Skip to content

Commit 7428806

Browse files
committed
Fix some E-needstest issues.
Also ignore `attr-on-trait` test on stage-1 to keep `./x.py test --stage 1` successful. Fixes #30355. Fixes #33241. Fixes #36400. Fixes #37887. Fixes #44578.
1 parent eabef06 commit 7428806

File tree

7 files changed

+119
-0
lines changed

7 files changed

+119
-0
lines changed

src/test/compile-fail/issue-30355.rs

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
// Copyright 2017 The Rust Project Developers. See the COPYRIGHT
2+
// file at the top-level directory of this distribution and at
3+
// http://rust-lang.org/COPYRIGHT.
4+
//
5+
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6+
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7+
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8+
// option. This file may not be copied, modified, or distributed
9+
// except according to those terms.
10+
11+
pub struct X([u8]);
12+
13+
pub static Y: &'static X = {
14+
const Y: &'static [u8] = b"";
15+
&X(*Y)
16+
//~^ ERROR cannot move out
17+
//~^^ ERROR cannot move a
18+
//~^^^ ERROR cannot move a
19+
};
20+
21+
fn main() {}

src/test/compile-fail/issue-33241.rs

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
// Copyright 2017 The Rust Project Developers. See the COPYRIGHT
2+
// file at the top-level directory of this distribution and at
3+
// http://rust-lang.org/COPYRIGHT.
4+
//
5+
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6+
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7+
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8+
// option. This file may not be copied, modified, or distributed
9+
// except according to those terms.
10+
11+
#![feature(rustc_attrs)]
12+
13+
use std::fmt;
14+
15+
// CoerceUnsized is not implemented for tuples. You can still create
16+
// an unsized tuple by transmuting a trait object.
17+
fn any<T>() -> T { unreachable!() }
18+
19+
#[rustc_error]
20+
fn main() { //~ ERROR compilation successful
21+
let t: &(u8, fmt::Debug) = any();
22+
println!("{:?}", &t.1);
23+
}

src/test/compile-fail/issue-37887.rs

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
// Copyright 2017 The Rust Project Developers. See the COPYRIGHT
2+
// file at the top-level directory of this distribution and at
3+
// http://rust-lang.org/COPYRIGHT.
4+
//
5+
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6+
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7+
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8+
// option. This file may not be copied, modified, or distributed
9+
// except according to those terms.
10+
11+
fn main() {
12+
extern crate libc; //~ ERROR use of unstable
13+
use libc::*; //~ ERROR unresolved import
14+
}

src/test/compile-fail/issue-44578.rs

+34
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
// Copyright 2017 The Rust Project Developers. See the COPYRIGHT
2+
// file at the top-level directory of this distribution and at
3+
// http://rust-lang.org/COPYRIGHT.
4+
//
5+
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6+
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7+
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8+
// option. This file may not be copied, modified, or distributed
9+
// except according to those terms.
10+
11+
trait Foo {
12+
const AMT: usize;
13+
}
14+
15+
enum Bar<A, B> {
16+
First(A),
17+
Second(B),
18+
}
19+
20+
impl<A: Foo, B: Foo> Foo for Bar<A, B> {
21+
const AMT: usize = [A::AMT][(A::AMT > B::AMT) as usize]; //~ ERROR constant evaluation
22+
}
23+
24+
impl Foo for u8 {
25+
const AMT: usize = 1;
26+
}
27+
28+
impl Foo for u16 {
29+
const AMT: usize = 2;
30+
}
31+
32+
fn main() {
33+
println!("{}", <Bar<u16, u8> as Foo>::AMT);
34+
}

src/test/run-pass-fulldeps/proc-macro/attr-on-trait.rs

+1
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
// except according to those terms.
1010

1111
// aux-build:attr-on-trait.rs
12+
// ignore-stage1
1213

1314
#![feature(proc_macro)]
1415

src/test/ui/issue-36400.rs

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
// Copyright 2017 The Rust Project Developers. See the COPYRIGHT
2+
// file at the top-level directory of this distribution and at
3+
// http://rust-lang.org/COPYRIGHT.
4+
//
5+
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6+
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7+
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8+
// option. This file may not be copied, modified, or distributed
9+
// except according to those terms.
10+
11+
fn f(x: &mut u32) {}
12+
13+
fn main() {
14+
let x = Box::new(3);
15+
f(&mut *x);
16+
}

src/test/ui/issue-36400.stderr

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
error[E0596]: cannot borrow immutable `Box` content `*x` as mutable
2+
--> $DIR/issue-36400.rs:15:12
3+
|
4+
14 | let x = Box::new(3);
5+
| - consider changing this to `mut x`
6+
15 | f(&mut *x);
7+
| ^^ cannot borrow as mutable
8+
9+
error: aborting due to previous error
10+

0 commit comments

Comments
 (0)