forked from rust-lang/rust
-
Notifications
You must be signed in to change notification settings - Fork 1
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 rust-lang#69966 - JohnTitor:more-more-tests, r=Centril
Add more regression tests Closes rust-lang#58490, closes rust-lang#60390, closes rust-lang#62504, closes rust-lang#67739, closes rust-lang#69092 r? @Centril
- Loading branch information
Showing
9 changed files
with
128 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,10 @@ | ||
// build-fail | ||
// ignore-emscripten no asm! support | ||
// Regression test for #69092 | ||
|
||
#![feature(asm)] | ||
|
||
fn main() { | ||
unsafe { asm!(".ascii \"Xen\0\""); } | ||
//~^ ERROR: <inline asm>:1:9: error: expected string in '.ascii' directive | ||
} |
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 @@ | ||
error: <inline asm>:1:9: error: expected string in '.ascii' directive | ||
.ascii "Xen | ||
^ | ||
|
||
--> $DIR/issue-69092.rs:8:14 | ||
| | ||
LL | unsafe { asm!(".ascii \"Xen\0\""); } | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
|
||
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,25 @@ | ||
// Regression test for #62504 | ||
|
||
#![feature(const_generics)] | ||
#![allow(incomplete_features)] | ||
|
||
trait HasSize { | ||
const SIZE: usize; | ||
} | ||
|
||
impl<const X: usize> HasSize for ArrayHolder<{ X }> { | ||
const SIZE: usize = X; | ||
} | ||
|
||
struct ArrayHolder<const X: usize>([u32; X]); | ||
|
||
impl<const X: usize> ArrayHolder<{ X }> { | ||
pub const fn new() -> Self { | ||
ArrayHolder([0; Self::SIZE]) | ||
//~^ ERROR: array lengths can't depend on generic parameters | ||
} | ||
} | ||
|
||
fn main() { | ||
let mut array = ArrayHolder::new(); | ||
} |
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: array lengths can't depend on generic parameters | ||
--> $DIR/issue-62504.rs:18:25 | ||
| | ||
LL | ArrayHolder([0; Self::SIZE]) | ||
| ^^^^^^^^^^ | ||
|
||
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,18 @@ | ||
// Regression test for #67739 | ||
|
||
#![allow(incomplete_features)] | ||
#![feature(const_generics)] | ||
|
||
use std::mem; | ||
|
||
pub trait Trait { | ||
type Associated: Sized; | ||
|
||
fn associated_size(&self) -> usize { | ||
[0u8; mem::size_of::<Self::Associated>()]; | ||
//~^ ERROR: array lengths can't depend on generic parameters | ||
0 | ||
} | ||
} | ||
|
||
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,8 @@ | ||
error: array lengths can't depend on generic parameters | ||
--> $DIR/issue-67739.rs:12:15 | ||
| | ||
LL | [0u8; mem::size_of::<Self::Associated>()]; | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
|
||
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,26 @@ | ||
// Regression test for #58490 | ||
|
||
macro_rules! a { | ||
( @1 $i:item ) => { | ||
a! { @2 $i } | ||
}; | ||
( @2 $i:item ) => { | ||
$i | ||
}; | ||
} | ||
mod b { | ||
a! { | ||
@1 | ||
#[macro_export] | ||
macro_rules! b { () => () } | ||
} | ||
#[macro_export] | ||
macro_rules! b { () => () } | ||
//~^ ERROR: the name `b` is defined multiple times | ||
} | ||
mod c { | ||
#[allow(unused_imports)] | ||
use crate::b; | ||
} | ||
|
||
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,14 @@ | ||
error[E0428]: the name `b` is defined multiple times | ||
--> $DIR/issue-58490.rs:18:5 | ||
| | ||
LL | macro_rules! b { () => () } | ||
| -------------- previous definition of the macro `b` here | ||
... | ||
LL | macro_rules! b { () => () } | ||
| ^^^^^^^^^^^^^^ `b` redefined here | ||
| | ||
= note: `b` must be defined only once in the macro namespace of this module | ||
|
||
error: aborting due to previous error | ||
|
||
For more information about this error, try `rustc --explain E0428`. |
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 @@ | ||
// check-pass | ||
// compile-flags: --emit=mir,link | ||
// Regression test for #60390, this ICE requires `--emit=mir` flag. | ||
|
||
fn main() { | ||
enum Inner { Member(u32) }; | ||
Inner::Member(0); | ||
} |