Skip to content

Commit d4e51a8

Browse files
committed
Move compile-fail tests with NOTE/HELP annotations to UI
1 parent 3a2ad57 commit d4e51a8

File tree

451 files changed

+5821
-7
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

451 files changed

+5821
-7
lines changed
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
error[E0038]: the trait `Foo` cannot be made into an object
2+
--> $DIR/arbitrary-self-types-not-object-safe.rs:40:33
3+
|
4+
40 | let x = Box::new(5usize) as Box<Foo>;
5+
| ^^^^^^^^ the trait `Foo` cannot be made into an object
6+
|
7+
= note: method `foo` has a non-standard `self` type. Only `&self`, `&mut self`, and `Box<Self>` are currently supported for trait objects
8+
9+
error[E0038]: the trait `Foo` cannot be made into an object
10+
--> $DIR/arbitrary-self-types-not-object-safe.rs:40:13
11+
|
12+
40 | let x = Box::new(5usize) as Box<Foo>;
13+
| ^^^^^^^^^^^^^^^^ the trait `Foo` cannot be made into an object
14+
|
15+
= note: method `foo` has a non-standard `self` type. Only `&self`, `&mut self`, and `Box<Self>` are currently supported for trait objects
16+
= note: required because of the requirements on the impl of `std::ops::CoerceUnsized<std::boxed::Box<Foo>>` for `std::boxed::Box<usize>`
17+
18+
error: aborting due to 2 previous errors
19+

src/test/ui/asm-out-assign-imm.stderr

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
error[E0384]: cannot assign twice to immutable variable `x`
2+
--> $DIR/asm-out-assign-imm.rs:29:9
3+
|
4+
26 | x = 1; //~ NOTE first assignment
5+
| ----- first assignment to `x`
6+
...
7+
29 | asm!("mov $1, $0" : "=r"(x) : "r"(5));
8+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot assign twice to immutable variable
9+
10+
error: aborting due to previous error
11+
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
error[E0308]: mismatched types
2+
--> $DIR/associated-const-impl-wrong-lifetime.rs:19:5
3+
|
4+
19 | const NAME: &'a str = "unit";
5+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ lifetime mismatch
6+
|
7+
= note: expected type `&'static str`
8+
found type `&'a str`
9+
note: the lifetime 'a as defined on the impl at 17:1...
10+
--> $DIR/associated-const-impl-wrong-lifetime.rs:17:1
11+
|
12+
17 | / impl<'a> Foo for &'a () {
13+
18 | | //~^ NOTE the lifetime 'a as defined
14+
19 | | const NAME: &'a str = "unit";
15+
20 | | //~^ ERROR mismatched types [E0308]
16+
... |
17+
23 | | //~| NOTE ...does not necessarily outlive the static lifetime
18+
24 | | }
19+
| |_^
20+
= note: ...does not necessarily outlive the static lifetime
21+
22+
error: aborting due to previous error
23+
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
error[E0326]: implemented const `BAR` has an incompatible type for trait
2+
--> $DIR/associated-const-impl-wrong-type.rs:19:16
3+
|
4+
13 | const BAR: u32; //~ NOTE type in trait
5+
| --- type in trait
6+
...
7+
19 | const BAR: i32 = -1;
8+
| ^^^ expected u32, found i32
9+
10+
error: aborting due to previous error
11+
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
error[E0221]: ambiguous associated type `Color` in bounds of `C`
2+
--> $DIR/associated-type-projection-from-multiple-supertraits.rs:35:32
3+
|
4+
15 | type Color;
5+
| ----------- ambiguous `Color` from `Vehicle`
6+
...
7+
24 | type Color;
8+
| ----------- ambiguous `Color` from `Box`
9+
...
10+
35 | fn dent<C:BoxCar>(c: C, color: C::Color) {
11+
| ^^^^^^^^ ambiguous associated type `Color`
12+
13+
error[E0221]: ambiguous associated type `Color` in bounds of `BoxCar`
14+
--> $DIR/associated-type-projection-from-multiple-supertraits.rs:40:33
15+
|
16+
15 | type Color;
17+
| ----------- ambiguous `Color` from `Vehicle`
18+
...
19+
24 | type Color;
20+
| ----------- ambiguous `Color` from `Box`
21+
...
22+
40 | fn dent_object<COLOR>(c: BoxCar<Color=COLOR>) {
23+
| ^^^^^^^^^^^ ambiguous associated type `Color`
24+
25+
error[E0191]: the value of the associated type `Color` (from the trait `Vehicle`) must be specified
26+
--> $DIR/associated-type-projection-from-multiple-supertraits.rs:40:26
27+
|
28+
40 | fn dent_object<COLOR>(c: BoxCar<Color=COLOR>) {
29+
| ^^^^^^^^^^^^^^^^^^^ missing associated type `Color` value
30+
31+
error[E0221]: ambiguous associated type `Color` in bounds of `C`
32+
--> $DIR/associated-type-projection-from-multiple-supertraits.rs:47:29
33+
|
34+
15 | type Color;
35+
| ----------- ambiguous `Color` from `Vehicle`
36+
...
37+
24 | type Color;
38+
| ----------- ambiguous `Color` from `Box`
39+
...
40+
47 | fn paint<C:BoxCar>(c: C, d: C::Color) {
41+
| ^^^^^^^^ ambiguous associated type `Color`
42+
43+
error: aborting due to 4 previous errors
44+
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
error[E0277]: the trait bound `(): Add<A>` is not satisfied
2+
--> $DIR/associated-types-ICE-when-projecting-out-of-err.rs:33:11
3+
|
4+
33 | r = r + a;
5+
| ^ the trait `Add<A>` is not implemented for `()`
6+
7+
error: aborting due to previous error
8+
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
error[E0223]: ambiguous associated type
2+
--> $DIR/associated-types-in-ambiguous-context.rs:16:36
3+
|
4+
16 | fn get<T:Get,U:Get>(x: T, y: U) -> Get::Value {}
5+
| ^^^^^^^^^^ ambiguous associated type
6+
|
7+
= note: specify the type using the syntax `<Type as Get>::Value`
8+
9+
error[E0223]: ambiguous associated type
10+
--> $DIR/associated-types-in-ambiguous-context.rs:29:10
11+
|
12+
29 | type X = std::ops::Deref::Target;
13+
| ^^^^^^^^^^^^^^^^^^^^^^^ ambiguous associated type
14+
|
15+
= note: specify the type using the syntax `<Type as std::ops::Deref>::Target`
16+
17+
error[E0223]: ambiguous associated type
18+
--> $DIR/associated-types-in-ambiguous-context.rs:23:23
19+
|
20+
23 | fn grab(&self) -> Grab::Value;
21+
| ^^^^^^^^^^^ ambiguous associated type
22+
|
23+
= note: specify the type using the syntax `<Type as Grab>::Value`
24+
25+
error: aborting due to 3 previous errors
26+
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
error[E0596]: cannot borrow immutable local variable `y` as mutable
2+
--> $DIR/augmented-assignments.rs:31:5
3+
|
4+
29 | let y = Int(2);
5+
| - consider changing this to `mut y`
6+
30 | //~^ consider changing this to `mut y`
7+
31 | y //~ error: cannot borrow immutable local variable `y` as mutable
8+
| ^ cannot borrow mutably
9+
10+
error[E0382]: use of moved value: `x`
11+
--> $DIR/augmented-assignments.rs:23:5
12+
|
13+
23 | x //~ error: use of moved value: `x`
14+
| ^ value used here after move
15+
...
16+
27 | x; //~ value moved here
17+
| - value moved here
18+
|
19+
= note: move occurs because `x` has type `Int`, which does not implement the `Copy` trait
20+
21+
error: aborting due to 2 previous errors
22+
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
// Copyright 2012 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+
#![crate_type="lib"]
12+
13+
pub trait Remote {
14+
fn foo(&self) { }
15+
}
16+
17+
pub trait Remote1<T> {
18+
fn foo(&self, t: T) { }
19+
}
20+
21+
pub trait Remote2<T, U> {
22+
fn foo(&self, t: T, u: U) { }
23+
}
24+
25+
pub struct Pair<T,U>(T,U);

src/test/ui/auxiliary/empty-struct.rs

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
// Copyright 2015 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 XEmpty1 {}
12+
pub struct XEmpty2;
13+
pub struct XEmpty6();
14+
15+
pub enum XE {
16+
XEmpty3 {},
17+
XEmpty4,
18+
XEmpty5(),
19+
}
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
// Copyright 2014 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+
#![crate_name="lint_output_format"]
12+
#![crate_type = "lib"]
13+
#![feature(staged_api)]
14+
#![unstable(feature = "test_feature", issue = "0")]
15+
16+
#[stable(feature = "test_feature", since = "1.0.0")]
17+
#[rustc_deprecated(since = "1.0.0", reason = "text")]
18+
pub fn foo() -> usize {
19+
20
20+
}
21+
22+
#[unstable(feature = "test_feature", issue = "0")]
23+
pub fn bar() -> usize {
24+
40
25+
}
26+
27+
#[unstable(feature = "test_feature", issue = "0")]
28+
pub fn baz() -> usize {
29+
30
30+
}
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
// Copyright 2014 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 A {
12+
a: isize,
13+
pub b: isize,
14+
}
15+
16+
pub struct B {
17+
pub a: isize,
18+
b: isize,
19+
}

src/test/ui/auxiliary/two_macros.rs

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
// Copyright 2015 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_export]
12+
macro_rules! macro_one { () => ("one") }
13+
14+
#[macro_export]
15+
macro_rules! macro_two { () => ("two") }
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
error[E0369]: binary operation `%` cannot be applied to type `&&{integer}`
2+
--> $DIR/binary-op-on-double-ref.rs:14:9
3+
|
4+
14 | x % 2 == 0
5+
| ^^^^^
6+
|
7+
= note: this is a reference to a type that `%` can be applied to; you need to dereference this variable once for this operation to work
8+
= note: an implementation of `std::ops::Rem` might be missing for `&&{integer}`
9+
10+
error: aborting due to previous error
11+
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
error[E0255]: the name `foo` is defined multiple times
2+
--> $DIR/blind-item-item-shadow.rs:13:5
3+
|
4+
11 | mod foo { pub mod foo { } } //~ NOTE previous definition of the module `foo` here
5+
| ---------------------------- previous definition of the module `foo` here
6+
12 |
7+
13 | use foo::foo;
8+
| ^^^^^^^^ `foo` reimported here
9+
|
10+
= note: `foo` must be defined only once in the type namespace of this module
11+
help: You can use `as` to change the binding name of the import
12+
|
13+
13 | use foo::foo as Otherfoo;
14+
| ^^^^^^^^^^^^^^^^^^^^
15+
16+
error: aborting due to previous error
17+
File renamed without changes.

src/test/ui/bogus-tag.stderr

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
error[E0599]: no variant named `hsl` found for type `color` in the current scope
2+
--> $DIR/bogus-tag.rs:19:7
3+
|
4+
12 | enum color { rgb(isize, isize, isize), rgba(isize, isize, isize, isize), }
5+
| ---------- variant `hsl` not found here
6+
...
7+
19 | color::hsl(h, s, l) => { println!("hsl"); }
8+
| ^^^^^^^^^^^^^^^^^^^ variant not found in `color`
9+
10+
error: aborting due to previous error
11+

0 commit comments

Comments
 (0)