Update test/ui/parser for bare_trait_object warnings

This commit is contained in:
memoryruins 2019-05-28 14:45:27 -04:00
parent 54e10558b4
commit a1d1d7a2c6
10 changed files with 43 additions and 12 deletions

View File

@ -1,5 +1,7 @@
// compile-pass
#![allow(bare_trait_objects)]
type A = Box<(Fn(u8) -> u8) + 'static + Send + Sync>; // OK (but see #39318)
fn main() {}

View File

@ -2,6 +2,7 @@
// compile-flags: -Z continue-parse-after-error
#![feature(box_syntax)]
#![allow(bare_trait_objects)]
use std::fmt::Debug;

View File

@ -1,6 +1,7 @@
// compile-flags: -Z continue-parse-after-error
#![feature(optin_builtin_traits)]
#![allow(bare_trait_objects)]
auto trait Auto {}

View File

@ -1,23 +1,23 @@
error[E0178]: expected a path on the left-hand side of `+`, not `((Auto))`
--> $DIR/trait-object-bad-parens.rs:8:16
--> $DIR/trait-object-bad-parens.rs:9:16
|
LL | let _: Box<((Auto)) + Auto>;
| ^^^^^^^^^^^^^^^ expected a path
error[E0178]: expected a path on the left-hand side of `+`, not `(Auto + Auto)`
--> $DIR/trait-object-bad-parens.rs:10:16
--> $DIR/trait-object-bad-parens.rs:11:16
|
LL | let _: Box<(Auto + Auto) + Auto>;
| ^^^^^^^^^^^^^^^^^^^^ expected a path
error[E0178]: expected a path on the left-hand side of `+`, not `(Auto)`
--> $DIR/trait-object-bad-parens.rs:12:16
--> $DIR/trait-object-bad-parens.rs:13:16
|
LL | let _: Box<(Auto +) + Auto>;
| ^^^^^^^^^^^^^^^ expected a path
error[E0178]: expected a path on the left-hand side of `+`, not `(dyn Auto)`
--> $DIR/trait-object-bad-parens.rs:14:16
--> $DIR/trait-object-bad-parens.rs:15:16
|
LL | let _: Box<(dyn Auto) + Auto>;
| ^^^^^^^^^^^^^^^^^ expected a path

View File

@ -1,5 +1,7 @@
// compile-flags: -Z continue-parse-after-error
#![allow(bare_trait_objects)]
trait Trait {}
fn f<'a, T: Trait + ('a)>() {} //~ ERROR parenthesized lifetime bounds are not supported

View File

@ -1,23 +1,23 @@
error: parenthesized lifetime bounds are not supported
--> $DIR/trait-object-lifetime-parens.rs:5:21
--> $DIR/trait-object-lifetime-parens.rs:7:21
|
LL | fn f<'a, T: Trait + ('a)>() {}
| ^^^^ help: remove the parentheses
error: parenthesized lifetime bounds are not supported
--> $DIR/trait-object-lifetime-parens.rs:8:24
--> $DIR/trait-object-lifetime-parens.rs:10:24
|
LL | let _: Box<Trait + ('a)>;
| ^^^^ help: remove the parentheses
error: expected `:`, found `)`
--> $DIR/trait-object-lifetime-parens.rs:9:19
--> $DIR/trait-object-lifetime-parens.rs:11:19
|
LL | let _: Box<('a) + Trait>;
| ^ expected `:`
error: chained comparison operators require parentheses
--> $DIR/trait-object-lifetime-parens.rs:9:15
--> $DIR/trait-object-lifetime-parens.rs:11:15
|
LL | let _: Box<('a) + Trait>;
| ^^^^^^^^^^^^^^^
@ -26,7 +26,7 @@ LL | let _: Box<('a) + Trait>;
= help: or use `(...)` if you meant to specify fn arguments
error: expected type, found `'a`
--> $DIR/trait-object-lifetime-parens.rs:9:17
--> $DIR/trait-object-lifetime-parens.rs:11:17
|
LL | let _: Box<('a) + Trait>;
| - ^^

View File

@ -1,3 +1,5 @@
#![allow(bare_trait_objects)]
trait Trait<'a> {}
fn main() {

View File

@ -1,5 +1,5 @@
error[E0178]: expected a path on the left-hand side of `+`, not `&for<'a> Trait<'a>`
--> $DIR/trait-object-polytrait-priority.rs:4:12
--> $DIR/trait-object-polytrait-priority.rs:6:12
|
LL | let _: &for<'a> Trait<'a> + 'static;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try adding parentheses: `&(for<'a> Trait<'a> + 'static)`

View File

@ -5,8 +5,11 @@ fn f<T: (Copy) + (?Sized) + (for<'a> Trait<'a>)>() {}
fn main() {
let _: Box<(Copy) + (?Sized) + (for<'a> Trait<'a>)>;
//~^ ERROR `?Trait` is not permitted in trait object types
//~| WARN trait objects without an explicit `dyn` are deprecated
let _: Box<(?Sized) + (for<'a> Trait<'a>) + (Copy)>;
//~^ WARN trait objects without an explicit `dyn` are deprecated
let _: Box<(for<'a> Trait<'a>) + (Copy) + (?Sized)>;
//~^ ERROR use of undeclared lifetime name `'a`
//~| ERROR `?Trait` is not permitted in trait object types
//~| WARN trait objects without an explicit `dyn` are deprecated
}

View File

@ -5,13 +5,33 @@ LL | let _: Box<(Copy) + (?Sized) + (for<'a> Trait<'a>)>;
| ^^^^^^^^
error: `?Trait` is not permitted in trait object types
--> $DIR/trait-object-trait-parens.rs:9:47
--> $DIR/trait-object-trait-parens.rs:11:47
|
LL | let _: Box<(for<'a> Trait<'a>) + (Copy) + (?Sized)>;
| ^^^^^^^^
warning: trait objects without an explicit `dyn` are deprecated
--> $DIR/trait-object-trait-parens.rs:6:16
|
LL | let _: Box<(Copy) + (?Sized) + (for<'a> Trait<'a>)>;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use `dyn`: `dyn (Copy) + (?Sized) + (for<'a> Trait<'a>)`
|
= note: #[warn(bare_trait_objects)] on by default
warning: trait objects without an explicit `dyn` are deprecated
--> $DIR/trait-object-trait-parens.rs:9:16
|
LL | let _: Box<(?Sized) + (for<'a> Trait<'a>) + (Copy)>;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use `dyn`: `dyn (?Sized) + (for<'a> Trait<'a>) + (Copy)`
warning: trait objects without an explicit `dyn` are deprecated
--> $DIR/trait-object-trait-parens.rs:11:16
|
LL | let _: Box<(for<'a> Trait<'a>) + (Copy) + (?Sized)>;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use `dyn`: `dyn (for<'a> Trait<'a>) + (Copy) + (?Sized)`
error[E0261]: use of undeclared lifetime name `'a`
--> $DIR/trait-object-trait-parens.rs:9:31
--> $DIR/trait-object-trait-parens.rs:11:31
|
LL | let _: Box<(for<'a> Trait<'a>) + (Copy) + (?Sized)>;
| ^^ undeclared lifetime