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 more regression tests #69966

Merged
merged 5 commits into from
Mar 13, 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
10 changes: 10 additions & 0 deletions src/test/ui/asm/issue-69092.rs
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
}
11 changes: 11 additions & 0 deletions src/test/ui/asm/issue-69092.stderr
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

25 changes: 25 additions & 0 deletions src/test/ui/const-generics/issues/issue-62504.rs
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();
}
8 changes: 8 additions & 0 deletions src/test/ui/const-generics/issues/issue-62504.stderr
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

18 changes: 18 additions & 0 deletions src/test/ui/const-generics/issues/issue-67739.rs
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() {}
8 changes: 8 additions & 0 deletions src/test/ui/const-generics/issues/issue-67739.stderr
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

26 changes: 26 additions & 0 deletions src/test/ui/macros/issue-58490.rs
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() {}
14 changes: 14 additions & 0 deletions src/test/ui/macros/issue-58490.stderr
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`.
8 changes: 8 additions & 0 deletions src/test/ui/mir/issue-60390.rs
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);
}