Skip to content

Commit a4a7950

Browse files
committed
Cleaned up some tests
fix explicit-call-to-dtor.rs fix explicit-call-to-supertrait-dtor.rs merge issues/issue-17740.rs with lifetimes/explicit-self-lifetime-mismatch.rs merge bare-fn-start.rs and trait-fn.rs into invalid-self-argument.rs add comment tests/ui/traits/catch-unwind-cell-interior-mut
1 parent 77afccf commit a4a7950

16 files changed

+134
-141
lines changed

tests/ui/drop/explicit-call-to-dtor.fixed

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
//@ run-rustfix
22
struct Foo {
3-
x: isize
3+
x: isize,
44
}
55

66
impl Drop for Foo {
@@ -12,5 +12,5 @@ impl Drop for Foo {
1212
fn main() {
1313
let x = Foo { x: 3 };
1414
println!("{}", x.x);
15-
drop(x); //~ ERROR explicit use of destructor method
15+
drop(x); //~ ERROR explicit use of destructor method
1616
}

tests/ui/drop/explicit-call-to-dtor.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
//@ run-rustfix
22
struct Foo {
3-
x: isize
3+
x: isize,
44
}
55

66
impl Drop for Foo {
@@ -12,5 +12,5 @@ impl Drop for Foo {
1212
fn main() {
1313
let x = Foo { x: 3 };
1414
println!("{}", x.x);
15-
x.drop(); //~ ERROR explicit use of destructor method
15+
x.drop(); //~ ERROR explicit use of destructor method
1616
}

tests/ui/drop/explicit-call-to-supertrait-dtor.fixed

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
#![allow(dropping_references)]
55

66
struct Foo {
7-
x: isize
7+
x: isize,
88
}
99

1010
#[allow(drop_bounds)]
@@ -20,7 +20,7 @@ impl Drop for Foo {
2020

2121
impl Bar for Foo {
2222
fn blah(&self) {
23-
drop(self); //~ ERROR explicit use of destructor method
23+
drop(self); //~ ERROR explicit use of destructor method
2424
}
2525
}
2626

tests/ui/drop/explicit-call-to-supertrait-dtor.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
#![allow(dropping_references)]
55

66
struct Foo {
7-
x: isize
7+
x: isize,
88
}
99

1010
#[allow(drop_bounds)]
@@ -20,7 +20,7 @@ impl Drop for Foo {
2020

2121
impl Bar for Foo {
2222
fn blah(&self) {
23-
self.drop(); //~ ERROR explicit use of destructor method
23+
self.drop(); //~ ERROR explicit use of destructor method
2424
}
2525
}
2626

tests/ui/issues/issue-17740.rs

Lines changed: 0 additions & 20 deletions
This file was deleted.

tests/ui/issues/issue-17740.stderr

Lines changed: 0 additions & 41 deletions
This file was deleted.
Lines changed: 32 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,41 @@
11
//@ dont-require-annotations: NOTE
2+
//! regression test for <https://github.com/rust-lang/rust/issues/17740>
23
3-
struct Foo<'a,'b> {
4+
struct Foo<'a, 'b> {
45
x: &'a isize,
56
y: &'b isize,
67
}
78

8-
impl<'a,'b> Foo<'a,'b> {
9-
fn bar(self:
10-
Foo<'b,'a>
11-
//~^ ERROR mismatched `self` parameter type
12-
//~| NOTE expected struct `Foo<'a, 'b>`
13-
//~| NOTE found struct `Foo<'b, 'a>`
14-
//~| NOTE lifetime mismatch
15-
//~| ERROR mismatched `self` parameter type
16-
//~| NOTE expected struct `Foo<'a, 'b>`
17-
//~| NOTE found struct `Foo<'b, 'a>`
18-
//~| NOTE lifetime mismatch
19-
) {}
9+
impl<'a, 'b> Foo<'a, 'b> {
10+
fn bar(
11+
self: Foo<'b, 'a>,
12+
//~^ ERROR mismatched `self` parameter type
13+
//~| NOTE expected struct `Foo<'a, 'b>`
14+
//~| NOTE found struct `Foo<'b, 'a>`
15+
//~| NOTE lifetime mismatch
16+
//~| ERROR mismatched `self` parameter type
17+
//~| NOTE expected struct `Foo<'a, 'b>`
18+
//~| NOTE found struct `Foo<'b, 'a>`
19+
//~| NOTE lifetime mismatch
20+
) {
21+
}
22+
}
23+
24+
struct Bar<'a> {
25+
data: &'a [u8],
26+
}
27+
28+
impl<'a> Bar<'a> {
29+
fn bar(self: &mut Bar) {
30+
//~^ ERROR mismatched `self` parameter type
31+
//~| NOTE expected struct `Bar<'a>`
32+
//~| NOTE found struct `Bar<'_>`
33+
//~| NOTE lifetime mismatch
34+
//~| ERROR mismatched `self` parameter type
35+
//~| NOTE expected struct `Bar<'a>`
36+
//~| NOTE found struct `Bar<'_>`
37+
//~| NOTE lifetime mismatch
38+
}
2039
}
2140

2241
fn main() {}
Lines changed: 55 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,41 +1,79 @@
11
error[E0308]: mismatched `self` parameter type
2-
--> $DIR/explicit-self-lifetime-mismatch.rs:10:12
2+
--> $DIR/explicit-self-lifetime-mismatch.rs:11:15
33
|
4-
LL | Foo<'b,'a>
5-
| ^^^^^^^^^^ lifetime mismatch
4+
LL | self: Foo<'b, 'a>,
5+
| ^^^^^^^^^^^ lifetime mismatch
66
|
77
= note: expected struct `Foo<'a, 'b>`
88
found struct `Foo<'b, 'a>`
99
note: the lifetime `'b` as defined here...
10-
--> $DIR/explicit-self-lifetime-mismatch.rs:8:9
10+
--> $DIR/explicit-self-lifetime-mismatch.rs:9:10
1111
|
12-
LL | impl<'a,'b> Foo<'a,'b> {
13-
| ^^
12+
LL | impl<'a, 'b> Foo<'a, 'b> {
13+
| ^^
1414
note: ...does not necessarily outlive the lifetime `'a` as defined here
15-
--> $DIR/explicit-self-lifetime-mismatch.rs:8:6
15+
--> $DIR/explicit-self-lifetime-mismatch.rs:9:6
1616
|
17-
LL | impl<'a,'b> Foo<'a,'b> {
17+
LL | impl<'a, 'b> Foo<'a, 'b> {
1818
| ^^
1919

2020
error[E0308]: mismatched `self` parameter type
21-
--> $DIR/explicit-self-lifetime-mismatch.rs:10:12
21+
--> $DIR/explicit-self-lifetime-mismatch.rs:11:15
2222
|
23-
LL | Foo<'b,'a>
24-
| ^^^^^^^^^^ lifetime mismatch
23+
LL | self: Foo<'b, 'a>,
24+
| ^^^^^^^^^^^ lifetime mismatch
2525
|
2626
= note: expected struct `Foo<'a, 'b>`
2727
found struct `Foo<'b, 'a>`
2828
note: the lifetime `'a` as defined here...
29-
--> $DIR/explicit-self-lifetime-mismatch.rs:8:6
29+
--> $DIR/explicit-self-lifetime-mismatch.rs:9:6
3030
|
31-
LL | impl<'a,'b> Foo<'a,'b> {
31+
LL | impl<'a, 'b> Foo<'a, 'b> {
3232
| ^^
3333
note: ...does not necessarily outlive the lifetime `'b` as defined here
34-
--> $DIR/explicit-self-lifetime-mismatch.rs:8:9
34+
--> $DIR/explicit-self-lifetime-mismatch.rs:9:10
3535
|
36-
LL | impl<'a,'b> Foo<'a,'b> {
37-
| ^^
36+
LL | impl<'a, 'b> Foo<'a, 'b> {
37+
| ^^
3838

39-
error: aborting due to 2 previous errors
39+
error[E0308]: mismatched `self` parameter type
40+
--> $DIR/explicit-self-lifetime-mismatch.rs:29:18
41+
|
42+
LL | fn bar(self: &mut Bar) {
43+
| ^^^^^^^^ lifetime mismatch
44+
|
45+
= note: expected struct `Bar<'a>`
46+
found struct `Bar<'_>`
47+
note: the anonymous lifetime defined here...
48+
--> $DIR/explicit-self-lifetime-mismatch.rs:29:23
49+
|
50+
LL | fn bar(self: &mut Bar) {
51+
| ^^^
52+
note: ...does not necessarily outlive the lifetime `'a` as defined here
53+
--> $DIR/explicit-self-lifetime-mismatch.rs:28:6
54+
|
55+
LL | impl<'a> Bar<'a> {
56+
| ^^
57+
58+
error[E0308]: mismatched `self` parameter type
59+
--> $DIR/explicit-self-lifetime-mismatch.rs:29:18
60+
|
61+
LL | fn bar(self: &mut Bar) {
62+
| ^^^^^^^^ lifetime mismatch
63+
|
64+
= note: expected struct `Bar<'a>`
65+
found struct `Bar<'_>`
66+
note: the lifetime `'a` as defined here...
67+
--> $DIR/explicit-self-lifetime-mismatch.rs:28:6
68+
|
69+
LL | impl<'a> Bar<'a> {
70+
| ^^
71+
note: ...does not necessarily outlive the anonymous lifetime defined here
72+
--> $DIR/explicit-self-lifetime-mismatch.rs:29:23
73+
|
74+
LL | fn bar(self: &mut Bar) {
75+
| ^^^
76+
77+
error: aborting due to 4 previous errors
4078

4179
For more information about this error, try `rustc --explain E0308`.

tests/ui/self/bare-fn-start.rs

Lines changed: 0 additions & 6 deletions
This file was deleted.

tests/ui/self/bare-fn-start.stderr

Lines changed: 0 additions & 10 deletions
This file was deleted.

0 commit comments

Comments
 (0)