Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
18f8657
Pass -bnoipath when adding rust upstream dynamic crates
Aug 9, 2024
1ae1f8c
Clarify comment
daltenty Dec 6, 2024
61fd92e
Removed Unnecessary Spaces From RELEASES.md
rohit141914 Dec 6, 2024
5d8233e
Define acronym for thread local storage
Will-Low Dec 6, 2024
120d6b2
Fix: typo in E0751 error explanation
off019 Dec 7, 2024
ab2ee7a
Use option "-sf" for the AIX "ln" command.
xingxue-ibm Dec 6, 2024
f884f18
Move tests for `-l` and `#[link(..)]` into `tests/ui/link-native-libs`
Zalathar Dec 7, 2024
db9e368
Actually walk into lifetimes and attrs in EarlyContextAndPass
compiler-errors Dec 7, 2024
0a48b96
Move more tests into `tests/ui/link-native-libs`
Zalathar Dec 7, 2024
8aacd1c
compiletest: show the difference between the normalized output and th…
jyn514 Dec 2, 2024
9b07e75
Add allocate_bytes and refactor allocate_str in InterpCx for raw byte…
shamb0 Dec 4, 2024
68253e1
Don't suggest restricting bound with unstable traits on stable
estebank Nov 27, 2024
d13c348
reword trait bound suggestion message to include the bounds
estebank Nov 28, 2024
568b0ac
Add test for lack of suggestion in stable
estebank Nov 28, 2024
3f2a63a
Use trait name instead of full constraint in suggestion message
estebank Nov 28, 2024
d860e5b
Mention type parameter in more cases and don't suggest ~const bound a…
estebank Nov 28, 2024
cb4db0a
Account for `impl Trait` in "add bound" suggestion message
estebank Nov 28, 2024
af09423
fix rustdoc test
estebank Nov 28, 2024
b466405
Do not talk about "trait `<Foo = Bar>`"
estebank Nov 28, 2024
6277fb0
Use run-make `diff` output for stable output test
estebank Nov 29, 2024
25ad047
Tweak wording
estebank Dec 7, 2024
b9f68fe
Rollup merge of #133522 - estebank:dont-suggest-unstable-trait, r=com…
workingjubilee Dec 8, 2024
c8cb6d2
Rollup merge of #133733 - jyn514:compiletest-diffs, r=jieyouxu
workingjubilee Dec 8, 2024
13ea986
Rollup merge of #133861 - shamb0:refactor_InterpCx_allocate_str, r=Ra…
workingjubilee Dec 8, 2024
eca5d60
Rollup merge of #133967 - daltenty:daltenty/bnoipath, r=jieyouxu
workingjubilee Dec 8, 2024
43f7177
Rollup merge of #133976 - rohit141914:master, r=workingjubilee
workingjubilee Dec 8, 2024
7e014de
Rollup merge of #133980 - xingxue-ibm:ln-option-aix, r=jieyouxu
workingjubilee Dec 8, 2024
72938f6
Rollup merge of #133987 - Will-Low:DefineTlsAcronym, r=workingjubilee
workingjubilee Dec 8, 2024
a402cda
Rollup merge of #133992 - compiler-errors:walk-fully, r=jieyouxu
workingjubilee Dec 8, 2024
4cd5e64
Rollup merge of #133993 - LuanOldCode:fix-e0571-typo, r=compiler-errors
workingjubilee Dec 8, 2024
f47a3f3
Rollup merge of #133996 - Zalathar:ui-link-native-libs, r=jieyouxu
workingjubilee Dec 8, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Add test for lack of suggestion in stable
This test will break when `Step` gets stabilized, but punt until then.
  • Loading branch information
estebank committed Dec 7, 2024
commit 568b0ac624553150330f1cc3bbff9b99e5d358a2
4 changes: 2 additions & 2 deletions compiler/rustc_middle/src/ty/diagnostics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -488,7 +488,7 @@ pub fn suggest_constraining_type_params<'a>(
.into_iter()
.filter(|(span, _, _, _)| !span.in_derive_expansion())
.collect::<Vec<_>>();

let suggested = !suggestions.is_empty();
if suggestions.len() == 1 {
let (span, constraint, suggestion, msg) = suggestions.pop().unwrap();
let post = format!(
Expand Down Expand Up @@ -524,7 +524,7 @@ pub fn suggest_constraining_type_params<'a>(
);
}

true
suggested
}

/// Collect al types that have an implicit `'static` obligation that we could suggest `'_` for.
Expand Down
4 changes: 4 additions & 0 deletions tests/run-make/missing-unstable-trait-bound/missing-bound.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
pub fn baz<T>(t: std::ops::Range<T>) {
for _ in t {}
}
fn main() {}
22 changes: 22 additions & 0 deletions tests/run-make/missing-unstable-trait-bound/rmake.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
//@ only-linux
//@ ignore-wasm32
//@ ignore-wasm64
// ignore-tidy-linelength

// Ensure that on stable we don't suggest restricting with an unsafe trait and we continue
// mentioning the rest of the obligation chain.

use run_make_support::{rust_lib_name, rustc};

fn main() {
rustc()
.env("RUSTC_BOOTSTRAP", "-1")
.input("missing-bound.rs")
.run_fail()
.assert_stderr_not_contains("help: consider restricting type parameter `T`")
.assert_stderr_contains(
r#"
= note: required for `std::ops::Range<T>` to implement `Iterator`
= note: required for `std::ops::Range<T>` to implement `IntoIterator`"#,
);
}
6 changes: 5 additions & 1 deletion tests/ui/trait-bounds/unstable-trait-suggestion.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,11 @@ pub trait Unstable {}
fn foo<T: Unstable>(_: T) {}

#[stable(feature = "unit_test", since = "1.0.0")]
pub fn demo<T>(t: T) { //~ HELP consider restricting type parameter `T` with unstable trait `Unstable`
pub fn bar<T>(t: T) { //~ HELP consider restricting type parameter `T` with unstable trait `Unstable`
foo(t) //~ ERROR E0277
}
#[stable(feature = "unit_test", since = "1.0.0")]
pub fn baz<T>(t: std::ops::Range<T>) { //~ HELP consider restricting type parameter `T` with unstable trait
for _ in t {} //~ ERROR E0277
}
fn main() {}
19 changes: 16 additions & 3 deletions tests/ui/trait-bounds/unstable-trait-suggestion.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,22 @@ LL | fn foo<T: Unstable>(_: T) {}
| ^^^^^^^^ required by this bound in `foo`
help: consider restricting type parameter `T` with unstable trait `Unstable`
|
LL | pub fn demo<T: Unstable>(t: T) {
| ++++++++++
LL | pub fn bar<T: Unstable>(t: T) {
| ++++++++++

error: aborting due to 1 previous error
error[E0277]: the trait bound `T: Step` is not satisfied
--> $DIR/unstable-trait-suggestion.rs:17:14
|
LL | for _ in t {}
| ^ the trait `Step` is not implemented for `T`
|
= note: required for `std::ops::Range<T>` to implement `Iterator`
= note: required for `std::ops::Range<T>` to implement `IntoIterator`
help: consider restricting type parameter `T` with unstable trait `std::iter::Step`
|
LL | pub fn baz<T: std::iter::Step>(t: std::ops::Range<T>) {
| +++++++++++++++++

error: aborting due to 2 previous errors

For more information about this error, try `rustc --explain E0277`.