-
Notifications
You must be signed in to change notification settings - Fork 13k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Auto merge of #104334 - compiler-errors:ufcs-sugg-wrong-def-id, r=est…
…ebank Use impl's def id when calculating type to specify in UFCS Fixes #104327 Fixes #104328 Also addresses #102670 (comment)
- Loading branch information
Showing
8 changed files
with
75 additions
and
11 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
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,12 @@ | ||
trait Bar {} | ||
|
||
trait Foo { | ||
fn f() {} | ||
} | ||
|
||
impl Foo for dyn Bar {} | ||
|
||
fn main() { | ||
Foo::f(); | ||
//~^ ERROR cannot call associated function on trait without specifying the corresponding `impl` type | ||
} |
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,17 @@ | ||
error[E0790]: cannot call associated function on trait without specifying the corresponding `impl` type | ||
--> $DIR/issue-104327.rs:10:5 | ||
| | ||
LL | fn f() {} | ||
| --------- `Foo::f` defined here | ||
... | ||
LL | Foo::f(); | ||
| ^^^^^^ cannot call associated function of trait | ||
| | ||
help: use the fully-qualified path to the only available implementation | ||
| | ||
LL | <(dyn Bar + 'static) as Foo>::f(); | ||
| +++++++++++++++++++++++ + | ||
|
||
error: aborting due to previous error | ||
|
||
For more information about this error, try `rustc --explain E0790`. |
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,12 @@ | ||
#![feature(object_safe_for_dispatch)] | ||
|
||
trait Foo { | ||
fn f() {} | ||
} | ||
|
||
impl Foo for dyn Sized {} | ||
|
||
fn main() { | ||
Foo::f(); | ||
//~^ ERROR cannot call associated function on trait without specifying the corresponding `impl` type | ||
} |
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,17 @@ | ||
error[E0790]: cannot call associated function on trait without specifying the corresponding `impl` type | ||
--> $DIR/issue-104328.rs:10:5 | ||
| | ||
LL | fn f() {} | ||
| --------- `Foo::f` defined here | ||
... | ||
LL | Foo::f(); | ||
| ^^^^^^ cannot call associated function of trait | ||
| | ||
help: use the fully-qualified path to the only available implementation | ||
| | ||
LL | <(dyn Sized + 'static) as Foo>::f(); | ||
| +++++++++++++++++++++++++ + | ||
|
||
error: aborting due to previous error | ||
|
||
For more information about this error, try `rustc --explain E0790`. |
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