diff options
| author | Michael Hewson <michael@michaelhewson.ca> | 2017-11-09 11:03:27 -0500 |
|---|---|---|
| committer | Michael Hewson <michael@michaelhewson.ca> | 2017-11-09 11:03:27 -0500 |
| commit | ddc21d567e50437d70f7f56377834135a2d34e6e (patch) | |
| tree | 77ac5c916c679b5e6f4909d502517c323ab71e60 | |
| parent | 5d170f0a3c3591b000a0400e7029fc8622144be2 (diff) | |
| download | rust-ddc21d567e50437d70f7f56377834135a2d34e6e.tar.gz rust-ddc21d567e50437d70f7f56377834135a2d34e6e.zip | |
Don't emit the feature error if it's an invalid self type
| -rw-r--r-- | src/librustc_typeck/check/wfcheck.rs | 2 | ||||
| -rw-r--r-- | src/test/compile-fail/issue-26194.rs | 1 | ||||
| -rw-r--r-- | src/test/compile-fail/ufcs-explicit-self-bad.rs | 3 | ||||
| -rw-r--r-- | src/test/ui/span/issue-27522.stderr | 11 |
4 files changed, 2 insertions, 15 deletions
diff --git a/src/librustc_typeck/check/wfcheck.rs b/src/librustc_typeck/check/wfcheck.rs index 519392ab26c..37cf67fe53e 100644 --- a/src/librustc_typeck/check/wfcheck.rs +++ b/src/librustc_typeck/check/wfcheck.rs @@ -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 } } diff --git a/src/test/compile-fail/issue-26194.rs b/src/test/compile-fail/issue-26194.rs index 439115a258d..7ddd56229ce 100644 --- a/src/test/compile-fail/issue-26194.rs +++ b/src/test/compile-fail/issue-26194.rs @@ -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(); } diff --git a/src/test/compile-fail/ufcs-explicit-self-bad.rs b/src/test/compile-fail/ufcs-explicit-self-bad.rs index 5160ceaf48e..a0d1f2dc331 100644 --- a/src/test/compile-fail/ufcs-explicit-self-bad.rs +++ b/src/test/compile-fail/ufcs-explicit-self-bad.rs @@ -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 } } diff --git a/src/test/ui/span/issue-27522.stderr b/src/test/ui/span/issue-27522.stderr index e3191d7eb22..e12fb57f15d 100644 --- a/src/test/ui/span/issue-27522.stderr +++ b/src/test/ui/span/issue-27522.stderr @@ -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 |
