Skip to content

Commit 75454f7

Browse files
author
Jonathan Turner
authored
Rollup merge of rust-lang#35713 - sanxiyn:ui-test, r=nikomatsakis
Use UI test to test spans, instead of forced line break There must be lots more, but these are what I could easily find.
2 parents 6193b1f + 3aa6340 commit 75454f7

File tree

4 files changed

+24
-8
lines changed

4 files changed

+24
-8
lines changed

src/test/compile-fail/move-closure-span.rs src/test/ui/span/move-closure.rs

+2-3
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,9 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11+
// Regression test for issue #24986
1112
// Make sure that the span of a closure marked `move` begins at the `move` keyword.
1213

1314
fn main() {
14-
let x: () =
15-
move //~ ERROR mismatched types
16-
|| ();
15+
let x: () = move || ();
1716
}

src/test/ui/span/move-closure.stderr

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
error[E0308]: mismatched types
2+
--> $DIR/move-closure.rs:15:17
3+
|
4+
15 | let x: () = move || ();
5+
| ^^^^^^^^^^ expected (), found closure
6+
|
7+
= note: expected type `()`
8+
= note: found type `[closure@$DIR/move-closure.rs:15:17: 15:27]`
9+
10+
error: aborting due to previous error
11+

src/test/compile-fail/ty_binding_span.rs src/test/ui/span/type-binding.rs

+3-5
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,11 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11+
// Regression test for issue #28158
1112
// Test the type binding span doesn't include >>
1213

1314
use std::ops::Deref;
1415

15-
fn homura<T: Deref<Trget=i32 //~ ERROR associated type
16-
>>(_: T) { }
16+
fn homura<T: Deref<Trget = i32>>(_: T) {}
1717

18-
19-
fn main() {
20-
}
18+
fn main() {}

src/test/ui/span/type-binding.stderr

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
error[E0220]: associated type `Trget` not found for `std::ops::Deref`
2+
--> $DIR/type-binding.rs:16:20
3+
|
4+
16 | fn homura<T: Deref<Trget = i32>>(_: T) {}
5+
| ^^^^^^^^^^^
6+
7+
error: aborting due to previous error
8+

0 commit comments

Comments
 (0)