Don't emit the feature error if it's an invalid self type

This commit is contained in:
Michael Hewson 2017-11-09 11:03:27 -05:00
parent 5d170f0a3c
commit ddc21d567e
4 changed files with 2 additions and 15 deletions

View File

@ -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
}
}

View File

@ -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(); }

View File

@ -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
}
}
@ -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
}
}

View File

@ -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