Skip to content

Commit

Permalink
Rollup merge of rust-lang#65688 - JohnTitor:add-some-tests, r=Dylan-DPC
Browse files Browse the repository at this point in the history
Add some tests for fixed ICEs

Fixes rust-lang#41366 from 1.35.0
Fixes rust-lang#51431 from 1.31.0-nightly (77af314 2018-10-11) (on my local)
Fixes rust-lang#52437 from nightly
Fixes rust-lang#63496 from nightly

r? @Centril
  • Loading branch information
JohnTitor committed Oct 23, 2019
2 parents 5bac361 + 7a85c43 commit c3e5413
Show file tree
Hide file tree
Showing 8 changed files with 103 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/test/ui/asm/issue-51431.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
// ignore-emscripten no asm! support

#![feature(asm)]

fn main() {
unsafe {
asm! {"mov $0,$1"::"0"("bx"),"1"(0x00)}
//~^ ERROR: invalid value for constraint in inline assembly
}
}
8 changes: 8 additions & 0 deletions src/test/ui/asm/issue-51431.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
error[E0669]: invalid value for constraint in inline assembly
--> $DIR/issue-51431.rs:7:32
|
LL | asm! {"mov $0,$1"::"0"("bx"),"1"(0x00)}
| ^^^^

error: aborting due to previous error

9 changes: 9 additions & 0 deletions src/test/ui/associated-const/issue-63496.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
trait A {
const C: usize;

fn f() -> ([u8; A::C], [u8; A::C]);
//~^ ERROR: type annotations needed: cannot resolve
//~| ERROR: type annotations needed: cannot resolve
}

fn main() {}
21 changes: 21 additions & 0 deletions src/test/ui/associated-const/issue-63496.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
error[E0283]: type annotations needed: cannot resolve `_: A`
--> $DIR/issue-63496.rs:4:21
|
LL | const C: usize;
| --------------- required by `A::C`
LL |
LL | fn f() -> ([u8; A::C], [u8; A::C]);
| ^^^^

error[E0283]: type annotations needed: cannot resolve `_: A`
--> $DIR/issue-63496.rs:4:33
|
LL | const C: usize;
| --------------- required by `A::C`
LL |
LL | fn f() -> ([u8; A::C], [u8; A::C]);
| ^^^^

error: aborting due to 2 previous errors

For more information about this error, try `rustc --explain E0283`.
13 changes: 13 additions & 0 deletions src/test/ui/closures/issue-41366.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
trait T<'x> {
type V;
}

impl<'g> T<'g> for u32 {
type V = u16;
}

fn main() {
(&|_|()) as &dyn for<'x> Fn(<u32 as T<'x>>::V);
//~^ ERROR: type mismatch in closure arguments
//~| ERROR: type mismatch resolving
}
22 changes: 22 additions & 0 deletions src/test/ui/closures/issue-41366.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
error[E0631]: type mismatch in closure arguments
--> $DIR/issue-41366.rs:10:5
|
LL | (&|_|()) as &dyn for<'x> Fn(<u32 as T<'x>>::V);
| ^^-----^
| | |
| | found signature of `fn(_) -> _`
| expected signature of `for<'x> fn(<u32 as T<'x>>::V) -> _`
|
= note: required for the cast to the object type `dyn for<'x> std::ops::Fn(<u32 as T<'x>>::V)`

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 == ()`
--> $DIR/issue-41366.rs:10:5
|
LL | (&|_|()) as &dyn for<'x> Fn(<u32 as T<'x>>::V);
| ^^^^^^^^ expected bound lifetime parameter 'x, found concrete lifetime
|
= note: required for the cast to the object type `dyn for<'x> std::ops::Fn(<u32 as T<'x>>::V)`

error: aborting due to 2 previous errors

For more information about this error, try `rustc --explain E0271`.
5 changes: 5 additions & 0 deletions src/test/ui/closures/issue-52437.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
fn main() {
[(); &(&'static: loop { |x| {}; }) as *const _ as usize]
//~^ ERROR: invalid label name `'static`
//~| ERROR: type annotations needed
}
15 changes: 15 additions & 0 deletions src/test/ui/closures/issue-52437.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
error: invalid label name `'static`
--> $DIR/issue-52437.rs:2:13
|
LL | [(); &(&'static: loop { |x| {}; }) as *const _ as usize]
| ^^^^^^^

error[E0282]: type annotations needed
--> $DIR/issue-52437.rs:2:30
|
LL | [(); &(&'static: loop { |x| {}; }) as *const _ as usize]
| ^ consider giving this closure parameter a type

error: aborting due to 2 previous errors

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

0 comments on commit c3e5413

Please sign in to comment.