Rollup merge of #77388 - JohnTitor:add-tests, r=Dylan-DPC
Add some regression tests Closes #66501 Closes #68951 Closes #72565 Closes #74244 Closes #75299 The first issue is fixed in 1.43.0, other issues are fixed in the recent nightly.
This commit is contained in:
commit
f09c962a84
11
src/test/ui/const-generics/issues/issue-75299.rs
Normal file
11
src/test/ui/const-generics/issues/issue-75299.rs
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
// compile-flags: -Zmir-opt-level=3
|
||||||
|
// run-pass
|
||||||
|
|
||||||
|
#![feature(const_generics)]
|
||||||
|
#![allow(incomplete_features)]
|
||||||
|
fn main() {
|
||||||
|
fn foo<const N: usize>() -> [u8; N] {
|
||||||
|
[0; N]
|
||||||
|
}
|
||||||
|
let _x = foo::<1>();
|
||||||
|
}
|
9
src/test/ui/issues/issue-68951.rs
Normal file
9
src/test/ui/issues/issue-68951.rs
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
// check-pass
|
||||||
|
|
||||||
|
fn main() {
|
||||||
|
let array = [0x42u8; 10];
|
||||||
|
for b in &array {
|
||||||
|
let lo = b & 0xf;
|
||||||
|
let hi = (b >> 4) & 0xf;
|
||||||
|
}
|
||||||
|
}
|
12
src/test/ui/pattern/issue-66501.rs
Normal file
12
src/test/ui/pattern/issue-66501.rs
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
// check-pass
|
||||||
|
|
||||||
|
#![allow(unreachable_patterns)]
|
||||||
|
|
||||||
|
fn main() {
|
||||||
|
const CONST: &[Option<()>; 1] = &[Some(())];
|
||||||
|
match &[Some(())] {
|
||||||
|
&[None] => {}
|
||||||
|
CONST => {}
|
||||||
|
&[Some(())] => {}
|
||||||
|
}
|
||||||
|
}
|
8
src/test/ui/pattern/issue-72565.rs
Normal file
8
src/test/ui/pattern/issue-72565.rs
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
const F: &'static dyn PartialEq<u32> = &7u32;
|
||||||
|
|
||||||
|
fn main() {
|
||||||
|
let a: &dyn PartialEq<u32> = &7u32;
|
||||||
|
match a {
|
||||||
|
F => panic!(), //~ ERROR: `&dyn PartialEq<u32>` cannot be used in patterns
|
||||||
|
}
|
||||||
|
}
|
8
src/test/ui/pattern/issue-72565.stderr
Normal file
8
src/test/ui/pattern/issue-72565.stderr
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
error: `&dyn PartialEq<u32>` cannot be used in patterns
|
||||||
|
--> $DIR/issue-72565.rs:6:9
|
||||||
|
|
|
||||||
|
LL | F => panic!(),
|
||||||
|
| ^
|
||||||
|
|
||||||
|
error: aborting due to previous error
|
||||||
|
|
20
src/test/ui/type-alias-impl-trait/issue-74244.rs
Normal file
20
src/test/ui/type-alias-impl-trait/issue-74244.rs
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
#![feature(type_alias_impl_trait)]
|
||||||
|
|
||||||
|
trait Allocator {
|
||||||
|
type Buffer;
|
||||||
|
}
|
||||||
|
|
||||||
|
struct DefaultAllocator;
|
||||||
|
|
||||||
|
impl<T> Allocator for DefaultAllocator {
|
||||||
|
//~^ ERROR: the type parameter `T` is not constrained
|
||||||
|
type Buffer = ();
|
||||||
|
}
|
||||||
|
|
||||||
|
type A = impl Fn(<DefaultAllocator as Allocator>::Buffer);
|
||||||
|
|
||||||
|
fn foo() -> A {
|
||||||
|
|_| ()
|
||||||
|
}
|
||||||
|
|
||||||
|
fn main() {}
|
9
src/test/ui/type-alias-impl-trait/issue-74244.stderr
Normal file
9
src/test/ui/type-alias-impl-trait/issue-74244.stderr
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
error[E0207]: the type parameter `T` is not constrained by the impl trait, self type, or predicates
|
||||||
|
--> $DIR/issue-74244.rs:9:6
|
||||||
|
|
|
||||||
|
LL | impl<T> Allocator for DefaultAllocator {
|
||||||
|
| ^ unconstrained type parameter
|
||||||
|
|
||||||
|
error: aborting due to previous error
|
||||||
|
|
||||||
|
For more information about this error, try `rustc --explain E0207`.
|
Loading…
x
Reference in New Issue
Block a user