diff options
| author | memoryruins <memoryruinsmusic@gmail.com> | 2019-05-28 14:46:13 -0400 |
|---|---|---|
| committer | memoryruins <memoryruinsmusic@gmail.com> | 2019-05-29 00:57:31 -0400 |
| commit | eb4580a570069175e1290b294d91042a09f9fde3 (patch) | |
| tree | fdb0ef28968512495204bd7a3dc3253cdb20365a /src/test/ui/object-lifetime | |
| parent | a1d1d7a2c696c2afeff2ea206621a32d77fa49dc (diff) | |
| download | rust-eb4580a570069175e1290b294d91042a09f9fde3.tar.gz rust-eb4580a570069175e1290b294d91042a09f9fde3.zip | |
Update ui test suite to use dyn
Diffstat (limited to 'src/test/ui/object-lifetime')
17 files changed, 53 insertions, 53 deletions
diff --git a/src/test/ui/object-lifetime/object-lifetime-default-ambiguous.rs b/src/test/ui/object-lifetime/object-lifetime-default-ambiguous.rs index d14351aef9a..5dae92fee5f 100644 --- a/src/test/ui/object-lifetime/object-lifetime-default-ambiguous.rs +++ b/src/test/ui/object-lifetime/object-lifetime-default-ambiguous.rs @@ -20,27 +20,27 @@ struct Ref2<'a,'b:'a,T:'a+'b+?Sized> { r: &'a &'b T } -fn a<'a,'b>(t: Ref2<'a,'b,Test>) { +fn a<'a,'b>(t: Ref2<'a,'b, dyn Test>) { //~^ ERROR lifetime bound for this object type cannot be deduced from context } -fn b(t: Ref2<Test>) { +fn b(t: Ref2<dyn Test>) { //~^ ERROR lifetime bound for this object type cannot be deduced from context } -fn c(t: Ref2<&Test>) { +fn c(t: Ref2<&dyn Test>) { // In this case, the &'a overrides. } -fn d(t: Ref2<Ref1<Test>>) { +fn d(t: Ref2<Ref1<dyn Test>>) { // In this case, the lifetime parameter from the Ref1 overrides. } -fn e(t: Ref2<Ref0<Test>>) { +fn e(t: Ref2<Ref0<dyn Test>>) { // In this case, Ref2 is ambiguous, but Ref0 overrides with 'static. } -fn f(t: &Ref2<Test>) { +fn f(t: &Ref2<dyn Test>) { //~^ ERROR lifetime bound for this object type cannot be deduced from context } diff --git a/src/test/ui/object-lifetime/object-lifetime-default-ambiguous.stderr b/src/test/ui/object-lifetime/object-lifetime-default-ambiguous.stderr index 0319c7bfbe2..0c3dbffeea6 100644 --- a/src/test/ui/object-lifetime/object-lifetime-default-ambiguous.stderr +++ b/src/test/ui/object-lifetime/object-lifetime-default-ambiguous.stderr @@ -1,20 +1,20 @@ error[E0228]: the lifetime bound for this object type cannot be deduced from context; please supply an explicit bound - --> $DIR/object-lifetime-default-ambiguous.rs:23:27 + --> $DIR/object-lifetime-default-ambiguous.rs:23:28 | -LL | fn a<'a,'b>(t: Ref2<'a,'b,Test>) { - | ^^^^ +LL | fn a<'a,'b>(t: Ref2<'a,'b, dyn Test>) { + | ^^^^^^^^ error[E0228]: the lifetime bound for this object type cannot be deduced from context; please supply an explicit bound --> $DIR/object-lifetime-default-ambiguous.rs:27:14 | -LL | fn b(t: Ref2<Test>) { - | ^^^^ +LL | fn b(t: Ref2<dyn Test>) { + | ^^^^^^^^ error[E0228]: the lifetime bound for this object type cannot be deduced from context; please supply an explicit bound --> $DIR/object-lifetime-default-ambiguous.rs:43:15 | -LL | fn f(t: &Ref2<Test>) { - | ^^^^ +LL | fn f(t: &Ref2<dyn Test>) { + | ^^^^^^^^ error: aborting due to 3 previous errors diff --git a/src/test/ui/object-lifetime/object-lifetime-default-elision.nll.stderr b/src/test/ui/object-lifetime/object-lifetime-default-elision.nll.stderr index 19cdd66ef75..e94f2a92125 100644 --- a/src/test/ui/object-lifetime/object-lifetime-default-elision.nll.stderr +++ b/src/test/ui/object-lifetime/object-lifetime-default-elision.nll.stderr @@ -1,7 +1,7 @@ error: lifetime may not live long enough --> $DIR/object-lifetime-default-elision.rs:71:5 | -LL | fn load3<'a,'b>(ss: &'a SomeTrait) -> &'b SomeTrait { +LL | fn load3<'a,'b>(ss: &'a dyn SomeTrait) -> &'b dyn SomeTrait { | -- -- lifetime `'b` defined here | | | lifetime `'a` defined here diff --git a/src/test/ui/object-lifetime/object-lifetime-default-elision.rs b/src/test/ui/object-lifetime/object-lifetime-default-elision.rs index cf15a4e8676..dc42edfba2c 100644 --- a/src/test/ui/object-lifetime/object-lifetime-default-elision.rs +++ b/src/test/ui/object-lifetime/object-lifetime-default-elision.rs @@ -8,7 +8,7 @@ trait SomeTrait { } struct SomeStruct<'a> { - r: Box<SomeTrait+'a> + r: Box<dyn SomeTrait+'a> } fn deref<T>(ss: &T) -> T { @@ -17,7 +17,7 @@ fn deref<T>(ss: &T) -> T { loop { } } -fn load0<'a>(ss: &'a Box<SomeTrait>) -> Box<SomeTrait> { +fn load0<'a>(ss: &'a Box<dyn SomeTrait>) -> Box<dyn SomeTrait> { // Under old rules, the fully elaborated types of input/output were: // // for<'a,'b> fn(&'a Box<SomeTrait+'b>) -> Box<SomeTrait+'a> @@ -31,7 +31,7 @@ fn load0<'a>(ss: &'a Box<SomeTrait>) -> Box<SomeTrait> { deref(ss) } -fn load1(ss: &SomeTrait) -> &SomeTrait { +fn load1(ss: &dyn SomeTrait) -> &dyn SomeTrait { // Under old rules, the fully elaborated types of input/output were: // // for<'a,'b> fn(&'a (SomeTrait+'b)) -> &'a (SomeTrait+'a) @@ -45,13 +45,13 @@ fn load1(ss: &SomeTrait) -> &SomeTrait { ss } -fn load2<'a>(ss: &'a SomeTrait) -> &SomeTrait { +fn load2<'a>(ss: &'a dyn SomeTrait) -> &dyn SomeTrait { // Same as `load1` but with an explicit name thrown in for fun. ss } -fn load3<'a,'b>(ss: &'a SomeTrait) -> &'b SomeTrait { +fn load3<'a,'b>(ss: &'a dyn SomeTrait) -> &'b dyn SomeTrait { // Under old rules, the fully elaborated types of input/output were: // // for<'a,'b,'c>fn(&'a (SomeTrait+'c)) -> &'b (SomeTrait+'a) diff --git a/src/test/ui/object-lifetime/object-lifetime-default-elision.stderr b/src/test/ui/object-lifetime/object-lifetime-default-elision.stderr index dcb07a1706f..2cdd6c5d890 100644 --- a/src/test/ui/object-lifetime/object-lifetime-default-elision.stderr +++ b/src/test/ui/object-lifetime/object-lifetime-default-elision.stderr @@ -7,7 +7,7 @@ LL | ss note: first, the lifetime cannot outlive the lifetime 'a as defined on the function body at 54:10... --> $DIR/object-lifetime-default-elision.rs:54:10 | -LL | fn load3<'a,'b>(ss: &'a SomeTrait) -> &'b SomeTrait { +LL | fn load3<'a,'b>(ss: &'a dyn SomeTrait) -> &'b dyn SomeTrait { | ^^ note: ...so that reference does not outlive borrowed content --> $DIR/object-lifetime-default-elision.rs:71:5 @@ -17,7 +17,7 @@ LL | ss note: but, the lifetime must be valid for the lifetime 'b as defined on the function body at 54:13... --> $DIR/object-lifetime-default-elision.rs:54:13 | -LL | fn load3<'a,'b>(ss: &'a SomeTrait) -> &'b SomeTrait { +LL | fn load3<'a,'b>(ss: &'a dyn SomeTrait) -> &'b dyn SomeTrait { | ^^ = note: ...so that the expression is assignable: expected &'b (dyn SomeTrait + 'b) @@ -32,7 +32,7 @@ LL | ss note: first, the lifetime cannot outlive the lifetime 'a as defined on the function body at 54:10... --> $DIR/object-lifetime-default-elision.rs:54:10 | -LL | fn load3<'a,'b>(ss: &'a SomeTrait) -> &'b SomeTrait { +LL | fn load3<'a,'b>(ss: &'a dyn SomeTrait) -> &'b dyn SomeTrait { | ^^ note: ...so that the declared lifetime parameter bounds are satisfied --> $DIR/object-lifetime-default-elision.rs:71:5 @@ -42,7 +42,7 @@ LL | ss note: but, the lifetime must be valid for the lifetime 'b as defined on the function body at 54:13... --> $DIR/object-lifetime-default-elision.rs:54:13 | -LL | fn load3<'a,'b>(ss: &'a SomeTrait) -> &'b SomeTrait { +LL | fn load3<'a,'b>(ss: &'a dyn SomeTrait) -> &'b dyn SomeTrait { | ^^ = note: ...so that the expression is assignable: expected &'b (dyn SomeTrait + 'b) diff --git a/src/test/ui/object-lifetime/object-lifetime-default-from-box-error.nll.stderr b/src/test/ui/object-lifetime/object-lifetime-default-from-box-error.nll.stderr index 9e68647214c..17fb7c4acdf 100644 --- a/src/test/ui/object-lifetime/object-lifetime-default-from-box-error.nll.stderr +++ b/src/test/ui/object-lifetime/object-lifetime-default-from-box-error.nll.stderr @@ -1,7 +1,7 @@ error[E0621]: explicit lifetime required in the type of `ss` --> $DIR/object-lifetime-default-from-box-error.rs:18:5 | -LL | fn load(ss: &mut SomeStruct) -> Box<SomeTrait> { +LL | fn load(ss: &mut SomeStruct) -> Box<dyn SomeTrait> { | --------------- help: add explicit lifetime `'static` to the type of `ss`: `&mut SomeStruct<'static>` ... LL | ss.r @@ -16,7 +16,7 @@ LL | ss.r error[E0621]: explicit lifetime required in the type of `ss` --> $DIR/object-lifetime-default-from-box-error.rs:31:5 | -LL | fn store1<'b>(ss: &mut SomeStruct, b: Box<SomeTrait+'b>) { +LL | fn store1<'b>(ss: &mut SomeStruct, b: Box<dyn SomeTrait+'b>) { | --------------- help: add explicit lifetime `'b` to the type of `ss`: `&mut SomeStruct<'b>` ... LL | ss.r = b; diff --git a/src/test/ui/object-lifetime/object-lifetime-default-from-box-error.rs b/src/test/ui/object-lifetime/object-lifetime-default-from-box-error.rs index b6d72f1fce3..587aab1edce 100644 --- a/src/test/ui/object-lifetime/object-lifetime-default-from-box-error.rs +++ b/src/test/ui/object-lifetime/object-lifetime-default-from-box-error.rs @@ -8,24 +8,24 @@ trait SomeTrait { } struct SomeStruct<'a> { - r: Box<SomeTrait+'a> + r: Box<dyn SomeTrait+'a> } -fn load(ss: &mut SomeStruct) -> Box<SomeTrait> { +fn load(ss: &mut SomeStruct) -> Box<dyn SomeTrait> { // `Box<SomeTrait>` defaults to a `'static` bound, so this return // is illegal. ss.r //~ ERROR explicit lifetime required in the type of `ss` [E0621] } -fn store(ss: &mut SomeStruct, b: Box<SomeTrait>) { +fn store(ss: &mut SomeStruct, b: Box<dyn SomeTrait>) { // No error: b is bounded by 'static which outlives the // (anonymous) lifetime on the struct. ss.r = b; } -fn store1<'b>(ss: &mut SomeStruct, b: Box<SomeTrait+'b>) { +fn store1<'b>(ss: &mut SomeStruct, b: Box<dyn SomeTrait+'b>) { // Here we override the lifetimes explicitly, and so naturally we get an error. ss.r = b; //~ ERROR explicit lifetime required in the type of `ss` [E0621] diff --git a/src/test/ui/object-lifetime/object-lifetime-default-from-box-error.stderr b/src/test/ui/object-lifetime/object-lifetime-default-from-box-error.stderr index 0077c95139f..78e4bdd374d 100644 --- a/src/test/ui/object-lifetime/object-lifetime-default-from-box-error.stderr +++ b/src/test/ui/object-lifetime/object-lifetime-default-from-box-error.stderr @@ -1,7 +1,7 @@ error[E0621]: explicit lifetime required in the type of `ss` --> $DIR/object-lifetime-default-from-box-error.rs:18:5 | -LL | fn load(ss: &mut SomeStruct) -> Box<SomeTrait> { +LL | fn load(ss: &mut SomeStruct) -> Box<dyn SomeTrait> { | --------------- help: add explicit lifetime `'static` to the type of `ss`: `&mut SomeStruct<'static>` ... LL | ss.r @@ -10,7 +10,7 @@ LL | ss.r error[E0621]: explicit lifetime required in the type of `ss` --> $DIR/object-lifetime-default-from-box-error.rs:31:12 | -LL | fn store1<'b>(ss: &mut SomeStruct, b: Box<SomeTrait+'b>) { +LL | fn store1<'b>(ss: &mut SomeStruct, b: Box<dyn SomeTrait+'b>) { | --------------- help: add explicit lifetime `'b` to the type of `ss`: `&mut SomeStruct<'b>` ... LL | ss.r = b; diff --git a/src/test/ui/object-lifetime/object-lifetime-default-from-rptr-box-error.nll.stderr b/src/test/ui/object-lifetime/object-lifetime-default-from-rptr-box-error.nll.stderr index 6d183ddf22d..7d6f9f39d13 100644 --- a/src/test/ui/object-lifetime/object-lifetime-default-from-rptr-box-error.nll.stderr +++ b/src/test/ui/object-lifetime/object-lifetime-default-from-rptr-box-error.nll.stderr @@ -1,7 +1,7 @@ error: lifetime may not live long enough --> $DIR/object-lifetime-default-from-rptr-box-error.rs:15:5 | -LL | fn c<'a>(t: &'a Box<Test+'a>, mut ss: SomeStruct<'a>) { +LL | fn c<'a>(t: &'a Box<dyn Test+'a>, mut ss: SomeStruct<'a>) { | -- lifetime `'a` defined here LL | ss.t = t; | ^^^^^^^^ assignment requires that `'a` must outlive `'static` diff --git a/src/test/ui/object-lifetime/object-lifetime-default-from-rptr-box-error.rs b/src/test/ui/object-lifetime/object-lifetime-default-from-rptr-box-error.rs index 91b384e0071..bf9e0beb57c 100644 --- a/src/test/ui/object-lifetime/object-lifetime-default-from-rptr-box-error.rs +++ b/src/test/ui/object-lifetime/object-lifetime-default-from-rptr-box-error.rs @@ -8,10 +8,10 @@ trait Test { } struct SomeStruct<'a> { - t: &'a Box<Test>, + t: &'a Box<dyn Test>, } -fn c<'a>(t: &'a Box<Test+'a>, mut ss: SomeStruct<'a>) { +fn c<'a>(t: &'a Box<dyn Test+'a>, mut ss: SomeStruct<'a>) { ss.t = t; //~ ERROR mismatched types } diff --git a/src/test/ui/object-lifetime/object-lifetime-default-from-rptr-box-error.stderr b/src/test/ui/object-lifetime/object-lifetime-default-from-rptr-box-error.stderr index d7e3a171333..4f9cef12c5e 100644 --- a/src/test/ui/object-lifetime/object-lifetime-default-from-rptr-box-error.stderr +++ b/src/test/ui/object-lifetime/object-lifetime-default-from-rptr-box-error.stderr @@ -9,7 +9,7 @@ LL | ss.t = t; note: the lifetime 'a as defined on the function body at 14:6... --> $DIR/object-lifetime-default-from-rptr-box-error.rs:14:6 | -LL | fn c<'a>(t: &'a Box<Test+'a>, mut ss: SomeStruct<'a>) { +LL | fn c<'a>(t: &'a Box<dyn Test+'a>, mut ss: SomeStruct<'a>) { | ^^ = note: ...does not necessarily outlive the static lifetime diff --git a/src/test/ui/object-lifetime/object-lifetime-default-from-rptr-struct-error.nll.stderr b/src/test/ui/object-lifetime/object-lifetime-default-from-rptr-struct-error.nll.stderr index fe3b21fa39c..6df54638ce0 100644 --- a/src/test/ui/object-lifetime/object-lifetime-default-from-rptr-struct-error.nll.stderr +++ b/src/test/ui/object-lifetime/object-lifetime-default-from-rptr-struct-error.nll.stderr @@ -1,7 +1,7 @@ error: lifetime may not live long enough --> $DIR/object-lifetime-default-from-rptr-struct-error.rs:21:5 | -LL | fn c<'a>(t: &'a MyBox<Test+'a>, mut ss: SomeStruct<'a>) { +LL | fn c<'a>(t: &'a MyBox<dyn Test+'a>, mut ss: SomeStruct<'a>) { | -- lifetime `'a` defined here LL | ss.t = t; | ^^^^^^^^ assignment requires that `'a` must outlive `'static` diff --git a/src/test/ui/object-lifetime/object-lifetime-default-from-rptr-struct-error.rs b/src/test/ui/object-lifetime/object-lifetime-default-from-rptr-struct-error.rs index 6a84621f59e..ae2878539cf 100644 --- a/src/test/ui/object-lifetime/object-lifetime-default-from-rptr-struct-error.rs +++ b/src/test/ui/object-lifetime/object-lifetime-default-from-rptr-struct-error.rs @@ -9,15 +9,15 @@ trait Test { } struct SomeStruct<'a> { - t: &'a MyBox<Test>, - u: &'a MyBox<Test+'a>, + t: &'a MyBox<dyn Test>, + u: &'a MyBox<dyn Test + 'a>, } struct MyBox<T:?Sized> { b: Box<T> } -fn c<'a>(t: &'a MyBox<Test+'a>, mut ss: SomeStruct<'a>) { +fn c<'a>(t: &'a MyBox<dyn Test+'a>, mut ss: SomeStruct<'a>) { ss.t = t; //~ ERROR mismatched types } diff --git a/src/test/ui/object-lifetime/object-lifetime-default-from-rptr-struct-error.stderr b/src/test/ui/object-lifetime/object-lifetime-default-from-rptr-struct-error.stderr index 4d082530dc5..3b7faee68aa 100644 --- a/src/test/ui/object-lifetime/object-lifetime-default-from-rptr-struct-error.stderr +++ b/src/test/ui/object-lifetime/object-lifetime-default-from-rptr-struct-error.stderr @@ -9,7 +9,7 @@ LL | ss.t = t; note: the lifetime 'a as defined on the function body at 20:6... --> $DIR/object-lifetime-default-from-rptr-struct-error.rs:20:6 | -LL | fn c<'a>(t: &'a MyBox<Test+'a>, mut ss: SomeStruct<'a>) { +LL | fn c<'a>(t: &'a MyBox<dyn Test+'a>, mut ss: SomeStruct<'a>) { | ^^ = note: ...does not necessarily outlive the static lifetime diff --git a/src/test/ui/object-lifetime/object-lifetime-default-mybox.nll.stderr b/src/test/ui/object-lifetime/object-lifetime-default-mybox.nll.stderr index 448fe9e5510..cdfbf0fc878 100644 --- a/src/test/ui/object-lifetime/object-lifetime-default-mybox.nll.stderr +++ b/src/test/ui/object-lifetime/object-lifetime-default-mybox.nll.stderr @@ -1,7 +1,7 @@ error: lifetime may not live long enough --> $DIR/object-lifetime-default-mybox.rs:27:5 | -LL | fn load1<'a,'b>(a: &'a MyBox<SomeTrait>, +LL | fn load1<'a,'b>(a: &'a MyBox<dyn SomeTrait>, | -- -- lifetime `'b` defined here | | | lifetime `'a` defined here @@ -12,7 +12,7 @@ LL | a error[E0521]: borrowed data escapes outside of function --> $DIR/object-lifetime-default-mybox.rs:31:5 | -LL | fn load2<'a>(ss: &MyBox<SomeTrait+'a>) -> MyBox<SomeTrait+'a> { +LL | fn load2<'a>(ss: &MyBox<dyn SomeTrait + 'a>) -> MyBox<dyn SomeTrait + 'a> { | -- `ss` is a reference that is only valid in the function body LL | load0(ss) | ^^^^^^^^^ `ss` escapes the function body here diff --git a/src/test/ui/object-lifetime/object-lifetime-default-mybox.rs b/src/test/ui/object-lifetime/object-lifetime-default-mybox.rs index c94df82a177..eb27fe90f47 100644 --- a/src/test/ui/object-lifetime/object-lifetime-default-mybox.rs +++ b/src/test/ui/object-lifetime/object-lifetime-default-mybox.rs @@ -16,18 +16,18 @@ fn deref<T>(ss: &T) -> T { loop { } } -fn load0(ss: &MyBox<SomeTrait>) -> MyBox<SomeTrait> { +fn load0(ss: &MyBox<dyn SomeTrait>) -> MyBox<dyn SomeTrait> { deref(ss) } -fn load1<'a,'b>(a: &'a MyBox<SomeTrait>, - b: &'b MyBox<SomeTrait>) - -> &'b MyBox<SomeTrait> +fn load1<'a,'b>(a: &'a MyBox<dyn SomeTrait>, + b: &'b MyBox<dyn SomeTrait>) + -> &'b MyBox<dyn SomeTrait> { a //~ ERROR lifetime mismatch } -fn load2<'a>(ss: &MyBox<SomeTrait+'a>) -> MyBox<SomeTrait+'a> { +fn load2<'a>(ss: &MyBox<dyn SomeTrait + 'a>) -> MyBox<dyn SomeTrait + 'a> { load0(ss) //~ ERROR mismatched types } diff --git a/src/test/ui/object-lifetime/object-lifetime-default-mybox.stderr b/src/test/ui/object-lifetime/object-lifetime-default-mybox.stderr index 4c23f867be8..928b9201982 100644 --- a/src/test/ui/object-lifetime/object-lifetime-default-mybox.stderr +++ b/src/test/ui/object-lifetime/object-lifetime-default-mybox.stderr @@ -1,11 +1,11 @@ error[E0623]: lifetime mismatch --> $DIR/object-lifetime-default-mybox.rs:27:5 | -LL | fn load1<'a,'b>(a: &'a MyBox<SomeTrait>, - | -------------------- this parameter and the return type are declared with different lifetimes... -LL | b: &'b MyBox<SomeTrait>) -LL | -> &'b MyBox<SomeTrait> - | -------------------- +LL | fn load1<'a,'b>(a: &'a MyBox<dyn SomeTrait>, + | ------------------------ this parameter and the return type are declared with different lifetimes... +LL | b: &'b MyBox<dyn SomeTrait>) +LL | -> &'b MyBox<dyn SomeTrait> + | ------------------------ LL | { LL | a | ^ ...but data from `a` is returned here @@ -21,7 +21,7 @@ LL | load0(ss) note: the lifetime 'a as defined on the function body at 30:10... --> $DIR/object-lifetime-default-mybox.rs:30:10 | -LL | fn load2<'a>(ss: &MyBox<SomeTrait+'a>) -> MyBox<SomeTrait+'a> { +LL | fn load2<'a>(ss: &MyBox<dyn SomeTrait + 'a>) -> MyBox<dyn SomeTrait + 'a> { | ^^ = note: ...does not necessarily outlive the static lifetime |
