Skip to content

Commit

Permalink
Experiment with not using inline suggestions
Browse files Browse the repository at this point in the history
  • Loading branch information
estebank committed Jul 3, 2024
1 parent 2495953 commit 95e271a
Show file tree
Hide file tree
Showing 414 changed files with 4,810 additions and 2,134 deletions.
2 changes: 1 addition & 1 deletion compiler/rustc_errors/src/diagnostic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -974,7 +974,7 @@ impl<'a, G: EmissionGuarantee> Diag<'a, G> {
msg,
suggestion,
applicability,
SuggestionStyle::ShowCode,
SuggestionStyle::ShowAlways,
);
self
} }
Expand Down
9 changes: 6 additions & 3 deletions tests/ui/argument-suggestions/issue-100154.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,19 @@ error[E0107]: function takes 0 generic arguments but 1 generic argument was supp
--> $DIR/issue-100154.rs:4:5
|
LL | foo::<()>(());
| ^^^------ help: remove these generics
| |
| expected 0 generic arguments
| ^^^ expected 0 generic arguments
|
note: function defined here, with 0 generic parameters
--> $DIR/issue-100154.rs:1:4
|
LL | fn foo(i: impl std::fmt::Display) {}
| ^^^
= note: `impl Trait` cannot be explicitly specified as a generic argument
help: remove these generics
|
LL - foo::<()>(());
LL + foo(());
|

error[E0277]: `()` doesn't implement `std::fmt::Display`
--> $DIR/issue-100154.rs:4:11
Expand Down
7 changes: 6 additions & 1 deletion tests/ui/argument-suggestions/issue-109831.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,12 @@ LL | struct A;
| --------- similarly named unit struct `A` defined here
...
LL | f(A, A, B, C);
| ^ help: a unit struct with a similar name exists: `A`
| ^
|
help: a unit struct with a similar name exists
|
LL | f(A, A, B, A);
| ~

error[E0061]: this function takes 3 arguments but 4 arguments were supplied
--> $DIR/issue-109831.rs:7:5
Expand Down
42 changes: 35 additions & 7 deletions tests/ui/array-slice-vec/suggest-array-length.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -44,71 +44,99 @@ error[E0658]: using `_` for array lengths is unstable
--> $DIR/suggest-array-length.rs:5:22
|
LL | const Foo: [i32; _] = [1, 2, 3];
| ^ help: consider specifying the array length: `3`
| ^
|
= note: see issue #85077 <https://github.com/rust-lang/rust/issues/85077> for more information
= help: add `#![feature(generic_arg_infer)]` to the crate attributes to enable
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
help: consider specifying the array length
|
LL | const Foo: [i32; 3] = [1, 2, 3];
| ~

error[E0658]: using `_` for array lengths is unstable
--> $DIR/suggest-array-length.rs:8:26
|
LL | const REF_FOO: &[u8; _] = &[1];
| ^ help: consider specifying the array length: `1`
| ^
|
= note: see issue #85077 <https://github.com/rust-lang/rust/issues/85077> for more information
= help: add `#![feature(generic_arg_infer)]` to the crate attributes to enable
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
help: consider specifying the array length
|
LL | const REF_FOO: &[u8; 1] = &[1];
| ~

error[E0658]: using `_` for array lengths is unstable
--> $DIR/suggest-array-length.rs:11:20
|
LL | let foo: [i32; _] = [1, 2, 3];
| ^ help: consider specifying the array length: `3`
| ^
|
= note: see issue #85077 <https://github.com/rust-lang/rust/issues/85077> for more information
= help: add `#![feature(generic_arg_infer)]` to the crate attributes to enable
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
help: consider specifying the array length
|
LL | let foo: [i32; 3] = [1, 2, 3];
| ~

error[E0658]: using `_` for array lengths is unstable
--> $DIR/suggest-array-length.rs:14:20
|
LL | let bar: [i32; _] = [0; 3];
| ^ help: consider specifying the array length: `3`
| ^
|
= note: see issue #85077 <https://github.com/rust-lang/rust/issues/85077> for more information
= help: add `#![feature(generic_arg_infer)]` to the crate attributes to enable
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
help: consider specifying the array length
|
LL | let bar: [i32; 3] = [0; 3];
| ~

error[E0658]: using `_` for array lengths is unstable
--> $DIR/suggest-array-length.rs:17:25
|
LL | let ref_foo: &[i32; _] = &[1, 2, 3];
| ^ help: consider specifying the array length: `3`
| ^
|
= note: see issue #85077 <https://github.com/rust-lang/rust/issues/85077> for more information
= help: add `#![feature(generic_arg_infer)]` to the crate attributes to enable
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
help: consider specifying the array length
|
LL | let ref_foo: &[i32; 3] = &[1, 2, 3];
| ~

error[E0658]: using `_` for array lengths is unstable
--> $DIR/suggest-array-length.rs:20:25
|
LL | let ref_bar: &[i32; _] = &[0; 3];
| ^ help: consider specifying the array length: `3`
| ^
|
= note: see issue #85077 <https://github.com/rust-lang/rust/issues/85077> for more information
= help: add `#![feature(generic_arg_infer)]` to the crate attributes to enable
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
help: consider specifying the array length
|
LL | let ref_bar: &[i32; 3] = &[0; 3];
| ~

error[E0658]: using `_` for array lengths is unstable
--> $DIR/suggest-array-length.rs:23:35
|
LL | let multiple_ref_foo: &&[i32; _] = &&[1, 2, 3];
| ^ help: consider specifying the array length: `3`
| ^
|
= note: see issue #85077 <https://github.com/rust-lang/rust/issues/85077> for more information
= help: add `#![feature(generic_arg_infer)]` to the crate attributes to enable
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
help: consider specifying the array length
|
LL | let multiple_ref_foo: &&[i32; 3] = &&[1, 2, 3];
| ~

error: aborting due to 14 previous errors

Expand Down
8 changes: 5 additions & 3 deletions tests/ui/assign-imm-local-twice.stderr
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
error[E0384]: cannot assign twice to immutable variable `v`
--> $DIR/assign-imm-local-twice.rs:7:5
|
LL | let v: isize;
| - help: consider making this binding mutable: `mut v`
...
LL | v = 1;
| ----- first assignment to `v`
LL | println!("v={}", v);
LL | v = 2;
| ^^^^^ cannot assign twice to immutable variable
|
help: consider making this binding mutable
|
LL | let mut v: isize;
| ~~~~~

error: aborting due to 1 previous error

Expand Down
20 changes: 12 additions & 8 deletions tests/ui/associated-item/issue-87638.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,12 @@ LL | type Target;
| ------------ associated type `Target` defined here
...
LL | let _: <S as Trait>::Output;
| ^^^^^^
| |
| not found in `Trait`
| help: maybe you meant this associated type: `Target`
| ^^^^^^ not found in `Trait`
|
help: maybe you meant this associated type
|
LL | let _: <S as Trait>::Target;
| ~~~~~~

error[E0576]: cannot find method or associated constant `BAR` in trait `Trait`
--> $DIR/issue-87638.rs:20:27
Expand All @@ -17,10 +19,12 @@ LL | const FOO: usize;
| ----------------- associated constant `FOO` defined here
...
LL | let _ = <S as Trait>::BAR;
| ^^^
| |
| not found in `Trait`
| help: maybe you meant this associated constant: `FOO`
| ^^^ not found in `Trait`
|
help: maybe you meant this associated constant
|
LL | let _ = <S as Trait>::FOO;
| ~~~

error: aborting due to 2 previous errors

Expand Down
18 changes: 10 additions & 8 deletions tests/ui/associated-types/defaults-specialization.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,7 @@ error[E0053]: method `make` has an incompatible type for trait
--> $DIR/defaults-specialization.rs:19:18
|
LL | fn make() -> u8 { 0 }
| ^^
| |
| expected associated type, found `u8`
| help: change the output type to match the trait: `<A<T> as Tr>::Ty`
| ^^ expected associated type, found `u8`
|
note: type in trait
--> $DIR/defaults-specialization.rs:9:18
Expand All @@ -24,6 +21,10 @@ LL | fn make() -> Self::Ty {
| ^^^^^^^^
= note: expected signature `fn() -> <A<T> as Tr>::Ty`
found signature `fn() -> u8`
help: change the output type to match the trait
|
LL | fn make() -> <A<T> as Tr>::Ty { 0 }
| ~~~~~~~~~~~~~~~~

error[E0053]: method `make` has an incompatible type for trait
--> $DIR/defaults-specialization.rs:35:18
Expand All @@ -32,10 +33,7 @@ LL | default type Ty = bool;
| ----------------------- associated type is `default` and may be overridden
LL |
LL | fn make() -> bool { true }
| ^^^^
| |
| expected associated type, found `bool`
| help: change the output type to match the trait: `<B<T> as Tr>::Ty`
| ^^^^ expected associated type, found `bool`
|
note: type in trait
--> $DIR/defaults-specialization.rs:9:18
Expand All @@ -44,6 +42,10 @@ LL | fn make() -> Self::Ty {
| ^^^^^^^^
= note: expected signature `fn() -> <B<T> as Tr>::Ty`
found signature `fn() -> bool`
help: change the output type to match the trait
|
LL | fn make() -> <B<T> as Tr>::Ty { true }
| ~~~~~~~~~~~~~~~~

error[E0308]: mismatched types
--> $DIR/defaults-specialization.rs:10:9
Expand Down
10 changes: 6 additions & 4 deletions tests/ui/associated-types/issue-19883.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,12 @@ LL | type Output;
| ------------ associated type `Output` defined here
...
LL | <Dst as From<Self>>::Dst
| ^^^
| |
| not found in `From`
| help: maybe you meant this associated type: `Output`
| ^^^ not found in `From`
|
help: maybe you meant this associated type
|
LL | <Dst as From<Self>>::Output
| ~~~~~~

error: aborting due to 1 previous error

Expand Down
10 changes: 6 additions & 4 deletions tests/ui/associated-types/issue-22037.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,12 @@ error[E0576]: cannot find associated type `X` in trait `A`
LL | type Output;
| ------------ associated type `Output` defined here
LL | fn a(&self) -> <Self as A>::X;
| ^
| |
| not found in `A`
| help: maybe you meant this associated type: `Output`
| ^ not found in `A`
|
help: maybe you meant this associated type
|
LL | fn a(&self) -> <Self as A>::Output;
| ~~~~~~

error: aborting due to 1 previous error

Expand Down
12 changes: 10 additions & 2 deletions tests/ui/associated-types/issue-22560.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,13 @@ LL | trait Add<Rhs=Self> {
| ------------------- type parameter `Rhs` must be specified for this
...
LL | type Test = dyn Add + Sub;
| ^^^ help: set the type parameter to the desired type: `Add<Rhs>`
| ^^^
|
= note: because of the default `Self` reference, type parameters must be specified on object types
help: set the type parameter to the desired type
|
LL | type Test = dyn Add<Rhs> + Sub;
| ~~~~~~~~

error[E0393]: the type parameter `Rhs` must be explicitly specified
--> $DIR/issue-22560.rs:9:23
Expand All @@ -46,9 +50,13 @@ LL | trait Sub<Rhs=Self> {
| ------------------- type parameter `Rhs` must be specified for this
...
LL | type Test = dyn Add + Sub;
| ^^^ help: set the type parameter to the desired type: `Sub<Rhs>`
| ^^^
|
= note: because of the default `Self` reference, type parameters must be specified on object types
help: set the type parameter to the desired type
|
LL | type Test = dyn Add + Sub<Rhs>;
| ~~~~~~~~

error: aborting due to 4 previous errors

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,16 @@ error[E0277]: `[usize; usize::MAX]` is not a future
--> $DIR/debug-ice-attempted-to-add-with-overflow.rs:8:37
|
LL | [0usize; 0xffff_ffff_ffff_ffff].await;
| -^^^^^
| ||
| |`[usize; usize::MAX]` is not a future
| help: remove the `.await`
| ^^^^^ `[usize; usize::MAX]` is not a future
|
= help: the trait `Future` is not implemented for `[usize; usize::MAX]`, which is required by `[usize; usize::MAX]: IntoFuture`
= note: [usize; usize::MAX] must be a future or must implement `IntoFuture` to be awaited
= note: required for `[usize; usize::MAX]` to implement `IntoFuture`
help: remove the `.await`
|
LL - [0usize; 0xffff_ffff_ffff_ffff].await;
LL + [0usize; 0xffff_ffff_ffff_ffff];
|

error[E0752]: `main` function is not allowed to be `async`
--> $DIR/debug-ice-attempted-to-add-with-overflow.rs:6:1
Expand Down
10 changes: 6 additions & 4 deletions tests/ui/async-await/drop-track-bad-field-in-fru.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,16 @@ error[E0277]: `Option<_>` is not a future
--> $DIR/drop-track-bad-field-in-fru.rs:6:46
|
LL | None { value: (), ..Default::default() }.await;
| -^^^^^
| ||
| |`Option<_>` is not a future
| help: remove the `.await`
| ^^^^^ `Option<_>` is not a future
|
= help: the trait `Future` is not implemented for `Option<_>`, which is required by `Option<_>: IntoFuture`
= note: Option<_> must be a future or must implement `IntoFuture` to be awaited
= note: required for `Option<_>` to implement `IntoFuture`
help: remove the `.await`
|
LL - None { value: (), ..Default::default() }.await;
LL + None { value: (), ..Default::default() };
|

error: aborting due to 2 previous errors

Expand Down
10 changes: 6 additions & 4 deletions tests/ui/async-await/in-trait/bad-signatures.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,12 @@ error: expected one of `:`, `@`, or `|`, found keyword `self`
--> $DIR/bad-signatures.rs:5:23
|
LL | async fn bar(&abc self);
| -----^^^^
| | |
| | expected one of `:`, `@`, or `|`
| help: declare the type after the parameter binding: `<identifier>: <type>`
| ^^^^ expected one of `:`, `@`, or `|`
|
help: declare the type after the parameter binding
|
LL | async fn bar(<identifier>: <type>);
| ~~~~~~~~~~~~~~~~~~~~

error: aborting due to 2 previous errors

10 changes: 6 additions & 4 deletions tests/ui/async-await/issue-101715.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,16 @@ error[E0277]: `()` is not a future
--> $DIR/issue-101715.rs:11:10
|
LL | .await
| -^^^^^
| ||
| |`()` is not a future
| help: remove the `.await`
| ^^^^^ `()` is not a future
|
= help: the trait `Future` is not implemented for `()`, which is required by `(): IntoFuture`
= note: () must be a future or must implement `IntoFuture` to be awaited
= note: required for `()` to implement `IntoFuture`
help: remove the `.await`
|
LL - .await
LL +
|

error: aborting due to 1 previous error

Expand Down
Loading

0 comments on commit 95e271a

Please sign in to comment.