Skip to content

Commit 04aa5c1

Browse files
committed
Add tests for issues with the E-needstest label
1 parent 7c46c6c commit 04aa5c1

File tree

8 files changed

+175
-0
lines changed

8 files changed

+175
-0
lines changed

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

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
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+
// Shadowing a unit-like enum in a closure
12+
13+
struct Test;
14+
15+
fn main() {
16+
|| {
17+
let Test = 1; //~ ERROR let bindings cannot shadow unit structs
18+
};
19+
}

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

+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
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(associated_consts)]
12+
13+
trait VecN {
14+
const DIM: usize;
15+
}
16+
trait Mat {
17+
type Row: VecN;
18+
}
19+
20+
fn m<M: Mat>() {
21+
let a = [3; M::Row::DIM]; //~ ERROR associated type `Row` not found for `M`
22+
}
23+
fn main() {
24+
}

src/test/run-fail/issue-29798.rs

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
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+
// error-pattern:index out of bounds: the len is 5 but the index is 5
12+
13+
#![feature(const_fn)]
14+
const fn test(x: usize) -> i32 {
15+
[42;5][x]
16+
}
17+
18+
fn main () {
19+
let _ = test(5);
20+
}

src/test/run-pass/issue-29516.rs

+28
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
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(optin_builtin_traits)]
12+
13+
trait NotSame {}
14+
impl NotSame for .. {}
15+
impl<A> !NotSame for (A, A) {}
16+
17+
trait OneOfEach {}
18+
19+
impl<A> OneOfEach for (A,) {}
20+
21+
impl<A, B> OneOfEach for (A, B)
22+
where
23+
(B,): OneOfEach,
24+
(A, B): NotSame,
25+
{
26+
}
27+
28+
fn main() {}

src/test/run-pass/issue-34780.rs

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
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(associated_consts)]
12+
13+
use std::marker::PhantomData;
14+
15+
trait Tr<'a> {
16+
const C: PhantomData<&'a u8> = PhantomData::<&'a u8>;
17+
}
18+
19+
fn main() {}

src/test/run-pass/issue-39467.rs

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
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+
macro_rules! expr { () => { () } }
12+
13+
enum A {}
14+
15+
impl A {
16+
const A: () = expr!();
17+
}
18+
19+
fn main() {}

src/test/run-pass/issue-39720.rs

+31
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
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(repr_simd, platform_intrinsics)]
12+
13+
#[repr(C)]
14+
#[repr(simd)]
15+
#[derive(Copy, Clone, Debug)]
16+
pub struct char3(pub i8, pub i8, pub i8);
17+
18+
#[repr(C)]
19+
#[repr(simd)]
20+
#[derive(Copy, Clone, Debug)]
21+
pub struct short3(pub i16, pub i16, pub i16);
22+
23+
extern "platform-intrinsic" {
24+
fn simd_cast<T, U>(x: T) -> U;
25+
}
26+
27+
fn main() {
28+
let cast: short3 = unsafe { simd_cast(char3(10, -3, -9)) };
29+
30+
println!("{:?}", cast);
31+
}

src/test/rustdoc/issue-19181.rs

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
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+
// compile-flags:--test
12+
13+
// rustdoc should not panic when target crate has compilation errors
14+
15+
fn main() { 0 }

0 commit comments

Comments
 (0)