Skip to content

Commit

Permalink
Rollup merge of rust-lang#42230 - venkatagiri:ice_regression_tests, r…
Browse files Browse the repository at this point in the history
…=Mark-Simulacrum

regression tests for ICEs

closes rust-lang#36379
closes rust-lang#37550
closes rust-lang#37665
closes rust-lang#38160
closes rust-lang#38954
closes rust-lang#39362

r? @Mark-Simulacrum
  • Loading branch information
frewsxcv committed May 26, 2017
2 parents af4ec62 + 2160b4a commit 076a422
Show file tree
Hide file tree
Showing 6 changed files with 129 additions and 0 deletions.
16 changes: 16 additions & 0 deletions src/test/compile-fail/issue-36379.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
// Copyright 2017 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except according to those terms.

#![feature(conservative_impl_trait, rustc_attrs)]

fn _test() -> impl Default { }

#[rustc_error]
fn main() { } //~ ERROR compilation successful
18 changes: 18 additions & 0 deletions src/test/compile-fail/issue-37550.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
// Copyright 2017 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except according to those terms.

#![feature(const_fn)]

const fn x() {
let t = true; //~ ERROR blocks in constant functions are limited to items and tail expressions
let x = || t; //~ ERROR blocks in constant functions are limited to items and tail expressions
}

fn main() {}
20 changes: 20 additions & 0 deletions src/test/compile-fail/issue-37665.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
// Copyright 2017 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except according to those terms.

// compile-flags: -Z unstable-options --unpretty=mir

use std::path::MAIN_SEPARATOR;

fn main() {
let mut foo : String = "hello".to_string();
foo.push(MAIN_SEPARATOR);
println!("{}", foo);
let x: () = 0; //~ ERROR: mismatched types
}
31 changes: 31 additions & 0 deletions src/test/compile-fail/issue-38160.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
// Copyright 2017 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except according to those terms.

#![feature(associated_consts, rustc_attrs)]
#![allow(warnings)]

trait MyTrait {
const MY_CONST: &'static str;
}

macro_rules! my_macro {
() => {
struct MyStruct;

impl MyTrait for MyStruct {
const MY_CONST: &'static str = stringify!(abc);
}
}
}

my_macro!();

#[rustc_error]
fn main() {} //~ ERROR compilation successful
16 changes: 16 additions & 0 deletions src/test/compile-fail/issue-38954.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
// Copyright 2017 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except according to those terms.

#![feature(rustc_attrs)]

fn _test(ref _p: str) {}

#[rustc_error]
fn main() { } //~ ERROR compilation successful
28 changes: 28 additions & 0 deletions src/test/compile-fail/issue-39362.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
// Copyright 2017 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except according to those terms.

enum Foo {
Bar { bar: Bar, id: usize }
}

enum Bar {
A, B, C, D, E, F
}

fn test(f: Foo) {
match f {
//~^ ERROR non-exhaustive patterns
//~| patterns
Foo::Bar { bar: Bar::A, .. } => (),
Foo::Bar { bar: Bar::B, .. } => (),
}
}

fn main() {}

0 comments on commit 076a422

Please sign in to comment.