Skip to content

Commit ddc21d5

Browse files
committed
Don't emit the feature error if it's an invalid self type
1 parent 5d170f0 commit ddc21d5

File tree

4 files changed

+2
-15
lines changed

4 files changed

+2
-15
lines changed

src/librustc_typeck/check/wfcheck.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -505,7 +505,7 @@ impl<'a, 'gcx> CheckTypeWellFormedVisitor<'a, 'gcx> {
505505
.help("consider changing to `self`, `&self`, `&mut self`, or `self: Box<Self>`")
506506
.code(DiagnosticId::Error("E0307".into()))
507507
.emit();
508-
break
508+
return
509509
}
510510
}
511511

src/test/compile-fail/issue-26194.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ struct S(String);
1313
impl S {
1414
fn f(self: *mut S) -> String { self.0 }
1515
//~^ ERROR invalid `self` type
16-
//~| ERROR arbitrary `self` types are unstable
1716
}
1817

1918
fn main() { S("".to_owned()).f(); }

src/test/compile-fail/ufcs-explicit-self-bad.rs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ struct Foo {
1717
impl Foo {
1818
fn foo(self: isize, x: isize) -> isize {
1919
//~^ ERROR invalid `self` type
20-
//~| ERROR arbitrary `self` types are unstable
2120
self.f + x
2221
}
2322
}
@@ -29,12 +28,10 @@ struct Bar<T> {
2928
impl<T> Bar<T> {
3029
fn foo(self: Bar<isize>, x: isize) -> isize {
3130
//~^ ERROR invalid `self` type
32-
//~| ERROR arbitrary `self` types are unstable
3331
x
3432
}
3533
fn bar(self: &Bar<usize>, x: isize) -> isize {
3634
//~^ ERROR invalid `self` type
37-
//~| ERROR arbitrary `self` types are unstable
3835
x
3936
}
4037
}

src/test/ui/span/issue-27522.stderr

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,5 @@ error[E0307]: invalid `self` type: &SomeType
77
= note: type must be `Self` or a type that dereferences to it`
88
= help: consider changing to `self`, `&self`, `&mut self`, or `self: Box<Self>`
99

10-
error: arbitrary `self` types are unstable (see issue #44874)
11-
--> $DIR/issue-27522.rs:16:22
12-
|
13-
16 | fn handler(self: &SomeType);
14-
| ^^^^^^^^^
15-
|
16-
= help: add #![feature(arbitrary_self_types)] to the crate attributes to enable
17-
= help: consider changing to `self`, `&self`, `&mut self`, or `self: Box<Self>`
18-
19-
error: aborting due to 2 previous errors
10+
error: aborting due to previous error
2011

0 commit comments

Comments
 (0)