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#105747 - chenyukang:yukang/fix-105732-auto-…
…trait, r=compiler-errors Fix ICE calling method on auto trait Fixes rust-lang#105732 r? `@compiler-errors`
- Loading branch information
Showing
3 changed files
with
51 additions
and
0 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,13 @@ | ||
#![feature(auto_traits)] | ||
|
||
auto trait Foo { | ||
fn g(&self); //~ ERROR auto traits cannot have associated items | ||
} | ||
|
||
trait Bar { | ||
fn f(&self) { | ||
self.g(); //~ ERROR the method `g` exists for reference `&Self`, but its trait bounds were not satisfied | ||
} | ||
} | ||
|
||
fn main() {} |
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,28 @@ | ||
error[E0380]: auto traits cannot have associated items | ||
--> $DIR/issue-105732.rs:4:8 | ||
| | ||
LL | auto trait Foo { | ||
| --- auto trait cannot have associated items | ||
LL | fn g(&self); | ||
| ---^-------- help: remove these associated items | ||
|
||
error[E0599]: the method `g` exists for reference `&Self`, but its trait bounds were not satisfied | ||
--> $DIR/issue-105732.rs:9:14 | ||
| | ||
LL | self.g(); | ||
| ^ | ||
| | ||
= note: the following trait bounds were not satisfied: | ||
`Self: Foo` | ||
which is required by `&Self: Foo` | ||
`&Self: Foo` | ||
= help: items from traits can only be used if the type parameter is bounded by the trait | ||
help: the following trait defines an item `g`, perhaps you need to add a supertrait for it: | ||
| | ||
LL | trait Bar: Foo { | ||
| +++++ | ||
|
||
error: aborting due to 2 previous errors | ||
|
||
Some errors have detailed explanations: E0380, E0599. | ||
For more information about an error, try `rustc --explain E0380`. |