-
Notifications
You must be signed in to change notification settings - Fork 12.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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.
- Loading branch information
Showing
7 changed files
with
77 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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>(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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(())] => {} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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() {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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`. |