Skip to content

Commit

Permalink
Move compile-fail tests with NOTE/HELP annotations to UI
Browse files Browse the repository at this point in the history
  • Loading branch information
petrochenkov committed Dec 14, 2017
1 parent 3a2ad57 commit d4e51a8
Show file tree
Hide file tree
Showing 451 changed files with 5,821 additions and 7 deletions.
19 changes: 19 additions & 0 deletions src/test/ui/arbitrary-self-types-not-object-safe.stderr
@@ -0,0 +1,19 @@
error[E0038]: the trait `Foo` cannot be made into an object
--> $DIR/arbitrary-self-types-not-object-safe.rs:40:33
|
40 | let x = Box::new(5usize) as Box<Foo>;
| ^^^^^^^^ the trait `Foo` cannot be made into an object
|
= note: method `foo` has a non-standard `self` type. Only `&self`, `&mut self`, and `Box<Self>` are currently supported for trait objects

error[E0038]: the trait `Foo` cannot be made into an object
--> $DIR/arbitrary-self-types-not-object-safe.rs:40:13
|
40 | let x = Box::new(5usize) as Box<Foo>;
| ^^^^^^^^^^^^^^^^ the trait `Foo` cannot be made into an object
|
= note: method `foo` has a non-standard `self` type. Only `&self`, `&mut self`, and `Box<Self>` are currently supported for trait objects
= note: required because of the requirements on the impl of `std::ops::CoerceUnsized<std::boxed::Box<Foo>>` for `std::boxed::Box<usize>`

error: aborting due to 2 previous errors

File renamed without changes.
11 changes: 11 additions & 0 deletions src/test/ui/asm-out-assign-imm.stderr
@@ -0,0 +1,11 @@
error[E0384]: cannot assign twice to immutable variable `x`
--> $DIR/asm-out-assign-imm.rs:29:9
|
26 | x = 1; //~ NOTE first assignment
| ----- first assignment to `x`
...
29 | asm!("mov $1, $0" : "=r"(x) : "r"(5));
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot assign twice to immutable variable

error: aborting due to previous error

23 changes: 23 additions & 0 deletions src/test/ui/associated-const-impl-wrong-lifetime.stderr
@@ -0,0 +1,23 @@
error[E0308]: mismatched types
--> $DIR/associated-const-impl-wrong-lifetime.rs:19:5
|
19 | const NAME: &'a str = "unit";
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ lifetime mismatch
|
= note: expected type `&'static str`
found type `&'a str`
note: the lifetime 'a as defined on the impl at 17:1...
--> $DIR/associated-const-impl-wrong-lifetime.rs:17:1
|
17 | / impl<'a> Foo for &'a () {
18 | | //~^ NOTE the lifetime 'a as defined
19 | | const NAME: &'a str = "unit";
20 | | //~^ ERROR mismatched types [E0308]
... |
23 | | //~| NOTE ...does not necessarily outlive the static lifetime
24 | | }
| |_^
= note: ...does not necessarily outlive the static lifetime

error: aborting due to previous error

11 changes: 11 additions & 0 deletions src/test/ui/associated-const-impl-wrong-type.stderr
@@ -0,0 +1,11 @@
error[E0326]: implemented const `BAR` has an incompatible type for trait
--> $DIR/associated-const-impl-wrong-type.rs:19:16
|
13 | const BAR: u32; //~ NOTE type in trait
| --- type in trait
...
19 | const BAR: i32 = -1;
| ^^^ expected u32, found i32

error: aborting due to previous error

@@ -0,0 +1,44 @@
error[E0221]: ambiguous associated type `Color` in bounds of `C`
--> $DIR/associated-type-projection-from-multiple-supertraits.rs:35:32
|
15 | type Color;
| ----------- ambiguous `Color` from `Vehicle`
...
24 | type Color;
| ----------- ambiguous `Color` from `Box`
...
35 | fn dent<C:BoxCar>(c: C, color: C::Color) {
| ^^^^^^^^ ambiguous associated type `Color`

error[E0221]: ambiguous associated type `Color` in bounds of `BoxCar`
--> $DIR/associated-type-projection-from-multiple-supertraits.rs:40:33
|
15 | type Color;
| ----------- ambiguous `Color` from `Vehicle`
...
24 | type Color;
| ----------- ambiguous `Color` from `Box`
...
40 | fn dent_object<COLOR>(c: BoxCar<Color=COLOR>) {
| ^^^^^^^^^^^ ambiguous associated type `Color`

error[E0191]: the value of the associated type `Color` (from the trait `Vehicle`) must be specified
--> $DIR/associated-type-projection-from-multiple-supertraits.rs:40:26
|
40 | fn dent_object<COLOR>(c: BoxCar<Color=COLOR>) {
| ^^^^^^^^^^^^^^^^^^^ missing associated type `Color` value

error[E0221]: ambiguous associated type `Color` in bounds of `C`
--> $DIR/associated-type-projection-from-multiple-supertraits.rs:47:29
|
15 | type Color;
| ----------- ambiguous `Color` from `Vehicle`
...
24 | type Color;
| ----------- ambiguous `Color` from `Box`
...
47 | fn paint<C:BoxCar>(c: C, d: C::Color) {
| ^^^^^^^^ ambiguous associated type `Color`

error: aborting due to 4 previous errors

@@ -0,0 +1,8 @@
error[E0277]: the trait bound `(): Add<A>` is not satisfied
--> $DIR/associated-types-ICE-when-projecting-out-of-err.rs:33:11
|
33 | r = r + a;
| ^ the trait `Add<A>` is not implemented for `()`

error: aborting due to previous error

26 changes: 26 additions & 0 deletions src/test/ui/associated-types-in-ambiguous-context.stderr
@@ -0,0 +1,26 @@
error[E0223]: ambiguous associated type
--> $DIR/associated-types-in-ambiguous-context.rs:16:36
|
16 | fn get<T:Get,U:Get>(x: T, y: U) -> Get::Value {}
| ^^^^^^^^^^ ambiguous associated type
|
= note: specify the type using the syntax `<Type as Get>::Value`

error[E0223]: ambiguous associated type
--> $DIR/associated-types-in-ambiguous-context.rs:29:10
|
29 | type X = std::ops::Deref::Target;
| ^^^^^^^^^^^^^^^^^^^^^^^ ambiguous associated type
|
= note: specify the type using the syntax `<Type as std::ops::Deref>::Target`

error[E0223]: ambiguous associated type
--> $DIR/associated-types-in-ambiguous-context.rs:23:23
|
23 | fn grab(&self) -> Grab::Value;
| ^^^^^^^^^^^ ambiguous associated type
|
= note: specify the type using the syntax `<Type as Grab>::Value`

error: aborting due to 3 previous errors

File renamed without changes.
22 changes: 22 additions & 0 deletions src/test/ui/augmented-assignments.stderr
@@ -0,0 +1,22 @@
error[E0596]: cannot borrow immutable local variable `y` as mutable
--> $DIR/augmented-assignments.rs:31:5
|
29 | let y = Int(2);
| - consider changing this to `mut y`
30 | //~^ consider changing this to `mut y`
31 | y //~ error: cannot borrow immutable local variable `y` as mutable
| ^ cannot borrow mutably

error[E0382]: use of moved value: `x`
--> $DIR/augmented-assignments.rs:23:5
|
23 | x //~ error: use of moved value: `x`
| ^ value used here after move
...
27 | x; //~ value moved here
| - value moved here
|
= note: move occurs because `x` has type `Int`, which does not implement the `Copy` trait

error: aborting due to 2 previous errors

File renamed without changes.
File renamed without changes.
File renamed without changes.
25 changes: 25 additions & 0 deletions src/test/ui/auxiliary/coherence_lib.rs
@@ -0,0 +1,25 @@
// Copyright 2012 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.

#![crate_type="lib"]

pub trait Remote {
fn foo(&self) { }
}

pub trait Remote1<T> {
fn foo(&self, t: T) { }
}

pub trait Remote2<T, U> {
fn foo(&self, t: T, u: U) { }
}

pub struct Pair<T,U>(T,U);
19 changes: 19 additions & 0 deletions src/test/ui/auxiliary/empty-struct.rs
@@ -0,0 +1,19 @@
// Copyright 2015 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.

pub struct XEmpty1 {}
pub struct XEmpty2;
pub struct XEmpty6();

pub enum XE {
XEmpty3 {},
XEmpty4,
XEmpty5(),
}
File renamed without changes.
30 changes: 30 additions & 0 deletions src/test/ui/auxiliary/lint_output_format.rs
@@ -0,0 +1,30 @@
// Copyright 2014 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.

#![crate_name="lint_output_format"]
#![crate_type = "lib"]
#![feature(staged_api)]
#![unstable(feature = "test_feature", issue = "0")]

#[stable(feature = "test_feature", since = "1.0.0")]
#[rustc_deprecated(since = "1.0.0", reason = "text")]
pub fn foo() -> usize {
20
}

#[unstable(feature = "test_feature", issue = "0")]
pub fn bar() -> usize {
40
}

#[unstable(feature = "test_feature", issue = "0")]
pub fn baz() -> usize {
30
}
19 changes: 19 additions & 0 deletions src/test/ui/auxiliary/struct_field_privacy.rs
@@ -0,0 +1,19 @@
// Copyright 2014 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.

pub struct A {
a: isize,
pub b: isize,
}

pub struct B {
pub a: isize,
b: isize,
}
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
15 changes: 15 additions & 0 deletions src/test/ui/auxiliary/two_macros.rs
@@ -0,0 +1,15 @@
// Copyright 2015 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.

#[macro_export]
macro_rules! macro_one { () => ("one") }

#[macro_export]
macro_rules! macro_two { () => ("two") }
File renamed without changes.
11 changes: 11 additions & 0 deletions src/test/ui/binary-op-on-double-ref.stderr
@@ -0,0 +1,11 @@
error[E0369]: binary operation `%` cannot be applied to type `&&{integer}`
--> $DIR/binary-op-on-double-ref.rs:14:9
|
14 | x % 2 == 0
| ^^^^^
|
= 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
= note: an implementation of `std::ops::Rem` might be missing for `&&{integer}`

error: aborting due to previous error

File renamed without changes.
17 changes: 17 additions & 0 deletions src/test/ui/blind-item-item-shadow.stderr
@@ -0,0 +1,17 @@
error[E0255]: the name `foo` is defined multiple times
--> $DIR/blind-item-item-shadow.rs:13:5
|
11 | mod foo { pub mod foo { } } //~ NOTE previous definition of the module `foo` here
| ---------------------------- previous definition of the module `foo` here
12 |
13 | use foo::foo;
| ^^^^^^^^ `foo` reimported here
|
= note: `foo` must be defined only once in the type namespace of this module
help: You can use `as` to change the binding name of the import
|
13 | use foo::foo as Otherfoo;
| ^^^^^^^^^^^^^^^^^^^^

error: aborting due to previous error

File renamed without changes.
11 changes: 11 additions & 0 deletions src/test/ui/bogus-tag.stderr
@@ -0,0 +1,11 @@
error[E0599]: no variant named `hsl` found for type `color` in the current scope
--> $DIR/bogus-tag.rs:19:7
|
12 | enum color { rgb(isize, isize, isize), rgba(isize, isize, isize, isize), }
| ---------- variant `hsl` not found here
...
19 | color::hsl(h, s, l) => { println!("hsl"); }
| ^^^^^^^^^^^^^^^^^^^ variant not found in `color`

error: aborting due to previous error

0 comments on commit d4e51a8

Please sign in to comment.