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#64056 - estebank:arbitrary-self-types, r=Ce…
…ntril Account for arbitrary self types in E0599 Fix rust-lang#62373
- Loading branch information
Showing
11 changed files
with
148 additions
and
26 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
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,9 @@ | ||
struct A; | ||
|
||
impl A { | ||
fn foo(self: Box<Self>) {} | ||
} | ||
|
||
fn main() { | ||
A.foo(); //~ ERROR E0599 | ||
} |
15 changes: 15 additions & 0 deletions
15
src/test/ui/self/point-at-arbitrary-self-type-method.stderr
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 @@ | ||
error[E0599]: no method named `foo` found for type `A` in the current scope | ||
--> $DIR/point-at-arbitrary-self-type-method.rs:8:7 | ||
| | ||
LL | struct A; | ||
| --------- method `foo` not found for this | ||
... | ||
LL | fn foo(self: Box<Self>) {} | ||
| --- the method is available for `std::boxed::Box<A>` here | ||
... | ||
LL | A.foo(); | ||
| ^^^ | ||
|
||
error: aborting due to previous error | ||
|
||
For more information about this error, try `rustc --explain E0599`. |
10 changes: 10 additions & 0 deletions
10
src/test/ui/self/point-at-arbitrary-self-type-trait-method.rs
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,10 @@ | ||
trait B { fn foo(self: Box<Self>); } | ||
struct A; | ||
|
||
impl B for A { | ||
fn foo(self: Box<Self>) {} | ||
} | ||
|
||
fn main() { | ||
A.foo() //~ ERROR E0599 | ||
} |
18 changes: 18 additions & 0 deletions
18
src/test/ui/self/point-at-arbitrary-self-type-trait-method.stderr
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[E0599]: no method named `foo` found for type `A` in the current scope | ||
--> $DIR/point-at-arbitrary-self-type-trait-method.rs:9:7 | ||
| | ||
LL | trait B { fn foo(self: Box<Self>); } | ||
| --- the method is available for `std::boxed::Box<A>` here | ||
LL | struct A; | ||
| --------- method `foo` not found for this | ||
... | ||
LL | A.foo() | ||
| ^^^ | ||
| | ||
= help: items from traits can only be used if the trait is implemented and in scope | ||
= note: the following trait defines an item `foo`, perhaps you need to implement it: | ||
candidate #1: `B` | ||
|
||
error: aborting due to previous error | ||
|
||
For more information about this error, try `rustc --explain E0599`. |
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