Skip to content

Commit c3e5413

Browse files
authored
Rollup merge of #65688 - JohnTitor:add-some-tests, r=Dylan-DPC
Add some tests for fixed ICEs Fixes #41366 from 1.35.0 Fixes #51431 from 1.31.0-nightly (77af314 2018-10-11) (on my local) Fixes #52437 from nightly Fixes #63496 from nightly r? @Centril
2 parents 5bac361 + 7a85c43 commit c3e5413

File tree

8 files changed

+103
-0
lines changed

8 files changed

+103
-0
lines changed

src/test/ui/asm/issue-51431.rs

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
// ignore-emscripten no asm! support
2+
3+
#![feature(asm)]
4+
5+
fn main() {
6+
unsafe {
7+
asm! {"mov $0,$1"::"0"("bx"),"1"(0x00)}
8+
//~^ ERROR: invalid value for constraint in inline assembly
9+
}
10+
}

src/test/ui/asm/issue-51431.stderr

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
error[E0669]: invalid value for constraint in inline assembly
2+
--> $DIR/issue-51431.rs:7:32
3+
|
4+
LL | asm! {"mov $0,$1"::"0"("bx"),"1"(0x00)}
5+
| ^^^^
6+
7+
error: aborting due to previous error
8+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
trait A {
2+
const C: usize;
3+
4+
fn f() -> ([u8; A::C], [u8; A::C]);
5+
//~^ ERROR: type annotations needed: cannot resolve
6+
//~| ERROR: type annotations needed: cannot resolve
7+
}
8+
9+
fn main() {}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
error[E0283]: type annotations needed: cannot resolve `_: A`
2+
--> $DIR/issue-63496.rs:4:21
3+
|
4+
LL | const C: usize;
5+
| --------------- required by `A::C`
6+
LL |
7+
LL | fn f() -> ([u8; A::C], [u8; A::C]);
8+
| ^^^^
9+
10+
error[E0283]: type annotations needed: cannot resolve `_: A`
11+
--> $DIR/issue-63496.rs:4:33
12+
|
13+
LL | const C: usize;
14+
| --------------- required by `A::C`
15+
LL |
16+
LL | fn f() -> ([u8; A::C], [u8; A::C]);
17+
| ^^^^
18+
19+
error: aborting due to 2 previous errors
20+
21+
For more information about this error, try `rustc --explain E0283`.

src/test/ui/closures/issue-41366.rs

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
trait T<'x> {
2+
type V;
3+
}
4+
5+
impl<'g> T<'g> for u32 {
6+
type V = u16;
7+
}
8+
9+
fn main() {
10+
(&|_|()) as &dyn for<'x> Fn(<u32 as T<'x>>::V);
11+
//~^ ERROR: type mismatch in closure arguments
12+
//~| ERROR: type mismatch resolving
13+
}
+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
error[E0631]: type mismatch in closure arguments
2+
--> $DIR/issue-41366.rs:10:5
3+
|
4+
LL | (&|_|()) as &dyn for<'x> Fn(<u32 as T<'x>>::V);
5+
| ^^-----^
6+
| | |
7+
| | found signature of `fn(_) -> _`
8+
| expected signature of `for<'x> fn(<u32 as T<'x>>::V) -> _`
9+
|
10+
= note: required for the cast to the object type `dyn for<'x> std::ops::Fn(<u32 as T<'x>>::V)`
11+
12+
error[E0271]: type mismatch resolving `for<'x> <[closure@$DIR/issue-41366.rs:10:7: 10:12] as std::ops::FnOnce<(<u32 as T<'x>>::V,)>>::Output == ()`
13+
--> $DIR/issue-41366.rs:10:5
14+
|
15+
LL | (&|_|()) as &dyn for<'x> Fn(<u32 as T<'x>>::V);
16+
| ^^^^^^^^ expected bound lifetime parameter 'x, found concrete lifetime
17+
|
18+
= note: required for the cast to the object type `dyn for<'x> std::ops::Fn(<u32 as T<'x>>::V)`
19+
20+
error: aborting due to 2 previous errors
21+
22+
For more information about this error, try `rustc --explain E0271`.

src/test/ui/closures/issue-52437.rs

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
fn main() {
2+
[(); &(&'static: loop { |x| {}; }) as *const _ as usize]
3+
//~^ ERROR: invalid label name `'static`
4+
//~| ERROR: type annotations needed
5+
}
+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
error: invalid label name `'static`
2+
--> $DIR/issue-52437.rs:2:13
3+
|
4+
LL | [(); &(&'static: loop { |x| {}; }) as *const _ as usize]
5+
| ^^^^^^^
6+
7+
error[E0282]: type annotations needed
8+
--> $DIR/issue-52437.rs:2:30
9+
|
10+
LL | [(); &(&'static: loop { |x| {}; }) as *const _ as usize]
11+
| ^ consider giving this closure parameter a type
12+
13+
error: aborting due to 2 previous errors
14+
15+
For more information about this error, try `rustc --explain E0282`.

0 commit comments

Comments
 (0)