Skip to content

Commit

Permalink
unify both existing test files for issue rust-lang#32829
Browse files Browse the repository at this point in the history
issue-32829.rs was introduced in f6a243d (2 June 2016), but
issue32829.rs was introduced in 94a0552 (9 May 2016). Weird! Let's
combine them for the best of both worlds.
  • Loading branch information
zackmdavis committed Feb 5, 2017
1 parent de8df01 commit 1c26f8c
Show file tree
Hide file tree
Showing 2 changed files with 78 additions and 90 deletions.
80 changes: 78 additions & 2 deletions src/test/compile-fail/issue-32829.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,85 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.

// error-pattern: calls in statics are limited
#![feature(const_fn)]

static S : u64 = { { panic!("foo"); 0 } };
const bad: u32 = {
{
5; //~ ERROR: blocks in constants are limited to items and tail expressions
0
}
};

const bad_two: u32 = {
{
invalid();
//~^ ERROR: blocks in constants are limited to items and tail expressions
//~^^ ERROR: calls in constants are limited to constant functions, struct and enum
0
}
};

const bad_three: u32 = {
{
valid();
//~^ ERROR: blocks in constants are limited to items and tail expressions
0
}
};

static bad_four: u32 = {
{
5; //~ ERROR: blocks in statics are limited to items and tail expressions
0
}
};

static bad_five: u32 = {
{
invalid();
//~^ ERROR: blocks in statics are limited to items and tail expressions
//~^^ ERROR: calls in statics are limited to constant functions, struct and enum
0
}
};

static bad_six: u32 = {
{
valid();
//~^ ERROR: blocks in statics are limited to items and tail expressions
0
}
};

static mut bad_seven: u32 = {
{
5; //~ ERROR: blocks in statics are limited to items and tail expressions
0
}
};

static mut bad_eight: u32 = {
{
invalid();
//~^ ERROR: blocks in statics are limited to items and tail expressions
//~^^ ERROR: calls in statics are limited to constant functions, struct and enum
0
}
};

static mut bad_nine: u32 = {
{
valid();
//~^ ERROR: blocks in statics are limited to items and tail expressions
0
}
};

fn invalid() {}
const fn valid() {}

static S: u64 = { { panic!("foo"); 0 } };
//~^ ERROR: calls in statics are limited

fn main() {
println!("{:?}", S);
Expand Down
88 changes: 0 additions & 88 deletions src/test/compile-fail/issue32829.rs

This file was deleted.

0 comments on commit 1c26f8c

Please sign in to comment.