diff --git a/src/test/compile-fail/issue-30355.rs b/src/test/compile-fail/issue-30355.rs new file mode 100644 index 0000000000000..ee19d04031893 --- /dev/null +++ b/src/test/compile-fail/issue-30355.rs @@ -0,0 +1,21 @@ +// 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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +pub struct X([u8]); + +pub static Y: &'static X = { + const Y: &'static [u8] = b""; + &X(*Y) + //~^ ERROR cannot move out + //~^^ ERROR cannot move a + //~^^^ ERROR cannot move a +}; + +fn main() {} diff --git a/src/test/compile-fail/issue-33241.rs b/src/test/compile-fail/issue-33241.rs new file mode 100644 index 0000000000000..6a411b4c59c68 --- /dev/null +++ b/src/test/compile-fail/issue-33241.rs @@ -0,0 +1,23 @@ +// 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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +#![feature(rustc_attrs)] + +use std::fmt; + +// CoerceUnsized is not implemented for tuples. You can still create +// an unsized tuple by transmuting a trait object. +fn any() -> T { unreachable!() } + +#[rustc_error] +fn main() { //~ ERROR compilation successful + let t: &(u8, fmt::Debug) = any(); + println!("{:?}", &t.1); +} diff --git a/src/test/compile-fail/issue-37887.rs b/src/test/compile-fail/issue-37887.rs new file mode 100644 index 0000000000000..f120bbbfc9f1a --- /dev/null +++ b/src/test/compile-fail/issue-37887.rs @@ -0,0 +1,14 @@ +// 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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +fn main() { + extern crate libc; //~ ERROR use of unstable + use libc::*; //~ ERROR unresolved import +} diff --git a/src/test/compile-fail/issue-44578.rs b/src/test/compile-fail/issue-44578.rs new file mode 100644 index 0000000000000..a6ae21c3b5497 --- /dev/null +++ b/src/test/compile-fail/issue-44578.rs @@ -0,0 +1,34 @@ +// 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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +trait Foo { + const AMT: usize; +} + +enum Bar { + First(A), + Second(B), +} + +impl Foo for Bar { + const AMT: usize = [A::AMT][(A::AMT > B::AMT) as usize]; //~ ERROR constant evaluation +} + +impl Foo for u8 { + const AMT: usize = 1; +} + +impl Foo for u16 { + const AMT: usize = 2; +} + +fn main() { + println!("{}", as Foo>::AMT); +} diff --git a/src/test/run-pass-fulldeps/proc-macro/attr-on-trait.rs b/src/test/run-pass-fulldeps/proc-macro/attr-on-trait.rs index 8ba38875eff5b..52a8652e65bcf 100644 --- a/src/test/run-pass-fulldeps/proc-macro/attr-on-trait.rs +++ b/src/test/run-pass-fulldeps/proc-macro/attr-on-trait.rs @@ -9,6 +9,7 @@ // except according to those terms. // aux-build:attr-on-trait.rs +// ignore-stage1 #![feature(proc_macro)] diff --git a/src/test/ui/issue-36400.rs b/src/test/ui/issue-36400.rs new file mode 100644 index 0000000000000..c0aec5b4296be --- /dev/null +++ b/src/test/ui/issue-36400.rs @@ -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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +fn f(x: &mut u32) {} + +fn main() { + let x = Box::new(3); + f(&mut *x); +} diff --git a/src/test/ui/issue-36400.stderr b/src/test/ui/issue-36400.stderr new file mode 100644 index 0000000000000..69e9c455f357d --- /dev/null +++ b/src/test/ui/issue-36400.stderr @@ -0,0 +1,10 @@ +error[E0596]: cannot borrow immutable `Box` content `*x` as mutable + --> $DIR/issue-36400.rs:15:12 + | +14 | let x = Box::new(3); + | - consider changing this to `mut x` +15 | f(&mut *x); + | ^^ cannot borrow as mutable + +error: aborting due to previous error +