-
Notifications
You must be signed in to change notification settings - Fork 13k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Poison check_well_formed if method receivers are invalid to prevent typeck from running on it #117403
Merged
bors
merged 1 commit into
rust-lang:master
from
oli-obk:the_gift_that_keeps_on_giving_116849
Oct 30, 2023
+41
−17
Merged
Poison check_well_formed if method receivers are invalid to prevent typeck from running on it #117403
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note that this causes any method receiver errors to prevent the trait solver from emitting any errors below