Skip to content

Commit 48dde00

Browse files
committed
Use more accurate span in resolve_ident_in_lexical_scope
1 parent 4af32ca commit 48dde00

File tree

9 files changed

+15
-15
lines changed

9 files changed

+15
-15
lines changed

compiler/rustc_resolve/src/ident.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -326,7 +326,7 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> {
326326
i,
327327
rib_ident,
328328
*res,
329-
finalize.map(|finalize| finalize.path_span),
329+
finalize.map(|_| general_span),
330330
*original_rib_ident_def,
331331
ribs,
332332
diag_metadata,

tests/ui/associated-item/associated-item-duplicate-bounds.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ error: generic parameters may not be used in const operations
22
--> $DIR/associated-item-duplicate-bounds.rs:7:18
33
|
44
LL | links: [u32; A::LINKS], // Shouldn't suggest bounds already there.
5-
| ^^^^^^^^ cannot perform const operation using `A`
5+
| ^ cannot perform const operation using `A`
66
|
77
= note: type parameters may not be used in const expressions
88
= help: add `#![feature(generic_const_exprs)]` to allow generic const expressions

tests/ui/delegation/target-expr.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ LL | reuse Trait::static_method {
77
| ------------- generic parameter used in this inner delegated function
88
LL |
99
LL | let _ = T::Default();
10-
| ^^^^^^^^^^ use of generic parameter from outer item
10+
| ^ use of generic parameter from outer item
1111

1212
error[E0434]: can't capture dynamic environment in a fn item
1313
--> $DIR/target-expr.rs:26:17

tests/ui/generics/invalid-type-param-default.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ error[E0128]: generic parameter defaults cannot reference parameters before they
22
--> $DIR/invalid-type-param-default.rs:12:12
33
|
44
LL | fn mdn<T = T::Item>(_: T) {}
5-
| ^^^^^^^ cannot reference `T` before it is declared
5+
| ^ cannot reference `T` before it is declared
66

77
error: defaults for generic parameters are not allowed here
88
--> $DIR/invalid-type-param-default.rs:7:8

tests/ui/resolve/generic-params-from-outer-item-in-const-item.default.stderr

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ error[E0401]: can't use generic parameters from outer item
44
LL | fn outer<T: Tr>() { // outer function
55
| - type parameter from outer item
66
LL | const K: u32 = T::C;
7-
| - ^^^^ use of generic parameter from outer item
7+
| - ^ use of generic parameter from outer item
88
| |
99
| generic parameter used in this inner constant item
1010
|
@@ -17,7 +17,7 @@ LL | impl<T> Tr for T { // outer impl block
1717
| - type parameter from outer item
1818
LL | const C: u32 = {
1919
LL | const I: u32 = T::C;
20-
| - ^^^^ use of generic parameter from outer item
20+
| - ^ use of generic parameter from outer item
2121
| |
2222
| generic parameter used in this inner constant item
2323
|
@@ -29,7 +29,7 @@ error[E0401]: can't use generic parameters from outer item
2929
LL | struct S<T: Tr>(U32<{ // outer struct
3030
| - type parameter from outer item
3131
LL | const _: u32 = T::C;
32-
| - ^^^^ use of generic parameter from outer item
32+
| - ^ use of generic parameter from outer item
3333
| |
3434
| generic parameter used in this inner constant item
3535
|

tests/ui/resolve/generic-params-from-outer-item-in-const-item.generic_const_items.stderr

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ error[E0401]: can't use generic parameters from outer item
44
LL | fn outer<T: Tr>() { // outer function
55
| - type parameter from outer item
66
LL | const K: u32 = T::C;
7-
| - ^^^^ use of generic parameter from outer item
7+
| - ^ use of generic parameter from outer item
88
| |
99
| generic parameter used in this inner constant item
1010
|
@@ -21,7 +21,7 @@ LL | impl<T> Tr for T { // outer impl block
2121
| - type parameter from outer item
2222
LL | const C: u32 = {
2323
LL | const I: u32 = T::C;
24-
| - ^^^^ use of generic parameter from outer item
24+
| - ^ use of generic parameter from outer item
2525
| |
2626
| generic parameter used in this inner constant item
2727
|
@@ -37,7 +37,7 @@ error[E0401]: can't use generic parameters from outer item
3737
LL | struct S<T: Tr>(U32<{ // outer struct
3838
| - type parameter from outer item
3939
LL | const _: u32 = T::C;
40-
| - ^^^^ use of generic parameter from outer item
40+
| - ^ use of generic parameter from outer item
4141
| |
4242
| generic parameter used in this inner constant item
4343
|

tests/ui/resolve/issue-39559.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ error: generic parameters may not be used in const operations
22
--> $DIR/issue-39559.rs:14:18
33
|
44
LL | entries: [T; D::dim()],
5-
| ^^^^^^ cannot perform const operation using `D`
5+
| ^ cannot perform const operation using `D`
66
|
77
= note: type parameters may not be used in const expressions
88
= help: add `#![feature(generic_const_exprs)]` to allow generic const expressions

tests/ui/resolve/use-self-in-inner-fn.stderr

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,12 +25,12 @@ LL | fn inner() {
2525
| ----- `Self` used in this inner function
2626
LL |
2727
LL | Self::do_something(move || {});
28-
| ^^^^^^^^^^^^^^^^^^ use of `Self` from outer item
28+
| ^^^^ use of `Self` from outer item
2929
|
3030
help: refer to the type directly here instead
3131
|
3232
LL - Self::do_something(move || {});
33-
LL + MyEnum(move || {});
33+
LL + MyEnum::do_something(move || {});
3434
|
3535

3636
error: aborting due to 2 previous errors

tests/ui/type/pattern_types/assoc_const.default.stderr

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ error: generic parameters may not be used in const operations
2020
--> $DIR/assoc_const.rs:20:40
2121
|
2222
LL | fn bar<T: Foo>(_: pattern_type!(u32 is T::START..=T::END)) {}
23-
| ^^^^^^^^ cannot perform const operation using `T`
23+
| ^ cannot perform const operation using `T`
2424
|
2525
= note: type parameters may not be used in const expressions
2626
= 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
2929
--> $DIR/assoc_const.rs:20:51
3030
|
3131
LL | fn bar<T: Foo>(_: pattern_type!(u32 is T::START..=T::END)) {}
32-
| ^^^^^^ cannot perform const operation using `T`
32+
| ^ cannot perform const operation using `T`
3333
|
3434
= note: type parameters may not be used in const expressions
3535
= help: add `#![feature(generic_const_exprs)]` to allow generic const expressions

0 commit comments

Comments
 (0)