forked from rust-lang/rust
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rollup merge of rust-lang#102421 - lyming2007:issue-101866, r=lcnr
remove the unused :: between trait and type to give user correct diag… …nostic information modified: compiler/rustc_trait_selection/src/traits/error_reporting/mod.rs new file: src/test/ui/type/issue-101866.rs new file: src/test/ui/type/issue-101866.stderr
- Loading branch information
Showing
3 changed files
with
47 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
trait TraitA<T> { | ||
fn func(); | ||
} | ||
|
||
struct StructA {} | ||
|
||
impl TraitA<i32> for StructA { | ||
fn func() {} | ||
} | ||
|
||
fn main() { | ||
TraitA::<i32>::func(); | ||
//~^ ERROR: cannot call associated function on trait without specifying the corresponding `impl` type [E0790] | ||
//~| help: use the fully-qualified path to the only available implementation | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
error[E0790]: cannot call associated function on trait without specifying the corresponding `impl` type | ||
--> $DIR/issue-101866.rs:12:5 | ||
| | ||
LL | fn func(); | ||
| ---------- `TraitA::func` defined here | ||
... | ||
LL | TraitA::<i32>::func(); | ||
| ^^^^^^^^^^^^^^^^^^^ cannot call associated function of trait | ||
| | ||
help: use the fully-qualified path to the only available implementation | ||
| | ||
LL - TraitA::<i32>::func(); | ||
LL + <::StructA as TraitA<i32>>::func(); | ||
| | ||
|
||
error: aborting due to previous error | ||
|
||
For more information about this error, try `rustc --explain E0790`. |