-
Notifications
You must be signed in to change notification settings - Fork 12.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Poison check_well_formed if method receivers are invalid to prevent t…
…ypeck from running on it
- Loading branch information
Showing
4 changed files
with
42 additions
and
17 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
13 changes: 13 additions & 0 deletions
13
tests/ui/self/arbitrary-self-from-method-substs.default.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,13 @@ | ||
error[E0658]: `R` cannot be used as the type of `self` without the `arbitrary_self_types` feature | ||
--> $DIR/arbitrary-self-from-method-substs.rs:8:43 | ||
| | ||
LL | fn get<R: Deref<Target = Self>>(self: R) -> u32 { | ||
| ^ | ||
| | ||
= note: see issue #44874 <https://github.com/rust-lang/rust/issues/44874> for more information | ||
= help: add `#![feature(arbitrary_self_types)]` to the crate attributes to enable | ||
= help: consider changing to `self`, `&self`, `&mut self`, `self: Box<Self>`, `self: Rc<Self>`, `self: Arc<Self>`, or `self: Pin<P>` (where P is one of the previous types except `Self`) | ||
|
||
error: aborting due to previous error | ||
|
||
For more information about this error, try `rustc --explain E0658`. |
2 changes: 1 addition & 1 deletion
2
.../arbitrary-self-from-method-substs.stderr → ...ry-self-from-method-substs.feature.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
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 |
---|---|---|
@@ -1,16 +1,18 @@ | ||
#![feature(arbitrary_self_types)] | ||
// revisions: default feature | ||
#![cfg_attr(feature, feature(arbitrary_self_types))] | ||
|
||
use std::ops::Deref; | ||
|
||
struct Foo(u32); | ||
impl Foo { | ||
fn get<R: Deref<Target=Self>>(self: R) -> u32 { | ||
fn get<R: Deref<Target = Self>>(self: R) -> u32 { | ||
//[default]~^ ERROR: `R` cannot be used as the type of `self` | ||
self.0 | ||
} | ||
} | ||
|
||
fn main() { | ||
let mut foo = Foo(1); | ||
foo.get::<&Foo>(); | ||
//~^ ERROR mismatched types | ||
//[feature]~^ ERROR mismatched types | ||
} |