Skip to content

Commit 8dea87d

Browse files
authored
Rollup merge of rust-lang#102670 - lyming2007:issue-101866-fix, r=compiler-errors
follow-up fix about 101866 to print the self type. modified: compiler/rustc_trait_selection/src/traits/error_reporting/mod.rs modified: src/test/ui/error-codes/E0283.stderr modified: src/test/ui/error-codes/E0790.stderr modified: src/test/ui/traits/static-method-generic-inference.stderr modified: src/test/ui/type/issue-101866.stderr
2 parents fd8be2c + 4f3b6ac commit 8dea87d

File tree

5 files changed

+16
-16
lines changed

5 files changed

+16
-16
lines changed

compiler/rustc_trait_selection/src/traits/error_reporting/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -2265,7 +2265,7 @@ impl<'a, 'tcx> InferCtxtPrivExt<'a, 'tcx> for InferCtxt<'a, 'tcx> {
22652265
};
22662266
let mut suggestions = vec![(
22672267
trait_path_segment.ident.span.shrink_to_lo(),
2268-
format!("<{} as ", self.tcx.def_path(impl_def_id).to_string_no_crate_verbose())
2268+
format!("<{} as ", self.tcx.type_of(impl_def_id))
22692269
)];
22702270
if let Some(generic_arg) = trait_path_segment.args {
22712271
let between_span = trait_path_segment.ident.span.between(generic_arg.span_ext);

src/test/ui/error-codes/E0283.stderr

+2-2
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ LL | let cont: u32 = Generator::create();
99
|
1010
help: use a fully-qualified path to a specific available implementation (2 found)
1111
|
12-
LL | let cont: u32 = <::Impl as Generator>::create();
13-
| ++++++++++ +
12+
LL | let cont: u32 = <Impl as Generator>::create();
13+
| ++++++++ +
1414

1515
error[E0283]: type annotations needed
1616
--> $DIR/E0283.rs:35:24

src/test/ui/error-codes/E0790.stderr

+10-10
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ LL | MyTrait::my_fn();
99
|
1010
help: use the fully-qualified path to the only available implementation
1111
|
12-
LL | <::inner::MyStruct as MyTrait>::my_fn();
13-
| +++++++++++++++++++++ +
12+
LL | <MyStruct as MyTrait>::my_fn();
13+
| ++++++++++++ +
1414

1515
error[E0790]: cannot refer to the associated constant on trait without specifying the corresponding `impl` type
1616
--> $DIR/E0790.rs:21:17
@@ -23,8 +23,8 @@ LL | let _ = MyTrait::MY_ASSOC_CONST;
2323
|
2424
help: use the fully-qualified path to the only available implementation
2525
|
26-
LL | let _ = <::inner::MyStruct as MyTrait>::MY_ASSOC_CONST;
27-
| +++++++++++++++++++++ +
26+
LL | let _ = <MyStruct as MyTrait>::MY_ASSOC_CONST;
27+
| ++++++++++++ +
2828

2929
error[E0790]: cannot call associated function on trait without specifying the corresponding `impl` type
3030
--> $DIR/E0790.rs:26:5
@@ -37,8 +37,8 @@ LL | inner::MyTrait::my_fn();
3737
|
3838
help: use the fully-qualified path to the only available implementation
3939
|
40-
LL | inner::<::inner::MyStruct as MyTrait>::my_fn();
41-
| +++++++++++++++++++++ +
40+
LL | inner::<MyStruct as MyTrait>::my_fn();
41+
| ++++++++++++ +
4242

4343
error[E0790]: cannot refer to the associated constant on trait without specifying the corresponding `impl` type
4444
--> $DIR/E0790.rs:30:13
@@ -51,8 +51,8 @@ LL | let _ = inner::MyTrait::MY_ASSOC_CONST;
5151
|
5252
help: use the fully-qualified path to the only available implementation
5353
|
54-
LL | let _ = inner::<::inner::MyStruct as MyTrait>::MY_ASSOC_CONST;
55-
| +++++++++++++++++++++ +
54+
LL | let _ = inner::<MyStruct as MyTrait>::MY_ASSOC_CONST;
55+
| ++++++++++++ +
5656

5757
error[E0790]: cannot call associated function on trait without specifying the corresponding `impl` type
5858
--> $DIR/E0790.rs:50:5
@@ -65,8 +65,8 @@ LL | MyTrait2::my_fn();
6565
|
6666
help: use a fully-qualified path to a specific available implementation (2 found)
6767
|
68-
LL | <::Impl1 as MyTrait2>::my_fn();
69-
| +++++++++++ +
68+
LL | <Impl1 as MyTrait2>::my_fn();
69+
| +++++++++ +
7070

7171
error: aborting due to 5 previous errors
7272

src/test/ui/traits/static-method-generic-inference.stderr

+2-2
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ LL | let _f: base::Foo = base::HasNew::new();
99
|
1010
help: use the fully-qualified path to the only available implementation
1111
|
12-
LL | let _f: base::Foo = base::<::base::Foo as HasNew>::new();
13-
| +++++++++++++++ +
12+
LL | let _f: base::Foo = base::<Foo as HasNew>::new();
13+
| +++++++ +
1414

1515
error: aborting due to previous error
1616

src/test/ui/type/issue-101866.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ LL | TraitA::<i32>::func();
1010
help: use the fully-qualified path to the only available implementation
1111
|
1212
LL - TraitA::<i32>::func();
13-
LL + <::StructA as TraitA<i32>>::func();
13+
LL + <StructA as TraitA<i32>>::func();
1414
|
1515

1616
error: aborting due to previous error

0 commit comments

Comments
 (0)