forked from rust-lang/rust
-
Notifications
You must be signed in to change notification settings - Fork 6
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#117403 - oli-obk:the_gift_that_keeps_on_giving_116849, r=compiler-errors Poison check_well_formed if method receivers are invalid to prevent typeck from running on it fixes rust-lang#117379 Though if some code invokes typeck without having first invoked `check_well_formed` then we'll encounter this ICE again. This can happen in const and const fn bodies if they are evaluated due to other `check_well_formed` checks or similar
- Loading branch information
Showing
4 changed files
with
41 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 | ||
} |