Navigation Menu

Skip to content

Commit

Permalink
Don't emit the feature error if it's an invalid self type
Browse files Browse the repository at this point in the history
  • Loading branch information
mikeyhew committed Nov 9, 2017
1 parent 5d170f0 commit ddc21d5
Show file tree
Hide file tree
Showing 4 changed files with 2 additions and 15 deletions.
2 changes: 1 addition & 1 deletion src/librustc_typeck/check/wfcheck.rs
Expand Up @@ -505,7 +505,7 @@ impl<'a, 'gcx> CheckTypeWellFormedVisitor<'a, 'gcx> {
.help("consider changing to `self`, `&self`, `&mut self`, or `self: Box<Self>`")
.code(DiagnosticId::Error("E0307".into()))
.emit();
break
return
}
}

Expand Down
1 change: 0 additions & 1 deletion src/test/compile-fail/issue-26194.rs
Expand Up @@ -13,7 +13,6 @@ struct S(String);
impl S {
fn f(self: *mut S) -> String { self.0 }
//~^ ERROR invalid `self` type
//~| ERROR arbitrary `self` types are unstable
}

fn main() { S("".to_owned()).f(); }
3 changes: 0 additions & 3 deletions src/test/compile-fail/ufcs-explicit-self-bad.rs
Expand Up @@ -17,7 +17,6 @@ struct Foo {
impl Foo {
fn foo(self: isize, x: isize) -> isize {
//~^ ERROR invalid `self` type
//~| ERROR arbitrary `self` types are unstable
self.f + x
}
}
Expand All @@ -29,12 +28,10 @@ struct Bar<T> {
impl<T> Bar<T> {
fn foo(self: Bar<isize>, x: isize) -> isize {
//~^ ERROR invalid `self` type
//~| ERROR arbitrary `self` types are unstable
x
}
fn bar(self: &Bar<usize>, x: isize) -> isize {
//~^ ERROR invalid `self` type
//~| ERROR arbitrary `self` types are unstable
x
}
}
Expand Down
11 changes: 1 addition & 10 deletions src/test/ui/span/issue-27522.stderr
Expand Up @@ -7,14 +7,5 @@ error[E0307]: invalid `self` type: &SomeType
= note: type must be `Self` or a type that dereferences to it`
= help: consider changing to `self`, `&self`, `&mut self`, or `self: Box<Self>`

error: arbitrary `self` types are unstable (see issue #44874)
--> $DIR/issue-27522.rs:16:22
|
16 | fn handler(self: &SomeType);
| ^^^^^^^^^
|
= help: add #![feature(arbitrary_self_types)] to the crate attributes to enable
= help: consider changing to `self`, `&self`, `&mut self`, or `self: Box<Self>`

error: aborting due to 2 previous errors
error: aborting due to previous error

0 comments on commit ddc21d5

Please sign in to comment.