Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add some regression tests #77388

Merged
merged 5 commits into from
Oct 4, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions src/test/ui/const-generics/issues/issue-75299.rs
Original file line number Diff line number Diff line change
@@ -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 changes: 9 additions & 0 deletions src/test/ui/issues/issue-68951.rs
Original file line number Diff line number Diff line change
@@ -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 changes: 12 additions & 0 deletions src/test/ui/pattern/issue-66501.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
// check-pass

#![allow(unreachable_patterns)]

fn main() {
const CONST: &[Option<()>; 1] = &[Some(())];
match &[Some(())] {
&[None] => {}
CONST => {}
&[Some(())] => {}
}
}
8 changes: 8 additions & 0 deletions src/test/ui/pattern/issue-72565.rs
Original file line number Diff line number Diff line change
@@ -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 changes: 8 additions & 0 deletions src/test/ui/pattern/issue-72565.stderr
Original file line number Diff line number Diff line change
@@ -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 changes: 20 additions & 0 deletions src/test/ui/type-alias-impl-trait/issue-74244.rs
Original file line number Diff line number Diff line change
@@ -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 changes: 9 additions & 0 deletions src/test/ui/type-alias-impl-trait/issue-74244.stderr
Original file line number Diff line number Diff line change
@@ -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`.