Rollup merge of #103111 - cjgillot:shadow-label, r=estebank
Account for hygiene in typo suggestions, and use them to point to shadowed names Fixes https://github.com/rust-lang/rust/issues/97459 r? `@estebank`
This commit is contained in:
commit
41a1cfdbaf
9 changed files with 102 additions and 32 deletions
|
|
@ -1,9 +1,16 @@
|
|||
error[E0425]: cannot find function `f` in this scope
|
||||
--> $DIR/globs.rs:22:9
|
||||
|
|
||||
LL | pub fn g() {}
|
||||
| ---------- similarly named function `g` defined here
|
||||
...
|
||||
LL | f();
|
||||
| ^ not found in this scope
|
||||
| ^
|
||||
|
|
||||
help: a function with a similar name exists
|
||||
|
|
||||
LL | g();
|
||||
| ~
|
||||
help: consider importing this function
|
||||
|
|
||||
LL | use foo::f;
|
||||
|
|
@ -12,8 +19,11 @@ LL | use foo::f;
|
|||
error[E0425]: cannot find function `g` in this scope
|
||||
--> $DIR/globs.rs:15:5
|
||||
|
|
||||
LL | pub fn f() {}
|
||||
| ---------- similarly named function `f` defined here
|
||||
...
|
||||
LL | g();
|
||||
| ^ not found in this scope
|
||||
| ^
|
||||
...
|
||||
LL | / m! {
|
||||
LL | | use bar::*;
|
||||
|
|
@ -23,6 +33,10 @@ LL | | }
|
|||
| |_____- in this macro invocation
|
||||
|
|
||||
= note: this error originates in the macro `m` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
help: a function with a similar name exists
|
||||
|
|
||||
LL | f();
|
||||
| ~
|
||||
help: consider importing this function
|
||||
|
|
||||
LL | use bar::g;
|
||||
|
|
|
|||
|
|
@ -19,14 +19,8 @@ LL | semitransparent;
|
|||
error[E0423]: expected value, found macro `opaque`
|
||||
--> $DIR/rustc-macro-transparency.rs:30:5
|
||||
|
|
||||
LL | struct Opaque;
|
||||
| -------------- similarly named unit struct `Opaque` defined here
|
||||
...
|
||||
LL | opaque;
|
||||
| ^^^^^^
|
||||
| |
|
||||
| not a value
|
||||
| help: a unit struct with a similar name exists (notice the capitalization): `Opaque`
|
||||
| ^^^^^^ not a value
|
||||
|
||||
error: aborting due to 3 previous errors
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,8 @@
|
|||
error[E0574]: expected struct, variant or union type, found type parameter `T`
|
||||
--> $DIR/lexical-scopes.rs:3:13
|
||||
|
|
||||
LL | struct T { i: i32 }
|
||||
| ------------------- you might have meant to refer to this struct
|
||||
LL | fn f<T>() {
|
||||
| - found this type parameter
|
||||
LL | let t = T { i: 0 };
|
||||
|
|
|
|||
|
|
@ -57,7 +57,7 @@ error[E0425]: cannot find value `i` in this scope
|
|||
--> $DIR/macro-context.rs:3:13
|
||||
|
|
||||
LL | () => ( i ; typeof );
|
||||
| ^ help: a local variable with a similar name exists: `a`
|
||||
| ^ not found in this scope
|
||||
...
|
||||
LL | let i = m!();
|
||||
| ---- in this macro invocation
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ error[E0425]: cannot find value `local_use` in this scope
|
|||
--> $DIR/gen-macro-rules-hygiene.rs:12:1
|
||||
|
|
||||
LL | gen_macro_rules!();
|
||||
| ^^^^^^^^^^^^^^^^^^ not found in this scope
|
||||
| ^^^^^^^^^^^^^^^^^^ help: a local variable with a similar name exists: `local_def`
|
||||
...
|
||||
LL | generated!();
|
||||
| ------------ in this macro invocation
|
||||
|
|
@ -24,7 +24,7 @@ error[E0425]: cannot find value `local_def` in this scope
|
|||
--> $DIR/gen-macro-rules-hygiene.rs:21:9
|
||||
|
|
||||
LL | local_def;
|
||||
| ^^^^^^^^^ not found in this scope
|
||||
| ^^^^^^^^^ help: a local variable with a similar name exists: `local_use`
|
||||
|
||||
error: aborting due to 3 previous errors
|
||||
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ error[E0425]: cannot find value `local_use` in this scope
|
|||
--> $DIR/mixed-site-span.rs:13:9
|
||||
|
|
||||
LL | proc_macro_rules!();
|
||||
| ^^^^^^^^^^^^^^^^^^^ not found in this scope
|
||||
| ^^^^^^^^^^^^^^^^^^^ help: a local variable with a similar name exists: `local_def`
|
||||
|
|
||||
= note: this error originates in the macro `proc_macro_rules` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
|
|
@ -18,7 +18,7 @@ error[E0425]: cannot find value `local_def` in this scope
|
|||
--> $DIR/mixed-site-span.rs:17:9
|
||||
|
|
||||
LL | local_def;
|
||||
| ^^^^^^^^^ not found in this scope
|
||||
| ^^^^^^^^^ help: a local variable with a similar name exists: `local_use`
|
||||
|
||||
error[E0412]: cannot find type `ItemUse` in crate `$crate`
|
||||
--> $DIR/mixed-site-span.rs:24:1
|
||||
|
|
|
|||
|
|
@ -1,11 +1,16 @@
|
|||
error[E0574]: expected struct, variant or union type, found type parameter `Baz`
|
||||
--> $DIR/point-at-type-parameter-shadowing-another-type.rs:16:13
|
||||
|
|
||||
LL | impl<Baz> Foo<Baz> for Bar {
|
||||
| --- found this type parameter
|
||||
LL | / struct Baz {
|
||||
LL | | num: usize,
|
||||
LL | | }
|
||||
| |_- you might have meant to refer to this struct
|
||||
LL |
|
||||
LL | impl<Baz> Foo<Baz> for Bar {
|
||||
| --- found this type parameter
|
||||
...
|
||||
LL | Baz { num } => num,
|
||||
| ^^^ not a struct, variant or union type
|
||||
LL | Baz { num } => num,
|
||||
| ^^^ not a struct, variant or union type
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue