Use more accurate span in resolve_ident_in_lexical_scope

This commit is contained in:
Esteban Küber 2025-11-03 02:13:34 +00:00
parent 4af32ca72f
commit 48dde00f10
9 changed files with 15 additions and 15 deletions

View file

@ -326,7 +326,7 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> {
i,
rib_ident,
*res,
finalize.map(|finalize| finalize.path_span),
finalize.map(|_| general_span),
*original_rib_ident_def,
ribs,
diag_metadata,

View file

@ -2,7 +2,7 @@ error: generic parameters may not be used in const operations
--> $DIR/associated-item-duplicate-bounds.rs:7:18
|
LL | links: [u32; A::LINKS], // Shouldn't suggest bounds already there.
| ^^^^^^^^ cannot perform const operation using `A`
| ^ cannot perform const operation using `A`
|
= note: type parameters may not be used in const expressions
= help: add `#![feature(generic_const_exprs)]` to allow generic const expressions

View file

@ -7,7 +7,7 @@ LL | reuse Trait::static_method {
| ------------- generic parameter used in this inner delegated function
LL |
LL | let _ = T::Default();
| ^^^^^^^^^^ use of generic parameter from outer item
| ^ use of generic parameter from outer item
error[E0434]: can't capture dynamic environment in a fn item
--> $DIR/target-expr.rs:26:17

View file

@ -2,7 +2,7 @@ error[E0128]: generic parameter defaults cannot reference parameters before they
--> $DIR/invalid-type-param-default.rs:12:12
|
LL | fn mdn<T = T::Item>(_: T) {}
| ^^^^^^^ cannot reference `T` before it is declared
| ^ cannot reference `T` before it is declared
error: defaults for generic parameters are not allowed here
--> $DIR/invalid-type-param-default.rs:7:8

View file

@ -4,7 +4,7 @@ error[E0401]: can't use generic parameters from outer item
LL | fn outer<T: Tr>() { // outer function
| - type parameter from outer item
LL | const K: u32 = T::C;
| - ^^^^ use of generic parameter from outer item
| - ^ use of generic parameter from outer item
| |
| generic parameter used in this inner constant item
|
@ -17,7 +17,7 @@ LL | impl<T> Tr for T { // outer impl block
| - type parameter from outer item
LL | const C: u32 = {
LL | const I: u32 = T::C;
| - ^^^^ use of generic parameter from outer item
| - ^ use of generic parameter from outer item
| |
| generic parameter used in this inner constant item
|
@ -29,7 +29,7 @@ error[E0401]: can't use generic parameters from outer item
LL | struct S<T: Tr>(U32<{ // outer struct
| - type parameter from outer item
LL | const _: u32 = T::C;
| - ^^^^ use of generic parameter from outer item
| - ^ use of generic parameter from outer item
| |
| generic parameter used in this inner constant item
|

View file

@ -4,7 +4,7 @@ error[E0401]: can't use generic parameters from outer item
LL | fn outer<T: Tr>() { // outer function
| - type parameter from outer item
LL | const K: u32 = T::C;
| - ^^^^ use of generic parameter from outer item
| - ^ use of generic parameter from outer item
| |
| generic parameter used in this inner constant item
|
@ -21,7 +21,7 @@ LL | impl<T> Tr for T { // outer impl block
| - type parameter from outer item
LL | const C: u32 = {
LL | const I: u32 = T::C;
| - ^^^^ use of generic parameter from outer item
| - ^ use of generic parameter from outer item
| |
| generic parameter used in this inner constant item
|
@ -37,7 +37,7 @@ error[E0401]: can't use generic parameters from outer item
LL | struct S<T: Tr>(U32<{ // outer struct
| - type parameter from outer item
LL | const _: u32 = T::C;
| - ^^^^ use of generic parameter from outer item
| - ^ use of generic parameter from outer item
| |
| generic parameter used in this inner constant item
|

View file

@ -2,7 +2,7 @@ error: generic parameters may not be used in const operations
--> $DIR/issue-39559.rs:14:18
|
LL | entries: [T; D::dim()],
| ^^^^^^ cannot perform const operation using `D`
| ^ cannot perform const operation using `D`
|
= note: type parameters may not be used in const expressions
= help: add `#![feature(generic_const_exprs)]` to allow generic const expressions

View file

@ -25,12 +25,12 @@ LL | fn inner() {
| ----- `Self` used in this inner function
LL |
LL | Self::do_something(move || {});
| ^^^^^^^^^^^^^^^^^^ use of `Self` from outer item
| ^^^^ use of `Self` from outer item
|
help: refer to the type directly here instead
|
LL - Self::do_something(move || {});
LL + MyEnum(move || {});
LL + MyEnum::do_something(move || {});
|
error: aborting due to 2 previous errors

View file

@ -20,7 +20,7 @@ error: generic parameters may not be used in const operations
--> $DIR/assoc_const.rs:20:40
|
LL | fn bar<T: Foo>(_: pattern_type!(u32 is T::START..=T::END)) {}
| ^^^^^^^^ cannot perform const operation using `T`
| ^ cannot perform const operation using `T`
|
= note: type parameters may not be used in const expressions
= help: add `#![feature(generic_const_exprs)]` to allow generic const expressions
@ -29,7 +29,7 @@ error: generic parameters may not be used in const operations
--> $DIR/assoc_const.rs:20:51
|
LL | fn bar<T: Foo>(_: pattern_type!(u32 is T::START..=T::END)) {}
| ^^^^^^ cannot perform const operation using `T`
| ^ cannot perform const operation using `T`
|
= note: type parameters may not be used in const expressions
= help: add `#![feature(generic_const_exprs)]` to allow generic const expressions