diff --git a/src/librustc/lint/builtin.rs b/src/librustc/lint/builtin.rs index 69d865f53d469..f7af51e47526c 100644 --- a/src/librustc/lint/builtin.rs +++ b/src/librustc/lint/builtin.rs @@ -255,7 +255,7 @@ declare_lint! { declare_lint! { pub BARE_TRAIT_OBJECTS, - Allow, + Warn, "suggest using `dyn Trait` for trait objects" } diff --git a/src/libstd/error.rs b/src/libstd/error.rs index aeb822fa99e66..c8978a94fcda4 100644 --- a/src/libstd/error.rs +++ b/src/libstd/error.rs @@ -94,7 +94,7 @@ pub trait Error: Debug + Display { /// "I'm the superhero of errors" /// } /// - /// fn cause(&self) -> Option<&Error> { + /// fn cause(&self) -> Option<&dyn Error> { /// Some(&self.side) /// } /// } @@ -244,7 +244,7 @@ impl<'a, E: Error + 'a> From for Box { /// /// let an_error = AnError; /// assert!(0 == mem::size_of_val(&an_error)); - /// let a_boxed_error = Box::::from(an_error); + /// let a_boxed_error = Box::::from(an_error); /// assert!(mem::size_of::>() == mem::size_of_val(&a_boxed_error)) /// ``` fn from(err: E) -> Box { @@ -287,7 +287,7 @@ impl<'a, E: Error + Send + Sync + 'a> From for Box::from(an_error); + /// let a_boxed_error = Box::::from(an_error); /// assert!( /// mem::size_of::>() == mem::size_of_val(&a_boxed_error)) /// ``` @@ -309,7 +309,7 @@ impl From for Box { /// use std::mem; /// /// let a_string_error = "a string error".to_string(); - /// let a_boxed_error = Box::::from(a_string_error); + /// let a_boxed_error = Box::::from(a_string_error); /// assert!( /// mem::size_of::>() == mem::size_of_val(&a_boxed_error)) /// ``` @@ -344,7 +344,7 @@ impl From for Box { /// use std::mem; /// /// let a_string_error = "a string error".to_string(); - /// let a_boxed_error = Box::::from(a_string_error); + /// let a_boxed_error = Box::::from(a_string_error); /// assert!(mem::size_of::>() == mem::size_of_val(&a_boxed_error)) /// ``` fn from(str_err: String) -> Box { @@ -367,7 +367,7 @@ impl<'a> From<&str> for Box { /// use std::mem; /// /// let a_str_error = "a str error"; - /// let a_boxed_error = Box::::from(a_str_error); + /// let a_boxed_error = Box::::from(a_str_error); /// assert!( /// mem::size_of::>() == mem::size_of_val(&a_boxed_error)) /// ``` @@ -389,7 +389,7 @@ impl From<&str> for Box { /// use std::mem; /// /// let a_str_error = "a str error"; - /// let a_boxed_error = Box::::from(a_str_error); + /// let a_boxed_error = Box::::from(a_str_error); /// assert!(mem::size_of::>() == mem::size_of_val(&a_boxed_error)) /// ``` fn from(err: &str) -> Box { @@ -412,7 +412,7 @@ impl<'a, 'b> From> for Box { /// use std::borrow::Cow; /// /// let a_cow_str_error = Cow::from("a str error"); - /// let a_boxed_error = Box::::from(a_cow_str_error); + /// let a_boxed_error = Box::::from(a_cow_str_error); /// assert!( /// mem::size_of::>() == mem::size_of_val(&a_boxed_error)) /// ``` @@ -436,7 +436,7 @@ impl<'a> From> for Box { /// use std::borrow::Cow; /// /// let a_cow_str_error = Cow::from("a str error"); - /// let a_boxed_error = Box::::from(a_cow_str_error); + /// let a_boxed_error = Box::::from(a_cow_str_error); /// assert!(mem::size_of::>() == mem::size_of_val(&a_boxed_error)) /// ``` fn from(err: Cow<'a, str>) -> Box { diff --git a/src/libstd/fs.rs b/src/libstd/fs.rs index 616b5eb836ffd..d41b3a3a1233f 100644 --- a/src/libstd/fs.rs +++ b/src/libstd/fs.rs @@ -1976,7 +1976,7 @@ pub fn remove_dir_all>(path: P) -> io::Result<()> { /// use std::path::Path; /// /// // one possible implementation of walking a directory only visiting files -/// fn visit_dirs(dir: &Path, cb: &Fn(&DirEntry)) -> io::Result<()> { +/// fn visit_dirs(dir: &Path, cb: &dyn Fn(&DirEntry)) -> io::Result<()> { /// if dir.is_dir() { /// for entry in fs::read_dir(dir)? { /// let entry = entry?; diff --git a/src/test/compile-fail/issue-23595-1.rs b/src/test/compile-fail/issue-23595-1.rs index b8a0c4846abeb..2912c4ead7a0a 100644 --- a/src/test/compile-fail/issue-23595-1.rs +++ b/src/test/compile-fail/issue-23595-1.rs @@ -5,7 +5,7 @@ use std::ops::{Index}; trait Hierarchy { type Value; type ChildKey; - type Children = Index; + type Children = dyn Index; //~^ ERROR: the value of the associated types `Value` (from the trait `Hierarchy`), `ChildKey` fn data(&self) -> Option<(Self::Value, Self::Children)>; diff --git a/src/test/run-pass-fulldeps/pprust-expr-roundtrip.rs b/src/test/run-pass-fulldeps/pprust-expr-roundtrip.rs index 659de9cf6d51b..2e2a77b92ca53 100644 --- a/src/test/run-pass-fulldeps/pprust-expr-roundtrip.rs +++ b/src/test/run-pass-fulldeps/pprust-expr-roundtrip.rs @@ -62,7 +62,7 @@ fn make_x() -> P { /// Iterate over exprs of depth up to `depth`. The goal is to explore all "interesting" /// combinations of expression nesting. For example, we explore combinations using `if`, but not /// `while` or `match`, since those should print and parse in much the same way as `if`. -fn iter_exprs(depth: usize, f: &mut FnMut(P)) { +fn iter_exprs(depth: usize, f: &mut dyn FnMut(P)) { if depth == 0 { f(make_x()); return; diff --git a/src/test/run-pass/alignment-gep-tup-like-1.rs b/src/test/run-pass/alignment-gep-tup-like-1.rs index badd095d0ae12..7e6ee60e5194c 100644 --- a/src/test/run-pass/alignment-gep-tup-like-1.rs +++ b/src/test/run-pass/alignment-gep-tup-like-1.rs @@ -22,11 +22,11 @@ impl Invokable for Invoker { } } -fn f(a: A, b: u16) -> Box+'static> { +fn f(a: A, b: u16) -> Box+'static> { box Invoker { a: a, b: b, - } as (Box+'static>) + } as (Box+'static>) } pub fn main() { diff --git a/src/test/run-pass/associated-types/associated-types-doubleendediterator-object.rs b/src/test/run-pass/associated-types/associated-types-doubleendediterator-object.rs index 5f86888aef020..96ba2ee3b62b8 100644 --- a/src/test/run-pass/associated-types/associated-types-doubleendediterator-object.rs +++ b/src/test/run-pass/associated-types/associated-types-doubleendediterator-object.rs @@ -1,7 +1,7 @@ // run-pass #![feature(box_syntax)] -fn pairwise_sub(mut t: Box>) -> isize { +fn pairwise_sub(mut t: Box>) -> isize { let mut result = 0; loop { let front = t.next(); diff --git a/src/test/run-pass/associated-types/associated-types-eq-obj.rs b/src/test/run-pass/associated-types/associated-types-eq-obj.rs index 0f3dfe338a33c..c202c376c5fe6 100644 --- a/src/test/run-pass/associated-types/associated-types-eq-obj.rs +++ b/src/test/run-pass/associated-types/associated-types-eq-obj.rs @@ -15,7 +15,7 @@ impl Foo for char { fn boo(&self) -> Bar { Bar } } -fn baz(x: &Foo) -> Bar { +fn baz(x: &dyn Foo) -> Bar { x.boo() } diff --git a/src/test/run-pass/associated-types/associated-types-projection-in-object-type.rs b/src/test/run-pass/associated-types/associated-types-projection-in-object-type.rs index 0dc32f2fd94ec..eec95a141f5cf 100644 --- a/src/test/run-pass/associated-types/associated-types-projection-in-object-type.rs +++ b/src/test/run-pass/associated-types/associated-types-projection-in-object-type.rs @@ -19,7 +19,7 @@ pub trait Subscriber { pub trait Publisher<'a> { type Output; - fn subscribe(&mut self, _: Box + 'a>); + fn subscribe(&mut self, _: Box + 'a>); } pub trait Processor<'a> : Subscriber + Publisher<'a> { } @@ -27,12 +27,12 @@ pub trait Processor<'a> : Subscriber + Publisher<'a> { } impl<'a, P> Processor<'a> for P where P : Subscriber + Publisher<'a> { } struct MyStruct<'a> { - sub: Box + 'a> + sub: Box + 'a> } impl<'a> Publisher<'a> for MyStruct<'a> { type Output = u64; - fn subscribe(&mut self, t : Box + 'a>) { + fn subscribe(&mut self, t : Box + 'a>) { self.sub = t; } } diff --git a/src/test/run-pass/autoref-autoderef/autoderef-method-on-trait.rs b/src/test/run-pass/autoref-autoderef/autoderef-method-on-trait.rs index 0a54db7f5cd8a..fadb0784e7525 100644 --- a/src/test/run-pass/autoref-autoderef/autoderef-method-on-trait.rs +++ b/src/test/run-pass/autoref-autoderef/autoderef-method-on-trait.rs @@ -11,6 +11,6 @@ impl double for usize { } pub fn main() { - let x: Box<_> = box (box 3usize as Box); + let x: Box<_> = box (box 3usize as Box); assert_eq!(x.double(), 6); } diff --git a/src/test/run-pass/borrowck/borrowck-trait-lifetime.rs b/src/test/run-pass/borrowck/borrowck-trait-lifetime.rs index 9721b08233e39..8a6dfe76d6065 100644 --- a/src/test/run-pass/borrowck/borrowck-trait-lifetime.rs +++ b/src/test/run-pass/borrowck/borrowck-trait-lifetime.rs @@ -12,7 +12,7 @@ use std::marker; fn main() { trait T { fn foo(&self) {} } - fn f<'a, V: T>(v: &'a V) -> &'a T { - v as &'a T + fn f<'a, V: T>(v: &'a V) -> &'a dyn T { + v as &'a dyn T } } diff --git a/src/test/run-pass/cast-rfc0401-vtable-kinds.rs b/src/test/run-pass/cast-rfc0401-vtable-kinds.rs index e53ab7919228b..a27dd9eef52ec 100644 --- a/src/test/run-pass/cast-rfc0401-vtable-kinds.rs +++ b/src/test/run-pass/cast-rfc0401-vtable-kinds.rs @@ -15,9 +15,9 @@ impl Foo for () {} impl Foo for u32 { fn foo(&self, _: u32) -> u32 { self+43 } } impl Bar for () {} -unsafe fn round_trip_and_call<'a>(t: *const (Foo+'a)) -> u32 { - let foo_e : *const Foo = t as *const _; - let r_1 = foo_e as *mut Foo; +unsafe fn round_trip_and_call<'a>(t: *const (dyn Foo+'a)) -> u32 { + let foo_e : *const dyn Foo = t as *const _; + let r_1 = foo_e as *mut dyn Foo; (&*r_1).foo(0) } @@ -38,8 +38,8 @@ fn tuple_i32_to_u32(u: *const (i32, T)) -> *const (u32, T) { fn main() { let x = 4u32; - let y : &Foo = &x; - let fl = unsafe { round_trip_and_call(y as *const Foo) }; + let y : &dyn Foo = &x; + let fl = unsafe { round_trip_and_call(y as *const dyn Foo) }; assert_eq!(fl, (43+4)); let s = FooS([0,1,2]); diff --git a/src/test/run-pass/cast-rfc0401.rs b/src/test/run-pass/cast-rfc0401.rs index 324860e53e198..017b63c737493 100644 --- a/src/test/run-pass/cast-rfc0401.rs +++ b/src/test/run-pass/cast-rfc0401.rs @@ -25,8 +25,8 @@ fn main() // coercion-cast let mut it = vec![137].into_iter(); let itr: &mut vec::IntoIter = &mut it; - assert_eq!((itr as &mut Iterator).next(), Some(137)); - assert_eq!((itr as &mut Iterator).next(), None); + assert_eq!((itr as &mut dyn Iterator).next(), Some(137)); + assert_eq!((itr as &mut dyn Iterator).next(), None); assert_eq!(Some(4u32) as Option, Some(4u32)); assert_eq!((1u32,2u32) as (u32,u32), (1,2)); diff --git a/src/test/run-pass/close-over-big-then-small-data.rs b/src/test/run-pass/close-over-big-then-small-data.rs index 2ae0b6c7d3de5..0eead0194efa2 100644 --- a/src/test/run-pass/close-over-big-then-small-data.rs +++ b/src/test/run-pass/close-over-big-then-small-data.rs @@ -24,11 +24,11 @@ impl Invokable for Invoker { } } -fn f(a: A, b: u16) -> Box+'static> { +fn f(a: A, b: u16) -> Box+'static> { box Invoker { a: a, b: b, - } as (Box+'static>) + } as (Box+'static>) } pub fn main() { diff --git a/src/test/run-pass/codegen-object-shim.rs b/src/test/run-pass/codegen-object-shim.rs index 4e2d7ac608653..26f53a9c18213 100644 --- a/src/test/run-pass/codegen-object-shim.rs +++ b/src/test/run-pass/codegen-object-shim.rs @@ -1,4 +1,4 @@ fn main() { - assert_eq!((ToString::to_string as fn(&(ToString+'static)) -> String)(&"foo"), + assert_eq!((ToString::to_string as fn(&(dyn ToString+'static)) -> String)(&"foo"), String::from("foo")); } diff --git a/src/test/run-pass/coerce/coerce-expect-unsized.rs b/src/test/run-pass/coerce/coerce-expect-unsized.rs index a7e80afbf767c..b44aa6ab37760 100644 --- a/src/test/run-pass/coerce/coerce-expect-unsized.rs +++ b/src/test/run-pass/coerce/coerce-expect-unsized.rs @@ -12,16 +12,16 @@ pub fn main() { let _: Box<[isize]> = Box::new({ [1, 2, 3] }); let _: Box<[isize]> = Box::new(if true { [1, 2, 3] } else { [1, 3, 4] }); let _: Box<[isize]> = Box::new(match true { true => [1, 2, 3], false => [1, 3, 4] }); - let _: Box _> = Box::new({ |x| (x as u8) }); - let _: Box = Box::new(if true { false } else { true }); - let _: Box = Box::new(match true { true => 'a', false => 'b' }); + let _: Box _> = Box::new({ |x| (x as u8) }); + let _: Box = Box::new(if true { false } else { true }); + let _: Box = Box::new(match true { true => 'a', false => 'b' }); let _: &[isize] = &{ [1, 2, 3] }; let _: &[isize] = &if true { [1, 2, 3] } else { [1, 3, 4] }; let _: &[isize] = &match true { true => [1, 2, 3], false => [1, 3, 4] }; - let _: &Fn(isize) -> _ = &{ |x| (x as u8) }; - let _: &Debug = &if true { false } else { true }; - let _: &Debug = &match true { true => 'a', false => 'b' }; + let _: &dyn Fn(isize) -> _ = &{ |x| (x as u8) }; + let _: &dyn Debug = &if true { false } else { true }; + let _: &dyn Debug = &match true { true => 'a', false => 'b' }; let _: &str = &{ String::new() }; let _: &str = &if true { String::from("...") } else { 5.to_string() }; @@ -31,12 +31,12 @@ pub fn main() { }; let _: Box<[isize]> = Box::new([1, 2, 3]); - let _: Box _> = Box::new(|x| (x as u8)); + let _: Box _> = Box::new(|x| (x as u8)); let _: Rc> = Rc::new(RefCell::new([1, 2, 3])); - let _: Rc _>> = Rc::new(RefCell::new(|x| (x as u8))); + let _: Rc _>> = Rc::new(RefCell::new(|x| (x as u8))); - let _: Vec _>> = vec![ + let _: Vec _>> = vec![ Box::new(|x| (x as u8)), Box::new(|x| (x as i16 as u8)), ]; diff --git a/src/test/run-pass/consts/const-trait-to-trait.rs b/src/test/run-pass/consts/const-trait-to-trait.rs index a324d73a3a9df..12a2999d79d47 100644 --- a/src/test/run-pass/consts/const-trait-to-trait.rs +++ b/src/test/run-pass/consts/const-trait-to-trait.rs @@ -8,7 +8,7 @@ struct Bar; impl Trait for Bar {} fn main() { - let x: &[&Trait] = &[{ &Bar }]; + let x: &[&dyn Trait] = &[{ &Bar }]; } // Issue #25748 - the cast causes an &Encoding -> &Encoding coercion: @@ -16,9 +16,9 @@ pub struct UTF8Encoding; pub const UTF_8: &'static UTF8Encoding = &UTF8Encoding; pub trait Encoding {} impl Encoding for UTF8Encoding {} -pub fn f() -> &'static Encoding { UTF_8 as &'static Encoding } +pub fn f() -> &'static dyn Encoding { UTF_8 as &'static dyn Encoding } // Root of the problem: &Trait -> &Trait coercions: -const FOO: &'static Trait = &Bar; -const BAR: &'static Trait = FOO; +const FOO: &'static dyn Trait = &Bar; +const BAR: &'static dyn Trait = FOO; fn foo() { let _x = BAR; } diff --git a/src/test/run-pass/deriving/deriving-show.rs b/src/test/run-pass/deriving/deriving-show.rs index 98c1f3ac0273e..eb3a8948fc80d 100644 --- a/src/test/run-pass/deriving/deriving-show.rs +++ b/src/test/run-pass/deriving/deriving-show.rs @@ -17,7 +17,7 @@ enum Enum { } #[derive(Debug)] -struct Pointers(*const Send, *mut Sync); +struct Pointers(*const dyn Send, *mut dyn Sync); macro_rules! t { ($x:expr, $expected:expr) => { diff --git a/src/test/run-pass/drop/drop-struct-as-object.rs b/src/test/run-pass/drop/drop-struct-as-object.rs index 307b3f1d6dc2b..1bc3b4c157ca8 100644 --- a/src/test/run-pass/drop/drop-struct-as-object.rs +++ b/src/test/run-pass/drop/drop-struct-as-object.rs @@ -30,7 +30,7 @@ impl Drop for Cat { pub fn main() { { let x = box Cat {name: 22}; - let nyan: Box = x as Box; + let nyan: Box = x as Box; } unsafe { assert_eq!(value, 22); diff --git a/src/test/run-pass/dynamically-sized-types/dst-coerce-custom.rs b/src/test/run-pass/dynamically-sized-types/dst-coerce-custom.rs index 35927bde027a3..24d83eb5343ec 100644 --- a/src/test/run-pass/dynamically-sized-types/dst-coerce-custom.rs +++ b/src/test/run-pass/dynamically-sized-types/dst-coerce-custom.rs @@ -36,7 +36,7 @@ fn main() { // Trait objects. let a: Bar = Bar { x: &42 }; - let b: Bar = a; + let b: Bar = a; unsafe { assert_eq!((*b.x).get(), 42); } diff --git a/src/test/run-pass/dynamically-sized-types/dst-coerce-rc.rs b/src/test/run-pass/dynamically-sized-types/dst-coerce-rc.rs index bbd0b1f8be1f7..683fa6850fd81 100644 --- a/src/test/run-pass/dynamically-sized-types/dst-coerce-rc.rs +++ b/src/test/run-pass/dynamically-sized-types/dst-coerce-rc.rs @@ -26,17 +26,17 @@ fn main() { assert_eq!(b[2], 3); let a: Rc = Rc::new(42); - let b: Rc = a.clone(); + let b: Rc = a.clone(); assert_eq!(b.get(), 42); let c: Weak = Rc::downgrade(&a); - let d: Weak = c.clone(); + let d: Weak = c.clone(); let _c = b.clone(); let a: Rc> = Rc::new(RefCell::new(42)); - let b: Rc> = a.clone(); + let b: Rc> = a.clone(); assert_eq!(b.borrow().get(), 42); // FIXME - let c: Weak> = Rc::downgrade(&a) as Weak<_>; + let c: Weak> = Rc::downgrade(&a) as Weak<_>; } diff --git a/src/test/run-pass/dynamically-sized-types/dst-coercions.rs b/src/test/run-pass/dynamically-sized-types/dst-coercions.rs index 06c2892b69ea2..66688e93fb80d 100644 --- a/src/test/run-pass/dynamically-sized-types/dst-coercions.rs +++ b/src/test/run-pass/dynamically-sized-types/dst-coercions.rs @@ -9,20 +9,20 @@ trait T { fn dummy(&self) { } } impl T for S {} pub fn main() { - let x: &T = &S; + let x: &dyn T = &S; // Test we can convert from &-ptr to *-ptr of trait objects - let x: *const T = &S; + let x: *const dyn T = &S; // Test we can convert from &-ptr to *-ptr of struct pointer (not DST) let x: *const S = &S; // As above, but mut - let x: &mut T = &mut S; - let x: *mut T = &mut S; + let x: &mut dyn T = &mut S; + let x: *mut dyn T = &mut S; let x: *mut S = &mut S; // Test we can change the mutability from mut to const. - let x: &T = &mut S; - let x: *const T = &mut S; + let x: &dyn T = &mut S; + let x: *const dyn T = &mut S; } diff --git a/src/test/run-pass/dynamically-sized-types/dst-field-align.rs b/src/test/run-pass/dynamically-sized-types/dst-field-align.rs index 9c81f5652d1ff..6c338e99912ec 100644 --- a/src/test/run-pass/dynamically-sized-types/dst-field-align.rs +++ b/src/test/run-pass/dynamically-sized-types/dst-field-align.rs @@ -26,7 +26,7 @@ fn main() { // Test that zero-offset works properly let b : Baz = Baz { a: 7 }; assert_eq!(b.a.get(), 7); - let b : &Baz = &b; + let b : &Baz = &b; assert_eq!(b.a.get(), 7); // Test that the field is aligned properly @@ -34,7 +34,7 @@ fn main() { assert_eq!(f.b.get(), 11); let ptr1 : *const u8 = &f.b as *const _ as *const u8; - let f : &Foo = &f; + let f : &Foo = &f; let ptr2 : *const u8 = &f.b as *const _ as *const u8; assert_eq!(f.b.get(), 11); @@ -44,13 +44,13 @@ fn main() { // Test that nested DSTs work properly let f : Foo> = Foo { a: 0, b: Foo { a: 1, b: 17 }}; assert_eq!(f.b.b.get(), 17); - let f : &Foo> = &f; + let f : &Foo> = &f; assert_eq!(f.b.b.get(), 17); // Test that get the pointer via destructuring works let f : Foo = Foo { a: 0, b: 11 }; - let f : &Foo = &f; + let f : &Foo = &f; let &Foo { a: _, b: ref bar } = f; assert_eq!(bar.get(), 11); diff --git a/src/test/run-pass/dynamically-sized-types/dst-index.rs b/src/test/run-pass/dynamically-sized-types/dst-index.rs index 0728599f3239e..980d99a6d6c11 100644 --- a/src/test/run-pass/dynamically-sized-types/dst-index.rs +++ b/src/test/run-pass/dynamically-sized-types/dst-index.rs @@ -19,11 +19,11 @@ impl Index for S { struct T; impl Index for T { - type Output = Debug + 'static; + type Output = dyn Debug + 'static; - fn index<'a>(&'a self, idx: usize) -> &'a (Debug + 'static) { + fn index<'a>(&'a self, idx: usize) -> &'a (dyn Debug + 'static) { static X: usize = 42; - &X as &(Debug + 'static) + &X as &(dyn Debug + 'static) } } diff --git a/src/test/run-pass/dynamically-sized-types/dst-raw.rs b/src/test/run-pass/dynamically-sized-types/dst-raw.rs index 949adbbefcea7..0893b02e74e82 100644 --- a/src/test/run-pass/dynamically-sized-types/dst-raw.rs +++ b/src/test/run-pass/dynamically-sized-types/dst-raw.rs @@ -24,7 +24,7 @@ struct Foo { pub fn main() { // raw trait object let x = A { f: 42 }; - let z: *const Trait = &x; + let z: *const dyn Trait = &x; let r = unsafe { (&*z).foo() }; @@ -32,7 +32,7 @@ pub fn main() { // raw DST struct let p = Foo {f: A { f: 42 }}; - let o: *const Foo = &p; + let o: *const Foo = &p; let r = unsafe { (&*o).f.foo() }; @@ -40,7 +40,7 @@ pub fn main() { // raw DST tuple let p = (A { f: 42 },); - let o: *const (Trait,) = &p; + let o: *const (dyn Trait,) = &p; let r = unsafe { (&*o).0.foo() }; @@ -84,21 +84,21 @@ pub fn main() { // all of the above with *mut let mut x = A { f: 42 }; - let z: *mut Trait = &mut x; + let z: *mut dyn Trait = &mut x; let r = unsafe { (&*z).foo() }; assert_eq!(r, 42); let mut p = Foo {f: A { f: 42 }}; - let o: *mut Foo = &mut p; + let o: *mut Foo = &mut p; let r = unsafe { (&*o).f.foo() }; assert_eq!(r, 42); let mut p = (A { f: 42 },); - let o: *mut (Trait,) = &mut p; + let o: *mut (dyn Trait,) = &mut p; let r = unsafe { (&*o).0.foo() }; diff --git a/src/test/run-pass/dynamically-sized-types/dst-trait-tuple.rs b/src/test/run-pass/dynamically-sized-types/dst-trait-tuple.rs index ca88605ee3a8f..70bcc3de07d29 100644 --- a/src/test/run-pass/dynamically-sized-types/dst-trait-tuple.rs +++ b/src/test/run-pass/dynamically-sized-types/dst-trait-tuple.rs @@ -38,7 +38,7 @@ impl ToBar for Bar1 { } // x is a fat pointer -fn foo(x: &Fat) { +fn foo(x: &Fat) { assert_eq!(x.0, 5); assert_eq!(x.1, "some str"); assert_eq!(x.2.to_bar(), Bar); @@ -49,12 +49,12 @@ fn foo(x: &Fat) { assert_eq!(y.to_val(), 42); } -fn bar(x: &ToBar) { +fn bar(x: &dyn ToBar) { assert_eq!(x.to_bar(), Bar); assert_eq!(x.to_val(), 42); } -fn baz(x: &Fat>) { +fn baz(x: &Fat>) { assert_eq!(x.0, 5); assert_eq!(x.1, "some str"); assert_eq!((x.2).0, 8); @@ -73,20 +73,20 @@ pub fn main() { foo(&f1); let f2 = &f1; foo(f2); - let f3: &Fat = f2; + let f3: &Fat = f2; foo(f3); - let f4: &Fat = &f1; + let f4: &Fat = &f1; foo(f4); - let f5: &Fat = &(5, "some str", Bar1 {f :42}); + let f5: &Fat = &(5, "some str", Bar1 {f :42}); foo(f5); // Zero size object. - let f6: &Fat = &(5, "some str", Bar); + let f6: &Fat = &(5, "some str", Bar); assert_eq!(f6.2.to_bar(), Bar); // &* // - let f7: Box = Box::new(Bar1 {f :42}); + let f7: Box = Box::new(Bar1 {f :42}); bar(&*f7); // Deep nesting @@ -94,10 +94,10 @@ pub fn main() { baz(&f1); let f2 = &f1; baz(f2); - let f3: &Fat> = f2; + let f3: &Fat> = f2; baz(f3); - let f4: &Fat> = &f1; + let f4: &Fat> = &f1; baz(f4); - let f5: &Fat> = &(5, "some str", (8, "deep str", Bar1 {f :42})); + let f5: &Fat> = &(5, "some str", (8, "deep str", Bar1 {f :42})); baz(f5); } diff --git a/src/test/run-pass/dynamically-sized-types/dst-trait.rs b/src/test/run-pass/dynamically-sized-types/dst-trait.rs index 9a9bd12d50f4f..ec6bc72192d4f 100644 --- a/src/test/run-pass/dynamically-sized-types/dst-trait.rs +++ b/src/test/run-pass/dynamically-sized-types/dst-trait.rs @@ -38,7 +38,7 @@ impl ToBar for Bar1 { } // x is a fat pointer -fn foo(x: &Fat) { +fn foo(x: &Fat) { assert_eq!(x.f1, 5); assert_eq!(x.f2, "some str"); assert_eq!(x.ptr.to_bar(), Bar); @@ -49,12 +49,12 @@ fn foo(x: &Fat) { assert_eq!(y.to_val(), 42); } -fn bar(x: &ToBar) { +fn bar(x: &dyn ToBar) { assert_eq!(x.to_bar(), Bar); assert_eq!(x.to_val(), 42); } -fn baz(x: &Fat>) { +fn baz(x: &Fat>) { assert_eq!(x.f1, 5); assert_eq!(x.f2, "some str"); assert_eq!(x.ptr.f1, 8); @@ -73,20 +73,20 @@ pub fn main() { foo(&f1); let f2 = &f1; foo(f2); - let f3: &Fat = f2; + let f3: &Fat = f2; foo(f3); - let f4: &Fat = &f1; + let f4: &Fat = &f1; foo(f4); - let f5: &Fat = &Fat { f1: 5, f2: "some str", ptr: Bar1 {f :42} }; + let f5: &Fat = &Fat { f1: 5, f2: "some str", ptr: Bar1 {f :42} }; foo(f5); // Zero size object. - let f6: &Fat = &Fat { f1: 5, f2: "some str", ptr: Bar }; + let f6: &Fat = &Fat { f1: 5, f2: "some str", ptr: Bar }; assert_eq!(f6.ptr.to_bar(), Bar); // &* // - let f7: Box = Box::new(Bar1 {f :42}); + let f7: Box = Box::new(Bar1 {f :42}); bar(&*f7); // Deep nesting @@ -95,11 +95,11 @@ pub fn main() { baz(&f1); let f2 = &f1; baz(f2); - let f3: &Fat> = f2; + let f3: &Fat> = f2; baz(f3); - let f4: &Fat> = &f1; + let f4: &Fat> = &f1; baz(f4); - let f5: &Fat> = + let f5: &Fat> = &Fat { f1: 5, f2: "some str", ptr: Fat { f1: 8, f2: "deep str", ptr: Bar1 {f :42}} }; baz(f5); } diff --git a/src/test/run-pass/extern/extern-types-trait-impl.rs b/src/test/run-pass/extern/extern-types-trait-impl.rs index ac4c70a71ce76..6cce6c723c5a2 100644 --- a/src/test/run-pass/extern/extern-types-trait-impl.rs +++ b/src/test/run-pass/extern/extern-types-trait-impl.rs @@ -18,7 +18,7 @@ impl Foo for A { fn assert_foo() { } -fn use_foo(x: &Foo) { +fn use_foo(x: &dyn Foo) { x.foo(); } diff --git a/src/test/run-pass/fat-ptr-cast.rs b/src/test/run-pass/fat-ptr-cast.rs index 367b57d5ea0a2..1943abe9e14da 100644 --- a/src/test/run-pass/fat-ptr-cast.rs +++ b/src/test/run-pass/fat-ptr-cast.rs @@ -25,7 +25,7 @@ fn main() { assert_eq!(a as usize, b as *const () as usize); // And conversion to a void pointer/address for trait objects too. - let a: *mut Foo = &mut Bar; + let a: *mut dyn Foo = &mut Bar; let b = a as *mut (); let c = a as *const () as usize; let d = unsafe { diff --git a/src/test/run-pass/functions-closures/closure-expected-type/issue-38714.rs b/src/test/run-pass/functions-closures/closure-expected-type/issue-38714.rs index 96b7a66d07587..e97785b5cacdf 100644 --- a/src/test/run-pass/functions-closures/closure-expected-type/issue-38714.rs +++ b/src/test/run-pass/functions-closures/closure-expected-type/issue-38714.rs @@ -5,7 +5,7 @@ struct UsizeRef<'a> { a: &'a usize } -type RefTo = Box Fn(&'r Vec) -> UsizeRef<'r>>; +type RefTo = Box Fn(&'r Vec) -> UsizeRef<'r>>; fn ref_to<'a>(vec: &'a Vec) -> UsizeRef<'a> { UsizeRef{ a: &vec[0]} diff --git a/src/test/run-pass/generics/generic-object.rs b/src/test/run-pass/generics/generic-object.rs index 054425989c318..870ff980ec64d 100644 --- a/src/test/run-pass/generics/generic-object.rs +++ b/src/test/run-pass/generics/generic-object.rs @@ -17,6 +17,6 @@ impl Foo for S { pub fn main() { let x = box S { x: 1 }; - let y = x as Box>; + let y = x as Box>; assert_eq!(y.get(), 1); } diff --git a/src/test/run-pass/hashmap-memory.rs b/src/test/run-pass/hashmap-memory.rs index 364661e565e2c..987a3e414f5c0 100644 --- a/src/test/run-pass/hashmap-memory.rs +++ b/src/test/run-pass/hashmap-memory.rs @@ -19,7 +19,7 @@ mod map_reduce { use std::str; use std::thread; - pub type putter<'a> = Box; + pub type putter<'a> = Box; pub type mapper = extern fn(String, putter); diff --git a/src/test/run-pass/higher-rank-trait-bounds/hrtb-binder-levels-in-object-types.rs b/src/test/run-pass/higher-rank-trait-bounds/hrtb-binder-levels-in-object-types.rs index 1591d616cac78..cc766c0605c9f 100644 --- a/src/test/run-pass/higher-rank-trait-bounds/hrtb-binder-levels-in-object-types.rs +++ b/src/test/run-pass/higher-rank-trait-bounds/hrtb-binder-levels-in-object-types.rs @@ -19,7 +19,7 @@ struct Tcx<'tcx> { impl<'tcx> Typer<'tcx> for Tcx<'tcx> { } -fn g<'tcx>(typer: &Typer<'tcx>) { +fn g<'tcx>(typer: &dyn Typer<'tcx>) { } fn check_static_type<'x>(tcx: &Tcx<'x>) { diff --git a/src/test/run-pass/higher-rank-trait-bounds/hrtb-debruijn-object-types-in-closures.rs b/src/test/run-pass/higher-rank-trait-bounds/hrtb-debruijn-object-types-in-closures.rs index 09152970fdcd2..8431226a3ece1 100644 --- a/src/test/run-pass/higher-rank-trait-bounds/hrtb-debruijn-object-types-in-closures.rs +++ b/src/test/run-pass/higher-rank-trait-bounds/hrtb-debruijn-object-types-in-closures.rs @@ -7,7 +7,7 @@ trait Typer<'tcx> { fn dummy(&self) { } } -fn g(_: F) where F: FnOnce(&Typer) {} +fn g(_: F) where F: FnOnce(&dyn Typer) {} fn h() { g(|typer| typer.dummy()) diff --git a/src/test/run-pass/higher-rank-trait-bounds/hrtb-fn-like-trait-object.rs b/src/test/run-pass/higher-rank-trait-bounds/hrtb-fn-like-trait-object.rs index 7ef8ea046b81a..ff84ad9d2988e 100644 --- a/src/test/run-pass/higher-rank-trait-bounds/hrtb-fn-like-trait-object.rs +++ b/src/test/run-pass/higher-rank-trait-bounds/hrtb-fn-like-trait-object.rs @@ -6,7 +6,7 @@ trait FnLike { fn call(&self, arg: A) -> R; } -type FnObject<'b> = for<'a> FnLike<&'a isize, &'a isize> + 'b; +type FnObject<'b> = dyn for<'a> FnLike<&'a isize, &'a isize> + 'b; struct Identity; diff --git a/src/test/run-pass/higher-rank-trait-bounds/hrtb-parse.rs b/src/test/run-pass/higher-rank-trait-bounds/hrtb-parse.rs index 3fb0b3290eb02..1fab9758c5c83 100644 --- a/src/test/run-pass/higher-rank-trait-bounds/hrtb-parse.rs +++ b/src/test/run-pass/higher-rank-trait-bounds/hrtb-parse.rs @@ -24,8 +24,8 @@ fn foo01 Get<&'a i32, &'a i32>>(t: T) // Parse HRTB with explicit `for` in various sorts of types: -fn foo10(t: Box Get>) { } -fn foo11(t: Box Fn(i32) -> i32>) { } +fn foo10(t: Box Get>) { } +fn foo11(t: Box Fn(i32) -> i32>) { } fn foo20(t: for<'a> fn(i32) -> i32) { } fn foo21(t: for<'a> unsafe fn(i32) -> i32) { } diff --git a/src/test/run-pass/higher-rank-trait-bounds/hrtb-precedence-of-plus.rs b/src/test/run-pass/higher-rank-trait-bounds/hrtb-precedence-of-plus.rs index 5fda4b826e00c..6834c392d4e96 100644 --- a/src/test/run-pass/higher-rank-trait-bounds/hrtb-precedence-of-plus.rs +++ b/src/test/run-pass/higher-rank-trait-bounds/hrtb-precedence-of-plus.rs @@ -6,7 +6,7 @@ // 'static` and not `Fn(isize) -> (isize + 'static)`. The latter would // cause a compilation error. Issue #18772. -fn adder(y: isize) -> Box isize + 'static> { +fn adder(y: isize) -> Box isize + 'static> { Box::new(move |x| y + x) } diff --git a/src/test/run-pass/higher-rank-trait-bounds/hrtb-resolve-lifetime.rs b/src/test/run-pass/higher-rank-trait-bounds/hrtb-resolve-lifetime.rs index 917f6f9611844..b97fdf4df508f 100644 --- a/src/test/run-pass/higher-rank-trait-bounds/hrtb-resolve-lifetime.rs +++ b/src/test/run-pass/higher-rank-trait-bounds/hrtb-resolve-lifetime.rs @@ -8,7 +8,7 @@ trait FnLike { fn call(&self, arg: A) -> R; } -type FnObject<'b> = for<'a> FnLike<&'a isize, &'a isize> + 'b; +type FnObject<'b> = dyn for<'a> FnLike<&'a isize, &'a isize> + 'b; fn main() { } diff --git a/src/test/run-pass/higher-rank-trait-bounds/hrtb-trait-object-paren-notation.rs b/src/test/run-pass/higher-rank-trait-bounds/hrtb-trait-object-paren-notation.rs index 0ed8f7ee52ae9..d8c726cdd71e5 100644 --- a/src/test/run-pass/higher-rank-trait-bounds/hrtb-trait-object-paren-notation.rs +++ b/src/test/run-pass/higher-rank-trait-bounds/hrtb-trait-object-paren-notation.rs @@ -5,7 +5,7 @@ trait FnLike { fn call(&self, arg: A) -> R; } -type FnObject<'b> = for<'a> FnLike<(&'a i32,), &'a i32> + 'b; +type FnObject<'b> = dyn for<'a> FnLike<(&'a i32,), &'a i32> + 'b; struct Identity; diff --git a/src/test/run-pass/higher-rank-trait-bounds/hrtb-trait-object-passed-to-closure.rs b/src/test/run-pass/higher-rank-trait-bounds/hrtb-trait-object-passed-to-closure.rs index 4cb9242f0ed80..41ebb3f5a14ab 100644 --- a/src/test/run-pass/higher-rank-trait-bounds/hrtb-trait-object-passed-to-closure.rs +++ b/src/test/run-pass/higher-rank-trait-bounds/hrtb-trait-object-passed-to-closure.rs @@ -17,7 +17,7 @@ struct NoAnn<'ast> { impl<'ast> PrinterSupport<'ast> for NoAnn<'ast> { } -fn foo<'ast, G>(f: Option<&'ast usize>, g: G) where G: FnOnce(&PrinterSupport) { +fn foo<'ast, G>(f: Option<&'ast usize>, g: G) where G: FnOnce(&dyn PrinterSupport) { let annotation = NoAnn { f: f }; g(&annotation) } diff --git a/src/test/run-pass/ifmt.rs b/src/test/run-pass/ifmt.rs index 8c17b01e2bd89..6660f393f7dac 100644 --- a/src/test/run-pass/ifmt.rs +++ b/src/test/run-pass/ifmt.rs @@ -93,7 +93,7 @@ pub fn main() { t!(format!("{:#4}", C), "☃123"); t!(format!("{:b}", D), "aa☃bb"); - let a: &fmt::Debug = &1; + let a: &dyn fmt::Debug = &1; t!(format!("{:?}", a), "1"); diff --git a/src/test/run-pass/issues/issue-10802.rs b/src/test/run-pass/issues/issue-10802.rs index 8872eae6f8bfb..f1d6b37a6843f 100644 --- a/src/test/run-pass/issues/issue-10802.rs +++ b/src/test/run-pass/issues/issue-10802.rs @@ -24,9 +24,9 @@ trait MyTrait { fn dummy(&self) { } } impl MyTrait for Box {} impl MyTrait for Box {} -struct Whatever { w: Box } +struct Whatever { w: Box } impl Whatever { - fn new(w: Box) -> Whatever { + fn new(w: Box) -> Whatever { Whatever { w: w } } } @@ -34,13 +34,13 @@ impl Whatever { fn main() { { let f: Box<_> = box DroppableStruct; - let _a = Whatever::new(box f as Box); + let _a = Whatever::new(box f as Box); } assert!(unsafe { DROPPED }); unsafe { DROPPED = false; } { let f: Box<_> = box DroppableEnum::DroppableVariant1; - let _a = Whatever::new(box f as Box); + let _a = Whatever::new(box f as Box); } assert!(unsafe { DROPPED }); } diff --git a/src/test/run-pass/issues/issue-11205.rs b/src/test/run-pass/issues/issue-11205.rs index b628bf601968d..ce0951eafdd34 100644 --- a/src/test/run-pass/issues/issue-11205.rs +++ b/src/test/run-pass/issues/issue-11205.rs @@ -5,44 +5,44 @@ trait Foo { fn dummy(&self) { } } impl Foo for isize {} -fn foo(_: [&Foo; 2]) {} -fn foos(_: &[&Foo]) {} +fn foo(_: [&dyn Foo; 2]) {} +fn foos(_: &[&dyn Foo]) {} fn foog(_: &[T], _: &[T]) {} -fn bar(_: [Box; 2]) {} -fn bars(_: &[Box]) {} +fn bar(_: [Box; 2]) {} +fn bars(_: &[Box]) {} fn main() { - let x: [&Foo; 2] = [&1, &2]; + let x: [&dyn Foo; 2] = [&1, &2]; foo(x); foo([&1, &2]); let r = &1; - let x: [&Foo; 2] = [r; 2]; + let x: [&dyn Foo; 2] = [r; 2]; foo(x); foo([&1; 2]); - let x: &[&Foo] = &[&1, &2]; + let x: &[&dyn Foo] = &[&1, &2]; foos(x); foos(&[&1, &2]); - let x: &[&Foo] = &[&1, &2]; + let x: &[&dyn Foo] = &[&1, &2]; let r = &1; foog(x, &[r]); - let x: [Box; 2] = [Box::new(1), Box::new(2)]; + let x: [Box; 2] = [Box::new(1), Box::new(2)]; bar(x); bar([Box::new(1), Box::new(2)]); - let x: &[Box] = &[Box::new(1), Box::new(2)]; + let x: &[Box] = &[Box::new(1), Box::new(2)]; bars(x); bars(&[Box::new(1), Box::new(2)]); - let x: &[Box] = &[Box::new(1), Box::new(2)]; + let x: &[Box] = &[Box::new(1), Box::new(2)]; foog(x, &[Box::new(1)]); struct T<'a> { - t: [&'a (Foo+'a); 2] + t: [&'a (dyn Foo+'a); 2] } let _n = T { t: [&1, &2] @@ -51,34 +51,34 @@ fn main() { let _n = T { t: [r; 2] }; - let x: [&Foo; 2] = [&1, &2]; + let x: [&dyn Foo; 2] = [&1, &2]; let _n = T { t: x }; struct F<'b> { - t: &'b [&'b (Foo+'b)] + t: &'b [&'b (dyn Foo+'b)] } let _n = F { t: &[&1, &2] }; let r = &1; - let r: [&Foo; 2] = [r; 2]; + let r: [&dyn Foo; 2] = [r; 2]; let _n = F { t: &r }; - let x: [&Foo; 2] = [&1, &2]; + let x: [&dyn Foo; 2] = [&1, &2]; let _n = F { t: &x }; struct M<'a> { - t: &'a [Box] + t: &'a [Box] } let _n = M { t: &[Box::new(1), Box::new(2)] }; - let x: [Box; 2] = [Box::new(1), Box::new(2)]; + let x: [Box; 2] = [Box::new(1), Box::new(2)]; let _n = M { t: &x }; diff --git a/src/test/run-pass/issues/issue-11267.rs b/src/test/run-pass/issues/issue-11267.rs index 1aaeaa62ad005..848ed6ac7a8ff 100644 --- a/src/test/run-pass/issues/issue-11267.rs +++ b/src/test/run-pass/issues/issue-11267.rs @@ -10,7 +10,7 @@ impl T for Empty { fn next(&mut self) -> Option { None } } -fn do_something_with(a : &mut T) { +fn do_something_with(a : &mut dyn T) { println!("{:?}", a.next()) } diff --git a/src/test/run-pass/issues/issue-11677.rs b/src/test/run-pass/issues/issue-11677.rs index 5dabecc48f9c1..be18c736f1483 100644 --- a/src/test/run-pass/issues/issue-11677.rs +++ b/src/test/run-pass/issues/issue-11677.rs @@ -11,8 +11,8 @@ trait X { fn dummy(&self) -> T { panic!() } } -struct S {f: Box+'static>, - g: Box+'static>} +struct S {f: Box+'static>, + g: Box+'static>} struct F; impl X for F { diff --git a/src/test/run-pass/issues/issue-11709.rs b/src/test/run-pass/issues/issue-11709.rs index f191a203f03a8..cb5e3dff3b31b 100644 --- a/src/test/run-pass/issues/issue-11709.rs +++ b/src/test/run-pass/issues/issue-11709.rs @@ -9,7 +9,7 @@ struct S {x:()} -fn test(slot: &mut Option Box>>) -> () { +fn test(slot: &mut Option Box>>) -> () { let a = slot.take(); let _a = match a { // `{let .. a(); }` would break diff --git a/src/test/run-pass/issues/issue-12744.rs b/src/test/run-pass/issues/issue-12744.rs index d02620ee1a471..e2756ec970c39 100644 --- a/src/test/run-pass/issues/issue-12744.rs +++ b/src/test/run-pass/issues/issue-12744.rs @@ -1,5 +1,5 @@ // run-pass fn main() { - fn test() -> Box { Box::new(1) } + fn test() -> Box { Box::new(1) } println!("{:?}", test()) } diff --git a/src/test/run-pass/issues/issue-13507-2.rs b/src/test/run-pass/issues/issue-13507-2.rs index ce920a3ccab9d..63f3589c6cc63 100644 --- a/src/test/run-pass/issues/issue-13507-2.rs +++ b/src/test/run-pass/issues/issue-13507-2.rs @@ -23,7 +23,7 @@ pub fn type_ids() -> Vec { TypeId::of::(), TypeId::of::(), TypeId::of::(), - TypeId::of::(), + TypeId::of::(), TypeId::of::(), TypeId::of::() ] diff --git a/src/test/run-pass/issues/issue-13808.rs b/src/test/run-pass/issues/issue-13808.rs index d1b94c7186462..9f9db067bf4b5 100644 --- a/src/test/run-pass/issues/issue-13808.rs +++ b/src/test/run-pass/issues/issue-13808.rs @@ -4,7 +4,7 @@ // pretty-expanded FIXME #23616 struct Foo<'a> { - listener: Box, + listener: Box, } impl<'a> Foo<'a> { diff --git a/src/test/run-pass/issues/issue-14399.rs b/src/test/run-pass/issues/issue-14399.rs index 1b57856e95566..6bf8a589959c5 100644 --- a/src/test/run-pass/issues/issue-14399.rs +++ b/src/test/run-pass/issues/issue-14399.rs @@ -16,5 +16,5 @@ impl A for B1 {} fn main() { let v: Box<_> = box B1; - let _c: Box = v.clone(); + let _c: Box = v.clone(); } diff --git a/src/test/run-pass/issues/issue-14589.rs b/src/test/run-pass/issues/issue-14589.rs index d495602dff7e7..5d8aab2ce74ce 100644 --- a/src/test/run-pass/issues/issue-14589.rs +++ b/src/test/run-pass/issues/issue-14589.rs @@ -5,9 +5,9 @@ // pretty-expanded FIXME #23616 fn main() { - send::>(Box::new(Output(0))); - Test::>::foo(Box::new(Output(0))); - Test::>::new().send(Box::new(Output(0))); + send::>(Box::new(Output(0))); + Test::>::foo(Box::new(Output(0))); + Test::>::new().send(Box::new(Output(0))); } fn send(_: T) {} diff --git a/src/test/run-pass/issues/issue-14821.rs b/src/test/run-pass/issues/issue-14821.rs index 5ac0d0df0d7d4..00b2e3607fcba 100644 --- a/src/test/run-pass/issues/issue-14821.rs +++ b/src/test/run-pass/issues/issue-14821.rs @@ -6,16 +6,16 @@ struct Meow; impl SomeTrait for Meow {} struct Foo<'a> { - x: &'a SomeTrait, - y: &'a SomeTrait, + x: &'a dyn SomeTrait, + y: &'a dyn SomeTrait, } impl<'a> Foo<'a> { - pub fn new<'b>(x: &'b SomeTrait, y: &'b SomeTrait) -> Foo<'b> { Foo { x: x, y: y } } + pub fn new<'b>(x: &'b dyn SomeTrait, y: &'b dyn SomeTrait) -> Foo<'b> { Foo { x: x, y: y } } } fn main() { let r = Meow; let s = Meow; - let q = Foo::new(&r as &SomeTrait, &s as &SomeTrait); + let q = Foo::new(&r as &dyn SomeTrait, &s as &dyn SomeTrait); } diff --git a/src/test/run-pass/issues/issue-14919.rs b/src/test/run-pass/issues/issue-14919.rs index c6ccb7575bb83..943615433549e 100644 --- a/src/test/run-pass/issues/issue-14919.rs +++ b/src/test/run-pass/issues/issue-14919.rs @@ -9,7 +9,7 @@ trait Matcher { struct CharPredMatcher<'a, 'b> { str: &'a str, - pred: Box bool + 'b>, + pred: Box bool + 'b>, } impl<'a, 'b> Matcher for CharPredMatcher<'a, 'b> { diff --git a/src/test/run-pass/issues/issue-14958.rs b/src/test/run-pass/issues/issue-14958.rs index 17f7f159fd2db..a12564ca9c0ee 100644 --- a/src/test/run-pass/issues/issue-14958.rs +++ b/src/test/run-pass/issues/issue-14958.rs @@ -7,17 +7,17 @@ trait Foo { fn dummy(&self) { }} struct Bar; -impl<'a> std::ops::Fn<(&'a (Foo+'a),)> for Bar { - extern "rust-call" fn call(&self, _: (&'a Foo,)) {} +impl<'a> std::ops::Fn<(&'a (dyn Foo+'a),)> for Bar { + extern "rust-call" fn call(&self, _: (&'a dyn Foo,)) {} } -impl<'a> std::ops::FnMut<(&'a (Foo+'a),)> for Bar { - extern "rust-call" fn call_mut(&mut self, a: (&'a Foo,)) { self.call(a) } +impl<'a> std::ops::FnMut<(&'a (dyn Foo+'a),)> for Bar { + extern "rust-call" fn call_mut(&mut self, a: (&'a dyn Foo,)) { self.call(a) } } -impl<'a> std::ops::FnOnce<(&'a (Foo+'a),)> for Bar { +impl<'a> std::ops::FnOnce<(&'a (dyn Foo+'a),)> for Bar { type Output = (); - extern "rust-call" fn call_once(self, a: (&'a Foo,)) { self.call(a) } + extern "rust-call" fn call_once(self, a: (&'a dyn Foo,)) { self.call(a) } } struct Baz; diff --git a/src/test/run-pass/issues/issue-15155.rs b/src/test/run-pass/issues/issue-15155.rs index 3e513a3d5ecbe..7b137b4af56a7 100644 --- a/src/test/run-pass/issues/issue-15155.rs +++ b/src/test/run-pass/issues/issue-15155.rs @@ -4,18 +4,18 @@ trait IndirectTraitWithSend: TraitWithSend {} // Check struct instantiation (Box will only have Send if TraitWithSend has Send) #[allow(dead_code)] -struct Blah { x: Box } +struct Blah { x: Box } impl TraitWithSend for Blah {} // Struct instantiation 2-levels deep #[allow(dead_code)] -struct IndirectBlah { x: Box } +struct IndirectBlah { x: Box } impl TraitWithSend for IndirectBlah {} impl IndirectTraitWithSend for IndirectBlah {} fn test_trait() { println!("got here!") } fn main() { - test_trait::(); - test_trait::(); + test_trait::(); + test_trait::(); } diff --git a/src/test/run-pass/issues/issue-15763.rs b/src/test/run-pass/issues/issue-15763.rs index 4438d1f2ceca3..9ceffff2e3806 100644 --- a/src/test/run-pass/issues/issue-15763.rs +++ b/src/test/run-pass/issues/issue-15763.rs @@ -78,12 +78,12 @@ fn main() { assert_eq!(cc().unwrap(), 3); assert_eq!(dd().unwrap(), 3); - let i = box 32isize as Box; + let i = box 32isize as Box; assert_eq!(i.aaa(), 3); - let i = box 32isize as Box; + let i = box 32isize as Box; assert_eq!(i.bbb(), 3); - let i = box 32isize as Box; + let i = box 32isize as Box; assert_eq!(i.ccc().unwrap(), 3); - let i = box 32isize as Box; + let i = box 32isize as Box; assert_eq!(i.ddd().unwrap(), 3); } diff --git a/src/test/run-pass/issues/issue-16739.rs b/src/test/run-pass/issues/issue-16739.rs index 6868eae6ea4f7..54ad8fd076e4e 100644 --- a/src/test/run-pass/issues/issue-16739.rs +++ b/src/test/run-pass/issues/issue-16739.rs @@ -39,12 +39,12 @@ impl FnOnce<(u32,u32)> for Foo { } fn main() { - let mut f = box Foo { foo: 42 } as Box u32>; + let mut f = box Foo { foo: 42 } as Box u32>; assert_eq!(f.call_mut(()), 42); - let mut f = box Foo { foo: 40 } as Box u32>; + let mut f = box Foo { foo: 40 } as Box u32>; assert_eq!(f.call_mut((2,)), 42); - let mut f = box Foo { foo: 40 } as Box u32>; + let mut f = box Foo { foo: 40 } as Box u32>; assert_eq!(f.call_mut((1, 1)), 42); } diff --git a/src/test/run-pass/issues/issue-16922.rs b/src/test/run-pass/issues/issue-16922.rs index 82a3943e9efa5..c3c6ff304888d 100644 --- a/src/test/run-pass/issues/issue-16922.rs +++ b/src/test/run-pass/issues/issue-16922.rs @@ -7,5 +7,5 @@ fn foo(_: &u8) { } fn main() { - let _ = &foo as &Any; + let _ = &foo as &dyn Any; } diff --git a/src/test/run-pass/issues/issue-17322.rs b/src/test/run-pass/issues/issue-17322.rs index 79b6a5ae5337c..20a8d13612469 100644 --- a/src/test/run-pass/issues/issue-17322.rs +++ b/src/test/run-pass/issues/issue-17322.rs @@ -5,11 +5,11 @@ use std::io::{self, Write}; -fn f(wr: &mut Write) { +fn f(wr: &mut dyn Write) { wr.write_all(b"hello").ok().expect("failed"); } fn main() { - let mut wr = box io::stdout() as Box; + let mut wr = box io::stdout() as Box; f(&mut wr); } diff --git a/src/test/run-pass/issues/issue-17351.rs b/src/test/run-pass/issues/issue-17351.rs index f51f0b3ca0171..62f6bcf15e3e7 100644 --- a/src/test/run-pass/issues/issue-17351.rs +++ b/src/test/run-pass/issues/issue-17351.rs @@ -6,5 +6,5 @@ impl Str for str {} impl<'a, S: ?Sized> Str for &'a S where S: Str {} fn main() { - let _: &Str = &"x"; + let _: &dyn Str = &"x"; } diff --git a/src/test/run-pass/issues/issue-17771.rs b/src/test/run-pass/issues/issue-17771.rs index 7eea5ce6589b5..2f6464668c2ce 100644 --- a/src/test/run-pass/issues/issue-17771.rs +++ b/src/test/run-pass/issues/issue-17771.rs @@ -4,13 +4,13 @@ trait Aaa { fn dummy(&self) { } } -impl<'a> Aaa for &'a mut (Aaa + 'a) {} +impl<'a> Aaa for &'a mut (dyn Aaa + 'a) {} struct Bar<'a> { - writer: &'a mut (Aaa + 'a), + writer: &'a mut (dyn Aaa + 'a), } -fn baz(_: &mut Aaa) { +fn baz(_: &mut dyn Aaa) { } fn foo<'a>(mut bar: Bar<'a>) { diff --git a/src/test/run-pass/issues/issue-17897.rs b/src/test/run-pass/issues/issue-17897.rs index 291bd3f1718a2..6873c7ccb7f1c 100644 --- a/src/test/run-pass/issues/issue-17897.rs +++ b/src/test/run-pass/issues/issue-17897.rs @@ -1,5 +1,5 @@ // run-pass -fn action(mut cb: Box usize>) -> usize { +fn action(mut cb: Box usize>) -> usize { cb(1) } diff --git a/src/test/run-pass/issues/issue-20055-box-trait.rs b/src/test/run-pass/issues/issue-20055-box-trait.rs index cb7b5a638fc2b..772cd9d7eda82 100644 --- a/src/test/run-pass/issues/issue-20055-box-trait.rs +++ b/src/test/run-pass/issues/issue-20055-box-trait.rs @@ -22,7 +22,7 @@ pub fn foo(box_1: fn () -> Box<[i8; 1]>, box_4: fn () -> Box<[i8; 4]>, ) { println!("Hello World 1"); - let _: Box = match 3 { + let _: Box = match 3 { 1 => box_1(), 2 => box_2(), 3 => box_3(), diff --git a/src/test/run-pass/issues/issue-20575.rs b/src/test/run-pass/issues/issue-20575.rs index 95273edcf7e82..0ca67d9dc710e 100644 --- a/src/test/run-pass/issues/issue-20575.rs +++ b/src/test/run-pass/issues/issue-20575.rs @@ -4,7 +4,7 @@ // pretty-expanded FIXME #23616 fn main() { - let functions: [Box Option<()>>; 1] = [Box::new(|| None)]; + let functions: [Box Option<()>>; 1] = [Box::new(|| None)]; let _: Option> = functions.iter().map(|f| (*f)()).collect(); } diff --git a/src/test/run-pass/issues/issue-20676.rs b/src/test/run-pass/issues/issue-20676.rs index 27bbff09a00f2..2bc5034960a1b 100644 --- a/src/test/run-pass/issues/issue-20676.rs +++ b/src/test/run-pass/issues/issue-20676.rs @@ -7,6 +7,6 @@ use std::fmt; fn main() { - let a: &fmt::Debug = &1; + let a: &dyn fmt::Debug = &1; format!("{:?}", a); } diff --git a/src/test/run-pass/issues/issue-20953.rs b/src/test/run-pass/issues/issue-20953.rs index f5c743d0d8262..4ec7e3195ebe0 100644 --- a/src/test/run-pass/issues/issue-20953.rs +++ b/src/test/run-pass/issues/issue-20953.rs @@ -2,11 +2,11 @@ #![allow(unused_mut)] #![allow(unused_variables)] fn main() { - let mut shrinker: Box> = Box::new(vec![1].into_iter()); + let mut shrinker: Box> = Box::new(vec![1].into_iter()); println!("{:?}", shrinker.next()); for v in shrinker { assert!(false); } - let mut shrinker: &mut Iterator = &mut vec![1].into_iter(); + let mut shrinker: &mut dyn Iterator = &mut vec![1].into_iter(); println!("{:?}", shrinker.next()); for v in shrinker { assert!(false); } } diff --git a/src/test/run-pass/issues/issue-21058.rs b/src/test/run-pass/issues/issue-21058.rs index e0cf26f7034ca..0483e62fd2121 100644 --- a/src/test/run-pass/issues/issue-21058.rs +++ b/src/test/run-pass/issues/issue-21058.rs @@ -13,7 +13,7 @@ fn main() { // str std::intrinsics::type_name::(), // Trait - std::intrinsics::type_name::(), + std::intrinsics::type_name::(), // Newtype std::intrinsics::type_name::(), // DST diff --git a/src/test/run-pass/issues/issue-21361.rs b/src/test/run-pass/issues/issue-21361.rs index 5297a4a7b29e2..c970e77abb72b 100644 --- a/src/test/run-pass/issues/issue-21361.rs +++ b/src/test/run-pass/issues/issue-21361.rs @@ -2,10 +2,10 @@ fn main() { let v = vec![1, 2, 3]; - let boxed: Box> = Box::new(v.into_iter()); + let boxed: Box> = Box::new(v.into_iter()); assert_eq!(boxed.max(), Some(3)); let v = vec![1, 2, 3]; - let boxed: &mut Iterator = &mut v.into_iter(); + let boxed: &mut dyn Iterator = &mut v.into_iter(); assert_eq!(boxed.max(), Some(3)); } diff --git a/src/test/run-pass/issues/issue-21655.rs b/src/test/run-pass/issues/issue-21655.rs index cddd48349f9d0..d1cd4ec7b8a01 100644 --- a/src/test/run-pass/issues/issue-21655.rs +++ b/src/test/run-pass/issues/issue-21655.rs @@ -1,6 +1,6 @@ // run-pass -fn test(it: &mut Iterator) { +fn test(it: &mut dyn Iterator) { for x in it { assert_eq!(x, 1) } diff --git a/src/test/run-pass/issues/issue-2190-1.rs b/src/test/run-pass/issues/issue-2190-1.rs index 34a80ab00516b..e67a924b9eedc 100644 --- a/src/test/run-pass/issues/issue-2190-1.rs +++ b/src/test/run-pass/issues/issue-2190-1.rs @@ -9,11 +9,11 @@ use std::thread::Builder; static generations: usize = 1024+256+128+49; -fn spawn(mut f: Box) { +fn spawn(mut f: Box) { Builder::new().stack_size(32 * 1024).spawn(move|| f()); } -fn child_no(x: usize) -> Box { +fn child_no(x: usize) -> Box { Box::new(move|| { if x < generations { spawn(child_no(x+1)); diff --git a/src/test/run-pass/issues/issue-22346.rs b/src/test/run-pass/issues/issue-22346.rs index b728911e54170..5f6d9dcc9ae43 100644 --- a/src/test/run-pass/issues/issue-22346.rs +++ b/src/test/run-pass/issues/issue-22346.rs @@ -3,7 +3,7 @@ // pretty-expanded FIXME #23616 // This used to cause an ICE because the retslot for the "return" had the wrong type -fn testcase<'a>() -> Box + 'a> { +fn testcase<'a>() -> Box + 'a> { return Box::new((0..3).map(|i| { return i; })); } diff --git a/src/test/run-pass/issues/issue-2288.rs b/src/test/run-pass/issues/issue-2288.rs index 963e7e62c7f11..c74e53fca60fd 100644 --- a/src/test/run-pass/issues/issue-2288.rs +++ b/src/test/run-pass/issues/issue-2288.rs @@ -23,13 +23,13 @@ fn foo(b: A) -> foo { } } -fn f(x: Box>, a: A) { +fn f(x: Box>, a: A) { x.chowder(a); } pub fn main() { let c = foo(42); - let d: Box> = box c as Box>; + let d: Box> = box c as Box>; f(d, c.x); } diff --git a/src/test/run-pass/issues/issue-23261.rs b/src/test/run-pass/issues/issue-23261.rs index 0b34653a34535..e21f86351eeee 100644 --- a/src/test/run-pass/issues/issue-23261.rs +++ b/src/test/run-pass/issues/issue-23261.rs @@ -41,7 +41,7 @@ fn check_both(val: &Foo<[u8]>) { } } -fn check_trait_obj(val: &Foo) { +fn check_trait_obj(val: &Foo) { match *val { Foo { a, ref inner } => { assert_eq!(a, 32); @@ -56,6 +56,6 @@ fn main() { check_dst_val(foo); check_both(foo); - let foo: &Foo = &Foo { a: 32, inner: 32 }; + let foo: &Foo = &Foo { a: 32, inner: 32 }; check_trait_obj(foo); } diff --git a/src/test/run-pass/issues/issue-23485.rs b/src/test/run-pass/issues/issue-23485.rs index a55846f40dfbd..1dd3d9293bcc6 100644 --- a/src/test/run-pass/issues/issue-23485.rs +++ b/src/test/run-pass/issues/issue-23485.rs @@ -45,6 +45,6 @@ impl Iterator for Counter { } fn main() { - let mut x: Box> = Box::new(Counter { value: 22 }); + let mut x: Box> = Box::new(Counter { value: 22 }); assert_eq!(x.next().unwrap().value, 22); } diff --git a/src/test/run-pass/issues/issue-24010.rs b/src/test/run-pass/issues/issue-24010.rs index 1f68d47d97b63..264e1ee22cdda 100644 --- a/src/test/run-pass/issues/issue-24010.rs +++ b/src/test/run-pass/issues/issue-24010.rs @@ -2,7 +2,7 @@ trait Foo: Fn(i32) -> i32 + Send {} impl i32 + Send> Foo for T {} -fn wants_foo(f: Box) -> i32 { +fn wants_foo(f: Box) -> i32 { f(42) } diff --git a/src/test/run-pass/issues/issue-24086.rs b/src/test/run-pass/issues/issue-24086.rs index 86fa5a6f3682e..54622afbcfc13 100644 --- a/src/test/run-pass/issues/issue-24086.rs +++ b/src/test/run-pass/issues/issue-24086.rs @@ -7,8 +7,8 @@ pub struct Registry<'a> { } pub struct Listener<'a> { - pub announce: Option>, - pub remove: Option>, + pub announce: Option>, + pub remove: Option>, } impl<'a> Drop for Registry<'a> { diff --git a/src/test/run-pass/issues/issue-25339.rs b/src/test/run-pass/issues/issue-25339.rs index 602f458e4cf54..6f8ec700951e2 100644 --- a/src/test/run-pass/issues/issue-25339.rs +++ b/src/test/run-pass/issues/issue-25339.rs @@ -12,7 +12,7 @@ pub trait Routing { pub trait ToRouting { type Input; - type Routing : ?Sized = Routing; + type Routing : ?Sized = dyn Routing; fn to_routing(self) -> Self::Routing; } diff --git a/src/test/run-pass/issues/issue-25515.rs b/src/test/run-pass/issues/issue-25515.rs index 75af16d8dda8e..e7b9ea3acfc01 100644 --- a/src/test/run-pass/issues/issue-25515.rs +++ b/src/test/run-pass/issues/issue-25515.rs @@ -13,7 +13,7 @@ fn main() { let mut drops = 0; { - let _: Rc = Rc::new(Foo(&mut drops)); + let _: Rc = Rc::new(Foo(&mut drops)); } assert_eq!(1, drops); diff --git a/src/test/run-pass/issues/issue-25549-multiple-drop.rs b/src/test/run-pass/issues/issue-25549-multiple-drop.rs index db9261f6ef48f..25a2da707dc0f 100644 --- a/src/test/run-pass/issues/issue-25549-multiple-drop.rs +++ b/src/test/run-pass/issues/issue-25549-multiple-drop.rs @@ -25,7 +25,7 @@ fn main() { drops = 0; { - let y = &Holder(Foo(&mut drops)) as &Holder; + let y = &Holder(Foo(&mut drops)) as &Holder; // this used to cause an extra drop of the Foo instance let x = &y.0; } diff --git a/src/test/run-pass/issues/issue-25757.rs b/src/test/run-pass/issues/issue-25757.rs index caade6defdd49..ec1864d7deb58 100644 --- a/src/test/run-pass/issues/issue-25757.rs +++ b/src/test/run-pass/issues/issue-25757.rs @@ -9,7 +9,7 @@ impl Foo { } } -const FUNC: &'static Fn(&mut Foo) -> () = &Foo::x; +const FUNC: &'static dyn Fn(&mut Foo) -> () = &Foo::x; fn main() { let mut foo = Foo { a: 137 }; diff --git a/src/test/run-pass/issues/issue-26641.rs b/src/test/run-pass/issues/issue-26641.rs index 297b1d689a6b1..4b6f2c2b3bc7d 100644 --- a/src/test/run-pass/issues/issue-26641.rs +++ b/src/test/run-pass/issues/issue-26641.rs @@ -1,5 +1,5 @@ // run-pass -struct Parser<'a>(Box); +struct Parser<'a>(Box); fn main() { let _x = Parser(Box::new(|_|{})); diff --git a/src/test/run-pass/issues/issue-26709.rs b/src/test/run-pass/issues/issue-26709.rs index 84cd21373672e..281ae13399dd2 100644 --- a/src/test/run-pass/issues/issue-26709.rs +++ b/src/test/run-pass/issues/issue-26709.rs @@ -11,7 +11,7 @@ fn main() { let mut x = 0; { let wrapper = Box::new(Wrapper(&mut x, 123)); - let _: Box> = wrapper; + let _: Box> = wrapper; } assert_eq!(432, x) } diff --git a/src/test/run-pass/issues/issue-26802.rs b/src/test/run-pass/issues/issue-26802.rs index c4aa70d50222d..307a67160980d 100644 --- a/src/test/run-pass/issues/issue-26802.rs +++ b/src/test/run-pass/issues/issue-26802.rs @@ -5,7 +5,7 @@ trait Foo<'a> { pub struct FooBar; impl Foo<'static> for FooBar {} -fn test(foobar: FooBar) -> Box> { +fn test(foobar: FooBar) -> Box> { Box::new(foobar) } diff --git a/src/test/run-pass/issues/issue-26805.rs b/src/test/run-pass/issues/issue-26805.rs index 950d98315d049..bcf8a6731910f 100644 --- a/src/test/run-pass/issues/issue-26805.rs +++ b/src/test/run-pass/issues/issue-26805.rs @@ -2,5 +2,5 @@ struct NonOrd; fn main() { - let _: Box> = Box::new(vec![NonOrd].into_iter()); + let _: Box> = Box::new(vec![NonOrd].into_iter()); } diff --git a/src/test/run-pass/issues/issue-26905.rs b/src/test/run-pass/issues/issue-26905.rs index 2f500d1c0d1b7..2d5827f476b9e 100644 --- a/src/test/run-pass/issues/issue-26905.rs +++ b/src/test/run-pass/issues/issue-26905.rs @@ -17,5 +17,5 @@ fn main() { let data = [1, 2, 3]; let iter = data.iter(); let x = MyRc { _ptr: &iter, _boo: PhantomData }; - let _y: MyRc> = x; + let _y: MyRc> = x; } diff --git a/src/test/run-pass/issues/issue-27268.rs b/src/test/run-pass/issues/issue-27268.rs index fccea452fbcef..161e2d4d204eb 100644 --- a/src/test/run-pass/issues/issue-27268.rs +++ b/src/test/run-pass/issues/issue-27268.rs @@ -1,4 +1,4 @@ // run-pass fn main() { - const _C: &'static Fn() = &||{}; + const _C: &'static dyn Fn() = &||{}; } diff --git a/src/test/run-pass/issues/issue-2734.rs b/src/test/run-pass/issues/issue-2734.rs index fcb224e2d043d..d449f6449aa09 100644 --- a/src/test/run-pass/issues/issue-2734.rs +++ b/src/test/run-pass/issues/issue-2734.rs @@ -11,8 +11,8 @@ trait hax { } impl hax for A { } -fn perform_hax(x: Box) -> Box { - box x as Box +fn perform_hax(x: Box) -> Box { + box x as Box } fn deadcode() { diff --git a/src/test/run-pass/issues/issue-2735.rs b/src/test/run-pass/issues/issue-2735.rs index c48bedf14f7b7..794c7d4edaa11 100644 --- a/src/test/run-pass/issues/issue-2735.rs +++ b/src/test/run-pass/issues/issue-2735.rs @@ -11,8 +11,8 @@ trait hax { } impl hax for A { } -fn perform_hax(x: Box) -> Box { - box x as Box +fn perform_hax(x: Box) -> Box { + box x as Box } fn deadcode() { diff --git a/src/test/run-pass/issues/issue-27890.rs b/src/test/run-pass/issues/issue-27890.rs index 0f6a932e4b886..9f85473380f82 100644 --- a/src/test/run-pass/issues/issue-27890.rs +++ b/src/test/run-pass/issues/issue-27890.rs @@ -1,6 +1,6 @@ // run-pass -static PLUS_ONE: &'static (Fn(i32) -> i32 + Sync) = (&|x: i32| { x + 1 }) - as &'static (Fn(i32) -> i32 + Sync); +static PLUS_ONE: &'static (dyn Fn(i32) -> i32 + Sync) = (&|x: i32| { x + 1 }) + as &'static (dyn Fn(i32) -> i32 + Sync); fn main() { assert_eq!(PLUS_ONE(2), 3); diff --git a/src/test/run-pass/issues/issue-2935.rs b/src/test/run-pass/issues/issue-2935.rs index 58ade32b2502c..11641ca738018 100644 --- a/src/test/run-pass/issues/issue-2935.rs +++ b/src/test/run-pass/issues/issue-2935.rs @@ -20,7 +20,7 @@ pub fn main() { // let y = box ({a: 4}); // let z = box ({a: 4} as it); // let z = box ({a: true} as it); - let z: Box<_> = box (box true as Box); + let z: Box<_> = box (box true as Box); // x.f(); // y.f(); // (*z).f(); diff --git a/src/test/run-pass/issues/issue-3052.rs b/src/test/run-pass/issues/issue-3052.rs index 927102981e7f9..ee2456da3e215 100644 --- a/src/test/run-pass/issues/issue-3052.rs +++ b/src/test/run-pass/issues/issue-3052.rs @@ -2,7 +2,7 @@ #![allow(dead_code)] // pretty-expanded FIXME #23616 -type Connection = Box) + 'static>; +type Connection = Box) + 'static>; fn f() -> Option { let mock_connection: Connection = Box::new(|_| {}); diff --git a/src/test/run-pass/issues/issue-30530.rs b/src/test/run-pass/issues/issue-30530.rs index 0ae270200a6a2..e837fc81721a8 100644 --- a/src/test/run-pass/issues/issue-30530.rs +++ b/src/test/run-pass/issues/issue-30530.rs @@ -8,7 +8,7 @@ pub enum Handler { Default, #[allow(dead_code)] - Custom(*mut Box), + Custom(*mut Box), } fn main() { @@ -16,7 +16,7 @@ fn main() { } #[inline(never)] -pub fn take(h: Handler, f: Box) -> Box { +pub fn take(h: Handler, f: Box) -> Box { unsafe { match h { Handler::Custom(ptr) => *Box::from_raw(ptr), diff --git a/src/test/run-pass/issues/issue-30615.rs b/src/test/run-pass/issues/issue-30615.rs index 236a181fc1d25..c718449d84eed 100644 --- a/src/test/run-pass/issues/issue-30615.rs +++ b/src/test/run-pass/issues/issue-30615.rs @@ -1,5 +1,5 @@ // run-pass fn main() { - &0u8 as *const u8 as *const PartialEq; + &0u8 as *const u8 as *const dyn PartialEq; &[0u8] as *const [u8; 1] as *const [u8]; } diff --git a/src/test/run-pass/issues/issue-32389.rs b/src/test/run-pass/issues/issue-32389.rs index 6824c66cb3751..cc94cc819d665 100644 --- a/src/test/run-pass/issues/issue-32389.rs +++ b/src/test/run-pass/issues/issue-32389.rs @@ -2,7 +2,7 @@ fn foo() -> T { loop {} } fn test() { - let ref mut a: &mut FnMut((i8,), i16) = foo(); + let ref mut a: &mut dyn FnMut((i8,), i16) = foo(); a((0,), 0); } diff --git a/src/test/run-pass/issues/issue-33387.rs b/src/test/run-pass/issues/issue-33387.rs index 792ff95200a1d..499fa7c1f27ac 100644 --- a/src/test/run-pass/issues/issue-33387.rs +++ b/src/test/run-pass/issues/issue-33387.rs @@ -15,18 +15,18 @@ impl Foo for [u8; 2] { struct Bar(T); -fn unsize_fat_ptr<'a>(x: &'a Bar) -> &'a Bar { +fn unsize_fat_ptr<'a>(x: &'a Bar) -> &'a Bar { x } -fn unsize_nested_fat_ptr(x: Arc) -> Arc { +fn unsize_nested_fat_ptr(x: Arc) -> Arc { x } fn main() { - let x: Box> = Box::new(Bar([1,2])); + let x: Box> = Box::new(Bar([1,2])); assert_eq!(unsize_fat_ptr(&*x).0.get(), [1, 2]); - let x: Arc = Arc::new([3, 4]); + let x: Arc = Arc::new([3, 4]); assert_eq!(unsize_nested_fat_ptr(x).get(), [3, 4]); } diff --git a/src/test/run-pass/issues/issue-33461.rs b/src/test/run-pass/issues/issue-33461.rs index 9c6c5bfe78c73..4e01d4d3061f9 100644 --- a/src/test/run-pass/issues/issue-33461.rs +++ b/src/test/run-pass/issues/issue-33461.rs @@ -24,5 +24,5 @@ impl Shape

for TheType { fn main() { let ball = TheType { t: PhantomData }; - let handle: &Shape<()> = &ball; + let handle: &dyn Shape<()> = &ball; } diff --git a/src/test/run-pass/issues/issue-34503.rs b/src/test/run-pass/issues/issue-34503.rs index 1fb4b8759bd58..26e7358408f48 100644 --- a/src/test/run-pass/issues/issue-34503.rs +++ b/src/test/run-pass/issues/issue-34503.rs @@ -7,5 +7,5 @@ fn main() { where Option: Ord { *x < *x } } impl Foo for () {} - let _ = &() as &Foo; + let _ = &() as &dyn Foo; } diff --git a/src/test/run-pass/issues/issue-35815.rs b/src/test/run-pass/issues/issue-35815.rs index 70e0ed9f7ce01..05fd1b15d43d0 100644 --- a/src/test/run-pass/issues/issue-35815.rs +++ b/src/test/run-pass/issues/issue-35815.rs @@ -10,6 +10,6 @@ struct Foo { fn main() { let foo: &Foo = &Foo { a: 1, b: false, c: 2i32 }; - let foo_unsized: &Foo = foo; + let foo_unsized: &Foo = foo; assert_eq!(mem::size_of_val(foo), mem::size_of_val(foo_unsized)); } diff --git a/src/test/run-pass/issues/issue-36260.rs b/src/test/run-pass/issues/issue-36260.rs index 728dd5ec8d0d6..d96dc80ea719c 100644 --- a/src/test/run-pass/issues/issue-36260.rs +++ b/src/test/run-pass/issues/issue-36260.rs @@ -2,7 +2,7 @@ // Make sure this compiles without getting a linker error because of missing // drop-glue because the collector missed adding drop-glue for the closure: -fn create_fn() -> Box { +fn create_fn() -> Box { let text = String::new(); Box::new(move || { let _ = &text; }) diff --git a/src/test/run-pass/issues/issue-36786-resolve-call.rs b/src/test/run-pass/issues/issue-36786-resolve-call.rs index 38461db544ffb..e5341ba7dbedd 100644 --- a/src/test/run-pass/issues/issue-36786-resolve-call.rs +++ b/src/test/run-pass/issues/issue-36786-resolve-call.rs @@ -3,6 +3,6 @@ // correctly fn main() { - let x : Vec> = vec![Box::new(|| ())]; + let x : Vec> = vec![Box::new(|| ())]; x[0]() } diff --git a/src/test/run-pass/issues/issue-3702.rs b/src/test/run-pass/issues/issue-3702.rs index 1420dff063cfa..f48d549b3eb2c 100644 --- a/src/test/run-pass/issues/issue-3702.rs +++ b/src/test/run-pass/issues/issue-3702.rs @@ -6,7 +6,7 @@ pub fn main() { fn to_string(&self) -> String; } - fn to_string(t: Box) { + fn to_string(t: Box) { println!("{}", (*t).to_string()); } diff --git a/src/test/run-pass/issues/issue-3794.rs b/src/test/run-pass/issues/issue-3794.rs index d6af65f787d70..408d8d866d862 100644 --- a/src/test/run-pass/issues/issue-3794.rs +++ b/src/test/run-pass/issues/issue-3794.rs @@ -16,7 +16,7 @@ impl T for S { } } -fn print_t(t: &T) { +fn print_t(t: &dyn T) { t.print(); } @@ -27,6 +27,6 @@ fn print_s(s: &S) { pub fn main() { let s: Box = box S { s: 5 }; print_s(&*s); - let t: Box = s as Box; + let t: Box = s as Box; print_t(&*t); } diff --git a/src/test/run-pass/issues/issue-39292.rs b/src/test/run-pass/issues/issue-39292.rs index 0b8139dd79514..968cf08916fd6 100644 --- a/src/test/run-pass/issues/issue-39292.rs +++ b/src/test/run-pass/issues/issue-39292.rs @@ -13,5 +13,5 @@ trait Bar: for<'a> Foo<&'a ()> { } impl Bar for () {} fn main() { - (&() as &Bar).print(); // Segfault + (&() as &dyn Bar).print(); // Segfault } diff --git a/src/test/run-pass/issues/issue-39823.rs b/src/test/run-pass/issues/issue-39823.rs index 0dfa8a75c4f00..148cf527e7cb7 100644 --- a/src/test/run-pass/issues/issue-39823.rs +++ b/src/test/run-pass/issues/issue-39823.rs @@ -11,15 +11,15 @@ struct LocalC(u32); struct LocalG(T); fn main() { - let virtual_localc : &Fn(_) -> LocalC = &LocalC; + let virtual_localc : &dyn Fn(_) -> LocalC = &LocalC; assert_eq!(virtual_localc(1), LocalC(1)); - let virtual_localg : &Fn(_) -> LocalG = &LocalG; + let virtual_localg : &dyn Fn(_) -> LocalG = &LocalG; assert_eq!(virtual_localg(1), LocalG(1)); - let virtual_remotec : &Fn(_) -> RemoteC = &RemoteC; + let virtual_remotec : &dyn Fn(_) -> RemoteC = &RemoteC; assert_eq!(virtual_remotec(1), RemoteC(1)); - let virtual_remoteg : &Fn(_) -> RemoteG = &RemoteG; + let virtual_remoteg : &dyn Fn(_) -> RemoteG = &RemoteG; assert_eq!(virtual_remoteg(1), RemoteG(1)); } diff --git a/src/test/run-pass/issues/issue-41053.rs b/src/test/run-pass/issues/issue-41053.rs index cd7a0a22623a8..967edfd441576 100644 --- a/src/test/run-pass/issues/issue-41053.rs +++ b/src/test/run-pass/issues/issue-41053.rs @@ -6,8 +6,8 @@ pub trait Trait { fn foo(&self) {} } pub struct Foo; impl Iterator for Foo { - type Item = Box; - fn next(&mut self) -> Option> { + type Item = Box; + fn next(&mut self) -> Option> { extern crate issue_41053; impl ::Trait for issue_41053::Test { fn foo(&self) {} diff --git a/src/test/run-pass/issues/issue-41744.rs b/src/test/run-pass/issues/issue-41744.rs index edc4354b25336..dcdd1c21ee527 100644 --- a/src/test/run-pass/issues/issue-41744.rs +++ b/src/test/run-pass/issues/issue-41744.rs @@ -3,5 +3,5 @@ trait Tc {} impl Tc for bool {} fn main() { - let _: &[&Tc] = &[&true]; + let _: &[&dyn Tc] = &[&true]; } diff --git a/src/test/run-pass/issues/issue-42210.rs b/src/test/run-pass/issues/issue-42210.rs index cf4a698f516f3..318e3099f98ba 100644 --- a/src/test/run-pass/issues/issue-42210.rs +++ b/src/test/run-pass/issues/issue-42210.rs @@ -12,9 +12,9 @@ struct Bar; trait Baz { } -impl Foo for (Bar, Baz) { } +impl Foo for (Bar, dyn Baz) { } fn main() { - <(Bar, Baz) as Foo>::foo() + <(Bar, dyn Baz) as Foo>::foo() } diff --git a/src/test/run-pass/issues/issue-43132.rs b/src/test/run-pass/issues/issue-43132.rs index 726a86142f6a5..c886f4b0a2d6b 100644 --- a/src/test/run-pass/issues/issue-43132.rs +++ b/src/test/run-pass/issues/issue-43132.rs @@ -6,7 +6,7 @@ fn main() { fn foo() { let b = mk::< - Forward<(Box>,)>, + Forward<(Box>,)>, >(); b.map_err(|_| ()).join(); } diff --git a/src/test/run-pass/issues/issue-4333.rs b/src/test/run-pass/issues/issue-4333.rs index ae9f4c8bdb523..3df319b683f47 100644 --- a/src/test/run-pass/issues/issue-4333.rs +++ b/src/test/run-pass/issues/issue-4333.rs @@ -5,6 +5,6 @@ use std::io; pub fn main() { - let stdout = &mut io::stdout() as &mut io::Write; + let stdout = &mut io::stdout() as &mut dyn io::Write; stdout.write(b"Hello!"); } diff --git a/src/test/run-pass/issues/issue-47638.rs b/src/test/run-pass/issues/issue-47638.rs index 357364ee61273..a1ed3c3654401 100644 --- a/src/test/run-pass/issues/issue-47638.rs +++ b/src/test/run-pass/issues/issue-47638.rs @@ -1,10 +1,10 @@ // run-pass #![allow(unused_variables)] -fn id<'c, 'b>(f: &'c &'b Fn(&i32)) -> &'c &'b Fn(&'static i32) { +fn id<'c, 'b>(f: &'c &'b dyn Fn(&i32)) -> &'c &'b dyn Fn(&'static i32) { f } fn main() { - let f: &Fn(&i32) = &|x| {}; + let f: &dyn Fn(&i32) = &|x| {}; id(&f); } diff --git a/src/test/run-pass/issues/issue-5008-borrowed-traitobject-method-call.rs b/src/test/run-pass/issues/issue-5008-borrowed-traitobject-method-call.rs index 457fca3fedf06..fc869ae4fec26 100644 --- a/src/test/run-pass/issues/issue-5008-borrowed-traitobject-method-call.rs +++ b/src/test/run-pass/issues/issue-5008-borrowed-traitobject-method-call.rs @@ -23,12 +23,12 @@ impl Debuggable for Thing { fn debug_name(&self) -> String { self.name.clone() } } -fn print_name(x: &Debuggable) +fn print_name(x: &dyn Debuggable) { println!("debug_name = {}", x.debug_name()); } pub fn main() { let thing = Thing::new(); - print_name(&thing as &Debuggable); + print_name(&thing as &dyn Debuggable); } diff --git a/src/test/run-pass/issues/issue-5192.rs b/src/test/run-pass/issues/issue-5192.rs index 74d8d861a7d05..5a83d1c2ff9fd 100644 --- a/src/test/run-pass/issues/issue-5192.rs +++ b/src/test/run-pass/issues/issue-5192.rs @@ -24,12 +24,12 @@ impl EventLoop for UvEventLoop { } pub struct Scheduler { - event_loop: Box, + event_loop: Box, } impl Scheduler { - pub fn new(event_loop: Box) -> Scheduler { + pub fn new(event_loop: Box) -> Scheduler { Scheduler { event_loop: event_loop, } @@ -37,5 +37,5 @@ impl Scheduler { } pub fn main() { - let _sched = Scheduler::new(box UvEventLoop::new() as Box); + let _sched = Scheduler::new(box UvEventLoop::new() as Box); } diff --git a/src/test/run-pass/issues/issue-5666.rs b/src/test/run-pass/issues/issue-5666.rs index bf919ed5b1073..aa51327783012 100644 --- a/src/test/run-pass/issues/issue-5666.rs +++ b/src/test/run-pass/issues/issue-5666.rs @@ -19,7 +19,7 @@ impl Barks for Dog { pub fn main() { let snoopy = box Dog{name: "snoopy".to_string()}; let bubbles = box Dog{name: "bubbles".to_string()}; - let barker = [snoopy as Box, bubbles as Box]; + let barker = [snoopy as Box, bubbles as Box]; for pup in &barker { println!("{}", pup.bark()); diff --git a/src/test/run-pass/issues/issue-5708.rs b/src/test/run-pass/issues/issue-5708.rs index d3a2858873caf..6fe9943d3689f 100644 --- a/src/test/run-pass/issues/issue-5708.rs +++ b/src/test/run-pass/issues/issue-5708.rs @@ -21,11 +21,11 @@ impl Inner for isize { } struct Outer<'a> { - inner: &'a (Inner+'a) + inner: &'a (dyn Inner+'a) } impl<'a> Outer<'a> { - fn new(inner: &Inner) -> Outer { + fn new(inner: &dyn Inner) -> Outer { Outer { inner: inner } @@ -34,7 +34,7 @@ impl<'a> Outer<'a> { pub fn main() { let inner: isize = 5; - let outer = Outer::new(&inner as &Inner); + let outer = Outer::new(&inner as &dyn Inner); outer.inner.print(); } @@ -45,11 +45,11 @@ pub trait MyTrait { } pub struct MyContainer<'a, T:'a> { - foos: Vec<&'a (MyTrait+'a)> , + foos: Vec<&'a (dyn MyTrait+'a)> , } impl<'a, T> MyContainer<'a, T> { - pub fn add (&mut self, foo: &'a MyTrait) { + pub fn add (&mut self, foo: &'a dyn MyTrait) { self.foos.push(foo); } } diff --git a/src/test/run-pass/issues/issue-5988.rs b/src/test/run-pass/issues/issue-5988.rs index db77ca4375fc3..303fb4fbc9416 100644 --- a/src/test/run-pass/issues/issue-5988.rs +++ b/src/test/run-pass/issues/issue-5988.rs @@ -19,6 +19,6 @@ impl T for A { fn main() { let a = A; - let br = &a as &B; + let br = &a as &dyn B; br.f(); } diff --git a/src/test/run-pass/issues/issue-6128.rs b/src/test/run-pass/issues/issue-6128.rs index f23a317c6ba6a..8859fbe6afb7b 100644 --- a/src/test/run-pass/issues/issue-6128.rs +++ b/src/test/run-pass/issues/issue-6128.rs @@ -20,5 +20,5 @@ impl Graph for HashMap { pub fn main() { let g : Box> = box HashMap::new(); - let _g2 : Box> = g as Box>; + let _g2 : Box> = g as Box>; } diff --git a/src/test/run-pass/issues/issue-6157.rs b/src/test/run-pass/issues/issue-6157.rs index 354797cb2a784..b7a44ed862395 100644 --- a/src/test/run-pass/issues/issue-6157.rs +++ b/src/test/run-pass/issues/issue-6157.rs @@ -9,7 +9,7 @@ impl OpInt for F where F: FnMut(isize, isize) -> isize { } } -fn squarei<'a>(x: isize, op: &'a mut OpInt) -> isize { op.call(x, x) } +fn squarei<'a>(x: isize, op: &'a mut dyn OpInt) -> isize { op.call(x, x) } fn muli(x:isize, y:isize) -> isize { x * y } @@ -17,7 +17,7 @@ pub fn main() { let mut f = |x, y| muli(x, y); { let g = &mut f; - let h = g as &mut OpInt; + let h = g as &mut dyn OpInt; squarei(3, h); } } diff --git a/src/test/run-pass/issues/issue-6318.rs b/src/test/run-pass/issues/issue-6318.rs index d416048265fa5..d8bd83f0dc6ad 100644 --- a/src/test/run-pass/issues/issue-6318.rs +++ b/src/test/run-pass/issues/issue-6318.rs @@ -4,7 +4,7 @@ #![feature(box_syntax)] pub enum Thing { - A(Box) + A(Box) } pub trait Foo { @@ -16,7 +16,7 @@ pub struct Struct; impl Foo for Struct {} pub fn main() { - match Thing::A(box Struct as Box) { + match Thing::A(box Struct as Box) { Thing::A(_a) => 0, }; } diff --git a/src/test/run-pass/issues/issue-7563.rs b/src/test/run-pass/issues/issue-7563.rs index 820fffd1056a9..c62405554b4d1 100644 --- a/src/test/run-pass/issues/issue-7563.rs +++ b/src/test/run-pass/issues/issue-7563.rs @@ -16,7 +16,7 @@ struct B<'a> { b: isize, pa: &'a A } } impl<'a> B<'a> { - fn get_pa(&self) -> &'a IDummy { self.pa as &'a IDummy } + fn get_pa(&self) -> &'a dyn IDummy { self.pa as &'a dyn IDummy } } pub fn main() { diff --git a/src/test/run-pass/issues/issue-7911.rs b/src/test/run-pass/issues/issue-7911.rs index cb7e009d074e5..de833324bd20f 100644 --- a/src/test/run-pass/issues/issue-7911.rs +++ b/src/test/run-pass/issues/issue-7911.rs @@ -12,18 +12,18 @@ struct Foo { bar: Bar } impl FooBar for Bar {} trait Test { - fn get_immut(&self) -> &FooBar; - fn get_mut(&mut self) -> &mut FooBar; + fn get_immut(&self) -> &dyn FooBar; + fn get_mut(&mut self) -> &mut dyn FooBar; } macro_rules! generate_test { ($type_:path, $slf:ident, $field:expr) => ( impl Test for $type_ { - fn get_immut(&$slf) -> &FooBar { - &$field as &FooBar + fn get_immut(&$slf) -> &dyn FooBar { + &$field as &dyn FooBar } - fn get_mut(&mut $slf) -> &mut FooBar { - &mut $field as &mut FooBar + fn get_mut(&mut $slf) -> &mut dyn FooBar { + &mut $field as &mut dyn FooBar } } )} diff --git a/src/test/run-pass/issues/issue-8248.rs b/src/test/run-pass/issues/issue-8248.rs index 239c432e457bf..31a305c31bee2 100644 --- a/src/test/run-pass/issues/issue-8248.rs +++ b/src/test/run-pass/issues/issue-8248.rs @@ -7,9 +7,9 @@ trait A { struct B; impl A for B {} -fn foo(_: &mut A) {} +fn foo(_: &mut dyn A) {} pub fn main() { let mut b = B; - foo(&mut b as &mut A); + foo(&mut b as &mut dyn A); } diff --git a/src/test/run-pass/issues/issue-8249.rs b/src/test/run-pass/issues/issue-8249.rs index db49f354a3929..d09dff3a69709 100644 --- a/src/test/run-pass/issues/issue-8249.rs +++ b/src/test/run-pass/issues/issue-8249.rs @@ -9,10 +9,10 @@ struct B; impl A for B {} struct C<'a> { - foo: &'a mut (A+'a), + foo: &'a mut (dyn A+'a), } -fn foo(a: &mut A) { +fn foo(a: &mut dyn A) { C{ foo: a }; } diff --git a/src/test/run-pass/issues/issue-9129.rs b/src/test/run-pass/issues/issue-9129.rs index c81b9b1a10d0d..3d87e1c203783 100644 --- a/src/test/run-pass/issues/issue-9129.rs +++ b/src/test/run-pass/issues/issue-9129.rs @@ -20,7 +20,7 @@ fn Ident_new() -> Ident { Ident {name: 0x6789ABCD } } -pub fn light_fuse(fld: Box) { +pub fn light_fuse(fld: Box) { int3!(); let f = || { int3!(); @@ -30,6 +30,6 @@ pub fn light_fuse(fld: Box) { } pub fn main() { - let b = box S as Box; + let b = box S as Box; light_fuse(b); } diff --git a/src/test/run-pass/issues/issue-9394-inherited-trait-calls.rs b/src/test/run-pass/issues/issue-9394-inherited-trait-calls.rs index c4c95aa1aaed1..cc0dd4fc14a0d 100644 --- a/src/test/run-pass/issues/issue-9394-inherited-trait-calls.rs +++ b/src/test/run-pass/issues/issue-9394-inherited-trait-calls.rs @@ -52,7 +52,7 @@ impl Super for X { pub fn main() { let n = X; - let s = &n as &Super; + let s = &n as &dyn Super; assert_eq!(s.bar(),"super bar".to_string()); assert_eq!(s.foo(),"base foo".to_string()); assert_eq!(s.foo1(),"base foo1".to_string()); diff --git a/src/test/run-pass/issues/issue-9951.rs b/src/test/run-pass/issues/issue-9951.rs index 4e14bdbd73429..2698a3b17c6c2 100644 --- a/src/test/run-pass/issues/issue-9951.rs +++ b/src/test/run-pass/issues/issue-9951.rs @@ -11,11 +11,11 @@ impl Bar for u8 { } fn main() { - let (a, b) = (&5u8 as &Bar, &9u8 as &Bar); - let (c, d): (&Bar, &Bar) = (a, b); + let (a, b) = (&5u8 as &dyn Bar, &9u8 as &dyn Bar); + let (c, d): (&dyn Bar, &dyn Bar) = (a, b); - let (a, b) = (Box::new(5u8) as Box, Box::new(9u8) as Box); - let (c, d): (&Bar, &Bar) = (&*a, &*b); + let (a, b) = (Box::new(5u8) as Box, Box::new(9u8) as Box); + let (c, d): (&dyn Bar, &dyn Bar) = (&*a, &*b); - let (c, d): (&Bar, &Bar) = (&5, &9); + let (c, d): (&dyn Bar, &dyn Bar) = (&5, &9); } diff --git a/src/test/run-pass/last-use-in-cap-clause.rs b/src/test/run-pass/last-use-in-cap-clause.rs index b77f7b5d7822c..42dc6a4b06e1d 100644 --- a/src/test/run-pass/last-use-in-cap-clause.rs +++ b/src/test/run-pass/last-use-in-cap-clause.rs @@ -3,7 +3,7 @@ struct A { a: Box } -fn foo() -> Box isize + 'static> { +fn foo() -> Box isize + 'static> { let k: Box<_> = Box::new(22); let _u = A {a: k.clone()}; let result = || 22; diff --git a/src/test/run-pass/macros/colorful-write-macros.rs b/src/test/run-pass/macros/colorful-write-macros.rs index aba4383c73441..eb1872cc7f094 100644 --- a/src/test/run-pass/macros/colorful-write-macros.rs +++ b/src/test/run-pass/macros/colorful-write-macros.rs @@ -4,7 +4,7 @@ use std::io::Write; use std::fmt; struct Foo<'a> { - writer: &'a mut (Write+'a), + writer: &'a mut (dyn Write+'a), other: &'a str, } @@ -22,7 +22,7 @@ fn borrowing_writer_from_struct_and_formatting_struct_field(foo: Foo) { fn main() { let mut w = Vec::new(); - write!(&mut w as &mut Write, "").unwrap(); + write!(&mut w as &mut dyn Write, "").unwrap(); write!(&mut w, "").unwrap(); // should coerce println!("ok"); diff --git a/src/test/run-pass/macros/type-macros-simple.rs b/src/test/run-pass/macros/type-macros-simple.rs index 579b485a2a56e..dd3ad2ef0ac0f 100644 --- a/src/test/run-pass/macros/type-macros-simple.rs +++ b/src/test/run-pass/macros/type-macros-simple.rs @@ -16,7 +16,7 @@ fn issue_36540() { let x: m!() = m!(); std::cell::Cell::::new(m!()); - impl std::ops::Index for Trait<(m!(), T)> + impl std::ops::Index for dyn Trait<(m!(), T)> where T: Trait { type Output = m!(); diff --git a/src/test/run-pass/methods/method-argument-inference-associated-type.rs b/src/test/run-pass/methods/method-argument-inference-associated-type.rs index b5ba1f9455697..acd4a8465b075 100644 --- a/src/test/run-pass/methods/method-argument-inference-associated-type.rs +++ b/src/test/run-pass/methods/method-argument-inference-associated-type.rs @@ -10,13 +10,13 @@ pub trait Service { pub struct S(T); impl Service for ClientMap { - type Request = S>; + type Request = S>; fn call(&self, _req: Self::Request) {} } impl Service for ClientMap2 { - type Request = (Box,); + type Request = (Box,); fn call(&self, _req: Self::Request) {} } diff --git a/src/test/run-pass/mir/mir_codegen_calls.rs b/src/test/run-pass/mir/mir_codegen_calls.rs index 075d266d34d74..fc0db03e3a968 100644 --- a/src/test/run-pass/mir/mir_codegen_calls.rs +++ b/src/test/run-pass/mir/mir_codegen_calls.rs @@ -42,7 +42,7 @@ fn test4(x: &Foo, a: isize) -> isize { x.extension_method(a) } -fn test5(x: &Bar, a: isize) -> isize { +fn test5(x: &dyn Bar, a: isize) -> isize { // Test calling method on trait object x.extension_method(a) } @@ -88,11 +88,11 @@ fn test_closure(f: &F, x: i32, y: i32) -> i32 f(x, y) } -fn test_fn_object(f: &Fn(i32, i32) -> i32, x: i32, y: i32) -> i32 { +fn test_fn_object(f: &dyn Fn(i32, i32) -> i32, x: i32, y: i32) -> i32 { f(x, y) } -fn test_fn_impl(f: &&Fn(i32, i32) -> i32, x: i32, y: i32) -> i32 { +fn test_fn_impl(f: &&dyn Fn(i32, i32) -> i32, x: i32, y: i32) -> i32 { // This call goes through the Fn implementation for &Fn provided in // core::ops::impls. It expands to a static Fn::call() that calls the // Fn::call() implementation of the object shim underneath. @@ -174,7 +174,7 @@ fn main() { let closure = |x: i32, y: i32| { r*(x + (y*2)) }; assert_eq!(test_fn_const_call(&closure), 294); assert_eq!(test_closure(&closure, 100, 1), 306); - let function_object = &closure as &Fn(i32, i32) -> i32; + let function_object = &closure as &dyn Fn(i32, i32) -> i32; assert_eq!(test_fn_object(function_object, 100, 2), 312); assert_eq!(test_fn_impl(&function_object, 100, 3), 318); assert_eq!(test_fn_direct_call(&closure, 100, 4), 324); diff --git a/src/test/run-pass/mir/mir_codegen_critical_edge.rs b/src/test/run-pass/mir/mir_codegen_critical_edge.rs index 03b111e93dd25..5c1f1c3b70135 100644 --- a/src/test/run-pass/mir/mir_codegen_critical_edge.rs +++ b/src/test/run-pass/mir/mir_codegen_critical_edge.rs @@ -37,7 +37,7 @@ where A: Iterator, B: Iterator } // Make sure we actually codegen a version of the function -pub fn do_stuff(mut f: Foo>, Box>>) { +pub fn do_stuff(mut f: Foo>, Box>>) { let _x = f.next(); } diff --git a/src/test/run-pass/mir/mir_coercions.rs b/src/test/run-pass/mir/mir_coercions.rs index b673345db7045..f3dcc6b85fd98 100644 --- a/src/test/run-pass/mir/mir_coercions.rs +++ b/src/test/run-pass/mir/mir_coercions.rs @@ -4,12 +4,12 @@ use std::ops::CoerceUnsized; use std::marker::Unsize; -fn identity_coercion(x: &(Fn(u32)->u32 + Send)) -> &Fn(u32)->u32 { +fn identity_coercion(x: &(dyn Fn(u32)->u32 + Send)) -> &dyn Fn(u32)->u32 { x } fn fn_coercions(f: &fn(u32) -> u32) -> (unsafe fn(u32) -> u32, - &(Fn(u32) -> u32+Send)) + &(dyn Fn(u32) -> u32+Send)) { (*f, f) } @@ -35,8 +35,8 @@ fn coerce_triv_ptr_wrapper(p: TrivPtrWrapper<[u8; 3]>) -> TrivPtrWrapper<[u8]> { p } -fn coerce_fat_ptr_wrapper(p: PtrWrapper u32+Send>) - -> PtrWrapper u32> { +fn coerce_fat_ptr_wrapper(p: PtrWrapper u32+Send>) + -> PtrWrapper u32> { p } @@ -65,7 +65,7 @@ fn main() { let z = coerce_fat_ptr_wrapper(PtrWrapper(2,3,(),&square_local)); assert_eq!((z.3)(6), 36); - let z: PtrWrapper u32> = + let z: PtrWrapper u32> = coerce_ptr_wrapper_poly(PtrWrapper(2,3,(),&square_local)); assert_eq!((z.3)(6), 36); } diff --git a/src/test/run-pass/mir/mir_raw_fat_ptr.rs b/src/test/run-pass/mir/mir_raw_fat_ptr.rs index 328c8c502cbc9..6583852aa9bb6 100644 --- a/src/test/run-pass/mir/mir_raw_fat_ptr.rs +++ b/src/test/run-pass/mir/mir_raw_fat_ptr.rs @@ -63,7 +63,7 @@ fn compare_au8(a: *const [u8], b: *const [u8]) -> ComparisonResults { } } -fn compare_foo<'a>(a: *const (Foo+'a), b: *const (Foo+'a)) -> ComparisonResults { +fn compare_foo<'a>(a: *const (dyn Foo+'a), b: *const (dyn Foo+'a)) -> ComparisonResults { ComparisonResults { lt: a < b, le: a <= b, @@ -74,7 +74,7 @@ fn compare_foo<'a>(a: *const (Foo+'a), b: *const (Foo+'a)) -> ComparisonResults } } -fn simple_eq<'a>(a: *const (Foo+'a), b: *const (Foo+'a)) -> bool { +fn simple_eq<'a>(a: *const (dyn Foo+'a), b: *const (dyn Foo+'a)) -> bool { let result = a == b; result } @@ -128,7 +128,7 @@ fn main() { let u32_ = (4u32, 5u32); // check ordering for ptrs - let buf: &mut [*const Foo] = &mut [ + let buf: &mut [*const dyn Foo] = &mut [ &u8_, &u8_.0, &u32_, &u32_.0, ]; diff --git a/src/test/run-pass/new-box.rs b/src/test/run-pass/new-box.rs index b35c5445a4405..5539518c37072 100644 --- a/src/test/run-pass/new-box.rs +++ b/src/test/run-pass/new-box.rs @@ -18,13 +18,13 @@ impl Trait for Struct { } } -fn g(x: Box) { +fn g(x: Box) { x.printme(); - let y: &Trait = &*x; + let y: &dyn Trait = &*x; y.printme(); } fn main() { f(box 1234); - g(box Struct as Box); + g(box Struct as Box); } diff --git a/src/test/run-pass/newlambdas-ret-infer.rs b/src/test/run-pass/newlambdas-ret-infer.rs index 969868486e6eb..79c9f7dc01103 100644 --- a/src/test/run-pass/newlambdas-ret-infer.rs +++ b/src/test/run-pass/newlambdas-ret-infer.rs @@ -4,7 +4,7 @@ // pretty-expanded FIXME #23616 -fn unique() -> Box { return Box::new(|| ()); } +fn unique() -> Box { return Box::new(|| ()); } pub fn main() { } diff --git a/src/test/run-pass/newlambdas-ret-infer2.rs b/src/test/run-pass/newlambdas-ret-infer2.rs index 676b3507c5740..104f5be7767d3 100644 --- a/src/test/run-pass/newlambdas-ret-infer2.rs +++ b/src/test/run-pass/newlambdas-ret-infer2.rs @@ -4,7 +4,7 @@ // pretty-expanded FIXME #23616 -fn unique() -> Box { Box::new(|| ()) } +fn unique() -> Box { Box::new(|| ()) } pub fn main() { } diff --git a/src/test/run-pass/object-lifetime-default-default-to-static.rs b/src/test/run-pass/object-lifetime-default-default-to-static.rs index cf836c1a7deda..cd61dea03788f 100644 --- a/src/test/run-pass/object-lifetime-default-default-to-static.rs +++ b/src/test/run-pass/object-lifetime-default-default-to-static.rs @@ -10,23 +10,23 @@ trait Test { } struct SomeStruct { - t: Box, - u: Box, + t: Box, + u: Box, } -fn a(t: Box, mut ss: SomeStruct) { +fn a(t: Box, mut ss: SomeStruct) { ss.t = t; } -fn b(t: Box, mut ss: SomeStruct) { +fn b(t: Box, mut ss: SomeStruct) { ss.t = t; } -fn c(t: Box, mut ss: SomeStruct) { +fn c(t: Box, mut ss: SomeStruct) { ss.u = t; } -fn d(t: Box, mut ss: SomeStruct) { +fn d(t: Box, mut ss: SomeStruct) { ss.u = t; } diff --git a/src/test/run-pass/object-lifetime-default-from-rptr-box.rs b/src/test/run-pass/object-lifetime-default-from-rptr-box.rs index 3f69c9274889c..9212f2802c018 100644 --- a/src/test/run-pass/object-lifetime-default-from-rptr-box.rs +++ b/src/test/run-pass/object-lifetime-default-from-rptr-box.rs @@ -10,21 +10,21 @@ trait Test { } struct SomeStruct<'a> { - t: &'a Box, - u: &'a Box, + t: &'a Box, + u: &'a Box, } -fn a<'a>(t: &'a Box, mut ss: SomeStruct<'a>) { +fn a<'a>(t: &'a Box, mut ss: SomeStruct<'a>) { ss.t = t; } -fn b<'a>(t: &'a Box, mut ss: SomeStruct<'a>) { +fn b<'a>(t: &'a Box, mut ss: SomeStruct<'a>) { ss.u = t; } // see also compile-fail/object-lifetime-default-from-rptr-box-error.rs -fn d<'a>(t: &'a Box, mut ss: SomeStruct<'a>) { +fn d<'a>(t: &'a Box, mut ss: SomeStruct<'a>) { ss.u = t; } diff --git a/src/test/run-pass/object-lifetime-default-from-rptr-mut.rs b/src/test/run-pass/object-lifetime-default-from-rptr-mut.rs index dc9e292f0de38..061f3a116fcbb 100644 --- a/src/test/run-pass/object-lifetime-default-from-rptr-mut.rs +++ b/src/test/run-pass/object-lifetime-default-from-rptr-mut.rs @@ -10,23 +10,23 @@ trait Test { } struct SomeStruct<'a> { - t: &'a mut Test, - u: &'a mut (Test+'a), + t: &'a mut dyn Test, + u: &'a mut (dyn Test+'a), } -fn a<'a>(t: &'a mut Test, mut ss: SomeStruct<'a>) { +fn a<'a>(t: &'a mut dyn Test, mut ss: SomeStruct<'a>) { ss.t = t; } -fn b<'a>(t: &'a mut Test, mut ss: SomeStruct<'a>) { +fn b<'a>(t: &'a mut dyn Test, mut ss: SomeStruct<'a>) { ss.u = t; } -fn c<'a>(t: &'a mut (Test+'a), mut ss: SomeStruct<'a>) { +fn c<'a>(t: &'a mut (dyn Test+'a), mut ss: SomeStruct<'a>) { ss.t = t; } -fn d<'a>(t: &'a mut (Test+'a), mut ss: SomeStruct<'a>) { +fn d<'a>(t: &'a mut (dyn Test+'a), mut ss: SomeStruct<'a>) { ss.u = t; } diff --git a/src/test/run-pass/object-lifetime-default-from-rptr.rs b/src/test/run-pass/object-lifetime-default-from-rptr.rs index 061f71b9ae6bf..cfa4af0d7a53f 100644 --- a/src/test/run-pass/object-lifetime-default-from-rptr.rs +++ b/src/test/run-pass/object-lifetime-default-from-rptr.rs @@ -12,30 +12,30 @@ trait Test { } struct SomeStruct<'a> { - t: &'a Test, - u: &'a (Test+'a), + t: &'a dyn Test, + u: &'a (dyn Test+'a), } -fn a<'a>(t: &'a Test, mut ss: SomeStruct<'a>) { +fn a<'a>(t: &'a dyn Test, mut ss: SomeStruct<'a>) { ss.t = t; } -fn b<'a>(t: &'a Test, mut ss: SomeStruct<'a>) { +fn b<'a>(t: &'a dyn Test, mut ss: SomeStruct<'a>) { ss.u = t; } -fn c<'a>(t: &'a (Test+'a), mut ss: SomeStruct<'a>) { +fn c<'a>(t: &'a (dyn Test+'a), mut ss: SomeStruct<'a>) { ss.t = t; } -fn d<'a>(t: &'a (Test+'a), mut ss: SomeStruct<'a>) { +fn d<'a>(t: &'a (dyn Test+'a), mut ss: SomeStruct<'a>) { ss.u = t; } -fn e<'a>(_: &'a (Display+'static)) {} +fn e<'a>(_: &'a (dyn Display+'static)) {} fn main() { // Inside a function body, we can just infer both // lifetimes, to allow &'tmp (Display+'static). - e(&0 as &Display); + e(&0 as &dyn Display); } diff --git a/src/test/run-pass/object-method-numbering.rs b/src/test/run-pass/object-method-numbering.rs index 455af78c7a08e..7f24ab2cbb5ff 100644 --- a/src/test/run-pass/object-method-numbering.rs +++ b/src/test/run-pass/object-method-numbering.rs @@ -21,7 +21,7 @@ impl SomeTrait for i32 { fn main() { let x = 22; - let x1: &SomeTrait = &x; + let x1: &dyn SomeTrait = &x; let y = get_int(x1); assert_eq!(x, y); } diff --git a/src/test/run-pass/objects-coerce-freeze-borrored.rs b/src/test/run-pass/objects-coerce-freeze-borrored.rs index 872b9d3e9160b..47196f108c02c 100644 --- a/src/test/run-pass/objects-coerce-freeze-borrored.rs +++ b/src/test/run-pass/objects-coerce-freeze-borrored.rs @@ -17,7 +17,7 @@ impl Foo for usize { } } -fn do_it_mut(obj: &mut Foo) { +fn do_it_mut(obj: &mut dyn Foo) { let x = obj.bar(); let y = obj.foo(); assert_eq!(x, y); @@ -25,14 +25,14 @@ fn do_it_mut(obj: &mut Foo) { do_it_imm(obj, y); } -fn do_it_imm(obj: &Foo, v: usize) { +fn do_it_imm(obj: &dyn Foo, v: usize) { let y = obj.foo(); assert_eq!(v, y); } pub fn main() { let mut x: usize = 22; - let obj = &mut x as &mut Foo; + let obj = &mut x as &mut dyn Foo; do_it_mut(obj); do_it_imm(obj, 23); do_it_mut(obj); diff --git a/src/test/run-pass/objects-owned-object-borrowed-method-headerless.rs b/src/test/run-pass/objects-owned-object-borrowed-method-headerless.rs index a96772bfb6312..58327237494ed 100644 --- a/src/test/run-pass/objects-owned-object-borrowed-method-headerless.rs +++ b/src/test/run-pass/objects-owned-object-borrowed-method-headerless.rs @@ -20,10 +20,10 @@ impl FooTrait for BarStruct { } pub fn main() { - let foos: Vec> = vec![ - box BarStruct{ x: 0 } as Box, - box BarStruct{ x: 1 } as Box, - box BarStruct{ x: 2 } as Box + let foos: Vec> = vec![ + box BarStruct{ x: 0 } as Box, + box BarStruct{ x: 1 } as Box, + box BarStruct{ x: 2 } as Box ]; for i in 0..foos.len() { diff --git a/src/test/run-pass/objects-owned-object-owned-method.rs b/src/test/run-pass/objects-owned-object-owned-method.rs index 6ca5233b198e0..69984fbb62f14 100644 --- a/src/test/run-pass/objects-owned-object-owned-method.rs +++ b/src/test/run-pass/objects-owned-object-owned-method.rs @@ -19,6 +19,6 @@ impl FooTrait for BarStruct { } pub fn main() { - let foo = box BarStruct{ x: 22 } as Box; + let foo = box BarStruct{ x: 22 } as Box; assert_eq!(22, foo.foo()); } diff --git a/src/test/run-pass/overloaded/overloaded-calls-object-one-arg.rs b/src/test/run-pass/overloaded/overloaded-calls-object-one-arg.rs index ff484418c1dbe..1afab9a1ffbe7 100644 --- a/src/test/run-pass/overloaded/overloaded-calls-object-one-arg.rs +++ b/src/test/run-pass/overloaded/overloaded-calls-object-one-arg.rs @@ -3,7 +3,7 @@ // This is a bit tricky due to rust-call ABI. -fn foo(f: &mut FnMut(isize) -> isize) -> isize { +fn foo(f: &mut dyn FnMut(isize) -> isize) -> isize { f(22) } diff --git a/src/test/run-pass/overloaded/overloaded-calls-object-two-args.rs b/src/test/run-pass/overloaded/overloaded-calls-object-two-args.rs index 0d0136bc29ac7..38087bc8710fc 100644 --- a/src/test/run-pass/overloaded/overloaded-calls-object-two-args.rs +++ b/src/test/run-pass/overloaded/overloaded-calls-object-two-args.rs @@ -3,7 +3,7 @@ // This is a bit tricky due to rust-call ABI. -fn foo(f: &mut FnMut(isize, isize) -> isize) -> isize { +fn foo(f: &mut dyn FnMut(isize, isize) -> isize) -> isize { f(1, 2) } diff --git a/src/test/run-pass/overloaded/overloaded-calls-object-zero-args.rs b/src/test/run-pass/overloaded/overloaded-calls-object-zero-args.rs index bbea6a909c880..9a7bfaa9bf4f0 100644 --- a/src/test/run-pass/overloaded/overloaded-calls-object-zero-args.rs +++ b/src/test/run-pass/overloaded/overloaded-calls-object-zero-args.rs @@ -3,7 +3,7 @@ // This is a bit tricky due to rust-call ABI. -fn foo(f: &mut FnMut() -> isize) -> isize { +fn foo(f: &mut dyn FnMut() -> isize) -> isize { f() } diff --git a/src/test/run-pass/panics/panic-safe.rs b/src/test/run-pass/panics/panic-safe.rs index 3798a4fc5cba1..9867cc56406ef 100644 --- a/src/test/run-pass/panics/panic-safe.rs +++ b/src/test/run-pass/panics/panic-safe.rs @@ -33,7 +33,7 @@ fn main() { assert::>(); trait Trait: UnwindSafe {} - assert::>(); + assert::>(); fn bar() { assert::>(); diff --git a/src/test/run-pass/privacy/privacy-ns.rs b/src/test/run-pass/privacy/privacy-ns.rs index b1b03eae5db5f..c32e3f17880db 100644 --- a/src/test/run-pass/privacy/privacy-ns.rs +++ b/src/test/run-pass/privacy/privacy-ns.rs @@ -28,19 +28,19 @@ fn test_unused1() { fn test_single1() { use foo1::Bar; - let _x: Box; + let _x: Box; } fn test_list1() { use foo1::{Bar,Baz}; - let _x: Box; + let _x: Box; } fn test_glob1() { use foo1::*; - let _x: Box; + let _x: Box; } // private type, public value @@ -93,21 +93,21 @@ fn test_single3() { use foo3::Bar; Bar(); - let _x: Box; + let _x: Box; } fn test_list3() { use foo3::{Bar,Baz}; Bar(); - let _x: Box; + let _x: Box; } fn test_glob3() { use foo3::*; Bar(); - let _x: Box; + let _x: Box; } fn main() { diff --git a/src/test/run-pass/raw-fat-ptr.rs b/src/test/run-pass/raw-fat-ptr.rs index df69db1cc9a25..511a35b25a3e8 100644 --- a/src/test/run-pass/raw-fat-ptr.rs +++ b/src/test/run-pass/raw-fat-ptr.rs @@ -78,7 +78,7 @@ fn main() { let mut u32_ = (4u32, 5u32); // check ordering for ptrs - let buf: &mut [*const Foo] = &mut [ + let buf: &mut [*const dyn Foo] = &mut [ &u8_, &u8_.0, &u32_, &u32_.0, ]; @@ -90,7 +90,7 @@ fn main() { assert_inorder(buf); // check ordering for mut ptrs - let buf: &mut [*mut Foo] = &mut [ + let buf: &mut [*mut dyn Foo] = &mut [ &mut u8_, &mut u8_.0, &mut u32_, &mut u32_.0, ]; diff --git a/src/test/run-pass/regions/regions-bound-lists-feature-gate.rs b/src/test/run-pass/regions/regions-bound-lists-feature-gate.rs index 204f4f8130dea..3815498f86fbb 100644 --- a/src/test/run-pass/regions/regions-bound-lists-feature-gate.rs +++ b/src/test/run-pass/regions/regions-bound-lists-feature-gate.rs @@ -9,7 +9,7 @@ trait Foo { fn dummy(&self) { } } -fn foo<'a>(x: Box) { +fn foo<'a>(x: Box) { } fn bar<'a, T: 'a>() { diff --git a/src/test/run-pass/regions/regions-close-over-type-parameter-successfully.rs b/src/test/run-pass/regions/regions-close-over-type-parameter-successfully.rs index 85c9c64c64386..4b47ed8c6aeb7 100644 --- a/src/test/run-pass/regions/regions-close-over-type-parameter-successfully.rs +++ b/src/test/run-pass/regions/regions-close-over-type-parameter-successfully.rs @@ -12,8 +12,8 @@ impl<'a> SomeTrait for &'a isize { } } -fn make_object<'a,A:SomeTrait+'a>(v: A) -> Box { - box v as Box +fn make_object<'a,A:SomeTrait+'a>(v: A) -> Box { + box v as Box } fn main() { diff --git a/src/test/run-pass/regions/regions-copy-closure.rs b/src/test/run-pass/regions/regions-copy-closure.rs index 6545ddf72c76a..43640079777a3 100644 --- a/src/test/run-pass/regions/regions-copy-closure.rs +++ b/src/test/run-pass/regions/regions-copy-closure.rs @@ -2,10 +2,10 @@ #![allow(non_camel_case_types)] struct closure_box<'a> { - cl: Box, + cl: Box, } -fn box_it<'a>(x: Box) -> closure_box<'a> { +fn box_it<'a>(x: Box) -> closure_box<'a> { closure_box {cl: x} } diff --git a/src/test/run-pass/regions/regions-debruijn-of-object.rs b/src/test/run-pass/regions/regions-debruijn-of-object.rs index 24c0cf53317e0..0b5510489fb45 100644 --- a/src/test/run-pass/regions/regions-debruijn-of-object.rs +++ b/src/test/run-pass/regions/regions-debruijn-of-object.rs @@ -13,9 +13,9 @@ trait AstConv<'tcx> { fn tcx<'a>(&'a self) -> &'a ctxt<'tcx>; } -fn foo(conv: &AstConv) { } +fn foo(conv: &dyn AstConv) { } -fn bar<'tcx>(conv: &AstConv<'tcx>) { +fn bar<'tcx>(conv: &dyn AstConv<'tcx>) { foo(conv) } diff --git a/src/test/run-pass/regions/regions-early-bound-trait-param.rs b/src/test/run-pass/regions/regions-early-bound-trait-param.rs index c71e47db22d41..cc2bde78d8594 100644 --- a/src/test/run-pass/regions/regions-early-bound-trait-param.rs +++ b/src/test/run-pass/regions/regions-early-bound-trait-param.rs @@ -15,14 +15,14 @@ fn poly_invoke<'c, T: Trait<'c>>(x: &'c T) -> (isize, isize) { (l,s) } -fn object_invoke1<'d>(x: &'d Trait<'d>) -> (isize, isize) { +fn object_invoke1<'d>(x: &'d dyn Trait<'d>) -> (isize, isize) { let l = x.long(); let s = x.short(); (l,s) } struct Struct1<'e> { - f: &'e (Trait<'e>+'e) + f: &'e (dyn Trait<'e>+'e) } fn field_invoke1<'f, 'g>(x: &'g Struct1<'f>) -> (isize,isize) { @@ -32,10 +32,10 @@ fn field_invoke1<'f, 'g>(x: &'g Struct1<'f>) -> (isize,isize) { } struct Struct2<'h, 'i:'h> { - f: &'h (Trait<'i>+'h) + f: &'h (dyn Trait<'i>+'h) } -fn object_invoke2<'j, 'k>(x: &'k Trait<'j>) -> isize { +fn object_invoke2<'j, 'k>(x: &'k dyn Trait<'j>) -> isize { x.short() } @@ -70,10 +70,10 @@ impl<'s> Trait<'s> for (isize,isize) { } } -impl<'t> MakerTrait for Box+'static> { - fn mk() -> Box+'static> { +impl<'t> MakerTrait for Box+'static> { + fn mk() -> Box+'static> { let tup: Box<(isize, isize)> = box (4,5); - tup as Box + tup as Box } } @@ -105,7 +105,7 @@ impl<'t> RefMakerTrait<'t> for List<'t> { pub fn main() { let t = (2,3); - let o = &t as &Trait; + let o = &t as &dyn Trait; let s1 = Struct1 { f: o }; let s2 = Struct2 { f: o }; assert_eq!(poly_invoke(&t), (2,3)); @@ -114,7 +114,7 @@ pub fn main() { assert_eq!(object_invoke2(&t), 3); assert_eq!(field_invoke2(&s2), 3); - let m : Box = make_val(); + let m : Box = make_val(); // assert_eq!(object_invoke1(&*m), (4,5)); // ~~~~~~~~~~~~~~~~~~~ // this call yields a compilation error; see compile-fail/dropck-object-cycle.rs diff --git a/src/test/run-pass/regions/regions-fn-subtyping-2.rs b/src/test/run-pass/regions/regions-fn-subtyping-2.rs index cbd88ebde0d1e..83949ddba3d1e 100644 --- a/src/test/run-pass/regions/regions-fn-subtyping-2.rs +++ b/src/test/run-pass/regions/regions-fn-subtyping-2.rs @@ -7,13 +7,13 @@ // that `x` is in. // pretty-expanded FIXME #23616 -fn has_same_region(f: Box FnMut(&'a isize, Box)>) { +fn has_same_region(f: Box FnMut(&'a isize, Box)>) { // `f` should be the type that `wants_same_region` wants, but // right now the compiler complains that it isn't. wants_same_region(f); } -fn wants_same_region(_f: Box FnMut(&'b isize, Box)>) { +fn wants_same_region(_f: Box FnMut(&'b isize, Box)>) { } pub fn main() { diff --git a/src/test/run-pass/regions/regions-fn-subtyping.rs b/src/test/run-pass/regions/regions-fn-subtyping.rs index a1da966659a21..9570359c69e31 100644 --- a/src/test/run-pass/regions/regions-fn-subtyping.rs +++ b/src/test/run-pass/regions/regions-fn-subtyping.rs @@ -8,21 +8,21 @@ #![allow(unused_variables)] // Should pass region checking. -fn ok(f: Box) { +fn ok(f: Box) { // Here, g is a function that can accept a usize pointer with // lifetime r, and f is a function that can accept a usize pointer // with any lifetime. The assignment g = f should be OK (i.e., // f's type should be a subtype of g's type), because f can be // used in any context that expects g's type. But this currently // fails. - let mut g: Box FnMut(&'r usize)> = Box::new(|x| { }); + let mut g: Box FnMut(&'r usize)> = Box::new(|x| { }); g = f; } // This version is the same as above, except that here, g's type is // inferred. -fn ok_inferred(f: Box) { - let mut g: Box FnMut(&'r usize)> = Box::new(|_| {}); +fn ok_inferred(f: Box) { + let mut g: Box FnMut(&'r usize)> = Box::new(|_| {}); g = f; } diff --git a/src/test/run-pass/regions/regions-infer-region-in-fn-but-not-type.rs b/src/test/run-pass/regions/regions-infer-region-in-fn-but-not-type.rs index dff36e6d183b9..6aa5d8217a466 100644 --- a/src/test/run-pass/regions/regions-infer-region-in-fn-but-not-type.rs +++ b/src/test/run-pass/regions/regions-infer-region-in-fn-but-not-type.rs @@ -8,7 +8,7 @@ // contains region pointers // pretty-expanded FIXME #23616 -struct foo(Box); +struct foo(Box); fn take_foo(x: T) {} diff --git a/src/test/run-pass/regions/regions-lifetime-nonfree-late-bound.rs b/src/test/run-pass/regions/regions-lifetime-nonfree-late-bound.rs index 189f617202968..c8106f32c65c2 100644 --- a/src/test/run-pass/regions/regions-lifetime-nonfree-late-bound.rs +++ b/src/test/run-pass/regions/regions-lifetime-nonfree-late-bound.rs @@ -19,15 +19,15 @@ pub fn main() { fn explicit() { - fn test(_x: Option>) where F: FnMut(Box FnMut(&'a isize)>) {} - test(Some(box |_f: Box FnMut(&'a isize)>| {})); + fn test(_x: Option>) where F: FnMut(Box FnMut(&'a isize)>) {} + test(Some(box |_f: Box FnMut(&'a isize)>| {})); } // The code below is shorthand for the code above (and more likely // to represent what one encounters in practice). fn implicit() { - fn test(_x: Option>) where F: FnMut(Box< FnMut(& isize)>) {} - test(Some(box |_f: Box< FnMut(& isize)>| {})); + fn test(_x: Option>) where F: FnMut(Box) {} + test(Some(box |_f: Box| {})); } explicit(); diff --git a/src/test/run-pass/regions/regions-relate-bound-regions-on-closures-to-inference-variables.rs b/src/test/run-pass/regions/regions-relate-bound-regions-on-closures-to-inference-variables.rs index f26ef85ef7234..aec05161c1afb 100644 --- a/src/test/run-pass/regions/regions-relate-bound-regions-on-closures-to-inference-variables.rs +++ b/src/test/run-pass/regions/regions-relate-bound-regions-on-closures-to-inference-variables.rs @@ -44,7 +44,7 @@ impl<'a,'tcx> Foo<'a,'tcx> { fn elaborate_bounds( &mut self, - mut mk_cand: Box FnMut(&mut Foo<'b, 'tcx>) -> isize>) + mut mk_cand: Box FnMut(&mut Foo<'b, 'tcx>) -> isize>) -> isize { mk_cand(self) diff --git a/src/test/run-pass/regions/regions-static-closure.rs b/src/test/run-pass/regions/regions-static-closure.rs index 6d00f7501ca9f..09cd56220323d 100644 --- a/src/test/run-pass/regions/regions-static-closure.rs +++ b/src/test/run-pass/regions/regions-static-closure.rs @@ -2,10 +2,10 @@ #![allow(non_camel_case_types)] struct closure_box<'a> { - cl: Box, + cl: Box, } -fn box_it<'a>(x: Box) -> closure_box<'a> { +fn box_it<'a>(x: Box) -> closure_box<'a> { closure_box {cl: x} } diff --git a/src/test/run-pass/regions/regions-trait-object-1.rs b/src/test/run-pass/regions/regions-trait-object-1.rs index 242142588eafe..679bf4dd8117c 100644 --- a/src/test/run-pass/regions/regions-trait-object-1.rs +++ b/src/test/run-pass/regions/regions-trait-object-1.rs @@ -21,10 +21,10 @@ impl<'d> M for P<'d> { fn n(&self) -> u8 { *self.g } } -fn extension<'e>(x: &'e E<'e>) -> Box { +fn extension<'e>(x: &'e E<'e>) -> Box { loop { let p = P { g: x.m() }; - return Box::new(p) as Box; + return Box::new(p) as Box; } } diff --git a/src/test/run-pass/string-box-error.rs b/src/test/run-pass/string-box-error.rs index debbe665a89f9..944157d0b2009 100644 --- a/src/test/run-pass/string-box-error.rs +++ b/src/test/run-pass/string-box-error.rs @@ -4,8 +4,8 @@ use std::error::Error; fn main() { - let _err1: Box = From::from("test".to_string()); - let _err2: Box = From::from("test".to_string()); - let _err3: Box = From::from("test"); - let _err4: Box = From::from("test"); + let _err1: Box = From::from("test".to_string()); + let _err2: Box = From::from("test".to_string()); + let _err3: Box = From::from("test"); + let _err4: Box = From::from("test"); } diff --git a/src/test/run-pass/structs-enums/class-cast-to-trait-cross-crate-2.rs b/src/test/run-pass/structs-enums/class-cast-to-trait-cross-crate-2.rs index cb4a67f609d95..bf1ba8a643fea 100644 --- a/src/test/run-pass/structs-enums/class-cast-to-trait-cross-crate-2.rs +++ b/src/test/run-pass/structs-enums/class-cast-to-trait-cross-crate-2.rs @@ -8,13 +8,13 @@ extern crate cci_class_cast; use std::string::ToString; use cci_class_cast::kitty::cat; -fn print_out(thing: Box, expected: String) { +fn print_out(thing: Box, expected: String) { let actual = (*thing).to_string(); println!("{}", actual); assert_eq!(actual.to_string(), expected); } pub fn main() { - let nyan: Box = box cat(0, 2, "nyan".to_string()) as Box; + let nyan: Box = box cat(0, 2, "nyan".to_string()) as Box; print_out(nyan, "nyan".to_string()); } diff --git a/src/test/run-pass/structs-enums/class-cast-to-trait-multiple-types.rs b/src/test/run-pass/structs-enums/class-cast-to-trait-multiple-types.rs index 5ce6538fcb361..55975cbdb5342 100644 --- a/src/test/run-pass/structs-enums/class-cast-to-trait-multiple-types.rs +++ b/src/test/run-pass/structs-enums/class-cast-to-trait-multiple-types.rs @@ -79,7 +79,7 @@ fn cat(in_x: usize, in_y: isize, in_name: String) -> cat { } -fn annoy_neighbors(critter: &mut noisy) { +fn annoy_neighbors(critter: &mut dyn noisy) { for _i in 0_usize..10 { critter.speak(); } } diff --git a/src/test/run-pass/structs-enums/class-cast-to-trait.rs b/src/test/run-pass/structs-enums/class-cast-to-trait.rs index 7fa60da6e5762..1019bb30015a9 100644 --- a/src/test/run-pass/structs-enums/class-cast-to-trait.rs +++ b/src/test/run-pass/structs-enums/class-cast-to-trait.rs @@ -55,6 +55,6 @@ fn cat(in_x : usize, in_y : isize, in_name: String) -> cat { pub fn main() { let mut nyan = cat(0, 2, "nyan".to_string()); - let mut nyan: &mut noisy = &mut nyan; + let mut nyan: &mut dyn noisy = &mut nyan; nyan.speak(); } diff --git a/src/test/run-pass/structs-enums/class-separate-impl.rs b/src/test/run-pass/structs-enums/class-separate-impl.rs index 2b10a46e8e25d..947690b51f422 100644 --- a/src/test/run-pass/structs-enums/class-separate-impl.rs +++ b/src/test/run-pass/structs-enums/class-separate-impl.rs @@ -53,13 +53,13 @@ impl fmt::Display for cat { } } -fn print_out(thing: Box, expected: String) { +fn print_out(thing: Box, expected: String) { let actual = (*thing).to_string(); println!("{}", actual); assert_eq!(actual.to_string(), expected); } pub fn main() { - let nyan: Box = box cat(0, 2, "nyan".to_string()) as Box; + let nyan: Box = box cat(0, 2, "nyan".to_string()) as Box; print_out(nyan, "nyan".to_string()); } diff --git a/src/test/run-pass/structs-enums/enum-null-pointer-opt.rs b/src/test/run-pass/structs-enums/enum-null-pointer-opt.rs index 5e3b5942a8209..87629665bc2bd 100644 --- a/src/test/run-pass/structs-enums/enum-null-pointer-opt.rs +++ b/src/test/run-pass/structs-enums/enum-null-pointer-opt.rs @@ -22,9 +22,9 @@ fn main() { assert_eq!(size_of::<&mut [isize]>(), size_of::>()); // Traits - Box / &Trait / &mut Trait - assert_eq!(size_of::>(), size_of::>>()); - assert_eq!(size_of::<&Trait>(), size_of::>()); - assert_eq!(size_of::<&mut Trait>(), size_of::>()); + assert_eq!(size_of::>(), size_of::>>()); + assert_eq!(size_of::<&dyn Trait>(), size_of::>()); + assert_eq!(size_of::<&mut dyn Trait>(), size_of::>()); // Pointers - Box assert_eq!(size_of::>(), size_of::>>()); diff --git a/src/test/run-pass/structs-enums/object-lifetime-default-from-ref-struct.rs b/src/test/run-pass/structs-enums/object-lifetime-default-from-ref-struct.rs index 0a48725cbe44a..e1a865fa50399 100644 --- a/src/test/run-pass/structs-enums/object-lifetime-default-from-ref-struct.rs +++ b/src/test/run-pass/structs-enums/object-lifetime-default-from-ref-struct.rs @@ -22,37 +22,37 @@ struct Ref2<'a,'b,T:'a+'b+?Sized> { } struct SomeStruct<'a> { - t: Ref<'a,Test>, - u: Ref<'a,Test+'a>, + t: Ref<'a, dyn Test>, + u: Ref<'a, dyn Test+'a>, } -fn a<'a>(t: Ref<'a,Test>, mut ss: SomeStruct<'a>) { +fn a<'a>(t: Ref<'a, dyn Test>, mut ss: SomeStruct<'a>) { ss.t = t; } -fn b<'a>(t: Ref<'a,Test>, mut ss: SomeStruct<'a>) { +fn b<'a>(t: Ref<'a, dyn Test>, mut ss: SomeStruct<'a>) { ss.u = t; } -fn c<'a>(t: Ref<'a,Test+'a>, mut ss: SomeStruct<'a>) { +fn c<'a>(t: Ref<'a, dyn Test+'a>, mut ss: SomeStruct<'a>) { ss.t = t; } -fn d<'a>(t: Ref<'a,Test+'a>, mut ss: SomeStruct<'a>) { +fn d<'a>(t: Ref<'a, dyn Test+'a>, mut ss: SomeStruct<'a>) { ss.u = t; } -fn e<'a>(_: Ref<'a, Display+'static>) {} -fn g<'a, 'b>(_: Ref2<'a, 'b, Display+'static>) {} +fn e<'a>(_: Ref<'a, dyn Display+'static>) {} +fn g<'a, 'b>(_: Ref2<'a, 'b, dyn Display+'static>) {} fn main() { // Inside a function body, we can just infer all // lifetimes, to allow Ref<'tmp, Display+'static> // and Ref2<'tmp, 'tmp, Display+'static>. - let x = &0 as &(Display+'static); - let r: Ref = Ref { r: x }; - let r2: Ref2 = Ref2 { a: x, b: x }; + let x = &0 as &(dyn Display+'static); + let r: Ref = Ref { r: x }; + let r2: Ref2 = Ref2 { a: x, b: x }; e(r); g(r2); } diff --git a/src/test/run-pass/structs-enums/object-lifetime-default-from-rptr-struct.rs b/src/test/run-pass/structs-enums/object-lifetime-default-from-rptr-struct.rs index 48ee5a2ed5450..1fc52ead48e0e 100644 --- a/src/test/run-pass/structs-enums/object-lifetime-default-from-rptr-struct.rs +++ b/src/test/run-pass/structs-enums/object-lifetime-default-from-rptr-struct.rs @@ -11,25 +11,25 @@ trait Test { } struct SomeStruct<'a> { - t: &'a MyBox, - u: &'a MyBox, + t: &'a MyBox, + u: &'a MyBox, } struct MyBox { b: Box } -fn a<'a>(t: &'a MyBox, mut ss: SomeStruct<'a>) { +fn a<'a>(t: &'a MyBox, mut ss: SomeStruct<'a>) { ss.t = t; } -fn b<'a>(t: &'a MyBox, mut ss: SomeStruct<'a>) { +fn b<'a>(t: &'a MyBox, mut ss: SomeStruct<'a>) { ss.u = t; } // see also compile-fail/object-lifetime-default-from-rptr-box-error.rs -fn d<'a>(t: &'a MyBox, mut ss: SomeStruct<'a>) { +fn d<'a>(t: &'a MyBox, mut ss: SomeStruct<'a>) { ss.u = t; } diff --git a/src/test/run-pass/traits/auto-traits.rs b/src/test/run-pass/traits/auto-traits.rs index 7702725e640cd..c495b97b25bfe 100644 --- a/src/test/run-pass/traits/auto-traits.rs +++ b/src/test/run-pass/traits/auto-traits.rs @@ -27,5 +27,5 @@ fn main() { take_auto_unsafe(AutoBool(true)); /// Auto traits are allowed in trait object bounds. - let _: &(Send + Auto) = &0; + let _: &(dyn Send + Auto) = &0; } diff --git a/src/test/run-pass/traits/impl-inherent-prefer-over-trait.rs b/src/test/run-pass/traits/impl-inherent-prefer-over-trait.rs index 140dcaf6a27b6..82760788897a5 100644 --- a/src/test/run-pass/traits/impl-inherent-prefer-over-trait.rs +++ b/src/test/run-pass/traits/impl-inherent-prefer-over-trait.rs @@ -11,7 +11,7 @@ impl Foo { fn bar(&self) {} } -impl Trait { +impl dyn Trait { fn baz(_: &Foo) {} } @@ -26,5 +26,5 @@ fn main() { // Should work even if Trait::baz doesn't exist. // N.B: `::bar` would be ambiguous. - ::baz(&Foo); + ::baz(&Foo); } diff --git a/src/test/run-pass/traits/infer-from-object-trait-issue-26952.rs b/src/test/run-pass/traits/infer-from-object-trait-issue-26952.rs index 1deb17e00da61..ed258dbb24c3f 100644 --- a/src/test/run-pass/traits/infer-from-object-trait-issue-26952.rs +++ b/src/test/run-pass/traits/infer-from-object-trait-issue-26952.rs @@ -14,7 +14,7 @@ trait Trait { fn foo(&self); } struct Type { a: PhantomData } -fn as_trait(t: &Type) -> &Trait { loop { } } +fn as_trait(t: &Type) -> &dyn Trait { loop { } } fn want+?Sized>(t: &T) { } diff --git a/src/test/run-pass/traits/kindck-owned-trait-contains-1.rs b/src/test/run-pass/traits/kindck-owned-trait-contains-1.rs index f7a58c6f92671..23b91f924b553 100644 --- a/src/test/run-pass/traits/kindck-owned-trait-contains-1.rs +++ b/src/test/run-pass/traits/kindck-owned-trait-contains-1.rs @@ -12,8 +12,8 @@ impl repeat for Box { } } -fn repeater(v: Box) -> Box+'static> { - box v as Box+'static> // No +fn repeater(v: Box) -> Box+'static> { + box v as Box+'static> // No } pub fn main() { diff --git a/src/test/run-pass/traits/object-one-type-two-traits.rs b/src/test/run-pass/traits/object-one-type-two-traits.rs index 12e4a34a233e0..b92a2ab7b4bc2 100644 --- a/src/test/run-pass/traits/object-one-type-two-traits.rs +++ b/src/test/run-pass/traits/object-one-type-two-traits.rs @@ -10,24 +10,24 @@ use std::any::Any; trait Wrap { fn get(&self) -> isize; - fn wrap(self: Box) -> Box; + fn wrap(self: Box) -> Box; } impl Wrap for isize { fn get(&self) -> isize { *self } - fn wrap(self: Box) -> Box { - self as Box + fn wrap(self: Box) -> Box { + self as Box } } -fn is(x: &Any) -> bool { +fn is(x: &dyn Any) -> bool { x.is::() } fn main() { - let x = box 22isize as Box; + let x = box 22isize as Box; println!("x={}", x.get()); let y = x.wrap(); } diff --git a/src/test/run-pass/traits/parameterized-trait-with-bounds.rs b/src/test/run-pass/traits/parameterized-trait-with-bounds.rs index b1339b207ebae..832d4f6c89f09 100644 --- a/src/test/run-pass/traits/parameterized-trait-with-bounds.rs +++ b/src/test/run-pass/traits/parameterized-trait-with-bounds.rs @@ -12,10 +12,10 @@ mod foo { pub trait D<'a, T> { fn get(self) -> &'a T; } } -fn foo1(_: &(A + Send)) {} -fn foo2(_: Box + Send + Sync>) {} -fn foo3(_: Box + 'static>) {} -fn foo4<'a, T>(_: Box + 'static + Send>) {} -fn foo5<'a, T>(_: Box + 'static + Send>) {} +fn foo1(_: &(dyn A + Send)) {} +fn foo2(_: Box + Send + Sync>) {} +fn foo3(_: Box + 'static>) {} +fn foo4<'a, T>(_: Box + 'static + Send>) {} +fn foo5<'a, T>(_: Box + 'static + Send>) {} pub fn main() {} diff --git a/src/test/run-pass/traits/trait-bounds-basic.rs b/src/test/run-pass/traits/trait-bounds-basic.rs index af6392e565859..8c8a7eb7d9da1 100644 --- a/src/test/run-pass/traits/trait-bounds-basic.rs +++ b/src/test/run-pass/traits/trait-bounds-basic.rs @@ -7,18 +7,18 @@ trait Foo { } -fn b(_x: Box) { +fn b(_x: Box) { } -fn c(x: Box) { +fn c(x: Box) { e(x); } -fn d(x: Box) { +fn d(x: Box) { e(x); } -fn e(x: Box) { +fn e(x: Box) { e(x); } diff --git a/src/test/run-pass/traits/trait-bounds-in-arc.rs b/src/test/run-pass/traits/trait-bounds-in-arc.rs index 82bdcdcf7c50b..a45d834297eed 100644 --- a/src/test/run-pass/traits/trait-bounds-in-arc.rs +++ b/src/test/run-pass/traits/trait-bounds-in-arc.rs @@ -12,7 +12,7 @@ use std::sync::mpsc::channel; use std::thread; trait Pet { - fn name(&self, blk: Box); + fn name(&self, blk: Box); fn num_legs(&self) -> usize; fn of_good_pedigree(&self) -> bool; } @@ -34,19 +34,19 @@ struct Goldfyshe { } impl Pet for Catte { - fn name(&self, mut blk: Box) { blk(&self.name) } + fn name(&self, mut blk: Box) { blk(&self.name) } fn num_legs(&self) -> usize { 4 } fn of_good_pedigree(&self) -> bool { self.num_whiskers >= 4 } } impl Pet for Dogge { - fn name(&self, mut blk: Box) { blk(&self.name) } + fn name(&self, mut blk: Box) { blk(&self.name) } fn num_legs(&self) -> usize { 4 } fn of_good_pedigree(&self) -> bool { self.bark_decibels < 70 || self.tricks_known > 20 } } impl Pet for Goldfyshe { - fn name(&self, mut blk: Box) { blk(&self.name) } + fn name(&self, mut blk: Box) { blk(&self.name) } fn num_legs(&self) -> usize { 0 } fn of_good_pedigree(&self) -> bool { self.swim_speed >= 500 } } @@ -67,10 +67,10 @@ pub fn main() { swim_speed: 998, name: "alec_guinness".to_string(), }; - let arc = Arc::new(vec![box catte as Box, - box dogge1 as Box, - box fishe as Box, - box dogge2 as Box]); + let arc = Arc::new(vec![box catte as Box, + box dogge1 as Box, + box fishe as Box, + box dogge2 as Box]); let (tx1, rx1) = channel(); let arc1 = arc.clone(); let t1 = thread::spawn(move|| { check_legs(arc1); tx1.send(()); }); @@ -88,21 +88,21 @@ pub fn main() { t3.join(); } -fn check_legs(arc: Arc>>) { +fn check_legs(arc: Arc>>) { let mut legs = 0; for pet in arc.iter() { legs += pet.num_legs(); } assert!(legs == 12); } -fn check_names(arc: Arc>>) { +fn check_names(arc: Arc>>) { for pet in arc.iter() { pet.name(Box::new(|name| { assert!(name.as_bytes()[0] == 'a' as u8 && name.as_bytes()[1] == 'l' as u8); })) } } -fn check_pedigree(arc: Arc>>) { +fn check_pedigree(arc: Arc>>) { for pet in arc.iter() { assert!(pet.of_good_pedigree()); } diff --git a/src/test/run-pass/traits/trait-bounds-on-structs-and-enums.rs b/src/test/run-pass/traits/trait-bounds-on-structs-and-enums.rs index 18b25b852d173..4dc4fecc91fcf 100644 --- a/src/test/run-pass/traits/trait-bounds-on-structs-and-enums.rs +++ b/src/test/run-pass/traits/trait-bounds-on-structs-and-enums.rs @@ -7,11 +7,11 @@ trait U {} trait T { fn get(self) -> X; } trait S2 { - fn m(x: Box+'static>) {} + fn m(x: Box+'static>) {} } struct St { - f: Box+'static>, + f: Box+'static>, } impl St { diff --git a/src/test/run-pass/traits/trait-coercion-generic.rs b/src/test/run-pass/traits/trait-coercion-generic.rs index 5d1b442afcc70..bf4dda4951910 100644 --- a/src/test/run-pass/traits/trait-coercion-generic.rs +++ b/src/test/run-pass/traits/trait-coercion-generic.rs @@ -18,8 +18,8 @@ impl Trait<&'static str> for Struct { pub fn main() { let a = Struct { x: 1, y: 2 }; - let b: Box> = Box::new(a); + let b: Box> = Box::new(a); b.f("Mary"); - let c: &Trait<&'static str> = &a; + let c: &dyn Trait<&'static str> = &a; c.f("Joe"); } diff --git a/src/test/run-pass/traits/trait-coercion.rs b/src/test/run-pass/traits/trait-coercion.rs index 1a40b81c89fe9..cba33af1f1aca 100644 --- a/src/test/run-pass/traits/trait-coercion.rs +++ b/src/test/run-pass/traits/trait-coercion.rs @@ -22,13 +22,13 @@ impl Trait for Struct { } } -fn foo(mut a: Box) {} +fn foo(mut a: Box) {} pub fn main() { let a = Struct { x: 1, y: 2 }; - let b: Box = Box::new(a); + let b: Box = Box::new(a); b.f(); - let c: &Trait = &a; + let c: &dyn Trait = &a; c.f(); let out = io::stdout(); diff --git a/src/test/run-pass/traits/trait-impl-2.rs b/src/test/run-pass/traits/trait-impl-2.rs index b28d74a7b35b1..804ffec12c2bf 100644 --- a/src/test/run-pass/traits/trait-impl-2.rs +++ b/src/test/run-pass/traits/trait-impl-2.rs @@ -11,7 +11,7 @@ pub mod Foo { } mod Bar { - impl<'a> ::Foo::Trait+'a { + impl<'a> dyn (::Foo::Trait) + 'a { fn bar(&self) { self.foo() } } } diff --git a/src/test/run-pass/traits/trait-impl.rs b/src/test/run-pass/traits/trait-impl.rs index 6b22ac08bb8a6..14796ce19c88e 100644 --- a/src/test/run-pass/traits/trait-impl.rs +++ b/src/test/run-pass/traits/trait-impl.rs @@ -12,7 +12,7 @@ trait T { fn t(&self) {} } -impl<'a> T+'a { +impl<'a> dyn T+'a { fn foo(&self) { unsafe { COUNT *= 2; } } @@ -27,7 +27,7 @@ struct Foo; impl<'a> Bar<'a> for Foo {} fn main() { - let x: &T = &42; + let x: &dyn T = &42; x.foo(); T::foo(x); @@ -36,6 +36,6 @@ fn main() { unsafe { assert_eq!(COUNT, 12); } // Cross-crait case - let x: &Bar = &Foo; + let x: &dyn Bar = &Foo; x.bar(); } diff --git a/src/test/run-pass/traits/trait-inheritance-cast-without-call-to-supertrait.rs b/src/test/run-pass/traits/trait-inheritance-cast-without-call-to-supertrait.rs index c0b5db63bd452..25159c1adb6f6 100644 --- a/src/test/run-pass/traits/trait-inheritance-cast-without-call-to-supertrait.rs +++ b/src/test/run-pass/traits/trait-inheritance-cast-without-call-to-supertrait.rs @@ -26,8 +26,8 @@ impl Bar for A { pub fn main() { let a = &A { x: 3 }; - let afoo = a as &Foo; - let abar = a as &Bar; + let afoo = a as &dyn Foo; + let abar = a as &dyn Bar; assert_eq!(afoo.f(), 10); assert_eq!(abar.g(), 20); } diff --git a/src/test/run-pass/traits/trait-inheritance-cast.rs b/src/test/run-pass/traits/trait-inheritance-cast.rs index 38e5c79e9e033..9070b9d1f5606 100644 --- a/src/test/run-pass/traits/trait-inheritance-cast.rs +++ b/src/test/run-pass/traits/trait-inheritance-cast.rs @@ -25,8 +25,8 @@ impl Bar for A { pub fn main() { let a = &A { x: 3 }; - let afoo = a as &Foo; - let abar = a as &Bar; + let afoo = a as &dyn Foo; + let abar = a as &dyn Bar; assert_eq!(afoo.f(), 10); assert_eq!(abar.g(), 20); assert_eq!(abar.f(), 10); diff --git a/src/test/run-pass/traits/trait-object-exclusion.rs b/src/test/run-pass/traits/trait-object-exclusion.rs index 248804d144a25..0b8b0e2f5ef4d 100644 --- a/src/test/run-pass/traits/trait-object-exclusion.rs +++ b/src/test/run-pass/traits/trait-object-exclusion.rs @@ -4,7 +4,7 @@ trait Future: 'static { // Future::forget in vtables, otherwise there's an infinite type // recursion through as Future>::forget. fn forget(self) where Self: Sized { - Box::new(Map(self)) as Box; + Box::new(Map(self)) as Box; } } diff --git a/src/test/run-pass/traits/trait-object-generics.rs b/src/test/run-pass/traits/trait-object-generics.rs index 168bffa0e4814..c18754302b75b 100644 --- a/src/test/run-pass/traits/trait-object-generics.rs +++ b/src/test/run-pass/traits/trait-object-generics.rs @@ -16,7 +16,7 @@ pub struct Impl { * task failed at 'index out of bounds: the len is 1 but the index is 1', * src/librustc/middle/subst.rs:58 */ - t: Box+'static> + t: Box+'static> } impl Impl { @@ -38,6 +38,6 @@ impl Trait for () { } pub fn main() { - let a = box () as Box>; + let a = box () as Box>; assert_eq!(a.method(Type::Constant((1, 2))), 0); } diff --git a/src/test/run-pass/traits/trait-object-lifetime-first.rs b/src/test/run-pass/traits/trait-object-lifetime-first.rs index e95a652057d5c..33757cb7c0ab1 100644 --- a/src/test/run-pass/traits/trait-object-lifetime-first.rs +++ b/src/test/run-pass/traits/trait-object-lifetime-first.rs @@ -4,8 +4,8 @@ use std::fmt::Display; static BYTE: u8 = 33; fn main() { - let x: &('static + Display) = &BYTE; - let y: Box<'static + Display> = Box::new(BYTE); + let x: &(dyn 'static + Display) = &BYTE; + let y: Box = Box::new(BYTE); let xstr = format!("{}", x); let ystr = format!("{}", y); assert_eq!(xstr, "33"); diff --git a/src/test/run-pass/traits/trait-object-with-lifetime-bound.rs b/src/test/run-pass/traits/trait-object-with-lifetime-bound.rs index 9060380db17e2..05aab5e3b085c 100644 --- a/src/test/run-pass/traits/trait-object-with-lifetime-bound.rs +++ b/src/test/run-pass/traits/trait-object-with-lifetime-bound.rs @@ -20,10 +20,10 @@ impl<'d> M for P<'d> { fn n(&self) -> u8 { *self.g } } -fn extension<'e>(x: &'e E<'e>) -> Box { +fn extension<'e>(x: &'e E<'e>) -> Box { loop { let p = P { g: x.m() }; - return Box::new(p) as Box; + return Box::new(p) as Box; } } diff --git a/src/test/run-pass/traits/trait-region-pointer-simple.rs b/src/test/run-pass/traits/trait-region-pointer-simple.rs index 6584182d38a4b..0456ca931156e 100644 --- a/src/test/run-pass/traits/trait-region-pointer-simple.rs +++ b/src/test/run-pass/traits/trait-region-pointer-simple.rs @@ -16,6 +16,6 @@ impl Foo for A { pub fn main() { let a = A { x: 3 }; - let b = (&a) as &Foo; + let b = (&a) as &dyn Foo; assert_eq!(b.f(), 3); } diff --git a/src/test/run-pass/traits/traits-impl-object-overlap-issue-23853.rs b/src/test/run-pass/traits/traits-impl-object-overlap-issue-23853.rs index c9745e06d8fb4..e490967b69047 100644 --- a/src/test/run-pass/traits/traits-impl-object-overlap-issue-23853.rs +++ b/src/test/run-pass/traits/traits-impl-object-overlap-issue-23853.rs @@ -14,5 +14,5 @@ impl Foo for T { } fn want_foo() { } fn main() { - want_foo::(); + want_foo::(); } diff --git a/src/test/run-pass/traits/traits-issue-26339.rs b/src/test/run-pass/traits/traits-issue-26339.rs index 0f831be248500..bedd87cc4cc79 100644 --- a/src/test/run-pass/traits/traits-issue-26339.rs +++ b/src/test/run-pass/traits/traits-issue-26339.rs @@ -25,7 +25,7 @@ impl PartialEq for Aimpl { impl A for Aimpl { } fn main() { - let a = &Aimpl as &A; + let a = &Aimpl as &dyn A; assert!(*a == Foo); } diff --git a/src/test/run-pass/traits/traits-repeated-supertrait.rs b/src/test/run-pass/traits/traits-repeated-supertrait.rs index c8318bdf15476..391d19c438558 100644 --- a/src/test/run-pass/traits/traits-repeated-supertrait.rs +++ b/src/test/run-pass/traits/traits-repeated-supertrait.rs @@ -22,7 +22,7 @@ impl CompareTo for i64 { impl CompareToInts for i64 { } -fn with_obj(c: &CompareToInts) -> bool { +fn with_obj(c: &dyn CompareToInts) -> bool { c.same_as(22_i64) && c.same_as(22_u64) } diff --git a/src/test/run-pass/traits/ufcs-trait-object.rs b/src/test/run-pass/traits/ufcs-trait-object.rs index abe164a5720bd..700488c22d678 100644 --- a/src/test/run-pass/traits/ufcs-trait-object.rs +++ b/src/test/run-pass/traits/ufcs-trait-object.rs @@ -12,6 +12,6 @@ impl Foo for i32 { } fn main() { - let a: &Foo = &22; + let a: &dyn Foo = &22; assert_eq!(Foo::test(a), 22); } diff --git a/src/test/run-pass/trivial_casts.rs b/src/test/run-pass/trivial_casts.rs index bc56d0158d4df..f06b0708290bc 100644 --- a/src/test/run-pass/trivial_casts.rs +++ b/src/test/run-pass/trivial_casts.rs @@ -36,21 +36,21 @@ pub fn main() { // unsize trait let x: &Bar = &Bar; - let _ = x as &Foo; - let _ = x as *const Foo; + let _ = x as &dyn Foo; + let _ = x as *const dyn Foo; let x: &mut Bar = &mut Bar; - let _ = x as &mut Foo; - let _ = x as *mut Foo; + let _ = x as &mut dyn Foo; + let _ = x as *mut dyn Foo; let x: Box = Box::new(Bar); - let _ = x as Box; + let _ = x as Box; // functions fn baz(_x: i32) {} - let _ = &baz as &Fn(i32); + let _ = &baz as &dyn Fn(i32); let x = |_x: i32| {}; - let _ = &x as &Fn(i32); + let _ = &x as &dyn Fn(i32); } // subtyping diff --git a/src/test/run-pass/type-id-higher-rank-2.rs b/src/test/run-pass/type-id-higher-rank-2.rs index d9280cf97f920..469bc8ed7e153 100644 --- a/src/test/run-pass/type-id-higher-rank-2.rs +++ b/src/test/run-pass/type-id-higher-rank-2.rs @@ -7,7 +7,7 @@ struct Foo<'a>(&'a str); fn good(s: &String) -> Foo { Foo(s) } fn bad1(s: String) -> Option<&'static str> { - let a: Box = Box::new(good as fn(&String) -> Foo); + let a: Box = Box::new(good as fn(&String) -> Foo); a.downcast_ref:: Foo<'static>>().map(|f| f(&s).0) } @@ -20,8 +20,8 @@ impl<'a> AsStr<'a, 'a> for String { } fn bad2(s: String) -> Option<&'static str> { - let a: Box = Box::new(Box::new(s) as Box AsStr<'a, 'a>>); - a.downcast_ref:: AsStr<'a, 'static>>>().map(|x| x.get()) + let a: Box = Box::new(Box::new(s) as Box AsStr<'a, 'a>>); + a.downcast_ref:: AsStr<'a, 'static>>>().map(|x| x.get()) } fn main() { diff --git a/src/test/run-pass/type-id-higher-rank.rs b/src/test/run-pass/type-id-higher-rank.rs index 55d70e31b1641..b98dff0d72b8d 100644 --- a/src/test/run-pass/type-id-higher-rank.rs +++ b/src/test/run-pass/type-id-higher-rank.rs @@ -26,9 +26,9 @@ fn main() { assert!(e != f); // Make sure lifetime parameters of items are not ignored. - let g = TypeId::of:: fn(&'a Trait<'a>) -> Struct<'a>>(); - let h = TypeId::of:: fn(&'a Trait<'a>) -> Struct<'static>>(); - let i = TypeId::of:: fn(&'a Trait<'b>) -> Struct<'b>>(); + let g = TypeId::of:: fn(&'a dyn Trait<'a>) -> Struct<'a>>(); + let h = TypeId::of:: fn(&'a dyn Trait<'a>) -> Struct<'static>>(); + let i = TypeId::of:: fn(&'a dyn Trait<'b>) -> Struct<'b>>(); assert!(g != h); assert!(g != i); assert!(h != i); @@ -40,10 +40,10 @@ fn main() { } // Boxed unboxed closures { - let a = TypeId::of::>(); - let b = TypeId::of:: Fn(&'static isize, &'a isize)>>(); - let c = TypeId::of:: Fn(&'a isize, &'b isize)>>(); - let d = TypeId::of:: Fn(&'b isize, &'a isize)>>(); + let a = TypeId::of::>(); + let b = TypeId::of:: Fn(&'static isize, &'a isize)>>(); + let c = TypeId::of:: Fn(&'a isize, &'b isize)>>(); + let d = TypeId::of:: Fn(&'b isize, &'a isize)>>(); assert!(a != b); assert!(a != c); assert!(a != d); @@ -52,8 +52,8 @@ fn main() { assert_eq!(c, d); // Make sure De Bruijn indices are handled correctly - let e = TypeId::of:: Fn(Box &'a isize>)>>(); - let f = TypeId::of:: Fn(&'a isize) -> &'a isize>)>>(); + let e = TypeId::of:: Fn(Box &'a isize>)>>(); + let f = TypeId::of:: Fn(&'a isize) -> &'a isize>)>>(); assert!(e != f); } // Raw unboxed closures diff --git a/src/test/run-pass/type-infer-generalize-ty-var.rs b/src/test/run-pass/type-infer-generalize-ty-var.rs index 244a72c80fa23..6298156452e49 100644 --- a/src/test/run-pass/type-infer-generalize-ty-var.rs +++ b/src/test/run-pass/type-infer-generalize-ty-var.rs @@ -23,8 +23,8 @@ trait Get { fn get(&self) -> &T; } -impl Get for Wrap { - fn get(&self) -> &(MyShow + 'static) { +impl Get for Wrap { + fn get(&self) -> &(dyn MyShow + 'static) { static x: usize = 42; &x } @@ -38,9 +38,9 @@ impl Get for Wrap { } trait MyShow { fn dummy(&self) { } } -impl<'a> MyShow for &'a (MyShow + 'a) { } +impl<'a> MyShow for &'a (dyn MyShow + 'a) { } impl MyShow for usize { } -fn constrain<'a>(rc: RefCell<&'a (MyShow + 'a)>) { } +fn constrain<'a>(rc: RefCell<&'a (dyn MyShow + 'a)>) { } fn main() { let mut collection: Wrap<_> = WrapNone; diff --git a/src/test/run-pass/unboxed-closures/unboxed-closures-blanket-fn-mut.rs b/src/test/run-pass/unboxed-closures/unboxed-closures-blanket-fn-mut.rs index 08a9796ea29c5..a1001673506f0 100644 --- a/src/test/run-pass/unboxed-closures/unboxed-closures-blanket-fn-mut.rs +++ b/src/test/run-pass/unboxed-closures/unboxed-closures-blanket-fn-mut.rs @@ -8,7 +8,7 @@ fn a i32>(mut f: F) -> i32 { f() } -fn b(f: &mut FnMut() -> i32) -> i32 { +fn b(f: &mut dyn FnMut() -> i32) -> i32 { a(f) } diff --git a/src/test/run-pass/unboxed-closures/unboxed-closures-blanket-fn.rs b/src/test/run-pass/unboxed-closures/unboxed-closures-blanket-fn.rs index 76ad40b8f3d63..ca1d31ca54470 100644 --- a/src/test/run-pass/unboxed-closures/unboxed-closures-blanket-fn.rs +++ b/src/test/run-pass/unboxed-closures/unboxed-closures-blanket-fn.rs @@ -8,7 +8,7 @@ fn a i32>(f: F) -> i32 { f() } -fn b(f: &Fn() -> i32) -> i32 { +fn b(f: &dyn Fn() -> i32) -> i32 { a(f) } diff --git a/src/test/run-pass/unboxed-closures/unboxed-closures-boxed.rs b/src/test/run-pass/unboxed-closures/unboxed-closures-boxed.rs index 6d55fe997b092..b2596e49aa78e 100644 --- a/src/test/run-pass/unboxed-closures/unboxed-closures-boxed.rs +++ b/src/test/run-pass/unboxed-closures/unboxed-closures-boxed.rs @@ -3,9 +3,9 @@ use std::ops::FnMut; - fn make_adder(x: i32) -> Boxi32+'static> { + fn make_adder(x: i32) -> Boxi32+'static> { (box move |y: i32| -> i32 { x + y }) as - Boxi32+'static> + Boxi32+'static> } pub fn main() { diff --git a/src/test/run-pass/unboxed-closures/unboxed-closures-call-sugar-object-autoderef.rs b/src/test/run-pass/unboxed-closures/unboxed-closures-call-sugar-object-autoderef.rs index 22fc148c3522a..d47ceea0f4f4d 100644 --- a/src/test/run-pass/unboxed-closures/unboxed-closures-call-sugar-object-autoderef.rs +++ b/src/test/run-pass/unboxed-closures/unboxed-closures-call-sugar-object-autoderef.rs @@ -3,7 +3,7 @@ use std::ops::FnMut; -fn make_adder(x: isize) -> Boxisize + 'static> { +fn make_adder(x: isize) -> Boxisize + 'static> { Box::new(move |y| { x + y }) } diff --git a/src/test/run-pass/unboxed-closures/unboxed-closures-call-sugar-object.rs b/src/test/run-pass/unboxed-closures/unboxed-closures-call-sugar-object.rs index 91311fba2e80f..f77733d106d4f 100644 --- a/src/test/run-pass/unboxed-closures/unboxed-closures-call-sugar-object.rs +++ b/src/test/run-pass/unboxed-closures/unboxed-closures-call-sugar-object.rs @@ -1,7 +1,7 @@ // run-pass use std::ops::FnMut; -fn make_adder(x: isize) -> Boxisize + 'static> { +fn make_adder(x: isize) -> Boxisize + 'static> { Box::new(move |y| { x + y }) } diff --git a/src/test/run-pass/unboxed-closures/unboxed-closures-extern-fn-hr.rs b/src/test/run-pass/unboxed-closures/unboxed-closures-extern-fn-hr.rs index 0fd23a2d79646..3ee1aeb109b18 100644 --- a/src/test/run-pass/unboxed-closures/unboxed-closures-extern-fn-hr.rs +++ b/src/test/run-pass/unboxed-closures/unboxed-closures-extern-fn-hr.rs @@ -7,7 +7,7 @@ fn call_itisize>(f: &F, x: isize) -> isize { (*f)(&x) } -fn call_it_boxed(f: &Fn(&isize) -> isize, x: isize) -> isize { +fn call_it_boxed(f: &dyn Fn(&isize) -> isize, x: isize) -> isize { f(&x) } diff --git a/src/test/run-pass/unboxed-closures/unboxed-closures-infer-arg-types-from-expected-object-type.rs b/src/test/run-pass/unboxed-closures/unboxed-closures-infer-arg-types-from-expected-object-type.rs index 4f23f85b649e4..d2eaee304104a 100644 --- a/src/test/run-pass/unboxed-closures/unboxed-closures-infer-arg-types-from-expected-object-type.rs +++ b/src/test/run-pass/unboxed-closures/unboxed-closures-infer-arg-types-from-expected-object-type.rs @@ -12,7 +12,7 @@ impl ToPrimitive for isize {} impl ToPrimitive for i32 {} impl ToPrimitive for usize {} -fn doit(val: T, f: &Fn(T)) { f(val) } +fn doit(val: T, f: &dyn Fn(T)) { f(val) } pub fn main() { doit(0, &|x /*: isize*/ | { x.to_int(); }); diff --git a/src/test/run-pass/unboxed-closures/unboxed-closures-infer-recursive-fn.rs b/src/test/run-pass/unboxed-closures/unboxed-closures-infer-recursive-fn.rs index 72d658f393bd9..86834f49407fc 100644 --- a/src/test/run-pass/unboxed-closures/unboxed-closures-infer-recursive-fn.rs +++ b/src/test/run-pass/unboxed-closures/unboxed-closures-infer-recursive-fn.rs @@ -20,23 +20,23 @@ impl YCombinator { } } -impl R, A) -> R> Fn<(A,)> for YCombinator { +impl R, A) -> R> Fn<(A,)> for YCombinator { extern "rust-call" fn call(&self, (arg,): (A,)) -> R { (self.func)(self, arg) } } -impl R, A) -> R> FnMut<(A,)> for YCombinator { +impl R, A) -> R> FnMut<(A,)> for YCombinator { extern "rust-call" fn call_mut(&mut self, args: (A,)) -> R { self.call(args) } } -impl R, A) -> R> FnOnce<(A,)> for YCombinator { +impl R, A) -> R> FnOnce<(A,)> for YCombinator { type Output = R; extern "rust-call" fn call_once(self, args: (A,)) -> R { self.call(args) } } fn main() { - let factorial = |recur: &Fn(u32) -> u32, arg: u32| -> u32 { + let factorial = |recur: &dyn Fn(u32) -> u32, arg: u32| -> u32 { if arg == 0 {1} else {arg * recur(arg-1)} }; let factorial: YCombinator<_,u32,u32> = YCombinator::new(factorial); diff --git a/src/test/run-pass/unboxed-closures/unboxed-closures-manual-impl.rs b/src/test/run-pass/unboxed-closures/unboxed-closures-manual-impl.rs index 5c7aafdc57361..df60b42ab126a 100644 --- a/src/test/run-pass/unboxed-closures/unboxed-closures-manual-impl.rs +++ b/src/test/run-pass/unboxed-closures/unboxed-closures-manual-impl.rs @@ -19,7 +19,7 @@ fn call_iti32>(mut f: F, x: i32) -> i32 { f(x) + 3 } -fn call_box(f: &mut FnMut(i32) -> i32, x: i32) -> i32 { +fn call_box(f: &mut dyn FnMut(i32) -> i32, x: i32) -> i32 { f(x) + 3 } diff --git a/src/test/run-pass/unboxed-closures/unboxed-closures-monomorphization.rs b/src/test/run-pass/unboxed-closures/unboxed-closures-monomorphization.rs index 092224b793457..2df360d4a30a4 100644 --- a/src/test/run-pass/unboxed-closures/unboxed-closures-monomorphization.rs +++ b/src/test/run-pass/unboxed-closures/unboxed-closures-monomorphization.rs @@ -3,7 +3,7 @@ // monomorphize correctly (issue #16791) fn main(){ - fn bar<'a, T:Clone+'a> (t: T) -> BoxT + 'a> { + fn bar<'a, T:Clone+'a> (t: T) -> BoxT + 'a> { Box::new(move || t.clone()) } diff --git a/src/test/run-pass/unboxed-closures/unboxed-closures-prelude.rs b/src/test/run-pass/unboxed-closures/unboxed-closures-prelude.rs index 7e53c4d9eb613..89a273b7a43ff 100644 --- a/src/test/run-pass/unboxed-closures/unboxed-closures-prelude.rs +++ b/src/test/run-pass/unboxed-closures/unboxed-closures-prelude.rs @@ -4,10 +4,10 @@ // pretty-expanded FIXME #23616 fn main() { - let task: Box isize> = Box::new(|x| x); + let task: Box isize> = Box::new(|x| x); task(0); - let mut task: Box isize> = Box::new(|x| x); + let mut task: Box isize> = Box::new(|x| x); task(0); call(|x| x, 22); diff --git a/src/test/run-pass/unboxed-closures/unboxed-closures-sugar-object.rs b/src/test/run-pass/unboxed-closures/unboxed-closures-sugar-object.rs index 45ab5df94b22c..1ca25517c3c5f 100644 --- a/src/test/run-pass/unboxed-closures/unboxed-closures-sugar-object.rs +++ b/src/test/run-pass/unboxed-closures/unboxed-closures-sugar-object.rs @@ -19,7 +19,7 @@ impl Getter for Identity { } fn main() { - let x: &Getter<(i32,), (i32,)> = &Identity; + let x: &dyn Getter<(i32,), (i32,)> = &Identity; let (y,) = x.get((22,)); assert_eq!(y, 22); } diff --git a/src/test/run-pass/unique/unique-object-move.rs b/src/test/run-pass/unique/unique-object-move.rs index 4bd3764fa15a7..84e8cdb32b84e 100644 --- a/src/test/run-pass/unique/unique-object-move.rs +++ b/src/test/run-pass/unique/unique-object-move.rs @@ -15,6 +15,6 @@ pub struct UvEventLoop { impl EventLoop for UvEventLoop { } pub fn main() { - let loop_: Box = box UvEventLoop { uvio: 0 } as Box; + let loop_: Box = box UvEventLoop { uvio: 0 } as Box; let _loop2_ = loop_; } diff --git a/src/test/run-pass/unsized2.rs b/src/test/run-pass/unsized2.rs index c3eae299b86c8..c9a8b2e7c664b 100644 --- a/src/test/run-pass/unsized2.rs +++ b/src/test/run-pass/unsized2.rs @@ -60,26 +60,26 @@ fn f7(x: &X) { trait T4 { fn dummy(&self) { } - fn m1(&self, x: &T4, y: X); - fn m2(&self, x: &T5, y: X); + fn m1(&self, x: &dyn T4, y: X); + fn m2(&self, x: &dyn T5, y: X); } trait T5 { fn dummy(&self) { } // not an error (for now) - fn m1(&self, x: &T4); - fn m2(&self, x: &T5); + fn m1(&self, x: &dyn T4); + fn m2(&self, x: &dyn T5); } trait T6 { fn dummy(&self) { } - fn m1(&self, x: &T4); - fn m2(&self, x: &T5); + fn m1(&self, x: &dyn T4); + fn m2(&self, x: &dyn T5); } trait T7 { fn dummy(&self) { } // not an error (for now) - fn m1(&self, x: &T4); - fn m2(&self, x: &T5); + fn m1(&self, x: &dyn T4); + fn m2(&self, x: &dyn T5); } // The last field in a struct may be unsized diff --git a/src/test/run-pass/wf-bound-region-in-object-type.rs b/src/test/run-pass/wf-bound-region-in-object-type.rs index d81059ca6a844..6814e2baab597 100644 --- a/src/test/run-pass/wf-bound-region-in-object-type.rs +++ b/src/test/run-pass/wf-bound-region-in-object-type.rs @@ -12,7 +12,7 @@ pub struct Context<'tcx> { pub type Cmd<'a> = &'a isize; pub type DecodeInlinedItem<'a> = - Box FnMut(Cmd, &Context<'tcx>) -> Result<&'tcx isize, ()> + 'a>; + Box FnMut(Cmd, &Context<'tcx>) -> Result<&'tcx isize, ()> + 'a>; fn foo(d: DecodeInlinedItem) { } diff --git a/src/test/ui/anonymous-higher-ranked-lifetime.rs b/src/test/ui/anonymous-higher-ranked-lifetime.rs index 2e2a124db9a5d..8a1744ed5f8ae 100644 --- a/src/test/ui/anonymous-higher-ranked-lifetime.rs +++ b/src/test/ui/anonymous-higher-ranked-lifetime.rs @@ -31,11 +31,11 @@ fn f4(_: F) where F: for<'r> Fn(&(), &'r ()) {} fn f5(_: F) where F: for<'r> Fn(&'r (), &'r ()) {} // Nested -fn g1(_: F) where F: Fn(&(), Box) {} +fn g1(_: F) where F: Fn(&(), Box) {} fn g2(_: F) where F: Fn(&(), fn(&())) {} -fn g3(_: F) where F: for<'s> Fn(&'s (), Box) {} +fn g3(_: F) where F: for<'s> Fn(&'s (), Box) {} fn g4(_: F) where F: Fn(&(), for<'r> fn(&'r ())) {} // Mixed -fn h1(_: F) where F: Fn(&(), Box, &(), fn(&(), &())) {} -fn h2(_: F) where F: for<'t0> Fn(&(), Box, &'t0 (), fn(&(), &())) {} +fn h1(_: F) where F: Fn(&(), Box, &(), fn(&(), &())) {} +fn h2(_: F) where F: for<'t0> Fn(&(), Box, &'t0 (), fn(&(), &())) {} diff --git a/src/test/ui/anonymous-higher-ranked-lifetime.stderr b/src/test/ui/anonymous-higher-ranked-lifetime.stderr index 86547303978d6..0ca3ca8437463 100644 --- a/src/test/ui/anonymous-higher-ranked-lifetime.stderr +++ b/src/test/ui/anonymous-higher-ranked-lifetime.stderr @@ -149,8 +149,8 @@ LL | g1(|_: (), _: ()| {}); note: required by `g1` --> $DIR/anonymous-higher-ranked-lifetime.rs:34:1 | -LL | fn g1(_: F) where F: Fn(&(), Box) {} - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | fn g1(_: F) where F: Fn(&(), Box) {} + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0631]: type mismatch in closure arguments --> $DIR/anonymous-higher-ranked-lifetime.rs:12:5 @@ -163,8 +163,8 @@ LL | g1(|_: (), _: ()| {}); note: required by `g1` --> $DIR/anonymous-higher-ranked-lifetime.rs:34:1 | -LL | fn g1(_: F) where F: Fn(&(), Box) {} - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | fn g1(_: F) where F: Fn(&(), Box) {} + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0631]: type mismatch in closure arguments --> $DIR/anonymous-higher-ranked-lifetime.rs:14:5 @@ -205,8 +205,8 @@ LL | g3(|_: (), _: ()| {}); note: required by `g3` --> $DIR/anonymous-higher-ranked-lifetime.rs:36:1 | -LL | fn g3(_: F) where F: for<'s> Fn(&'s (), Box) {} - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | fn g3(_: F) where F: for<'s> Fn(&'s (), Box) {} + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0631]: type mismatch in closure arguments --> $DIR/anonymous-higher-ranked-lifetime.rs:16:5 @@ -219,8 +219,8 @@ LL | g3(|_: (), _: ()| {}); note: required by `g3` --> $DIR/anonymous-higher-ranked-lifetime.rs:36:1 | -LL | fn g3(_: F) where F: for<'s> Fn(&'s (), Box) {} - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | fn g3(_: F) where F: for<'s> Fn(&'s (), Box) {} + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0631]: type mismatch in closure arguments --> $DIR/anonymous-higher-ranked-lifetime.rs:18:5 @@ -261,8 +261,8 @@ LL | h1(|_: (), _: (), _: (), _: ()| {}); note: required by `h1` --> $DIR/anonymous-higher-ranked-lifetime.rs:40:1 | -LL | fn h1(_: F) where F: Fn(&(), Box, &(), fn(&(), &())) {} - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | fn h1(_: F) where F: Fn(&(), Box, &(), fn(&(), &())) {} + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0631]: type mismatch in closure arguments --> $DIR/anonymous-higher-ranked-lifetime.rs:20:5 @@ -275,8 +275,8 @@ LL | h1(|_: (), _: (), _: (), _: ()| {}); note: required by `h1` --> $DIR/anonymous-higher-ranked-lifetime.rs:40:1 | -LL | fn h1(_: F) where F: Fn(&(), Box, &(), fn(&(), &())) {} - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | fn h1(_: F) where F: Fn(&(), Box, &(), fn(&(), &())) {} + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0631]: type mismatch in closure arguments --> $DIR/anonymous-higher-ranked-lifetime.rs:22:5 @@ -289,8 +289,8 @@ LL | h2(|_: (), _: (), _: (), _: ()| {}); note: required by `h2` --> $DIR/anonymous-higher-ranked-lifetime.rs:41:1 | -LL | fn h2(_: F) where F: for<'t0> Fn(&(), Box, &'t0 (), fn(&(), &())) {} - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | fn h2(_: F) where F: for<'t0> Fn(&(), Box, &'t0 (), fn(&(), &())) {} + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0631]: type mismatch in closure arguments --> $DIR/anonymous-higher-ranked-lifetime.rs:22:5 @@ -303,8 +303,8 @@ LL | h2(|_: (), _: (), _: (), _: ()| {}); note: required by `h2` --> $DIR/anonymous-higher-ranked-lifetime.rs:41:1 | -LL | fn h2(_: F) where F: for<'t0> Fn(&(), Box, &'t0 (), fn(&(), &())) {} - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | fn h2(_: F) where F: for<'t0> Fn(&(), Box, &'t0 (), fn(&(), &())) {} + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: aborting due to 22 previous errors diff --git a/src/test/ui/associated-const/associated-const-in-trait.rs b/src/test/ui/associated-const/associated-const-in-trait.rs index 187708a60b449..cc3acd5395622 100644 --- a/src/test/ui/associated-const/associated-const-in-trait.rs +++ b/src/test/ui/associated-const/associated-const-in-trait.rs @@ -6,7 +6,7 @@ trait Trait { const N: usize; } -impl Trait { +impl dyn Trait { //~^ ERROR the trait `Trait` cannot be made into an object [E0038] const fn n() -> usize { Self::N } } diff --git a/src/test/ui/associated-const/associated-const-in-trait.stderr b/src/test/ui/associated-const/associated-const-in-trait.stderr index 44a92639b5d7e..dff268a55c909 100644 --- a/src/test/ui/associated-const/associated-const-in-trait.stderr +++ b/src/test/ui/associated-const/associated-const-in-trait.stderr @@ -1,8 +1,8 @@ error[E0038]: the trait `Trait` cannot be made into an object --> $DIR/associated-const-in-trait.rs:9:6 | -LL | impl Trait { - | ^^^^^ the trait `Trait` cannot be made into an object +LL | impl dyn Trait { + | ^^^^^^^^^ the trait `Trait` cannot be made into an object | = note: the trait cannot contain associated consts like `N` diff --git a/src/test/ui/associated-type/associated-type-projection-from-multiple-supertraits.rs b/src/test/ui/associated-type/associated-type-projection-from-multiple-supertraits.rs index df9143d685ff3..7a678445796e6 100644 --- a/src/test/ui/associated-type/associated-type-projection-from-multiple-supertraits.rs +++ b/src/test/ui/associated-type/associated-type-projection-from-multiple-supertraits.rs @@ -20,7 +20,7 @@ fn dent(c: C, color: C::Color) { //~^ ERROR ambiguous associated type `Color` in bounds of `C` } -fn dent_object(c: BoxCar) { +fn dent_object(c: dyn BoxCar) { //~^ ERROR ambiguous associated type //~| ERROR the value of the associated type `Color` (from the trait `Vehicle`) must be specified } diff --git a/src/test/ui/associated-type/associated-type-projection-from-multiple-supertraits.stderr b/src/test/ui/associated-type/associated-type-projection-from-multiple-supertraits.stderr index dd46ad64692c0..6118ebef125a5 100644 --- a/src/test/ui/associated-type/associated-type-projection-from-multiple-supertraits.stderr +++ b/src/test/ui/associated-type/associated-type-projection-from-multiple-supertraits.stderr @@ -11,7 +11,7 @@ LL | fn dent(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:23:33 + --> $DIR/associated-type-projection-from-multiple-supertraits.rs:23:37 | LL | type Color; | ----------- ambiguous `Color` from `Vehicle` @@ -19,8 +19,8 @@ LL | type Color; LL | type Color; | ----------- ambiguous `Color` from `Box` ... -LL | fn dent_object(c: BoxCar) { - | ^^^^^^^^^^^ ambiguous associated type `Color` +LL | fn dent_object(c: dyn BoxCar) { + | ^^^^^^^^^^^ 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:23:26 @@ -28,8 +28,8 @@ error[E0191]: the value of the associated type `Color` (from the trait `Vehicle` LL | type Color; | ----------- `Color` defined here ... -LL | fn dent_object(c: BoxCar) { - | ^^^^^^^^^^^^^^^^^^^ associated type `Color` must be specified +LL | fn dent_object(c: dyn BoxCar) { + | ^^^^^^^^^^^^^^^^^^^^^^^ associated type `Color` must be specified error[E0221]: ambiguous associated type `Color` in bounds of `C` --> $DIR/associated-type-projection-from-multiple-supertraits.rs:28:29 diff --git a/src/test/ui/associated-types/associated-types-eq-3.rs b/src/test/ui/associated-types/associated-types-eq-3.rs index 1a58dcca9e249..9366148b587d2 100644 --- a/src/test/ui/associated-types/associated-types-eq-3.rs +++ b/src/test/ui/associated-types/associated-types-eq-3.rs @@ -28,7 +28,7 @@ fn foo2(x: I) { } -pub fn baz(x: &Foo) { +pub fn baz(x: &dyn Foo) { let _: Bar = x.boo(); } diff --git a/src/test/ui/associated-types/associated-types-incomplete-object.rs b/src/test/ui/associated-types/associated-types-incomplete-object.rs index c93f3bec4d7d5..4993b13121549 100644 --- a/src/test/ui/associated-types/associated-types-incomplete-object.rs +++ b/src/test/ui/associated-types/associated-types-incomplete-object.rs @@ -18,14 +18,14 @@ impl Foo for isize { } pub fn main() { - let a = &42isize as &Foo; + let a = &42isize as &dyn Foo; - let b = &42isize as &Foo; + let b = &42isize as &dyn Foo; //~^ ERROR the value of the associated type `B` (from the trait `Foo`) must be specified - let c = &42isize as &Foo; + let c = &42isize as &dyn Foo; //~^ ERROR the value of the associated type `A` (from the trait `Foo`) must be specified - let d = &42isize as &Foo; + let d = &42isize as &dyn Foo; //~^ ERROR the value of the associated types `A` (from the trait `Foo`), `B` (from the trait } diff --git a/src/test/ui/associated-types/associated-types-incomplete-object.stderr b/src/test/ui/associated-types/associated-types-incomplete-object.stderr index d152e028eb733..b4c08f4a4cce5 100644 --- a/src/test/ui/associated-types/associated-types-incomplete-object.stderr +++ b/src/test/ui/associated-types/associated-types-incomplete-object.stderr @@ -4,8 +4,8 @@ error[E0191]: the value of the associated type `B` (from the trait `Foo`) must b LL | type B; | ------- `B` defined here ... -LL | let b = &42isize as &Foo; - | ^^^^^^^^^^^^ associated type `B` must be specified +LL | let b = &42isize as &dyn Foo; + | ^^^^^^^^^^^^^^^^ associated type `B` must be specified error[E0191]: the value of the associated type `A` (from the trait `Foo`) must be specified --> $DIR/associated-types-incomplete-object.rs:26:26 @@ -13,8 +13,8 @@ error[E0191]: the value of the associated type `A` (from the trait `Foo`) must b LL | type A; | ------- `A` defined here ... -LL | let c = &42isize as &Foo; - | ^^^^^^^^^^^ associated type `A` must be specified +LL | let c = &42isize as &dyn Foo; + | ^^^^^^^^^^^^^^^ associated type `A` must be specified error[E0191]: the value of the associated types `A` (from the trait `Foo`), `B` (from the trait `Foo`) must be specified --> $DIR/associated-types-incomplete-object.rs:29:26 @@ -24,8 +24,8 @@ LL | type A; LL | type B; | ------- `B` defined here ... -LL | let d = &42isize as &Foo; - | ^^^ +LL | let d = &42isize as &dyn Foo; + | ^^^^^^^ | | | associated type `A` must be specified | associated type `B` must be specified diff --git a/src/test/ui/associated-types/associated-types-overridden-binding-2.rs b/src/test/ui/associated-types/associated-types-overridden-binding-2.rs index 7467f33204725..109feb8e969a5 100644 --- a/src/test/ui/associated-types/associated-types-overridden-binding-2.rs +++ b/src/test/ui/associated-types/associated-types-overridden-binding-2.rs @@ -3,6 +3,6 @@ trait I32Iterator = Iterator; fn main() { - let _: &I32Iterator = &vec![42].into_iter(); + let _: &dyn I32Iterator = &vec![42].into_iter(); //~^ ERROR type mismatch } diff --git a/src/test/ui/associated-types/associated-types-overridden-binding-2.stderr b/src/test/ui/associated-types/associated-types-overridden-binding-2.stderr index 85724cb7c6e85..aff067c289107 100644 --- a/src/test/ui/associated-types/associated-types-overridden-binding-2.stderr +++ b/src/test/ui/associated-types/associated-types-overridden-binding-2.stderr @@ -1,8 +1,8 @@ error[E0271]: type mismatch resolving ` as std::iter::Iterator>::Item == i32` - --> $DIR/associated-types-overridden-binding-2.rs:6:39 + --> $DIR/associated-types-overridden-binding-2.rs:6:43 | -LL | let _: &I32Iterator = &vec![42].into_iter(); - | ^^^^^^^^^^^^^^^^^^^^^ expected u32, found i32 +LL | let _: &dyn I32Iterator = &vec![42].into_iter(); + | ^^^^^^^^^^^^^^^^^^^^^ expected u32, found i32 | = note: expected type `u32` found type `i32` diff --git a/src/test/ui/associated-types/associated-types-overridden-binding.rs b/src/test/ui/associated-types/associated-types-overridden-binding.rs index ea3a61b2befae..fa1889389fd5c 100644 --- a/src/test/ui/associated-types/associated-types-overridden-binding.rs +++ b/src/test/ui/associated-types/associated-types-overridden-binding.rs @@ -7,5 +7,5 @@ trait I32Iterator = Iterator; trait U32Iterator = I32Iterator; fn main() { - let _: &I32Iterator; + let _: &dyn I32Iterator; } diff --git a/src/test/ui/associated-types/bound-lifetime-constrained.object.stderr b/src/test/ui/associated-types/bound-lifetime-constrained.object.stderr index 9258854245c84..36fa06cce4dd6 100644 --- a/src/test/ui/associated-types/bound-lifetime-constrained.object.stderr +++ b/src/test/ui/associated-types/bound-lifetime-constrained.object.stderr @@ -1,14 +1,14 @@ error[E0582]: binding for associated type `Output` references lifetime `'a`, which does not appear in the trait input types - --> $DIR/bound-lifetime-constrained.rs:28:56 + --> $DIR/bound-lifetime-constrained.rs:28:60 | -LL | fn object1(_: Box Fn(<() as Foo<'a>>::Item) -> &'a i32>) { - | ^^^^^^^ +LL | fn object1(_: Box Fn(<() as Foo<'a>>::Item) -> &'a i32>) { + | ^^^^^^^ error[E0582]: binding for associated type `Output` references lifetime `'a`, which does not appear in the trait input types - --> $DIR/bound-lifetime-constrained.rs:33:35 + --> $DIR/bound-lifetime-constrained.rs:33:39 | -LL | fn object2(_: Box Fn() -> <() as Foo<'a>>::Item>) { - | ^^^^^^^^^^^^^^^^^^^^^ +LL | fn object2(_: Box Fn() -> <() as Foo<'a>>::Item>) { + | ^^^^^^^^^^^^^^^^^^^^^ error: aborting due to 2 previous errors diff --git a/src/test/ui/associated-types/bound-lifetime-constrained.rs b/src/test/ui/associated-types/bound-lifetime-constrained.rs index b590f88b60dca..fb82b3fa66660 100644 --- a/src/test/ui/associated-types/bound-lifetime-constrained.rs +++ b/src/test/ui/associated-types/bound-lifetime-constrained.rs @@ -25,12 +25,12 @@ fn func2(_: for<'a> fn() -> <() as Foo<'a>>::Item) { } #[cfg(object)] -fn object1(_: Box Fn(<() as Foo<'a>>::Item) -> &'a i32>) { +fn object1(_: Box Fn(<() as Foo<'a>>::Item) -> &'a i32>) { //[object]~^ ERROR E0582 } #[cfg(object)] -fn object2(_: Box Fn() -> <() as Foo<'a>>::Item>) { +fn object2(_: Box Fn() -> <() as Foo<'a>>::Item>) { //[object]~^ ERROR E0582 } diff --git a/src/test/ui/associated-types/bound-lifetime-in-binding-only.angle.stderr b/src/test/ui/associated-types/bound-lifetime-in-binding-only.angle.stderr index fee64c0f663b7..54f4bb9076b28 100644 --- a/src/test/ui/associated-types/bound-lifetime-in-binding-only.angle.stderr +++ b/src/test/ui/associated-types/bound-lifetime-in-binding-only.angle.stderr @@ -17,10 +17,10 @@ LL | fn angle2() where for<'a> T: Foo { | ^^^^^^^^^^^^ error[E0582]: binding for associated type `Item` references lifetime `'a`, which does not appear in the trait input types - --> $DIR/bound-lifetime-in-binding-only.rs:27:27 + --> $DIR/bound-lifetime-in-binding-only.rs:27:31 | -LL | fn angle3(_: &for<'a> Foo) { - | ^^^^^^^^^^^^ +LL | fn angle3(_: &dyn for<'a> Foo) { + | ^^^^^^^^^^^^ error: aborting due to 4 previous errors diff --git a/src/test/ui/associated-types/bound-lifetime-in-binding-only.paren.stderr b/src/test/ui/associated-types/bound-lifetime-in-binding-only.paren.stderr index 8c9480027e62a..74bc84c222aa7 100644 --- a/src/test/ui/associated-types/bound-lifetime-in-binding-only.paren.stderr +++ b/src/test/ui/associated-types/bound-lifetime-in-binding-only.paren.stderr @@ -17,10 +17,10 @@ LL | fn paren2() where for<'a> T: Fn() -> &'a i32 { | ^^^^^^^ error[E0582]: binding for associated type `Output` references lifetime `'a`, which does not appear in the trait input types - --> $DIR/bound-lifetime-in-binding-only.rs:47:31 + --> $DIR/bound-lifetime-in-binding-only.rs:47:35 | -LL | fn paren3(_: &for<'a> Fn() -> &'a i32) { - | ^^^^^^^ +LL | fn paren3(_: &dyn for<'a> Fn() -> &'a i32) { + | ^^^^^^^ error: aborting due to 4 previous errors diff --git a/src/test/ui/associated-types/bound-lifetime-in-binding-only.rs b/src/test/ui/associated-types/bound-lifetime-in-binding-only.rs index e1989d35bbb8c..843f5f0619588 100644 --- a/src/test/ui/associated-types/bound-lifetime-in-binding-only.rs +++ b/src/test/ui/associated-types/bound-lifetime-in-binding-only.rs @@ -24,7 +24,7 @@ fn angle2() where for<'a> T: Foo { } #[cfg(angle)] -fn angle3(_: &for<'a> Foo) { +fn angle3(_: &dyn for<'a> Foo) { //[angle]~^ ERROR binding for associated type `Item` references lifetime `'a` } @@ -44,7 +44,7 @@ fn paren2() where for<'a> T: Fn() -> &'a i32 { } #[cfg(paren)] -fn paren3(_: &for<'a> Fn() -> &'a i32) { +fn paren3(_: &dyn for<'a> Fn() -> &'a i32) { //[paren]~^ ERROR binding for associated type `Output` references lifetime `'a` } diff --git a/src/test/ui/associated-types/bound-lifetime-in-return-only.rs b/src/test/ui/associated-types/bound-lifetime-in-return-only.rs index 5a7e086fd476c..9c0dc61494d1f 100644 --- a/src/test/ui/associated-types/bound-lifetime-in-return-only.rs +++ b/src/test/ui/associated-types/bound-lifetime-in-return-only.rs @@ -38,11 +38,11 @@ fn elision(_: fn() -> &i32) { struct Parameterized<'a> { x: &'a str } #[cfg(ok)] -fn ok1(_: &for<'a> Fn(&Parameterized<'a>) -> &'a i32) { +fn ok1(_: &dyn for<'a> Fn(&Parameterized<'a>) -> &'a i32) { } #[cfg(ok)] -fn ok2(_: &for<'a,'b> Fn<(&'b Parameterized<'a>,), Output=&'a i32>) { +fn ok2(_: &dyn for<'a,'b> Fn<(&'b Parameterized<'a>,), Output=&'a i32>) { } #[rustc_error] diff --git a/src/test/ui/async-await/async-with-closure.rs b/src/test/ui/async-await/async-with-closure.rs index 856a778078a61..e94a5f0853d72 100644 --- a/src/test/ui/async-await/async-with-closure.rs +++ b/src/test/ui/async-await/async-with-closure.rs @@ -19,7 +19,7 @@ struct MyStream { async fn get_future(_stream: MyStream) {} async fn f() { - let messages: MyStream = unimplemented!(); + let messages: MyStream = unimplemented!(); await!(get_future(messages)); } diff --git a/src/test/ui/async-await/issues/issue-53249.rs b/src/test/ui/async-await/issues/issue-53249.rs index 9e4ff43ecd112..2157cf7d4f7ab 100644 --- a/src/test/ui/async-await/issues/issue-53249.rs +++ b/src/test/ui/async-await/issues/issue-53249.rs @@ -35,7 +35,7 @@ impl Future for Lazy } async fn __receive(want: WantFn) -> () - where Fut: Future, WantFn: Fn(&Box) -> Fut, + where Fut: Future, WantFn: Fn(&Box) -> Fut, { await!(lazy(|_| ())); } diff --git a/src/test/ui/async-await/issues/issue-54974.rs b/src/test/ui/async-await/issues/issue-54974.rs index d6f18875c9e3a..ad18f41187569 100644 --- a/src/test/ui/async-await/issues/issue-54974.rs +++ b/src/test/ui/async-await/issues/issue-54974.rs @@ -9,7 +9,7 @@ trait SomeTrait: Send + Sync + 'static { fn do_something(&self); } -async fn my_task(obj: Arc) { +async fn my_task(obj: Arc) { unimplemented!() } diff --git a/src/test/ui/bad/bad-sized.rs b/src/test/ui/bad/bad-sized.rs index 0da4e456f088d..b899c59ff2ea7 100644 --- a/src/test/ui/bad/bad-sized.rs +++ b/src/test/ui/bad/bad-sized.rs @@ -1,7 +1,7 @@ trait Trait {} pub fn main() { - let x: Vec = Vec::new(); + let x: Vec = Vec::new(); //~^ ERROR only auto traits can be used as additional traits in a trait object //~| ERROR the size for values of type //~| ERROR the size for values of type diff --git a/src/test/ui/bad/bad-sized.stderr b/src/test/ui/bad/bad-sized.stderr index 6307af5d725d1..e9ded557281a4 100644 --- a/src/test/ui/bad/bad-sized.stderr +++ b/src/test/ui/bad/bad-sized.stderr @@ -1,29 +1,29 @@ error[E0225]: only auto traits can be used as additional traits in a trait object - --> $DIR/bad-sized.rs:4:24 + --> $DIR/bad-sized.rs:4:28 | -LL | let x: Vec = Vec::new(); - | ----- ^^^^^ - | | | - | | additional non-auto trait - | | trait alias used in trait object type (additional use) - | first non-auto trait - | trait alias used in trait object type (first use) +LL | let x: Vec = Vec::new(); + | ----- ^^^^^ + | | | + | | additional non-auto trait + | | trait alias used in trait object type (additional use) + | first non-auto trait + | trait alias used in trait object type (first use) error[E0277]: the size for values of type `dyn Trait` cannot be known at compilation time --> $DIR/bad-sized.rs:4:12 | -LL | let x: Vec = Vec::new(); - | ^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time +LL | let x: Vec = Vec::new(); + | ^^^^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time | = help: the trait `std::marker::Sized` is not implemented for `dyn Trait` = note: to learn more, visit = note: required by `std::vec::Vec` error[E0277]: the size for values of type `dyn Trait` cannot be known at compilation time - --> $DIR/bad-sized.rs:4:33 + --> $DIR/bad-sized.rs:4:37 | -LL | let x: Vec = Vec::new(); - | ^^^^^^^^ doesn't have a size known at compile-time +LL | let x: Vec = Vec::new(); + | ^^^^^^^^ doesn't have a size known at compile-time | = help: the trait `std::marker::Sized` is not implemented for `dyn Trait` = note: to learn more, visit diff --git a/src/test/ui/borrowck/borrowck-borrow-mut-object-twice.rs b/src/test/ui/borrowck/borrowck-borrow-mut-object-twice.rs index 5e853afd38c87..b4d85b60cd5af 100644 --- a/src/test/ui/borrowck/borrowck-borrow-mut-object-twice.rs +++ b/src/test/ui/borrowck/borrowck-borrow-mut-object-twice.rs @@ -8,7 +8,7 @@ trait Foo { fn f2(&mut self); } -fn test(x: &mut Foo) { +fn test(x: &mut dyn Foo) { let y = x.f1(); x.f2(); //~ ERROR cannot borrow `*x` as mutable y.use_ref(); diff --git a/src/test/ui/borrowck/borrowck-consume-upcast-box.rs b/src/test/ui/borrowck/borrowck-consume-upcast-box.rs index ed669c4d90151..6b32d185b6fdf 100644 --- a/src/test/ui/borrowck/borrowck-consume-upcast-box.rs +++ b/src/test/ui/borrowck/borrowck-consume-upcast-box.rs @@ -2,10 +2,10 @@ trait Foo { fn dummy(&self); } -fn consume(_: Box) { +fn consume(_: Box) { } -fn foo(b: Box) { +fn foo(b: Box) { consume(b); consume(b); //~ ERROR use of moved value } diff --git a/src/test/ui/borrowck/borrowck-consume-upcast-box.stderr b/src/test/ui/borrowck/borrowck-consume-upcast-box.stderr index e8194ad694403..356cda01e29c8 100644 --- a/src/test/ui/borrowck/borrowck-consume-upcast-box.stderr +++ b/src/test/ui/borrowck/borrowck-consume-upcast-box.stderr @@ -1,7 +1,7 @@ error[E0382]: use of moved value: `b` --> $DIR/borrowck-consume-upcast-box.rs:10:13 | -LL | fn foo(b: Box) { +LL | fn foo(b: Box) { | - move occurs because `b` has type `std::boxed::Box`, which does not implement the `Copy` trait LL | consume(b); | - value moved here diff --git a/src/test/ui/borrowck/borrowck-escaping-closure-error-2.rs b/src/test/ui/borrowck/borrowck-escaping-closure-error-2.rs index a44e3031e256f..b50d455637b9a 100644 --- a/src/test/ui/borrowck/borrowck-escaping-closure-error-2.rs +++ b/src/test/ui/borrowck/borrowck-escaping-closure-error-2.rs @@ -6,7 +6,7 @@ // closure may outlive the current function, but it borrows `books`, // which is owned by the current function -fn foo<'a>(x: &'a i32) -> Box { +fn foo<'a>(x: &'a i32) -> Box { let mut books = vec![1,2,3]; Box::new(|| books.push(4)) //~^ ERROR E0373 diff --git a/src/test/ui/borrowck/borrowck-in-static.rs b/src/test/ui/borrowck/borrowck-in-static.rs index 43bb652a024ff..c468740bc3bf5 100644 --- a/src/test/ui/borrowck/borrowck-in-static.rs +++ b/src/test/ui/borrowck/borrowck-in-static.rs @@ -1,6 +1,6 @@ // check that borrowck looks inside consts/statics -static FN : &'static (Fn() -> (BoxBox>) + Sync) = &|| { +static FN : &'static (dyn Fn() -> (BoxBox>) + Sync) = &|| { let x = Box::new(0); Box::new(|| x) //~ ERROR cannot move out of captured variable in an `Fn` closure }; diff --git a/src/test/ui/borrowck/borrowck-object-lifetime.rs b/src/test/ui/borrowck/borrowck-object-lifetime.rs index 495516cf97634..137a9adbc40ac 100644 --- a/src/test/ui/borrowck/borrowck-object-lifetime.rs +++ b/src/test/ui/borrowck/borrowck-object-lifetime.rs @@ -8,26 +8,26 @@ trait Foo { fn mut_borrowed(&mut self) -> &(); } -fn borrowed_receiver(x: &Foo) { +fn borrowed_receiver(x: &dyn Foo) { let y = x.borrowed(); let z = x.borrowed(); z.use_ref(); y.use_ref(); } -fn mut_borrowed_receiver(x: &mut Foo) { +fn mut_borrowed_receiver(x: &mut dyn Foo) { let y = x.borrowed(); let z = x.mut_borrowed(); //~ ERROR cannot borrow y.use_ref(); } -fn mut_owned_receiver(mut x: Box) { +fn mut_owned_receiver(mut x: Box) { let y = x.borrowed(); let z = &mut x; //~ ERROR cannot borrow y.use_ref(); } -fn imm_owned_receiver(mut x: Box) { +fn imm_owned_receiver(mut x: Box) { let y = x.borrowed(); let z = &x; z.use_ref(); diff --git a/src/test/ui/borrowck/borrowck-use-uninitialized-in-cast-trait.rs b/src/test/ui/borrowck/borrowck-use-uninitialized-in-cast-trait.rs index 1e272372f6c94..3ce7216181494 100644 --- a/src/test/ui/borrowck/borrowck-use-uninitialized-in-cast-trait.rs +++ b/src/test/ui/borrowck/borrowck-use-uninitialized-in-cast-trait.rs @@ -6,5 +6,5 @@ impl Foo for i32 { } fn main() { let x: &i32; - let y = x as *const Foo; //~ ERROR [E0381] + let y = x as *const dyn Foo; //~ ERROR [E0381] } diff --git a/src/test/ui/borrowck/borrowck-use-uninitialized-in-cast-trait.stderr b/src/test/ui/borrowck/borrowck-use-uninitialized-in-cast-trait.stderr index df610cbb5618f..2b80140c6b376 100644 --- a/src/test/ui/borrowck/borrowck-use-uninitialized-in-cast-trait.stderr +++ b/src/test/ui/borrowck/borrowck-use-uninitialized-in-cast-trait.stderr @@ -1,7 +1,7 @@ error[E0381]: borrow of possibly uninitialized variable: `x` --> $DIR/borrowck-use-uninitialized-in-cast-trait.rs:9:13 | -LL | let y = x as *const Foo; +LL | let y = x as *const dyn Foo; | ^ use of possibly uninitialized `*x` error: aborting due to previous error diff --git a/src/test/ui/borrowck/regions-escape-unboxed-closure.rs b/src/test/ui/borrowck/regions-escape-unboxed-closure.rs index 62ddf4decfcab..d8bef927fd722 100644 --- a/src/test/ui/borrowck/regions-escape-unboxed-closure.rs +++ b/src/test/ui/borrowck/regions-escape-unboxed-closure.rs @@ -1,4 +1,4 @@ -fn with_int(f: &mut FnMut(&isize)) { +fn with_int(f: &mut dyn FnMut(&isize)) { } fn main() { diff --git a/src/test/ui/borrowck/two-phase-nonrecv-autoref.nll.stderr b/src/test/ui/borrowck/two-phase-nonrecv-autoref.nll.stderr index fca425da34d37..baf122df5e268 100644 --- a/src/test/ui/borrowck/two-phase-nonrecv-autoref.nll.stderr +++ b/src/test/ui/borrowck/two-phase-nonrecv-autoref.nll.stderr @@ -29,7 +29,7 @@ LL | f(f(10)); error[E0382]: use of moved value: `f` --> $DIR/two-phase-nonrecv-autoref.rs:80:11 | -LL | fn twice_ten_oo(f: Box i32>) { +LL | fn twice_ten_oo(f: Box i32>) { | - move occurs because `f` has type `std::boxed::Box i32>`, which does not implement the `Copy` trait LL | f(f(10)); | - ^ value used here after move diff --git a/src/test/ui/borrowck/two-phase-nonrecv-autoref.rs b/src/test/ui/borrowck/two-phase-nonrecv-autoref.rs index c0a117d6766d5..b29664e3d8cbd 100644 --- a/src/test/ui/borrowck/two-phase-nonrecv-autoref.rs +++ b/src/test/ui/borrowck/two-phase-nonrecv-autoref.rs @@ -68,15 +68,15 @@ fn overloaded_call_traits() { //[g2p]~^^ ERROR use of moved value: `f` } - fn twice_ten_om(f: &mut FnMut(i32) -> i32) { + fn twice_ten_om(f: &mut dyn FnMut(i32) -> i32) { f(f(10)); //[nll]~^ ERROR cannot borrow `*f` as mutable more than once at a time //[g2p]~^^ ERROR cannot borrow `*f` as mutable more than once at a time } - fn twice_ten_oi(f: &mut Fn(i32) -> i32) { + fn twice_ten_oi(f: &mut dyn Fn(i32) -> i32) { f(f(10)); } - fn twice_ten_oo(f: Box i32>) { + fn twice_ten_oo(f: Box i32>) { f(f(10)); //[nll]~^ ERROR use of moved value: `f` //[g2p]~^^ ERROR use of moved value: `f` diff --git a/src/test/ui/bounds-lifetime.rs b/src/test/ui/bounds-lifetime.rs index 8abfe3e4b7623..31aa4011b9114 100644 --- a/src/test/ui/bounds-lifetime.rs +++ b/src/test/ui/bounds-lifetime.rs @@ -2,6 +2,6 @@ type A = for<'b, 'a: 'b> fn(); //~ ERROR lifetime bounds cannot be used in this type B = for<'b, 'a: 'b,> fn(); //~ ERROR lifetime bounds cannot be used in this context type C = for<'b, 'a: 'b +> fn(); //~ ERROR lifetime bounds cannot be used in this context type D = for<'a, T> fn(); //~ ERROR only lifetime parameters can be used in this context -type E = for Fn(); //~ ERROR only lifetime parameters can be used in this context +type E = dyn for Fn(); //~ ERROR only lifetime parameters can be used in this context fn main() {} diff --git a/src/test/ui/bounds-lifetime.stderr b/src/test/ui/bounds-lifetime.stderr index 21a7814626746..a0395ed49045f 100644 --- a/src/test/ui/bounds-lifetime.stderr +++ b/src/test/ui/bounds-lifetime.stderr @@ -23,10 +23,10 @@ LL | type D = for<'a, T> fn(); | ^ error: only lifetime parameters can be used in this context - --> $DIR/bounds-lifetime.rs:5:14 + --> $DIR/bounds-lifetime.rs:5:18 | -LL | type E = for Fn(); - | ^ +LL | type E = dyn for Fn(); + | ^ error: aborting due to 5 previous errors diff --git a/src/test/ui/cast/cast-to-unsized-trait-object-suggestion.rs b/src/test/ui/cast/cast-to-unsized-trait-object-suggestion.rs index ac859c512637e..5342b595c7c5e 100644 --- a/src/test/ui/cast/cast-to-unsized-trait-object-suggestion.rs +++ b/src/test/ui/cast/cast-to-unsized-trait-object-suggestion.rs @@ -1,4 +1,4 @@ fn main() { - &1 as Send; //~ ERROR cast to unsized - Box::new(1) as Send; //~ ERROR cast to unsized + &1 as dyn Send; //~ ERROR cast to unsized + Box::new(1) as dyn Send; //~ ERROR cast to unsized } diff --git a/src/test/ui/cast/cast-to-unsized-trait-object-suggestion.stderr b/src/test/ui/cast/cast-to-unsized-trait-object-suggestion.stderr index bd7a0e1834aa7..ffa02533d8b66 100644 --- a/src/test/ui/cast/cast-to-unsized-trait-object-suggestion.stderr +++ b/src/test/ui/cast/cast-to-unsized-trait-object-suggestion.stderr @@ -1,18 +1,18 @@ error[E0620]: cast to unsized type: `&{integer}` as `dyn std::marker::Send` --> $DIR/cast-to-unsized-trait-object-suggestion.rs:2:5 | -LL | &1 as Send; - | ^^^^^^---- +LL | &1 as dyn Send; + | ^^^^^^-------- | | - | help: try casting to a reference instead: `&Send` + | help: try casting to a reference instead: `&dyn Send` error[E0620]: cast to unsized type: `std::boxed::Box<{integer}>` as `dyn std::marker::Send` --> $DIR/cast-to-unsized-trait-object-suggestion.rs:3:5 | -LL | Box::new(1) as Send; - | ^^^^^^^^^^^^^^^---- +LL | Box::new(1) as dyn Send; + | ^^^^^^^^^^^^^^^-------- | | - | help: try casting to a `Box` instead: `Box` + | help: try casting to a `Box` instead: `Box` error: aborting due to 2 previous errors diff --git a/src/test/ui/casts-differing-anon.rs b/src/test/ui/casts-differing-anon.rs index cba178104c99f..d4a0f9613055e 100644 --- a/src/test/ui/casts-differing-anon.rs +++ b/src/test/ui/casts-differing-anon.rs @@ -5,7 +5,7 @@ fn foo() -> Box { x } fn bar() -> Box { - let y: Box = Box::new([0]); + let y: Box = Box::new([0]); y } diff --git a/src/test/ui/class-cast-to-trait.rs b/src/test/ui/class-cast-to-trait.rs index 3ae4987254fce..bb4c3fac93806 100644 --- a/src/test/ui/class-cast-to-trait.rs +++ b/src/test/ui/class-cast-to-trait.rs @@ -49,6 +49,6 @@ fn cat(in_x : usize, in_y : isize, in_name: String) -> Cat { } fn main() { - let nyan: Box = box cat(0, 2, "nyan".to_string()) as Box; + let nyan: Box = box cat(0, 2, "nyan".to_string()) as Box; nyan.eat(); //~ ERROR no method named `eat` found } diff --git a/src/test/ui/closure_context/issue-26046-fn-mut.rs b/src/test/ui/closure_context/issue-26046-fn-mut.rs index e5840181e41ef..0a015ea1436c5 100644 --- a/src/test/ui/closure_context/issue-26046-fn-mut.rs +++ b/src/test/ui/closure_context/issue-26046-fn-mut.rs @@ -1,4 +1,4 @@ -fn foo() -> Box { +fn foo() -> Box { let num = 5; let closure = || { //~ ERROR expected a closure that diff --git a/src/test/ui/closure_context/issue-26046-fn-once.rs b/src/test/ui/closure_context/issue-26046-fn-once.rs index d33420c52a035..511690e9dd4b3 100644 --- a/src/test/ui/closure_context/issue-26046-fn-once.rs +++ b/src/test/ui/closure_context/issue-26046-fn-once.rs @@ -1,4 +1,4 @@ -fn get_closure() -> Box Vec> { +fn get_closure() -> Box Vec> { let vec = vec![1u8, 2u8]; let closure = move || { //~ ERROR expected a closure diff --git a/src/test/ui/closures/closure-immutable-outer-variable.fixed b/src/test/ui/closures/closure-immutable-outer-variable.fixed index 03240d4857ca8..102f1f94a36e1 100644 --- a/src/test/ui/closures/closure-immutable-outer-variable.fixed +++ b/src/test/ui/closures/closure-immutable-outer-variable.fixed @@ -2,7 +2,7 @@ // Point at the captured immutable outer variable -fn foo(mut f: Box) { +fn foo(mut f: Box) { f(); } diff --git a/src/test/ui/closures/closure-immutable-outer-variable.rs b/src/test/ui/closures/closure-immutable-outer-variable.rs index 8fa9e44845d5b..6eb43b372c96c 100644 --- a/src/test/ui/closures/closure-immutable-outer-variable.rs +++ b/src/test/ui/closures/closure-immutable-outer-variable.rs @@ -2,7 +2,7 @@ // Point at the captured immutable outer variable -fn foo(mut f: Box) { +fn foo(mut f: Box) { f(); } diff --git a/src/test/ui/codemap_tests/coherence-overlapping-inherent-impl-trait.rs b/src/test/ui/codemap_tests/coherence-overlapping-inherent-impl-trait.rs index f35fbad7cd6df..414acfd84ce4e 100644 --- a/src/test/ui/codemap_tests/coherence-overlapping-inherent-impl-trait.rs +++ b/src/test/ui/codemap_tests/coherence-overlapping-inherent-impl-trait.rs @@ -1,6 +1,6 @@ #![allow(dead_code)] trait C {} -impl C { fn f() {} } //~ ERROR duplicate -impl C { fn f() {} } +impl dyn C { fn f() {} } //~ ERROR duplicate +impl dyn C { fn f() {} } fn main() { } diff --git a/src/test/ui/codemap_tests/coherence-overlapping-inherent-impl-trait.stderr b/src/test/ui/codemap_tests/coherence-overlapping-inherent-impl-trait.stderr index 16cdca774ba37..a97161b131d49 100644 --- a/src/test/ui/codemap_tests/coherence-overlapping-inherent-impl-trait.stderr +++ b/src/test/ui/codemap_tests/coherence-overlapping-inherent-impl-trait.stderr @@ -1,10 +1,10 @@ error[E0592]: duplicate definitions with name `f` - --> $DIR/coherence-overlapping-inherent-impl-trait.rs:4:10 + --> $DIR/coherence-overlapping-inherent-impl-trait.rs:4:14 | -LL | impl C { fn f() {} } - | ^^^^^^^^^ duplicate definitions for `f` -LL | impl C { fn f() {} } - | --------- other definition for `f` +LL | impl dyn C { fn f() {} } + | ^^^^^^^^^ duplicate definitions for `f` +LL | impl dyn C { fn f() {} } + | --------- other definition for `f` error: aborting due to previous error diff --git a/src/test/ui/codemap_tests/two_files_data.rs b/src/test/ui/codemap_tests/two_files_data.rs index db8ab14e67371..b4d2f5d3c6d09 100644 --- a/src/test/ui/codemap_tests/two_files_data.rs +++ b/src/test/ui/codemap_tests/two_files_data.rs @@ -2,4 +2,4 @@ trait Foo { } -type Bar = Foo; +type Bar = dyn Foo; diff --git a/src/test/ui/coercion/coerce-expect-unsized-ascribed.rs b/src/test/ui/coercion/coerce-expect-unsized-ascribed.rs index 9a4e134cb39a4..c139e823c2aef 100644 --- a/src/test/ui/coercion/coerce-expect-unsized-ascribed.rs +++ b/src/test/ui/coercion/coerce-expect-unsized-ascribed.rs @@ -10,23 +10,23 @@ pub fn main() { let _ = box if true { [1, 2, 3] } else { [1, 3, 4] }: Box<[i32]>; //~ ERROR mismatched types let _ = box match true { true => [1, 2, 3], false => [1, 3, 4] }: Box<[i32]>; //~^ ERROR mismatched types - let _ = box { |x| (x as u8) }: Box _>; //~ ERROR mismatched types - let _ = box if true { false } else { true }: Box; //~ ERROR mismatched types - let _ = box match true { true => 'a', false => 'b' }: Box; //~ ERROR mismatched types + let _ = box { |x| (x as u8) }: Box _>; //~ ERROR mismatched types + let _ = box if true { false } else { true }: Box; //~ ERROR mismatched types + let _ = box match true { true => 'a', false => 'b' }: Box; //~ ERROR mismatched types let _ = &{ [1, 2, 3] }: &[i32]; //~ ERROR mismatched types let _ = &if true { [1, 2, 3] } else { [1, 3, 4] }: &[i32]; //~ ERROR mismatched types let _ = &match true { true => [1, 2, 3], false => [1, 3, 4] }: &[i32]; //~^ ERROR mismatched types - let _ = &{ |x| (x as u8) }: &Fn(i32) -> _; //~ ERROR mismatched types - let _ = &if true { false } else { true }: &Debug; //~ ERROR mismatched types - let _ = &match true { true => 'a', false => 'b' }: &Debug; //~ ERROR mismatched types + let _ = &{ |x| (x as u8) }: &dyn Fn(i32) -> _; //~ ERROR mismatched types + let _ = &if true { false } else { true }: &dyn Debug; //~ ERROR mismatched types + let _ = &match true { true => 'a', false => 'b' }: &dyn Debug; //~ ERROR mismatched types let _ = Box::new([1, 2, 3]): Box<[i32]>; //~ ERROR mismatched types - let _ = Box::new(|x| (x as u8)): Box _>; //~ ERROR mismatched types + let _ = Box::new(|x| (x as u8)): Box _>; //~ ERROR mismatched types let _ = vec![ Box::new(|x| (x as u8)), box |x| (x as i16 as u8), - ]: Vec _>>; + ]: Vec _>>; } diff --git a/src/test/ui/coercion/coerce-expect-unsized-ascribed.stderr b/src/test/ui/coercion/coerce-expect-unsized-ascribed.stderr index be362c9a78b98..3b81610a06e09 100644 --- a/src/test/ui/coercion/coerce-expect-unsized-ascribed.stderr +++ b/src/test/ui/coercion/coerce-expect-unsized-ascribed.stderr @@ -28,7 +28,7 @@ LL | let _ = box match true { true => [1, 2, 3], false => [1, 3, 4] }: Box<[ error[E0308]: mismatched types --> $DIR/coerce-expect-unsized-ascribed.rs:13:13 | -LL | let _ = box { |x| (x as u8) }: Box _>; +LL | let _ = box { |x| (x as u8) }: Box _>; | ^^^^^^^^^^^^^^^^^^^^^ expected trait std::ops::Fn, found closure | = note: expected type `std::boxed::Box u8>` @@ -37,7 +37,7 @@ LL | let _ = box { |x| (x as u8) }: Box _>; error[E0308]: mismatched types --> $DIR/coerce-expect-unsized-ascribed.rs:14:13 | -LL | let _ = box if true { false } else { true }: Box; +LL | let _ = box if true { false } else { true }: Box; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected trait std::fmt::Debug, found bool | = note: expected type `std::boxed::Box` @@ -46,7 +46,7 @@ LL | let _ = box if true { false } else { true }: Box; error[E0308]: mismatched types --> $DIR/coerce-expect-unsized-ascribed.rs:15:13 | -LL | let _ = box match true { true => 'a', false => 'b' }: Box; +LL | let _ = box match true { true => 'a', false => 'b' }: Box; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected trait std::fmt::Debug, found char | = note: expected type `std::boxed::Box` @@ -82,7 +82,7 @@ LL | let _ = &match true { true => [1, 2, 3], false => [1, 3, 4] }: &[i32]; error[E0308]: mismatched types --> $DIR/coerce-expect-unsized-ascribed.rs:21:13 | -LL | let _ = &{ |x| (x as u8) }: &Fn(i32) -> _; +LL | let _ = &{ |x| (x as u8) }: &dyn Fn(i32) -> _; | ^^^^^^^^^^^^^^^^^^ expected trait std::ops::Fn, found closure | = note: expected type `&dyn std::ops::Fn(i32) -> u8` @@ -91,7 +91,7 @@ LL | let _ = &{ |x| (x as u8) }: &Fn(i32) -> _; error[E0308]: mismatched types --> $DIR/coerce-expect-unsized-ascribed.rs:22:13 | -LL | let _ = &if true { false } else { true }: &Debug; +LL | let _ = &if true { false } else { true }: &dyn Debug; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected trait std::fmt::Debug, found bool | = note: expected type `&dyn std::fmt::Debug` @@ -100,7 +100,7 @@ LL | let _ = &if true { false } else { true }: &Debug; error[E0308]: mismatched types --> $DIR/coerce-expect-unsized-ascribed.rs:23:13 | -LL | let _ = &match true { true => 'a', false => 'b' }: &Debug; +LL | let _ = &match true { true => 'a', false => 'b' }: &dyn Debug; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected trait std::fmt::Debug, found char | = note: expected type `&dyn std::fmt::Debug` @@ -118,7 +118,7 @@ LL | let _ = Box::new([1, 2, 3]): Box<[i32]>; error[E0308]: mismatched types --> $DIR/coerce-expect-unsized-ascribed.rs:26:13 | -LL | let _ = Box::new(|x| (x as u8)): Box _>; +LL | let _ = Box::new(|x| (x as u8)): Box _>; | ^^^^^^^^^^^^^^^^^^^^^^^ expected trait std::ops::Fn, found closure | = note: expected type `std::boxed::Box _>` diff --git a/src/test/ui/coherence/coherence-impl-trait-for-trait-object-safe.old.stderr b/src/test/ui/coherence/coherence-impl-trait-for-trait-object-safe.old.stderr index b48f6bbfb9417..c38d7456a9952 100644 --- a/src/test/ui/coherence/coherence-impl-trait-for-trait-object-safe.old.stderr +++ b/src/test/ui/coherence/coherence-impl-trait-for-trait-object-safe.old.stderr @@ -1,7 +1,7 @@ error[E0038]: the trait `NotObjectSafe` cannot be made into an object --> $DIR/coherence-impl-trait-for-trait-object-safe.rs:11:6 | -LL | impl NotObjectSafe for NotObjectSafe { } +LL | impl NotObjectSafe for dyn NotObjectSafe { } | ^^^^^^^^^^^^^ the trait `NotObjectSafe` cannot be made into an object | = note: method `eq` references the `Self` type in its arguments or return type diff --git a/src/test/ui/coherence/coherence-impl-trait-for-trait-object-safe.re.stderr b/src/test/ui/coherence/coherence-impl-trait-for-trait-object-safe.re.stderr index b48f6bbfb9417..c38d7456a9952 100644 --- a/src/test/ui/coherence/coherence-impl-trait-for-trait-object-safe.re.stderr +++ b/src/test/ui/coherence/coherence-impl-trait-for-trait-object-safe.re.stderr @@ -1,7 +1,7 @@ error[E0038]: the trait `NotObjectSafe` cannot be made into an object --> $DIR/coherence-impl-trait-for-trait-object-safe.rs:11:6 | -LL | impl NotObjectSafe for NotObjectSafe { } +LL | impl NotObjectSafe for dyn NotObjectSafe { } | ^^^^^^^^^^^^^ the trait `NotObjectSafe` cannot be made into an object | = note: method `eq` references the `Self` type in its arguments or return type diff --git a/src/test/ui/coherence/coherence-impl-trait-for-trait-object-safe.rs b/src/test/ui/coherence/coherence-impl-trait-for-trait-object-safe.rs index 803e8fc6bca64..b4c88e937830e 100644 --- a/src/test/ui/coherence/coherence-impl-trait-for-trait-object-safe.rs +++ b/src/test/ui/coherence/coherence-impl-trait-for-trait-object-safe.rs @@ -8,7 +8,7 @@ // If the trait is not object-safe, we give a more tailored message // because we're such schnuckels: trait NotObjectSafe { fn eq(&self, other: Self); } -impl NotObjectSafe for NotObjectSafe { } +impl NotObjectSafe for dyn NotObjectSafe { } //[old]~^ ERROR E0038 //[re]~^^ ERROR E0038 diff --git a/src/test/ui/coherence/coherence-impl-trait-for-trait.old.stderr b/src/test/ui/coherence/coherence-impl-trait-for-trait.old.stderr index 324747603f911..4819ce9260e70 100644 --- a/src/test/ui/coherence/coherence-impl-trait-for-trait.old.stderr +++ b/src/test/ui/coherence/coherence-impl-trait-for-trait.old.stderr @@ -1,20 +1,20 @@ error[E0371]: the object type `(dyn Baz + 'static)` automatically implements the trait `Foo` --> $DIR/coherence-impl-trait-for-trait.rs:13:1 | -LL | impl Foo for Baz { } - | ^^^^^^^^^^^^^^^^ `(dyn Baz + 'static)` automatically implements trait `Foo` +LL | impl Foo for dyn Baz { } + | ^^^^^^^^^^^^^^^^^^^^ `(dyn Baz + 'static)` automatically implements trait `Foo` error[E0371]: the object type `(dyn Baz + 'static)` automatically implements the trait `Bar` --> $DIR/coherence-impl-trait-for-trait.rs:16:1 | -LL | impl Bar for Baz { } - | ^^^^^^^^^^^^^^^^ `(dyn Baz + 'static)` automatically implements trait `Bar` +LL | impl Bar for dyn Baz { } + | ^^^^^^^^^^^^^^^^^^^^ `(dyn Baz + 'static)` automatically implements trait `Bar` error[E0371]: the object type `(dyn Baz + 'static)` automatically implements the trait `Baz` --> $DIR/coherence-impl-trait-for-trait.rs:19:1 | -LL | impl Baz for Baz { } - | ^^^^^^^^^^^^^^^^ `(dyn Baz + 'static)` automatically implements trait `Baz` +LL | impl Baz for dyn Baz { } + | ^^^^^^^^^^^^^^^^^^^^ `(dyn Baz + 'static)` automatically implements trait `Baz` error: aborting due to 3 previous errors diff --git a/src/test/ui/coherence/coherence-impl-trait-for-trait.re.stderr b/src/test/ui/coherence/coherence-impl-trait-for-trait.re.stderr index 324747603f911..4819ce9260e70 100644 --- a/src/test/ui/coherence/coherence-impl-trait-for-trait.re.stderr +++ b/src/test/ui/coherence/coherence-impl-trait-for-trait.re.stderr @@ -1,20 +1,20 @@ error[E0371]: the object type `(dyn Baz + 'static)` automatically implements the trait `Foo` --> $DIR/coherence-impl-trait-for-trait.rs:13:1 | -LL | impl Foo for Baz { } - | ^^^^^^^^^^^^^^^^ `(dyn Baz + 'static)` automatically implements trait `Foo` +LL | impl Foo for dyn Baz { } + | ^^^^^^^^^^^^^^^^^^^^ `(dyn Baz + 'static)` automatically implements trait `Foo` error[E0371]: the object type `(dyn Baz + 'static)` automatically implements the trait `Bar` --> $DIR/coherence-impl-trait-for-trait.rs:16:1 | -LL | impl Bar for Baz { } - | ^^^^^^^^^^^^^^^^ `(dyn Baz + 'static)` automatically implements trait `Bar` +LL | impl Bar for dyn Baz { } + | ^^^^^^^^^^^^^^^^^^^^ `(dyn Baz + 'static)` automatically implements trait `Bar` error[E0371]: the object type `(dyn Baz + 'static)` automatically implements the trait `Baz` --> $DIR/coherence-impl-trait-for-trait.rs:19:1 | -LL | impl Baz for Baz { } - | ^^^^^^^^^^^^^^^^ `(dyn Baz + 'static)` automatically implements trait `Baz` +LL | impl Baz for dyn Baz { } + | ^^^^^^^^^^^^^^^^^^^^ `(dyn Baz + 'static)` automatically implements trait `Baz` error: aborting due to 3 previous errors diff --git a/src/test/ui/coherence/coherence-impl-trait-for-trait.rs b/src/test/ui/coherence/coherence-impl-trait-for-trait.rs index dcaf564fdecfe..3ce3dca0660b9 100644 --- a/src/test/ui/coherence/coherence-impl-trait-for-trait.rs +++ b/src/test/ui/coherence/coherence-impl-trait-for-trait.rs @@ -10,18 +10,18 @@ trait Bar: Foo { } trait Baz: Bar { } // Supertraits of Baz are not legal: -impl Foo for Baz { } +impl Foo for dyn Baz { } //[old]~^ ERROR E0371 //[re]~^^ ERROR E0371 -impl Bar for Baz { } +impl Bar for dyn Baz { } //[old]~^ ERROR E0371 //[re]~^^ ERROR E0371 -impl Baz for Baz { } +impl Baz for dyn Baz { } //[old]~^ ERROR E0371 //[re]~^^ ERROR E0371 // But other random traits are: trait Other { } -impl Other for Baz { } // OK, Other not a supertrait of Baz +impl Other for dyn Baz { } // OK, Other not a supertrait of Baz fn main() { } diff --git a/src/test/ui/confuse-field-and-method/issue-2392.rs b/src/test/ui/confuse-field-and-method/issue-2392.rs index c242b6c2c20a2..8aef091fe3186 100644 --- a/src/test/ui/confuse-field-and-method/issue-2392.rs +++ b/src/test/ui/confuse-field-and-method/issue-2392.rs @@ -14,7 +14,7 @@ struct Obj where F: FnOnce() -> u32 { } struct BoxedObj { - boxed_closure: Box u32>, + boxed_closure: Box u32>, } struct Wrapper where F: FnMut() -> u32 { @@ -25,8 +25,8 @@ fn func() -> u32 { 0 } -fn check_expression() -> Obj u32>> { - Obj { closure: Box::new(|| 42_u32) as Box u32>, not_closure: 42 } +fn check_expression() -> Obj u32>> { + Obj { closure: Box::new(|| 42_u32) as Box u32>, not_closure: 42 } } fn main() { @@ -44,7 +44,7 @@ fn main() { let boxed_fn = BoxedObj { boxed_closure: Box::new(func) }; boxed_fn.boxed_closure();//~ ERROR no method named `boxed_closure` found - let boxed_closure = BoxedObj { boxed_closure: Box::new(|| 42_u32) as Box u32> }; + let boxed_closure = BoxedObj { boxed_closure: Box::new(|| 42_u32) as Box u32> }; boxed_closure.boxed_closure();//~ ERROR no method named `boxed_closure` found // test expression writing in the notes diff --git a/src/test/ui/confuse-field-and-method/issue-32128.rs b/src/test/ui/confuse-field-and-method/issue-32128.rs index 02c6838d41941..5a024aa4b6749 100644 --- a/src/test/ui/confuse-field-and-method/issue-32128.rs +++ b/src/test/ui/confuse-field-and-method/issue-32128.rs @@ -1,5 +1,5 @@ struct Example { - example: Box i32> + example: Box i32> } fn main() { diff --git a/src/test/ui/consts/const-eval/const_transmute.rs b/src/test/ui/consts/const-eval/const_transmute.rs index e4f7fb155ab90..4726f9dde3a84 100644 --- a/src/test/ui/consts/const-eval/const_transmute.rs +++ b/src/test/ui/consts/const-eval/const_transmute.rs @@ -41,7 +41,7 @@ struct VTable { bar: for<'a> fn(&'a Foo) -> u32, } -const FOO: &Bar = &Foo { foo: 128, bar: false }; +const FOO: &dyn Bar = &Foo { foo: 128, bar: false }; const G: Fat = unsafe { Transmute { t: FOO }.u }; const F: Option fn(&'a mut Foo)> = G.1.drop; const H: for<'a> fn(&'a Foo) -> u32 = G.1.bar; diff --git a/src/test/ui/consts/const-eval/issue-53401.rs b/src/test/ui/consts/const-eval/issue-53401.rs index 89834aa94fc51..e8ac5a90880ce 100644 --- a/src/test/ui/consts/const-eval/issue-53401.rs +++ b/src/test/ui/consts/const-eval/issue-53401.rs @@ -1,6 +1,6 @@ // compile-pass -pub const STATIC_TRAIT: &Test = &(); +pub const STATIC_TRAIT: &dyn Test = &(); fn main() {} diff --git a/src/test/ui/consts/const-eval/ub-upvars.rs b/src/test/ui/consts/const-eval/ub-upvars.rs index 9b7bca6b72d61..0a427cd8857e8 100644 --- a/src/test/ui/consts/const-eval/ub-upvars.rs +++ b/src/test/ui/consts/const-eval/ub-upvars.rs @@ -3,7 +3,7 @@ use std::mem; -const BAD_UPVAR: &FnOnce() = &{ //~ ERROR it is undefined behavior to use this value +const BAD_UPVAR: &dyn FnOnce() = &{ //~ ERROR it is undefined behavior to use this value let bad_ref: &'static u16 = unsafe { mem::transmute(0usize) }; let another_var = 13; move || { let _ = bad_ref; let _ = another_var; } diff --git a/src/test/ui/consts/const-eval/ub-upvars.stderr b/src/test/ui/consts/const-eval/ub-upvars.stderr index 21d2847db1e8a..f8273ba902a88 100644 --- a/src/test/ui/consts/const-eval/ub-upvars.stderr +++ b/src/test/ui/consts/const-eval/ub-upvars.stderr @@ -1,7 +1,7 @@ error[E0080]: it is undefined behavior to use this value --> $DIR/ub-upvars.rs:6:1 | -LL | / const BAD_UPVAR: &FnOnce() = &{ +LL | / const BAD_UPVAR: &dyn FnOnce() = &{ LL | | let bad_ref: &'static u16 = unsafe { mem::transmute(0usize) }; LL | | let another_var = 13; LL | | move || { let _ = bad_ref; let _ = another_var; } diff --git a/src/test/ui/consts/const-eval/union-ub-fat-ptr.rs b/src/test/ui/consts/const-eval/union-ub-fat-ptr.rs index 13489c50a1223..d5405f3441fec 100644 --- a/src/test/ui/consts/const-eval/union-ub-fat-ptr.rs +++ b/src/test/ui/consts/const-eval/union-ub-fat-ptr.rs @@ -59,7 +59,7 @@ union DynTransmute { repr: DynRepr, repr2: DynRepr2, bad: BadDynRepr, - rust: &'static Trait, + rust: &'static dyn Trait, } trait Trait {} @@ -94,17 +94,17 @@ const C3: &[u8] = unsafe { SliceTransmute { bad: BadSliceRepr { ptr: &42, len: & //~^ ERROR it is undefined behavior to use this value // bad trait object -const D: &Trait = unsafe { DynTransmute { repr: DynRepr { ptr: &92, vtable: &3 } }.rust}; +const D: &dyn Trait = unsafe { DynTransmute { repr: DynRepr { ptr: &92, vtable: &3 } }.rust}; //~^ ERROR it is undefined behavior to use this value // bad trait object -const E: &Trait = unsafe { DynTransmute { repr2: DynRepr2 { ptr: &92, vtable: &3 } }.rust}; +const E: &dyn Trait = unsafe { DynTransmute { repr2: DynRepr2 { ptr: &92, vtable: &3 } }.rust}; //~^ ERROR it is undefined behavior to use this value // bad trait object -const F: &Trait = unsafe { DynTransmute { bad: BadDynRepr { ptr: &92, vtable: 3 } }.rust}; +const F: &dyn Trait = unsafe { DynTransmute { bad: BadDynRepr { ptr: &92, vtable: 3 } }.rust}; //~^ ERROR it is undefined behavior to use this value // bad data *inside* the trait object -const G: &Trait = &unsafe { BoolTransmute { val: 3 }.bl }; +const G: &dyn Trait = &unsafe { BoolTransmute { val: 3 }.bl }; //~^ ERROR it is undefined behavior to use this value // bad data *inside* the slice diff --git a/src/test/ui/consts/const-eval/union-ub-fat-ptr.stderr b/src/test/ui/consts/const-eval/union-ub-fat-ptr.stderr index 761a5fc4445ed..5048a97d19514 100644 --- a/src/test/ui/consts/const-eval/union-ub-fat-ptr.stderr +++ b/src/test/ui/consts/const-eval/union-ub-fat-ptr.stderr @@ -41,32 +41,32 @@ LL | const C3: &[u8] = unsafe { SliceTransmute { bad: BadSliceRepr { ptr: &42, l error[E0080]: it is undefined behavior to use this value --> $DIR/union-ub-fat-ptr.rs:97:1 | -LL | const D: &Trait = unsafe { DynTransmute { repr: DynRepr { ptr: &92, vtable: &3 } }.rust}; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered invalid drop fn in vtable +LL | const D: &dyn Trait = unsafe { DynTransmute { repr: DynRepr { ptr: &92, vtable: &3 } }.rust}; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered invalid drop fn in vtable | = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rust compiler repository if you believe it should not be considered undefined behavior error[E0080]: it is undefined behavior to use this value --> $DIR/union-ub-fat-ptr.rs:100:1 | -LL | const E: &Trait = unsafe { DynTransmute { repr2: DynRepr2 { ptr: &92, vtable: &3 } }.rust}; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered invalid drop fn in vtable +LL | const E: &dyn Trait = unsafe { DynTransmute { repr2: DynRepr2 { ptr: &92, vtable: &3 } }.rust}; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered invalid drop fn in vtable | = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rust compiler repository if you believe it should not be considered undefined behavior error[E0080]: it is undefined behavior to use this value --> $DIR/union-ub-fat-ptr.rs:103:1 | -LL | const F: &Trait = unsafe { DynTransmute { bad: BadDynRepr { ptr: &92, vtable: 3 } }.rust}; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered non-pointer vtable in fat pointer +LL | const F: &dyn Trait = unsafe { DynTransmute { bad: BadDynRepr { ptr: &92, vtable: 3 } }.rust}; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered non-pointer vtable in fat pointer | = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rust compiler repository if you believe it should not be considered undefined behavior error[E0080]: it is undefined behavior to use this value --> $DIR/union-ub-fat-ptr.rs:107:1 | -LL | const G: &Trait = &unsafe { BoolTransmute { val: 3 }.bl }; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered 3 at .., but expected something less or equal to 1 +LL | const G: &dyn Trait = &unsafe { BoolTransmute { val: 3 }.bl }; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered 3 at .., but expected something less or equal to 1 | = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rust compiler repository if you believe it should not be considered undefined behavior diff --git a/src/test/ui/consts/const-unsized.rs b/src/test/ui/consts/const-unsized.rs index e20ded68ceb96..319b8ef97deae 100644 --- a/src/test/ui/consts/const-unsized.rs +++ b/src/test/ui/consts/const-unsized.rs @@ -1,12 +1,12 @@ use std::fmt::Debug; -const CONST_0: Debug+Sync = *(&0 as &(Debug+Sync)); +const CONST_0: dyn Debug + Sync = *(&0 as &(dyn Debug + Sync)); //~^ ERROR the size for values of type const CONST_FOO: str = *"foo"; //~^ ERROR the size for values of type -static STATIC_1: Debug+Sync = *(&1 as &(Debug+Sync)); +static STATIC_1: dyn Debug + Sync = *(&1 as &(dyn Debug + Sync)); //~^ ERROR the size for values of type static STATIC_BAR: str = *"bar"; diff --git a/src/test/ui/consts/const-unsized.stderr b/src/test/ui/consts/const-unsized.stderr index 0f996fcd94340..beeea87bfb1d3 100644 --- a/src/test/ui/consts/const-unsized.stderr +++ b/src/test/ui/consts/const-unsized.stderr @@ -1,8 +1,8 @@ error[E0277]: the size for values of type `(dyn std::fmt::Debug + std::marker::Sync + 'static)` cannot be known at compilation time --> $DIR/const-unsized.rs:3:16 | -LL | const CONST_0: Debug+Sync = *(&0 as &(Debug+Sync)); - | ^^^^^^^^^^ doesn't have a size known at compile-time +LL | const CONST_0: dyn Debug + Sync = *(&0 as &(dyn Debug + Sync)); + | ^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time | = help: the trait `std::marker::Sized` is not implemented for `(dyn std::fmt::Debug + std::marker::Sync + 'static)` = note: to learn more, visit @@ -19,8 +19,8 @@ LL | const CONST_FOO: str = *"foo"; error[E0277]: the size for values of type `(dyn std::fmt::Debug + std::marker::Sync + 'static)` cannot be known at compilation time --> $DIR/const-unsized.rs:9:18 | -LL | static STATIC_1: Debug+Sync = *(&1 as &(Debug+Sync)); - | ^^^^^^^^^^ doesn't have a size known at compile-time +LL | static STATIC_1: dyn Debug + Sync = *(&1 as &(dyn Debug + Sync)); + | ^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time | = help: the trait `std::marker::Sized` is not implemented for `(dyn std::fmt::Debug + std::marker::Sync + 'static)` = note: to learn more, visit diff --git a/src/test/ui/consts/min_const_fn/min_const_fn.nll.stderr b/src/test/ui/consts/min_const_fn/min_const_fn.nll.stderr index 8d962384a121a..7a10c469c51a0 100644 --- a/src/test/ui/consts/min_const_fn/min_const_fn.nll.stderr +++ b/src/test/ui/consts/min_const_fn/min_const_fn.nll.stderr @@ -298,8 +298,8 @@ LL | const fn no_dyn_trait_ret() -> &'static dyn std::fmt::Debug { &() } error[E0723]: trait bounds other than `Sized` on const fn parameters are unstable --> $DIR/min_const_fn.rs:144:41 | -LL | const fn really_no_traits_i_mean_it() { (&() as &std::fmt::Debug, ()).1 } - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | const fn really_no_traits_i_mean_it() { (&() as &dyn std::fmt::Debug, ()).1 } + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: for more information, see issue https://github.com/rust-lang/rust/issues/57563 = help: add #![feature(const_fn)] to the crate attributes to enable diff --git a/src/test/ui/consts/min_const_fn/min_const_fn.rs b/src/test/ui/consts/min_const_fn/min_const_fn.rs index 783c79005ae37..96b6057c8fd2d 100644 --- a/src/test/ui/consts/min_const_fn/min_const_fn.rs +++ b/src/test/ui/consts/min_const_fn/min_const_fn.rs @@ -141,7 +141,7 @@ const fn no_dyn_trait_ret() -> &'static dyn std::fmt::Debug { &() } const fn no_unsafe() { unsafe {} } -const fn really_no_traits_i_mean_it() { (&() as &std::fmt::Debug, ()).1 } +const fn really_no_traits_i_mean_it() { (&() as &dyn std::fmt::Debug, ()).1 } //~^ ERROR trait bounds other than `Sized` const fn no_fn_ptrs(_x: fn()) {} diff --git a/src/test/ui/consts/min_const_fn/min_const_fn.stderr b/src/test/ui/consts/min_const_fn/min_const_fn.stderr index 93b57bc24a82f..e388b443d2344 100644 --- a/src/test/ui/consts/min_const_fn/min_const_fn.stderr +++ b/src/test/ui/consts/min_const_fn/min_const_fn.stderr @@ -302,8 +302,8 @@ LL | const fn no_dyn_trait_ret() -> &'static dyn std::fmt::Debug { &() } error[E0723]: trait bounds other than `Sized` on const fn parameters are unstable --> $DIR/min_const_fn.rs:144:41 | -LL | const fn really_no_traits_i_mean_it() { (&() as &std::fmt::Debug, ()).1 } - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | const fn really_no_traits_i_mean_it() { (&() as &dyn std::fmt::Debug, ()).1 } + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: for more information, see issue https://github.com/rust-lang/rust/issues/57563 = help: add #![feature(const_fn)] to the crate attributes to enable diff --git a/src/test/ui/cross/cross-borrow-trait.rs b/src/test/ui/cross/cross-borrow-trait.rs index d8d7537f24a61..274cdad75ec2a 100644 --- a/src/test/ui/cross/cross-borrow-trait.rs +++ b/src/test/ui/cross/cross-borrow-trait.rs @@ -6,8 +6,8 @@ trait Trait { fn foo(&self) {} } impl Trait for Foo {} pub fn main() { - let x: Box = Box::new(Foo); - let _y: &Trait = x; //~ ERROR E0308 - //~| expected type `&dyn Trait` - //~| found type `std::boxed::Box` + let x: Box = Box::new(Foo); + let _y: &dyn Trait = x; //~ ERROR E0308 + //~| expected type `&dyn Trait` + //~| found type `std::boxed::Box` } diff --git a/src/test/ui/cross/cross-borrow-trait.stderr b/src/test/ui/cross/cross-borrow-trait.stderr index b35f59658c042..ada1c0204eb01 100644 --- a/src/test/ui/cross/cross-borrow-trait.stderr +++ b/src/test/ui/cross/cross-borrow-trait.stderr @@ -1,11 +1,11 @@ error[E0308]: mismatched types - --> $DIR/cross-borrow-trait.rs:10:22 + --> $DIR/cross-borrow-trait.rs:10:26 | -LL | let _y: &Trait = x; - | ^ - | | - | expected &dyn Trait, found struct `std::boxed::Box` - | help: consider borrowing here: `&x` +LL | let _y: &dyn Trait = x; + | ^ + | | + | expected &dyn Trait, found struct `std::boxed::Box` + | help: consider borrowing here: `&x` | = note: expected type `&dyn Trait` found type `std::boxed::Box` diff --git a/src/test/ui/custom-test-frameworks-simple.rs b/src/test/ui/custom-test-frameworks-simple.rs index a8aac6ec1427a..aee0040ef4de4 100644 --- a/src/test/ui/custom-test-frameworks-simple.rs +++ b/src/test/ui/custom-test-frameworks-simple.rs @@ -5,7 +5,7 @@ #![test_runner(crate::foo_runner)] #[cfg(test)] -fn foo_runner(ts: &[&Fn(usize)->()]) { +fn foo_runner(ts: &[&dyn Fn(usize)->()]) { for (i, t) in ts.iter().enumerate() { t(i); } diff --git a/src/test/ui/cycle-trait/cycle-trait-default-type-trait.rs b/src/test/ui/cycle-trait/cycle-trait-default-type-trait.rs index d658753eb242b..6175b7df1107a 100644 --- a/src/test/ui/cycle-trait/cycle-trait-default-type-trait.rs +++ b/src/test/ui/cycle-trait/cycle-trait-default-type-trait.rs @@ -1,7 +1,7 @@ // Test a cycle where a type parameter on a trait has a default that // again references the trait. -trait Foo> { +trait Foo> { //~^ ERROR cycle detected } diff --git a/src/test/ui/cycle-trait/cycle-trait-default-type-trait.stderr b/src/test/ui/cycle-trait/cycle-trait-default-type-trait.stderr index aa45462a52e41..e89d25742a0ac 100644 --- a/src/test/ui/cycle-trait/cycle-trait-default-type-trait.stderr +++ b/src/test/ui/cycle-trait/cycle-trait-default-type-trait.stderr @@ -1,15 +1,15 @@ error[E0391]: cycle detected when processing `Foo::X` - --> $DIR/cycle-trait-default-type-trait.rs:4:19 + --> $DIR/cycle-trait-default-type-trait.rs:4:23 | -LL | trait Foo> { - | ^^^ +LL | trait Foo> { + | ^^^ | = note: ...which again requires processing `Foo::X`, completing the cycle note: cycle used when collecting item types in top-level module --> $DIR/cycle-trait-default-type-trait.rs:4:1 | -LL | trait Foo> { - | ^^^^^^^^^^^^^^^^^^^^^^^ +LL | trait Foo> { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/destructure-trait-ref.rs b/src/test/ui/destructure-trait-ref.rs index 66be493cb1f97..71cf37ca84951 100644 --- a/src/test/ui/destructure-trait-ref.rs +++ b/src/test/ui/destructure-trait-ref.rs @@ -18,27 +18,28 @@ fn main() { // if n > m, it's a type mismatch error. // n < m - let &x = &(&1isize as &T); - let &x = &&(&1isize as &T); - let &&x = &&(&1isize as &T); + let &x = &(&1isize as &dyn T); + let &x = &&(&1isize as &dyn T); + let &&x = &&(&1isize as &dyn T); // n == m - let &x = &1isize as &T; //~ ERROR type `&dyn T` cannot be dereferenced - let &&x = &(&1isize as &T); //~ ERROR type `&dyn T` cannot be dereferenced - let box x = box 1isize as Box; //~ ERROR type `std::boxed::Box` cannot be dereferenced + let &x = &1isize as &dyn T; //~ ERROR type `&dyn T` cannot be dereferenced + let &&x = &(&1isize as &dyn T); //~ ERROR type `&dyn T` cannot be dereferenced + let box x = box 1isize as Box; + //~^ ERROR type `std::boxed::Box` cannot be dereferenced // n > m - let &&x = &1isize as &T; + let &&x = &1isize as &dyn T; //~^ ERROR mismatched types //~| expected type `dyn T` //~| found type `&_` //~| expected trait T, found reference - let &&&x = &(&1isize as &T); + let &&&x = &(&1isize as &dyn T); //~^ ERROR mismatched types //~| expected type `dyn T` //~| found type `&_` //~| expected trait T, found reference - let box box x = box 1isize as Box; + let box box x = box 1isize as Box; //~^ ERROR mismatched types //~| expected type `dyn T` //~| found type `std::boxed::Box<_>` diff --git a/src/test/ui/destructure-trait-ref.stderr b/src/test/ui/destructure-trait-ref.stderr index bc3013b78b38c..d3ad21eb24ffb 100644 --- a/src/test/ui/destructure-trait-ref.stderr +++ b/src/test/ui/destructure-trait-ref.stderr @@ -1,25 +1,25 @@ error[E0033]: type `&dyn T` cannot be dereferenced --> $DIR/destructure-trait-ref.rs:26:9 | -LL | let &x = &1isize as &T; +LL | let &x = &1isize as &dyn T; | ^^ type `&dyn T` cannot be dereferenced error[E0033]: type `&dyn T` cannot be dereferenced --> $DIR/destructure-trait-ref.rs:27:10 | -LL | let &&x = &(&1isize as &T); +LL | let &&x = &(&1isize as &dyn T); | ^^ type `&dyn T` cannot be dereferenced error[E0033]: type `std::boxed::Box` cannot be dereferenced --> $DIR/destructure-trait-ref.rs:28:9 | -LL | let box x = box 1isize as Box; +LL | let box x = box 1isize as Box; | ^^^^^ type `std::boxed::Box` cannot be dereferenced error[E0308]: mismatched types - --> $DIR/destructure-trait-ref.rs:31:10 + --> $DIR/destructure-trait-ref.rs:32:10 | -LL | let &&x = &1isize as &T; +LL | let &&x = &1isize as &dyn T; | ^^ | | | expected trait T, found reference @@ -29,9 +29,9 @@ LL | let &&x = &1isize as &T; found type `&_` error[E0308]: mismatched types - --> $DIR/destructure-trait-ref.rs:36:11 + --> $DIR/destructure-trait-ref.rs:37:11 | -LL | let &&&x = &(&1isize as &T); +LL | let &&&x = &(&1isize as &dyn T); | ^^ | | | expected trait T, found reference @@ -41,9 +41,9 @@ LL | let &&&x = &(&1isize as &T); found type `&_` error[E0308]: mismatched types - --> $DIR/destructure-trait-ref.rs:41:13 + --> $DIR/destructure-trait-ref.rs:42:13 | -LL | let box box x = box 1isize as Box; +LL | let box box x = box 1isize as Box; | ^^^^^ expected trait T, found struct `std::boxed::Box` | = note: expected type `dyn T` diff --git a/src/test/ui/did_you_mean/E0178.rs b/src/test/ui/did_you_mean/E0178.rs index aad95dc2c20e0..095df640c38f2 100644 --- a/src/test/ui/did_you_mean/E0178.rs +++ b/src/test/ui/did_you_mean/E0178.rs @@ -1,3 +1,5 @@ +#![allow(bare_trait_objects)] + trait Foo {} struct Bar<'a> { diff --git a/src/test/ui/did_you_mean/E0178.stderr b/src/test/ui/did_you_mean/E0178.stderr index 44e6ddd0eac8f..58ac6e90823f6 100644 --- a/src/test/ui/did_you_mean/E0178.stderr +++ b/src/test/ui/did_you_mean/E0178.stderr @@ -1,23 +1,23 @@ error[E0178]: expected a path on the left-hand side of `+`, not `&'a Foo` - --> $DIR/E0178.rs:4:8 + --> $DIR/E0178.rs:6:8 | LL | w: &'a Foo + Copy, | ^^^^^^^^^^^^^^ help: try adding parentheses: `&'a (Foo + Copy)` error[E0178]: expected a path on the left-hand side of `+`, not `&'a Foo` - --> $DIR/E0178.rs:5:8 + --> $DIR/E0178.rs:7:8 | LL | x: &'a Foo + 'a, | ^^^^^^^^^^^^ help: try adding parentheses: `&'a (Foo + 'a)` error[E0178]: expected a path on the left-hand side of `+`, not `&'a mut Foo` - --> $DIR/E0178.rs:6:8 + --> $DIR/E0178.rs:8:8 | LL | y: &'a mut Foo + 'a, | ^^^^^^^^^^^^^^^^ help: try adding parentheses: `&'a mut (Foo + 'a)` error[E0178]: expected a path on the left-hand side of `+`, not `fn() -> Foo` - --> $DIR/E0178.rs:7:8 + --> $DIR/E0178.rs:9:8 | LL | z: fn() -> Foo + 'a, | ^^^^^^^^^^^^^^^^ perhaps you forgot parentheses? diff --git a/src/test/ui/did_you_mean/bad-assoc-ty.rs b/src/test/ui/did_you_mean/bad-assoc-ty.rs index 85e36f887be08..fccfb7911cecf 100644 --- a/src/test/ui/did_you_mean/bad-assoc-ty.rs +++ b/src/test/ui/did_you_mean/bad-assoc-ty.rs @@ -24,7 +24,7 @@ type F = &'static (u8)::AssocTy; // Qualified paths cannot appear in bounds, so the recovery // should apply to the whole sum and not `(Send)`. -type G = 'static + (Send)::AssocTy; +type G = dyn 'static + (Send)::AssocTy; //~^ ERROR missing angle brackets in associated item path //~| ERROR ambiguous associated type diff --git a/src/test/ui/did_you_mean/bad-assoc-ty.stderr b/src/test/ui/did_you_mean/bad-assoc-ty.stderr index 8c694f9d42b3e..0ae64edcc0546 100644 --- a/src/test/ui/did_you_mean/bad-assoc-ty.stderr +++ b/src/test/ui/did_you_mean/bad-assoc-ty.stderr @@ -37,8 +37,8 @@ LL | type F = &'static (u8)::AssocTy; error: missing angle brackets in associated item path --> $DIR/bad-assoc-ty.rs:27:10 | -LL | type G = 'static + (Send)::AssocTy; - | ^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `<'static + (Send)>::AssocTy` +LL | type G = dyn 'static + (Send)::AssocTy; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `::AssocTy` error: missing angle brackets in associated item path --> $DIR/bad-assoc-ty.rs:44:10 @@ -94,8 +94,8 @@ LL | type F = &'static (u8)::AssocTy; error[E0223]: ambiguous associated type --> $DIR/bad-assoc-ty.rs:27:10 | -LL | type G = 'static + (Send)::AssocTy; - | ^^^^^^^^^^^^^^^^^^^^^^^^^ help: use fully-qualified syntax: `<(dyn std::marker::Send + 'static) as Trait>::AssocTy` +LL | type G = dyn 'static + (Send)::AssocTy; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use fully-qualified syntax: `<(dyn std::marker::Send + 'static) as Trait>::AssocTy` error[E0223]: ambiguous associated type --> $DIR/bad-assoc-ty.rs:33:10 diff --git a/src/test/ui/did_you_mean/issue-40006.rs b/src/test/ui/did_you_mean/issue-40006.rs index 75ea02b6a9d4a..a1184f757e2ab 100644 --- a/src/test/ui/did_you_mean/issue-40006.rs +++ b/src/test/ui/did_you_mean/issue-40006.rs @@ -1,4 +1,4 @@ -impl X { //~ ERROR cannot be made into an object +impl dyn X { //~ ERROR cannot be made into an object //~^ ERROR missing Y } diff --git a/src/test/ui/did_you_mean/issue-40006.stderr b/src/test/ui/did_you_mean/issue-40006.stderr index f6f7fe5fa38c3..87e48cd1e1cd9 100644 --- a/src/test/ui/did_you_mean/issue-40006.stderr +++ b/src/test/ui/did_you_mean/issue-40006.stderr @@ -1,8 +1,8 @@ error: missing `fn`, `type`, or `const` for impl-item declaration - --> $DIR/issue-40006.rs:1:9 + --> $DIR/issue-40006.rs:1:13 | -LL | impl X { - | _________^ +LL | impl dyn X { + | _____________^ LL | | LL | | Y | |____^ missing `fn`, `type`, or `const` @@ -59,8 +59,8 @@ LL | pub hello_method(&self) { error[E0038]: the trait `X` cannot be made into an object --> $DIR/issue-40006.rs:1:6 | -LL | impl X { - | ^ the trait `X` cannot be made into an object +LL | impl dyn X { + | ^^^^^ the trait `X` cannot be made into an object | = note: method `xxx` has no receiver diff --git a/src/test/ui/did_you_mean/trait-object-reference-without-parens-suggestion.rs b/src/test/ui/did_you_mean/trait-object-reference-without-parens-suggestion.rs index a05227416cfd7..c9a097d3610a1 100644 --- a/src/test/ui/did_you_mean/trait-object-reference-without-parens-suggestion.rs +++ b/src/test/ui/did_you_mean/trait-object-reference-without-parens-suggestion.rs @@ -1,3 +1,5 @@ +#![allow(bare_trait_objects)] + fn main() { let _: &Copy + 'static; //~ ERROR expected a path //~^ ERROR cannot be made into an object diff --git a/src/test/ui/did_you_mean/trait-object-reference-without-parens-suggestion.stderr b/src/test/ui/did_you_mean/trait-object-reference-without-parens-suggestion.stderr index de1efcd7e0f7d..8c6c33b11865b 100644 --- a/src/test/ui/did_you_mean/trait-object-reference-without-parens-suggestion.stderr +++ b/src/test/ui/did_you_mean/trait-object-reference-without-parens-suggestion.stderr @@ -1,17 +1,17 @@ error[E0178]: expected a path on the left-hand side of `+`, not `&Copy` - --> $DIR/trait-object-reference-without-parens-suggestion.rs:2:12 + --> $DIR/trait-object-reference-without-parens-suggestion.rs:4:12 | LL | let _: &Copy + 'static; | ^^^^^^^^^^^^^^^ help: try adding parentheses: `&(Copy + 'static)` error[E0178]: expected a path on the left-hand side of `+`, not `&'static Copy` - --> $DIR/trait-object-reference-without-parens-suggestion.rs:4:12 + --> $DIR/trait-object-reference-without-parens-suggestion.rs:6:12 | LL | let _: &'static Copy + 'static; | ^^^^^^^^^^^^^^^^^^^^^^^ help: try adding parentheses: `&'static (Copy + 'static)` error[E0038]: the trait `std::marker::Copy` cannot be made into an object - --> $DIR/trait-object-reference-without-parens-suggestion.rs:2:12 + --> $DIR/trait-object-reference-without-parens-suggestion.rs:4:12 | LL | let _: &Copy + 'static; | ^^^^^ the trait `std::marker::Copy` cannot be made into an object diff --git a/src/test/ui/dropck/dropck_trait_cycle_checked.rs b/src/test/ui/dropck/dropck_trait_cycle_checked.rs index 128bbb04ee0ea..bea77dc9f5c4f 100644 --- a/src/test/ui/dropck/dropck_trait_cycle_checked.rs +++ b/src/test/ui/dropck/dropck_trait_cycle_checked.rs @@ -63,14 +63,14 @@ impl Drop for CheckId { } trait Obj<'a> : HasId { - fn set0(&self, b: &'a Box>); - fn set1(&self, b: &'a Box>); + fn set0(&self, b: &'a Box>); + fn set1(&self, b: &'a Box>); } struct O<'a> { id: Id, - obj0: CheckId>>>>, - obj1: CheckId>>>>, + obj0: CheckId>>>>, + obj1: CheckId>>>>, } impl<'a> HasId for O<'a> { @@ -87,7 +87,7 @@ impl<'a> O<'a> { } } -impl<'a> HasId for Cell>>> { +impl<'a> HasId for Cell>>> { fn count(&self) -> usize { match self.get() { None => 1, @@ -97,17 +97,17 @@ impl<'a> HasId for Cell>>> { } impl<'a> Obj<'a> for O<'a> { - fn set0(&self, b: &'a Box>) { + fn set0(&self, b: &'a Box>) { self.obj0.v.set(Some(b)) } - fn set1(&self, b: &'a Box>) { + fn set1(&self, b: &'a Box>) { self.obj1.v.set(Some(b)) } } fn f() { - let (o1, o2, o3): (Box, Box, Box) = (O::new(), O::new(), O::new()); + let (o1, o2, o3): (Box, Box, Box) = (O::new(), O::new(), O::new()); o1.set0(&o2); //~ ERROR `o2` does not live long enough o1.set1(&o3); //~ ERROR `o3` does not live long enough o2.set0(&o2); //~ ERROR `o2` does not live long enough diff --git a/src/test/ui/dropck/dropck_trait_cycle_checked.stderr b/src/test/ui/dropck/dropck_trait_cycle_checked.stderr index 8c669b597c3c0..1e779208e58a5 100644 --- a/src/test/ui/dropck/dropck_trait_cycle_checked.stderr +++ b/src/test/ui/dropck/dropck_trait_cycle_checked.stderr @@ -1,8 +1,8 @@ error[E0597]: `o2` does not live long enough --> $DIR/dropck_trait_cycle_checked.rs:111:13 | -LL | let (o1, o2, o3): (Box, Box, Box) = (O::new(), O::new(), O::new()); - | -------- cast requires that `o2` is borrowed for `'static` +LL | let (o1, o2, o3): (Box, Box, Box) = (O::new(), O::new(), O::new()); + | -------- cast requires that `o2` is borrowed for `'static` LL | o1.set0(&o2); | ^^^ borrowed value does not live long enough ... @@ -12,8 +12,8 @@ LL | } error[E0597]: `o3` does not live long enough --> $DIR/dropck_trait_cycle_checked.rs:112:13 | -LL | let (o1, o2, o3): (Box, Box, Box) = (O::new(), O::new(), O::new()); - | -------- cast requires that `o3` is borrowed for `'static` +LL | let (o1, o2, o3): (Box, Box, Box) = (O::new(), O::new(), O::new()); + | -------- cast requires that `o3` is borrowed for `'static` LL | o1.set0(&o2); LL | o1.set1(&o3); | ^^^ borrowed value does not live long enough @@ -24,8 +24,8 @@ LL | } error[E0597]: `o2` does not live long enough --> $DIR/dropck_trait_cycle_checked.rs:113:13 | -LL | let (o1, o2, o3): (Box, Box, Box) = (O::new(), O::new(), O::new()); - | -------- cast requires that `o2` is borrowed for `'static` +LL | let (o1, o2, o3): (Box, Box, Box) = (O::new(), O::new(), O::new()); + | -------- cast requires that `o2` is borrowed for `'static` ... LL | o2.set0(&o2); | ^^^ borrowed value does not live long enough @@ -36,8 +36,8 @@ LL | } error[E0597]: `o3` does not live long enough --> $DIR/dropck_trait_cycle_checked.rs:114:13 | -LL | let (o1, o2, o3): (Box, Box, Box) = (O::new(), O::new(), O::new()); - | -------- cast requires that `o3` is borrowed for `'static` +LL | let (o1, o2, o3): (Box, Box, Box) = (O::new(), O::new(), O::new()); + | -------- cast requires that `o3` is borrowed for `'static` ... LL | o2.set1(&o3); | ^^^ borrowed value does not live long enough @@ -48,8 +48,8 @@ LL | } error[E0597]: `o1` does not live long enough --> $DIR/dropck_trait_cycle_checked.rs:115:13 | -LL | let (o1, o2, o3): (Box, Box, Box) = (O::new(), O::new(), O::new()); - | -------- cast requires that `o1` is borrowed for `'static` +LL | let (o1, o2, o3): (Box, Box, Box) = (O::new(), O::new(), O::new()); + | -------- cast requires that `o1` is borrowed for `'static` ... LL | o3.set0(&o1); | ^^^ borrowed value does not live long enough @@ -60,8 +60,8 @@ LL | } error[E0597]: `o2` does not live long enough --> $DIR/dropck_trait_cycle_checked.rs:116:13 | -LL | let (o1, o2, o3): (Box, Box, Box) = (O::new(), O::new(), O::new()); - | -------- cast requires that `o2` is borrowed for `'static` +LL | let (o1, o2, o3): (Box, Box, Box) = (O::new(), O::new(), O::new()); + | -------- cast requires that `o2` is borrowed for `'static` ... LL | o3.set1(&o2); | ^^^ borrowed value does not live long enough diff --git a/src/test/ui/dst/dst-bad-assign-2.rs b/src/test/ui/dst/dst-bad-assign-2.rs index b4f72d034f5c5..7ba31bf2e5172 100644 --- a/src/test/ui/dst/dst-bad-assign-2.rs +++ b/src/test/ui/dst/dst-bad-assign-2.rs @@ -30,8 +30,8 @@ impl ToBar for Bar1 { pub fn main() { // Assignment. - let f5: &mut Fat = &mut Fat { f1: 5, f2: "some str", ptr: Bar1 {f :42} }; - let z: Box = Box::new(Bar1 {f: 36}); + let f5: &mut Fat = &mut Fat { f1: 5, f2: "some str", ptr: Bar1 {f :42} }; + let z: Box = Box::new(Bar1 {f: 36}); f5.ptr = *z; //~^ ERROR the size for values of type diff --git a/src/test/ui/dst/dst-bad-assign-3.rs b/src/test/ui/dst/dst-bad-assign-3.rs index 5124abc7d8222..691909a231743 100644 --- a/src/test/ui/dst/dst-bad-assign-3.rs +++ b/src/test/ui/dst/dst-bad-assign-3.rs @@ -28,8 +28,8 @@ impl ToBar for Bar1 { pub fn main() { // Assignment. - let f5: &mut Fat = &mut (5, "some str", Bar1 {f :42}); - let z: Box = Box::new(Bar1 {f: 36}); + let f5: &mut Fat = &mut (5, "some str", Bar1 {f :42}); + let z: Box = Box::new(Bar1 {f: 36}); f5.2 = Bar1 {f: 36}; //~^ ERROR mismatched types //~| expected type `dyn ToBar` diff --git a/src/test/ui/dst/dst-bad-assign.rs b/src/test/ui/dst/dst-bad-assign.rs index 003c80b4dc423..4f2648653f051 100644 --- a/src/test/ui/dst/dst-bad-assign.rs +++ b/src/test/ui/dst/dst-bad-assign.rs @@ -30,8 +30,8 @@ impl ToBar for Bar1 { pub fn main() { // Assignment. - let f5: &mut Fat = &mut Fat { f1: 5, f2: "some str", ptr: Bar1 {f :42} }; - let z: Box = Box::new(Bar1 {f: 36}); + let f5: &mut Fat = &mut Fat { f1: 5, f2: "some str", ptr: Bar1 {f :42} }; + let z: Box = Box::new(Bar1 {f: 36}); f5.ptr = Bar1 {f: 36}; //~^ ERROR mismatched types //~| expected type `dyn ToBar` diff --git a/src/test/ui/dst/dst-bad-coerce1.rs b/src/test/ui/dst/dst-bad-coerce1.rs index 8ca34234c0317..7ef237e39e36e 100644 --- a/src/test/ui/dst/dst-bad-coerce1.rs +++ b/src/test/ui/dst/dst-bad-coerce1.rs @@ -19,7 +19,7 @@ pub fn main() { // With a trait. let f1 = Fat { ptr: Foo }; let f2: &Fat = &f1; - let f3: &Fat = f2; + let f3: &Fat = f2; //~^ ERROR `Foo: Bar` is not satisfied // Tuple with a vec of isize. @@ -31,6 +31,6 @@ pub fn main() { // Tuple with a trait. let f1 = (Foo,); let f2: &(Foo,) = &f1; - let f3: &(Bar,) = f2; + let f3: &(dyn Bar,) = f2; //~^ ERROR `Foo: Bar` is not satisfied } diff --git a/src/test/ui/dst/dst-bad-coerce1.stderr b/src/test/ui/dst/dst-bad-coerce1.stderr index 3776ce71c611f..a48f37b20be97 100644 --- a/src/test/ui/dst/dst-bad-coerce1.stderr +++ b/src/test/ui/dst/dst-bad-coerce1.stderr @@ -8,10 +8,10 @@ LL | let f3: &Fat<[usize]> = f2; found type `&Fat<[isize; 3]>` error[E0277]: the trait bound `Foo: Bar` is not satisfied - --> $DIR/dst-bad-coerce1.rs:22:25 + --> $DIR/dst-bad-coerce1.rs:22:29 | -LL | let f3: &Fat = f2; - | ^^ the trait `Bar` is not implemented for `Foo` +LL | let f3: &Fat = f2; + | ^^ the trait `Bar` is not implemented for `Foo` | = note: required for the cast to the object type `dyn Bar` @@ -25,10 +25,10 @@ LL | let f3: &([usize],) = f2; found type `&([isize; 3],)` error[E0277]: the trait bound `Foo: Bar` is not satisfied - --> $DIR/dst-bad-coerce1.rs:34:23 + --> $DIR/dst-bad-coerce1.rs:34:27 | -LL | let f3: &(Bar,) = f2; - | ^^ the trait `Bar` is not implemented for `Foo` +LL | let f3: &(dyn Bar,) = f2; + | ^^ the trait `Bar` is not implemented for `Foo` | = note: required for the cast to the object type `dyn Bar` diff --git a/src/test/ui/dst/dst-bad-coerce2.rs b/src/test/ui/dst/dst-bad-coerce2.rs index 2bc7ecced0aab..e7ce20b895879 100644 --- a/src/test/ui/dst/dst-bad-coerce2.rs +++ b/src/test/ui/dst/dst-bad-coerce2.rs @@ -17,7 +17,7 @@ pub fn main() { // With a trait. let f1 = Fat { ptr: Foo }; let f2: &Fat = &f1; - let f3: &mut Fat = f2; //~ ERROR mismatched types + let f3: &mut Fat = f2; //~ ERROR mismatched types // Tuple with a vec of ints. let f1 = ([1, 2, 3],); @@ -27,5 +27,5 @@ pub fn main() { // Tuple with a trait. let f1 = (Foo,); let f2: &(Foo,) = &f1; - let f3: &mut (Bar,) = f2; //~ ERROR mismatched types + let f3: &mut (dyn Bar,) = f2; //~ ERROR mismatched types } diff --git a/src/test/ui/dst/dst-bad-coerce2.stderr b/src/test/ui/dst/dst-bad-coerce2.stderr index cae4ec51c37cc..d1da9b6ca0749 100644 --- a/src/test/ui/dst/dst-bad-coerce2.stderr +++ b/src/test/ui/dst/dst-bad-coerce2.stderr @@ -8,10 +8,10 @@ LL | let f3: &mut Fat<[isize]> = f2; found type `&Fat<[isize; 3]>` error[E0308]: mismatched types - --> $DIR/dst-bad-coerce2.rs:20:29 + --> $DIR/dst-bad-coerce2.rs:20:33 | -LL | let f3: &mut Fat = f2; - | ^^ types differ in mutability +LL | let f3: &mut Fat = f2; + | ^^ types differ in mutability | = note: expected type `&mut Fat` found type `&Fat` @@ -26,10 +26,10 @@ LL | let f3: &mut ([isize],) = f2; found type `&([isize; 3],)` error[E0308]: mismatched types - --> $DIR/dst-bad-coerce2.rs:30:27 + --> $DIR/dst-bad-coerce2.rs:30:31 | -LL | let f3: &mut (Bar,) = f2; - | ^^ types differ in mutability +LL | let f3: &mut (dyn Bar,) = f2; + | ^^ types differ in mutability | = note: expected type `&mut (dyn Bar,)` found type `&(Foo,)` diff --git a/src/test/ui/dst/dst-bad-coerce3.rs b/src/test/ui/dst/dst-bad-coerce3.rs index 58c988520eb0d..fd5ee3b57bb42 100644 --- a/src/test/ui/dst/dst-bad-coerce3.rs +++ b/src/test/ui/dst/dst-bad-coerce3.rs @@ -19,7 +19,7 @@ fn baz<'a>() { // With a trait. let f1 = Fat { ptr: Foo }; let f2: &Fat = &f1; //~ ERROR `f1` does not live long enough - let f3: &'a Fat = f2; + let f3: &'a Fat = f2; // Tuple with a vec of ints. let f1 = ([1, 2, 3],); @@ -29,7 +29,7 @@ fn baz<'a>() { // Tuple with a trait. let f1 = (Foo,); let f2: &(Foo,) = &f1; //~ ERROR `f1` does not live long enough - let f3: &'a (Bar,) = f2; + let f3: &'a (dyn Bar,) = f2; } pub fn main() { diff --git a/src/test/ui/dst/dst-bad-coerce3.stderr b/src/test/ui/dst/dst-bad-coerce3.stderr index 289d451f02a7f..957e98bbeee96 100644 --- a/src/test/ui/dst/dst-bad-coerce3.stderr +++ b/src/test/ui/dst/dst-bad-coerce3.stderr @@ -20,8 +20,8 @@ LL | fn baz<'a>() { ... LL | let f2: &Fat = &f1; | ^^^ borrowed value does not live long enough -LL | let f3: &'a Fat = f2; - | ------------ type annotation requires that `f1` is borrowed for `'a` +LL | let f3: &'a Fat = f2; + | ---------------- type annotation requires that `f1` is borrowed for `'a` ... LL | } | - `f1` dropped here while still borrowed @@ -48,8 +48,8 @@ LL | fn baz<'a>() { ... LL | let f2: &(Foo,) = &f1; | ^^^ borrowed value does not live long enough -LL | let f3: &'a (Bar,) = f2; - | ---------- type annotation requires that `f1` is borrowed for `'a` +LL | let f3: &'a (dyn Bar,) = f2; + | -------------- type annotation requires that `f1` is borrowed for `'a` LL | } | - `f1` dropped here while still borrowed diff --git a/src/test/ui/dst/dst-bad-coercions.rs b/src/test/ui/dst/dst-bad-coercions.rs index 9aa697225d5b6..bffef378c921c 100644 --- a/src/test/ui/dst/dst-bad-coercions.rs +++ b/src/test/ui/dst/dst-bad-coercions.rs @@ -12,15 +12,15 @@ pub fn main() { // Test that we cannot convert from *-ptr to &S and &T let x: *const S = &S; let y: &S = x; //~ ERROR mismatched types - let y: &T = x; //~ ERROR mismatched types + let y: &dyn T = x; //~ ERROR mismatched types // Test that we cannot convert from *-ptr to &S and &T (mut version) let x: *mut S = &mut S; let y: &S = x; //~ ERROR mismatched types - let y: &T = x; //~ ERROR mismatched types + let y: &dyn T = x; //~ ERROR mismatched types // Test that we cannot convert an immutable ptr to a mutable one using *-ptrs - let x: &mut T = &S; //~ ERROR mismatched types - let x: *mut T = &S; //~ ERROR mismatched types + let x: &mut dyn T = &S; //~ ERROR mismatched types + let x: *mut dyn T = &S; //~ ERROR mismatched types let x: *mut S = &S; //~ ERROR mismatched types } diff --git a/src/test/ui/dst/dst-bad-coercions.stderr b/src/test/ui/dst/dst-bad-coercions.stderr index 27016829a07f3..e4bc6ee0010a2 100644 --- a/src/test/ui/dst/dst-bad-coercions.stderr +++ b/src/test/ui/dst/dst-bad-coercions.stderr @@ -8,13 +8,13 @@ LL | let y: &S = x; found type `*const S` error[E0308]: mismatched types - --> $DIR/dst-bad-coercions.rs:15:17 + --> $DIR/dst-bad-coercions.rs:15:21 | -LL | let y: &T = x; - | ^ - | | - | expected &dyn T, found *-ptr - | help: consider borrowing here: `&x` +LL | let y: &dyn T = x; + | ^ + | | + | expected &dyn T, found *-ptr + | help: consider borrowing here: `&x` | = note: expected type `&dyn T` found type `*const S` @@ -29,31 +29,31 @@ LL | let y: &S = x; found type `*mut S` error[E0308]: mismatched types - --> $DIR/dst-bad-coercions.rs:20:17 + --> $DIR/dst-bad-coercions.rs:20:21 | -LL | let y: &T = x; - | ^ - | | - | expected &dyn T, found *-ptr - | help: consider borrowing here: `&x` +LL | let y: &dyn T = x; + | ^ + | | + | expected &dyn T, found *-ptr + | help: consider borrowing here: `&x` | = note: expected type `&dyn T` found type `*mut S` error[E0308]: mismatched types - --> $DIR/dst-bad-coercions.rs:23:21 + --> $DIR/dst-bad-coercions.rs:23:25 | -LL | let x: &mut T = &S; - | ^^ types differ in mutability +LL | let x: &mut dyn T = &S; + | ^^ types differ in mutability | = note: expected type `&mut dyn T` found type `&S` error[E0308]: mismatched types - --> $DIR/dst-bad-coercions.rs:24:21 + --> $DIR/dst-bad-coercions.rs:24:25 | -LL | let x: *mut T = &S; - | ^^ types differ in mutability +LL | let x: *mut dyn T = &S; + | ^^ types differ in mutability | = note: expected type `*mut dyn T` found type `&S` diff --git a/src/test/ui/dst/dst-index.rs b/src/test/ui/dst/dst-index.rs index 71ff067bbd9dc..fced3144eb85b 100644 --- a/src/test/ui/dst/dst-index.rs +++ b/src/test/ui/dst/dst-index.rs @@ -19,9 +19,9 @@ impl Index for S { struct T; impl Index for T { - type Output = Debug + 'static; + type Output = dyn Debug + 'static; - fn index<'a>(&'a self, idx: usize) -> &'a (Debug + 'static) { + fn index<'a>(&'a self, idx: usize) -> &'a (dyn Debug + 'static) { static x: usize = 42; &x } diff --git a/src/test/ui/dst/dst-object-from-unsized-type.rs b/src/test/ui/dst/dst-object-from-unsized-type.rs index f4ee1783a2e34..3cd5b1ed6f462 100644 --- a/src/test/ui/dst/dst-object-from-unsized-type.rs +++ b/src/test/ui/dst/dst-object-from-unsized-type.rs @@ -5,22 +5,22 @@ impl Foo for str {} impl Foo for [u8] {} fn test1(t: &T) { - let u: &Foo = t; + let u: &dyn Foo = t; //~^ ERROR the size for values of type } fn test2(t: &T) { - let v: &Foo = t as &Foo; + let v: &dyn Foo = t as &dyn Foo; //~^ ERROR the size for values of type } fn test3() { - let _: &[&Foo] = &["hi"]; + let _: &[&dyn Foo] = &["hi"]; //~^ ERROR the size for values of type } fn test4(x: &[u8]) { - let _: &Foo = x as &Foo; + let _: &dyn Foo = x as &dyn Foo; //~^ ERROR the size for values of type } diff --git a/src/test/ui/dst/dst-object-from-unsized-type.stderr b/src/test/ui/dst/dst-object-from-unsized-type.stderr index 4851ca108285f..55ac625fc985b 100644 --- a/src/test/ui/dst/dst-object-from-unsized-type.stderr +++ b/src/test/ui/dst/dst-object-from-unsized-type.stderr @@ -1,8 +1,8 @@ error[E0277]: the size for values of type `T` cannot be known at compilation time - --> $DIR/dst-object-from-unsized-type.rs:8:19 + --> $DIR/dst-object-from-unsized-type.rs:8:23 | -LL | let u: &Foo = t; - | ^ doesn't have a size known at compile-time +LL | let u: &dyn Foo = t; + | ^ doesn't have a size known at compile-time | = help: the trait `std::marker::Sized` is not implemented for `T` = note: to learn more, visit @@ -10,10 +10,10 @@ LL | let u: &Foo = t; = note: required for the cast to the object type `dyn Foo` error[E0277]: the size for values of type `T` cannot be known at compilation time - --> $DIR/dst-object-from-unsized-type.rs:13:19 + --> $DIR/dst-object-from-unsized-type.rs:13:23 | -LL | let v: &Foo = t as &Foo; - | ^ doesn't have a size known at compile-time +LL | let v: &dyn Foo = t as &dyn Foo; + | ^ doesn't have a size known at compile-time | = help: the trait `std::marker::Sized` is not implemented for `T` = note: to learn more, visit @@ -21,20 +21,20 @@ LL | let v: &Foo = t as &Foo; = note: required for the cast to the object type `dyn Foo` error[E0277]: the size for values of type `str` cannot be known at compilation time - --> $DIR/dst-object-from-unsized-type.rs:18:24 + --> $DIR/dst-object-from-unsized-type.rs:18:28 | -LL | let _: &[&Foo] = &["hi"]; - | ^^^^ doesn't have a size known at compile-time +LL | let _: &[&dyn Foo] = &["hi"]; + | ^^^^ doesn't have a size known at compile-time | = help: the trait `std::marker::Sized` is not implemented for `str` = note: to learn more, visit = note: required for the cast to the object type `dyn Foo` error[E0277]: the size for values of type `[u8]` cannot be known at compilation time - --> $DIR/dst-object-from-unsized-type.rs:23:19 + --> $DIR/dst-object-from-unsized-type.rs:23:23 | -LL | let _: &Foo = x as &Foo; - | ^ doesn't have a size known at compile-time +LL | let _: &dyn Foo = x as &dyn Foo; + | ^ doesn't have a size known at compile-time | = help: the trait `std::marker::Sized` is not implemented for `[u8]` = note: to learn more, visit diff --git a/src/test/ui/elide-errors-on-mismatched-tuple.rs b/src/test/ui/elide-errors-on-mismatched-tuple.rs index e68358fd978bf..7d87b0a7756b1 100644 --- a/src/test/ui/elide-errors-on-mismatched-tuple.rs +++ b/src/test/ui/elide-errors-on-mismatched-tuple.rs @@ -13,6 +13,6 @@ impl A { fn main() { let (a, b, c) = (A::new(), A::new()); // This tuple is 2 elements, should be three //~^ ERROR mismatched types - let ts: Vec<&T> = vec![&a, &b, &c]; + let ts: Vec<&dyn T> = vec![&a, &b, &c]; // There is no E0277 error above, as `a`, `b` and `c` are `TyErr` } diff --git a/src/test/ui/error-codes/E0033-teach.rs b/src/test/ui/error-codes/E0033-teach.rs index 0f0b8d864dc43..6a27b07fa8b77 100644 --- a/src/test/ui/error-codes/E0033-teach.rs +++ b/src/test/ui/error-codes/E0033-teach.rs @@ -5,7 +5,7 @@ trait SomeTrait { } fn main() { - let trait_obj: &SomeTrait = SomeTrait; + let trait_obj: &dyn SomeTrait = SomeTrait; //~^ ERROR expected value, found trait `SomeTrait` //~| ERROR E0038 //~| method `foo` has no receiver diff --git a/src/test/ui/error-codes/E0033-teach.stderr b/src/test/ui/error-codes/E0033-teach.stderr index 1b78820cae07b..fb630de7fc147 100644 --- a/src/test/ui/error-codes/E0033-teach.stderr +++ b/src/test/ui/error-codes/E0033-teach.stderr @@ -1,14 +1,14 @@ error[E0423]: expected value, found trait `SomeTrait` - --> $DIR/E0033-teach.rs:8:33 + --> $DIR/E0033-teach.rs:8:37 | -LL | let trait_obj: &SomeTrait = SomeTrait; - | ^^^^^^^^^ not a value +LL | let trait_obj: &dyn SomeTrait = SomeTrait; + | ^^^^^^^^^ not a value error[E0038]: the trait `SomeTrait` cannot be made into an object --> $DIR/E0033-teach.rs:8:20 | -LL | let trait_obj: &SomeTrait = SomeTrait; - | ^^^^^^^^^^ the trait `SomeTrait` cannot be made into an object +LL | let trait_obj: &dyn SomeTrait = SomeTrait; + | ^^^^^^^^^^^^^^ the trait `SomeTrait` cannot be made into an object | = note: method `foo` has no receiver diff --git a/src/test/ui/error-codes/E0033.rs b/src/test/ui/error-codes/E0033.rs index 5a4f3cbce60e4..582600e110ba0 100644 --- a/src/test/ui/error-codes/E0033.rs +++ b/src/test/ui/error-codes/E0033.rs @@ -3,7 +3,7 @@ trait SomeTrait { } fn main() { - let trait_obj: &SomeTrait = SomeTrait; + let trait_obj: &dyn SomeTrait = SomeTrait; //~^ ERROR expected value, found trait `SomeTrait` //~| ERROR E0038 //~| method `foo` has no receiver diff --git a/src/test/ui/error-codes/E0033.stderr b/src/test/ui/error-codes/E0033.stderr index 976b0e0286fa0..fe9f45d86a6a0 100644 --- a/src/test/ui/error-codes/E0033.stderr +++ b/src/test/ui/error-codes/E0033.stderr @@ -1,14 +1,14 @@ error[E0423]: expected value, found trait `SomeTrait` - --> $DIR/E0033.rs:6:33 + --> $DIR/E0033.rs:6:37 | -LL | let trait_obj: &SomeTrait = SomeTrait; - | ^^^^^^^^^ not a value +LL | let trait_obj: &dyn SomeTrait = SomeTrait; + | ^^^^^^^^^ not a value error[E0038]: the trait `SomeTrait` cannot be made into an object --> $DIR/E0033.rs:6:20 | -LL | let trait_obj: &SomeTrait = SomeTrait; - | ^^^^^^^^^^ the trait `SomeTrait` cannot be made into an object +LL | let trait_obj: &dyn SomeTrait = SomeTrait; + | ^^^^^^^^^^^^^^ the trait `SomeTrait` cannot be made into an object | = note: method `foo` has no receiver diff --git a/src/test/ui/error-codes/E0038.rs b/src/test/ui/error-codes/E0038.rs index b2226803da7fa..9757e2ab10c7a 100644 --- a/src/test/ui/error-codes/E0038.rs +++ b/src/test/ui/error-codes/E0038.rs @@ -2,7 +2,7 @@ trait Trait { fn foo(&self) -> Self; } -fn call_foo(x: Box) { +fn call_foo(x: Box) { //~^ ERROR E0038 let y = x.foo(); } diff --git a/src/test/ui/error-codes/E0038.stderr b/src/test/ui/error-codes/E0038.stderr index 74b77338c85c0..e3d7593e42a71 100644 --- a/src/test/ui/error-codes/E0038.stderr +++ b/src/test/ui/error-codes/E0038.stderr @@ -1,8 +1,8 @@ error[E0038]: the trait `Trait` cannot be made into an object --> $DIR/E0038.rs:5:1 | -LL | fn call_foo(x: Box) { - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Trait` cannot be made into an object +LL | fn call_foo(x: Box) { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Trait` cannot be made into an object | = note: method `foo` references the `Self` type in its arguments or return type diff --git a/src/test/ui/error-codes/E0120.rs b/src/test/ui/error-codes/E0120.rs index 049707415e505..287a4088183f4 100644 --- a/src/test/ui/error-codes/E0120.rs +++ b/src/test/ui/error-codes/E0120.rs @@ -1,6 +1,6 @@ trait MyTrait { fn foo() {} } -impl Drop for MyTrait { +impl Drop for dyn MyTrait { //~^ ERROR E0120 fn drop(&mut self) {} } diff --git a/src/test/ui/error-codes/E0120.stderr b/src/test/ui/error-codes/E0120.stderr index 9b6603dbaca9c..68ca7d800d5ce 100644 --- a/src/test/ui/error-codes/E0120.stderr +++ b/src/test/ui/error-codes/E0120.stderr @@ -1,8 +1,8 @@ error[E0120]: the Drop trait may only be implemented on structures --> $DIR/E0120.rs:3:15 | -LL | impl Drop for MyTrait { - | ^^^^^^^ implementing Drop requires a struct +LL | impl Drop for dyn MyTrait { + | ^^^^^^^^^^^ implementing Drop requires a struct error: aborting due to previous error diff --git a/src/test/ui/error-codes/E0191.rs b/src/test/ui/error-codes/E0191.rs index 356110671e715..22f739b9e76c2 100644 --- a/src/test/ui/error-codes/E0191.rs +++ b/src/test/ui/error-codes/E0191.rs @@ -2,6 +2,6 @@ trait Trait { type Bar; } -type Foo = Trait; //~ ERROR E0191 +type Foo = dyn Trait; //~ ERROR E0191 fn main() {} diff --git a/src/test/ui/error-codes/E0191.stderr b/src/test/ui/error-codes/E0191.stderr index 2d9fdfe5d29c7..92fa85bca0eff 100644 --- a/src/test/ui/error-codes/E0191.stderr +++ b/src/test/ui/error-codes/E0191.stderr @@ -4,8 +4,8 @@ error[E0191]: the value of the associated type `Bar` (from the trait `Trait`) mu LL | type Bar; | --------- `Bar` defined here ... -LL | type Foo = Trait; - | ^^^^^ associated type `Bar` must be specified +LL | type Foo = dyn Trait; + | ^^^^^^^^^ associated type `Bar` must be specified error: aborting due to previous error diff --git a/src/test/ui/error-codes/E0220.rs b/src/test/ui/error-codes/E0220.rs index f4798042538dd..e11a570df79d5 100644 --- a/src/test/ui/error-codes/E0220.rs +++ b/src/test/ui/error-codes/E0220.rs @@ -2,7 +2,7 @@ trait Trait { type Bar; } -type Foo = Trait; //~ ERROR E0220 - //~| ERROR E0191 +type Foo = dyn Trait; //~ ERROR E0220 + //~| ERROR E0191 fn main() { } diff --git a/src/test/ui/error-codes/E0220.stderr b/src/test/ui/error-codes/E0220.stderr index bd2205fb75274..5da302748cdaf 100644 --- a/src/test/ui/error-codes/E0220.stderr +++ b/src/test/ui/error-codes/E0220.stderr @@ -1,8 +1,8 @@ error[E0220]: associated type `F` not found for `Trait` - --> $DIR/E0220.rs:5:18 + --> $DIR/E0220.rs:5:22 | -LL | type Foo = Trait; - | ^^^^^ associated type `F` not found +LL | type Foo = dyn Trait; + | ^^^^^ associated type `F` not found error[E0191]: the value of the associated type `Bar` (from the trait `Trait`) must be specified --> $DIR/E0220.rs:5:12 @@ -10,8 +10,8 @@ error[E0191]: the value of the associated type `Bar` (from the trait `Trait`) mu LL | type Bar; | --------- `Bar` defined here ... -LL | type Foo = Trait; - | ^^^^^^^^^^^^ associated type `Bar` must be specified +LL | type Foo = dyn Trait; + | ^^^^^^^^^^^^^^^^ associated type `Bar` must be specified error: aborting due to 2 previous errors diff --git a/src/test/ui/error-codes/E0393.rs b/src/test/ui/error-codes/E0393.rs index bdd4deafc838e..0c1a369806d8f 100644 --- a/src/test/ui/error-codes/E0393.rs +++ b/src/test/ui/error-codes/E0393.rs @@ -1,6 +1,6 @@ trait A {} -fn together_we_will_rule_the_galaxy(son: &A) {} +fn together_we_will_rule_the_galaxy(son: &dyn A) {} //~^ ERROR E0393 fn main() { diff --git a/src/test/ui/error-codes/E0393.stderr b/src/test/ui/error-codes/E0393.stderr index bf564ef10210a..543e3213633c8 100644 --- a/src/test/ui/error-codes/E0393.stderr +++ b/src/test/ui/error-codes/E0393.stderr @@ -1,8 +1,8 @@ error[E0393]: the type parameter `T` must be explicitly specified - --> $DIR/E0393.rs:3:43 + --> $DIR/E0393.rs:3:47 | -LL | fn together_we_will_rule_the_galaxy(son: &A) {} - | ^ missing reference to `T` +LL | fn together_we_will_rule_the_galaxy(son: &dyn A) {} + | ^ missing reference to `T` | = note: because of the default `Self` reference, type parameters must be specified on object types diff --git a/src/test/ui/error-codes/E0478.rs b/src/test/ui/error-codes/E0478.rs index 1b5ca09d5a6c4..b1562dc0a8ba0 100644 --- a/src/test/ui/error-codes/E0478.rs +++ b/src/test/ui/error-codes/E0478.rs @@ -1,7 +1,7 @@ trait Wedding<'t>: 't { } struct Prince<'kiss, 'SnowWhite> { - child: Box + 'SnowWhite>, //~ ERROR E0478 + child: Box + 'SnowWhite>, //~ ERROR E0478 } fn main() { diff --git a/src/test/ui/error-codes/E0478.stderr b/src/test/ui/error-codes/E0478.stderr index 71e490364d7ab..587125fdc336e 100644 --- a/src/test/ui/error-codes/E0478.stderr +++ b/src/test/ui/error-codes/E0478.stderr @@ -1,8 +1,8 @@ error[E0478]: lifetime bound not satisfied --> $DIR/E0478.rs:4:5 | -LL | child: Box + 'SnowWhite>, - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | child: Box + 'SnowWhite>, + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | note: lifetime parameter instantiated with the lifetime 'SnowWhite as defined on the struct at 3:22 --> $DIR/E0478.rs:3:22 diff --git a/src/test/ui/error-codes/E0719.rs b/src/test/ui/error-codes/E0719.rs index 6b572f49cee8b..3311e190937cc 100644 --- a/src/test/ui/error-codes/E0719.rs +++ b/src/test/ui/error-codes/E0719.rs @@ -3,12 +3,12 @@ trait Foo: Iterator {} type Unit = (); -fn test() -> Box> { +fn test() -> Box> { //~^ ERROR is already specified Box::new(None.into_iter()) } fn main() { - let _: &Iterator; + let _: &dyn Iterator; test(); } diff --git a/src/test/ui/error-codes/E0719.stderr b/src/test/ui/error-codes/E0719.stderr index 5854cd7e1438b..c5b9a71c65994 100644 --- a/src/test/ui/error-codes/E0719.stderr +++ b/src/test/ui/error-codes/E0719.stderr @@ -7,12 +7,12 @@ LL | trait Foo: Iterator {} | `Item` bound here first error[E0719]: the value of the associated type `Item` (from the trait `std::iter::Iterator`) is already specified - --> $DIR/E0719.rs:6:38 + --> $DIR/E0719.rs:6:42 | -LL | fn test() -> Box> { - | --------- ^^^^^^^^^^^ re-bound here - | | - | `Item` bound here first +LL | fn test() -> Box> { + | --------- ^^^^^^^^^^^ re-bound here + | | + | `Item` bound here first error: aborting due to 2 previous errors diff --git a/src/test/ui/fat-ptr-cast.rs b/src/test/ui/fat-ptr-cast.rs index eb419ba2036a4..a0fad583a1645 100644 --- a/src/test/ui/fat-ptr-cast.rs +++ b/src/test/ui/fat-ptr-cast.rs @@ -19,6 +19,6 @@ fn main() { q as *const [i32]; //~ ERROR cannot cast // #21397 - let t: *mut (Trait + 'static) = 0 as *mut _; //~ ERROR casting + let t: *mut (dyn Trait + 'static) = 0 as *mut _; //~ ERROR casting let mut fail: *const str = 0 as *const str; //~ ERROR casting } diff --git a/src/test/ui/fat-ptr-cast.stderr b/src/test/ui/fat-ptr-cast.stderr index bb7a4d3ff7f6a..93e1471838f72 100644 --- a/src/test/ui/fat-ptr-cast.stderr +++ b/src/test/ui/fat-ptr-cast.stderr @@ -53,10 +53,10 @@ LL | q as *const [i32]; | ^^^^^^^^^^^^^^^^^ error[E0606]: casting `usize` as `*mut (dyn Trait + 'static)` is invalid - --> $DIR/fat-ptr-cast.rs:22:37 + --> $DIR/fat-ptr-cast.rs:22:41 | -LL | let t: *mut (Trait + 'static) = 0 as *mut _; - | ^^^^^^^^^^^ +LL | let t: *mut (dyn Trait + 'static) = 0 as *mut _; + | ^^^^^^^^^^^ error[E0606]: casting `usize` as `*const str` is invalid --> $DIR/fat-ptr-cast.rs:23:32 diff --git a/src/test/ui/feature-gates/feature-gate-trivial_bounds.rs b/src/test/ui/feature-gates/feature-gate-trivial_bounds.rs index e5028f2f8aa78..3dbaf5dea250e 100644 --- a/src/test/ui/feature-gates/feature-gate-trivial_bounds.rs +++ b/src/test/ui/feature-gates/feature-gate-trivial_bounds.rs @@ -52,8 +52,8 @@ struct Dst { struct TwoStrs(str, str) where str: Sized; //~ ERROR -fn unsized_local() where Dst: Sized { //~ ERROR - let x: Dst = *(Box::new(Dst { x: 1 }) as Box>); +fn unsized_local() where Dst: Sized { //~ ERROR + let x: Dst = *(Box::new(Dst { x: 1 }) as Box>); } fn return_str() -> str where str: Sized { //~ ERROR diff --git a/src/test/ui/feature-gates/feature-gate-trivial_bounds.stderr b/src/test/ui/feature-gates/feature-gate-trivial_bounds.stderr index b04a6e4d671ba..1d346fd42ffa4 100644 --- a/src/test/ui/feature-gates/feature-gate-trivial_bounds.stderr +++ b/src/test/ui/feature-gates/feature-gate-trivial_bounds.stderr @@ -102,8 +102,8 @@ LL | struct TwoStrs(str, str) where str: Sized; error[E0277]: the size for values of type `(dyn A + 'static)` cannot be known at compilation time --> $DIR/feature-gate-trivial_bounds.rs:55:1 | -LL | / fn unsized_local() where Dst: Sized { -LL | | let x: Dst = *(Box::new(Dst { x: 1 }) as Box>); +LL | / fn unsized_local() where Dst: Sized { +LL | | let x: Dst = *(Box::new(Dst { x: 1 }) as Box>); LL | | } | |_^ doesn't have a size known at compile-time | diff --git a/src/test/ui/feature-gates/feature-gate-unsized_locals.rs b/src/test/ui/feature-gates/feature-gate-unsized_locals.rs index a8f81f3f113c9..3686e7b37f4c4 100644 --- a/src/test/ui/feature-gates/feature-gate-unsized_locals.rs +++ b/src/test/ui/feature-gates/feature-gate-unsized_locals.rs @@ -1,4 +1,4 @@ -fn f(f: FnOnce()) {} +fn f(f: dyn FnOnce()) {} //~^ ERROR E0277 fn main() { diff --git a/src/test/ui/feature-gates/feature-gate-unsized_locals.stderr b/src/test/ui/feature-gates/feature-gate-unsized_locals.stderr index bde39cbeaeb28..d20b9e2981e8c 100644 --- a/src/test/ui/feature-gates/feature-gate-unsized_locals.stderr +++ b/src/test/ui/feature-gates/feature-gate-unsized_locals.stderr @@ -1,7 +1,7 @@ error[E0277]: the size for values of type `(dyn std::ops::FnOnce() + 'static)` cannot be known at compilation time --> $DIR/feature-gate-unsized_locals.rs:1:6 | -LL | fn f(f: FnOnce()) {} +LL | fn f(f: dyn FnOnce()) {} | ^ doesn't have a size known at compile-time | = help: the trait `std::marker::Sized` is not implemented for `(dyn std::ops::FnOnce() + 'static)` diff --git a/src/test/ui/feature-gates/feature-gate-unsized_tuple_coercion.rs b/src/test/ui/feature-gates/feature-gate-unsized_tuple_coercion.rs index f781bc9aeddd1..c3d62a231e5e4 100644 --- a/src/test/ui/feature-gates/feature-gate-unsized_tuple_coercion.rs +++ b/src/test/ui/feature-gates/feature-gate-unsized_tuple_coercion.rs @@ -1,4 +1,4 @@ fn main() { - let _ : &(Send,) = &((),); + let _ : &(dyn Send,) = &((),); //~^ ERROR unsized tuple coercion is not stable enough } diff --git a/src/test/ui/feature-gates/feature-gate-unsized_tuple_coercion.stderr b/src/test/ui/feature-gates/feature-gate-unsized_tuple_coercion.stderr index 669e87ceadaf5..5b93c889db1c2 100644 --- a/src/test/ui/feature-gates/feature-gate-unsized_tuple_coercion.stderr +++ b/src/test/ui/feature-gates/feature-gate-unsized_tuple_coercion.stderr @@ -1,8 +1,8 @@ error[E0658]: unsized tuple coercion is not stable enough for use and is subject to change - --> $DIR/feature-gate-unsized_tuple_coercion.rs:2:24 + --> $DIR/feature-gate-unsized_tuple_coercion.rs:2:28 | -LL | let _ : &(Send,) = &((),); - | ^^^^^^ +LL | let _ : &(dyn Send,) = &((),); + | ^^^^^^ | = note: for more information, see https://github.com/rust-lang/rust/issues/42877 = help: add #![feature(unsized_tuple_coercion)] to the crate attributes to enable diff --git a/src/test/ui/fn/fn-trait-formatting.rs b/src/test/ui/fn/fn-trait-formatting.rs index 21da39dd4004f..5c16c1a7e88b7 100644 --- a/src/test/ui/fn/fn-trait-formatting.rs +++ b/src/test/ui/fn/fn-trait-formatting.rs @@ -3,15 +3,15 @@ fn needs_fn(x: F) where F: Fn(isize) -> isize {} fn main() { - let _: () = (box |_: isize| {}) as Box; + let _: () = (box |_: isize| {}) as Box; //~^ ERROR mismatched types //~| expected type `()` //~| found type `std::boxed::Box` - let _: () = (box |_: isize, isize| {}) as Box; + let _: () = (box |_: isize, isize| {}) as Box; //~^ ERROR mismatched types //~| expected type `()` //~| found type `std::boxed::Box` - let _: () = (box || -> isize { unimplemented!() }) as Box isize>; + let _: () = (box || -> isize { unimplemented!() }) as Box isize>; //~^ ERROR mismatched types //~| expected type `()` //~| found type `std::boxed::Box isize>` diff --git a/src/test/ui/fn/fn-trait-formatting.stderr b/src/test/ui/fn/fn-trait-formatting.stderr index 6b76a6c914f00..504bc2605ec38 100644 --- a/src/test/ui/fn/fn-trait-formatting.stderr +++ b/src/test/ui/fn/fn-trait-formatting.stderr @@ -1,8 +1,8 @@ error[E0308]: mismatched types --> $DIR/fn-trait-formatting.rs:6:17 | -LL | let _: () = (box |_: isize| {}) as Box; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected (), found struct `std::boxed::Box` +LL | let _: () = (box |_: isize| {}) as Box; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected (), found struct `std::boxed::Box` | = note: expected type `()` found type `std::boxed::Box` @@ -10,8 +10,8 @@ LL | let _: () = (box |_: isize| {}) as Box; error[E0308]: mismatched types --> $DIR/fn-trait-formatting.rs:10:17 | -LL | let _: () = (box |_: isize, isize| {}) as Box; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected (), found struct `std::boxed::Box` +LL | let _: () = (box |_: isize, isize| {}) as Box; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected (), found struct `std::boxed::Box` | = note: expected type `()` found type `std::boxed::Box` @@ -19,8 +19,8 @@ LL | let _: () = (box |_: isize, isize| {}) as Box; error[E0308]: mismatched types --> $DIR/fn-trait-formatting.rs:14:17 | -LL | let _: () = (box || -> isize { unimplemented!() }) as Box isize>; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected (), found struct `std::boxed::Box` +LL | let _: () = (box || -> isize { unimplemented!() }) as Box isize>; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected (), found struct `std::boxed::Box` | = note: expected type `()` found type `std::boxed::Box isize>` diff --git a/src/test/ui/higher-lifetime-bounds.rs b/src/test/ui/higher-lifetime-bounds.rs index 546f4d4366333..f3393347d90dc 100644 --- a/src/test/ui/higher-lifetime-bounds.rs +++ b/src/test/ui/higher-lifetime-bounds.rs @@ -58,12 +58,12 @@ struct S3(F) where for<'xa, 'xb: 'xa> F: Fn(&'xa i32, &'xb i32) -> &'xa i32; struct S_fnty(for<'xa, 'xb: 'xa> fn(&'xa i32, &'xb i32) -> &'xa i32); //~^ ERROR lifetime bounds cannot be used in this context -type T1 = Box Fn(&'xa i32, &'xb i32) -> &'xa i32>; +type T1 = Box Fn(&'xa i32, &'xb i32) -> &'xa i32>; //~^ ERROR lifetime bounds cannot be used in this context fn main() { let _ : Option fn(&'xa i32, &'xb i32) -> &'xa i32> = None; //~^ ERROR lifetime bounds cannot be used in this context - let _ : Option Fn(&'xa i32, &'xb i32) -> &'xa i32>> = None; + let _ : Option Fn(&'xa i32, &'xb i32) -> &'xa i32>> = None; //~^ ERROR lifetime bounds cannot be used in this context } diff --git a/src/test/ui/higher-lifetime-bounds.stderr b/src/test/ui/higher-lifetime-bounds.stderr index 431a89f5eb81b..bc6d2288cdfc4 100644 --- a/src/test/ui/higher-lifetime-bounds.stderr +++ b/src/test/ui/higher-lifetime-bounds.stderr @@ -47,10 +47,10 @@ LL | struct S_fnty(for<'xa, 'xb: 'xa> fn(&'xa i32, &'xb i32) -> &'xa i32); | ^^^ error: lifetime bounds cannot be used in this context - --> $DIR/higher-lifetime-bounds.rs:61:29 + --> $DIR/higher-lifetime-bounds.rs:61:33 | -LL | type T1 = Box Fn(&'xa i32, &'xb i32) -> &'xa i32>; - | ^^^ +LL | type T1 = Box Fn(&'xa i32, &'xb i32) -> &'xa i32>; + | ^^^ error: lifetime bounds cannot be used in this context --> $DIR/higher-lifetime-bounds.rs:65:34 @@ -59,10 +59,10 @@ LL | let _ : Option fn(&'xa i32, &'xb i32) -> &'xa i32> = | ^^^ error: lifetime bounds cannot be used in this context - --> $DIR/higher-lifetime-bounds.rs:67:38 + --> $DIR/higher-lifetime-bounds.rs:67:42 | -LL | let _ : Option Fn(&'xa i32, &'xb i32) -> &'xa i32>> = None; - | ^^^ +LL | let _ : Option Fn(&'xa i32, &'xb i32) -> &'xa i32>> = None; + | ^^^ error: aborting due to 11 previous errors diff --git a/src/test/ui/imports/extern-crate-used.rs b/src/test/ui/imports/extern-crate-used.rs index 26150c7d4a16b..8198c1816a141 100644 --- a/src/test/ui/imports/extern-crate-used.rs +++ b/src/test/ui/imports/extern-crate-used.rs @@ -20,13 +20,13 @@ extern crate core; //~ ERROR unused extern crate mod m { use iso1::any as are_you_okay1; use ::iso2::any as are_you_okay2; - type AreYouOkay1 = iso3::any::Any; - type AreYouOkay2 = ::iso4::any::Any; + type AreYouOkay1 = dyn iso3::any::Any; + type AreYouOkay2 = dyn (::iso4::any::Any); use core::any as are_you_okay3; use ::core::any as are_you_okay4; - type AreYouOkay3 = core::any::Any; - type AreYouOkay4 = ::core::any::Any; + type AreYouOkay3 = dyn core::any::Any; + type AreYouOkay4 = dyn (::core::any::Any); } fn main() {} diff --git a/src/test/ui/in-band-lifetimes/mismatched_trait_impl-2.rs b/src/test/ui/in-band-lifetimes/mismatched_trait_impl-2.rs index d4535ac442538..d131a944721d0 100644 --- a/src/test/ui/in-band-lifetimes/mismatched_trait_impl-2.rs +++ b/src/test/ui/in-band-lifetimes/mismatched_trait_impl-2.rs @@ -4,8 +4,8 @@ trait Trait {} struct Struct; impl Deref for Struct { - type Target = Trait; - fn deref(&self) -> &Trait { + type Target = dyn Trait; + fn deref(&self) -> &dyn Trait { unimplemented!(); } } diff --git a/src/test/ui/in-band-lifetimes/mismatched_trait_impl-2.stderr b/src/test/ui/in-band-lifetimes/mismatched_trait_impl-2.stderr index e56a56e2dae21..b50a926c63795 100644 --- a/src/test/ui/in-band-lifetimes/mismatched_trait_impl-2.stderr +++ b/src/test/ui/in-band-lifetimes/mismatched_trait_impl-2.stderr @@ -1,13 +1,13 @@ error[E0495]: cannot infer an appropriate lifetime for lifetime parameter in generic type due to conflicting requirements --> $DIR/mismatched_trait_impl-2.rs:8:5 | -LL | fn deref(&self) -> &Trait { - | ^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | fn deref(&self) -> &dyn Trait { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | note: first, the lifetime cannot outlive the anonymous lifetime #1 defined on the method body at 8:5... --> $DIR/mismatched_trait_impl-2.rs:8:5 | -LL | / fn deref(&self) -> &Trait { +LL | / fn deref(&self) -> &dyn Trait { LL | | unimplemented!(); LL | | } | |_____^ diff --git a/src/test/ui/issues/issue-10291.nll.stderr b/src/test/ui/issues/issue-10291.nll.stderr index 45f29fd79565b..a7b827d27a87b 100644 --- a/src/test/ui/issues/issue-10291.nll.stderr +++ b/src/test/ui/issues/issue-10291.nll.stderr @@ -3,7 +3,7 @@ error: lifetime may not live long enough | LL | fn test<'x>(x: &'x isize) { | -- lifetime `'x` defined here -LL | drop:: FnMut(&'z isize) -> &'z isize>>(Box::new(|z| { +LL | drop:: FnMut(&'z isize) -> &'z isize>>(Box::new(|z| { LL | x | ^ returning this value requires that `'x` must outlive `'static` diff --git a/src/test/ui/issues/issue-10291.rs b/src/test/ui/issues/issue-10291.rs index 877b0aba47392..559c5fcac954b 100644 --- a/src/test/ui/issues/issue-10291.rs +++ b/src/test/ui/issues/issue-10291.rs @@ -1,5 +1,5 @@ fn test<'x>(x: &'x isize) { - drop:: FnMut(&'z isize) -> &'z isize>>(Box::new(|z| { + drop:: FnMut(&'z isize) -> &'z isize>>(Box::new(|z| { x //~ ERROR E0312 })); } diff --git a/src/test/ui/issues/issue-10291.stderr b/src/test/ui/issues/issue-10291.stderr index 0d653e6ced1ef..5e63469da59f5 100644 --- a/src/test/ui/issues/issue-10291.stderr +++ b/src/test/ui/issues/issue-10291.stderr @@ -4,11 +4,11 @@ error[E0312]: lifetime of reference outlives lifetime of borrowed content... LL | x | ^ | -note: ...the reference is valid for the anonymous lifetime #2 defined on the body at 2:65... - --> $DIR/issue-10291.rs:2:65 +note: ...the reference is valid for the anonymous lifetime #2 defined on the body at 2:69... + --> $DIR/issue-10291.rs:2:69 | -LL | drop:: FnMut(&'z isize) -> &'z isize>>(Box::new(|z| { - | _________________________________________________________________^ +LL | drop:: FnMut(&'z isize) -> &'z isize>>(Box::new(|z| { + | _____________________________________________________________________^ LL | | x LL | | })); | |_____^ diff --git a/src/test/ui/issues/issue-10902.rs b/src/test/ui/issues/issue-10902.rs index 672386bc8a6c2..5e7f8ed7fd5d2 100644 --- a/src/test/ui/issues/issue-10902.rs +++ b/src/test/ui/issues/issue-10902.rs @@ -4,16 +4,16 @@ pub mod two_tuple { pub trait T { fn dummy(&self) { } } - pub struct P<'a>(&'a (T + 'a), &'a (T + 'a)); - pub fn f<'a>(car: &'a T, cdr: &'a T) -> P<'a> { + pub struct P<'a>(&'a (dyn T + 'a), &'a (dyn T + 'a)); + pub fn f<'a>(car: &'a dyn T, cdr: &'a dyn T) -> P<'a> { P(car, cdr) } } pub mod two_fields { pub trait T { fn dummy(&self) { } } - pub struct P<'a> { car: &'a (T + 'a), cdr: &'a (T + 'a) } - pub fn f<'a>(car: &'a T, cdr: &'a T) -> P<'a> { + pub struct P<'a> { car: &'a (dyn T + 'a), cdr: &'a (dyn T + 'a) } + pub fn f<'a>(car: &'a dyn T, cdr: &'a dyn T) -> P<'a> { P{ car: car, cdr: cdr } } } diff --git a/src/test/ui/issues/issue-11374.rs b/src/test/ui/issues/issue-11374.rs index f00da0acf8124..7519ba2826e7a 100644 --- a/src/test/ui/issues/issue-11374.rs +++ b/src/test/ui/issues/issue-11374.rs @@ -2,11 +2,11 @@ use std::io::{self, Read}; use std::vec; pub struct Container<'a> { - reader: &'a mut Read + reader: &'a mut dyn Read } impl<'a> Container<'a> { - pub fn wrap<'s>(reader: &'s mut io::Read) -> Container<'s> { + pub fn wrap<'s>(reader: &'s mut dyn io::Read) -> Container<'s> { Container { reader: reader } } @@ -17,7 +17,7 @@ impl<'a> Container<'a> { pub fn for_stdin<'a>() -> Container<'a> { let mut r = io::stdin(); - Container::wrap(&mut r as &mut io::Read) + Container::wrap(&mut r as &mut dyn io::Read) } fn main() { diff --git a/src/test/ui/issues/issue-11515.rs b/src/test/ui/issues/issue-11515.rs index 7eab2a26178af..a7671b9282a99 100644 --- a/src/test/ui/issues/issue-11515.rs +++ b/src/test/ui/issues/issue-11515.rs @@ -1,10 +1,10 @@ #![feature(box_syntax)] struct Test { - func: Box + func: Box } fn main() { - let closure: Box = Box::new(|| ()); + let closure: Box = Box::new(|| ()); let test = box Test { func: closure }; //~ ERROR mismatched types } diff --git a/src/test/ui/issues/issue-11612.rs b/src/test/ui/issues/issue-11612.rs index 4d6f4656d589d..fd4fb2443cbe7 100644 --- a/src/test/ui/issues/issue-11612.rs +++ b/src/test/ui/issues/issue-11612.rs @@ -14,11 +14,11 @@ struct B<'a, T:'a> { impl<'a, T> A for B<'a, T> {} -fn foo(_: &A) {} +fn foo(_: &dyn A) {} fn bar(b: &B) { foo(b); // Coercion should work - foo(b as &A); // Explicit cast should work as well + foo(b as &dyn A); // Explicit cast should work as well } fn main() {} diff --git a/src/test/ui/issues/issue-12470.rs b/src/test/ui/issues/issue-12470.rs index 77b78c8a1f723..0ade359923a0e 100644 --- a/src/test/ui/issues/issue-12470.rs +++ b/src/test/ui/issues/issue-12470.rs @@ -16,10 +16,10 @@ impl X for B { } struct A<'a> { - p: &'a (X+'a) + p: &'a (dyn X + 'a) } -fn make_a<'a>(p: &'a X) -> A<'a> { +fn make_a<'a>(p: &'a dyn X) -> A<'a> { A { p: p } } diff --git a/src/test/ui/issues/issue-13033.rs b/src/test/ui/issues/issue-13033.rs index a6c9e9712c050..e5274eb823d46 100644 --- a/src/test/ui/issues/issue-13033.rs +++ b/src/test/ui/issues/issue-13033.rs @@ -1,11 +1,11 @@ trait Foo { - fn bar(&mut self, other: &mut Foo); + fn bar(&mut self, other: &mut dyn Foo); } struct Baz; impl Foo for Baz { - fn bar(&mut self, other: &Foo) {} + fn bar(&mut self, other: &dyn Foo) {} //~^ ERROR method `bar` has an incompatible type for trait //~| expected type `fn(&mut Baz, &mut dyn Foo)` //~| found type `fn(&mut Baz, &dyn Foo)` diff --git a/src/test/ui/issues/issue-13033.stderr b/src/test/ui/issues/issue-13033.stderr index d1e8eb31c8834..195d0c39b2983 100644 --- a/src/test/ui/issues/issue-13033.stderr +++ b/src/test/ui/issues/issue-13033.stderr @@ -1,18 +1,18 @@ error[E0053]: method `bar` has an incompatible type for trait --> $DIR/issue-13033.rs:8:30 | -LL | fn bar(&mut self, other: &mut Foo); - | -------- type in trait +LL | fn bar(&mut self, other: &mut dyn Foo); + | ------------ type in trait ... -LL | fn bar(&mut self, other: &Foo) {} - | ^^^^ types differ in mutability +LL | fn bar(&mut self, other: &dyn Foo) {} + | ^^^^^^^^ types differ in mutability | = note: expected type `fn(&mut Baz, &mut dyn Foo)` found type `fn(&mut Baz, &dyn Foo)` help: consider change the type to match the mutability in trait | -LL | fn bar(&mut self, other: &mut Foo) {} - | ^^^^^^^^ +LL | fn bar(&mut self, other: &mut dyn Foo) {} + | ^^^^^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/issues/issue-13352.rs b/src/test/ui/issues/issue-13352.rs index c711e3b713f29..e6995be27d20e 100644 --- a/src/test/ui/issues/issue-13352.rs +++ b/src/test/ui/issues/issue-13352.rs @@ -1,6 +1,6 @@ // ignore-cloudabi no std::process -fn foo(_: Box) {} +fn foo(_: Box) {} fn main() { foo(loop { diff --git a/src/test/ui/issues/issue-13853-2.rs b/src/test/ui/issues/issue-13853-2.rs index b58f2bd3b3b7c..27319c98d6e35 100644 --- a/src/test/ui/issues/issue-13853-2.rs +++ b/src/test/ui/issues/issue-13853-2.rs @@ -2,5 +2,5 @@ trait FromStructReader<'a> { } trait ResponseHook { fn get(&self); } -fn foo(res : Box) { res.get } //~ ERROR attempted to take value of method +fn foo(res : Box) { res.get } //~ ERROR attempted to take value of method fn main() {} diff --git a/src/test/ui/issues/issue-13853-2.stderr b/src/test/ui/issues/issue-13853-2.stderr index 0853f5cffb762..ea3b38940cf01 100644 --- a/src/test/ui/issues/issue-13853-2.stderr +++ b/src/test/ui/issues/issue-13853-2.stderr @@ -1,8 +1,8 @@ error[E0615]: attempted to take value of method `get` on type `std::boxed::Box<(dyn ResponseHook + 'static)>` - --> $DIR/issue-13853-2.rs:5:39 + --> $DIR/issue-13853-2.rs:5:43 | -LL | fn foo(res : Box) { res.get } - | ^^^ help: use parentheses to call the method: `get()` +LL | fn foo(res : Box) { res.get } + | ^^^ help: use parentheses to call the method: `get()` error: aborting due to previous error diff --git a/src/test/ui/issues/issue-14285.rs b/src/test/ui/issues/issue-14285.rs index 934d72a67ca19..2ba9ff717739c 100644 --- a/src/test/ui/issues/issue-14285.rs +++ b/src/test/ui/issues/issue-14285.rs @@ -6,9 +6,9 @@ struct A; impl Foo for A {} -struct B<'a>(&'a (Foo+'a)); +struct B<'a>(&'a (dyn Foo + 'a)); -fn foo<'a>(a: &Foo) -> B<'a> { +fn foo<'a>(a: &dyn Foo) -> B<'a> { B(a) //~ ERROR explicit lifetime required in the type of `a` [E0621] } diff --git a/src/test/ui/issues/issue-14285.stderr b/src/test/ui/issues/issue-14285.stderr index c180ed03e540b..5c07066018e83 100644 --- a/src/test/ui/issues/issue-14285.stderr +++ b/src/test/ui/issues/issue-14285.stderr @@ -1,8 +1,8 @@ error[E0621]: explicit lifetime required in the type of `a` --> $DIR/issue-14285.rs:12:5 | -LL | fn foo<'a>(a: &Foo) -> B<'a> { - | ---- help: add explicit lifetime `'a` to the type of `a`: `&'a (dyn Foo + 'a)` +LL | fn foo<'a>(a: &dyn Foo) -> B<'a> { + | -------- help: add explicit lifetime `'a` to the type of `a`: `&'a (dyn Foo + 'a)` LL | B(a) | ^^^^ lifetime `'a` required diff --git a/src/test/ui/issues/issue-14366.rs b/src/test/ui/issues/issue-14366.rs index a6298f25d470b..bb338860d8b77 100644 --- a/src/test/ui/issues/issue-14366.rs +++ b/src/test/ui/issues/issue-14366.rs @@ -1,4 +1,4 @@ fn main() { - let _x = "test" as &::std::any::Any; + let _x = "test" as &dyn (::std::any::Any); //~^ ERROR the size for values of type } diff --git a/src/test/ui/issues/issue-14366.stderr b/src/test/ui/issues/issue-14366.stderr index a3588bb8ebe12..542d8a904c4e3 100644 --- a/src/test/ui/issues/issue-14366.stderr +++ b/src/test/ui/issues/issue-14366.stderr @@ -1,7 +1,7 @@ error[E0277]: the size for values of type `str` cannot be known at compilation time --> $DIR/issue-14366.rs:2:14 | -LL | let _x = "test" as &::std::any::Any; +LL | let _x = "test" as &dyn (::std::any::Any); | ^^^^^^ doesn't have a size known at compile-time | = help: the trait `std::marker::Sized` is not implemented for `str` diff --git a/src/test/ui/issues/issue-14901.rs b/src/test/ui/issues/issue-14901.rs index 61b2b64ddf0c1..9b89c1631df15 100644 --- a/src/test/ui/issues/issue-14901.rs +++ b/src/test/ui/issues/issue-14901.rs @@ -2,7 +2,7 @@ pub trait Reader {} enum Wrapper<'a> { - WrapReader(&'a (Reader + 'a)) + WrapReader(&'a (dyn Reader + 'a)) } trait Wrap<'a> { @@ -11,7 +11,7 @@ trait Wrap<'a> { impl<'a, R: Reader> Wrap<'a> for &'a mut R { fn wrap(self) -> Wrapper<'a> { - Wrapper::WrapReader(self as &'a mut Reader) + Wrapper::WrapReader(self as &'a mut dyn Reader) } } diff --git a/src/test/ui/issues/issue-14959.rs b/src/test/ui/issues/issue-14959.rs index 78ae21e2837af..60daaafbcc8bd 100644 --- a/src/test/ui/issues/issue-14959.rs +++ b/src/test/ui/issues/issue-14959.rs @@ -26,20 +26,20 @@ impl Alloy { } } -impl<'b> Fn<(&'b mut (Response+'b),)> for SendFile { - extern "rust-call" fn call(&self, (_res,): (&'b mut (Response+'b),)) {} +impl<'b> Fn<(&'b mut (dyn Response + 'b),)> for SendFile { + extern "rust-call" fn call(&self, (_res,): (&'b mut (dyn Response + 'b),)) {} } -impl<'b> FnMut<(&'b mut (Response+'b),)> for SendFile { - extern "rust-call" fn call_mut(&mut self, (_res,): (&'b mut (Response+'b),)) { +impl<'b> FnMut<(&'b mut (dyn Response + 'b),)> for SendFile { + extern "rust-call" fn call_mut(&mut self, (_res,): (&'b mut (dyn Response+'b),)) { self.call((_res,)) } } -impl<'b> FnOnce<(&'b mut (Response+'b),)> for SendFile { +impl<'b> FnOnce<(&'b mut (dyn Response + 'b),)> for SendFile { type Output = (); - extern "rust-call" fn call_once(self, (_res,): (&'b mut (Response+'b),)) { + extern "rust-call" fn call_once(self, (_res,): (&'b mut (dyn Response+'b),)) { self.call((_res,)) } } diff --git a/src/test/ui/issues/issue-16668.rs b/src/test/ui/issues/issue-16668.rs index f69ca4677c9c3..b570a2ced67bc 100644 --- a/src/test/ui/issues/issue-16668.rs +++ b/src/test/ui/issues/issue-16668.rs @@ -1,7 +1,7 @@ // compile-pass #![allow(dead_code)] struct Parser<'a, I, O> { - parse: Box Result + 'a> + parse: Box Result + 'a> } impl<'a, I: 'a, O: 'a> Parser<'a, I, O> { diff --git a/src/test/ui/issues/issue-16922.rs b/src/test/ui/issues/issue-16922.rs index 1e865515c4b74..10a5cccbceef0 100644 --- a/src/test/ui/issues/issue-16922.rs +++ b/src/test/ui/issues/issue-16922.rs @@ -1,7 +1,7 @@ use std::any::Any; -fn foo(value: &T) -> Box { - Box::new(value) as Box +fn foo(value: &T) -> Box { + Box::new(value) as Box //~^ ERROR explicit lifetime required in the type of `value` [E0621] } diff --git a/src/test/ui/issues/issue-16922.stderr b/src/test/ui/issues/issue-16922.stderr index 1f3b3fe739c44..4e3d3ecb9c03a 100644 --- a/src/test/ui/issues/issue-16922.stderr +++ b/src/test/ui/issues/issue-16922.stderr @@ -1,9 +1,9 @@ error[E0621]: explicit lifetime required in the type of `value` --> $DIR/issue-16922.rs:4:5 | -LL | fn foo(value: &T) -> Box { +LL | fn foo(value: &T) -> Box { | -- help: add explicit lifetime `'static` to the type of `value`: `&'static T` -LL | Box::new(value) as Box +LL | Box::new(value) as Box | ^^^^^^^^^^^^^^^ lifetime `'static` required error: aborting due to previous error diff --git a/src/test/ui/issues/issue-16994.rs b/src/test/ui/issues/issue-16994.rs index d356ce8a4da40..d5f1b1310eb5c 100644 --- a/src/test/ui/issues/issue-16994.rs +++ b/src/test/ui/issues/issue-16994.rs @@ -1,6 +1,6 @@ // compile-pass // skip-codegen -fn cb<'a,T>(_x: Box, bool))) -> T>) -> T { +fn cb<'a,T>(_x: Box, bool))) -> T>) -> T { panic!() } diff --git a/src/test/ui/issues/issue-17441.rs b/src/test/ui/issues/issue-17441.rs index cfb2fe674edf7..b9813ef1eef77 100644 --- a/src/test/ui/issues/issue-17441.rs +++ b/src/test/ui/issues/issue-17441.rs @@ -2,10 +2,10 @@ fn main() { let _foo = &[1_usize, 2] as [usize]; //~^ ERROR cast to unsized type: `&[usize; 2]` as `[usize]` - let _bar = Box::new(1_usize) as std::fmt::Debug; + let _bar = Box::new(1_usize) as dyn std::fmt::Debug; //~^ ERROR cast to unsized type: `std::boxed::Box` as `dyn std::fmt::Debug` - let _baz = 1_usize as std::fmt::Debug; + let _baz = 1_usize as dyn std::fmt::Debug; //~^ ERROR cast to unsized type: `usize` as `dyn std::fmt::Debug` let _quux = [1_usize, 2] as [usize]; diff --git a/src/test/ui/issues/issue-17441.stderr b/src/test/ui/issues/issue-17441.stderr index 436ee7325f8e5..0ab035515a051 100644 --- a/src/test/ui/issues/issue-17441.stderr +++ b/src/test/ui/issues/issue-17441.stderr @@ -13,21 +13,21 @@ LL | let _foo = &[1_usize, 2] as [usize]; error[E0620]: cast to unsized type: `std::boxed::Box` as `dyn std::fmt::Debug` --> $DIR/issue-17441.rs:5:16 | -LL | let _bar = Box::new(1_usize) as std::fmt::Debug; - | ^^^^^^^^^^^^^^^^^^^^^--------------- +LL | let _bar = Box::new(1_usize) as dyn std::fmt::Debug; + | ^^^^^^^^^^^^^^^^^^^^^------------------- | | - | help: try casting to a `Box` instead: `Box` + | help: try casting to a `Box` instead: `Box` error[E0620]: cast to unsized type: `usize` as `dyn std::fmt::Debug` --> $DIR/issue-17441.rs:8:16 | -LL | let _baz = 1_usize as std::fmt::Debug; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | let _baz = 1_usize as dyn std::fmt::Debug; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | help: consider using a box or reference as appropriate --> $DIR/issue-17441.rs:8:16 | -LL | let _baz = 1_usize as std::fmt::Debug; +LL | let _baz = 1_usize as dyn std::fmt::Debug; | ^^^^^^^ error[E0620]: cast to unsized type: `[usize; 2]` as `[usize]` diff --git a/src/test/ui/issues/issue-17959.rs b/src/test/ui/issues/issue-17959.rs index d56f346ecd45a..73865ae2d2eb6 100644 --- a/src/test/ui/issues/issue-17959.rs +++ b/src/test/ui/issues/issue-17959.rs @@ -17,5 +17,5 @@ impl Drop for G { } fn main() { - let x:G; + let x:G; } diff --git a/src/test/ui/issues/issue-18107.rs b/src/test/ui/issues/issue-18107.rs index 184d122d5cd61..122940f1c1726 100644 --- a/src/test/ui/issues/issue-18107.rs +++ b/src/test/ui/issues/issue-18107.rs @@ -1,7 +1,7 @@ pub trait AbstractRenderer {} fn _create_render(_: &()) -> - AbstractRenderer + dyn AbstractRenderer //~^ ERROR the size for values of type { match 0 { diff --git a/src/test/ui/issues/issue-18107.stderr b/src/test/ui/issues/issue-18107.stderr index 23b58c3f6df3d..9bdf470413b1c 100644 --- a/src/test/ui/issues/issue-18107.stderr +++ b/src/test/ui/issues/issue-18107.stderr @@ -1,8 +1,8 @@ error[E0277]: the size for values of type `(dyn AbstractRenderer + 'static)` cannot be known at compilation time --> $DIR/issue-18107.rs:4:5 | -LL | AbstractRenderer - | ^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time +LL | dyn AbstractRenderer + | ^^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time | = help: the trait `std::marker::Sized` is not implemented for `(dyn AbstractRenderer + 'static)` = note: to learn more, visit diff --git a/src/test/ui/issues/issue-18188.rs b/src/test/ui/issues/issue-18188.rs index 8e39dc15597e7..4d0c4464759c6 100644 --- a/src/test/ui/issues/issue-18188.rs +++ b/src/test/ui/issues/issue-18188.rs @@ -5,7 +5,7 @@ pub trait Promisable: Send + Sync {} impl Promisable for T {} pub fn propagate<'a, T, E, F, G>(mut action: F) - -> Box) -> Result + 'a> + -> Box) -> Result + 'a> where T: Promisable + Clone + 'a, E: Promisable + Clone + 'a, diff --git a/src/test/ui/issues/issue-18446-2.rs b/src/test/ui/issues/issue-18446-2.rs index 2f05ece31979f..3e04a914d4586 100644 --- a/src/test/ui/issues/issue-18446-2.rs +++ b/src/test/ui/issues/issue-18446-2.rs @@ -6,7 +6,7 @@ trait T { fn foo(&self) -> i32 { 0 } } -impl<'a> T + 'a { +impl<'a> dyn T + 'a { fn foo(&self) -> i32 { 1 } } diff --git a/src/test/ui/issues/issue-18446.rs b/src/test/ui/issues/issue-18446.rs index 64c89df3868cc..a2e238da03a3e 100644 --- a/src/test/ui/issues/issue-18446.rs +++ b/src/test/ui/issues/issue-18446.rs @@ -5,7 +5,7 @@ trait T { fn foo(&self); } -impl<'a> T + 'a { +impl<'a> dyn T + 'a { fn foo(&self) {} } @@ -14,6 +14,6 @@ impl T for i32 { } fn main() { - let x: &T = &0i32; + let x: &dyn T = &0i32; x.foo(); //~ ERROR multiple applicable items in scope [E0034] } diff --git a/src/test/ui/issues/issue-18783.rs b/src/test/ui/issues/issue-18783.rs index b84a1adb42569..d4851ac14187e 100644 --- a/src/test/ui/issues/issue-18783.rs +++ b/src/test/ui/issues/issue-18783.rs @@ -18,11 +18,11 @@ fn ufcs() { } trait Push<'c> { - fn push<'f: 'c>(&self, push: Box); + fn push<'f: 'c>(&self, push: Box); } -impl<'c> Push<'c> for RefCell>> { - fn push<'f: 'c>(&self, fun: Box) { +impl<'c> Push<'c> for RefCell>> { + fn push<'f: 'c>(&self, fun: Box) { self.borrow_mut().push(fun) } } diff --git a/src/test/ui/issues/issue-18819.rs b/src/test/ui/issues/issue-18819.rs index 80db056e7dd3a..e634c55f824fd 100644 --- a/src/test/ui/issues/issue-18819.rs +++ b/src/test/ui/issues/issue-18819.rs @@ -8,7 +8,7 @@ impl Foo for X { type Item = bool; } -fn print_x(_: &Foo, extra: &str) { +fn print_x(_: &dyn Foo, extra: &str) { println!("{}", extra); } diff --git a/src/test/ui/issues/issue-18819.stderr b/src/test/ui/issues/issue-18819.stderr index eb7e4ad405fa1..41e8470ecd04f 100644 --- a/src/test/ui/issues/issue-18819.stderr +++ b/src/test/ui/issues/issue-18819.stderr @@ -1,8 +1,8 @@ error[E0061]: this function takes 2 parameters but 1 parameter was supplied --> $DIR/issue-18819.rs:16:5 | -LL | fn print_x(_: &Foo, extra: &str) { - | ------------------------------------------- defined here +LL | fn print_x(_: &dyn Foo, extra: &str) { + | ----------------------------------------------- defined here ... LL | print_x(X); | ^^^^^^^^^^ expected 2 parameters diff --git a/src/test/ui/issues/issue-18919.rs b/src/test/ui/issues/issue-18919.rs index 9db3084918239..91fbb13cd6988 100644 --- a/src/test/ui/issues/issue-18919.rs +++ b/src/test/ui/issues/issue-18919.rs @@ -1,4 +1,4 @@ -type FuncType<'f> = Fn(&isize) -> isize + 'f; +type FuncType<'f> = dyn Fn(&isize) -> isize + 'f; fn ho_func(f: Option) { //~^ ERROR the size for values of type diff --git a/src/test/ui/issues/issue-18937.rs b/src/test/ui/issues/issue-18937.rs index f3824765f237a..ab4c9c736d896 100644 --- a/src/test/ui/issues/issue-18937.rs +++ b/src/test/ui/issues/issue-18937.rs @@ -6,7 +6,7 @@ use std::fmt; struct MyString<'a>(&'a String); struct B { - list: Vec>, + list: Vec>, } trait A<'a> { diff --git a/src/test/ui/issues/issue-18959.rs b/src/test/ui/issues/issue-18959.rs index b07800928bc22..4b6f04e251b94 100644 --- a/src/test/ui/issues/issue-18959.rs +++ b/src/test/ui/issues/issue-18959.rs @@ -8,13 +8,13 @@ impl Foo for Thing { } #[inline(never)] -fn foo(b: &Bar) { +fn foo(b: &dyn Bar) { //~^ ERROR E0038 b.foo(&0) } fn main() { let mut thing = Thing; - let test: &Bar = &mut thing; + let test: &dyn Bar = &mut thing; foo(test); } diff --git a/src/test/ui/issues/issue-18959.stderr b/src/test/ui/issues/issue-18959.stderr index 939390102c387..63c33b7f4472d 100644 --- a/src/test/ui/issues/issue-18959.stderr +++ b/src/test/ui/issues/issue-18959.stderr @@ -1,8 +1,8 @@ error[E0038]: the trait `Bar` cannot be made into an object --> $DIR/issue-18959.rs:11:1 | -LL | fn foo(b: &Bar) { - | ^^^^^^^^^^^^^^^ the trait `Bar` cannot be made into an object +LL | fn foo(b: &dyn Bar) { + | ^^^^^^^^^^^^^^^^^^^ the trait `Bar` cannot be made into an object | = note: method `foo` has generic type parameters diff --git a/src/test/ui/issues/issue-18988.rs b/src/test/ui/issues/issue-18988.rs index e03934866495b..7fe662e907d73 100644 --- a/src/test/ui/issues/issue-18988.rs +++ b/src/test/ui/issues/issue-18988.rs @@ -3,7 +3,7 @@ pub trait Foo : Send { } pub struct MyFoo { - children: Vec>, + children: Vec>, } impl Foo for MyFoo { } diff --git a/src/test/ui/issues/issue-19380.rs b/src/test/ui/issues/issue-19380.rs index efbc5a0346ac5..5c10e2067e408 100644 --- a/src/test/ui/issues/issue-19380.rs +++ b/src/test/ui/issues/issue-19380.rs @@ -8,7 +8,7 @@ impl Qiz for Foo { } struct Bar { - foos: &'static [&'static (Qiz + 'static)] + foos: &'static [&'static (dyn Qiz + 'static)] //~^ ERROR E0038 } diff --git a/src/test/ui/issues/issue-19380.stderr b/src/test/ui/issues/issue-19380.stderr index 060e160f2e484..27e3ff57bf9ab 100644 --- a/src/test/ui/issues/issue-19380.stderr +++ b/src/test/ui/issues/issue-19380.stderr @@ -1,8 +1,8 @@ error[E0038]: the trait `Qiz` cannot be made into an object --> $DIR/issue-19380.rs:11:3 | -LL | foos: &'static [&'static (Qiz + 'static)] - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Qiz` cannot be made into an object +LL | foos: &'static [&'static (dyn Qiz + 'static)] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Qiz` cannot be made into an object | = note: method `qiz` has no receiver diff --git a/src/test/ui/issues/issue-19404.rs b/src/test/ui/issues/issue-19404.rs index cdec74fe9684d..59544393bae05 100644 --- a/src/test/ui/issues/issue-19404.rs +++ b/src/test/ui/issues/issue-19404.rs @@ -12,10 +12,10 @@ trait Component: 'static {} impl Component for Engine {} trait Env { - fn get_component_type_id(&self, type_id: TypeId) -> Option>; + fn get_component_type_id(&self, type_id: TypeId) -> Option>; } -impl<'a> Env+'a { +impl<'a> dyn Env + 'a { fn get_component(&self) -> Option> { let x = self.get_component_type_id(TypeId::of::()); None @@ -23,13 +23,13 @@ impl<'a> Env+'a { } trait Figment { - fn init(&mut self, env: &Env); + fn init(&mut self, env: &dyn Env); } struct MyFigment; impl Figment for MyFigment { - fn init(&mut self, env: &Env) { + fn init(&mut self, env: &dyn Env) { let engine = env.get_component::(); } } diff --git a/src/test/ui/issues/issue-19482.rs b/src/test/ui/issues/issue-19482.rs index 6ba334905499e..9e4b77d87f8b5 100644 --- a/src/test/ui/issues/issue-19482.rs +++ b/src/test/ui/issues/issue-19482.rs @@ -7,7 +7,7 @@ trait Foo { fn dummy(&self) { } } -fn bar(x: &Foo) {} +fn bar(x: &dyn Foo) {} //~^ ERROR the associated type `A` (from the trait `Foo`) must be specified pub fn main() {} diff --git a/src/test/ui/issues/issue-19482.stderr b/src/test/ui/issues/issue-19482.stderr index a8894f84e743d..f1e5419c71229 100644 --- a/src/test/ui/issues/issue-19482.stderr +++ b/src/test/ui/issues/issue-19482.stderr @@ -4,8 +4,8 @@ error[E0191]: the value of the associated type `A` (from the trait `Foo`) must b LL | type A; | ------- `A` defined here ... -LL | fn bar(x: &Foo) {} - | ^^^ associated type `A` must be specified +LL | fn bar(x: &dyn Foo) {} + | ^^^^^^^ associated type `A` must be specified error: aborting due to previous error diff --git a/src/test/ui/issues/issue-19538.rs b/src/test/ui/issues/issue-19538.rs index 9f0b08d6c357c..7054ef41b1c82 100644 --- a/src/test/ui/issues/issue-19538.rs +++ b/src/test/ui/issues/issue-19538.rs @@ -14,7 +14,7 @@ impl Bar for Thing { } fn main() { let mut thing = Thing; - let test: &mut Bar = &mut thing; + let test: &mut dyn Bar = &mut thing; //~^ ERROR E0038 //~| ERROR E0038 } diff --git a/src/test/ui/issues/issue-19538.stderr b/src/test/ui/issues/issue-19538.stderr index d0f05a41d4d3a..e5da0a9b0dac3 100644 --- a/src/test/ui/issues/issue-19538.stderr +++ b/src/test/ui/issues/issue-19538.stderr @@ -1,16 +1,16 @@ error[E0038]: the trait `Bar` cannot be made into an object --> $DIR/issue-19538.rs:17:15 | -LL | let test: &mut Bar = &mut thing; - | ^^^^^^^^ the trait `Bar` cannot be made into an object +LL | let test: &mut dyn Bar = &mut thing; + | ^^^^^^^^^^^^ the trait `Bar` cannot be made into an object | = note: method `foo` has generic type parameters error[E0038]: the trait `Bar` cannot be made into an object - --> $DIR/issue-19538.rs:17:26 + --> $DIR/issue-19538.rs:17:30 | -LL | let test: &mut Bar = &mut thing; - | ^^^^^^^^^^ the trait `Bar` cannot be made into an object +LL | let test: &mut dyn Bar = &mut thing; + | ^^^^^^^^^^ the trait `Bar` cannot be made into an object | = note: method `foo` has generic type parameters = note: required because of the requirements on the impl of `std::ops::CoerceUnsized<&mut dyn Bar>` for `&mut Thing` diff --git a/src/test/ui/issues/issue-20396.rs b/src/test/ui/issues/issue-20396.rs index b6dfffbd69ebb..0e69b7f3d1e0c 100644 --- a/src/test/ui/issues/issue-20396.rs +++ b/src/test/ui/issues/issue-20396.rs @@ -10,7 +10,7 @@ trait Foo { enum Bar { Bla(T) } struct Baz<'a> { - inner: for<'b> Foo> + 'a, + inner: dyn for<'b> Foo> + 'a, } fn main() {} diff --git a/src/test/ui/issues/issue-20605.rs b/src/test/ui/issues/issue-20605.rs index 11a2a573ea677..17b7d32ebf59b 100644 --- a/src/test/ui/issues/issue-20605.rs +++ b/src/test/ui/issues/issue-20605.rs @@ -1,4 +1,4 @@ -fn changer<'a>(mut things: Box>) { +fn changer<'a>(mut things: Box>) { for item in *things { *item = 0 } //~^ ERROR the size for values of type } diff --git a/src/test/ui/issues/issue-20692.rs b/src/test/ui/issues/issue-20692.rs index ea89bca78d076..2a05bba7b1632 100644 --- a/src/test/ui/issues/issue-20692.rs +++ b/src/test/ui/issues/issue-20692.rs @@ -4,7 +4,7 @@ fn f(x: &T) { let _ = x //~^ ERROR `Array` cannot be made into an object as - &Array; + &dyn Array; //~^ ERROR `Array` cannot be made into an object } diff --git a/src/test/ui/issues/issue-20692.stderr b/src/test/ui/issues/issue-20692.stderr index acc223c0b2dfc..66309394a426d 100644 --- a/src/test/ui/issues/issue-20692.stderr +++ b/src/test/ui/issues/issue-20692.stderr @@ -1,8 +1,8 @@ error[E0038]: the trait `Array` cannot be made into an object --> $DIR/issue-20692.rs:7:5 | -LL | &Array; - | ^^^^^^ the trait `Array` cannot be made into an object +LL | &dyn Array; + | ^^^^^^^^^^ the trait `Array` cannot be made into an object | = note: the trait cannot require that `Self : Sized` diff --git a/src/test/ui/issues/issue-20831-debruijn.rs b/src/test/ui/issues/issue-20831-debruijn.rs index 6d3c7331a4579..ef4b1581fd874 100644 --- a/src/test/ui/issues/issue-20831-debruijn.rs +++ b/src/test/ui/issues/issue-20831-debruijn.rs @@ -12,7 +12,7 @@ pub trait Subscriber { pub trait Publisher<'a> { type Output; - fn subscribe(&mut self, _: Box + 'a>); + fn subscribe(&mut self, _: Box + 'a>); } pub trait Processor<'a> : Subscriber + Publisher<'a> { } @@ -20,12 +20,12 @@ pub trait Processor<'a> : Subscriber + Publisher<'a> { } impl<'a, P> Processor<'a> for P where P : Subscriber + Publisher<'a> { } struct MyStruct<'a> { - sub: Box + 'a> + sub: Box + 'a> } impl<'a> Publisher<'a> for MyStruct<'a> { type Output = u64; - fn subscribe(&mut self, t : Box::Output> + 'a>) { + fn subscribe(&mut self, t : Box::Output> + 'a>) { // Not obvious, but there is an implicit lifetime here -------^ //~^^ ERROR cannot infer //~| ERROR mismatched types diff --git a/src/test/ui/issues/issue-20831-debruijn.stderr b/src/test/ui/issues/issue-20831-debruijn.stderr index 70a395d0b89eb..64e3cdc64c112 100644 --- a/src/test/ui/issues/issue-20831-debruijn.stderr +++ b/src/test/ui/issues/issue-20831-debruijn.stderr @@ -1,7 +1,7 @@ error[E0308]: mismatched types --> $DIR/issue-20831-debruijn.rs:28:5 | -LL | / fn subscribe(&mut self, t : Box::Output> + 'a>) { +LL | / fn subscribe(&mut self, t : Box::Output> + 'a>) { LL | | // Not obvious, but there is an implicit lifetime here -------^ LL | | LL | | @@ -15,7 +15,7 @@ LL | | } note: the anonymous lifetime #2 defined on the method body at 28:5... --> $DIR/issue-20831-debruijn.rs:28:5 | -LL | / fn subscribe(&mut self, t : Box::Output> + 'a>) { +LL | / fn subscribe(&mut self, t : Box::Output> + 'a>) { LL | | // Not obvious, but there is an implicit lifetime here -------^ LL | | LL | | @@ -32,7 +32,7 @@ LL | impl<'a> Publisher<'a> for MyStruct<'a> { error[E0308]: mismatched types --> $DIR/issue-20831-debruijn.rs:28:5 | -LL | / fn subscribe(&mut self, t : Box::Output> + 'a>) { +LL | / fn subscribe(&mut self, t : Box::Output> + 'a>) { LL | | // Not obvious, but there is an implicit lifetime here -------^ LL | | LL | | @@ -51,7 +51,7 @@ LL | impl<'a> Publisher<'a> for MyStruct<'a> { note: ...does not necessarily outlive the anonymous lifetime #2 defined on the method body at 28:5 --> $DIR/issue-20831-debruijn.rs:28:5 | -LL | / fn subscribe(&mut self, t : Box::Output> + 'a>) { +LL | / fn subscribe(&mut self, t : Box::Output> + 'a>) { LL | | // Not obvious, but there is an implicit lifetime here -------^ LL | | LL | | @@ -63,7 +63,7 @@ LL | | } error[E0495]: cannot infer an appropriate lifetime for lifetime parameter `'a` due to conflicting requirements --> $DIR/issue-20831-debruijn.rs:28:5 | -LL | / fn subscribe(&mut self, t : Box::Output> + 'a>) { +LL | / fn subscribe(&mut self, t : Box::Output> + 'a>) { LL | | // Not obvious, but there is an implicit lifetime here -------^ LL | | LL | | @@ -75,7 +75,7 @@ LL | | } note: first, the lifetime cannot outlive the anonymous lifetime #2 defined on the method body at 28:5... --> $DIR/issue-20831-debruijn.rs:28:5 | -LL | / fn subscribe(&mut self, t : Box::Output> + 'a>) { +LL | / fn subscribe(&mut self, t : Box::Output> + 'a>) { LL | | // Not obvious, but there is an implicit lifetime here -------^ LL | | LL | | diff --git a/src/test/ui/issues/issue-20939.rs b/src/test/ui/issues/issue-20939.rs index 259fff2e6c2f8..c0c222978970d 100644 --- a/src/test/ui/issues/issue-20939.rs +++ b/src/test/ui/issues/issue-20939.rs @@ -1,6 +1,6 @@ trait Foo {} -impl<'a> Foo for Foo+'a {} +impl<'a> Foo for dyn Foo + 'a {} //~^ ERROR the object type `(dyn Foo + 'a)` automatically implements the trait `Foo` fn main() {} diff --git a/src/test/ui/issues/issue-20939.stderr b/src/test/ui/issues/issue-20939.stderr index d15a5196667f3..3819a21a2cfff 100644 --- a/src/test/ui/issues/issue-20939.stderr +++ b/src/test/ui/issues/issue-20939.stderr @@ -1,8 +1,8 @@ error[E0371]: the object type `(dyn Foo + 'a)` automatically implements the trait `Foo` --> $DIR/issue-20939.rs:3:1 | -LL | impl<'a> Foo for Foo+'a {} - | ^^^^^^^^^^^^^^^^^^^^^^^ `(dyn Foo + 'a)` automatically implements trait `Foo` +LL | impl<'a> Foo for dyn Foo + 'a {} + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `(dyn Foo + 'a)` automatically implements trait `Foo` error: aborting due to previous error diff --git a/src/test/ui/issues/issue-21363.rs b/src/test/ui/issues/issue-21363.rs index 5e30db17c6d18..12efce9496efa 100644 --- a/src/test/ui/issues/issue-21363.rs +++ b/src/test/ui/issues/issue-21363.rs @@ -8,7 +8,7 @@ trait Iterator { fn dummy(&self) { } } -impl<'a, T> Iterator for &'a mut (Iterator + 'a) { +impl<'a, T> Iterator for &'a mut (dyn Iterator + 'a) { type Item = T; } diff --git a/src/test/ui/issues/issue-21950.rs b/src/test/ui/issues/issue-21950.rs index b902893bf8224..0bc87824ccec3 100644 --- a/src/test/ui/issues/issue-21950.rs +++ b/src/test/ui/issues/issue-21950.rs @@ -2,7 +2,7 @@ use std::ops::Add; fn main() { let x = &10 as - &Add; + &dyn Add; //~^ ERROR E0393 //~| ERROR E0191 } diff --git a/src/test/ui/issues/issue-21950.stderr b/src/test/ui/issues/issue-21950.stderr index 7655e0811e066..9be7b052da31c 100644 --- a/src/test/ui/issues/issue-21950.stderr +++ b/src/test/ui/issues/issue-21950.stderr @@ -1,16 +1,16 @@ error[E0393]: the type parameter `Rhs` must be explicitly specified - --> $DIR/issue-21950.rs:5:14 + --> $DIR/issue-21950.rs:5:18 | -LL | &Add; - | ^^^ missing reference to `Rhs` +LL | &dyn Add; + | ^^^ missing reference to `Rhs` | = note: because of the default `Self` reference, type parameters must be specified on object types error[E0191]: the value of the associated type `Output` (from the trait `std::ops::Add`) must be specified --> $DIR/issue-21950.rs:5:14 | -LL | &Add; - | ^^^ associated type `Output` must be specified +LL | &dyn Add; + | ^^^^^^^ associated type `Output` must be specified error: aborting due to 2 previous errors diff --git a/src/test/ui/issues/issue-22034.rs b/src/test/ui/issues/issue-22034.rs index 75ac78ad24fea..508c9c91b04e5 100644 --- a/src/test/ui/issues/issue-22034.rs +++ b/src/test/ui/issues/issue-22034.rs @@ -4,8 +4,8 @@ extern crate libc; fn main() { let ptr: *mut () = 0 as *mut _; - let _: &mut Fn() = unsafe { - &mut *(ptr as *mut Fn()) + let _: &mut dyn Fn() = unsafe { + &mut *(ptr as *mut dyn Fn()) //~^ ERROR expected a `std::ops::Fn<()>` closure, found `()` }; } diff --git a/src/test/ui/issues/issue-22034.stderr b/src/test/ui/issues/issue-22034.stderr index de2d315ff5c68..19fb080154a4a 100644 --- a/src/test/ui/issues/issue-22034.stderr +++ b/src/test/ui/issues/issue-22034.stderr @@ -1,7 +1,7 @@ error[E0277]: expected a `std::ops::Fn<()>` closure, found `()` --> $DIR/issue-22034.rs:8:16 | -LL | &mut *(ptr as *mut Fn()) +LL | &mut *(ptr as *mut dyn Fn()) | ^^^ expected an `Fn<()>` closure, found `()` | = help: the trait `std::ops::Fn<()>` is not implemented for `()` diff --git a/src/test/ui/issues/issue-22289.rs b/src/test/ui/issues/issue-22289.rs index b683834de441b..e1b3dfe5b61bd 100644 --- a/src/test/ui/issues/issue-22289.rs +++ b/src/test/ui/issues/issue-22289.rs @@ -1,3 +1,3 @@ fn main() { - 0 as &std::any::Any; //~ ERROR non-primitive cast + 0 as &dyn std::any::Any; //~ ERROR non-primitive cast } diff --git a/src/test/ui/issues/issue-22289.stderr b/src/test/ui/issues/issue-22289.stderr index e9846b848f431..cc7ace30cabef 100644 --- a/src/test/ui/issues/issue-22289.stderr +++ b/src/test/ui/issues/issue-22289.stderr @@ -1,8 +1,8 @@ error[E0605]: non-primitive cast: `i32` as `&(dyn std::any::Any + 'static)` --> $DIR/issue-22289.rs:2:5 | -LL | 0 as &std::any::Any; - | ^^^^^^^^^^^^^^^^^^^ +LL | 0 as &dyn std::any::Any; + | ^^^^^^^^^^^^^^^^^^^^^^^ | = note: an `as` expression can only be used to convert between primitive types. Consider using the `From` trait diff --git a/src/test/ui/issues/issue-22312.rs b/src/test/ui/issues/issue-22312.rs index f7ebdb0372ad8..250fec2588702 100644 --- a/src/test/ui/issues/issue-22312.rs +++ b/src/test/ui/issues/issue-22312.rs @@ -8,7 +8,7 @@ pub trait Array2D: Index { return None; } let i = y * self.columns() + x; - let indexer = &(*self as &Index>::Output>); + let indexer = &(*self as &dyn Index>::Output>); //~^ERROR non-primitive cast Some(indexer.index(i)) } diff --git a/src/test/ui/issues/issue-22312.stderr b/src/test/ui/issues/issue-22312.stderr index 6a012b214c504..fc32fd376b75a 100644 --- a/src/test/ui/issues/issue-22312.stderr +++ b/src/test/ui/issues/issue-22312.stderr @@ -1,8 +1,8 @@ error[E0605]: non-primitive cast: `Self` as `&dyn std::ops::Index>::Output>` --> $DIR/issue-22312.rs:11:24 | -LL | let indexer = &(*self as &Index>::Output>); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | let indexer = &(*self as &dyn Index>::Output>); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: an `as` expression can only be used to convert between primitive types. Consider using the `From` trait diff --git a/src/test/ui/issues/issue-22370.rs b/src/test/ui/issues/issue-22370.rs index 90912cfda0d4e..bab0469c01193 100644 --- a/src/test/ui/issues/issue-22370.rs +++ b/src/test/ui/issues/issue-22370.rs @@ -1,6 +1,6 @@ trait A {} -fn f(a: &A) {} +fn f(a: &dyn A) {} //~^ ERROR E0393 fn main() {} diff --git a/src/test/ui/issues/issue-22370.stderr b/src/test/ui/issues/issue-22370.stderr index f21551a55bc9a..3ce164e9548b4 100644 --- a/src/test/ui/issues/issue-22370.stderr +++ b/src/test/ui/issues/issue-22370.stderr @@ -1,8 +1,8 @@ error[E0393]: the type parameter `T` must be explicitly specified - --> $DIR/issue-22370.rs:3:10 + --> $DIR/issue-22370.rs:3:14 | -LL | fn f(a: &A) {} - | ^ missing reference to `T` +LL | fn f(a: &dyn A) {} + | ^ missing reference to `T` | = note: because of the default `Self` reference, type parameters must be specified on object types diff --git a/src/test/ui/issues/issue-22434.rs b/src/test/ui/issues/issue-22434.rs index 0d7d67cbc1bc2..3e800a2b61db9 100644 --- a/src/test/ui/issues/issue-22434.rs +++ b/src/test/ui/issues/issue-22434.rs @@ -2,7 +2,7 @@ pub trait Foo { type A; } -type I<'a> = &'a (Foo + 'a); +type I<'a> = &'a (dyn Foo + 'a); //~^ ERROR the value of the associated type `A` (from the trait `Foo`) must be specified fn main() {} diff --git a/src/test/ui/issues/issue-22434.stderr b/src/test/ui/issues/issue-22434.stderr index bbdbeb6ae9804..eb78c4fc311fc 100644 --- a/src/test/ui/issues/issue-22434.stderr +++ b/src/test/ui/issues/issue-22434.stderr @@ -4,8 +4,8 @@ error[E0191]: the value of the associated type `A` (from the trait `Foo`) must b LL | type A; | ------- `A` defined here ... -LL | type I<'a> = &'a (Foo + 'a); - | ^^^^^^^^ associated type `A` must be specified +LL | type I<'a> = &'a (dyn Foo + 'a); + | ^^^^^^^^^^^^ associated type `A` must be specified error: aborting due to previous error diff --git a/src/test/ui/issues/issue-22560.rs b/src/test/ui/issues/issue-22560.rs index 4b8e3aa9eb3e1..acee99dbedcc4 100644 --- a/src/test/ui/issues/issue-22560.rs +++ b/src/test/ui/issues/issue-22560.rs @@ -1,6 +1,6 @@ use std::ops::{Add, Sub}; -type Test = Add + +type Test = dyn Add + //~^ ERROR E0393 //~| ERROR E0191 Sub; diff --git a/src/test/ui/issues/issue-22560.stderr b/src/test/ui/issues/issue-22560.stderr index 322136d35cad1..5b58adb197c69 100644 --- a/src/test/ui/issues/issue-22560.stderr +++ b/src/test/ui/issues/issue-22560.stderr @@ -7,21 +7,21 @@ LL | Sub; = note: because of the default `Self` reference, type parameters must be specified on object types error[E0393]: the type parameter `Rhs` must be explicitly specified - --> $DIR/issue-22560.rs:3:13 + --> $DIR/issue-22560.rs:3:17 | -LL | type Test = Add + - | ^^^ missing reference to `Rhs` +LL | type Test = dyn Add + + | ^^^ missing reference to `Rhs` | = note: because of the default `Self` reference, type parameters must be specified on object types error[E0225]: only auto traits can be used as additional traits in a trait object --> $DIR/issue-22560.rs:6:13 | -LL | type Test = Add + - | --- - | | - | first non-auto trait - | trait alias used in trait object type (first use) +LL | type Test = dyn Add + + | --- + | | + | first non-auto trait + | trait alias used in trait object type (first use) ... LL | Sub; | ^^^ @@ -32,7 +32,7 @@ LL | Sub; error[E0191]: the value of the associated types `Output` (from the trait `std::ops::Add`), `Output` (from the trait `std::ops::Sub`) must be specified --> $DIR/issue-22560.rs:3:13 | -LL | type Test = Add + +LL | type Test = dyn Add + | _____________^ | |_____________| | | diff --git a/src/test/ui/issues/issue-22781.rs b/src/test/ui/issues/issue-22781.rs index 5df3d88b168fa..a7b94c106a4c8 100644 --- a/src/test/ui/issues/issue-22781.rs +++ b/src/test/ui/issues/issue-22781.rs @@ -4,7 +4,7 @@ use std::collections::HashMap; use std::collections::hash_map::Entry::Vacant; pub fn foo() { - type F = Box; + type F = Box; let mut map: HashMap<(), F> = HashMap::new(); let x: &mut F = match map.entry(()) { Vacant(_) => unimplemented!(), diff --git a/src/test/ui/issues/issue-22872.rs b/src/test/ui/issues/issue-22872.rs index 8ef4af15bd462..5db2891e65e75 100644 --- a/src/test/ui/issues/issue-22872.rs +++ b/src/test/ui/issues/issue-22872.rs @@ -17,7 +17,7 @@ pub trait Process<'a> { } fn push_process

(process: P) where P: Process<'static> { - let _: Box Wrap<'b>> = Box::new(Wrapper(process)); + let _: Box Wrap<'b>> = Box::new(Wrapper(process)); //~^ ERROR is not an iterator } diff --git a/src/test/ui/issues/issue-22872.stderr b/src/test/ui/issues/issue-22872.stderr index ebd096f1dde5a..fc5de23752b3e 100644 --- a/src/test/ui/issues/issue-22872.stderr +++ b/src/test/ui/issues/issue-22872.stderr @@ -1,8 +1,8 @@ error[E0277]: `

>::Item` is not an iterator - --> $DIR/issue-22872.rs:20:36 + --> $DIR/issue-22872.rs:20:40 | -LL | let _: Box Wrap<'b>> = Box::new(Wrapper(process)); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ `

>::Item` is not an iterator +LL | let _: Box Wrap<'b>> = Box::new(Wrapper(process)); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ `

>::Item` is not an iterator | = help: the trait `std::iter::Iterator` is not implemented for `

>::Item` = help: consider adding a `where

>::Item: std::iter::Iterator` bound diff --git a/src/test/ui/issues/issue-23024.rs b/src/test/ui/issues/issue-23024.rs index 0639ce30aa0e8..2638e15f0eae5 100644 --- a/src/test/ui/issues/issue-23024.rs +++ b/src/test/ui/issues/issue-23024.rs @@ -4,9 +4,9 @@ use std::any::Any; fn main() { fn h(x:i32) -> i32 {3*x} - let mut vfnfer:Vec> = vec![]; + let mut vfnfer:Vec> = vec![]; vfnfer.push(box h); - println!("{:?}",(vfnfer[0] as Fn)(3)); + println!("{:?}",(vfnfer[0] as dyn Fn)(3)); //~^ ERROR the precise format of `Fn`-family traits' //~| ERROR wrong number of type arguments: expected 1, found 0 [E0107] //~| ERROR the value of the associated type `Output` (from the trait `std::ops::FnOnce`) diff --git a/src/test/ui/issues/issue-23024.stderr b/src/test/ui/issues/issue-23024.stderr index fbefbe4f56e68..e99854539de88 100644 --- a/src/test/ui/issues/issue-23024.stderr +++ b/src/test/ui/issues/issue-23024.stderr @@ -1,23 +1,23 @@ error[E0658]: the precise format of `Fn`-family traits' type parameters is subject to change. Use parenthetical notation (Fn(Foo, Bar) -> Baz) instead - --> $DIR/issue-23024.rs:9:35 + --> $DIR/issue-23024.rs:9:39 | -LL | println!("{:?}",(vfnfer[0] as Fn)(3)); - | ^^ +LL | println!("{:?}",(vfnfer[0] as dyn Fn)(3)); + | ^^ | = note: for more information, see https://github.com/rust-lang/rust/issues/29625 = help: add #![feature(unboxed_closures)] to the crate attributes to enable error[E0107]: wrong number of type arguments: expected 1, found 0 - --> $DIR/issue-23024.rs:9:35 + --> $DIR/issue-23024.rs:9:39 | -LL | println!("{:?}",(vfnfer[0] as Fn)(3)); - | ^^ expected 1 type argument +LL | println!("{:?}",(vfnfer[0] as dyn Fn)(3)); + | ^^ expected 1 type argument error[E0191]: the value of the associated type `Output` (from the trait `std::ops::FnOnce`) must be specified --> $DIR/issue-23024.rs:9:35 | -LL | println!("{:?}",(vfnfer[0] as Fn)(3)); - | ^^ associated type `Output` must be specified +LL | println!("{:?}",(vfnfer[0] as dyn Fn)(3)); + | ^^^^^^ associated type `Output` must be specified error: aborting due to 3 previous errors diff --git a/src/test/ui/issues/issue-23041.rs b/src/test/ui/issues/issue-23041.rs index a18e85806d918..a1371521a0aa0 100644 --- a/src/test/ui/issues/issue-23041.rs +++ b/src/test/ui/issues/issue-23041.rs @@ -2,6 +2,6 @@ use std::any::Any; fn main() { fn bar(x:i32) ->i32 { 3*x }; - let b:Box = Box::new(bar as fn(_)->_); + let b:Box = Box::new(bar as fn(_)->_); b.downcast_ref::_>(); //~ ERROR E0282 } diff --git a/src/test/ui/issues/issue-23046.rs b/src/test/ui/issues/issue-23046.rs index 898654b7b5967..a68369616d8b6 100644 --- a/src/test/ui/issues/issue-23046.rs +++ b/src/test/ui/issues/issue-23046.rs @@ -1,6 +1,6 @@ pub enum Expr<'var, VAR> { Let(Box>, - Box Fn(Expr<'v, VAR>) -> Expr<'v, VAR> + 'var>) + Box Fn(Expr<'v, VAR>) -> Expr<'v, VAR> + 'var>) } pub fn add<'var, VAR> diff --git a/src/test/ui/issues/issue-23281.rs b/src/test/ui/issues/issue-23281.rs index 2b457a57d3ede..d5f7472886273 100644 --- a/src/test/ui/issues/issue-23281.rs +++ b/src/test/ui/issues/issue-23281.rs @@ -1,7 +1,7 @@ pub struct Struct; impl Struct { - pub fn function(funs: Vec ()>) {} + pub fn function(funs: Vec ()>) {} //~^ ERROR the size for values of type } diff --git a/src/test/ui/issues/issue-23281.stderr b/src/test/ui/issues/issue-23281.stderr index e540d4e819242..f1def47458368 100644 --- a/src/test/ui/issues/issue-23281.stderr +++ b/src/test/ui/issues/issue-23281.stderr @@ -1,8 +1,8 @@ error[E0277]: the size for values of type `(dyn std::ops::Fn() + 'static)` cannot be known at compilation time --> $DIR/issue-23281.rs:4:5 | -LL | pub fn function(funs: Vec ()>) {} - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time +LL | pub fn function(funs: Vec ()>) {} + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time | = help: the trait `std::marker::Sized` is not implemented for `(dyn std::ops::Fn() + 'static)` = note: to learn more, visit diff --git a/src/test/ui/issues/issue-24446.rs b/src/test/ui/issues/issue-24446.rs index c5e1b49e5ed1c..ffd6dfabc2890 100644 --- a/src/test/ui/issues/issue-24446.rs +++ b/src/test/ui/issues/issue-24446.rs @@ -1,5 +1,5 @@ fn main() { - static foo: Fn() -> u32 = || -> u32 { + static foo: dyn Fn() -> u32 = || -> u32 { //~^ ERROR the size for values of type 0 }; diff --git a/src/test/ui/issues/issue-24446.stderr b/src/test/ui/issues/issue-24446.stderr index ffec73b1ab4a8..344443e783038 100644 --- a/src/test/ui/issues/issue-24446.stderr +++ b/src/test/ui/issues/issue-24446.stderr @@ -1,8 +1,8 @@ error[E0277]: the size for values of type `(dyn std::ops::Fn() -> u32 + 'static)` cannot be known at compilation time --> $DIR/issue-24446.rs:2:17 | -LL | static foo: Fn() -> u32 = || -> u32 { - | ^^^^^^^^^^^ doesn't have a size known at compile-time +LL | static foo: dyn Fn() -> u32 = || -> u32 { + | ^^^^^^^^^^^^^^^ doesn't have a size known at compile-time | = help: the trait `std::marker::Sized` is not implemented for `(dyn std::ops::Fn() -> u32 + 'static)` = note: to learn more, visit diff --git a/src/test/ui/issues/issue-25180.rs b/src/test/ui/issues/issue-25180.rs index 739d571d7275f..297f403c05ee7 100644 --- a/src/test/ui/issues/issue-25180.rs +++ b/src/test/ui/issues/issue-25180.rs @@ -2,6 +2,6 @@ #![allow(dead_code)] #![allow(non_upper_case_globals)] -const x: &'static Fn() = &|| println!("ICE here"); +const x: &'static dyn Fn() = &|| println!("ICE here"); fn main() {} diff --git a/src/test/ui/issues/issue-26056.rs b/src/test/ui/issues/issue-26056.rs index 0d9973b454843..99d43ec792b3c 100644 --- a/src/test/ui/issues/issue-26056.rs +++ b/src/test/ui/issues/issue-26056.rs @@ -17,6 +17,6 @@ impl Map for K { fn main() { let _ = &() - as &Map; + as &dyn Map; //~^ ERROR E0038 } diff --git a/src/test/ui/issues/issue-26056.stderr b/src/test/ui/issues/issue-26056.stderr index 44fabd0db195a..9c4cf0b18acfe 100644 --- a/src/test/ui/issues/issue-26056.stderr +++ b/src/test/ui/issues/issue-26056.stderr @@ -1,8 +1,8 @@ error[E0038]: the trait `Map` cannot be made into an object --> $DIR/issue-26056.rs:20:13 | -LL | as &Map; - | ^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Map` cannot be made into an object +LL | as &dyn Map; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Map` cannot be made into an object | = note: the trait cannot use `Self` as a type parameter in the supertraits or where-clauses diff --git a/src/test/ui/issues/issue-26638.rs b/src/test/ui/issues/issue-26638.rs index 0f5ed5caa74cb..72fe4286a06b3 100644 --- a/src/test/ui/issues/issue-26638.rs +++ b/src/test/ui/issues/issue-26638.rs @@ -1,4 +1,4 @@ -fn parse_type(iter: Box+'static>) -> &str { iter.next() } +fn parse_type(iter: Box+'static>) -> &str { iter.next() } //~^ ERROR missing lifetime specifier [E0106] fn parse_type_2(iter: fn(&u8)->&u8) -> &str { iter() } diff --git a/src/test/ui/issues/issue-26638.stderr b/src/test/ui/issues/issue-26638.stderr index 64c2cd43264d0..6d7c1b0c43fce 100644 --- a/src/test/ui/issues/issue-26638.stderr +++ b/src/test/ui/issues/issue-26638.stderr @@ -1,8 +1,8 @@ error[E0106]: missing lifetime specifier - --> $DIR/issue-26638.rs:1:58 + --> $DIR/issue-26638.rs:1:62 | -LL | fn parse_type(iter: Box+'static>) -> &str { iter.next() } - | ^ expected lifetime parameter +LL | fn parse_type(iter: Box+'static>) -> &str { iter.next() } + | ^ expected lifetime parameter | = help: this function's return type contains a borrowed value, but the signature does not say which one of `iter`'s 2 lifetimes it is borrowed from diff --git a/src/test/ui/issues/issue-26905.rs b/src/test/ui/issues/issue-26905.rs index efd06219c3dec..4c5c67d58bc3d 100644 --- a/src/test/ui/issues/issue-26905.rs +++ b/src/test/ui/issues/issue-26905.rs @@ -19,5 +19,5 @@ fn main() { let data = [1, 2, 3]; let iter = data.iter(); let x = MyRc { _ptr: &iter, _boo: NotPhantomData(PhantomData) }; - let _y: MyRc> = x; + let _y: MyRc> = x; } diff --git a/src/test/ui/issues/issue-27105.rs b/src/test/ui/issues/issue-27105.rs index 5f0dff12aec92..1aafa11768fd3 100644 --- a/src/test/ui/issues/issue-27105.rs +++ b/src/test/ui/issues/issue-27105.rs @@ -3,7 +3,7 @@ use std::cell::RefCell; use std::rc::Rc; pub struct Callbacks { - callbacks: Vec>>, + callbacks: Vec>>, } impl Callbacks { diff --git a/src/test/ui/issues/issue-28279.rs b/src/test/ui/issues/issue-28279.rs index c770c50985959..fab91160a88be 100644 --- a/src/test/ui/issues/issue-28279.rs +++ b/src/test/ui/issues/issue-28279.rs @@ -2,7 +2,7 @@ #![allow(dead_code)] use std::rc::Rc; -fn test1() -> Rc Fn(&'a usize) + 'static> { +fn test1() -> Rc Fn(&'a usize) + 'static> { if let Some(_) = Some(1) { loop{} } else { @@ -10,7 +10,7 @@ fn test1() -> Rc Fn(&'a usize) + 'static> { } } -fn test2() -> *mut (for<'a> Fn(&'a usize) + 'static) { +fn test2() -> *mut (dyn for<'a> Fn(&'a usize) + 'static) { if let Some(_) = Some(1) { loop{} } else { diff --git a/src/test/ui/issues/issue-28576.rs b/src/test/ui/issues/issue-28576.rs index de665d5aa1680..972c839b64803 100644 --- a/src/test/ui/issues/issue-28576.rs +++ b/src/test/ui/issues/issue-28576.rs @@ -4,7 +4,7 @@ pub trait Foo { pub trait Bar: Foo { fn new(&self, b: & - Bar //~ ERROR the trait `Bar` cannot be made into an object + dyn Bar //~ ERROR the trait `Bar` cannot be made into an object ); } diff --git a/src/test/ui/issues/issue-28576.stderr b/src/test/ui/issues/issue-28576.stderr index cf6174ba857be..3249d76e69b57 100644 --- a/src/test/ui/issues/issue-28576.stderr +++ b/src/test/ui/issues/issue-28576.stderr @@ -1,7 +1,7 @@ error[E0038]: the trait `Bar` cannot be made into an object --> $DIR/issue-28576.rs:7:12 | -LL | / Bar +LL | / dyn Bar LL | | | |________________________^ the trait `Bar` cannot be made into an object | diff --git a/src/test/ui/issues/issue-2904.rs b/src/test/ui/issues/issue-2904.rs index 7755b7ecee307..42f71a1b09615 100644 --- a/src/test/ui/issues/issue-2904.rs +++ b/src/test/ui/issues/issue-2904.rs @@ -55,7 +55,7 @@ fn square_from_char(c: char) -> square { fn read_board_grid(mut input: rdr) -> Vec> { - let mut input: &mut Read = &mut input; + let mut input: &mut dyn Read = &mut input; let mut grid = Vec::new(); let mut line = [0; 10]; input.read(&mut line); diff --git a/src/test/ui/issues/issue-32963.rs b/src/test/ui/issues/issue-32963.rs index be59d3522b865..ee099069f0241 100644 --- a/src/test/ui/issues/issue-32963.rs +++ b/src/test/ui/issues/issue-32963.rs @@ -5,7 +5,7 @@ trait Misc {} fn size_of_copy() -> usize { mem::size_of::() } fn main() { - size_of_copy::(); + size_of_copy::(); //~^ ERROR only auto traits can be used as additional traits in a trait object //~| ERROR the trait bound `dyn Misc: std::marker::Copy` is not satisfied } diff --git a/src/test/ui/issues/issue-32963.stderr b/src/test/ui/issues/issue-32963.stderr index cde4123dc3f40..a31a74a07f46e 100644 --- a/src/test/ui/issues/issue-32963.stderr +++ b/src/test/ui/issues/issue-32963.stderr @@ -1,19 +1,19 @@ error[E0225]: only auto traits can be used as additional traits in a trait object - --> $DIR/issue-32963.rs:8:25 + --> $DIR/issue-32963.rs:8:31 | -LL | size_of_copy::(); - | ---- ^^^^ - | | | - | | additional non-auto trait - | | trait alias used in trait object type (additional use) - | first non-auto trait - | trait alias used in trait object type (first use) +LL | size_of_copy::(); + | ---- ^^^^ + | | | + | | additional non-auto trait + | | trait alias used in trait object type (additional use) + | first non-auto trait + | trait alias used in trait object type (first use) error[E0277]: the trait bound `dyn Misc: std::marker::Copy` is not satisfied --> $DIR/issue-32963.rs:8:5 | -LL | size_of_copy::(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `std::marker::Copy` is not implemented for `dyn Misc` +LL | size_of_copy::(); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `std::marker::Copy` is not implemented for `dyn Misc` | note: required by `size_of_copy` --> $DIR/issue-32963.rs:5:1 diff --git a/src/test/ui/issues/issue-32995.rs b/src/test/ui/issues/issue-32995.rs index c32fb63f1e584..3526deffc79ab 100644 --- a/src/test/ui/issues/issue-32995.rs +++ b/src/test/ui/issues/issue-32995.rs @@ -17,11 +17,11 @@ fn main() { //~^ ERROR parenthesized type parameters may only be used with a `Fn` trait //~| WARN previously accepted - let o : Box<::std::marker()::Send> = Box::new(1); + let o : Box = Box::new(1); //~^ ERROR parenthesized type parameters may only be used with a `Fn` trait //~| WARN previously accepted - let o : Box = Box::new(1); + let o : Box = Box::new(1); //~^ ERROR parenthesized type parameters may only be used with a `Fn` trait //~| WARN previously accepted } diff --git a/src/test/ui/issues/issue-32995.stderr b/src/test/ui/issues/issue-32995.stderr index 97b4b7fa76ca8..f97d86f6522ab 100644 --- a/src/test/ui/issues/issue-32995.stderr +++ b/src/test/ui/issues/issue-32995.stderr @@ -36,19 +36,19 @@ LL | let p = ::std::str::from_utf8::()(b"foo").unwrap(); = note: for more information, see issue #42238 error: parenthesized type parameters may only be used with a `Fn` trait - --> $DIR/issue-32995.rs:20:30 + --> $DIR/issue-32995.rs:20:35 | -LL | let o : Box<::std::marker()::Send> = Box::new(1); - | ^^ +LL | let o : Box = Box::new(1); + | ^^ | = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! = note: for more information, see issue #42238 error: parenthesized type parameters may only be used with a `Fn` trait - --> $DIR/issue-32995.rs:24:37 + --> $DIR/issue-32995.rs:24:41 | -LL | let o : Box = Box::new(1); - | ^^ +LL | let o : Box = Box::new(1); + | ^^ | = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! = note: for more information, see issue #42238 diff --git a/src/test/ui/issues/issue-33140-traitobject-crate.rs b/src/test/ui/issues/issue-33140-traitobject-crate.rs index 2b644817df115..078f3f3dd2cd2 100644 --- a/src/test/ui/issues/issue-33140-traitobject-crate.rs +++ b/src/test/ui/issues/issue-33140-traitobject-crate.rs @@ -13,85 +13,85 @@ /// Implementations for all traits in std are provided. pub unsafe trait Trait {} -unsafe impl Trait for ::std::any::Any + Send { } -unsafe impl Trait for ::std::any::Any + Sync { } -unsafe impl Trait for ::std::any::Any + Send + Sync { } -unsafe impl Trait for ::std::borrow::Borrow + Send { } -unsafe impl Trait for ::std::borrow::Borrow + Sync { } -unsafe impl Trait for ::std::borrow::Borrow + Send + Sync { } -unsafe impl Trait for ::std::borrow::BorrowMut + Send { } -unsafe impl Trait for ::std::borrow::BorrowMut + Sync { } -unsafe impl Trait for ::std::borrow::BorrowMut + Send + Sync { } -unsafe impl Trait for ::std::convert::AsMut + Send { } -unsafe impl Trait for ::std::convert::AsMut + Sync { } -unsafe impl Trait for ::std::convert::AsMut + Send + Sync { } -unsafe impl Trait for ::std::convert::AsRef + Send { } -unsafe impl Trait for ::std::convert::AsRef + Sync { } -unsafe impl Trait for ::std::convert::AsRef + Send + Sync { } -unsafe impl Trait for ::std::error::Error + Send { } -unsafe impl Trait for ::std::error::Error + Sync { } -unsafe impl Trait for ::std::error::Error + Send + Sync { } -unsafe impl Trait for ::std::fmt::Binary + Send { } -unsafe impl Trait for ::std::fmt::Binary + Sync { } -unsafe impl Trait for ::std::fmt::Binary + Send + Sync { } -unsafe impl Trait for ::std::fmt::Debug + Send { } -unsafe impl Trait for ::std::fmt::Debug + Sync { } -unsafe impl Trait for ::std::fmt::Debug + Send + Sync { } -unsafe impl Trait for ::std::fmt::Display + Send { } -unsafe impl Trait for ::std::fmt::Display + Sync { } -unsafe impl Trait for ::std::fmt::Display + Send + Sync { } -unsafe impl Trait for ::std::fmt::LowerExp + Send { } -unsafe impl Trait for ::std::fmt::LowerExp + Sync { } -unsafe impl Trait for ::std::fmt::LowerExp + Send + Sync { } -unsafe impl Trait for ::std::fmt::LowerHex + Send { } -unsafe impl Trait for ::std::fmt::LowerHex + Sync { } -unsafe impl Trait for ::std::fmt::LowerHex + Send + Sync { } -unsafe impl Trait for ::std::fmt::Octal + Send { } -unsafe impl Trait for ::std::fmt::Octal + Sync { } -unsafe impl Trait for ::std::fmt::Octal + Send + Sync { } -unsafe impl Trait for ::std::fmt::Pointer + Send { } -unsafe impl Trait for ::std::fmt::Pointer + Sync { } -unsafe impl Trait for ::std::fmt::Pointer + Send + Sync { } -unsafe impl Trait for ::std::fmt::UpperExp + Send { } -unsafe impl Trait for ::std::fmt::UpperExp + Sync { } -unsafe impl Trait for ::std::fmt::UpperExp + Send + Sync { } -unsafe impl Trait for ::std::fmt::UpperHex + Send { } -unsafe impl Trait for ::std::fmt::UpperHex + Sync { } -unsafe impl Trait for ::std::fmt::UpperHex + Send + Sync { } -unsafe impl Trait for ::std::fmt::Write + Send { } -unsafe impl Trait for ::std::fmt::Write + Sync { } -unsafe impl Trait for ::std::fmt::Write + Send + Sync { } -unsafe impl Trait for ::std::hash::Hasher + Send { } -unsafe impl Trait for ::std::hash::Hasher + Sync { } -unsafe impl Trait for ::std::hash::Hasher + Send + Sync { } -unsafe impl Trait for ::std::io::BufRead + Send { } -unsafe impl Trait for ::std::io::BufRead + Sync { } -unsafe impl Trait for ::std::io::BufRead + Send + Sync { } -unsafe impl Trait for ::std::io::Read + Send { } -unsafe impl Trait for ::std::io::Read + Sync { } -unsafe impl Trait for ::std::io::Read + Send + Sync { } -unsafe impl Trait for ::std::io::Seek + Send { } -unsafe impl Trait for ::std::io::Seek + Sync { } -unsafe impl Trait for ::std::io::Seek + Send + Sync { } -unsafe impl Trait for ::std::io::Write + Send { } -unsafe impl Trait for ::std::io::Write + Sync { } -unsafe impl Trait for ::std::io::Write + Send + Sync { } -unsafe impl Trait for ::std::iter::IntoIterator { } -unsafe impl Trait for ::std::iter::Iterator + Send { } -unsafe impl Trait for ::std::iter::Iterator + Sync { } -unsafe impl Trait for ::std::iter::Iterator + Send + Sync { } -unsafe impl Trait for ::std::marker::Send + Send { } -unsafe impl Trait for ::std::marker::Send + Sync { } -unsafe impl Trait for ::std::marker::Send + Send + Sync { } -unsafe impl Trait for ::std::marker::Sync + Send { } -unsafe impl Trait for ::std::marker::Sync + Sync { } -unsafe impl Trait for ::std::marker::Sync + Send + Sync { } -unsafe impl Trait for ::std::ops::Drop + Send { } -unsafe impl Trait for ::std::ops::Drop + Sync { } -unsafe impl Trait for ::std::ops::Drop + Send + Sync { } -unsafe impl Trait for ::std::string::ToString + Send { } -unsafe impl Trait for ::std::string::ToString + Sync { } -unsafe impl Trait for ::std::string::ToString + Send + Sync { } +unsafe impl Trait for dyn (::std::any::Any) + Send { } +unsafe impl Trait for dyn (::std::any::Any) + Sync { } +unsafe impl Trait for dyn (::std::any::Any) + Send + Sync { } +unsafe impl Trait for dyn (::std::borrow::Borrow) + Send { } +unsafe impl Trait for dyn (::std::borrow::Borrow) + Sync { } +unsafe impl Trait for dyn (::std::borrow::Borrow) + Send + Sync { } +unsafe impl Trait for dyn (::std::borrow::BorrowMut) + Send { } +unsafe impl Trait for dyn (::std::borrow::BorrowMut) + Sync { } +unsafe impl Trait for dyn (::std::borrow::BorrowMut) + Send + Sync { } +unsafe impl Trait for dyn (::std::convert::AsMut) + Send { } +unsafe impl Trait for dyn (::std::convert::AsMut) + Sync { } +unsafe impl Trait for dyn (::std::convert::AsMut) + Send + Sync { } +unsafe impl Trait for dyn (::std::convert::AsRef) + Send { } +unsafe impl Trait for dyn (::std::convert::AsRef) + Sync { } +unsafe impl Trait for dyn (::std::convert::AsRef) + Send + Sync { } +unsafe impl Trait for dyn (::std::error::Error) + Send { } +unsafe impl Trait for dyn (::std::error::Error) + Sync { } +unsafe impl Trait for dyn (::std::error::Error) + Send + Sync { } +unsafe impl Trait for dyn (::std::fmt::Binary) + Send { } +unsafe impl Trait for dyn (::std::fmt::Binary) + Sync { } +unsafe impl Trait for dyn (::std::fmt::Binary) + Send + Sync { } +unsafe impl Trait for dyn (::std::fmt::Debug) + Send { } +unsafe impl Trait for dyn (::std::fmt::Debug) + Sync { } +unsafe impl Trait for dyn (::std::fmt::Debug) + Send + Sync { } +unsafe impl Trait for dyn (::std::fmt::Display) + Send { } +unsafe impl Trait for dyn (::std::fmt::Display) + Sync { } +unsafe impl Trait for dyn (::std::fmt::Display) + Send + Sync { } +unsafe impl Trait for dyn (::std::fmt::LowerExp) + Send { } +unsafe impl Trait for dyn (::std::fmt::LowerExp) + Sync { } +unsafe impl Trait for dyn (::std::fmt::LowerExp) + Send + Sync { } +unsafe impl Trait for dyn (::std::fmt::LowerHex) + Send { } +unsafe impl Trait for dyn (::std::fmt::LowerHex) + Sync { } +unsafe impl Trait for dyn (::std::fmt::LowerHex) + Send + Sync { } +unsafe impl Trait for dyn (::std::fmt::Octal) + Send { } +unsafe impl Trait for dyn (::std::fmt::Octal) + Sync { } +unsafe impl Trait for dyn (::std::fmt::Octal) + Send + Sync { } +unsafe impl Trait for dyn (::std::fmt::Pointer) + Send { } +unsafe impl Trait for dyn (::std::fmt::Pointer) + Sync { } +unsafe impl Trait for dyn (::std::fmt::Pointer) + Send + Sync { } +unsafe impl Trait for dyn (::std::fmt::UpperExp) + Send { } +unsafe impl Trait for dyn (::std::fmt::UpperExp) + Sync { } +unsafe impl Trait for dyn (::std::fmt::UpperExp) + Send + Sync { } +unsafe impl Trait for dyn (::std::fmt::UpperHex) + Send { } +unsafe impl Trait for dyn (::std::fmt::UpperHex) + Sync { } +unsafe impl Trait for dyn (::std::fmt::UpperHex) + Send + Sync { } +unsafe impl Trait for dyn (::std::fmt::Write) + Send { } +unsafe impl Trait for dyn (::std::fmt::Write) + Sync { } +unsafe impl Trait for dyn (::std::fmt::Write) + Send + Sync { } +unsafe impl Trait for dyn (::std::hash::Hasher) + Send { } +unsafe impl Trait for dyn (::std::hash::Hasher) + Sync { } +unsafe impl Trait for dyn (::std::hash::Hasher) + Send + Sync { } +unsafe impl Trait for dyn (::std::io::BufRead) + Send { } +unsafe impl Trait for dyn (::std::io::BufRead) + Sync { } +unsafe impl Trait for dyn (::std::io::BufRead) + Send + Sync { } +unsafe impl Trait for dyn (::std::io::Read) + Send { } +unsafe impl Trait for dyn (::std::io::Read) + Sync { } +unsafe impl Trait for dyn (::std::io::Read) + Send + Sync { } +unsafe impl Trait for dyn (::std::io::Seek) + Send { } +unsafe impl Trait for dyn (::std::io::Seek) + Sync { } +unsafe impl Trait for dyn (::std::io::Seek) + Send + Sync { } +unsafe impl Trait for dyn (::std::io::Write) + Send { } +unsafe impl Trait for dyn (::std::io::Write) + Sync { } +unsafe impl Trait for dyn (::std::io::Write) + Send + Sync { } +unsafe impl Trait for dyn (::std::iter::IntoIterator) { } +unsafe impl Trait for dyn (::std::iter::Iterator) + Send { } +unsafe impl Trait for dyn (::std::iter::Iterator) + Sync { } +unsafe impl Trait for dyn (::std::iter::Iterator) + Send + Sync { } +unsafe impl Trait for dyn (::std::marker::Send) + Send { } +unsafe impl Trait for dyn (::std::marker::Send) + Sync { } +unsafe impl Trait for dyn (::std::marker::Send) + Send + Sync { } +unsafe impl Trait for dyn (::std::marker::Sync) + Send { } +unsafe impl Trait for dyn (::std::marker::Sync) + Sync { } +unsafe impl Trait for dyn (::std::marker::Sync) + Send + Sync { } +unsafe impl Trait for dyn (::std::ops::Drop) + Send { } +unsafe impl Trait for dyn (::std::ops::Drop) + Sync { } +unsafe impl Trait for dyn (::std::ops::Drop) + Send + Sync { } +unsafe impl Trait for dyn (::std::string::ToString) + Send { } +unsafe impl Trait for dyn (::std::string::ToString) + Sync { } +unsafe impl Trait for dyn (::std::string::ToString) + Send + Sync { } fn assert_trait() {} fn main() { diff --git a/src/test/ui/issues/issue-33140-traitobject-crate.stderr b/src/test/ui/issues/issue-33140-traitobject-crate.stderr index 6f71e79d0ee7a..76db98aa38bb4 100644 --- a/src/test/ui/issues/issue-33140-traitobject-crate.stderr +++ b/src/test/ui/issues/issue-33140-traitobject-crate.stderr @@ -1,10 +1,10 @@ warning: conflicting implementations of trait `Trait` for type `(dyn std::marker::Send + std::marker::Sync + 'static)`: (E0119) --> $DIR/issue-33140-traitobject-crate.rs:85:1 | -LL | unsafe impl Trait for ::std::marker::Send + Sync { } - | ------------------------------------------------ first implementation here -LL | unsafe impl Trait for ::std::marker::Send + Send + Sync { } - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `(dyn std::marker::Send + std::marker::Sync + 'static)` +LL | unsafe impl Trait for dyn (::std::marker::Send) + Sync { } + | ------------------------------------------------------ first implementation here +LL | unsafe impl Trait for dyn (::std::marker::Send) + Send + Sync { } + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `(dyn std::marker::Send + std::marker::Sync + 'static)` | note: lint level defined here --> $DIR/issue-33140-traitobject-crate.rs:3:9 @@ -17,10 +17,10 @@ LL | #![warn(order_dependent_trait_objects)] warning: conflicting implementations of trait `Trait` for type `(dyn std::marker::Send + std::marker::Sync + 'static)`: (E0119) --> $DIR/issue-33140-traitobject-crate.rs:86:1 | -LL | unsafe impl Trait for ::std::marker::Send + Send + Sync { } - | ------------------------------------------------------- first implementation here -LL | unsafe impl Trait for ::std::marker::Sync + Send { } - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `(dyn std::marker::Send + std::marker::Sync + 'static)` +LL | unsafe impl Trait for dyn (::std::marker::Send) + Send + Sync { } + | ------------------------------------------------------------- first implementation here +LL | unsafe impl Trait for dyn (::std::marker::Sync) + Send { } + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `(dyn std::marker::Send + std::marker::Sync + 'static)` | = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! = note: for more information, see issue #56484 @@ -28,11 +28,11 @@ LL | unsafe impl Trait for ::std::marker::Sync + Send { } warning: conflicting implementations of trait `Trait` for type `(dyn std::marker::Send + std::marker::Sync + 'static)`: (E0119) --> $DIR/issue-33140-traitobject-crate.rs:88:1 | -LL | unsafe impl Trait for ::std::marker::Sync + Send { } - | ------------------------------------------------ first implementation here -LL | unsafe impl Trait for ::std::marker::Sync + Sync { } -LL | unsafe impl Trait for ::std::marker::Sync + Send + Sync { } - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `(dyn std::marker::Send + std::marker::Sync + 'static)` +LL | unsafe impl Trait for dyn (::std::marker::Sync) + Send { } + | ------------------------------------------------------ first implementation here +LL | unsafe impl Trait for dyn (::std::marker::Sync) + Sync { } +LL | unsafe impl Trait for dyn (::std::marker::Sync) + Send + Sync { } + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `(dyn std::marker::Send + std::marker::Sync + 'static)` | = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! = note: for more information, see issue #56484 diff --git a/src/test/ui/issues/issue-33140.rs b/src/test/ui/issues/issue-33140.rs index 930e24218ac72..9bdac4b8375c2 100644 --- a/src/test/ui/issues/issue-33140.rs +++ b/src/test/ui/issues/issue-33140.rs @@ -38,10 +38,10 @@ impl Foo { } fn main() { - assert_eq!(::xyz(), false); - assert_eq!(::xyz(), true); - assert_eq!(::uvw(), false); - assert_eq!(::uvw(), true); - assert_eq!(>::abc(), false); - assert_eq!(>::abc(), true); + assert_eq!(::xyz(), false); + assert_eq!(::xyz(), true); + assert_eq!(::uvw(), false); + assert_eq!(::uvw(), true); + assert_eq!(>::abc(), false); + assert_eq!(>::abc(), true); } diff --git a/src/test/ui/issues/issue-33241.rs b/src/test/ui/issues/issue-33241.rs index 4c5052a60d3f3..4d6204cb28832 100644 --- a/src/test/ui/issues/issue-33241.rs +++ b/src/test/ui/issues/issue-33241.rs @@ -9,6 +9,6 @@ fn any() -> T { unreachable!() } fn main() { - let t: &(u8, fmt::Debug) = any(); + let t: &(u8, dyn fmt::Debug) = any(); println!("{:?}", &t.1); } diff --git a/src/test/ui/issues/issue-3424.rs b/src/test/ui/issues/issue-3424.rs index a9ba5f5408bdb..19f9f13e14416 100644 --- a/src/test/ui/issues/issue-3424.rs +++ b/src/test/ui/issues/issue-3424.rs @@ -5,7 +5,7 @@ pub struct Path; -type rsrc_loader = Box Result>; +type rsrc_loader = Box Result>; fn tester() { diff --git a/src/test/ui/issues/issue-35139.rs b/src/test/ui/issues/issue-35139.rs index 1ee00fc7ec2d9..e462f35437358 100644 --- a/src/test/ui/issues/issue-35139.rs +++ b/src/test/ui/issues/issue-35139.rs @@ -7,14 +7,14 @@ pub trait MethodType { pub struct MTFn; impl<'a> MethodType for MTFn { //~ ERROR E0207 - type GetProp = fmt::Debug + 'a; + type GetProp = dyn fmt::Debug + 'a; } -fn bad(a: Box<::GetProp>) -> Box { +fn bad(a: Box<::GetProp>) -> Box { a } -fn dangling(a: &str) -> Box { +fn dangling(a: &str) -> Box { bad(Box::new(a)) } diff --git a/src/test/ui/issues/issue-35546.rs b/src/test/ui/issues/issue-35546.rs index 19c0491e4bc29..500ba48e0b71c 100644 --- a/src/test/ui/issues/issue-35546.rs +++ b/src/test/ui/issues/issue-35546.rs @@ -6,11 +6,11 @@ // `value` field of `Node`). struct Node { - next: Option>>, + next: Option>>, value: T, } -fn clear(head: &mut Option>>) { +fn clear(head: &mut Option>>) { match head.take() { Some(node) => *head = node.next, None => (), diff --git a/src/test/ui/issues/issue-35570.rs b/src/test/ui/issues/issue-35570.rs index e809b46bcdca5..9bb9db63951c3 100644 --- a/src/test/ui/issues/issue-35570.rs +++ b/src/test/ui/issues/issue-35570.rs @@ -8,7 +8,7 @@ trait Trait2<'a> { type Ty; } -fn _ice(param: Box Trait1<<() as Trait2<'a>>::Ty>>) { +fn _ice(param: Box Trait1<<() as Trait2<'a>>::Ty>>) { let _e: (usize, usize) = unsafe{mem::transmute(param)}; } diff --git a/src/test/ui/issues/issue-35976.rs b/src/test/ui/issues/issue-35976.rs index 95c0cc95bb2ba..d075794d9946f 100644 --- a/src/test/ui/issues/issue-35976.rs +++ b/src/test/ui/issues/issue-35976.rs @@ -3,14 +3,14 @@ mod private { fn wait(&self) where Self: Sized; } - impl Future for Box { + impl Future for Box { fn wait(&self) { } } } //use private::Future; -fn bar(arg: Box) { +fn bar(arg: Box) { arg.wait(); //~^ ERROR the `wait` method cannot be invoked on a trait object } diff --git a/src/test/ui/issues/issue-3609.rs b/src/test/ui/issues/issue-3609.rs index c76c183821e52..9bccb2a21e33c 100644 --- a/src/test/ui/issues/issue-3609.rs +++ b/src/test/ui/issues/issue-3609.rs @@ -6,7 +6,7 @@ use std::thread; use std::sync::mpsc::Sender; type RingBuffer = Vec ; -type SamplesFn = Box; +type SamplesFn = Box; enum Msg { diff --git a/src/test/ui/issues/issue-36839.rs b/src/test/ui/issues/issue-36839.rs index 0944d07896e57..a660368f40153 100644 --- a/src/test/ui/issues/issue-36839.rs +++ b/src/test/ui/issues/issue-36839.rs @@ -19,5 +19,5 @@ impl Broken for T { fn main() { - let _m: &Broken = &(); + let _m: &dyn Broken = &(); } diff --git a/src/test/ui/issues/issue-3702-2.rs b/src/test/ui/issues/issue-3702-2.rs index c3a92a23cef50..d47f6d248f708 100644 --- a/src/test/ui/issues/issue-3702-2.rs +++ b/src/test/ui/issues/issue-3702-2.rs @@ -7,12 +7,12 @@ impl ToPrimitive for isize {} trait Add { fn to_int(&self) -> isize; - fn add_dynamic(&self, other: &Add) -> isize; + fn add_dynamic(&self, other: &dyn Add) -> isize; } impl Add for isize { fn to_int(&self) -> isize { *self } - fn add_dynamic(&self, other: &Add) -> isize { + fn add_dynamic(&self, other: &dyn Add) -> isize { self.to_int() + other.to_int() //~ ERROR multiple applicable items in scope } } diff --git a/src/test/ui/issues/issue-37515.rs b/src/test/ui/issues/issue-37515.rs index 090b9bbf1ec49..cc07bd1d91509 100644 --- a/src/test/ui/issues/issue-37515.rs +++ b/src/test/ui/issues/issue-37515.rs @@ -2,7 +2,7 @@ // compile-pass #![warn(unused)] -type Z = for<'x> Send; +type Z = dyn for<'x> Send; //~^ WARN type alias is never used diff --git a/src/test/ui/issues/issue-37515.stderr b/src/test/ui/issues/issue-37515.stderr index 1b4965594848b..1476d17cdc642 100644 --- a/src/test/ui/issues/issue-37515.stderr +++ b/src/test/ui/issues/issue-37515.stderr @@ -1,8 +1,8 @@ warning: type alias is never used: `Z` --> $DIR/issue-37515.rs:5:1 | -LL | type Z = for<'x> Send; - | ^^^^^^^^^^^^^^^^^^^^^^ +LL | type Z = dyn for<'x> Send; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ | note: lint level defined here --> $DIR/issue-37515.rs:3:9 diff --git a/src/test/ui/issues/issue-38404.rs b/src/test/ui/issues/issue-38404.rs index cddd75e267c42..1a92acc34042b 100644 --- a/src/test/ui/issues/issue-38404.rs +++ b/src/test/ui/issues/issue-38404.rs @@ -1,6 +1,6 @@ trait A: std::ops::Add + Sized {} trait B: A {} -trait C: A> {} +trait C: A> {} //~^ ERROR the trait `B` cannot be made into an object fn main() {} diff --git a/src/test/ui/issues/issue-38404.stderr b/src/test/ui/issues/issue-38404.stderr index 06bcf220f1836..d18a26b3a7638 100644 --- a/src/test/ui/issues/issue-38404.stderr +++ b/src/test/ui/issues/issue-38404.stderr @@ -1,8 +1,8 @@ error[E0038]: the trait `B` cannot be made into an object --> $DIR/issue-38404.rs:3:15 | -LL | trait C: A> {} - | ^^^^^^^^^^^^^^^^^^ the trait `B` cannot be made into an object +LL | trait C: A> {} + | ^^^^^^^^^^^^^^^^^^^^^^ the trait `B` cannot be made into an object | = note: the trait cannot use `Self` as a type parameter in the supertraits or where-clauses diff --git a/src/test/ui/issues/issue-38604.rs b/src/test/ui/issues/issue-38604.rs index c172595a245cd..002a3c43fcba6 100644 --- a/src/test/ui/issues/issue-38604.rs +++ b/src/test/ui/issues/issue-38604.rs @@ -11,6 +11,6 @@ impl Foo for () { } fn main() { - let _f: Box = //~ ERROR `Foo` cannot be made into an object + let _f: Box = //~ ERROR `Foo` cannot be made into an object Box::new(()); //~ ERROR `Foo` cannot be made into an object } diff --git a/src/test/ui/issues/issue-38604.stderr b/src/test/ui/issues/issue-38604.stderr index 77b42b80613c3..8ef7d346cb331 100644 --- a/src/test/ui/issues/issue-38604.stderr +++ b/src/test/ui/issues/issue-38604.stderr @@ -1,8 +1,8 @@ error[E0038]: the trait `Foo` cannot be made into an object --> $DIR/issue-38604.rs:14:13 | -LL | let _f: Box = - | ^^^^^^^^ the trait `Foo` cannot be made into an object +LL | let _f: Box = + | ^^^^^^^^^^^^ the trait `Foo` cannot be made into an object | = note: the trait cannot use `Self` as a type parameter in the supertraits or where-clauses diff --git a/src/test/ui/issues/issue-40000.rs b/src/test/ui/issues/issue-40000.rs index 320992c0764cf..9d5ef481afc37 100644 --- a/src/test/ui/issues/issue-40000.rs +++ b/src/test/ui/issues/issue-40000.rs @@ -1,7 +1,7 @@ fn main() { let bar: fn(&mut u32) = |_| {}; - fn foo(x: Box) {} - let bar = Box::new(|x: &i32| {}) as Box; + fn foo(x: Box) {} + let bar = Box::new(|x: &i32| {}) as Box; foo(bar); //~ ERROR E0308 } diff --git a/src/test/ui/issues/issue-41139.rs b/src/test/ui/issues/issue-41139.rs index f3e6c44ecb921..4814232607cf8 100644 --- a/src/test/ui/issues/issue-41139.rs +++ b/src/test/ui/issues/issue-41139.rs @@ -1,8 +1,8 @@ trait Trait {} -fn get_function<'a>() -> &'a Fn() -> Trait { panic!("") } +fn get_function<'a>() -> &'a dyn Fn() -> dyn Trait { panic!("") } fn main() { - let t : &Trait = &get_function()(); + let t : &dyn Trait = &get_function()(); //~^ ERROR cannot move a value of type dyn Trait } diff --git a/src/test/ui/issues/issue-41139.stderr b/src/test/ui/issues/issue-41139.stderr index 4dd017b0a9191..829d0cfa72ca7 100644 --- a/src/test/ui/issues/issue-41139.stderr +++ b/src/test/ui/issues/issue-41139.stderr @@ -1,8 +1,8 @@ error[E0161]: cannot move a value of type dyn Trait: the size of dyn Trait cannot be statically determined - --> $DIR/issue-41139.rs:6:23 + --> $DIR/issue-41139.rs:6:27 | -LL | let t : &Trait = &get_function()(); - | ^^^^^^^^^^^^^^^^ +LL | let t : &dyn Trait = &get_function()(); + | ^^^^^^^^^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/issues/issue-42312.rs b/src/test/ui/issues/issue-42312.rs index b1c651f665b72..426efcbf9b16f 100644 --- a/src/test/ui/issues/issue-42312.rs +++ b/src/test/ui/issues/issue-42312.rs @@ -5,7 +5,7 @@ pub trait Foo { //~^ ERROR the size for values of type } -pub fn f(_: ToString) {} +pub fn f(_: dyn ToString) {} //~^ ERROR the size for values of type fn main() { } diff --git a/src/test/ui/issues/issue-42312.stderr b/src/test/ui/issues/issue-42312.stderr index 20c8d085cbc62..bfdc4272fb308 100644 --- a/src/test/ui/issues/issue-42312.stderr +++ b/src/test/ui/issues/issue-42312.stderr @@ -11,10 +11,10 @@ LL | fn baz(_: Self::Target) where Self: Deref {} = help: unsized locals are gated as an unstable feature error[E0277]: the size for values of type `(dyn std::string::ToString + 'static)` cannot be known at compilation time - --> $DIR/issue-42312.rs:8:23 + --> $DIR/issue-42312.rs:8:27 | -LL | pub fn f(_: ToString) {} - | ^ doesn't have a size known at compile-time +LL | pub fn f(_: dyn ToString) {} + | ^ doesn't have a size known at compile-time | = help: the trait `std::marker::Sized` is not implemented for `(dyn std::string::ToString + 'static)` = note: to learn more, visit diff --git a/src/test/ui/issues/issue-4335.rs b/src/test/ui/issues/issue-4335.rs index d3c9954cdb051..a10ae9a1243a2 100644 --- a/src/test/ui/issues/issue-4335.rs +++ b/src/test/ui/issues/issue-4335.rs @@ -2,7 +2,7 @@ fn id(t: T) -> T { t } -fn f<'r, T>(v: &'r T) -> Box T + 'r> { +fn f<'r, T>(v: &'r T) -> Box T + 'r> { id(Box::new(|| *v)) //~^ ERROR E0373 //~| ERROR E0507 diff --git a/src/test/ui/issues/issue-4335.stderr b/src/test/ui/issues/issue-4335.stderr index 1b5cab249291b..f1b6e475949dc 100644 --- a/src/test/ui/issues/issue-4335.stderr +++ b/src/test/ui/issues/issue-4335.stderr @@ -1,7 +1,7 @@ error[E0507]: cannot move out of captured variable in an `FnMut` closure --> $DIR/issue-4335.rs:6:20 | -LL | fn f<'r, T>(v: &'r T) -> Box T + 'r> { +LL | fn f<'r, T>(v: &'r T) -> Box T + 'r> { | - captured outer variable LL | id(Box::new(|| *v)) | ^^ cannot move out of captured variable in an `FnMut` closure diff --git a/src/test/ui/issues/issue-45730.rs b/src/test/ui/issues/issue-45730.rs index 5709125e5f01b..3776759fe07a5 100644 --- a/src/test/ui/issues/issue-45730.rs +++ b/src/test/ui/issues/issue-45730.rs @@ -3,7 +3,7 @@ fn main() { let x: *const _ = 0 as _; //~ ERROR cannot cast let x: *const _ = 0 as *const _; //~ ERROR cannot cast - let y: Option<*const fmt::Debug> = Some(x) as _; + let y: Option<*const dyn fmt::Debug> = Some(x) as _; let x = 0 as *const i32 as *const _ as *mut _; //~ ERROR cannot cast } diff --git a/src/test/ui/issues/issue-4972.rs b/src/test/ui/issues/issue-4972.rs index 9c95a9794766b..fab258f137e68 100644 --- a/src/test/ui/issues/issue-4972.rs +++ b/src/test/ui/issues/issue-4972.rs @@ -6,10 +6,10 @@ trait MyTrait { } pub enum TraitWrapper { - A(Box), + A(Box), } -fn get_tw_map(tw: &TraitWrapper) -> &MyTrait { +fn get_tw_map(tw: &TraitWrapper) -> &dyn MyTrait { match *tw { TraitWrapper::A(box ref map) => map, //~ ERROR cannot be dereferenced } diff --git a/src/test/ui/issues/issue-50761.rs b/src/test/ui/issues/issue-50761.rs index bcf3ebcd60a5e..70b4bc8b755aa 100644 --- a/src/test/ui/issues/issue-50761.rs +++ b/src/test/ui/issues/issue-50761.rs @@ -14,7 +14,7 @@ mod b { } impl Builder { - pub fn with_a(&mut self, _a: fn() -> ::a::A) {} + pub fn with_a(&mut self, _a: fn() -> dyn (::a::A)) {} } } diff --git a/src/test/ui/issues/issue-50781.rs b/src/test/ui/issues/issue-50781.rs index edf8d82b48050..3c5e5a9f69af0 100644 --- a/src/test/ui/issues/issue-50781.rs +++ b/src/test/ui/issues/issue-50781.rs @@ -15,5 +15,5 @@ impl Trait for dyn X {} pub fn main() { // Check that this does not segfault. - ::foo(&()); + ::foo(&()); } diff --git a/src/test/ui/issues/issue-5153.rs b/src/test/ui/issues/issue-5153.rs index 551880ae009fb..e6737662088f2 100644 --- a/src/test/ui/issues/issue-5153.rs +++ b/src/test/ui/issues/issue-5153.rs @@ -7,6 +7,6 @@ impl Foo for isize { } fn main() { - (&5isize as &Foo).foo(); + (&5isize as &dyn Foo).foo(); //~^ ERROR: no method named `foo` found for type `&dyn Foo` in the current scope } diff --git a/src/test/ui/issues/issue-5153.stderr b/src/test/ui/issues/issue-5153.stderr index 48adfee0dec03..97214fbdc52d4 100644 --- a/src/test/ui/issues/issue-5153.stderr +++ b/src/test/ui/issues/issue-5153.stderr @@ -1,8 +1,8 @@ error[E0599]: no method named `foo` found for type `&dyn Foo` in the current scope - --> $DIR/issue-5153.rs:10:23 + --> $DIR/issue-5153.rs:10:27 | -LL | (&5isize as &Foo).foo(); - | ^^^ +LL | (&5isize as &dyn Foo).foo(); + | ^^^ | = help: items from traits can only be used if the trait is implemented and in scope = note: the following trait defines an item `foo`, perhaps you need to implement it: diff --git a/src/test/ui/issues/issue-5216.rs b/src/test/ui/issues/issue-5216.rs index fd490884fa1fc..35b343edfbdbe 100644 --- a/src/test/ui/issues/issue-5216.rs +++ b/src/test/ui/issues/issue-5216.rs @@ -1,10 +1,10 @@ fn f() { } -struct S(Box); +struct S(Box); pub static C: S = S(f); //~ ERROR mismatched types fn g() { } -type T = Box; +type T = Box; pub static D: T = g; //~ ERROR mismatched types fn main() {} diff --git a/src/test/ui/issues/issue-53419.rs b/src/test/ui/issues/issue-53419.rs index 52149cf486dc9..bf6791734d4e2 100644 --- a/src/test/ui/issues/issue-53419.rs +++ b/src/test/ui/issues/issue-53419.rs @@ -1,7 +1,7 @@ //compile-pass struct Foo { - bar: for<'r> Fn(usize, &'r FnMut()) + bar: dyn for<'r> Fn(usize, &'r dyn FnMut()) } fn main() { diff --git a/src/test/ui/issues/issue-54582.rs b/src/test/ui/issues/issue-54582.rs index c2dbf361911b5..8c50cac67f8fc 100644 --- a/src/test/ui/issues/issue-54582.rs +++ b/src/test/ui/issues/issue-54582.rs @@ -9,7 +9,7 @@ pub enum Enum { impl Stage for Enum {} -pub static ARRAY: [(&Stage, &str); 1] = [ +pub static ARRAY: [(&dyn Stage, &str); 1] = [ (&Enum::A, ""), ]; diff --git a/src/test/ui/issues/issue-55796.rs b/src/test/ui/issues/issue-55796.rs index efdea5c9b1e16..088d4301c51b1 100644 --- a/src/test/ui/issues/issue-55796.rs +++ b/src/test/ui/issues/issue-55796.rs @@ -12,12 +12,12 @@ pub trait Graph<'a> { fn out_edges(&'a self, u: &Self::Node) -> Self::EdgesIter; fn in_edges(&'a self, u: &Self::Node) -> Self::EdgesIter; - fn out_neighbors(&'a self, u: &Self::Node) -> Box> { + fn out_neighbors(&'a self, u: &Self::Node) -> Box> { Box::new(self.out_edges(u).map(|e| e.target())) //~^ ERROR cannot infer } - fn in_neighbors(&'a self, u: &Self::Node) -> Box> { + fn in_neighbors(&'a self, u: &Self::Node) -> Box> { Box::new(self.in_edges(u).map(|e| e.target())) //~^ ERROR cannot infer } diff --git a/src/test/ui/issues/issue-5883.rs b/src/test/ui/issues/issue-5883.rs index b4a73ba99c574..0de535023972e 100644 --- a/src/test/ui/issues/issue-5883.rs +++ b/src/test/ui/issues/issue-5883.rs @@ -1,10 +1,10 @@ trait A {} struct Struct { - r: A+'static + r: dyn A + 'static } -fn new_struct(r: A+'static) +fn new_struct(r: dyn A + 'static) -> Struct { //~^ ERROR the size for values of type //~^ ERROR the size for values of type Struct { r: r } diff --git a/src/test/ui/issues/issue-5883.stderr b/src/test/ui/issues/issue-5883.stderr index 7753881f73684..c2de1d095505a 100644 --- a/src/test/ui/issues/issue-5883.stderr +++ b/src/test/ui/issues/issue-5883.stderr @@ -1,7 +1,7 @@ error[E0277]: the size for values of type `(dyn A + 'static)` cannot be known at compilation time --> $DIR/issue-5883.rs:7:15 | -LL | fn new_struct(r: A+'static) +LL | fn new_struct(r: dyn A + 'static) | ^ doesn't have a size known at compile-time | = help: the trait `std::marker::Sized` is not implemented for `(dyn A + 'static)` diff --git a/src/test/ui/issues/issue-60989.rs b/src/test/ui/issues/issue-60989.rs index 930e98bedce8a..6dae1e1347b7a 100644 --- a/src/test/ui/issues/issue-60989.rs +++ b/src/test/ui/issues/issue-60989.rs @@ -13,6 +13,6 @@ fn main() { //~^ ERROR type arguments are not allowed for this type let c1 = A {}; - c1::>; + c1::>; //~^ ERROR type arguments are not allowed for this type } diff --git a/src/test/ui/issues/issue-60989.stderr b/src/test/ui/issues/issue-60989.stderr index 55a0b9626df75..5d2d9e83c9b9c 100644 --- a/src/test/ui/issues/issue-60989.stderr +++ b/src/test/ui/issues/issue-60989.stderr @@ -7,8 +7,8 @@ LL | c1::<()>; error[E0109]: type arguments are not allowed for this type --> $DIR/issue-60989.rs:16:10 | -LL | c1::>; - | ^^^^^^^ type argument not allowed +LL | c1::>; + | ^^^^^^^^^^^ type argument not allowed error: aborting due to 2 previous errors diff --git a/src/test/ui/issues/issue-7013.rs b/src/test/ui/issues/issue-7013.rs index ee68aa8623b37..3d72b67e391c9 100644 --- a/src/test/ui/issues/issue-7013.rs +++ b/src/test/ui/issues/issue-7013.rs @@ -19,10 +19,10 @@ impl Foo for B { } struct A { - v: Box, + v: Box, } fn main() { - let a = A {v: box B{v: None} as Box}; + let a = A {v: box B{v: None} as Box}; //~^ ERROR `std::rc::Rc>` cannot be sent between threads safely } diff --git a/src/test/ui/issues/issue-7013.stderr b/src/test/ui/issues/issue-7013.stderr index 22185c7da344b..f2668d3312289 100644 --- a/src/test/ui/issues/issue-7013.stderr +++ b/src/test/ui/issues/issue-7013.stderr @@ -1,7 +1,7 @@ error[E0277]: `std::rc::Rc>` cannot be sent between threads safely --> $DIR/issue-7013.rs:26:19 | -LL | let a = A {v: box B{v: None} as Box}; +LL | let a = A {v: box B{v: None} as Box}; | ^^^^^^^^^^^^^^ `std::rc::Rc>` cannot be sent between threads safely | = help: within `B`, the trait `std::marker::Send` is not implemented for `std::rc::Rc>` diff --git a/src/test/ui/issues/issue-7673-cast-generically-implemented-trait.rs b/src/test/ui/issues/issue-7673-cast-generically-implemented-trait.rs index 7dd6b07177f93..619256c787193 100644 --- a/src/test/ui/issues/issue-7673-cast-generically-implemented-trait.rs +++ b/src/test/ui/issues/issue-7673-cast-generically-implemented-trait.rs @@ -18,5 +18,5 @@ trait A { impl A for T {} -fn owned2(a: Box) { a as Box; } -fn owned3(a: Box) { box a as Box; } +fn owned2(a: Box) { a as Box; } +fn owned3(a: Box) { box a as Box; } diff --git a/src/test/ui/issues/issue-8398.rs b/src/test/ui/issues/issue-8398.rs index bd37b8582b204..a65c667b08e45 100644 --- a/src/test/ui/issues/issue-8398.rs +++ b/src/test/ui/issues/issue-8398.rs @@ -6,7 +6,7 @@ pub trait Writer { fn write(&mut self, b: &[u8]) -> Result<(), ()>; } -fn foo(a: &mut Writer) { +fn foo(a: &mut dyn Writer) { a.write(&[]).unwrap(); } diff --git a/src/test/ui/issues/issue-9719.rs b/src/test/ui/issues/issue-9719.rs index 96865344e7464..1e38ab9c6c2a4 100644 --- a/src/test/ui/issues/issue-9719.rs +++ b/src/test/ui/issues/issue-9719.rs @@ -12,8 +12,8 @@ mod a { } impl X for isize {} - pub struct Z<'a>(Enum<&'a (X+'a)>); - fn foo() { let x: isize = 42; let z = Z(Enum::A(&x as &X)); let _ = z; } + pub struct Z<'a>(Enum<&'a (dyn X + 'a)>); + fn foo() { let x: isize = 42; let z = Z(Enum::A(&x as &dyn X)); let _ = z; } } mod b { @@ -22,20 +22,20 @@ mod b { } impl X for isize {} struct Y<'a>{ - x:Option<&'a (X+'a)>, + x:Option<&'a (dyn X + 'a)>, } fn bar() { let x: isize = 42; - let _y = Y { x: Some(&x as &X) }; + let _y = Y { x: Some(&x as &dyn X) }; } } mod c { pub trait X { fn f(&self); } impl X for isize { fn f(&self) {} } - pub struct Z<'a>(Option<&'a (X+'a)>); - fn main() { let x: isize = 42; let z = Z(Some(&x as &X)); let _ = z; } + pub struct Z<'a>(Option<&'a (dyn X + 'a)>); + fn main() { let x: isize = 42; let z = Z(Some(&x as &dyn X)); let _ = z; } } pub fn main() {} diff --git a/src/test/ui/kindck/kindck-copy.rs b/src/test/ui/kindck/kindck-copy.rs index dadeb9569644c..eb18613682f65 100644 --- a/src/test/ui/kindck/kindck-copy.rs +++ b/src/test/ui/kindck/kindck-copy.rs @@ -34,16 +34,16 @@ fn test<'a,T,U:Copy>(_: &'a isize) { assert_copy::>(); //~ ERROR : std::marker::Copy` is not satisfied // borrowed object types are generally ok - assert_copy::<&'a Dummy>(); - assert_copy::<&'a (Dummy+Send)>(); - assert_copy::<&'static (Dummy+Send)>(); + assert_copy::<&'a dyn Dummy>(); + assert_copy::<&'a (dyn Dummy + Send)>(); + assert_copy::<&'static (dyn Dummy + Send)>(); // owned object types are not ok - assert_copy::>(); //~ ERROR : std::marker::Copy` is not satisfied - assert_copy::>(); //~ ERROR : std::marker::Copy` is not satisfied + assert_copy::>(); //~ ERROR : std::marker::Copy` is not satisfied + assert_copy::>(); //~ ERROR : std::marker::Copy` is not satisfied // mutable object types are not ok - assert_copy::<&'a mut (Dummy+Send)>(); //~ ERROR : std::marker::Copy` is not satisfied + assert_copy::<&'a mut (dyn Dummy + Send)>(); //~ ERROR : std::marker::Copy` is not satisfied // unsafe ptrs are ok assert_copy::<*const isize>(); diff --git a/src/test/ui/kindck/kindck-copy.stderr b/src/test/ui/kindck/kindck-copy.stderr index 2680cb7c012f1..929a807656209 100644 --- a/src/test/ui/kindck/kindck-copy.stderr +++ b/src/test/ui/kindck/kindck-copy.stderr @@ -77,8 +77,8 @@ LL | fn assert_copy() { } error[E0277]: the trait bound `std::boxed::Box: std::marker::Copy` is not satisfied --> $DIR/kindck-copy.rs:42:5 | -LL | assert_copy::>(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `std::marker::Copy` is not implemented for `std::boxed::Box` +LL | assert_copy::>(); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `std::marker::Copy` is not implemented for `std::boxed::Box` | note: required by `assert_copy` --> $DIR/kindck-copy.rs:5:1 @@ -89,8 +89,8 @@ LL | fn assert_copy() { } error[E0277]: the trait bound `std::boxed::Box: std::marker::Copy` is not satisfied --> $DIR/kindck-copy.rs:43:5 | -LL | assert_copy::>(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `std::marker::Copy` is not implemented for `std::boxed::Box` +LL | assert_copy::>(); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `std::marker::Copy` is not implemented for `std::boxed::Box` | note: required by `assert_copy` --> $DIR/kindck-copy.rs:5:1 @@ -101,8 +101,8 @@ LL | fn assert_copy() { } error[E0277]: the trait bound `&'a mut (dyn Dummy + std::marker::Send + 'a): std::marker::Copy` is not satisfied --> $DIR/kindck-copy.rs:46:5 | -LL | assert_copy::<&'a mut (Dummy+Send)>(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `std::marker::Copy` is not implemented for `&'a mut (dyn Dummy + std::marker::Send + 'a)` +LL | assert_copy::<&'a mut (dyn Dummy + Send)>(); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `std::marker::Copy` is not implemented for `&'a mut (dyn Dummy + std::marker::Send + 'a)` | note: required by `assert_copy` --> $DIR/kindck-copy.rs:5:1 diff --git a/src/test/ui/kindck/kindck-impl-type-params.nll.stderr b/src/test/ui/kindck/kindck-impl-type-params.nll.stderr index c1f662fda610b..25d0e74187f75 100644 --- a/src/test/ui/kindck/kindck-impl-type-params.nll.stderr +++ b/src/test/ui/kindck/kindck-impl-type-params.nll.stderr @@ -1,7 +1,7 @@ error[E0277]: `T` cannot be sent between threads safely --> $DIR/kindck-impl-type-params.rs:18:13 | -LL | let a = &t as &Gettable; +LL | let a = &t as &dyn Gettable; | ^^ `T` cannot be sent between threads safely | = help: the trait `std::marker::Send` is not implemented for `T` @@ -12,7 +12,7 @@ LL | let a = &t as &Gettable; error[E0277]: the trait bound `T: std::marker::Copy` is not satisfied --> $DIR/kindck-impl-type-params.rs:18:13 | -LL | let a = &t as &Gettable; +LL | let a = &t as &dyn Gettable; | ^^ the trait `std::marker::Copy` is not implemented for `T` | = help: consider adding a `where T: std::marker::Copy` bound @@ -20,10 +20,10 @@ LL | let a = &t as &Gettable; = note: required for the cast to the object type `dyn Gettable` error[E0277]: `T` cannot be sent between threads safely - --> $DIR/kindck-impl-type-params.rs:25:27 + --> $DIR/kindck-impl-type-params.rs:25:31 | -LL | let a: &Gettable = &t; - | ^^ `T` cannot be sent between threads safely +LL | let a: &dyn Gettable = &t; + | ^^ `T` cannot be sent between threads safely | = help: the trait `std::marker::Send` is not implemented for `T` = help: consider adding a `where T: std::marker::Send` bound @@ -31,10 +31,10 @@ LL | let a: &Gettable = &t; = note: required for the cast to the object type `dyn Gettable` error[E0277]: the trait bound `T: std::marker::Copy` is not satisfied - --> $DIR/kindck-impl-type-params.rs:25:27 + --> $DIR/kindck-impl-type-params.rs:25:31 | -LL | let a: &Gettable = &t; - | ^^ the trait `std::marker::Copy` is not implemented for `T` +LL | let a: &dyn Gettable = &t; + | ^^ the trait `std::marker::Copy` is not implemented for `T` | = help: consider adding a `where T: std::marker::Copy` bound = note: required because of the requirements on the impl of `Gettable` for `S` @@ -43,17 +43,17 @@ LL | let a: &Gettable = &t; error[E0277]: the trait bound `std::string::String: std::marker::Copy` is not satisfied --> $DIR/kindck-impl-type-params.rs:38:13 | -LL | let a = t as Box>; +LL | let a = t as Box>; | ^ the trait `std::marker::Copy` is not implemented for `std::string::String` | = note: required because of the requirements on the impl of `Gettable` for `S` = note: required for the cast to the object type `dyn Gettable` error[E0277]: the trait bound `foo3::Foo: std::marker::Copy` is not satisfied - --> $DIR/kindck-impl-type-params.rs:46:33 + --> $DIR/kindck-impl-type-params.rs:46:37 | -LL | let a: Box> = t; - | ^ the trait `std::marker::Copy` is not implemented for `foo3::Foo` +LL | let a: Box> = t; + | ^ the trait `std::marker::Copy` is not implemented for `foo3::Foo` | = note: required because of the requirements on the impl of `Gettable` for `S` = note: required for the cast to the object type `dyn Gettable` diff --git a/src/test/ui/kindck/kindck-impl-type-params.rs b/src/test/ui/kindck/kindck-impl-type-params.rs index a47e418709dcd..c4f90f36acfc2 100644 --- a/src/test/ui/kindck/kindck-impl-type-params.rs +++ b/src/test/ui/kindck/kindck-impl-type-params.rs @@ -15,27 +15,27 @@ impl Gettable for S {} fn f(val: T) { let t: S = S(marker::PhantomData); - let a = &t as &Gettable; + let a = &t as &dyn Gettable; //~^ ERROR `T` cannot be sent between threads safely //~| ERROR : std::marker::Copy` is not satisfied } fn g(val: T) { let t: S = S(marker::PhantomData); - let a: &Gettable = &t; + let a: &dyn Gettable = &t; //~^ ERROR `T` cannot be sent between threads safely //~| ERROR : std::marker::Copy` is not satisfied } fn foo<'a>() { let t: S<&'a isize> = S(marker::PhantomData); - let a = &t as &Gettable<&'a isize>; + let a = &t as &dyn Gettable<&'a isize>; //~^ ERROR does not fulfill } fn foo2<'a>() { let t: Box> = box S(marker::PhantomData); - let a = t as Box>; + let a = t as Box>; //~^ ERROR : std::marker::Copy` is not satisfied } @@ -43,7 +43,7 @@ fn foo3<'a>() { struct Foo; // does not impl Copy let t: Box> = box S(marker::PhantomData); - let a: Box> = t; + let a: Box> = t; //~^ ERROR : std::marker::Copy` is not satisfied } diff --git a/src/test/ui/kindck/kindck-impl-type-params.stderr b/src/test/ui/kindck/kindck-impl-type-params.stderr index 8580e6812b41c..e6f7088bd4635 100644 --- a/src/test/ui/kindck/kindck-impl-type-params.stderr +++ b/src/test/ui/kindck/kindck-impl-type-params.stderr @@ -1,7 +1,7 @@ error[E0277]: `T` cannot be sent between threads safely --> $DIR/kindck-impl-type-params.rs:18:13 | -LL | let a = &t as &Gettable; +LL | let a = &t as &dyn Gettable; | ^^ `T` cannot be sent between threads safely | = help: the trait `std::marker::Send` is not implemented for `T` @@ -12,7 +12,7 @@ LL | let a = &t as &Gettable; error[E0277]: the trait bound `T: std::marker::Copy` is not satisfied --> $DIR/kindck-impl-type-params.rs:18:13 | -LL | let a = &t as &Gettable; +LL | let a = &t as &dyn Gettable; | ^^ the trait `std::marker::Copy` is not implemented for `T` | = help: consider adding a `where T: std::marker::Copy` bound @@ -20,10 +20,10 @@ LL | let a = &t as &Gettable; = note: required for the cast to the object type `dyn Gettable` error[E0277]: `T` cannot be sent between threads safely - --> $DIR/kindck-impl-type-params.rs:25:27 + --> $DIR/kindck-impl-type-params.rs:25:31 | -LL | let a: &Gettable = &t; - | ^^ `T` cannot be sent between threads safely +LL | let a: &dyn Gettable = &t; + | ^^ `T` cannot be sent between threads safely | = help: the trait `std::marker::Send` is not implemented for `T` = help: consider adding a `where T: std::marker::Send` bound @@ -31,10 +31,10 @@ LL | let a: &Gettable = &t; = note: required for the cast to the object type `dyn Gettable` error[E0277]: the trait bound `T: std::marker::Copy` is not satisfied - --> $DIR/kindck-impl-type-params.rs:25:27 + --> $DIR/kindck-impl-type-params.rs:25:31 | -LL | let a: &Gettable = &t; - | ^^ the trait `std::marker::Copy` is not implemented for `T` +LL | let a: &dyn Gettable = &t; + | ^^ the trait `std::marker::Copy` is not implemented for `T` | = help: consider adding a `where T: std::marker::Copy` bound = note: required because of the requirements on the impl of `Gettable` for `S` @@ -43,7 +43,7 @@ LL | let a: &Gettable = &t; error[E0477]: the type `&'a isize` does not fulfill the required lifetime --> $DIR/kindck-impl-type-params.rs:32:13 | -LL | let a = &t as &Gettable<&'a isize>; +LL | let a = &t as &dyn Gettable<&'a isize>; | ^^ | = note: type must satisfy the static lifetime @@ -51,17 +51,17 @@ LL | let a = &t as &Gettable<&'a isize>; error[E0277]: the trait bound `std::string::String: std::marker::Copy` is not satisfied --> $DIR/kindck-impl-type-params.rs:38:13 | -LL | let a = t as Box>; +LL | let a = t as Box>; | ^ the trait `std::marker::Copy` is not implemented for `std::string::String` | = note: required because of the requirements on the impl of `Gettable` for `S` = note: required for the cast to the object type `dyn Gettable` error[E0277]: the trait bound `foo3::Foo: std::marker::Copy` is not satisfied - --> $DIR/kindck-impl-type-params.rs:46:33 + --> $DIR/kindck-impl-type-params.rs:46:37 | -LL | let a: Box> = t; - | ^ the trait `std::marker::Copy` is not implemented for `foo3::Foo` +LL | let a: Box> = t; + | ^ the trait `std::marker::Copy` is not implemented for `foo3::Foo` | = note: required because of the requirements on the impl of `Gettable` for `S` = note: required for the cast to the object type `dyn Gettable` diff --git a/src/test/ui/kindck/kindck-inherited-copy-bound.rs b/src/test/ui/kindck/kindck-inherited-copy-bound.rs index 0134636fa0d3c..61e72908248df 100644 --- a/src/test/ui/kindck/kindck-inherited-copy-bound.rs +++ b/src/test/ui/kindck/kindck-inherited-copy-bound.rs @@ -21,7 +21,7 @@ fn a() { fn b() { let x: Box<_> = box 3; let y = &x; - let z = &x as &Foo; + let z = &x as &dyn Foo; //~^ ERROR E0038 //~| ERROR E0038 } diff --git a/src/test/ui/kindck/kindck-inherited-copy-bound.stderr b/src/test/ui/kindck/kindck-inherited-copy-bound.stderr index 0ed2da46fbaea..1e719e2608425 100644 --- a/src/test/ui/kindck/kindck-inherited-copy-bound.stderr +++ b/src/test/ui/kindck/kindck-inherited-copy-bound.stderr @@ -14,15 +14,15 @@ LL | fn take_param(foo: &T) { } error[E0038]: the trait `Foo` cannot be made into an object --> $DIR/kindck-inherited-copy-bound.rs:24:19 | -LL | let z = &x as &Foo; - | ^^^^ the trait `Foo` cannot be made into an object +LL | let z = &x as &dyn Foo; + | ^^^^^^^^ the trait `Foo` cannot be made into an object | = note: the trait cannot require that `Self : Sized` error[E0038]: the trait `Foo` cannot be made into an object --> $DIR/kindck-inherited-copy-bound.rs:24:13 | -LL | let z = &x as &Foo; +LL | let z = &x as &dyn Foo; | ^^ the trait `Foo` cannot be made into an object | = note: the trait cannot require that `Self : Sized` diff --git a/src/test/ui/kindck/kindck-send-object.rs b/src/test/ui/kindck/kindck-send-object.rs index 97f46c3953d51..6411e688b4aa6 100644 --- a/src/test/ui/kindck/kindck-send-object.rs +++ b/src/test/ui/kindck/kindck-send-object.rs @@ -9,18 +9,18 @@ trait Message : Send { } // careful with object types, who knows what they close over... fn object_ref_with_static_bound_not_ok() { - assert_send::<&'static (Dummy+'static)>(); + assert_send::<&'static (dyn Dummy + 'static)>(); //~^ ERROR `(dyn Dummy + 'static)` cannot be shared between threads safely [E0277] } fn box_object_with_no_bound_not_ok<'a>() { - assert_send::>(); + assert_send::>(); //~^ ERROR `dyn Dummy` cannot be sent between threads safely } fn object_with_send_bound_ok() { - assert_send::<&'static (Dummy+Sync)>(); - assert_send::>(); + assert_send::<&'static (dyn Dummy + Sync)>(); + assert_send::>(); } fn main() { } diff --git a/src/test/ui/kindck/kindck-send-object.stderr b/src/test/ui/kindck/kindck-send-object.stderr index 8d9935660292f..c9aadd85a53f2 100644 --- a/src/test/ui/kindck/kindck-send-object.stderr +++ b/src/test/ui/kindck/kindck-send-object.stderr @@ -1,8 +1,8 @@ error[E0277]: `(dyn Dummy + 'static)` cannot be shared between threads safely --> $DIR/kindck-send-object.rs:12:5 | -LL | assert_send::<&'static (Dummy+'static)>(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `(dyn Dummy + 'static)` cannot be shared between threads safely +LL | assert_send::<&'static (dyn Dummy + 'static)>(); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `(dyn Dummy + 'static)` cannot be shared between threads safely | = help: the trait `std::marker::Sync` is not implemented for `(dyn Dummy + 'static)` = note: required because of the requirements on the impl of `std::marker::Send` for `&'static (dyn Dummy + 'static)` @@ -15,8 +15,8 @@ LL | fn assert_send() { } error[E0277]: `dyn Dummy` cannot be sent between threads safely --> $DIR/kindck-send-object.rs:17:5 | -LL | assert_send::>(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^ `dyn Dummy` cannot be sent between threads safely +LL | assert_send::>(); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `dyn Dummy` cannot be sent between threads safely | = help: the trait `std::marker::Send` is not implemented for `dyn Dummy` = note: required because of the requirements on the impl of `std::marker::Send` for `std::ptr::Unique` diff --git a/src/test/ui/kindck/kindck-send-object1.nll.stderr b/src/test/ui/kindck/kindck-send-object1.nll.stderr index 1df7412132bd9..998dc90456f14 100644 --- a/src/test/ui/kindck/kindck-send-object1.nll.stderr +++ b/src/test/ui/kindck/kindck-send-object1.nll.stderr @@ -1,8 +1,8 @@ error[E0277]: `(dyn Dummy + 'a)` cannot be shared between threads safely --> $DIR/kindck-send-object1.rs:10:5 | -LL | assert_send::<&'a Dummy>(); - | ^^^^^^^^^^^^^^^^^^^^^^^^ `(dyn Dummy + 'a)` cannot be shared between threads safely +LL | assert_send::<&'a dyn Dummy>(); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `(dyn Dummy + 'a)` cannot be shared between threads safely | = help: the trait `std::marker::Sync` is not implemented for `(dyn Dummy + 'a)` = note: required because of the requirements on the impl of `std::marker::Send` for `&'a (dyn Dummy + 'a)` @@ -15,8 +15,8 @@ LL | fn assert_send() { } error[E0277]: `(dyn Dummy + 'a)` cannot be sent between threads safely --> $DIR/kindck-send-object1.rs:29:5 | -LL | assert_send::>(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `(dyn Dummy + 'a)` cannot be sent between threads safely +LL | assert_send::>(); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `(dyn Dummy + 'a)` cannot be sent between threads safely | = help: the trait `std::marker::Send` is not implemented for `(dyn Dummy + 'a)` = note: required because of the requirements on the impl of `std::marker::Send` for `std::ptr::Unique<(dyn Dummy + 'a)>` diff --git a/src/test/ui/kindck/kindck-send-object1.rs b/src/test/ui/kindck/kindck-send-object1.rs index 341985467de6c..0e198395c26fb 100644 --- a/src/test/ui/kindck/kindck-send-object1.rs +++ b/src/test/ui/kindck/kindck-send-object1.rs @@ -7,26 +7,26 @@ trait Dummy { } // careful with object types, who knows what they close over... fn test51<'a>() { - assert_send::<&'a Dummy>(); + assert_send::<&'a dyn Dummy>(); //~^ ERROR `(dyn Dummy + 'a)` cannot be shared between threads safely [E0277] } fn test52<'a>() { - assert_send::<&'a (Dummy+Sync)>(); + assert_send::<&'a (dyn Dummy + Sync)>(); //~^ ERROR does not fulfill the required lifetime } // ...unless they are properly bounded fn test60() { - assert_send::<&'static (Dummy+Sync)>(); + assert_send::<&'static (dyn Dummy + Sync)>(); } fn test61() { - assert_send::>(); + assert_send::>(); } // closure and object types can have lifetime bounds which make // them not ok fn test_71<'a>() { - assert_send::>(); + assert_send::>(); //~^ ERROR `(dyn Dummy + 'a)` cannot be sent between threads safely } diff --git a/src/test/ui/kindck/kindck-send-object1.stderr b/src/test/ui/kindck/kindck-send-object1.stderr index a4b908e4101ff..757b41ab6cb7e 100644 --- a/src/test/ui/kindck/kindck-send-object1.stderr +++ b/src/test/ui/kindck/kindck-send-object1.stderr @@ -1,8 +1,8 @@ error[E0277]: `(dyn Dummy + 'a)` cannot be shared between threads safely --> $DIR/kindck-send-object1.rs:10:5 | -LL | assert_send::<&'a Dummy>(); - | ^^^^^^^^^^^^^^^^^^^^^^^^ `(dyn Dummy + 'a)` cannot be shared between threads safely +LL | assert_send::<&'a dyn Dummy>(); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `(dyn Dummy + 'a)` cannot be shared between threads safely | = help: the trait `std::marker::Sync` is not implemented for `(dyn Dummy + 'a)` = note: required because of the requirements on the impl of `std::marker::Send` for `&'a (dyn Dummy + 'a)` @@ -15,16 +15,16 @@ LL | fn assert_send() { } error[E0477]: the type `&'a (dyn Dummy + std::marker::Sync + 'a)` does not fulfill the required lifetime --> $DIR/kindck-send-object1.rs:14:5 | -LL | assert_send::<&'a (Dummy+Sync)>(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | assert_send::<&'a (dyn Dummy + Sync)>(); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: type must satisfy the static lifetime error[E0277]: `(dyn Dummy + 'a)` cannot be sent between threads safely --> $DIR/kindck-send-object1.rs:29:5 | -LL | assert_send::>(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `(dyn Dummy + 'a)` cannot be sent between threads safely +LL | assert_send::>(); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `(dyn Dummy + 'a)` cannot be sent between threads safely | = help: the trait `std::marker::Send` is not implemented for `(dyn Dummy + 'a)` = note: required because of the requirements on the impl of `std::marker::Send` for `std::ptr::Unique<(dyn Dummy + 'a)>` diff --git a/src/test/ui/kindck/kindck-send-object2.rs b/src/test/ui/kindck/kindck-send-object2.rs index 911ad988081f5..b797588e446d6 100644 --- a/src/test/ui/kindck/kindck-send-object2.rs +++ b/src/test/ui/kindck/kindck-send-object2.rs @@ -4,21 +4,21 @@ fn assert_send() { } trait Dummy { } fn test50() { - assert_send::<&'static Dummy>(); + assert_send::<&'static dyn Dummy>(); //~^ ERROR `(dyn Dummy + 'static)` cannot be shared between threads safely [E0277] } fn test53() { - assert_send::>(); + assert_send::>(); //~^ ERROR `dyn Dummy` cannot be sent between threads safely } // ...unless they are properly bounded fn test60() { - assert_send::<&'static (Dummy+Sync)>(); + assert_send::<&'static (dyn Dummy + Sync)>(); } fn test61() { - assert_send::>(); + assert_send::>(); } fn main() { } diff --git a/src/test/ui/kindck/kindck-send-object2.stderr b/src/test/ui/kindck/kindck-send-object2.stderr index db79989dc5f6c..c1c9db9da839a 100644 --- a/src/test/ui/kindck/kindck-send-object2.stderr +++ b/src/test/ui/kindck/kindck-send-object2.stderr @@ -1,8 +1,8 @@ error[E0277]: `(dyn Dummy + 'static)` cannot be shared between threads safely --> $DIR/kindck-send-object2.rs:7:5 | -LL | assert_send::<&'static Dummy>(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `(dyn Dummy + 'static)` cannot be shared between threads safely +LL | assert_send::<&'static dyn Dummy>(); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `(dyn Dummy + 'static)` cannot be shared between threads safely | = help: the trait `std::marker::Sync` is not implemented for `(dyn Dummy + 'static)` = note: required because of the requirements on the impl of `std::marker::Send` for `&'static (dyn Dummy + 'static)` @@ -15,8 +15,8 @@ LL | fn assert_send() { } error[E0277]: `dyn Dummy` cannot be sent between threads safely --> $DIR/kindck-send-object2.rs:12:5 | -LL | assert_send::>(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^ `dyn Dummy` cannot be sent between threads safely +LL | assert_send::>(); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `dyn Dummy` cannot be sent between threads safely | = help: the trait `std::marker::Send` is not implemented for `dyn Dummy` = note: required because of the requirements on the impl of `std::marker::Send` for `std::ptr::Unique` diff --git a/src/test/ui/lifetimes/lifetime-bound-will-change-warning.nll.stderr b/src/test/ui/lifetimes/lifetime-bound-will-change-warning.nll.stderr index 8b24563e92004..f2cf19abdac31 100644 --- a/src/test/ui/lifetimes/lifetime-bound-will-change-warning.nll.stderr +++ b/src/test/ui/lifetimes/lifetime-bound-will-change-warning.nll.stderr @@ -1,7 +1,7 @@ error[E0521]: borrowed data escapes outside of function --> $DIR/lifetime-bound-will-change-warning.rs:34:5 | -LL | fn test2<'a>(x: &'a Box) { +LL | fn test2<'a>(x: &'a Box) { | - `x` is a reference that is only valid in the function body LL | // but ref_obj will not, so warn. LL | ref_obj(x) @@ -10,7 +10,7 @@ LL | ref_obj(x) error[E0521]: borrowed data escapes outside of function --> $DIR/lifetime-bound-will-change-warning.rs:39:5 | -LL | fn test2cc<'a>(x: &'a Box) { +LL | fn test2cc<'a>(x: &'a Box) { | - `x` is a reference that is only valid in the function body LL | // same as test2, but cross crate LL | lib::ref_obj(x) diff --git a/src/test/ui/lifetimes/lifetime-bound-will-change-warning.rs b/src/test/ui/lifetimes/lifetime-bound-will-change-warning.rs index 5461f875af6c5..3c6d92234c4fa 100644 --- a/src/test/ui/lifetimes/lifetime-bound-will-change-warning.rs +++ b/src/test/ui/lifetimes/lifetime-bound-will-change-warning.rs @@ -9,42 +9,42 @@ extern crate lifetime_bound_will_change_warning_lib as lib; -fn just_ref(x: &Fn()) { +fn just_ref(x: &dyn Fn()) { } -fn ref_obj(x: &Box) { +fn ref_obj(x: &Box) { // this will change to &Box... // Note: no warning is issued here, because the type of `x` will change to 'static if false { ref_obj(x); } } -fn test1<'a>(x: &'a Box) { +fn test1<'a>(x: &'a Box) { // just_ref will stay the same. just_ref(&**x) } -fn test1cc<'a>(x: &'a Box) { +fn test1cc<'a>(x: &'a Box) { // same as test1, but cross-crate lib::just_ref(&**x) } -fn test2<'a>(x: &'a Box) { +fn test2<'a>(x: &'a Box) { // but ref_obj will not, so warn. ref_obj(x) //~ ERROR mismatched types } -fn test2cc<'a>(x: &'a Box) { +fn test2cc<'a>(x: &'a Box) { // same as test2, but cross crate lib::ref_obj(x) //~ ERROR mismatched types } -fn test3<'a>(x: &'a Box) { +fn test3<'a>(x: &'a Box) { // here, we have a 'static bound, so even when ref_obj changes, no error results ref_obj(x) } -fn test3cc<'a>(x: &'a Box) { +fn test3cc<'a>(x: &'a Box) { // same as test3, but cross crate lib::ref_obj(x) } diff --git a/src/test/ui/lifetimes/lifetime-bound-will-change-warning.stderr b/src/test/ui/lifetimes/lifetime-bound-will-change-warning.stderr index 1af4bd501ba49..35d63c1727651 100644 --- a/src/test/ui/lifetimes/lifetime-bound-will-change-warning.stderr +++ b/src/test/ui/lifetimes/lifetime-bound-will-change-warning.stderr @@ -9,7 +9,7 @@ LL | ref_obj(x) note: the lifetime 'a as defined on the function body at 32:10... --> $DIR/lifetime-bound-will-change-warning.rs:32:10 | -LL | fn test2<'a>(x: &'a Box) { +LL | fn test2<'a>(x: &'a Box) { | ^^ = note: ...does not necessarily outlive the static lifetime @@ -24,7 +24,7 @@ LL | lib::ref_obj(x) note: the lifetime 'a as defined on the function body at 37:12... --> $DIR/lifetime-bound-will-change-warning.rs:37:12 | -LL | fn test2cc<'a>(x: &'a Box) { +LL | fn test2cc<'a>(x: &'a Box) { | ^^ = note: ...does not necessarily outlive the static lifetime diff --git a/src/test/ui/lifetimes/lifetime-elision-return-type-trait.rs b/src/test/ui/lifetimes/lifetime-elision-return-type-trait.rs index 1c288a7e44f37..2370084b072c7 100644 --- a/src/test/ui/lifetimes/lifetime-elision-return-type-trait.rs +++ b/src/test/ui/lifetimes/lifetime-elision-return-type-trait.rs @@ -5,7 +5,7 @@ trait Future { use std::error::Error; -fn foo() -> impl Future> { +fn foo() -> impl Future> { //~^ ERROR missing lifetime Ok(()) } diff --git a/src/test/ui/lifetimes/lifetime-elision-return-type-trait.stderr b/src/test/ui/lifetimes/lifetime-elision-return-type-trait.stderr index b2a3d9a94361f..06b317ce95278 100644 --- a/src/test/ui/lifetimes/lifetime-elision-return-type-trait.stderr +++ b/src/test/ui/lifetimes/lifetime-elision-return-type-trait.stderr @@ -1,8 +1,8 @@ error[E0106]: missing lifetime specifier --> $DIR/lifetime-elision-return-type-trait.rs:8:44 | -LL | fn foo() -> impl Future> { - | ^^^^^ help: consider giving it a 'static lifetime: `Error + 'static` +LL | fn foo() -> impl Future> { + | ^^^^^^^^^ help: consider giving it a 'static lifetime: `dyn Error + 'static` | = help: this function's return type contains a borrowed value, but there is no value for it to be borrowed from diff --git a/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-using-trait-objects.nll.stderr b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-using-trait-objects.nll.stderr index c4e7ff90069db..3c95be95db080 100644 --- a/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-using-trait-objects.nll.stderr +++ b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-using-trait-objects.nll.stderr @@ -1,18 +1,18 @@ error[E0596]: cannot borrow `y` as mutable, as it is not declared as mutable --> $DIR/ex3-both-anon-regions-using-trait-objects.rs:2:3 | -LL | fn foo(x:Box , y: Vec<&u8>, z: &u8) { - | - help: consider changing this to be mutable: `mut y` +LL | fn foo(x:Box , y: Vec<&u8>, z: &u8) { + | - help: consider changing this to be mutable: `mut y` LL | y.push(z); | ^ cannot borrow as mutable error: lifetime may not live long enough --> $DIR/ex3-both-anon-regions-using-trait-objects.rs:2:3 | -LL | fn foo(x:Box , y: Vec<&u8>, z: &u8) { - | - - let's call the lifetime of this reference `'1` - | | - | let's call the lifetime of this reference `'2` +LL | fn foo(x:Box , y: Vec<&u8>, z: &u8) { + | - - let's call the lifetime of this reference `'1` + | | + | let's call the lifetime of this reference `'2` LL | y.push(z); | ^^^^^^^^^ argument requires that `'1` must outlive `'2` diff --git a/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-using-trait-objects.rs b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-using-trait-objects.rs index 324a5846c94ae..6625d41c7de2a 100644 --- a/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-using-trait-objects.rs +++ b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-using-trait-objects.rs @@ -1,4 +1,4 @@ -fn foo(x:Box , y: Vec<&u8>, z: &u8) { +fn foo(x:Box , y: Vec<&u8>, z: &u8) { y.push(z); //~ ERROR lifetime mismatch } diff --git a/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-using-trait-objects.stderr b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-using-trait-objects.stderr index 6cd175b8a617b..bfecb4d33931b 100644 --- a/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-using-trait-objects.stderr +++ b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-using-trait-objects.stderr @@ -1,8 +1,8 @@ error[E0623]: lifetime mismatch --> $DIR/ex3-both-anon-regions-using-trait-objects.rs:2:10 | -LL | fn foo(x:Box , y: Vec<&u8>, z: &u8) { - | --- --- these two types are declared with different lifetimes... +LL | fn foo(x:Box , y: Vec<&u8>, z: &u8) { + | --- --- these two types are declared with different lifetimes... LL | y.push(z); | ^ ...but data from `z` flows into `y` here diff --git a/src/test/ui/lint/lint-ctypes.rs b/src/test/ui/lint/lint-ctypes.rs index 816177abdeaf1..a3d9b6febdbb7 100644 --- a/src/test/ui/lint/lint-ctypes.rs +++ b/src/test/ui/lint/lint-ctypes.rs @@ -51,7 +51,7 @@ extern { pub fn char_type(p: char); //~ ERROR uses type `char` pub fn i128_type(p: i128); //~ ERROR uses type `i128` pub fn u128_type(p: u128); //~ ERROR uses type `u128` - pub fn trait_type(p: &Clone); //~ ERROR uses type `dyn std::clone::Clone` + pub fn trait_type(p: &dyn Clone); //~ ERROR uses type `dyn std::clone::Clone` pub fn tuple_type(p: (i32, i32)); //~ ERROR uses type `(i32, i32)` pub fn tuple_type2(p: I32Pair); //~ ERROR uses type `(i32, i32)` pub fn zero_size(p: ZeroSize); //~ ERROR struct has no fields diff --git a/src/test/ui/lint/lint-ctypes.stderr b/src/test/ui/lint/lint-ctypes.stderr index 67ba30a81c502..03c18e4530b82 100644 --- a/src/test/ui/lint/lint-ctypes.stderr +++ b/src/test/ui/lint/lint-ctypes.stderr @@ -76,8 +76,8 @@ LL | pub fn u128_type(p: u128); error: `extern` block uses type `dyn std::clone::Clone` which is not FFI-safe: trait objects have no C equivalent --> $DIR/lint-ctypes.rs:54:26 | -LL | pub fn trait_type(p: &Clone); - | ^^^^^^ +LL | pub fn trait_type(p: &dyn Clone); + | ^^^^^^^^^^ error: `extern` block uses type `(i32, i32)` which is not FFI-safe: tuples have unspecified layout --> $DIR/lint-ctypes.rs:55:26 diff --git a/src/test/ui/lint/lint-dead-code-3.rs b/src/test/ui/lint/lint-dead-code-3.rs index 00b250f83dd6f..4397522f3f32f 100644 --- a/src/test/ui/lint/lint-dead-code-3.rs +++ b/src/test/ui/lint/lint-dead-code-3.rs @@ -73,6 +73,6 @@ mod inner { } pub fn foo() { - let a: &inner::Trait = &1_isize; + let a: &dyn inner::Trait = &1_isize; a.f(); } diff --git a/src/test/ui/lint/lint-stability-2.rs b/src/test/ui/lint/lint-stability-2.rs index 12e7b086d35d1..53eee35a9ca24 100644 --- a/src/test/ui/lint/lint-stability-2.rs +++ b/src/test/ui/lint/lint-stability-2.rs @@ -148,7 +148,7 @@ mod cross_crate { ::trait_stable(&foo); } - fn test_method_object(foo: &Trait) { + fn test_method_object(foo: &dyn Trait) { foo.trait_deprecated(); foo.trait_deprecated_text(); foo.trait_deprecated_unstable(); @@ -373,7 +373,7 @@ mod this_crate { ::trait_stable(&foo); } - fn test_method_object(foo: &Trait) { + fn test_method_object(foo: &dyn Trait) { foo.trait_deprecated(); foo.trait_deprecated_text(); foo.trait_unstable(); diff --git a/src/test/ui/lint/lint-stability-deprecated.rs b/src/test/ui/lint/lint-stability-deprecated.rs index bf574d7144d06..a2031c2189ae1 100644 --- a/src/test/ui/lint/lint-stability-deprecated.rs +++ b/src/test/ui/lint/lint-stability-deprecated.rs @@ -98,7 +98,7 @@ mod cross_crate { struct S1(T::TypeUnstable); struct S2(T::TypeDeprecated); //~^ WARN use of deprecated item 'lint_stability::TraitWithAssociatedTypes::TypeDeprecated': text - type A = TraitWithAssociatedTypes< + type A = dyn TraitWithAssociatedTypes< TypeUnstable = u8, TypeDeprecated = u16, //~^ WARN use of deprecated item 'lint_stability::TraitWithAssociatedTypes::TypeDeprecated' @@ -170,7 +170,7 @@ mod cross_crate { ::trait_stable(&foo); } - fn test_method_object(foo: &Trait) { + fn test_method_object(foo: &dyn Trait) { foo.trait_deprecated(); //~ WARN use of deprecated item 'lint_stability::Trait::trait_deprecated' foo.trait_deprecated_text(); //~ WARN use of deprecated item 'lint_stability::Trait::trait_deprecated_text': text foo.trait_deprecated_unstable(); //~ WARN use of deprecated item 'lint_stability::Trait::trait_deprecated_unstable' @@ -423,7 +423,7 @@ mod this_crate { ::trait_stable(&foo); } - fn test_method_object(foo: &Trait) { + fn test_method_object(foo: &dyn Trait) { foo.trait_deprecated(); //~ WARN use of deprecated item 'this_crate::Trait::trait_deprecated' foo.trait_deprecated_text(); //~ WARN use of deprecated item 'this_crate::Trait::trait_deprecated_text': text foo.trait_unstable(); diff --git a/src/test/ui/lint/lint-stability.rs b/src/test/ui/lint/lint-stability.rs index 3e4a3874d2c4a..fde27eec7d3e8 100644 --- a/src/test/ui/lint/lint-stability.rs +++ b/src/test/ui/lint/lint-stability.rs @@ -88,7 +88,7 @@ mod cross_crate { struct S1(T::TypeUnstable); //~^ ERROR use of unstable library feature struct S2(T::TypeDeprecated); - type A = TraitWithAssociatedTypes< + type A = dyn TraitWithAssociatedTypes< TypeUnstable = u8, //~ ERROR use of unstable library feature TypeDeprecated = u16, >; @@ -161,7 +161,7 @@ mod cross_crate { ::trait_stable(&foo); } - fn test_method_object(foo: &Trait) { + fn test_method_object(foo: &dyn Trait) { foo.trait_deprecated(); foo.trait_deprecated_text(); foo.trait_stable(); @@ -414,7 +414,7 @@ mod this_crate { ::trait_stable(&foo); } - fn test_method_object(foo: &Trait) { + fn test_method_object(foo: &dyn Trait) { foo.trait_deprecated(); foo.trait_deprecated_text(); foo.trait_unstable(); diff --git a/src/test/ui/lint/lint-unconditional-recursion.rs b/src/test/ui/lint/lint-unconditional-recursion.rs index 44af1179097ed..ab60a326cd220 100644 --- a/src/test/ui/lint/lint-unconditional-recursion.rs +++ b/src/test/ui/lint/lint-unconditional-recursion.rs @@ -39,7 +39,7 @@ trait Foo { } } -impl Foo for Box { +impl Foo for Box { fn bar(&self) { //~ ERROR function cannot return without recursing loop { self.bar() @@ -67,7 +67,7 @@ trait Foo2 { } } -impl Foo2 for Box { +impl Foo2 for Box { fn bar(&self) { //~ ERROR function cannot return without recursing loop { Foo2::bar(self) diff --git a/src/test/ui/loops/loops-reject-lifetime-shadowing-label.rs b/src/test/ui/loops/loops-reject-lifetime-shadowing-label.rs index f48e984845665..656ed6576e269 100644 --- a/src/test/ui/loops/loops-reject-lifetime-shadowing-label.rs +++ b/src/test/ui/loops/loops-reject-lifetime-shadowing-label.rs @@ -18,7 +18,7 @@ fn foo() { let z = 3_i8; 'a: loop { - let b = Box::new(|x: &i8| *x) as Box Fn(&'a i8) -> i8>; + let b = Box::new(|x: &i8| *x) as Box Fn(&'a i8) -> i8>; //~^ WARN lifetime name `'a` shadows a label name that is already in scope assert_eq!((*b)(&z), z); break 'a; diff --git a/src/test/ui/loops/loops-reject-lifetime-shadowing-label.stderr b/src/test/ui/loops/loops-reject-lifetime-shadowing-label.stderr index 4c4d9218ec9e9..e5d376675c62a 100644 --- a/src/test/ui/loops/loops-reject-lifetime-shadowing-label.stderr +++ b/src/test/ui/loops/loops-reject-lifetime-shadowing-label.stderr @@ -1,8 +1,8 @@ warning: lifetime name `'a` shadows a label name that is already in scope - --> $DIR/loops-reject-lifetime-shadowing-label.rs:21:51 + --> $DIR/loops-reject-lifetime-shadowing-label.rs:21:55 | LL | 'a: loop { | -- first declared here -LL | let b = Box::new(|x: &i8| *x) as Box Fn(&'a i8) -> i8>; - | ^^ lifetime 'a already in scope +LL | let b = Box::new(|x: &i8| *x) as Box Fn(&'a i8) -> i8>; + | ^^ lifetime 'a already in scope diff --git a/src/test/ui/lub-glb/old-lub-glb-object.rs b/src/test/ui/lub-glb/old-lub-glb-object.rs index dcd604a5157e2..f303c07e6d79c 100644 --- a/src/test/ui/lub-glb/old-lub-glb-object.rs +++ b/src/test/ui/lub-glb/old-lub-glb-object.rs @@ -4,8 +4,8 @@ trait Foo { } fn foo( - x: &for<'a, 'b> Foo<&'a u8, &'b u8>, - y: &for<'a> Foo<&'a u8, &'a u8>, + x: &dyn for<'a, 'b> Foo<&'a u8, &'b u8>, + y: &dyn for<'a> Foo<&'a u8, &'a u8>, ) { let z = match 22 { 0 => x, @@ -14,12 +14,12 @@ fn foo( } fn bar( - x: &for<'a, 'b> Foo<&'a u8, &'b u8>, - y: &for<'a> Foo<&'a u8, &'a u8>, + x: &dyn for<'a, 'b> Foo<&'a u8, &'b u8>, + y: &dyn for<'a> Foo<&'a u8, &'a u8>, ) { // Accepted with explicit case: let z = match 22 { - 0 => x as &for<'a> Foo<&'a u8, &'a u8>, + 0 => x as &dyn for<'a> Foo<&'a u8, &'a u8>, _ => y, }; } diff --git a/src/test/ui/map-types.rs b/src/test/ui/map-types.rs index dab7863415f6e..c355a0e420f8f 100644 --- a/src/test/ui/map-types.rs +++ b/src/test/ui/map-types.rs @@ -13,7 +13,7 @@ impl Map for HashMap {} fn main() { let x: Box> = box HashMap::new(); - let x: Box> = x; - let y: Box> = Box::new(x); + let x: Box> = x; + let y: Box> = Box::new(x); //~^ ERROR `std::boxed::Box>: Map` is not satisfied } diff --git a/src/test/ui/map-types.stderr b/src/test/ui/map-types.stderr index 9aa9804424214..21dac1ab1edfb 100644 --- a/src/test/ui/map-types.stderr +++ b/src/test/ui/map-types.stderr @@ -1,8 +1,8 @@ error[E0277]: the trait bound `std::boxed::Box>: Map` is not satisfied - --> $DIR/map-types.rs:17:37 + --> $DIR/map-types.rs:17:41 | -LL | let y: Box> = Box::new(x); - | ^^^^^^^^^^^ the trait `Map` is not implemented for `std::boxed::Box>` +LL | let y: Box> = Box::new(x); + | ^^^^^^^^^^^ the trait `Map` is not implemented for `std::boxed::Box>` | = note: required for the cast to the object type `dyn Map` diff --git a/src/test/ui/methods/method-call-lifetime-args-lint-fail.rs b/src/test/ui/methods/method-call-lifetime-args-lint-fail.rs index 36a1a2fda6995..23893911eabd9 100644 --- a/src/test/ui/methods/method-call-lifetime-args-lint-fail.rs +++ b/src/test/ui/methods/method-call-lifetime-args-lint-fail.rs @@ -11,10 +11,10 @@ impl S { // 'late lifetimes here belong to nested types not to the tested functions. fn early_tricky_explicit<'a>(_: for<'late> fn(&'late u8), - _: Box Fn(&'late u8)>) + _: Box Fn(&'late u8)>) -> &'a u8 { loop {} } fn early_tricky_implicit<'a>(_: fn(&u8), - _: Box) + _: Box) -> &'a u8 { loop {} } } diff --git a/src/test/ui/mismatched_types/cast-rfc0401.rs b/src/test/ui/mismatched_types/cast-rfc0401.rs index a5e03a18e6af2..2f88c6496c420 100644 --- a/src/test/ui/mismatched_types/cast-rfc0401.rs +++ b/src/test/ui/mismatched_types/cast-rfc0401.rs @@ -24,7 +24,7 @@ fn main() let v = 0 as *const u8; let fat_v : *const [u8] = unsafe { &*(0 as *const [u8; 1])}; let fat_sv : *const [i8] = unsafe { &*(0 as *const [i8; 1])}; - let foo: &Foo = &f; + let foo: &dyn Foo = &f; let _ = v as &u8; //~ ERROR non-primitive cast let _ = v as E; //~ ERROR non-primitive cast @@ -50,7 +50,7 @@ fn main() let _ = 42usize as *const [u8]; //~ ERROR is invalid let _ = v as *const [u8]; //~ ERROR cannot cast - let _ = fat_v as *const Foo; //~ ERROR the size for values of type + let _ = fat_v as *const dyn Foo; //~ ERROR the size for values of type let _ = foo as *const str; //~ ERROR is invalid let _ = foo as *mut str; //~ ERROR is invalid let _ = main as *mut str; //~ ERROR is invalid @@ -59,14 +59,14 @@ fn main() let _ = fat_sv as usize; //~ ERROR is invalid let a : *const str = "hello"; - let _ = a as *const Foo; //~ ERROR the size for values of type + let _ = a as *const dyn Foo; //~ ERROR the size for values of type // check no error cascade let _ = main.f as *const u32; //~ ERROR no field - let cf: *const Foo = &0; + let cf: *const dyn Foo = &0; let _ = cf as *const [u16]; //~ ERROR is invalid - let _ = cf as *const Bar; //~ ERROR is invalid + let _ = cf as *const dyn Bar; //~ ERROR is invalid vec![0.0].iter().map(|s| s as f32).collect::>(); //~ ERROR is invalid } diff --git a/src/test/ui/mismatched_types/cast-rfc0401.stderr b/src/test/ui/mismatched_types/cast-rfc0401.stderr index 0e0bb8da81e43..f94dfd100a6f4 100644 --- a/src/test/ui/mismatched_types/cast-rfc0401.stderr +++ b/src/test/ui/mismatched_types/cast-rfc0401.stderr @@ -207,15 +207,15 @@ LL | let _ = cf as *const [u16]; error[E0606]: casting `*const dyn Foo` as `*const dyn Bar` is invalid --> $DIR/cast-rfc0401.rs:69:13 | -LL | let _ = cf as *const Bar; - | ^^^^^^^^^^^^^^^^ +LL | let _ = cf as *const dyn Bar; + | ^^^^^^^^^^^^^^^^^^^^ | = note: vtable kinds may not match error[E0277]: the size for values of type `[u8]` cannot be known at compilation time --> $DIR/cast-rfc0401.rs:53:13 | -LL | let _ = fat_v as *const Foo; +LL | let _ = fat_v as *const dyn Foo; | ^^^^^ doesn't have a size known at compile-time | = help: the trait `std::marker::Sized` is not implemented for `[u8]` @@ -225,7 +225,7 @@ LL | let _ = fat_v as *const Foo; error[E0277]: the size for values of type `str` cannot be known at compilation time --> $DIR/cast-rfc0401.rs:62:13 | -LL | let _ = a as *const Foo; +LL | let _ = a as *const dyn Foo; | ^ doesn't have a size known at compile-time | = help: the trait `std::marker::Sized` is not implemented for `str` diff --git a/src/test/ui/mismatched_types/issue-19109.rs b/src/test/ui/mismatched_types/issue-19109.rs index 030b7a40ca6fe..eae6a87905b33 100644 --- a/src/test/ui/mismatched_types/issue-19109.rs +++ b/src/test/ui/mismatched_types/issue-19109.rs @@ -1,7 +1,7 @@ trait Trait { } -fn function(t: &mut Trait) { - t as *mut Trait +fn function(t: &mut dyn Trait) { + t as *mut dyn Trait //~^ ERROR: mismatched types } diff --git a/src/test/ui/mismatched_types/issue-19109.stderr b/src/test/ui/mismatched_types/issue-19109.stderr index db2d484edff07..b826ca66c683a 100644 --- a/src/test/ui/mismatched_types/issue-19109.stderr +++ b/src/test/ui/mismatched_types/issue-19109.stderr @@ -1,10 +1,10 @@ error[E0308]: mismatched types --> $DIR/issue-19109.rs:4:5 | -LL | fn function(t: &mut Trait) { - | - help: try adding a return type: `-> *mut dyn Trait` -LL | t as *mut Trait - | ^^^^^^^^^^^^^^^ expected (), found *-ptr +LL | fn function(t: &mut dyn Trait) { + | - help: try adding a return type: `-> *mut dyn Trait` +LL | t as *mut dyn Trait + | ^^^^^^^^^^^^^^^^^^^ expected (), found *-ptr | = note: expected type `()` found type `*mut dyn Trait` diff --git a/src/test/ui/mismatched_types/trait-bounds-cant-coerce.rs b/src/test/ui/mismatched_types/trait-bounds-cant-coerce.rs index be5fab871b42f..882533992bd3c 100644 --- a/src/test/ui/mismatched_types/trait-bounds-cant-coerce.rs +++ b/src/test/ui/mismatched_types/trait-bounds-cant-coerce.rs @@ -2,14 +2,14 @@ trait Foo { fn dummy(&self) { } } -fn a(_x: Box) { +fn a(_x: Box) { } -fn c(x: Box) { +fn c(x: Box) { a(x); } -fn d(x: Box) { +fn d(x: Box) { a(x); //~ ERROR mismatched types [E0308] } diff --git a/src/test/ui/moves/moves-based-on-type-no-recursive-stack-closure.rs b/src/test/ui/moves/moves-based-on-type-no-recursive-stack-closure.rs index 3fa11878629c3..0385a120ce213 100644 --- a/src/test/ui/moves/moves-based-on-type-no-recursive-stack-closure.rs +++ b/src/test/ui/moves/moves-based-on-type-no-recursive-stack-closure.rs @@ -6,7 +6,7 @@ struct R<'a> { // This struct is needed to create the // otherwise infinite type of a fn that // accepts itself as argument: - c: Box + c: Box } fn innocent_looking_victim() { diff --git a/src/test/ui/nll/issue-52663-trait-object.rs b/src/test/ui/nll/issue-52663-trait-object.rs index e8e571aadc368..a7be365bde4bd 100644 --- a/src/test/ui/nll/issue-52663-trait-object.rs +++ b/src/test/ui/nll/issue-52663-trait-object.rs @@ -10,7 +10,7 @@ fn main() { let _ = { let tmp0 = 3; let tmp1 = &tmp0; - box tmp1 as Box + box tmp1 as Box }; //~^^^ ERROR `tmp0` does not live long enough } diff --git a/src/test/ui/nll/issue-52663-trait-object.stderr b/src/test/ui/nll/issue-52663-trait-object.stderr index 9262117f39755..b71893de7f8bd 100644 --- a/src/test/ui/nll/issue-52663-trait-object.stderr +++ b/src/test/ui/nll/issue-52663-trait-object.stderr @@ -3,8 +3,8 @@ error[E0597]: `tmp0` does not live long enough | LL | let tmp1 = &tmp0; | ^^^^^ borrowed value does not live long enough -LL | box tmp1 as Box - | ------------------------- borrow later captured here by trait object +LL | box tmp1 as Box + | ----------------------------- borrow later captured here by trait object LL | }; | - `tmp0` dropped here while still borrowed diff --git a/src/test/ui/nll/issue-53570.rs b/src/test/ui/nll/issue-53570.rs index cea458dcb65b9..81c50edfed1a4 100644 --- a/src/test/ui/nll/issue-53570.rs +++ b/src/test/ui/nll/issue-53570.rs @@ -14,11 +14,11 @@ trait AnyVec<'a> { } trait GenericVec { - fn unwrap<'a, 'b>(vec: &'b AnyVec<'a>) -> &'b [T] where T: 'a; + fn unwrap<'a, 'b>(vec: &'b dyn AnyVec<'a>) -> &'b [T] where T: 'a; } struct Scratchpad<'a> { - buffers: RefCell>>, + buffers: RefCell>>, } impl<'a> Scratchpad<'a> { diff --git a/src/test/ui/object-does-not-impl-trait.rs b/src/test/ui/object-does-not-impl-trait.rs index 2d72b4588f754..104e7b2e21559 100644 --- a/src/test/ui/object-does-not-impl-trait.rs +++ b/src/test/ui/object-does-not-impl-trait.rs @@ -3,6 +3,6 @@ trait Foo {} fn take_foo(f: F) {} -fn take_object(f: Box) { take_foo(f); } +fn take_object(f: Box) { take_foo(f); } //~^ ERROR `std::boxed::Box: Foo` is not satisfied fn main() {} diff --git a/src/test/ui/object-does-not-impl-trait.stderr b/src/test/ui/object-does-not-impl-trait.stderr index 0e28875ced63a..288ce9682c209 100644 --- a/src/test/ui/object-does-not-impl-trait.stderr +++ b/src/test/ui/object-does-not-impl-trait.stderr @@ -1,8 +1,8 @@ error[E0277]: the trait bound `std::boxed::Box: Foo` is not satisfied - --> $DIR/object-does-not-impl-trait.rs:6:31 + --> $DIR/object-does-not-impl-trait.rs:6:35 | -LL | fn take_object(f: Box) { take_foo(f); } - | ^^^^^^^^ the trait `Foo` is not implemented for `std::boxed::Box` +LL | fn take_object(f: Box) { take_foo(f); } + | ^^^^^^^^ the trait `Foo` is not implemented for `std::boxed::Box` | note: required by `take_foo` --> $DIR/object-does-not-impl-trait.rs:5:1 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 d14351aef9a48..5dae92fee5f90 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) { +fn b(t: Ref2) { //~^ 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>) { +fn d(t: Ref2>) { // In this case, the lifetime parameter from the Ref1 overrides. } -fn e(t: Ref2>) { +fn e(t: Ref2>) { // In this case, Ref2 is ambiguous, but Ref0 overrides with 'static. } -fn f(t: &Ref2) { +fn f(t: &Ref2) { //~^ 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 0319c7bfbe272..0c3dbffeea638 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) { - | ^^^^ +LL | fn b(t: Ref2) { + | ^^^^^^^^ 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) { - | ^^^^ +LL | fn f(t: &Ref2) { + | ^^^^^^^^ 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 19cdd66ef759c..e94f2a92125cd 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 cf15a4e8676bd..dc42edfba2cc1 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 + r: Box } fn deref(ss: &T) -> T { @@ -17,7 +17,7 @@ fn deref(ss: &T) -> T { loop { } } -fn load0<'a>(ss: &'a Box) -> Box { +fn load0<'a>(ss: &'a Box) -> Box { // Under old rules, the fully elaborated types of input/output were: // // for<'a,'b> fn(&'a Box) -> Box @@ -31,7 +31,7 @@ fn load0<'a>(ss: &'a Box) -> Box { 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 dcb07a1706f35..2cdd6c5d890f2 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 9e68647214c27..17fb7c4acdffd 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 { +LL | fn load(ss: &mut SomeStruct) -> Box { | --------------- 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) { +LL | fn store1<'b>(ss: &mut SomeStruct, b: Box) { | --------------- 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 b6d72f1fce3ff..587aab1edce38 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 + r: Box } -fn load(ss: &mut SomeStruct) -> Box { +fn load(ss: &mut SomeStruct) -> Box { // `Box` 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) { +fn store(ss: &mut SomeStruct, b: Box) { // 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) { +fn store1<'b>(ss: &mut SomeStruct, b: Box) { // 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 0077c95139f4b..78e4bdd374da9 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 { +LL | fn load(ss: &mut SomeStruct) -> Box { | --------------- 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) { +LL | fn store1<'b>(ss: &mut SomeStruct, b: Box) { | --------------- 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 6d183ddf22d19..7d6f9f39d13ed 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, mut ss: SomeStruct<'a>) { +LL | fn c<'a>(t: &'a Box, 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 91b384e00713b..bf9e0beb57cdf 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, + t: &'a Box, } -fn c<'a>(t: &'a Box, mut ss: SomeStruct<'a>) { +fn c<'a>(t: &'a Box, 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 d7e3a171333ec..4f9cef12c5ef2 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, mut ss: SomeStruct<'a>) { +LL | fn c<'a>(t: &'a Box, 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 fe3b21fa39c57..6df54638ce004 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, mut ss: SomeStruct<'a>) { +LL | fn c<'a>(t: &'a MyBox, 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 6a84621f59e44..ae2878539cfd1 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, - u: &'a MyBox, + t: &'a MyBox, + u: &'a MyBox, } struct MyBox { b: Box } -fn c<'a>(t: &'a MyBox, mut ss: SomeStruct<'a>) { +fn c<'a>(t: &'a MyBox, 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 4d082530dc528..3b7faee68aaba 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, mut ss: SomeStruct<'a>) { +LL | fn c<'a>(t: &'a MyBox, 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 448fe9e55109c..cdfbf0fc878cf 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, +LL | fn load1<'a,'b>(a: &'a MyBox, | -- -- 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) -> MyBox { +LL | fn load2<'a>(ss: &MyBox) -> MyBox { | -- `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 c94df82a17759..eb27fe90f47ce 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(ss: &T) -> T { loop { } } -fn load0(ss: &MyBox) -> MyBox { +fn load0(ss: &MyBox) -> MyBox { deref(ss) } -fn load1<'a,'b>(a: &'a MyBox, - b: &'b MyBox) - -> &'b MyBox +fn load1<'a,'b>(a: &'a MyBox, + b: &'b MyBox) + -> &'b MyBox { a //~ ERROR lifetime mismatch } -fn load2<'a>(ss: &MyBox) -> MyBox { +fn load2<'a>(ss: &MyBox) -> MyBox { 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 4c23f867be81d..928b920198232 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, - | -------------------- this parameter and the return type are declared with different lifetimes... -LL | b: &'b MyBox) -LL | -> &'b MyBox - | -------------------- +LL | fn load1<'a,'b>(a: &'a MyBox, + | ------------------------ this parameter and the return type are declared with different lifetimes... +LL | b: &'b MyBox) +LL | -> &'b MyBox + | ------------------------ 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) -> MyBox { +LL | fn load2<'a>(ss: &MyBox) -> MyBox { | ^^ = note: ...does not necessarily outlive the static lifetime diff --git a/src/test/ui/object-pointer-types.rs b/src/test/ui/object-pointer-types.rs index a8a482fb5a6c3..760a50e5b7972 100644 --- a/src/test/ui/object-pointer-types.rs +++ b/src/test/ui/object-pointer-types.rs @@ -5,19 +5,19 @@ trait Foo { fn owned(self: Box); } -fn borrowed_receiver(x: &Foo) { +fn borrowed_receiver(x: &dyn Foo) { x.borrowed(); x.borrowed_mut(); // See [1] x.owned(); //~ ERROR no method named `owned` found } -fn borrowed_mut_receiver(x: &mut Foo) { +fn borrowed_mut_receiver(x: &mut dyn Foo) { x.borrowed(); x.borrowed_mut(); x.owned(); //~ ERROR no method named `owned` found } -fn owned_receiver(x: Box) { +fn owned_receiver(x: Box) { x.borrowed(); x.borrowed_mut(); // See [1] x.managed(); //~ ERROR no method named `managed` found diff --git a/src/test/ui/object-safety/object-safety-associated-consts.rs b/src/test/ui/object-safety/object-safety-associated-consts.rs index 79b7e541af82a..5900019ea915a 100644 --- a/src/test/ui/object-safety/object-safety-associated-consts.rs +++ b/src/test/ui/object-safety/object-safety-associated-consts.rs @@ -6,7 +6,7 @@ trait Bar { const X: usize; } -fn make_bar(t: &T) -> &Bar { +fn make_bar(t: &T) -> &dyn Bar { //~^ ERROR E0038 t } diff --git a/src/test/ui/object-safety/object-safety-associated-consts.stderr b/src/test/ui/object-safety/object-safety-associated-consts.stderr index 96962c10720a2..55f9e3f9f138b 100644 --- a/src/test/ui/object-safety/object-safety-associated-consts.stderr +++ b/src/test/ui/object-safety/object-safety-associated-consts.stderr @@ -1,8 +1,8 @@ error[E0038]: the trait `Bar` cannot be made into an object --> $DIR/object-safety-associated-consts.rs:9:1 | -LL | fn make_bar(t: &T) -> &Bar { - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Bar` cannot be made into an object +LL | fn make_bar(t: &T) -> &dyn Bar { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Bar` cannot be made into an object | = note: the trait cannot contain associated consts like `X` diff --git a/src/test/ui/object-safety/object-safety-by-value-self-use.rs b/src/test/ui/object-safety/object-safety-by-value-self-use.rs index 0b70c8ad45e7d..f903f26c0901d 100644 --- a/src/test/ui/object-safety/object-safety-by-value-self-use.rs +++ b/src/test/ui/object-safety/object-safety-by-value-self-use.rs @@ -11,7 +11,7 @@ trait Baz { fn baz(self: Self); } -fn use_bar(t: Box) { +fn use_bar(t: Box) { t.bar() //~ ERROR cannot move a value of type dyn Bar } diff --git a/src/test/ui/object-safety/object-safety-by-value-self.rs b/src/test/ui/object-safety/object-safety-by-value-self.rs index dee31f6e370f9..a8b1ddfaba7f1 100644 --- a/src/test/ui/object-safety/object-safety-by-value-self.rs +++ b/src/test/ui/object-safety/object-safety-by-value-self.rs @@ -17,28 +17,28 @@ trait Quux { fn baz(self: Self) where Self : Sized; } -fn make_bar(t: &T) -> &Bar { +fn make_bar(t: &T) -> &dyn Bar { t // legal } -fn make_bar_explicit(t: &T) -> &Bar { - t as &Bar // legal +fn make_bar_explicit(t: &T) -> &dyn Bar { + t as &dyn Bar // legal } -fn make_baz(t: &T) -> &Baz { +fn make_baz(t: &T) -> &dyn Baz { t // legal } -fn make_baz_explicit(t: &T) -> &Baz { - t as &Baz // legal +fn make_baz_explicit(t: &T) -> &dyn Baz { + t as &dyn Baz // legal } -fn make_quux(t: &T) -> &Quux { +fn make_quux(t: &T) -> &dyn Quux { t } -fn make_quux_explicit(t: &T) -> &Quux { - t as &Quux +fn make_quux_explicit(t: &T) -> &dyn Quux { + t as &dyn Quux } diff --git a/src/test/ui/object-safety/object-safety-generics.rs b/src/test/ui/object-safety/object-safety-generics.rs index 5f4aabf5469cb..d63ea28c8f227 100644 --- a/src/test/ui/object-safety/object-safety-generics.rs +++ b/src/test/ui/object-safety/object-safety-generics.rs @@ -11,22 +11,22 @@ trait Quux { where Self : Sized; } -fn make_bar(t: &T) -> &Bar { +fn make_bar(t: &T) -> &dyn Bar { //~^ ERROR E0038 t } -fn make_bar_explicit(t: &T) -> &Bar { +fn make_bar_explicit(t: &T) -> &dyn Bar { //~^ ERROR E0038 - t as &Bar + t as &dyn Bar } -fn make_quux(t: &T) -> &Quux { +fn make_quux(t: &T) -> &dyn Quux { t } -fn make_quux_explicit(t: &T) -> &Quux { - t as &Quux +fn make_quux_explicit(t: &T) -> &dyn Quux { + t as &dyn Quux } fn main() { diff --git a/src/test/ui/object-safety/object-safety-generics.stderr b/src/test/ui/object-safety/object-safety-generics.stderr index 7ae44794ceba9..d66cdb98448d4 100644 --- a/src/test/ui/object-safety/object-safety-generics.stderr +++ b/src/test/ui/object-safety/object-safety-generics.stderr @@ -1,16 +1,16 @@ error[E0038]: the trait `Bar` cannot be made into an object --> $DIR/object-safety-generics.rs:14:1 | -LL | fn make_bar(t: &T) -> &Bar { - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Bar` cannot be made into an object +LL | fn make_bar(t: &T) -> &dyn Bar { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Bar` cannot be made into an object | = note: method `bar` has generic type parameters error[E0038]: the trait `Bar` cannot be made into an object --> $DIR/object-safety-generics.rs:19:1 | -LL | fn make_bar_explicit(t: &T) -> &Bar { - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Bar` cannot be made into an object +LL | fn make_bar_explicit(t: &T) -> &dyn Bar { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Bar` cannot be made into an object | = note: method `bar` has generic type parameters diff --git a/src/test/ui/object-safety/object-safety-issue-22040.rs b/src/test/ui/object-safety/object-safety-issue-22040.rs index eb28fcf0d5af2..1fc5c5442c21b 100644 --- a/src/test/ui/object-safety/object-safety-issue-22040.rs +++ b/src/test/ui/object-safety/object-safety-issue-22040.rs @@ -9,7 +9,7 @@ trait Expr: Debug + PartialEq { //#[derive(PartialEq)] #[derive(Debug)] struct SExpr<'x> { - elements: Vec>, + elements: Vec>, //~^ ERROR E0038 } @@ -35,8 +35,8 @@ impl <'x> Expr for SExpr<'x> { } fn main() { - let a: Box = Box::new(SExpr::new()); - let b: Box = Box::new(SExpr::new()); + let a: Box = Box::new(SExpr::new()); + let b: Box = Box::new(SExpr::new()); // assert_eq!(a , b); } diff --git a/src/test/ui/object-safety/object-safety-issue-22040.stderr b/src/test/ui/object-safety/object-safety-issue-22040.stderr index 85721f1a5f81c..1f5c472ddc25a 100644 --- a/src/test/ui/object-safety/object-safety-issue-22040.stderr +++ b/src/test/ui/object-safety/object-safety-issue-22040.stderr @@ -1,8 +1,8 @@ error[E0038]: the trait `Expr` cannot be made into an object --> $DIR/object-safety-issue-22040.rs:12:23 | -LL | elements: Vec>, - | ^^^^^^^^ the trait `Expr` cannot be made into an object +LL | elements: Vec>, + | ^^^^^^^^^^^^^ the trait `Expr` cannot be made into an object | = note: the trait cannot use `Self` as a type parameter in the supertraits or where-clauses diff --git a/src/test/ui/object-safety/object-safety-mentions-Self.rs b/src/test/ui/object-safety/object-safety-mentions-Self.rs index 8e1bd83cec00a..f13ffe5362670 100644 --- a/src/test/ui/object-safety/object-safety-mentions-Self.rs +++ b/src/test/ui/object-safety/object-safety-mentions-Self.rs @@ -14,22 +14,22 @@ trait Quux { fn get(&self, s: &Self) -> Self where Self : Sized; } -fn make_bar(t: &T) -> &Bar { +fn make_bar(t: &T) -> &dyn Bar { //~^ ERROR E0038 loop { } } -fn make_baz(t: &T) -> &Baz { +fn make_baz(t: &T) -> &dyn Baz { //~^ ERROR E0038 t } -fn make_quux(t: &T) -> &Quux { +fn make_quux(t: &T) -> &dyn Quux { t } -fn make_quux_explicit(t: &T) -> &Quux { - t as &Quux +fn make_quux_explicit(t: &T) -> &dyn Quux { + t as &dyn Quux } fn main() { diff --git a/src/test/ui/object-safety/object-safety-mentions-Self.stderr b/src/test/ui/object-safety/object-safety-mentions-Self.stderr index ed3aed983cf7a..c0c471c2b1e72 100644 --- a/src/test/ui/object-safety/object-safety-mentions-Self.stderr +++ b/src/test/ui/object-safety/object-safety-mentions-Self.stderr @@ -1,16 +1,16 @@ error[E0038]: the trait `Bar` cannot be made into an object --> $DIR/object-safety-mentions-Self.rs:17:1 | -LL | fn make_bar(t: &T) -> &Bar { - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Bar` cannot be made into an object +LL | fn make_bar(t: &T) -> &dyn Bar { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Bar` cannot be made into an object | = note: method `bar` references the `Self` type in its arguments or return type error[E0038]: the trait `Baz` cannot be made into an object --> $DIR/object-safety-mentions-Self.rs:22:1 | -LL | fn make_baz(t: &T) -> &Baz { - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Baz` cannot be made into an object +LL | fn make_baz(t: &T) -> &dyn Baz { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Baz` cannot be made into an object | = note: method `bar` references the `Self` type in its arguments or return type diff --git a/src/test/ui/object-safety/object-safety-no-static.rs b/src/test/ui/object-safety/object-safety-no-static.rs index 4faf9386f9a8b..55d31ce808769 100644 --- a/src/test/ui/object-safety/object-safety-no-static.rs +++ b/src/test/ui/object-safety/object-safety-no-static.rs @@ -5,7 +5,7 @@ trait Foo { fn foo(); } -fn foo_implicit(b: Box) -> Box { +fn foo_implicit(b: Box) -> Box { //~^ ERROR E0038 loop { } } diff --git a/src/test/ui/object-safety/object-safety-no-static.stderr b/src/test/ui/object-safety/object-safety-no-static.stderr index 3b8ccb594c181..da8dd657c2a9d 100644 --- a/src/test/ui/object-safety/object-safety-no-static.stderr +++ b/src/test/ui/object-safety/object-safety-no-static.stderr @@ -1,8 +1,8 @@ error[E0038]: the trait `Foo` cannot be made into an object --> $DIR/object-safety-no-static.rs:8:1 | -LL | fn foo_implicit(b: Box) -> Box { - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Foo` cannot be made into an object +LL | fn foo_implicit(b: Box) -> Box { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Foo` cannot be made into an object | = note: method `foo` has no receiver diff --git a/src/test/ui/object-safety/object-safety-phantom-fn.rs b/src/test/ui/object-safety/object-safety-phantom-fn.rs index f8875e4995b44..59ed12c78f026 100644 --- a/src/test/ui/object-safety/object-safety-phantom-fn.rs +++ b/src/test/ui/object-safety/object-safety-phantom-fn.rs @@ -9,11 +9,11 @@ trait Baz { trait Bar { } -fn make_bar>(t: &T) -> &Bar { +fn make_bar>(t: &T) -> &dyn Bar { t } -fn make_baz(t: &T) -> &Baz { +fn make_baz(t: &T) -> &dyn Baz { t } diff --git a/src/test/ui/object-safety/object-safety-sized-2.rs b/src/test/ui/object-safety/object-safety-sized-2.rs index baeb3734677fb..7235b22404e29 100644 --- a/src/test/ui/object-safety/object-safety-sized-2.rs +++ b/src/test/ui/object-safety/object-safety-sized-2.rs @@ -7,7 +7,7 @@ trait Bar fn bar(&self, t: T); } -fn make_bar(t: &T) -> &Bar { +fn make_bar(t: &T) -> &dyn Bar { //~^ ERROR E0038 loop { } } diff --git a/src/test/ui/object-safety/object-safety-sized-2.stderr b/src/test/ui/object-safety/object-safety-sized-2.stderr index 2b8bfa341d796..dcaf2ff0bc294 100644 --- a/src/test/ui/object-safety/object-safety-sized-2.stderr +++ b/src/test/ui/object-safety/object-safety-sized-2.stderr @@ -1,8 +1,8 @@ error[E0038]: the trait `Bar` cannot be made into an object --> $DIR/object-safety-sized-2.rs:10:1 | -LL | fn make_bar(t: &T) -> &Bar { - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Bar` cannot be made into an object +LL | fn make_bar(t: &T) -> &dyn Bar { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Bar` cannot be made into an object | = note: the trait cannot require that `Self : Sized` diff --git a/src/test/ui/object-safety/object-safety-sized.rs b/src/test/ui/object-safety/object-safety-sized.rs index 77dc7390aff01..1312bb34717ee 100644 --- a/src/test/ui/object-safety/object-safety-sized.rs +++ b/src/test/ui/object-safety/object-safety-sized.rs @@ -5,7 +5,7 @@ trait Bar : Sized { fn bar(&self, t: T); } -fn make_bar(t: &T) -> &Bar { +fn make_bar(t: &T) -> &dyn Bar { //~^ ERROR E0038 t } diff --git a/src/test/ui/object-safety/object-safety-sized.stderr b/src/test/ui/object-safety/object-safety-sized.stderr index ba98e2f1ef655..98bc73e38d4cc 100644 --- a/src/test/ui/object-safety/object-safety-sized.stderr +++ b/src/test/ui/object-safety/object-safety-sized.stderr @@ -1,8 +1,8 @@ error[E0038]: the trait `Bar` cannot be made into an object --> $DIR/object-safety-sized.rs:8:1 | -LL | fn make_bar(t: &T) -> &Bar { - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Bar` cannot be made into an object +LL | fn make_bar(t: &T) -> &dyn Bar { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Bar` cannot be made into an object | = note: the trait cannot require that `Self : Sized` diff --git a/src/test/ui/object-safety/object-safety-supertrait-mentions-Self.rs b/src/test/ui/object-safety/object-safety-supertrait-mentions-Self.rs index 9d0da4e327c7c..2445b33c81447 100644 --- a/src/test/ui/object-safety/object-safety-supertrait-mentions-Self.rs +++ b/src/test/ui/object-safety/object-safety-supertrait-mentions-Self.rs @@ -8,11 +8,11 @@ trait Bar { trait Baz : Bar { } -fn make_bar>(t: &T) -> &Bar { +fn make_bar>(t: &T) -> &dyn Bar { t } -fn make_baz(t: &T) -> &Baz { +fn make_baz(t: &T) -> &dyn Baz { //~^ ERROR E0038 t } diff --git a/src/test/ui/object-safety/object-safety-supertrait-mentions-Self.stderr b/src/test/ui/object-safety/object-safety-supertrait-mentions-Self.stderr index 5db34a23fff64..8ae89832703d1 100644 --- a/src/test/ui/object-safety/object-safety-supertrait-mentions-Self.stderr +++ b/src/test/ui/object-safety/object-safety-supertrait-mentions-Self.stderr @@ -1,8 +1,8 @@ error[E0038]: the trait `Baz` cannot be made into an object --> $DIR/object-safety-supertrait-mentions-Self.rs:15:31 | -LL | fn make_baz(t: &T) -> &Baz { - | ^^^ the trait `Baz` cannot be made into an object +LL | fn make_baz(t: &T) -> &dyn Baz { + | ^^^^^^^ the trait `Baz` cannot be made into an object | = note: the trait cannot use `Self` as a type parameter in the supertraits or where-clauses diff --git a/src/test/ui/parser/bounds-obj-parens.rs b/src/test/ui/parser/bounds-obj-parens.rs index cc86879bf461a..1e0f9e40cdca6 100644 --- a/src/test/ui/parser/bounds-obj-parens.rs +++ b/src/test/ui/parser/bounds-obj-parens.rs @@ -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() {} diff --git a/src/test/ui/parser/trailing-plus-in-bounds.rs b/src/test/ui/parser/trailing-plus-in-bounds.rs index 153f942b978a8..89a2953ad0fd4 100644 --- a/src/test/ui/parser/trailing-plus-in-bounds.rs +++ b/src/test/ui/parser/trailing-plus-in-bounds.rs @@ -2,6 +2,7 @@ // compile-flags: -Z continue-parse-after-error #![feature(box_syntax)] +#![allow(bare_trait_objects)] use std::fmt::Debug; diff --git a/src/test/ui/parser/trait-object-bad-parens.rs b/src/test/ui/parser/trait-object-bad-parens.rs index 0f1f49a521bd6..e81b019b6468f 100644 --- a/src/test/ui/parser/trait-object-bad-parens.rs +++ b/src/test/ui/parser/trait-object-bad-parens.rs @@ -1,6 +1,7 @@ // compile-flags: -Z continue-parse-after-error #![feature(optin_builtin_traits)] +#![allow(bare_trait_objects)] auto trait Auto {} diff --git a/src/test/ui/parser/trait-object-bad-parens.stderr b/src/test/ui/parser/trait-object-bad-parens.stderr index 74e484eebee1f..a36727ffeaf10 100644 --- a/src/test/ui/parser/trait-object-bad-parens.stderr +++ b/src/test/ui/parser/trait-object-bad-parens.stderr @@ -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 diff --git a/src/test/ui/parser/trait-object-lifetime-parens.rs b/src/test/ui/parser/trait-object-lifetime-parens.rs index 43f6497f7e71c..d5598afd6f4fd 100644 --- a/src/test/ui/parser/trait-object-lifetime-parens.rs +++ b/src/test/ui/parser/trait-object-lifetime-parens.rs @@ -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 diff --git a/src/test/ui/parser/trait-object-lifetime-parens.stderr b/src/test/ui/parser/trait-object-lifetime-parens.stderr index a31b7aea8fee6..55f14c978760f 100644 --- a/src/test/ui/parser/trait-object-lifetime-parens.stderr +++ b/src/test/ui/parser/trait-object-lifetime-parens.stderr @@ -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; | ^^^^ 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>; | - ^^ diff --git a/src/test/ui/parser/trait-object-polytrait-priority.rs b/src/test/ui/parser/trait-object-polytrait-priority.rs index 40d2ad52c3574..63425f3e20186 100644 --- a/src/test/ui/parser/trait-object-polytrait-priority.rs +++ b/src/test/ui/parser/trait-object-polytrait-priority.rs @@ -1,3 +1,5 @@ +#![allow(bare_trait_objects)] + trait Trait<'a> {} fn main() { diff --git a/src/test/ui/parser/trait-object-polytrait-priority.stderr b/src/test/ui/parser/trait-object-polytrait-priority.stderr index 5e2a35ea60cb0..a6add6079cece 100644 --- a/src/test/ui/parser/trait-object-polytrait-priority.stderr +++ b/src/test/ui/parser/trait-object-polytrait-priority.stderr @@ -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)` diff --git a/src/test/ui/parser/trait-object-trait-parens.rs b/src/test/ui/parser/trait-object-trait-parens.rs index 9ac10cd13279b..a113de14b6fbc 100644 --- a/src/test/ui/parser/trait-object-trait-parens.rs +++ b/src/test/ui/parser/trait-object-trait-parens.rs @@ -5,8 +5,11 @@ fn f 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 } diff --git a/src/test/ui/parser/trait-object-trait-parens.stderr b/src/test/ui/parser/trait-object-trait-parens.stderr index 36494b765394c..e3fb8a0113a66 100644 --- a/src/test/ui/parser/trait-object-trait-parens.stderr +++ b/src/test/ui/parser/trait-object-trait-parens.stderr @@ -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 diff --git a/src/test/ui/privacy/private-in-public-non-principal-2.rs b/src/test/ui/privacy/private-in-public-non-principal-2.rs index 02fd92aa7a4ef..8a59073fa6c7e 100644 --- a/src/test/ui/privacy/private-in-public-non-principal-2.rs +++ b/src/test/ui/privacy/private-in-public-non-principal-2.rs @@ -4,7 +4,7 @@ mod m { pub trait PubPrincipal {} auto trait PrivNonPrincipal {} - pub fn leak_dyn_nonprincipal() -> Box { loop {} } + pub fn leak_dyn_nonprincipal() -> Box { loop {} } } fn main() { diff --git a/src/test/ui/privacy/private-in-public-non-principal.rs b/src/test/ui/privacy/private-in-public-non-principal.rs index 5de5a685208cd..5d89d8105b119 100644 --- a/src/test/ui/privacy/private-in-public-non-principal.rs +++ b/src/test/ui/privacy/private-in-public-non-principal.rs @@ -3,7 +3,7 @@ pub trait PubPrincipal {} auto trait PrivNonPrincipal {} -pub fn leak_dyn_nonprincipal() -> Box { loop {} } +pub fn leak_dyn_nonprincipal() -> Box { loop {} } //~^ WARN private trait `PrivNonPrincipal` in public interface //~| WARN this was previously accepted diff --git a/src/test/ui/privacy/private-in-public-non-principal.stderr b/src/test/ui/privacy/private-in-public-non-principal.stderr index 729b94ed8926a..578f4380b4225 100644 --- a/src/test/ui/privacy/private-in-public-non-principal.stderr +++ b/src/test/ui/privacy/private-in-public-non-principal.stderr @@ -1,8 +1,8 @@ warning: private trait `PrivNonPrincipal` in public interface (error E0445) --> $DIR/private-in-public-non-principal.rs:6:1 | -LL | pub fn leak_dyn_nonprincipal() -> Box { loop {} } - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | pub fn leak_dyn_nonprincipal() -> Box { loop {} } + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: #[warn(private_in_public)] on by default = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! diff --git a/src/test/ui/privacy/private-inferred-type.rs b/src/test/ui/privacy/private-inferred-type.rs index d9bb421b53f8c..dab440b2d9910 100644 --- a/src/test/ui/privacy/private-inferred-type.rs +++ b/src/test/ui/privacy/private-inferred-type.rs @@ -65,9 +65,9 @@ mod m { pub fn leak_anon2() -> impl TraitWithTyParam { 0 } pub fn leak_anon3() -> impl TraitWithAssocTy { 0 } - pub fn leak_dyn1() -> Box { Box::new(0) } - pub fn leak_dyn2() -> Box> { Box::new(0) } - pub fn leak_dyn3() -> Box> { Box::new(0) } + pub fn leak_dyn1() -> Box { Box::new(0) } + pub fn leak_dyn2() -> Box> { Box::new(0) } + pub fn leak_dyn3() -> Box> { Box::new(0) } } mod adjust { diff --git a/src/test/ui/regions/region-borrow-params-issue-29793-small.rs b/src/test/ui/regions/region-borrow-params-issue-29793-small.rs index a1ccf66767104..5f1c2ed08f6b7 100644 --- a/src/test/ui/regions/region-borrow-params-issue-29793-small.rs +++ b/src/test/ui/regions/region-borrow-params-issue-29793-small.rs @@ -51,7 +51,7 @@ fn ok_borrow_of_fn_params(a: usize, b:usize) { // TOP-LEVEL FN'S fn escaping_borrow_of_fn_params_1() { - fn g<'a>(x: usize, y:usize) -> Box usize + 'a> { + fn g<'a>(x: usize, y:usize) -> Box usize + 'a> { let f = |t: bool| if t { x } else { y }; // (separate errors for `x` vs `y`) //~^ ERROR E0373 //~| ERROR E0373 @@ -62,7 +62,7 @@ fn escaping_borrow_of_fn_params_1() { } fn escaping_borrow_of_fn_params_2() { - fn g<'a>(x: usize, y:usize) -> Box usize + 'a> { + fn g<'a>(x: usize, y:usize) -> Box usize + 'a> { let f = |t: bool| if t { x } else { y }; // (separate errors for `x` vs `y`) //~^ ERROR E0373 //~| ERROR E0373 @@ -73,7 +73,7 @@ fn escaping_borrow_of_fn_params_2() { } fn move_of_fn_params() { - fn g<'a>(x: usize, y:usize) -> Box usize + 'a> { + fn g<'a>(x: usize, y:usize) -> Box usize + 'a> { let f = move |t: bool| if t { x } else { y }; return Box::new(f); }; @@ -86,7 +86,7 @@ fn move_of_fn_params() { fn escaping_borrow_of_method_params_1() { struct S; impl S { - fn g<'a>(&self, x: usize, y:usize) -> Box usize + 'a> { + fn g<'a>(&self, x: usize, y:usize) -> Box usize + 'a> { let f = |t: bool| if t { x } else { y }; // (separate errors for `x` vs `y`) //~^ ERROR E0373 //~| ERROR E0373 @@ -100,7 +100,7 @@ fn escaping_borrow_of_method_params_1() { fn escaping_borrow_of_method_params_2() { struct S; impl S { - fn g<'a>(&self, x: usize, y:usize) -> Box usize + 'a> { + fn g<'a>(&self, x: usize, y:usize) -> Box usize + 'a> { let f = |t: bool| if t { x } else { y }; // (separate errors for `x` vs `y`) //~^ ERROR E0373 //~| ERROR E0373 @@ -113,7 +113,7 @@ fn escaping_borrow_of_method_params_2() { fn move_of_method_params() { struct S; impl S { - fn g<'a>(&self, x: usize, y:usize) -> Box usize + 'a> { + fn g<'a>(&self, x: usize, y:usize) -> Box usize + 'a> { let f = move |t: bool| if t { x } else { y }; return Box::new(f); } @@ -125,10 +125,10 @@ fn move_of_method_params() { // TRAIT IMPL METHODS fn escaping_borrow_of_trait_impl_params_1() { - trait T { fn g<'a>(&self, x: usize, y:usize) -> Box usize + 'a>; } + trait T { fn g<'a>(&self, x: usize, y:usize) -> Box usize + 'a>; } struct S; impl T for S { - fn g<'a>(&self, x: usize, y:usize) -> Box usize + 'a> { + fn g<'a>(&self, x: usize, y:usize) -> Box usize + 'a> { let f = |t: bool| if t { x } else { y }; // (separate errors for `x` vs `y`) //~^ ERROR E0373 //~| ERROR E0373 @@ -140,10 +140,10 @@ fn escaping_borrow_of_trait_impl_params_1() { } fn escaping_borrow_of_trait_impl_params_2() { - trait T { fn g<'a>(&self, x: usize, y:usize) -> Box usize + 'a>; } + trait T { fn g<'a>(&self, x: usize, y:usize) -> Box usize + 'a>; } struct S; impl T for S { - fn g<'a>(&self, x: usize, y:usize) -> Box usize + 'a> { + fn g<'a>(&self, x: usize, y:usize) -> Box usize + 'a> { let f = |t: bool| if t { x } else { y }; // (separate errors for `x` vs `y`) //~^ ERROR E0373 //~| ERROR E0373 @@ -154,10 +154,10 @@ fn escaping_borrow_of_trait_impl_params_2() { } fn move_of_trait_impl_params() { - trait T { fn g<'a>(&self, x: usize, y:usize) -> Box usize + 'a>; } + trait T { fn g<'a>(&self, x: usize, y:usize) -> Box usize + 'a>; } struct S; impl T for S { - fn g<'a>(&self, x: usize, y:usize) -> Box usize + 'a> { + fn g<'a>(&self, x: usize, y:usize) -> Box usize + 'a> { let f = move |t: bool| if t { x } else { y }; return Box::new(f); } @@ -171,7 +171,7 @@ fn move_of_trait_impl_params() { fn escaping_borrow_of_trait_default_params_1() { struct S; trait T { - fn g<'a>(&self, x: usize, y:usize) -> Box usize + 'a> { + fn g<'a>(&self, x: usize, y:usize) -> Box usize + 'a> { let f = |t: bool| if t { x } else { y }; // (separate errors for `x` vs `y`) //~^ ERROR E0373 //~| ERROR E0373 @@ -185,7 +185,7 @@ fn escaping_borrow_of_trait_default_params_1() { fn escaping_borrow_of_trait_default_params_2() { struct S; trait T { - fn g<'a>(&self, x: usize, y:usize) -> Box usize + 'a> { + fn g<'a>(&self, x: usize, y:usize) -> Box usize + 'a> { let f = |t: bool| if t { x } else { y }; // (separate errors for `x` vs `y`) //~^ ERROR E0373 //~| ERROR E0373 @@ -199,7 +199,7 @@ fn escaping_borrow_of_trait_default_params_2() { fn move_of_trait_default_params() { struct S; trait T { - fn g<'a>(&self, x: usize, y:usize) -> Box usize + 'a> { + fn g<'a>(&self, x: usize, y:usize) -> Box usize + 'a> { let f = move |t: bool| if t { x } else { y }; return Box::new(f); } diff --git a/src/test/ui/regions/region-bounds-on-objects-and-type-parameters.rs b/src/test/ui/regions/region-bounds-on-objects-and-type-parameters.rs index 3a211b0463605..40d2b740b4303 100644 --- a/src/test/ui/regions/region-bounds-on-objects-and-type-parameters.rs +++ b/src/test/ui/regions/region-bounds-on-objects-and-type-parameters.rs @@ -10,15 +10,15 @@ trait SomeTrait { } struct Foo<'a,'b,'c> { //~ ERROR parameter `'c` is never used // All of these are ok, because we can derive exactly one bound: - a: Box, - b: Box>, - c: Box>, - d: Box, - e: Box+Send>, // we can derive two bounds, but one is 'static, so ok - f: Box, // OK, defaults to 'static due to RFC 599. - g: Box, + a: Box, + b: Box>, + c: Box>, + d: Box, + e: Box+Send>, // we can derive two bounds, but one is 'static, so ok + f: Box, // OK, defaults to 'static due to RFC 599. + g: Box, - z: Box+'b+'c>, + z: Box+'b+'c>, //~^ ERROR only a single explicit lifetime bound is permitted //~| ERROR lifetime bound not satisfied } diff --git a/src/test/ui/regions/region-bounds-on-objects-and-type-parameters.stderr b/src/test/ui/regions/region-bounds-on-objects-and-type-parameters.stderr index 8bcb2da457792..003dd0699d381 100644 --- a/src/test/ui/regions/region-bounds-on-objects-and-type-parameters.stderr +++ b/src/test/ui/regions/region-bounds-on-objects-and-type-parameters.stderr @@ -1,14 +1,14 @@ error[E0226]: only a single explicit lifetime bound is permitted - --> $DIR/region-bounds-on-objects-and-type-parameters.rs:21:22 + --> $DIR/region-bounds-on-objects-and-type-parameters.rs:21:26 | -LL | z: Box+'b+'c>, - | ^^ +LL | z: Box+'b+'c>, + | ^^ error[E0478]: lifetime bound not satisfied --> $DIR/region-bounds-on-objects-and-type-parameters.rs:21:5 | -LL | z: Box+'b+'c>, - | ^^^^^^^^^^^^^^^^^^^^ +LL | z: Box+'b+'c>, + | ^^^^^^^^^^^^^^^^^^^^^^^^ | note: lifetime parameter instantiated with the lifetime 'b as defined on the struct at 11:15 --> $DIR/region-bounds-on-objects-and-type-parameters.rs:11:15 diff --git a/src/test/ui/regions/region-object-lifetime-2.nll.stderr b/src/test/ui/regions/region-object-lifetime-2.nll.stderr index 56e8c40c99f71..60084773466a6 100644 --- a/src/test/ui/regions/region-object-lifetime-2.nll.stderr +++ b/src/test/ui/regions/region-object-lifetime-2.nll.stderr @@ -1,7 +1,7 @@ error: lifetime may not live long enough --> $DIR/region-object-lifetime-2.rs:10:5 | -LL | fn borrowed_receiver_different_lifetimes<'a,'b>(x: &'a Foo) -> &'b () { +LL | fn borrowed_receiver_different_lifetimes<'a,'b>(x: &'a dyn Foo) -> &'b () { | -- -- lifetime `'b` defined here | | | lifetime `'a` defined here diff --git a/src/test/ui/regions/region-object-lifetime-2.rs b/src/test/ui/regions/region-object-lifetime-2.rs index 92c85020e9a85..4279848789338 100644 --- a/src/test/ui/regions/region-object-lifetime-2.rs +++ b/src/test/ui/regions/region-object-lifetime-2.rs @@ -6,7 +6,7 @@ trait Foo { } // Borrowed receiver but two distinct lifetimes, we get an error. -fn borrowed_receiver_different_lifetimes<'a,'b>(x: &'a Foo) -> &'b () { +fn borrowed_receiver_different_lifetimes<'a,'b>(x: &'a dyn Foo) -> &'b () { x.borrowed() //~ ERROR cannot infer } diff --git a/src/test/ui/regions/region-object-lifetime-2.stderr b/src/test/ui/regions/region-object-lifetime-2.stderr index d3552ab0c4b23..0c5e22ebae283 100644 --- a/src/test/ui/regions/region-object-lifetime-2.stderr +++ b/src/test/ui/regions/region-object-lifetime-2.stderr @@ -7,7 +7,7 @@ LL | x.borrowed() note: first, the lifetime cannot outlive the lifetime 'a as defined on the function body at 9:42... --> $DIR/region-object-lifetime-2.rs:9:42 | -LL | fn borrowed_receiver_different_lifetimes<'a,'b>(x: &'a Foo) -> &'b () { +LL | fn borrowed_receiver_different_lifetimes<'a,'b>(x: &'a dyn Foo) -> &'b () { | ^^ note: ...so that reference does not outlive borrowed content --> $DIR/region-object-lifetime-2.rs:10:5 @@ -17,7 +17,7 @@ LL | x.borrowed() note: but, the lifetime must be valid for the lifetime 'b as defined on the function body at 9:45... --> $DIR/region-object-lifetime-2.rs:9:45 | -LL | fn borrowed_receiver_different_lifetimes<'a,'b>(x: &'a Foo) -> &'b () { +LL | fn borrowed_receiver_different_lifetimes<'a,'b>(x: &'a dyn Foo) -> &'b () { | ^^ note: ...so that reference does not outlive borrowed content --> $DIR/region-object-lifetime-2.rs:10:5 diff --git a/src/test/ui/regions/region-object-lifetime-4.nll.stderr b/src/test/ui/regions/region-object-lifetime-4.nll.stderr index aa91c371f41b9..75b049dae21f8 100644 --- a/src/test/ui/regions/region-object-lifetime-4.nll.stderr +++ b/src/test/ui/regions/region-object-lifetime-4.nll.stderr @@ -1,7 +1,7 @@ error: lifetime may not live long enough --> $DIR/region-object-lifetime-4.rs:12:5 | -LL | fn borrowed_receiver_related_lifetimes2<'a,'b>(x: &'a (Foo+'b)) -> &'b () { +LL | fn borrowed_receiver_related_lifetimes2<'a,'b>(x: &'a (dyn Foo + 'b)) -> &'b () { | -- -- lifetime `'b` defined here | | | lifetime `'a` defined here diff --git a/src/test/ui/regions/region-object-lifetime-4.rs b/src/test/ui/regions/region-object-lifetime-4.rs index d2ab617ebb764..4fe12b2acfc69 100644 --- a/src/test/ui/regions/region-object-lifetime-4.rs +++ b/src/test/ui/regions/region-object-lifetime-4.rs @@ -8,7 +8,7 @@ trait Foo { // Here we have two distinct lifetimes, but we try to return a pointer // with the longer lifetime when (from the signature) we only know // that it lives as long as the shorter lifetime. Therefore, error. -fn borrowed_receiver_related_lifetimes2<'a,'b>(x: &'a (Foo+'b)) -> &'b () { +fn borrowed_receiver_related_lifetimes2<'a,'b>(x: &'a (dyn Foo + 'b)) -> &'b () { x.borrowed() //~ ERROR cannot infer } diff --git a/src/test/ui/regions/region-object-lifetime-4.stderr b/src/test/ui/regions/region-object-lifetime-4.stderr index 75b26ffc6d576..e737d27d5606f 100644 --- a/src/test/ui/regions/region-object-lifetime-4.stderr +++ b/src/test/ui/regions/region-object-lifetime-4.stderr @@ -7,7 +7,7 @@ LL | x.borrowed() note: first, the lifetime cannot outlive the lifetime 'a as defined on the function body at 11:41... --> $DIR/region-object-lifetime-4.rs:11:41 | -LL | fn borrowed_receiver_related_lifetimes2<'a,'b>(x: &'a (Foo+'b)) -> &'b () { +LL | fn borrowed_receiver_related_lifetimes2<'a,'b>(x: &'a (dyn Foo + 'b)) -> &'b () { | ^^ note: ...so that reference does not outlive borrowed content --> $DIR/region-object-lifetime-4.rs:12:5 @@ -17,7 +17,7 @@ LL | x.borrowed() note: but, the lifetime must be valid for the lifetime 'b as defined on the function body at 11:44... --> $DIR/region-object-lifetime-4.rs:11:44 | -LL | fn borrowed_receiver_related_lifetimes2<'a,'b>(x: &'a (Foo+'b)) -> &'b () { +LL | fn borrowed_receiver_related_lifetimes2<'a,'b>(x: &'a (dyn Foo + 'b)) -> &'b () { | ^^ note: ...so that reference does not outlive borrowed content --> $DIR/region-object-lifetime-4.rs:12:5 diff --git a/src/test/ui/regions/region-object-lifetime-5.rs b/src/test/ui/regions/region-object-lifetime-5.rs index bd68aebbeeb09..307bbcbd58d7a 100644 --- a/src/test/ui/regions/region-object-lifetime-5.rs +++ b/src/test/ui/regions/region-object-lifetime-5.rs @@ -7,7 +7,7 @@ trait Foo { // Here, the object is bounded by an anonymous lifetime and returned // as `&'static`, so you get an error. -fn owned_receiver(x: Box) -> &'static () { +fn owned_receiver(x: Box) -> &'static () { x.borrowed() //~ ERROR cannot return value referencing local data `*x` } diff --git a/src/test/ui/regions/region-object-lifetime-in-coercion.nll.stderr b/src/test/ui/regions/region-object-lifetime-in-coercion.nll.stderr index a54f8f5faab54..43acbfd412d91 100644 --- a/src/test/ui/regions/region-object-lifetime-in-coercion.nll.stderr +++ b/src/test/ui/regions/region-object-lifetime-in-coercion.nll.stderr @@ -1,15 +1,15 @@ error[E0621]: explicit lifetime required in the type of `v` --> $DIR/region-object-lifetime-in-coercion.rs:8:12 | -LL | fn a(v: &[u8]) -> Box { +LL | fn a(v: &[u8]) -> Box { | ----- help: add explicit lifetime `'static` to the type of `v`: `&'static [u8]` -LL | let x: Box = Box::new(v); - | ^^^^^^^^^^^^^^^^^^ lifetime `'static` required +LL | let x: Box = Box::new(v); + | ^^^^^^^^^^^^^^^^^^^^^^ lifetime `'static` required error[E0621]: explicit lifetime required in the type of `v` --> $DIR/region-object-lifetime-in-coercion.rs:14:5 | -LL | fn b(v: &[u8]) -> Box { +LL | fn b(v: &[u8]) -> Box { | ----- help: add explicit lifetime `'static` to the type of `v`: `&'static [u8]` LL | Box::new(v) | ^^^^^^^^^^^ lifetime `'static` required @@ -17,7 +17,7 @@ LL | Box::new(v) error[E0621]: explicit lifetime required in the type of `v` --> $DIR/region-object-lifetime-in-coercion.rs:21:5 | -LL | fn c(v: &[u8]) -> Box { +LL | fn c(v: &[u8]) -> Box { | ----- help: add explicit lifetime `'static` to the type of `v`: `&'static [u8]` ... LL | Box::new(v) @@ -26,7 +26,7 @@ LL | Box::new(v) error: lifetime may not live long enough --> $DIR/region-object-lifetime-in-coercion.rs:26:5 | -LL | fn d<'a,'b>(v: &'a [u8]) -> Box { +LL | fn d<'a,'b>(v: &'a [u8]) -> Box { | -- -- lifetime `'b` defined here | | | lifetime `'a` defined here diff --git a/src/test/ui/regions/region-object-lifetime-in-coercion.rs b/src/test/ui/regions/region-object-lifetime-in-coercion.rs index dfba04b0d25fc..2dc67599913a6 100644 --- a/src/test/ui/regions/region-object-lifetime-in-coercion.rs +++ b/src/test/ui/regions/region-object-lifetime-in-coercion.rs @@ -4,30 +4,30 @@ trait Foo {} impl<'a> Foo for &'a [u8] {} -fn a(v: &[u8]) -> Box { - let x: Box = Box::new(v); +fn a(v: &[u8]) -> Box { + let x: Box = Box::new(v); //~^ ERROR explicit lifetime required in the type of `v` [E0621] x } -fn b(v: &[u8]) -> Box { +fn b(v: &[u8]) -> Box { Box::new(v) //~^ ERROR explicit lifetime required in the type of `v` [E0621] } -fn c(v: &[u8]) -> Box { +fn c(v: &[u8]) -> Box { // same as previous case due to RFC 599 Box::new(v) //~^ ERROR explicit lifetime required in the type of `v` [E0621] } -fn d<'a,'b>(v: &'a [u8]) -> Box { +fn d<'a,'b>(v: &'a [u8]) -> Box { Box::new(v) //~^ ERROR cannot infer an appropriate lifetime due to conflicting } -fn e<'a:'b,'b>(v: &'a [u8]) -> Box { +fn e<'a:'b,'b>(v: &'a [u8]) -> Box { Box::new(v) // OK, thanks to 'a:'b } diff --git a/src/test/ui/regions/region-object-lifetime-in-coercion.stderr b/src/test/ui/regions/region-object-lifetime-in-coercion.stderr index c94a25ce60478..8209fa1840d05 100644 --- a/src/test/ui/regions/region-object-lifetime-in-coercion.stderr +++ b/src/test/ui/regions/region-object-lifetime-in-coercion.stderr @@ -1,15 +1,15 @@ error[E0621]: explicit lifetime required in the type of `v` - --> $DIR/region-object-lifetime-in-coercion.rs:8:33 + --> $DIR/region-object-lifetime-in-coercion.rs:8:37 | -LL | fn a(v: &[u8]) -> Box { +LL | fn a(v: &[u8]) -> Box { | ----- help: add explicit lifetime `'static` to the type of `v`: `&'static [u8]` -LL | let x: Box = Box::new(v); - | ^^^^^^^^^^^ lifetime `'static` required +LL | let x: Box = Box::new(v); + | ^^^^^^^^^^^ lifetime `'static` required error[E0621]: explicit lifetime required in the type of `v` --> $DIR/region-object-lifetime-in-coercion.rs:14:5 | -LL | fn b(v: &[u8]) -> Box { +LL | fn b(v: &[u8]) -> Box { | ----- help: add explicit lifetime `'static` to the type of `v`: `&'static [u8]` LL | Box::new(v) | ^^^^^^^^^^^ lifetime `'static` required @@ -17,7 +17,7 @@ LL | Box::new(v) error[E0621]: explicit lifetime required in the type of `v` --> $DIR/region-object-lifetime-in-coercion.rs:21:5 | -LL | fn c(v: &[u8]) -> Box { +LL | fn c(v: &[u8]) -> Box { | ----- help: add explicit lifetime `'static` to the type of `v`: `&'static [u8]` ... LL | Box::new(v) @@ -32,7 +32,7 @@ LL | Box::new(v) note: first, the lifetime cannot outlive the lifetime 'a as defined on the function body at 25:6... --> $DIR/region-object-lifetime-in-coercion.rs:25:6 | -LL | fn d<'a,'b>(v: &'a [u8]) -> Box { +LL | fn d<'a,'b>(v: &'a [u8]) -> Box { | ^^ = note: ...so that the expression is assignable: expected &[u8] @@ -40,7 +40,7 @@ LL | fn d<'a,'b>(v: &'a [u8]) -> Box { note: but, the lifetime must be valid for the lifetime 'b as defined on the function body at 25:9... --> $DIR/region-object-lifetime-in-coercion.rs:25:9 | -LL | fn d<'a,'b>(v: &'a [u8]) -> Box { +LL | fn d<'a,'b>(v: &'a [u8]) -> Box { | ^^ = note: ...so that the expression is assignable: expected std::boxed::Box<(dyn Foo + 'b)> diff --git a/src/test/ui/regions/regions-close-associated-type-into-object.rs b/src/test/ui/regions/regions-close-associated-type-into-object.rs index 853d961138718..0cbdc828c507f 100644 --- a/src/test/ui/regions/regions-close-associated-type-into-object.rs +++ b/src/test/ui/regions/regions-close-associated-type-into-object.rs @@ -9,54 +9,54 @@ trait Iter { fn as_item(&self) -> &Self::Item; } -fn bad1(v: T) -> Box +fn bad1(v: T) -> Box { let item = v.into_item(); Box::new(item) //~ ERROR associated type `::Item` may not live long enough } -fn bad2(v: T) -> Box +fn bad2(v: T) -> Box where Box : X { let item: Box<_> = box v.into_item(); Box::new(item) //~ ERROR associated type `::Item` may not live long enough } -fn bad3<'a, T: Iter>(v: T) -> Box +fn bad3<'a, T: Iter>(v: T) -> Box { let item = v.into_item(); Box::new(item) //~ ERROR associated type `::Item` may not live long enough } -fn bad4<'a, T: Iter>(v: T) -> Box +fn bad4<'a, T: Iter>(v: T) -> Box where Box : X { let item: Box<_> = box v.into_item(); Box::new(item) //~ ERROR associated type `::Item` may not live long enough } -fn ok1<'a, T: Iter>(v: T) -> Box +fn ok1<'a, T: Iter>(v: T) -> Box where T::Item : 'a { let item = v.into_item(); Box::new(item) // OK, T::Item : 'a is declared } -fn ok2<'a, T: Iter>(v: &T, w: &'a T::Item) -> Box +fn ok2<'a, T: Iter>(v: &T, w: &'a T::Item) -> Box where T::Item : Clone { let item = Clone::clone(w); Box::new(item) // OK, T::Item : 'a is implied } -fn ok3<'a, T: Iter>(v: &'a T) -> Box +fn ok3<'a, T: Iter>(v: &'a T) -> Box where T::Item : Clone + 'a { let item = Clone::clone(v.as_item()); Box::new(item) // OK, T::Item : 'a was declared } -fn meh1<'a, T: Iter>(v: &'a T) -> Box +fn meh1<'a, T: Iter>(v: &'a T) -> Box where T::Item : Clone { // This case is kind of interesting. It's the same as `ok3` but diff --git a/src/test/ui/regions/regions-close-object-into-object-2.nll.stderr b/src/test/ui/regions/regions-close-object-into-object-2.nll.stderr index 42df9b1c49fba..806a3ca82425b 100644 --- a/src/test/ui/regions/regions-close-object-into-object-2.nll.stderr +++ b/src/test/ui/regions/regions-close-object-into-object-2.nll.stderr @@ -1,16 +1,16 @@ error: lifetime may not live long enough --> $DIR/regions-close-object-into-object-2.rs:10:5 | -LL | fn g<'a, T: 'static>(v: Box+'a>) -> Box { +LL | fn g<'a, T: 'static>(v: Box + 'a>) -> Box { | -- lifetime `'a` defined here -LL | box B(&*v) as Box - | ^^^^^^^^^^^^^^^^^^^^ returning this value requires that `'a` must outlive `'static` +LL | box B(&*v) as Box + | ^^^^^^^^^^^^^^^^^^^^^^^^ returning this value requires that `'a` must outlive `'static` error[E0515]: cannot return value referencing local data `*v` --> $DIR/regions-close-object-into-object-2.rs:10:5 | -LL | box B(&*v) as Box - | ^^^^^^---^^^^^^^^^^^ +LL | box B(&*v) as Box + | ^^^^^^---^^^^^^^^^^^^^^^ | | | | | `*v` is borrowed here | returns a value referencing data owned by the current function diff --git a/src/test/ui/regions/regions-close-object-into-object-2.rs b/src/test/ui/regions/regions-close-object-into-object-2.rs index cebb4ac68cbc6..2364ba2728600 100644 --- a/src/test/ui/regions/regions-close-object-into-object-2.rs +++ b/src/test/ui/regions/regions-close-object-into-object-2.rs @@ -1,13 +1,13 @@ #![feature(box_syntax)] trait A { } -struct B<'a, T:'a>(&'a (A+'a)); +struct B<'a, T:'a>(&'a (dyn A + 'a)); trait X { } impl<'a, T> X for B<'a, T> {} -fn g<'a, T: 'static>(v: Box+'a>) -> Box { - box B(&*v) as Box //~ ERROR cannot infer +fn g<'a, T: 'static>(v: Box + 'a>) -> Box { + box B(&*v) as Box //~ ERROR cannot infer } fn main() { } diff --git a/src/test/ui/regions/regions-close-object-into-object-2.stderr b/src/test/ui/regions/regions-close-object-into-object-2.stderr index b5b03e618e1de..fa203debb3a1b 100644 --- a/src/test/ui/regions/regions-close-object-into-object-2.stderr +++ b/src/test/ui/regions/regions-close-object-into-object-2.stderr @@ -1,18 +1,18 @@ error[E0495]: cannot infer an appropriate lifetime for borrow expression due to conflicting requirements --> $DIR/regions-close-object-into-object-2.rs:10:11 | -LL | box B(&*v) as Box +LL | box B(&*v) as Box | ^^^ | note: first, the lifetime cannot outlive the lifetime 'a as defined on the function body at 9:6... --> $DIR/regions-close-object-into-object-2.rs:9:6 | -LL | fn g<'a, T: 'static>(v: Box+'a>) -> Box { +LL | fn g<'a, T: 'static>(v: Box + 'a>) -> Box { | ^^ note: ...so that the type `(dyn A + 'a)` is not borrowed for too long --> $DIR/regions-close-object-into-object-2.rs:10:11 | -LL | box B(&*v) as Box +LL | box B(&*v) as Box | ^^^ = note: but, the lifetime must be valid for the static lifetime... = note: ...so that the expression is assignable: diff --git a/src/test/ui/regions/regions-close-object-into-object-4.nll.stderr b/src/test/ui/regions/regions-close-object-into-object-4.nll.stderr index 8af94fa7e79b8..1e57023bc2320 100644 --- a/src/test/ui/regions/regions-close-object-into-object-4.nll.stderr +++ b/src/test/ui/regions/regions-close-object-into-object-4.nll.stderr @@ -1,7 +1,7 @@ error[E0310]: the parameter type `U` may not live long enough --> $DIR/regions-close-object-into-object-4.rs:10:5 | -LL | box B(&*v) as Box +LL | box B(&*v) as Box | ^^^^^^^^^^ | = help: consider adding an explicit lifetime bound `U: 'static`... @@ -9,16 +9,16 @@ LL | box B(&*v) as Box error: lifetime may not live long enough --> $DIR/regions-close-object-into-object-4.rs:10:5 | -LL | fn i<'a, T, U>(v: Box+'a>) -> Box { +LL | fn i<'a, T, U>(v: Box+'a>) -> Box { | -- lifetime `'a` defined here -LL | box B(&*v) as Box - | ^^^^^^^^^^^^^^^^^^^^ returning this value requires that `'a` must outlive `'static` +LL | box B(&*v) as Box + | ^^^^^^^^^^^^^^^^^^^^^^^^ returning this value requires that `'a` must outlive `'static` error[E0515]: cannot return value referencing local data `*v` --> $DIR/regions-close-object-into-object-4.rs:10:5 | -LL | box B(&*v) as Box - | ^^^^^^---^^^^^^^^^^^ +LL | box B(&*v) as Box + | ^^^^^^---^^^^^^^^^^^^^^^ | | | | | `*v` is borrowed here | returns a value referencing data owned by the current function @@ -26,7 +26,7 @@ LL | box B(&*v) as Box error[E0310]: the parameter type `U` may not live long enough --> $DIR/regions-close-object-into-object-4.rs:10:9 | -LL | box B(&*v) as Box +LL | box B(&*v) as Box | ^^^^^^ | = help: consider adding an explicit lifetime bound `U: 'static`... diff --git a/src/test/ui/regions/regions-close-object-into-object-4.rs b/src/test/ui/regions/regions-close-object-into-object-4.rs index 91aab057bb9a2..d531077043686 100644 --- a/src/test/ui/regions/regions-close-object-into-object-4.rs +++ b/src/test/ui/regions/regions-close-object-into-object-4.rs @@ -1,13 +1,13 @@ #![feature(box_syntax)] trait A { } -struct B<'a, T:'a>(&'a (A+'a)); +struct B<'a, T:'a>(&'a (dyn A + 'a)); trait X { } impl<'a, T> X for B<'a, T> {} -fn i<'a, T, U>(v: Box+'a>) -> Box { - box B(&*v) as Box //~ ERROR cannot infer +fn i<'a, T, U>(v: Box+'a>) -> Box { + box B(&*v) as Box //~ ERROR cannot infer } fn main() {} diff --git a/src/test/ui/regions/regions-close-object-into-object-4.stderr b/src/test/ui/regions/regions-close-object-into-object-4.stderr index 20cbcbb841f2b..f5e66f84a9ee7 100644 --- a/src/test/ui/regions/regions-close-object-into-object-4.stderr +++ b/src/test/ui/regions/regions-close-object-into-object-4.stderr @@ -1,18 +1,18 @@ error[E0495]: cannot infer an appropriate lifetime for borrow expression due to conflicting requirements --> $DIR/regions-close-object-into-object-4.rs:10:11 | -LL | box B(&*v) as Box +LL | box B(&*v) as Box | ^^^ | note: first, the lifetime cannot outlive the lifetime 'a as defined on the function body at 9:6... --> $DIR/regions-close-object-into-object-4.rs:9:6 | -LL | fn i<'a, T, U>(v: Box+'a>) -> Box { +LL | fn i<'a, T, U>(v: Box+'a>) -> Box { | ^^ note: ...so that the type `(dyn A + 'a)` is not borrowed for too long --> $DIR/regions-close-object-into-object-4.rs:10:11 | -LL | box B(&*v) as Box +LL | box B(&*v) as Box | ^^^ = note: but, the lifetime must be valid for the static lifetime... = note: ...so that the expression is assignable: diff --git a/src/test/ui/regions/regions-close-over-type-parameter-1.nll.stderr b/src/test/ui/regions/regions-close-over-type-parameter-1.nll.stderr index 30fdb820e3630..7d3d51bdb437e 100644 --- a/src/test/ui/regions/regions-close-over-type-parameter-1.nll.stderr +++ b/src/test/ui/regions/regions-close-over-type-parameter-1.nll.stderr @@ -1,7 +1,7 @@ error[E0310]: the parameter type `A` may not live long enough --> $DIR/regions-close-over-type-parameter-1.rs:10:5 | -LL | box v as Box +LL | box v as Box | ^^^^^ | = help: consider adding an explicit lifetime bound `A: 'static`... @@ -9,7 +9,7 @@ LL | box v as Box error[E0309]: the parameter type `A` may not live long enough --> $DIR/regions-close-over-type-parameter-1.rs:20:5 | -LL | box v as Box +LL | box v as Box | ^^^^^ | = help: consider adding an explicit lifetime bound `A: 'b`... diff --git a/src/test/ui/regions/regions-close-over-type-parameter-1.rs b/src/test/ui/regions/regions-close-over-type-parameter-1.rs index 9aee9663e8f46..6a9aa66a446c3 100644 --- a/src/test/ui/regions/regions-close-over-type-parameter-1.rs +++ b/src/test/ui/regions/regions-close-over-type-parameter-1.rs @@ -6,18 +6,18 @@ trait SomeTrait { fn get(&self) -> isize; } -fn make_object1(v: A) -> Box { - box v as Box +fn make_object1(v: A) -> Box { + box v as Box //~^ ERROR the parameter type `A` may not live long enough //~| ERROR the parameter type `A` may not live long enough } -fn make_object2<'a,A:SomeTrait+'a>(v: A) -> Box { - box v as Box +fn make_object2<'a,A:SomeTrait+'a>(v: A) -> Box { + box v as Box } -fn make_object3<'a,'b,A:SomeTrait+'a>(v: A) -> Box { - box v as Box +fn make_object3<'a,'b,A:SomeTrait+'a>(v: A) -> Box { + box v as Box //~^ ERROR the parameter type `A` may not live long enough //~| ERROR the parameter type `A` may not live long enough } diff --git a/src/test/ui/regions/regions-close-over-type-parameter-1.stderr b/src/test/ui/regions/regions-close-over-type-parameter-1.stderr index 615c55d9da346..81534b7b770d0 100644 --- a/src/test/ui/regions/regions-close-over-type-parameter-1.stderr +++ b/src/test/ui/regions/regions-close-over-type-parameter-1.stderr @@ -1,58 +1,58 @@ error[E0310]: the parameter type `A` may not live long enough --> $DIR/regions-close-over-type-parameter-1.rs:10:5 | -LL | fn make_object1(v: A) -> Box { +LL | fn make_object1(v: A) -> Box { | -- help: consider adding an explicit lifetime bound `A: 'static`... -LL | box v as Box +LL | box v as Box | ^^^^^ | note: ...so that the type `A` will meet its required lifetime bounds --> $DIR/regions-close-over-type-parameter-1.rs:10:5 | -LL | box v as Box +LL | box v as Box | ^^^^^ error[E0310]: the parameter type `A` may not live long enough --> $DIR/regions-close-over-type-parameter-1.rs:10:5 | -LL | fn make_object1(v: A) -> Box { +LL | fn make_object1(v: A) -> Box { | -- help: consider adding an explicit lifetime bound `A: 'static`... -LL | box v as Box - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | box v as Box + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | note: ...so that it can be closed over into an object --> $DIR/regions-close-over-type-parameter-1.rs:10:5 | -LL | box v as Box - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | box v as Box + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0309]: the parameter type `A` may not live long enough --> $DIR/regions-close-over-type-parameter-1.rs:20:5 | -LL | fn make_object3<'a,'b,A:SomeTrait+'a>(v: A) -> Box { +LL | fn make_object3<'a,'b,A:SomeTrait+'a>(v: A) -> Box { | -- help: consider adding an explicit lifetime bound `A: 'b`... -LL | box v as Box +LL | box v as Box | ^^^^^ | note: ...so that the type `A` will meet its required lifetime bounds --> $DIR/regions-close-over-type-parameter-1.rs:20:5 | -LL | box v as Box +LL | box v as Box | ^^^^^ error[E0309]: the parameter type `A` may not live long enough --> $DIR/regions-close-over-type-parameter-1.rs:20:5 | -LL | fn make_object3<'a,'b,A:SomeTrait+'a>(v: A) -> Box { +LL | fn make_object3<'a,'b,A:SomeTrait+'a>(v: A) -> Box { | -- help: consider adding an explicit lifetime bound `A: 'b`... -LL | box v as Box - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | box v as Box + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | note: ...so that it can be closed over into an object --> $DIR/regions-close-over-type-parameter-1.rs:20:5 | -LL | box v as Box - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | box v as Box + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: aborting due to 4 previous errors diff --git a/src/test/ui/regions/regions-close-over-type-parameter-multiple.nll.stderr b/src/test/ui/regions/regions-close-over-type-parameter-multiple.nll.stderr index 001ed7fe4c53a..88d6abd1428aa 100644 --- a/src/test/ui/regions/regions-close-over-type-parameter-multiple.nll.stderr +++ b/src/test/ui/regions/regions-close-over-type-parameter-multiple.nll.stderr @@ -1,13 +1,13 @@ error: lifetime may not live long enough --> $DIR/regions-close-over-type-parameter-multiple.rs:20:5 | -LL | fn make_object_bad<'a,'b,'c,A:SomeTrait+'a+'b>(v: A) -> Box { +LL | fn make_object_bad<'a,'b,'c,A:SomeTrait+'a+'b>(v: A) -> Box { | -- -- lifetime `'c` defined here | | | lifetime `'a` defined here LL | // A outlives 'a AND 'b...but not 'c. -LL | box v as Box - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ returning this value requires that `'a` must outlive `'c` +LL | box v as Box + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ returning this value requires that `'a` must outlive `'c` error: aborting due to previous error diff --git a/src/test/ui/regions/regions-close-over-type-parameter-multiple.rs b/src/test/ui/regions/regions-close-over-type-parameter-multiple.rs index defbc5d9f2395..26643e08985be 100644 --- a/src/test/ui/regions/regions-close-over-type-parameter-multiple.rs +++ b/src/test/ui/regions/regions-close-over-type-parameter-multiple.rs @@ -5,19 +5,19 @@ trait SomeTrait { fn get(&self) -> isize; } -fn make_object_good1<'a,'b,A:SomeTrait+'a+'b>(v: A) -> Box { +fn make_object_good1<'a,'b,A:SomeTrait+'a+'b>(v: A) -> Box { // A outlives 'a AND 'b... - box v as Box // ...hence this type is safe. + box v as Box // ...hence this type is safe. } -fn make_object_good2<'a,'b,A:SomeTrait+'a+'b>(v: A) -> Box { +fn make_object_good2<'a,'b,A:SomeTrait+'a+'b>(v: A) -> Box { // A outlives 'a AND 'b... - box v as Box // ...hence this type is safe. + box v as Box // ...hence this type is safe. } -fn make_object_bad<'a,'b,'c,A:SomeTrait+'a+'b>(v: A) -> Box { +fn make_object_bad<'a,'b,'c,A:SomeTrait+'a+'b>(v: A) -> Box { // A outlives 'a AND 'b...but not 'c. - box v as Box //~ ERROR cannot infer an appropriate lifetime + box v as Box //~ ERROR cannot infer an appropriate lifetime } fn main() { diff --git a/src/test/ui/regions/regions-close-over-type-parameter-multiple.stderr b/src/test/ui/regions/regions-close-over-type-parameter-multiple.stderr index 96e6a329e7d52..8b3dbc8b64902 100644 --- a/src/test/ui/regions/regions-close-over-type-parameter-multiple.stderr +++ b/src/test/ui/regions/regions-close-over-type-parameter-multiple.stderr @@ -1,23 +1,23 @@ error[E0495]: cannot infer an appropriate lifetime due to conflicting requirements --> $DIR/regions-close-over-type-parameter-multiple.rs:20:5 | -LL | box v as Box - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | box v as Box + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | note: first, the lifetime cannot outlive the lifetime 'a as defined on the function body at 18:20... --> $DIR/regions-close-over-type-parameter-multiple.rs:18:20 | -LL | fn make_object_bad<'a,'b,'c,A:SomeTrait+'a+'b>(v: A) -> Box { +LL | fn make_object_bad<'a,'b,'c,A:SomeTrait+'a+'b>(v: A) -> Box { | ^^ note: ...so that the declared lifetime parameter bounds are satisfied --> $DIR/regions-close-over-type-parameter-multiple.rs:20:5 | -LL | box v as Box - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | box v as Box + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ note: but, the lifetime must be valid for the lifetime 'c as defined on the function body at 18:26... --> $DIR/regions-close-over-type-parameter-multiple.rs:18:26 | -LL | fn make_object_bad<'a,'b,'c,A:SomeTrait+'a+'b>(v: A) -> Box { +LL | fn make_object_bad<'a,'b,'c,A:SomeTrait+'a+'b>(v: A) -> Box { | ^^ = note: ...so that the expression is assignable: expected std::boxed::Box<(dyn SomeTrait + 'c)> diff --git a/src/test/ui/regions/regions-close-param-into-object.rs b/src/test/ui/regions/regions-close-param-into-object.rs index 86590748cb2d4..2760e5eed9595 100644 --- a/src/test/ui/regions/regions-close-param-into-object.rs +++ b/src/test/ui/regions/regions-close-param-into-object.rs @@ -1,24 +1,24 @@ trait X { fn foo(&self) {} } -fn p1(v: T) -> Box +fn p1(v: T) -> Box where T : X { Box::new(v) //~ ERROR parameter type `T` may not live long enough } -fn p2(v: Box) -> Box +fn p2(v: Box) -> Box where Box : X { Box::new(v) //~ ERROR parameter type `T` may not live long enough } -fn p3<'a,T>(v: T) -> Box +fn p3<'a,T>(v: T) -> Box where T : X { Box::new(v) //~ ERROR parameter type `T` may not live long enough } -fn p4<'a,T>(v: Box) -> Box +fn p4<'a,T>(v: Box) -> Box where Box : X { Box::new(v) //~ ERROR parameter type `T` may not live long enough diff --git a/src/test/ui/regions/regions-close-param-into-object.stderr b/src/test/ui/regions/regions-close-param-into-object.stderr index ef226073de6d3..7f2c646c12196 100644 --- a/src/test/ui/regions/regions-close-param-into-object.stderr +++ b/src/test/ui/regions/regions-close-param-into-object.stderr @@ -1,7 +1,7 @@ error[E0310]: the parameter type `T` may not live long enough --> $DIR/regions-close-param-into-object.rs:6:5 | -LL | fn p1(v: T) -> Box +LL | fn p1(v: T) -> Box | - help: consider adding an explicit lifetime bound `T: 'static`... ... LL | Box::new(v) @@ -16,7 +16,7 @@ LL | Box::new(v) error[E0310]: the parameter type `T` may not live long enough --> $DIR/regions-close-param-into-object.rs:12:5 | -LL | fn p2(v: Box) -> Box +LL | fn p2(v: Box) -> Box | - help: consider adding an explicit lifetime bound `T: 'static`... ... LL | Box::new(v) @@ -31,7 +31,7 @@ LL | Box::new(v) error[E0309]: the parameter type `T` may not live long enough --> $DIR/regions-close-param-into-object.rs:18:5 | -LL | fn p3<'a,T>(v: T) -> Box +LL | fn p3<'a,T>(v: T) -> Box | - help: consider adding an explicit lifetime bound `T: 'a`... ... LL | Box::new(v) @@ -46,7 +46,7 @@ LL | Box::new(v) error[E0309]: the parameter type `T` may not live long enough --> $DIR/regions-close-param-into-object.rs:24:5 | -LL | fn p4<'a,T>(v: Box) -> Box +LL | fn p4<'a,T>(v: Box) -> Box | - help: consider adding an explicit lifetime bound `T: 'a`... ... LL | Box::new(v) diff --git a/src/test/ui/regions/regions-implied-bounds-projection-gap-hr-1.rs b/src/test/ui/regions/regions-implied-bounds-projection-gap-hr-1.rs index 7e04b6782eba1..a4272802af54d 100644 --- a/src/test/ui/regions/regions-implied-bounds-projection-gap-hr-1.rs +++ b/src/test/ui/regions/regions-implied-bounds-projection-gap-hr-1.rs @@ -18,7 +18,7 @@ trait Trait2<'a, 'b> { // this argument `t` is not automatically considered well-formed, // since for it to be WF, we would need to know that `'y: 'x`, but we // do not infer that. -fn callee<'x, 'y, T>(t: &'x for<'z> Trait1< >::Foo >) +fn callee<'x, 'y, T>(t: &'x dyn for<'z> Trait1< >::Foo >) //~^ ERROR reference has a longer lifetime than the data it references { } diff --git a/src/test/ui/regions/regions-implied-bounds-projection-gap-hr-1.stderr b/src/test/ui/regions/regions-implied-bounds-projection-gap-hr-1.stderr index ca86eb7edae18..b3390bcc4d50b 100644 --- a/src/test/ui/regions/regions-implied-bounds-projection-gap-hr-1.stderr +++ b/src/test/ui/regions/regions-implied-bounds-projection-gap-hr-1.stderr @@ -1,7 +1,7 @@ error[E0491]: in type `&'x (dyn for<'z> Trait1<>::Foo> + 'x)`, reference has a longer lifetime than the data it references --> $DIR/regions-implied-bounds-projection-gap-hr-1.rs:21:1 | -LL | / fn callee<'x, 'y, T>(t: &'x for<'z> Trait1< >::Foo >) +LL | / fn callee<'x, 'y, T>(t: &'x dyn for<'z> Trait1< >::Foo >) LL | | LL | | { LL | | } @@ -10,12 +10,12 @@ LL | | } note: the pointer is valid for the lifetime 'x as defined on the function body at 21:11 --> $DIR/regions-implied-bounds-projection-gap-hr-1.rs:21:11 | -LL | fn callee<'x, 'y, T>(t: &'x for<'z> Trait1< >::Foo >) +LL | fn callee<'x, 'y, T>(t: &'x dyn for<'z> Trait1< >::Foo >) | ^^ note: but the referenced data is only valid for the lifetime 'y as defined on the function body at 21:15 --> $DIR/regions-implied-bounds-projection-gap-hr-1.rs:21:15 | -LL | fn callee<'x, 'y, T>(t: &'x for<'z> Trait1< >::Foo >) +LL | fn callee<'x, 'y, T>(t: &'x dyn for<'z> Trait1< >::Foo >) | ^^ error: aborting due to previous error diff --git a/src/test/ui/regions/regions-infer-at-fn-not-param.rs b/src/test/ui/regions/regions-infer-at-fn-not-param.rs index 0fd734d57b5ce..fb9c5d5c210c9 100644 --- a/src/test/ui/regions/regions-infer-at-fn-not-param.rs +++ b/src/test/ui/regions/regions-infer-at-fn-not-param.rs @@ -1,13 +1,13 @@ struct Parameterized1<'a> { - g: Box + g: Box } struct NotParameterized1 { - g: Box + g: Box } struct NotParameterized2 { - g: Box + g: Box } fn take1<'a>(p: Parameterized1) -> Parameterized1<'a> { p } diff --git a/src/test/ui/regions/regions-infer-invariance-due-to-mutability-3.rs b/src/test/ui/regions/regions-infer-invariance-due-to-mutability-3.rs index 168bf0284a18e..5843598ab48e4 100644 --- a/src/test/ui/regions/regions-infer-invariance-due-to-mutability-3.rs +++ b/src/test/ui/regions/regions-infer-invariance-due-to-mutability-3.rs @@ -1,5 +1,5 @@ struct Invariant<'a> { - f: Box, + f: Box, } fn to_same_lifetime<'r>(b_isize: Invariant<'r>) { diff --git a/src/test/ui/regions/regions-infer-invariance-due-to-mutability-4.rs b/src/test/ui/regions/regions-infer-invariance-due-to-mutability-4.rs index 90c86cebce38f..f0af18cf61804 100644 --- a/src/test/ui/regions/regions-infer-invariance-due-to-mutability-4.rs +++ b/src/test/ui/regions/regions-infer-invariance-due-to-mutability-4.rs @@ -1,5 +1,5 @@ struct Invariant<'a> { - f: Box *mut &'a isize + 'static>, + f: Box *mut &'a isize + 'static>, } fn to_same_lifetime<'r>(b_isize: Invariant<'r>) { diff --git a/src/test/ui/regions/regions-infer-not-param.rs b/src/test/ui/regions/regions-infer-not-param.rs index 214402952a3db..d1744f8a51eee 100644 --- a/src/test/ui/regions/regions-infer-not-param.rs +++ b/src/test/ui/regions/regions-infer-not-param.rs @@ -4,12 +4,12 @@ struct Direct<'a> { struct Indirect1 { // Here the lifetime parameter of direct is bound by the fn() - g: Box + g: Box } struct Indirect2<'a> { // But here it is set to 'a - g: Box) + 'static> + g: Box) + 'static> } fn take_direct<'a,'b>(p: Direct<'a>) -> Direct<'b> { p } //~ ERROR mismatched types diff --git a/src/test/ui/regions/regions-name-undeclared.rs b/src/test/ui/regions/regions-name-undeclared.rs index 230a97a04b625..044c688977262 100644 --- a/src/test/ui/regions/regions-name-undeclared.rs +++ b/src/test/ui/regions/regions-name-undeclared.rs @@ -33,14 +33,14 @@ fn bar<'a>(x: &'a isize) { // &'a CAN be declared on functions and used then: fn g<'a>(a: &'a isize) { } // OK - fn h(a: Box FnOnce(&'a isize)>) { } // OK + fn h(a: Box FnOnce(&'a isize)>) { } // OK } // Test nesting of lifetimes in fn type declarations fn fn_types(a: &'a isize, //~ ERROR undeclared lifetime - b: Box FnOnce(&'a isize, + b: Box FnOnce(&'a isize, &'b isize, //~ ERROR undeclared lifetime - Box FnOnce(&'a isize, + Box FnOnce(&'a isize, &'b isize)>, &'b isize)>, //~ ERROR undeclared lifetime c: &'a isize) //~ ERROR undeclared lifetime diff --git a/src/test/ui/regions/regions-nested-fns.nll.stderr b/src/test/ui/regions/regions-nested-fns.nll.stderr index c11c09b6d0d51..97650636cb67f 100644 --- a/src/test/ui/regions/regions-nested-fns.nll.stderr +++ b/src/test/ui/regions/regions-nested-fns.nll.stderr @@ -4,8 +4,8 @@ error[E0521]: borrowed data escapes outside of closure LL | let mut ay = &y; | ------ `ay` is declared here, outside of the closure body LL | -LL | ignore:: FnMut(&'z isize)>>(Box::new(|z| { - | - `z` is a reference that is only valid in the closure body +LL | ignore:: FnMut(&'z isize)>>(Box::new(|z| { + | - `z` is a reference that is only valid in the closure body ... LL | ay = z; | ^^^^^^ `z` escapes the closure body here @@ -25,8 +25,8 @@ LL | } error[E0597]: `y` does not live long enough --> $DIR/regions-nested-fns.rs:9:15 | -LL | ignore:: FnMut(&'z isize)>>(Box::new(|z| { - | --- value captured here +LL | ignore:: FnMut(&'z isize)>>(Box::new(|z| { + | --- value captured here LL | ay = x; LL | ay = &y; | ^ borrowed value does not live long enough diff --git a/src/test/ui/regions/regions-nested-fns.rs b/src/test/ui/regions/regions-nested-fns.rs index 161d812f016a6..c02d4e0ce453b 100644 --- a/src/test/ui/regions/regions-nested-fns.rs +++ b/src/test/ui/regions/regions-nested-fns.rs @@ -4,13 +4,13 @@ fn nested<'x>(x: &'x isize) { let y = 3; let mut ay = &y; //~ ERROR E0495 - ignore:: FnMut(&'z isize)>>(Box::new(|z| { + ignore:: FnMut(&'z isize)>>(Box::new(|z| { ay = x; ay = &y; ay = z; })); - ignore::< Box FnMut(&'z isize) -> &'z isize>>(Box::new(|z| { + ignore::< Box FnMut(&'z isize) -> &'z isize>>(Box::new(|z| { if false { return x; } //~ ERROR E0312 if false { return ay; } return z; diff --git a/src/test/ui/regions/regions-nested-fns.stderr b/src/test/ui/regions/regions-nested-fns.stderr index 702254a0ac423..15c9c9ca4ddbb 100644 --- a/src/test/ui/regions/regions-nested-fns.stderr +++ b/src/test/ui/regions/regions-nested-fns.stderr @@ -4,11 +4,11 @@ error[E0495]: cannot infer an appropriate lifetime due to conflicting requiremen LL | let mut ay = &y; | ^^ | -note: first, the lifetime cannot outlive the anonymous lifetime #2 defined on the body at 7:54... - --> $DIR/regions-nested-fns.rs:7:54 +note: first, the lifetime cannot outlive the anonymous lifetime #2 defined on the body at 7:58... + --> $DIR/regions-nested-fns.rs:7:58 | -LL | ignore:: FnMut(&'z isize)>>(Box::new(|z| { - | ______________________________________________________^ +LL | ignore:: FnMut(&'z isize)>>(Box::new(|z| { + | __________________________________________________________^ LL | | ay = x; LL | | ay = &y; LL | | ay = z; @@ -19,11 +19,11 @@ note: ...so that reference does not outlive borrowed content | LL | ay = z; | ^ -note: but, the lifetime must be valid for the anonymous lifetime #2 defined on the body at 13:68... - --> $DIR/regions-nested-fns.rs:13:68 +note: but, the lifetime must be valid for the anonymous lifetime #2 defined on the body at 13:72... + --> $DIR/regions-nested-fns.rs:13:72 | -LL | ignore::< Box FnMut(&'z isize) -> &'z isize>>(Box::new(|z| { - | ____________________________________________________________________^ +LL | ignore::< Box FnMut(&'z isize) -> &'z isize>>(Box::new(|z| { + | ________________________________________________________________________^ LL | | if false { return x; } LL | | if false { return ay; } LL | | return z; @@ -39,11 +39,11 @@ error[E0312]: lifetime of reference outlives lifetime of borrowed content... LL | if false { return x; } | ^ | -note: ...the reference is valid for the anonymous lifetime #2 defined on the body at 13:68... - --> $DIR/regions-nested-fns.rs:13:68 +note: ...the reference is valid for the anonymous lifetime #2 defined on the body at 13:72... + --> $DIR/regions-nested-fns.rs:13:72 | -LL | ignore::< Box FnMut(&'z isize) -> &'z isize>>(Box::new(|z| { - | ____________________________________________________________________^ +LL | ignore::< Box FnMut(&'z isize) -> &'z isize>>(Box::new(|z| { + | ________________________________________________________________________^ LL | | if false { return x; } LL | | if false { return ay; } LL | | return z; diff --git a/src/test/ui/regions/regions-proc-bound-capture.rs b/src/test/ui/regions/regions-proc-bound-capture.rs index f2010dbe62d8d..0c903b7384992 100644 --- a/src/test/ui/regions/regions-proc-bound-capture.rs +++ b/src/test/ui/regions/regions-proc-bound-capture.rs @@ -1,10 +1,10 @@ -fn borrowed_proc<'a>(x: &'a isize) -> Box(isize) + 'a> { +fn borrowed_proc<'a>(x: &'a isize) -> Box(isize) + 'a> { // This is legal, because the region bound on `proc` // states that it captures `x`. Box::new(move|| { *x }) } -fn static_proc(x: &isize) -> Box(isize) + 'static> { +fn static_proc(x: &isize) -> Box(isize) + 'static> { // This is illegal, because the region bound on `proc` is 'static. Box::new(move|| { *x }) //~ ERROR explicit lifetime required in the type of `x` [E0621] } diff --git a/src/test/ui/regions/regions-proc-bound-capture.stderr b/src/test/ui/regions/regions-proc-bound-capture.stderr index aea7347d53c27..c53af34456ef3 100644 --- a/src/test/ui/regions/regions-proc-bound-capture.stderr +++ b/src/test/ui/regions/regions-proc-bound-capture.stderr @@ -1,7 +1,7 @@ error[E0621]: explicit lifetime required in the type of `x` --> $DIR/regions-proc-bound-capture.rs:9:5 | -LL | fn static_proc(x: &isize) -> Box(isize) + 'static> { +LL | fn static_proc(x: &isize) -> Box(isize) + 'static> { | ------ help: add explicit lifetime `'static` to the type of `x`: `&'static isize` LL | // This is illegal, because the region bound on `proc` is 'static. LL | Box::new(move|| { *x }) diff --git a/src/test/ui/regions/regions-steal-closure.rs b/src/test/ui/regions/regions-steal-closure.rs index e6b34510bb567..83e93522c9483 100644 --- a/src/test/ui/regions/regions-steal-closure.rs +++ b/src/test/ui/regions/regions-steal-closure.rs @@ -1,10 +1,10 @@ #![feature(fn_traits)] struct ClosureBox<'a> { - cl: Box, + cl: Box, } -fn box_it<'r>(x: Box) -> ClosureBox<'r> { +fn box_it<'r>(x: Box) -> ClosureBox<'r> { ClosureBox {cl: x} } diff --git a/src/test/ui/regions/regions-trait-1.rs b/src/test/ui/regions/regions-trait-1.rs index 7273887193620..0da8ac53695e9 100644 --- a/src/test/ui/regions/regions-trait-1.rs +++ b/src/test/ui/regions/regions-trait-1.rs @@ -19,12 +19,12 @@ impl<'a> GetCtxt for HasCtxt<'a> { } -fn get_v(gc: Box) -> usize { +fn get_v(gc: Box) -> usize { gc.get_ctxt().v } fn main() { let ctxt = Ctxt { v: 22 }; let hc = HasCtxt { c: &ctxt }; - assert_eq!(get_v(box hc as Box), 22); + assert_eq!(get_v(box hc as Box), 22); } diff --git a/src/test/ui/regions/regions-trait-object-subtyping.nll.stderr b/src/test/ui/regions/regions-trait-object-subtyping.nll.stderr index eccf1b5e8cf76..f4b1a89db9a73 100644 --- a/src/test/ui/regions/regions-trait-object-subtyping.nll.stderr +++ b/src/test/ui/regions/regions-trait-object-subtyping.nll.stderr @@ -1,7 +1,7 @@ error: lifetime may not live long enough --> $DIR/regions-trait-object-subtyping.rs:15:5 | -LL | fn foo3<'a,'b>(x: &'a mut Dummy) -> &'b mut Dummy { +LL | fn foo3<'a,'b>(x: &'a mut dyn Dummy) -> &'b mut dyn Dummy { | -- -- lifetime `'b` defined here | | | lifetime `'a` defined here @@ -12,7 +12,7 @@ LL | x error: lifetime may not live long enough --> $DIR/regions-trait-object-subtyping.rs:22:5 | -LL | fn foo4<'a:'b,'b>(x: Wrapper<&'a mut Dummy>) -> Wrapper<&'b mut Dummy> { +LL | fn foo4<'a:'b,'b>(x: Wrapper<&'a mut dyn Dummy>) -> Wrapper<&'b mut dyn Dummy> { | -- -- lifetime `'b` defined here | | | lifetime `'a` defined here diff --git a/src/test/ui/regions/regions-trait-object-subtyping.rs b/src/test/ui/regions/regions-trait-object-subtyping.rs index eb2623544563f..5b36194870ef6 100644 --- a/src/test/ui/regions/regions-trait-object-subtyping.rs +++ b/src/test/ui/regions/regions-trait-object-subtyping.rs @@ -1,23 +1,23 @@ trait Dummy { fn dummy(&self); } -fn foo1<'a:'b,'b>(x: &'a mut (Dummy+'a)) -> &'b mut (Dummy+'b) { +fn foo1<'a:'b,'b>(x: &'a mut (dyn Dummy+'a)) -> &'b mut (dyn Dummy+'b) { // Here, we are able to coerce x } -fn foo2<'a:'b,'b>(x: &'b mut (Dummy+'a)) -> &'b mut (Dummy+'b) { +fn foo2<'a:'b,'b>(x: &'b mut (dyn Dummy+'a)) -> &'b mut (dyn Dummy+'b) { // Here, we are able to coerce x } -fn foo3<'a,'b>(x: &'a mut Dummy) -> &'b mut Dummy { +fn foo3<'a,'b>(x: &'a mut dyn Dummy) -> &'b mut dyn Dummy { // Without knowing 'a:'b, we can't coerce x //~ ERROR lifetime bound not satisfied //~^ ERROR cannot infer an appropriate lifetime } struct Wrapper(T); -fn foo4<'a:'b,'b>(x: Wrapper<&'a mut Dummy>) -> Wrapper<&'b mut Dummy> { +fn foo4<'a:'b,'b>(x: Wrapper<&'a mut dyn Dummy>) -> Wrapper<&'b mut dyn Dummy> { // We can't coerce because it is packed in `Wrapper` x //~ ERROR mismatched types } diff --git a/src/test/ui/regions/regions-trait-object-subtyping.stderr b/src/test/ui/regions/regions-trait-object-subtyping.stderr index f2d2b37d90726..6de92f13840b3 100644 --- a/src/test/ui/regions/regions-trait-object-subtyping.stderr +++ b/src/test/ui/regions/regions-trait-object-subtyping.stderr @@ -7,12 +7,12 @@ LL | x note: lifetime parameter instantiated with the lifetime 'a as defined on the function body at 13:9 --> $DIR/regions-trait-object-subtyping.rs:13:9 | -LL | fn foo3<'a,'b>(x: &'a mut Dummy) -> &'b mut Dummy { +LL | fn foo3<'a,'b>(x: &'a mut dyn Dummy) -> &'b mut dyn Dummy { | ^^ note: but lifetime parameter must outlive the lifetime 'b as defined on the function body at 13:12 --> $DIR/regions-trait-object-subtyping.rs:13:12 | -LL | fn foo3<'a,'b>(x: &'a mut Dummy) -> &'b mut Dummy { +LL | fn foo3<'a,'b>(x: &'a mut dyn Dummy) -> &'b mut dyn Dummy { | ^^ error[E0495]: cannot infer an appropriate lifetime for automatic coercion due to conflicting requirements @@ -24,7 +24,7 @@ LL | x note: first, the lifetime cannot outlive the lifetime 'a as defined on the function body at 13:9... --> $DIR/regions-trait-object-subtyping.rs:13:9 | -LL | fn foo3<'a,'b>(x: &'a mut Dummy) -> &'b mut Dummy { +LL | fn foo3<'a,'b>(x: &'a mut dyn Dummy) -> &'b mut dyn Dummy { | ^^ note: ...so that reference does not outlive borrowed content --> $DIR/regions-trait-object-subtyping.rs:15:5 @@ -34,7 +34,7 @@ LL | x note: but, the lifetime must be valid for the lifetime 'b as defined on the function body at 13:12... --> $DIR/regions-trait-object-subtyping.rs:13:12 | -LL | fn foo3<'a,'b>(x: &'a mut Dummy) -> &'b mut Dummy { +LL | fn foo3<'a,'b>(x: &'a mut dyn Dummy) -> &'b mut dyn Dummy { | ^^ = note: ...so that the expression is assignable: expected &'b mut (dyn Dummy + 'b) @@ -51,12 +51,12 @@ LL | x note: the lifetime 'b as defined on the function body at 20:15... --> $DIR/regions-trait-object-subtyping.rs:20:15 | -LL | fn foo4<'a:'b,'b>(x: Wrapper<&'a mut Dummy>) -> Wrapper<&'b mut Dummy> { +LL | fn foo4<'a:'b,'b>(x: Wrapper<&'a mut dyn Dummy>) -> Wrapper<&'b mut dyn Dummy> { | ^^ note: ...does not necessarily outlive the lifetime 'a as defined on the function body at 20:9 --> $DIR/regions-trait-object-subtyping.rs:20:9 | -LL | fn foo4<'a:'b,'b>(x: Wrapper<&'a mut Dummy>) -> Wrapper<&'b mut Dummy> { +LL | fn foo4<'a:'b,'b>(x: Wrapper<&'a mut dyn Dummy>) -> Wrapper<&'b mut dyn Dummy> { | ^^ error: aborting due to 3 previous errors diff --git a/src/test/ui/regions/regions-trait-variance.rs b/src/test/ui/regions/regions-trait-variance.rs index 73baa84ec9049..9169d457d4051 100644 --- a/src/test/ui/regions/regions-trait-variance.rs +++ b/src/test/ui/regions/regions-trait-variance.rs @@ -23,10 +23,10 @@ impl Drop for B { } struct A<'r> { - p: &'r (X+'r) + p: &'r (dyn X + 'r) } -fn make_a(p:&X) -> A { +fn make_a(p: &dyn X) -> A { A{p:p} } diff --git a/src/test/ui/regions/regions-wf-trait-object.rs b/src/test/ui/regions/regions-wf-trait-object.rs index 61bab359f9a08..d0053b2023445 100644 --- a/src/test/ui/regions/regions-wf-trait-object.rs +++ b/src/test/ui/regions/regions-wf-trait-object.rs @@ -4,7 +4,7 @@ trait TheTrait<'t>: 't { } struct Foo<'a,'b> { - x: Box+'b> //~ ERROR E0478 + x: Box+'b> //~ ERROR E0478 } fn main() { } diff --git a/src/test/ui/regions/regions-wf-trait-object.stderr b/src/test/ui/regions/regions-wf-trait-object.stderr index 3dc1c4dcd22d2..4e12478c36da3 100644 --- a/src/test/ui/regions/regions-wf-trait-object.stderr +++ b/src/test/ui/regions/regions-wf-trait-object.stderr @@ -1,8 +1,8 @@ error[E0478]: lifetime bound not satisfied --> $DIR/regions-wf-trait-object.rs:7:5 | -LL | x: Box+'b> - | ^^^^^^^^^^^^^^^^^^^^^^^ +LL | x: Box+'b> + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ | note: lifetime parameter instantiated with the lifetime 'b as defined on the struct at 6:15 --> $DIR/regions-wf-trait-object.rs:6:15 diff --git a/src/test/ui/resolve/issue-23305.rs b/src/test/ui/resolve/issue-23305.rs index af335acd41bc3..95635e12a63b1 100644 --- a/src/test/ui/resolve/issue-23305.rs +++ b/src/test/ui/resolve/issue-23305.rs @@ -2,7 +2,7 @@ pub trait ToNbt { fn new(val: T) -> Self; } -impl ToNbt {} +impl dyn ToNbt {} //~^ ERROR cycle detected fn main() {} diff --git a/src/test/ui/resolve/issue-23305.stderr b/src/test/ui/resolve/issue-23305.stderr index 1da56ad05d28c..0ed3af81d5668 100644 --- a/src/test/ui/resolve/issue-23305.stderr +++ b/src/test/ui/resolve/issue-23305.stderr @@ -1,10 +1,10 @@ -error[E0391]: cycle detected when processing `` - --> $DIR/issue-23305.rs:5:12 +error[E0391]: cycle detected when processing `` + --> $DIR/issue-23305.rs:5:16 | -LL | impl ToNbt {} - | ^^^^ +LL | impl dyn ToNbt {} + | ^^^^ | - = note: ...which again requires processing ``, completing the cycle + = note: ...which again requires processing ``, completing the cycle note: cycle used when collecting item types in top-level module --> $DIR/issue-23305.rs:1:1 | diff --git a/src/test/ui/resolve/issue-33876.rs b/src/test/ui/resolve/issue-33876.rs index dd31fc231cfb5..e233ec631cc13 100644 --- a/src/test/ui/resolve/issue-33876.rs +++ b/src/test/ui/resolve/issue-33876.rs @@ -7,6 +7,6 @@ trait Bar {} impl Bar for Foo {} fn main() { - let any: &Any = &Bar; //~ ERROR expected value, found trait `Bar` + let any: &dyn Any = &Bar; //~ ERROR expected value, found trait `Bar` if any.is::() { println!("u32"); } } diff --git a/src/test/ui/resolve/issue-33876.stderr b/src/test/ui/resolve/issue-33876.stderr index 29a63fdd11fe5..52308f2a7f028 100644 --- a/src/test/ui/resolve/issue-33876.stderr +++ b/src/test/ui/resolve/issue-33876.stderr @@ -1,8 +1,8 @@ error[E0423]: expected value, found trait `Bar` - --> $DIR/issue-33876.rs:10:22 + --> $DIR/issue-33876.rs:10:26 | -LL | let any: &Any = &Bar; - | ^^^ not a value +LL | let any: &dyn Any = &Bar; + | ^^^ not a value error: aborting due to previous error diff --git a/src/test/ui/resolve/issue-3907-2.rs b/src/test/ui/resolve/issue-3907-2.rs index dc9624698dfdd..46f145e63e157 100644 --- a/src/test/ui/resolve/issue-3907-2.rs +++ b/src/test/ui/resolve/issue-3907-2.rs @@ -2,7 +2,7 @@ extern crate issue_3907; -type Foo = issue_3907::Foo+'static; +type Foo = dyn issue_3907::Foo + 'static; struct S { name: isize diff --git a/src/test/ui/resolve/issue-3907.rs b/src/test/ui/resolve/issue-3907.rs index 87e465489a481..6211de4271782 100644 --- a/src/test/ui/resolve/issue-3907.rs +++ b/src/test/ui/resolve/issue-3907.rs @@ -2,7 +2,7 @@ extern crate issue_3907; -type Foo = issue_3907::Foo; +type Foo = dyn issue_3907::Foo; struct S { name: isize diff --git a/src/test/ui/resolve/issue-5035-2.rs b/src/test/ui/resolve/issue-5035-2.rs index f88a2375a4315..b831bb4be3487 100644 --- a/src/test/ui/resolve/issue-5035-2.rs +++ b/src/test/ui/resolve/issue-5035-2.rs @@ -1,5 +1,5 @@ trait I {} -type K = I+'static; +type K = dyn I + 'static; fn foo(_x: K) {} //~^ ERROR the size for values of type diff --git a/src/test/ui/resolve/issue-5035.rs b/src/test/ui/resolve/issue-5035.rs index c00567a75b7a3..49fa312f9d257 100644 --- a/src/test/ui/resolve/issue-5035.rs +++ b/src/test/ui/resolve/issue-5035.rs @@ -1,5 +1,5 @@ trait I {} -type K = I; +type K = dyn I; impl K for isize {} //~ ERROR expected trait, found type alias `K` use ImportError; //~ ERROR unresolved import `ImportError` [E0432] diff --git a/src/test/ui/rfc-2093-infer-outlives/self-structs.rs b/src/test/ui/rfc-2093-infer-outlives/self-structs.rs index d2550a99e814c..8f2d29d6f17c2 100644 --- a/src/test/ui/rfc-2093-infer-outlives/self-structs.rs +++ b/src/test/ui/rfc-2093-infer-outlives/self-structs.rs @@ -2,7 +2,7 @@ #[rustc_outlives] struct Foo<'a, 'b, T> { //~ ERROR rustc_outlives - field1: Bar<'a, 'b, T> + field1: dyn Bar<'a, 'b, T> } trait Bar<'x, 's, U> diff --git a/src/test/ui/rfc-2093-infer-outlives/self-structs.stderr b/src/test/ui/rfc-2093-infer-outlives/self-structs.stderr index 9ae05dab74d5e..b32c9743e9edb 100644 --- a/src/test/ui/rfc-2093-infer-outlives/self-structs.stderr +++ b/src/test/ui/rfc-2093-infer-outlives/self-structs.stderr @@ -2,7 +2,7 @@ error: rustc_outlives --> $DIR/self-structs.rs:4:1 | LL | / struct Foo<'a, 'b, T> { -LL | | field1: Bar<'a, 'b, T> +LL | | field1: dyn Bar<'a, 'b, T> LL | | } | |_^ | diff --git a/src/test/ui/rfc1598-generic-associated-types/generic-associated-types-where.rs b/src/test/ui/rfc1598-generic-associated-types/generic-associated-types-where.rs index b0d1fa1a74fb5..01daf307c0068 100644 --- a/src/test/ui/rfc1598-generic-associated-types/generic-associated-types-where.rs +++ b/src/test/ui/rfc1598-generic-associated-types/generic-associated-types-where.rs @@ -9,7 +9,7 @@ trait Foo { type Assoc where Self: Sized; type Assoc2 where T: Display; type Assoc3; - type WithDefault where T: Debug = Iterator; + type WithDefault where T: Debug = dyn Iterator; type NoGenerics; } @@ -19,7 +19,7 @@ impl Foo for Bar { type Assoc = usize; type Assoc2 = Vec; type Assoc3 where T: Iterator = Vec; - type WithDefault<'a, T> = &'a Iterator; + type WithDefault<'a, T> = &'a dyn Iterator; type NoGenerics = ::std::cell::Cell; } diff --git a/src/test/ui/rfc1623.rs b/src/test/ui/rfc1623.rs index 5920446dbc2e2..ebb4d56af9eec 100644 --- a/src/test/ui/rfc1623.rs +++ b/src/test/ui/rfc1623.rs @@ -13,7 +13,7 @@ static NON_ELIDABLE_FN: &fn(&u8, &u8) -> &u8 = struct SomeStruct<'x, 'y, 'z: 'x> { foo: &'x Foo<'z>, bar: &'x Bar<'z>, - f: &'y for<'a, 'b> Fn(&'a Foo<'b>) -> &'a Bar<'b>, + f: &'y dyn for<'a, 'b> Fn(&'a Foo<'b>) -> &'a Bar<'b>, } fn id(t: T) -> T { diff --git a/src/test/ui/save-analysis/issue-59134-0.rs b/src/test/ui/save-analysis/issue-59134-0.rs index 3158328b3ff15..a0871ca18094e 100644 --- a/src/test/ui/save-analysis/issue-59134-0.rs +++ b/src/test/ui/save-analysis/issue-59134-0.rs @@ -4,7 +4,7 @@ pub fn f() { trait Trait {} - impl Trait { + impl dyn Trait { const FLAG: u32 = bogus.field; //~ ERROR cannot find value `bogus` } } diff --git a/src/test/ui/self/arbitrary-self-types-not-object-safe.rs b/src/test/ui/self/arbitrary-self-types-not-object-safe.rs index 2c1fd937a65ad..7443d888c9ec8 100644 --- a/src/test/ui/self/arbitrary-self-types-not-object-safe.rs +++ b/src/test/ui/self/arbitrary-self-types-not-object-safe.rs @@ -28,13 +28,13 @@ impl Bar for usize { } fn make_foo() { - let x = Rc::new(5usize) as Rc; + let x = Rc::new(5usize) as Rc; //~^ ERROR E0038 //~| ERROR E0038 } fn make_bar() { - let x = Rc::new(5usize) as Rc; + let x = Rc::new(5usize) as Rc; x.bar(); } diff --git a/src/test/ui/self/arbitrary-self-types-not-object-safe.stderr b/src/test/ui/self/arbitrary-self-types-not-object-safe.stderr index dacab1222aba3..e45bc2657f1ea 100644 --- a/src/test/ui/self/arbitrary-self-types-not-object-safe.stderr +++ b/src/test/ui/self/arbitrary-self-types-not-object-safe.stderr @@ -1,15 +1,15 @@ error[E0038]: the trait `Foo` cannot be made into an object --> $DIR/arbitrary-self-types-not-object-safe.rs:31:32 | -LL | let x = Rc::new(5usize) as Rc; - | ^^^^^^^ the trait `Foo` cannot be made into an object +LL | let x = Rc::new(5usize) as Rc; + | ^^^^^^^^^^^ the trait `Foo` cannot be made into an object | = note: method `foo`'s receiver cannot be dispatched on error[E0038]: the trait `Foo` cannot be made into an object --> $DIR/arbitrary-self-types-not-object-safe.rs:31:13 | -LL | let x = Rc::new(5usize) as Rc; +LL | let x = Rc::new(5usize) as Rc; | ^^^^^^^^^^^^^^^ the trait `Foo` cannot be made into an object | = note: method `foo`'s receiver cannot be dispatched on diff --git a/src/test/ui/self/arbitrary_self_types_raw_pointer_trait.rs b/src/test/ui/self/arbitrary_self_types_raw_pointer_trait.rs index acbe896eebe77..0a9370e6f5ac7 100644 --- a/src/test/ui/self/arbitrary_self_types_raw_pointer_trait.rs +++ b/src/test/ui/self/arbitrary_self_types_raw_pointer_trait.rs @@ -34,8 +34,8 @@ impl Foo for u32 { } fn main() { - let null_i32 = ptr::null::() as *const Foo; - let null_u32 = ptr::null::() as *const Foo; + let null_i32 = ptr::null::() as *const dyn Foo; + let null_u32 = ptr::null::() as *const dyn Foo; assert_eq!("I'm an i32!", null_i32.foo()); assert_eq!("I'm a u32!", null_u32.foo()); @@ -45,7 +45,7 @@ fn main() { assert_eq!("I'm an i32!", valid_i32_thin.foo()); assert_eq!(5, unsafe { valid_i32_thin.bar() }); assert_eq!(5, unsafe { (&valid_i32_thin as *const *const i32).complicated() }); - let valid_i32_fat = valid_i32_thin as *const Foo; + let valid_i32_fat = valid_i32_thin as *const dyn Foo; assert_eq!("I'm an i32!", valid_i32_fat.foo()); assert_eq!(5, unsafe { valid_i32_fat.bar() }); @@ -54,7 +54,7 @@ fn main() { assert_eq!("I'm a u32!", valid_u32_thin.foo()); assert_eq!(18, unsafe { valid_u32_thin.bar() }); assert_eq!(18, unsafe { (&valid_u32_thin as *const *const u32).complicated() }); - let valid_u32_fat = valid_u32_thin as *const Foo; + let valid_u32_fat = valid_u32_thin as *const dyn Foo; assert_eq!("I'm a u32!", valid_u32_fat.foo()); assert_eq!(18, unsafe { valid_u32_fat.bar() }); diff --git a/src/test/ui/self/explicit-self-objects-uniq.rs b/src/test/ui/self/explicit-self-objects-uniq.rs index f95686cf11234..0050bc7124d71 100644 --- a/src/test/ui/self/explicit-self-objects-uniq.rs +++ b/src/test/ui/self/explicit-self-objects-uniq.rs @@ -17,6 +17,6 @@ impl Foo for S { pub fn main() { let x = box S { x: 3 }; - let y = x as Box; + let y = x as Box; y.f(); } diff --git a/src/test/ui/self/object-safety-sized-self-by-value-self.rs b/src/test/ui/self/object-safety-sized-self-by-value-self.rs index ae0512666ce0b..43b1d8b9149a1 100644 --- a/src/test/ui/self/object-safety-sized-self-by-value-self.rs +++ b/src/test/ui/self/object-safety-sized-self-by-value-self.rs @@ -23,7 +23,7 @@ fn tick1(mut c: C) -> u32 { c.get() } -fn tick2(c: &mut Counter) { +fn tick2(c: &mut dyn Counter) { tick3(c); } diff --git a/src/test/ui/self/object-safety-sized-self-generic-method.rs b/src/test/ui/self/object-safety-sized-self-generic-method.rs index 0b3f663373785..e0b0526a3338a 100644 --- a/src/test/ui/self/object-safety-sized-self-generic-method.rs +++ b/src/test/ui/self/object-safety-sized-self-generic-method.rs @@ -23,7 +23,7 @@ fn tick1(c: &mut C) { c.with(|i| ()); } -fn tick2(c: &mut Counter) { +fn tick2(c: &mut dyn Counter) { tick3(c); } diff --git a/src/test/ui/self/object-safety-sized-self-return-Self.rs b/src/test/ui/self/object-safety-sized-self-return-Self.rs index e88dba0a4e8a3..222c754394569 100644 --- a/src/test/ui/self/object-safety-sized-self-return-Self.rs +++ b/src/test/ui/self/object-safety-sized-self-return-Self.rs @@ -23,7 +23,7 @@ fn preticked() -> C { c } -fn tick(c: &mut Counter) { +fn tick(c: &mut dyn Counter) { tick_generic(c); } diff --git a/src/test/ui/span/borrowck-call-is-borrow-issue-12224.rs b/src/test/ui/span/borrowck-call-is-borrow-issue-12224.rs index db48bdf4c01b2..6099263ccd0e9 100644 --- a/src/test/ui/span/borrowck-call-is-borrow-issue-12224.rs +++ b/src/test/ui/span/borrowck-call-is-borrow-issue-12224.rs @@ -2,10 +2,10 @@ // Ensure that invoking a closure counts as a unique immutable borrow -type Fn<'a> = Box; +type Fn<'a> = Box; struct Test<'a> { - f: Box + f: Box } fn call(mut f: F) where F: FnMut(Fn) { @@ -47,9 +47,9 @@ fn test6() { } fn test7() { - fn foo(_: F) where F: FnMut(Box, isize) {} + fn foo(_: F) where F: FnMut(Box, isize) {} let s = String::new(); // Capture to make f !Copy - let mut f = move |g: Box, b: isize| { + let mut f = move |g: Box, b: isize| { let _ = s.len(); }; f(Box::new(|a| { diff --git a/src/test/ui/span/borrowck-call-is-borrow-issue-12224.stderr b/src/test/ui/span/borrowck-call-is-borrow-issue-12224.stderr index 847f6865624bf..72f979e8d3c34 100644 --- a/src/test/ui/span/borrowck-call-is-borrow-issue-12224.stderr +++ b/src/test/ui/span/borrowck-call-is-borrow-issue-12224.stderr @@ -29,7 +29,7 @@ LL | f.f.call_mut(()) error[E0507]: cannot move out of captured variable in an `FnMut` closure --> $DIR/borrowck-call-is-borrow-issue-12224.rs:57:13 | -LL | let mut f = move |g: Box, b: isize| { +LL | let mut f = move |g: Box, b: isize| { | ----- captured outer variable ... LL | foo(f); diff --git a/src/test/ui/span/borrowck-object-mutability.rs b/src/test/ui/span/borrowck-object-mutability.rs index e672c46453582..f5adc2cc1413e 100644 --- a/src/test/ui/span/borrowck-object-mutability.rs +++ b/src/test/ui/span/borrowck-object-mutability.rs @@ -3,22 +3,22 @@ trait Foo { fn borrowed_mut(&mut self); } -fn borrowed_receiver(x: &Foo) { +fn borrowed_receiver(x: &dyn Foo) { x.borrowed(); x.borrowed_mut(); //~ ERROR cannot borrow } -fn borrowed_mut_receiver(x: &mut Foo) { +fn borrowed_mut_receiver(x: &mut dyn Foo) { x.borrowed(); x.borrowed_mut(); } -fn owned_receiver(x: Box) { +fn owned_receiver(x: Box) { x.borrowed(); x.borrowed_mut(); //~ ERROR cannot borrow } -fn mut_owned_receiver(mut x: Box) { +fn mut_owned_receiver(mut x: Box) { x.borrowed(); x.borrowed_mut(); } diff --git a/src/test/ui/span/borrowck-object-mutability.stderr b/src/test/ui/span/borrowck-object-mutability.stderr index fe6014cd5ad83..fe6d05c588f7f 100644 --- a/src/test/ui/span/borrowck-object-mutability.stderr +++ b/src/test/ui/span/borrowck-object-mutability.stderr @@ -1,8 +1,8 @@ error[E0596]: cannot borrow `*x` as mutable, as it is behind a `&` reference --> $DIR/borrowck-object-mutability.rs:8:5 | -LL | fn borrowed_receiver(x: &Foo) { - | ---- help: consider changing this to be a mutable reference: `&mut dyn Foo` +LL | fn borrowed_receiver(x: &dyn Foo) { + | -------- help: consider changing this to be a mutable reference: `&mut dyn Foo` LL | x.borrowed(); LL | x.borrowed_mut(); | ^ `x` is a `&` reference, so the data it refers to cannot be borrowed as mutable @@ -10,7 +10,7 @@ LL | x.borrowed_mut(); error[E0596]: cannot borrow `*x` as mutable, as `x` is not declared as mutable --> $DIR/borrowck-object-mutability.rs:18:5 | -LL | fn owned_receiver(x: Box) { +LL | fn owned_receiver(x: Box) { | - help: consider changing this to be mutable: `mut x` LL | x.borrowed(); LL | x.borrowed_mut(); diff --git a/src/test/ui/span/dropck-object-cycle.rs b/src/test/ui/span/dropck-object-cycle.rs index 8dc70ea252b27..a26123d5246f6 100644 --- a/src/test/ui/span/dropck-object-cycle.rs +++ b/src/test/ui/span/dropck-object-cycle.rs @@ -8,7 +8,7 @@ trait Trait<'a> { fn short<'b>(&'b self) -> isize; } -fn object_invoke1<'d>(x: &'d Trait<'d>) -> (isize, isize) { loop { } } +fn object_invoke1<'d>(x: &'d dyn Trait<'d>) -> (isize, isize) { loop { } } trait MakerTrait { fn mk() -> Self; @@ -18,12 +18,12 @@ fn make_val() -> T { MakerTrait::mk() } -impl<'t> MakerTrait for Box+'static> { - fn mk() -> Box+'static> { loop { } } +impl<'t> MakerTrait for Box+'static> { + fn mk() -> Box+'static> { loop { } } } pub fn main() { - let m : Box = make_val(); + let m : Box = make_val(); assert_eq!(object_invoke1(&*m), (4,5)); //~^ ERROR `*m` does not live long enough diff --git a/src/test/ui/span/issue-25199.rs b/src/test/ui/span/issue-25199.rs index ed690443d4ddb..dbc3b190068ec 100644 --- a/src/test/ui/span/issue-25199.rs +++ b/src/test/ui/span/issue-25199.rs @@ -34,7 +34,7 @@ impl Drop for VecHolder { struct Container<'a> { v: VecHolder, - d: RefCell>>, + d: RefCell>>, } impl<'a> Container<'a> { diff --git a/src/test/ui/span/issue-26656.rs b/src/test/ui/span/issue-26656.rs index c5a70c87ed873..cde68da189736 100644 --- a/src/test/ui/span/issue-26656.rs +++ b/src/test/ui/span/issue-26656.rs @@ -10,7 +10,7 @@ impl Trigger for () { // Still unsound Zook trait Button { fn push(&self); } -struct Zook { button: B, trigger: Box+'static> } +struct Zook { button: B, trigger: Box+'static> } impl Drop for Zook { fn drop(&mut self) { diff --git a/src/test/ui/span/regions-close-over-borrowed-ref-in-obj.rs b/src/test/ui/span/regions-close-over-borrowed-ref-in-obj.rs index 13e651fa56b8f..e34f84683bbc7 100644 --- a/src/test/ui/span/regions-close-over-borrowed-ref-in-obj.rs +++ b/src/test/ui/span/regions-close-over-borrowed-ref-in-obj.rs @@ -11,6 +11,6 @@ fn main() { { let ss: &isize = &id(1); //~^ ERROR temporary value dropped while borrowed - blah = box ss as Box; + blah = box ss as Box; } } diff --git a/src/test/ui/span/regions-close-over-type-parameter-2.rs b/src/test/ui/span/regions-close-over-type-parameter-2.rs index 11187b74c4299..29083154b8991 100644 --- a/src/test/ui/span/regions-close-over-type-parameter-2.rs +++ b/src/test/ui/span/regions-close-over-type-parameter-2.rs @@ -10,8 +10,8 @@ impl Foo for A { fn get(&self) { } } -fn repeater3<'a,A:'a>(v: A) -> Box { - box v as Box +fn repeater3<'a,A:'a>(v: A) -> Box { + box v as Box } fn main() { diff --git a/src/test/ui/span/send-is-not-static-ensures-scoping.rs b/src/test/ui/span/send-is-not-static-ensures-scoping.rs index ac07420ee362d..2aecc2a7e0d96 100644 --- a/src/test/ui/span/send-is-not-static-ensures-scoping.rs +++ b/src/test/ui/span/send-is-not-static-ensures-scoping.rs @@ -1,5 +1,5 @@ struct Guard<'a> { - f: Box, + f: Box, } fn scoped<'a, F: Fn() + Send + 'a>(f: F) -> Guard<'a> { diff --git a/src/test/ui/suggestions/use-type-argument-instead-of-assoc-type.rs b/src/test/ui/suggestions/use-type-argument-instead-of-assoc-type.rs index a3cc53e69e20e..78487bd7bb58c 100644 --- a/src/test/ui/suggestions/use-type-argument-instead-of-assoc-type.rs +++ b/src/test/ui/suggestions/use-type-argument-instead-of-assoc-type.rs @@ -4,7 +4,7 @@ pub trait T { type C; } pub struct Foo { - i: Box>, + i: Box>, //~^ ERROR must be specified //~| ERROR wrong number of type arguments } diff --git a/src/test/ui/suggestions/use-type-argument-instead-of-assoc-type.stderr b/src/test/ui/suggestions/use-type-argument-instead-of-assoc-type.stderr index 5e333187e3d36..d273ec3fca59b 100644 --- a/src/test/ui/suggestions/use-type-argument-instead-of-assoc-type.stderr +++ b/src/test/ui/suggestions/use-type-argument-instead-of-assoc-type.stderr @@ -1,10 +1,10 @@ error[E0107]: wrong number of type arguments: expected 2, found 4 - --> $DIR/use-type-argument-instead-of-assoc-type.rs:7:28 + --> $DIR/use-type-argument-instead-of-assoc-type.rs:7:32 | -LL | i: Box>, - | ^^^^^ ^^^^^ unexpected type argument - | | - | unexpected type argument +LL | i: Box>, + | ^^^^^ ^^^^^ unexpected type argument + | | + | unexpected type argument error[E0191]: the value of the associated types `A` (from the trait `T`), `C` (from the trait `T`) must be specified --> $DIR/use-type-argument-instead-of-assoc-type.rs:7:12 @@ -15,15 +15,15 @@ LL | type B; LL | type C; | ------- `C` defined here ... -LL | i: Box>, - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | i: Box>, + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | | | associated type `A` must be specified | associated type `C` must be specified help: if you meant to specify the associated types, write | -LL | i: Box>, - | ^^^^^^^^^ ^^^^^^^^^ +LL | i: Box>, + | ^^^^^^^^^ ^^^^^^^^^ error: aborting due to 2 previous errors diff --git a/src/test/ui/traits/trait-alias/trait-alias-bounds.rs b/src/test/ui/traits/trait-alias/trait-alias-bounds.rs index 428ce5102bad8..b97eb38c5af8d 100644 --- a/src/test/ui/traits/trait-alias/trait-alias-bounds.rs +++ b/src/test/ui/traits/trait-alias/trait-alias-bounds.rs @@ -17,7 +17,7 @@ struct Foo(PhantomData); #[allow(dead_code)] struct Bar(PhantomData) where T: SendSyncAlias; -impl EmptyAlias {} +impl dyn EmptyAlias {} impl Empty for T {} diff --git a/src/test/ui/traits/trait-alias/trait-alias-no-duplicates.rs b/src/test/ui/traits/trait-alias/trait-alias-no-duplicates.rs index afd8400e23050..88feb89170dd3 100644 --- a/src/test/ui/traits/trait-alias/trait-alias-no-duplicates.rs +++ b/src/test/ui/traits/trait-alias/trait-alias-no-duplicates.rs @@ -114,13 +114,13 @@ type _T44 = dyn _4 + Send + Sync + _8; trait ObjL<'l> {} trait _9 = for<'a> ObjL<'a>; trait _10 = for<'b> ObjL<'b>; -type _T50 = _9 + _10; +type _T50 = dyn _9 + _10; //~^ ERROR only auto traits can be used as additional traits in a trait object [E0225] trait ObjT {} trait _11 = ObjT fn(&'a u8)>; trait _12 = ObjT fn(&'b u8)>; -type _T60 = _11 + _12; +type _T60 = dyn _11 + _12; //~^ ERROR only auto traits can be used as additional traits in a trait object [E0225] fn main() {} diff --git a/src/test/ui/traits/trait-alias/trait-alias-no-duplicates.stderr b/src/test/ui/traits/trait-alias/trait-alias-no-duplicates.stderr index eb667c9522ce1..6df1df86508ee 100644 --- a/src/test/ui/traits/trait-alias/trait-alias-no-duplicates.stderr +++ b/src/test/ui/traits/trait-alias/trait-alias-no-duplicates.stderr @@ -430,28 +430,28 @@ LL | type _T44 = dyn _4 + Send + Sync + _8; | trait alias used in trait object type (first use) error[E0225]: only auto traits can be used as additional traits in a trait object - --> $DIR/trait-alias-no-duplicates.rs:117:18 + --> $DIR/trait-alias-no-duplicates.rs:117:22 | LL | trait _9 = for<'a> ObjL<'a>; | ---------------- first non-auto trait LL | trait _10 = for<'b> ObjL<'b>; | ---------------- additional non-auto trait -LL | type _T50 = _9 + _10; - | -- ^^^ trait alias used in trait object type (additional use) - | | - | trait alias used in trait object type (first use) +LL | type _T50 = dyn _9 + _10; + | -- ^^^ trait alias used in trait object type (additional use) + | | + | trait alias used in trait object type (first use) error[E0225]: only auto traits can be used as additional traits in a trait object - --> $DIR/trait-alias-no-duplicates.rs:123:19 + --> $DIR/trait-alias-no-duplicates.rs:123:23 | LL | trait _11 = ObjT fn(&'a u8)>; | ------------------------ first non-auto trait LL | trait _12 = ObjT fn(&'b u8)>; | ------------------------ additional non-auto trait -LL | type _T60 = _11 + _12; - | --- ^^^ trait alias used in trait object type (additional use) - | | - | trait alias used in trait object type (first use) +LL | type _T60 = dyn _11 + _12; + | --- ^^^ trait alias used in trait object type (additional use) + | | + | trait alias used in trait object type (first use) error: aborting due to 27 previous errors diff --git a/src/test/ui/traits/trait-bounds-not-on-bare-trait.rs b/src/test/ui/traits/trait-bounds-not-on-bare-trait.rs index fd3af6f3a9aaa..33c9f2f00cfee 100644 --- a/src/test/ui/traits/trait-bounds-not-on-bare-trait.rs +++ b/src/test/ui/traits/trait-bounds-not-on-bare-trait.rs @@ -6,6 +6,7 @@ trait Foo { fn foo(_x: Foo + Send) { //~^ ERROR the size for values of type + //~| WARN trait objects without an explicit `dyn` are deprecated } fn main() { } diff --git a/src/test/ui/traits/trait-bounds-not-on-bare-trait.stderr b/src/test/ui/traits/trait-bounds-not-on-bare-trait.stderr index 5aee1e7e982a8..250ea4b1c3201 100644 --- a/src/test/ui/traits/trait-bounds-not-on-bare-trait.stderr +++ b/src/test/ui/traits/trait-bounds-not-on-bare-trait.stderr @@ -1,3 +1,11 @@ +warning: trait objects without an explicit `dyn` are deprecated + --> $DIR/trait-bounds-not-on-bare-trait.rs:7:12 + | +LL | fn foo(_x: Foo + Send) { + | ^^^^^^^^^^ help: use `dyn`: `dyn Foo + Send` + | + = note: #[warn(bare_trait_objects)] on by default + error[E0277]: the size for values of type `(dyn Foo + std::marker::Send + 'static)` cannot be known at compilation time --> $DIR/trait-bounds-not-on-bare-trait.rs:7:8 | diff --git a/src/test/ui/traits/trait-bounds-sugar.rs b/src/test/ui/traits/trait-bounds-sugar.rs index 0892153c0cf86..65b6f6faa4250 100644 --- a/src/test/ui/traits/trait-bounds-sugar.rs +++ b/src/test/ui/traits/trait-bounds-sugar.rs @@ -2,17 +2,17 @@ trait Foo {} -fn a(_x: Box) { +fn a(_x: Box) { } -fn b(_x: &'static (Foo+'static)) { +fn b(_x: &'static (dyn Foo + 'static)) { } -fn c(x: Box) { +fn c(x: Box) { a(x); //~ ERROR mismatched types } -fn d(x: &'static (Foo+Sync)) { +fn d(x: &'static (dyn Foo + Sync)) { b(x); } diff --git a/src/test/ui/traits/trait-coercion-generic-bad.rs b/src/test/ui/traits/trait-coercion-generic-bad.rs index 5aa2183414820..2e115c732b9d7 100644 --- a/src/test/ui/traits/trait-coercion-generic-bad.rs +++ b/src/test/ui/traits/trait-coercion-generic-bad.rs @@ -13,7 +13,7 @@ impl Trait<&'static str> for Struct { } fn main() { - let s: Box> = Box::new(Struct { person: "Fred" }); + let s: Box> = Box::new(Struct { person: "Fred" }); //~^ ERROR `Struct: Trait` is not satisfied s.f(1); } diff --git a/src/test/ui/traits/trait-coercion-generic-bad.stderr b/src/test/ui/traits/trait-coercion-generic-bad.stderr index 7f3b46b8ae52d..f2710dea0952f 100644 --- a/src/test/ui/traits/trait-coercion-generic-bad.stderr +++ b/src/test/ui/traits/trait-coercion-generic-bad.stderr @@ -1,8 +1,8 @@ error[E0277]: the trait bound `Struct: Trait` is not satisfied - --> $DIR/trait-coercion-generic-bad.rs:16:32 + --> $DIR/trait-coercion-generic-bad.rs:16:36 | -LL | let s: Box> = Box::new(Struct { person: "Fred" }); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Trait` is not implemented for `Struct` +LL | let s: Box> = Box::new(Struct { person: "Fred" }); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Trait` is not implemented for `Struct` | = help: the following implementations were found: > diff --git a/src/test/ui/traits/trait-coercion-generic-regions.rs b/src/test/ui/traits/trait-coercion-generic-regions.rs index 148b7dd5c43da..af478df6dfa99 100644 --- a/src/test/ui/traits/trait-coercion-generic-regions.rs +++ b/src/test/ui/traits/trait-coercion-generic-regions.rs @@ -15,5 +15,5 @@ impl Trait<&'static str> for Struct { fn main() { let person = "Fred".to_string(); let person: &str = &person; //~ ERROR `person` does not live long enough - let s: Box> = Box::new(Struct { person: person }); + let s: Box> = Box::new(Struct { person: person }); } diff --git a/src/test/ui/traits/trait-coercion-generic-regions.stderr b/src/test/ui/traits/trait-coercion-generic-regions.stderr index 4ee3e4cacc372..d21b48e571df9 100644 --- a/src/test/ui/traits/trait-coercion-generic-regions.stderr +++ b/src/test/ui/traits/trait-coercion-generic-regions.stderr @@ -6,7 +6,7 @@ LL | let person: &str = &person; | | | borrowed value does not live long enough | assignment requires that `person` is borrowed for `'static` -LL | let s: Box> = Box::new(Struct { person: person }); +LL | let s: Box> = Box::new(Struct { person: person }); LL | } | - `person` dropped here while still borrowed diff --git a/src/test/ui/traits/trait-impl-1.rs b/src/test/ui/traits/trait-impl-1.rs index 29f58a6a9cbc1..43b822218354f 100644 --- a/src/test/ui/traits/trait-impl-1.rs +++ b/src/test/ui/traits/trait-impl-1.rs @@ -4,7 +4,7 @@ trait T {} -impl<'a> T+'a { +impl<'a> dyn T + 'a { fn foo(&self) {} } diff --git a/src/test/ui/traits/trait-item-privacy.rs b/src/test/ui/traits/trait-item-privacy.rs index dfc8c8f4f6cc1..d58bbef38c492 100644 --- a/src/test/ui/traits/trait-item-privacy.rs +++ b/src/test/ui/traits/trait-item-privacy.rs @@ -68,7 +68,7 @@ fn check_method() { S.b(); //~ ERROR no method named `b` found for type `S` in the current scope S.c(); // OK // a, b, c are resolved as inherent items, their traits don't need to be in scope - let c = &S as &C; + let c = &S as &dyn C; c.a(); //~ ERROR method `a` is private c.b(); // OK c.c(); // OK @@ -121,10 +121,10 @@ fn check_assoc_ty() { let _: T::C; // OK // Associated types, bindings - let _: assoc_ty::B< + let _: dyn assoc_ty::B< B = u8, // OK >; - let _: C< + let _: dyn C< A = u8, //~ ERROR associated type `A` is private B = u8, // OK C = u8, // OK diff --git a/src/test/ui/traits/trait-object-auto-dedup-in-impl.rs b/src/test/ui/traits/trait-object-auto-dedup-in-impl.rs index 6ba5d28a6c4c2..85698f1948904 100644 --- a/src/test/ui/traits/trait-object-auto-dedup-in-impl.rs +++ b/src/test/ui/traits/trait-object-auto-dedup-in-impl.rs @@ -5,15 +5,15 @@ struct Struct; impl Trait for Struct {} trait Trait {} -type Send1 = Trait + Send; -type Send2 = Trait + Send + Send; +type Send1 = dyn Trait + Send; +type Send2 = dyn Trait + Send + Send; fn main () {} -impl Trait + Send { +impl dyn Trait + Send { fn test(&self) { println!("one"); } //~ ERROR duplicate definitions with name `test` } -impl Trait + Send + Send { +impl dyn Trait + Send + Send { fn test(&self) { println!("two"); } } diff --git a/src/test/ui/traits/trait-object-macro-matcher.rs b/src/test/ui/traits/trait-object-macro-matcher.rs index 0f55e2dc4f21e..5ec157275a629 100644 --- a/src/test/ui/traits/trait-object-macro-matcher.rs +++ b/src/test/ui/traits/trait-object-macro-matcher.rs @@ -5,7 +5,8 @@ macro_rules! m { } fn main() { - m!(Copy + Send + 'static); //~ ERROR the trait `std::marker::Copy` cannot be made into an object - m!('static + Send); - m!('static +); //~ ERROR at least one non-builtin trait is required for an object type + m!(dyn Copy + Send + 'static); + //~^ ERROR the trait `std::marker::Copy` cannot be made into an object + m!(dyn 'static + Send); + m!(dyn 'static +); //~ ERROR at least one non-builtin trait is required for an object type } diff --git a/src/test/ui/traits/trait-object-macro-matcher.stderr b/src/test/ui/traits/trait-object-macro-matcher.stderr index 57a529ebc5765..0b84c3dfcb057 100644 --- a/src/test/ui/traits/trait-object-macro-matcher.stderr +++ b/src/test/ui/traits/trait-object-macro-matcher.stderr @@ -1,14 +1,14 @@ error[E0224]: at least one non-builtin trait is required for an object type - --> $DIR/trait-object-macro-matcher.rs:10:8 + --> $DIR/trait-object-macro-matcher.rs:11:8 | -LL | m!('static +); - | ^^^^^^^^^ +LL | m!(dyn 'static +); + | ^^^^^^^^^^^^^ error[E0038]: the trait `std::marker::Copy` cannot be made into an object --> $DIR/trait-object-macro-matcher.rs:8:8 | -LL | m!(Copy + Send + 'static); - | ^^^^^^^^^^^^^^^^^^^^^ the trait `std::marker::Copy` cannot be made into an object +LL | m!(dyn Copy + Send + 'static); + | ^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `std::marker::Copy` cannot be made into an object | = note: the trait cannot require that `Self : Sized` diff --git a/src/test/ui/traits/trait-object-safety.rs b/src/test/ui/traits/trait-object-safety.rs index e333bf6bfe53b..f43d332d69637 100644 --- a/src/test/ui/traits/trait-object-safety.rs +++ b/src/test/ui/traits/trait-object-safety.rs @@ -12,6 +12,6 @@ impl Tr for St { } fn main() { - let _: &Tr = &St; //~ ERROR E0038 + let _: &dyn Tr = &St; //~ ERROR E0038 //~^ ERROR E0038 } diff --git a/src/test/ui/traits/trait-object-safety.stderr b/src/test/ui/traits/trait-object-safety.stderr index a7fe83cb7564a..68edc17870534 100644 --- a/src/test/ui/traits/trait-object-safety.stderr +++ b/src/test/ui/traits/trait-object-safety.stderr @@ -1,8 +1,8 @@ error[E0038]: the trait `Tr` cannot be made into an object - --> $DIR/trait-object-safety.rs:15:18 + --> $DIR/trait-object-safety.rs:15:22 | -LL | let _: &Tr = &St; - | ^^^ the trait `Tr` cannot be made into an object +LL | let _: &dyn Tr = &St; + | ^^^ the trait `Tr` cannot be made into an object | = note: method `foo` has no receiver = note: required because of the requirements on the impl of `std::ops::CoerceUnsized<&dyn Tr>` for `&St` @@ -10,8 +10,8 @@ LL | let _: &Tr = &St; error[E0038]: the trait `Tr` cannot be made into an object --> $DIR/trait-object-safety.rs:15:12 | -LL | let _: &Tr = &St; - | ^^^ the trait `Tr` cannot be made into an object +LL | let _: &dyn Tr = &St; + | ^^^^^^^ the trait `Tr` cannot be made into an object | = note: method `foo` has no receiver diff --git a/src/test/ui/traits/trait-object-vs-lifetime-2.rs b/src/test/ui/traits/trait-object-vs-lifetime-2.rs index 2579a0056f142..4d56fcf11e39e 100644 --- a/src/test/ui/traits/trait-object-vs-lifetime-2.rs +++ b/src/test/ui/traits/trait-object-vs-lifetime-2.rs @@ -6,7 +6,7 @@ // `'static` is a lifetime, `'static +` is a type, `'a` is a type fn g() where 'static: 'static, - 'static +: 'static + Copy, + dyn 'static +: 'static + Copy, //~^ ERROR at least one non-builtin trait is required for an object type {} diff --git a/src/test/ui/traits/trait-object-vs-lifetime-2.stderr b/src/test/ui/traits/trait-object-vs-lifetime-2.stderr index 057f587a7b630..24162c920be33 100644 --- a/src/test/ui/traits/trait-object-vs-lifetime-2.stderr +++ b/src/test/ui/traits/trait-object-vs-lifetime-2.stderr @@ -1,8 +1,8 @@ error[E0224]: at least one non-builtin trait is required for an object type --> $DIR/trait-object-vs-lifetime-2.rs:9:5 | -LL | 'static +: 'static + Copy, - | ^^^^^^^^^ +LL | dyn 'static +: 'static + Copy, + | ^^^^^^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/traits/trait-object-vs-lifetime.rs b/src/test/ui/traits/trait-object-vs-lifetime.rs index 36dec21be0520..803b29367c8a8 100644 --- a/src/test/ui/traits/trait-object-vs-lifetime.rs +++ b/src/test/ui/traits/trait-object-vs-lifetime.rs @@ -6,12 +6,12 @@ struct S<'a, T>(&'a u8, T); fn main() { // `'static` is a lifetime argument, `'static +` is a type argument let _: S<'static, u8>; - let _: S<'static, 'static +>; + let _: S<'static, dyn 'static +>; //~^ at least one non-builtin trait is required for an object type let _: S<'static, 'static>; //~^ ERROR wrong number of lifetime arguments: expected 1, found 2 //~| ERROR wrong number of type arguments: expected 1, found 0 - let _: S<'static +, 'static>; + let _: S; //~^ ERROR lifetime arguments must be declared prior to type arguments //~| ERROR at least one non-builtin trait is required for an object type } diff --git a/src/test/ui/traits/trait-object-vs-lifetime.stderr b/src/test/ui/traits/trait-object-vs-lifetime.stderr index c13d0e3f29373..be1af59ed4f5c 100644 --- a/src/test/ui/traits/trait-object-vs-lifetime.stderr +++ b/src/test/ui/traits/trait-object-vs-lifetime.stderr @@ -1,14 +1,14 @@ error: lifetime arguments must be declared prior to type arguments - --> $DIR/trait-object-vs-lifetime.rs:14:25 + --> $DIR/trait-object-vs-lifetime.rs:14:29 | -LL | let _: S<'static +, 'static>; - | ^^^^^^^ +LL | let _: S; + | ^^^^^^^ error[E0224]: at least one non-builtin trait is required for an object type --> $DIR/trait-object-vs-lifetime.rs:9:23 | -LL | let _: S<'static, 'static +>; - | ^^^^^^^^^ +LL | let _: S<'static, dyn 'static +>; + | ^^^^^^^^^^^^^ error[E0107]: wrong number of lifetime arguments: expected 1, found 2 --> $DIR/trait-object-vs-lifetime.rs:11:23 @@ -25,8 +25,8 @@ LL | let _: S<'static, 'static>; error[E0224]: at least one non-builtin trait is required for an object type --> $DIR/trait-object-vs-lifetime.rs:14:14 | -LL | let _: S<'static +, 'static>; - | ^^^^^^^^^ +LL | let _: S; + | ^^^^^^^^^^^^^ error: aborting due to 5 previous errors diff --git a/src/test/ui/traits/trait-test-2.rs b/src/test/ui/traits/trait-test-2.rs index 20d979df4bf43..86570f1152e1e 100644 --- a/src/test/ui/traits/trait-test-2.rs +++ b/src/test/ui/traits/trait-test-2.rs @@ -8,7 +8,7 @@ impl bar for u32 { fn dup(&self) -> u32 { *self } fn blah(&self) {} } fn main() { 10.dup::(); //~ ERROR wrong number of type arguments: expected 0, found 1 10.blah::(); //~ ERROR wrong number of type arguments: expected 1, found 2 - (box 10 as Box).dup(); + (box 10 as Box).dup(); //~^ ERROR E0038 //~| ERROR E0038 } diff --git a/src/test/ui/traits/trait-test-2.stderr b/src/test/ui/traits/trait-test-2.stderr index 0e3446e0d231d..5d5251925a1ae 100644 --- a/src/test/ui/traits/trait-test-2.stderr +++ b/src/test/ui/traits/trait-test-2.stderr @@ -13,8 +13,8 @@ LL | 10.blah::(); error[E0038]: the trait `bar` cannot be made into an object --> $DIR/trait-test-2.rs:11:16 | -LL | (box 10 as Box).dup(); - | ^^^^^^^^ the trait `bar` cannot be made into an object +LL | (box 10 as Box).dup(); + | ^^^^^^^^^^^^ the trait `bar` cannot be made into an object | = note: method `dup` references the `Self` type in its arguments or return type = note: method `blah` has generic type parameters @@ -22,7 +22,7 @@ LL | (box 10 as Box).dup(); error[E0038]: the trait `bar` cannot be made into an object --> $DIR/trait-test-2.rs:11:6 | -LL | (box 10 as Box).dup(); +LL | (box 10 as Box).dup(); | ^^^^^^ the trait `bar` cannot be made into an object | = note: method `dup` references the `Self` type in its arguments or return type diff --git a/src/test/ui/traits/traits-repeated-supertrait-ambig.rs b/src/test/ui/traits/traits-repeated-supertrait-ambig.rs index 5fa7e87aa4b97..6aaef8a305bce 100644 --- a/src/test/ui/traits/traits-repeated-supertrait-ambig.rs +++ b/src/test/ui/traits/traits-repeated-supertrait-ambig.rs @@ -22,7 +22,7 @@ impl CompareTo for i64 { impl CompareToInts for i64 { } -fn with_obj(c: &CompareToInts) -> bool { +fn with_obj(c: &dyn CompareToInts) -> bool { c.same_as(22) //~ ERROR `dyn CompareToInts: CompareTo` is not satisfied } diff --git a/src/test/ui/trivial-bounds/trivial-bounds-inconsistent-sized.rs b/src/test/ui/trivial-bounds/trivial-bounds-inconsistent-sized.rs index a5d5b93772651..d411807673c66 100644 --- a/src/test/ui/trivial-bounds/trivial-bounds-inconsistent-sized.rs +++ b/src/test/ui/trivial-bounds/trivial-bounds-inconsistent-sized.rs @@ -13,8 +13,8 @@ struct T { struct S(str, str) where str: Sized; -fn unsized_local() where for<'a> T: Sized { - let x: T = *(Box::new(T { x: 1 }) as Box>); +fn unsized_local() where for<'a> T: Sized { + let x: T = *(Box::new(T { x: 1 }) as Box>); } fn return_str() -> str where str: Sized { diff --git a/src/test/ui/trivial-bounds/trivial-bounds-inconsistent-sized.stderr b/src/test/ui/trivial-bounds/trivial-bounds-inconsistent-sized.stderr index a9d2634c1ad71..fda1d6d70ac58 100644 --- a/src/test/ui/trivial-bounds/trivial-bounds-inconsistent-sized.stderr +++ b/src/test/ui/trivial-bounds/trivial-bounds-inconsistent-sized.stderr @@ -7,10 +7,10 @@ LL | struct S(str, str) where str: Sized; = note: #[warn(trivial_bounds)] on by default warning: Trait bound for<'a> T<(dyn A + 'a)>: std::marker::Sized does not depend on any type or lifetime parameters - --> $DIR/trivial-bounds-inconsistent-sized.rs:16:45 + --> $DIR/trivial-bounds-inconsistent-sized.rs:16:49 | -LL | fn unsized_local() where for<'a> T: Sized { - | ^^^^^ +LL | fn unsized_local() where for<'a> T: Sized { + | ^^^^^ warning: Trait bound str: std::marker::Sized does not depend on any type or lifetime parameters --> $DIR/trivial-bounds-inconsistent-sized.rs:20:35 diff --git a/src/test/ui/trivial-bounds/trivial-bounds-inconsistent.rs b/src/test/ui/trivial-bounds/trivial-bounds-inconsistent.rs index fdbaec9a5c7ff..f6538b14d1711 100644 --- a/src/test/ui/trivial-bounds/trivial-bounds-inconsistent.rs +++ b/src/test/ui/trivial-bounds/trivial-bounds-inconsistent.rs @@ -52,8 +52,8 @@ struct Dst { struct TwoStrs(str, str) where str: Sized; -fn unsized_local() where for<'a> Dst: Sized { - let x: Dst = *(Box::new(Dst { x: 1 }) as Box>); +fn unsized_local() where for<'a> Dst: Sized { + let x: Dst = *(Box::new(Dst { x: 1 }) as Box>); } fn return_str() -> str where str: Sized { diff --git a/src/test/ui/trivial-bounds/trivial-bounds-inconsistent.stderr b/src/test/ui/trivial-bounds/trivial-bounds-inconsistent.stderr index 744e146f83003..a0d638f17147e 100644 --- a/src/test/ui/trivial-bounds/trivial-bounds-inconsistent.stderr +++ b/src/test/ui/trivial-bounds/trivial-bounds-inconsistent.stderr @@ -64,10 +64,10 @@ LL | struct TwoStrs(str, str) where str: Sized; | ^^^^^ warning: Trait bound for<'a> Dst<(dyn A + 'a)>: std::marker::Sized does not depend on any type or lifetime parameters - --> $DIR/trivial-bounds-inconsistent.rs:55:47 + --> $DIR/trivial-bounds-inconsistent.rs:55:51 | -LL | fn unsized_local() where for<'a> Dst: Sized { - | ^^^^^ +LL | fn unsized_local() where for<'a> Dst: Sized { + | ^^^^^ warning: Trait bound str: std::marker::Sized does not depend on any type or lifetime parameters --> $DIR/trivial-bounds-inconsistent.rs:59:35 diff --git a/src/test/ui/trivial_casts.rs b/src/test/ui/trivial_casts.rs index c1f5441a36b08..dd578e074fdac 100644 --- a/src/test/ui/trivial_casts.rs +++ b/src/test/ui/trivial_casts.rs @@ -49,29 +49,29 @@ pub fn main() { // unsize trait let x: &Bar = &Bar; - let _ = x as &Foo; //~ERROR trivial cast: `&Bar` as `&dyn Foo` - let _ = x as *const Foo; //~ERROR trivial cast: `&Bar` as `*const dyn Foo` - let _: &Foo = x; - let _: *const Foo = x; + let _ = x as &dyn Foo; //~ERROR trivial cast: `&Bar` as `&dyn Foo` + let _ = x as *const dyn Foo; //~ERROR trivial cast: `&Bar` as `*const dyn Foo` + let _: &dyn Foo = x; + let _: *const dyn Foo = x; let x: &mut Bar = &mut Bar; - let _ = x as &mut Foo; //~ERROR trivial cast: `&mut Bar` as `&mut dyn Foo` - let _ = x as *mut Foo; //~ERROR trivial cast: `&mut Bar` as `*mut dyn Foo` - let _: &mut Foo = x; - let _: *mut Foo = x; + let _ = x as &mut dyn Foo; //~ERROR trivial cast: `&mut Bar` as `&mut dyn Foo` + let _ = x as *mut dyn Foo; //~ERROR trivial cast: `&mut Bar` as `*mut dyn Foo` + let _: &mut dyn Foo = x; + let _: *mut dyn Foo = x; let x: Box = Box::new(Bar); - let _ = x as Box; //~ERROR `std::boxed::Box` as `std::boxed::Box` + let _ = x as Box; //~ERROR `std::boxed::Box` as `std::boxed::Box` let x: Box = Box::new(Bar); - let _: Box = x; + let _: Box = x; // functions fn baz(_x: i32) {} - let _ = &baz as &Fn(i32); //~ERROR `&fn(i32) {main::baz}` as `&dyn std::ops::Fn(i32)` - let _: &Fn(i32) = &baz; + let _ = &baz as &dyn Fn(i32); //~ERROR `&fn(i32) {main::baz}` as `&dyn std::ops::Fn(i32)` + let _: &dyn Fn(i32) = &baz; let x = |_x: i32| {}; - let _ = &x as &Fn(i32); //~ERROR trivial cast - let _: &Fn(i32) = &x; + let _ = &x as &dyn Fn(i32); //~ERROR trivial cast + let _: &dyn Fn(i32) = &x; } // subtyping diff --git a/src/test/ui/trivial_casts.stderr b/src/test/ui/trivial_casts.stderr index 524eb7feaafbd..8fa44372f0b4f 100644 --- a/src/test/ui/trivial_casts.stderr +++ b/src/test/ui/trivial_casts.stderr @@ -83,56 +83,56 @@ LL | let _ = x as Box<[u32]>; error: trivial cast: `&Bar` as `&dyn Foo` --> $DIR/trivial_casts.rs:52:13 | -LL | let _ = x as &Foo; - | ^^^^^^^^^ +LL | let _ = x as &dyn Foo; + | ^^^^^^^^^^^^^ | = help: cast can be replaced by coercion; this might require a temporary variable error: trivial cast: `&Bar` as `*const dyn Foo` --> $DIR/trivial_casts.rs:53:13 | -LL | let _ = x as *const Foo; - | ^^^^^^^^^^^^^^^ +LL | let _ = x as *const dyn Foo; + | ^^^^^^^^^^^^^^^^^^^ | = help: cast can be replaced by coercion; this might require a temporary variable error: trivial cast: `&mut Bar` as `&mut dyn Foo` --> $DIR/trivial_casts.rs:58:13 | -LL | let _ = x as &mut Foo; - | ^^^^^^^^^^^^^ +LL | let _ = x as &mut dyn Foo; + | ^^^^^^^^^^^^^^^^^ | = help: cast can be replaced by coercion; this might require a temporary variable error: trivial cast: `&mut Bar` as `*mut dyn Foo` --> $DIR/trivial_casts.rs:59:13 | -LL | let _ = x as *mut Foo; - | ^^^^^^^^^^^^^ +LL | let _ = x as *mut dyn Foo; + | ^^^^^^^^^^^^^^^^^ | = help: cast can be replaced by coercion; this might require a temporary variable error: trivial cast: `std::boxed::Box` as `std::boxed::Box` --> $DIR/trivial_casts.rs:64:13 | -LL | let _ = x as Box; - | ^^^^^^^^^^^^^ +LL | let _ = x as Box; + | ^^^^^^^^^^^^^^^^^ | = help: cast can be replaced by coercion; this might require a temporary variable error: trivial cast: `&fn(i32) {main::baz}` as `&dyn std::ops::Fn(i32)` --> $DIR/trivial_casts.rs:70:13 | -LL | let _ = &baz as &Fn(i32); - | ^^^^^^^^^^^^^^^^ +LL | let _ = &baz as &dyn Fn(i32); + | ^^^^^^^^^^^^^^^^^^^^ | = help: cast can be replaced by coercion; this might require a temporary variable error: trivial cast: `&[closure@$DIR/trivial_casts.rs:72:13: 72:25]` as `&dyn std::ops::Fn(i32)` --> $DIR/trivial_casts.rs:73:13 | -LL | let _ = &x as &Fn(i32); - | ^^^^^^^^^^^^^^ +LL | let _ = &x as &dyn Fn(i32); + | ^^^^^^^^^^^^^^^^^^ | = help: cast can be replaced by coercion; this might require a temporary variable diff --git a/src/test/ui/type/type-arg-out-of-scope.rs b/src/test/ui/type/type-arg-out-of-scope.rs index d5b815f6a95e9..02aad00770793 100644 --- a/src/test/ui/type/type-arg-out-of-scope.rs +++ b/src/test/ui/type/type-arg-out-of-scope.rs @@ -1,5 +1,5 @@ // error-pattern:can't use generic parameters from outer function fn foo(x: T) { - fn bar(f: Box T>) { } + fn bar(f: Box T>) { } } fn main() { foo(1); } diff --git a/src/test/ui/type/type-arg-out-of-scope.stderr b/src/test/ui/type/type-arg-out-of-scope.stderr index ea991069c08dd..0b6283fbc51e9 100644 --- a/src/test/ui/type/type-arg-out-of-scope.stderr +++ b/src/test/ui/type/type-arg-out-of-scope.stderr @@ -1,20 +1,20 @@ error[E0401]: can't use generic parameters from outer function - --> $DIR/type-arg-out-of-scope.rs:3:25 + --> $DIR/type-arg-out-of-scope.rs:3:29 | LL | fn foo(x: T) { | - type parameter from outer function -LL | fn bar(f: Box T>) { } - | --- ^ use of generic parameter from outer function +LL | fn bar(f: Box T>) { } + | --- ^ use of generic parameter from outer function | | | help: try using a local generic parameter instead: `bar` error[E0401]: can't use generic parameters from outer function - --> $DIR/type-arg-out-of-scope.rs:3:31 + --> $DIR/type-arg-out-of-scope.rs:3:35 | LL | fn foo(x: T) { | - type parameter from outer function -LL | fn bar(f: Box T>) { } - | --- ^ use of generic parameter from outer function +LL | fn bar(f: Box T>) { } + | --- ^ use of generic parameter from outer function | | | help: try using a local generic parameter instead: `bar` diff --git a/src/test/ui/type/type-parameter-defaults-referencing-Self-ppaux.rs b/src/test/ui/type/type-parameter-defaults-referencing-Self-ppaux.rs index 3e1c876c76ba8..444453dc69437 100644 --- a/src/test/ui/type/type-parameter-defaults-referencing-Self-ppaux.rs +++ b/src/test/ui/type/type-parameter-defaults-referencing-Self-ppaux.rs @@ -11,7 +11,7 @@ impl MyAdd for i32 { fn main() { let x: i32 = 5; - let y = x as MyAdd; + let y = x as dyn MyAdd; //~^ ERROR E0038 //~| ERROR cast to unsized type: `i32` as `dyn MyAdd` } diff --git a/src/test/ui/type/type-parameter-defaults-referencing-Self-ppaux.stderr b/src/test/ui/type/type-parameter-defaults-referencing-Self-ppaux.stderr index 0beb9e9eb4b03..58727ea0fef99 100644 --- a/src/test/ui/type/type-parameter-defaults-referencing-Self-ppaux.stderr +++ b/src/test/ui/type/type-parameter-defaults-referencing-Self-ppaux.stderr @@ -1,20 +1,20 @@ error[E0620]: cast to unsized type: `i32` as `dyn MyAdd` --> $DIR/type-parameter-defaults-referencing-Self-ppaux.rs:14:13 | -LL | let y = x as MyAdd; - | ^^^^^^^^^^^^^^^ +LL | let y = x as dyn MyAdd; + | ^^^^^^^^^^^^^^^^^^^ | help: consider using a box or reference as appropriate --> $DIR/type-parameter-defaults-referencing-Self-ppaux.rs:14:13 | -LL | let y = x as MyAdd; +LL | let y = x as dyn MyAdd; | ^ error[E0038]: the trait `MyAdd` cannot be made into an object --> $DIR/type-parameter-defaults-referencing-Self-ppaux.rs:14:18 | -LL | let y = x as MyAdd; - | ^^^^^^^^^^ the trait `MyAdd` cannot be made into an object +LL | let y = x as dyn MyAdd; + | ^^^^^^^^^^^^^^ the trait `MyAdd` cannot be made into an object | = note: method `add` references the `Self` type in its arguments or return type diff --git a/src/test/ui/type/type-parameter-defaults-referencing-Self.rs b/src/test/ui/type/type-parameter-defaults-referencing-Self.rs index 721bf960a55c2..a4c59dced029a 100644 --- a/src/test/ui/type/type-parameter-defaults-referencing-Self.rs +++ b/src/test/ui/type/type-parameter-defaults-referencing-Self.rs @@ -7,7 +7,7 @@ trait Foo { fn method(&self); } -fn foo(x: &Foo) { } +fn foo(x: &dyn Foo) { } //~^ ERROR the type parameter `T` must be explicitly specified fn main() { } diff --git a/src/test/ui/type/type-parameter-defaults-referencing-Self.stderr b/src/test/ui/type/type-parameter-defaults-referencing-Self.stderr index 70093b61f251b..0d6ca9d9dcd9f 100644 --- a/src/test/ui/type/type-parameter-defaults-referencing-Self.stderr +++ b/src/test/ui/type/type-parameter-defaults-referencing-Self.stderr @@ -1,8 +1,8 @@ error[E0393]: the type parameter `T` must be explicitly specified - --> $DIR/type-parameter-defaults-referencing-Self.rs:10:12 + --> $DIR/type-parameter-defaults-referencing-Self.rs:10:16 | -LL | fn foo(x: &Foo) { } - | ^^^ missing reference to `T` +LL | fn foo(x: &dyn Foo) { } + | ^^^ missing reference to `T` | = note: because of the default `Self` reference, type parameters must be specified on object types diff --git a/src/test/ui/typeck/typeck-builtin-bound-type-parameters.rs b/src/test/ui/typeck/typeck-builtin-bound-type-parameters.rs index 7760866436210..f466c19e051ed 100644 --- a/src/test/ui/typeck/typeck-builtin-bound-type-parameters.rs +++ b/src/test/ui/typeck/typeck-builtin-bound-type-parameters.rs @@ -1,7 +1,7 @@ fn foo1, U>(x: T) {} //~^ ERROR wrong number of type arguments: expected 0, found 1 [E0107] -trait Trait: Copy {} +trait Trait: Copy {} //~^ ERROR wrong number of type arguments: expected 0, found 1 [E0107] struct MyStruct1>; diff --git a/src/test/ui/typeck/typeck-builtin-bound-type-parameters.stderr b/src/test/ui/typeck/typeck-builtin-bound-type-parameters.stderr index 0242287a3e5ef..0be1c8ef3bc16 100644 --- a/src/test/ui/typeck/typeck-builtin-bound-type-parameters.stderr +++ b/src/test/ui/typeck/typeck-builtin-bound-type-parameters.stderr @@ -7,8 +7,8 @@ LL | fn foo1, U>(x: T) {} error[E0107]: wrong number of type arguments: expected 0, found 1 --> $DIR/typeck-builtin-bound-type-parameters.rs:4:19 | -LL | trait Trait: Copy {} - | ^^^^ unexpected type argument +LL | trait Trait: Copy {} + | ^^^^^^^^ unexpected type argument error[E0107]: wrong number of type arguments: expected 0, found 1 --> $DIR/typeck-builtin-bound-type-parameters.rs:7:26 diff --git a/src/test/ui/unboxed-closures/unboxed-closure-feature-gate.rs b/src/test/ui/unboxed-closures/unboxed-closure-feature-gate.rs index 1eb9de778e82d..d8b201bf82d3b 100644 --- a/src/test/ui/unboxed-closures/unboxed-closure-feature-gate.rs +++ b/src/test/ui/unboxed-closures/unboxed-closure-feature-gate.rs @@ -10,11 +10,11 @@ trait Foo { } fn main() { - let x: Box; + let x: Box; //~^ ERROR parenthetical notation is only stable when used with `Fn`-family // No errors with these: - let x: Box; - let x: Box; - let x: Box; + let x: Box; + let x: Box; + let x: Box; } diff --git a/src/test/ui/unboxed-closures/unboxed-closure-feature-gate.stderr b/src/test/ui/unboxed-closures/unboxed-closure-feature-gate.stderr index 1604aa4a0f700..c23acbcb311d6 100644 --- a/src/test/ui/unboxed-closures/unboxed-closure-feature-gate.stderr +++ b/src/test/ui/unboxed-closures/unboxed-closure-feature-gate.stderr @@ -1,8 +1,8 @@ error[E0658]: parenthetical notation is only stable when used with `Fn`-family traits - --> $DIR/unboxed-closure-feature-gate.rs:13:16 + --> $DIR/unboxed-closure-feature-gate.rs:13:20 | -LL | let x: Box; - | ^^^^^^^^^^ +LL | let x: Box; + | ^^^^^^^^^^ | = note: for more information, see https://github.com/rust-lang/rust/issues/29625 = help: add #![feature(unboxed_closures)] to the crate attributes to enable diff --git a/src/test/ui/unboxed-closures/unboxed-closure-sugar-default.rs b/src/test/ui/unboxed-closures/unboxed-closure-sugar-default.rs index 044859de6a4a5..f1c83f0606fad 100644 --- a/src/test/ui/unboxed-closures/unboxed-closure-sugar-default.rs +++ b/src/test/ui/unboxed-closures/unboxed-closure-sugar-default.rs @@ -15,14 +15,14 @@ fn eq() where A : Eq { } fn test<'a,'b>() { // Parens are equivalent to omitting default in angle. - eq::< Foo<(isize,),Output=()>, Foo(isize) >(); + eq::, dyn Foo(isize)>(); // In angle version, we supply something other than the default - eq::< Foo<(isize,),isize,Output=()>, Foo(isize) >(); + eq::, dyn Foo(isize)>(); //~^ ERROR E0277 // Supply default explicitly. - eq::< Foo<(isize,),(isize,),Output=()>, Foo(isize) >(); + eq::, dyn Foo(isize)>(); } fn main() { } diff --git a/src/test/ui/unboxed-closures/unboxed-closure-sugar-default.stderr b/src/test/ui/unboxed-closures/unboxed-closure-sugar-default.stderr index ce90f5b9d2486..fd5ef4b9df15a 100644 --- a/src/test/ui/unboxed-closures/unboxed-closure-sugar-default.stderr +++ b/src/test/ui/unboxed-closures/unboxed-closure-sugar-default.stderr @@ -1,8 +1,8 @@ error[E0277]: the trait bound `dyn Foo<(isize,), isize, Output = ()>: Eq>` is not satisfied --> $DIR/unboxed-closure-sugar-default.rs:21:5 | -LL | eq::< Foo<(isize,),isize,Output=()>, Foo(isize) >(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Eq>` is not implemented for `dyn Foo<(isize,), isize, Output = ()>` +LL | eq::, dyn Foo(isize)>(); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Eq>` is not implemented for `dyn Foo<(isize,), isize, Output = ()>` | note: required by `eq` --> $DIR/unboxed-closure-sugar-default.rs:14:1 diff --git a/src/test/ui/unboxed-closures/unboxed-closure-sugar-equiv.rs b/src/test/ui/unboxed-closures/unboxed-closure-sugar-equiv.rs index 95bd391f251b8..0fc3e23ec73ef 100644 --- a/src/test/ui/unboxed-closures/unboxed-closure-sugar-equiv.rs +++ b/src/test/ui/unboxed-closures/unboxed-closure-sugar-equiv.rs @@ -17,31 +17,31 @@ fn eq>() { } fn test<'a,'b>() { // No errors expected: - eq::< Foo<(),Output=()>, Foo() >(); - eq::< Foo<(isize,),Output=()>, Foo(isize) >(); - eq::< Foo<(isize,usize),Output=()>, Foo(isize,usize) >(); - eq::< Foo<(isize,usize),Output=usize>, Foo(isize,usize) -> usize >(); - eq::< Foo<(&'a isize,&'b usize),Output=usize>, Foo(&'a isize,&'b usize) -> usize >(); + eq::< dyn Foo<(),Output=()>, dyn Foo() >(); + eq::< dyn Foo<(isize,),Output=()>, dyn Foo(isize) >(); + eq::< dyn Foo<(isize,usize),Output=()>, dyn Foo(isize,usize) >(); + eq::< dyn Foo<(isize,usize),Output=usize>, dyn Foo(isize,usize) -> usize >(); + eq::< dyn Foo<(&'a isize,&'b usize),Output=usize>, dyn Foo(&'a isize,&'b usize) -> usize >(); // Test that anonymous regions in `()` form are equivalent // to fresh bound regions, and that we can intermingle // named and anonymous as we choose: - eq::< for<'x,'y> Foo<(&'x isize,&'y usize),Output=usize>, - for<'x,'y> Foo(&'x isize,&'y usize) -> usize >(); - eq::< for<'x,'y> Foo<(&'x isize,&'y usize),Output=usize>, - for<'x> Foo(&'x isize,&usize) -> usize >(); - eq::< for<'x,'y> Foo<(&'x isize,&'y usize),Output=usize>, - for<'y> Foo(&isize,&'y usize) -> usize >(); - eq::< for<'x,'y> Foo<(&'x isize,&'y usize),Output=usize>, - Foo(&isize,&usize) -> usize >(); + eq::< dyn for<'x,'y> Foo<(&'x isize,&'y usize),Output=usize>, + dyn for<'x,'y> Foo(&'x isize,&'y usize) -> usize >(); + eq::< dyn for<'x,'y> Foo<(&'x isize,&'y usize),Output=usize>, + dyn for<'x> Foo(&'x isize,&usize) -> usize >(); + eq::< dyn for<'x,'y> Foo<(&'x isize,&'y usize),Output=usize>, + dyn for<'y> Foo(&isize,&'y usize) -> usize >(); + eq::< dyn for<'x,'y> Foo<(&'x isize,&'y usize),Output=usize>, + dyn Foo(&isize,&usize) -> usize >(); // lifetime elision - eq::< for<'x> Foo<(&'x isize,), Output=&'x isize>, - Foo(&isize) -> &isize >(); + eq::< dyn for<'x> Foo<(&'x isize,), Output=&'x isize>, + dyn Foo(&isize) -> &isize >(); // Errors expected: - eq::< Foo<(),Output=()>, - Foo(char) >(); + eq::< dyn Foo<(),Output=()>, + dyn Foo(char) >(); //~^^ ERROR E0277 } diff --git a/src/test/ui/unboxed-closures/unboxed-closure-sugar-equiv.stderr b/src/test/ui/unboxed-closures/unboxed-closure-sugar-equiv.stderr index 857a32ca69e73..005a86bc2178b 100644 --- a/src/test/ui/unboxed-closures/unboxed-closure-sugar-equiv.stderr +++ b/src/test/ui/unboxed-closures/unboxed-closure-sugar-equiv.stderr @@ -1,9 +1,9 @@ error[E0277]: the trait bound `dyn Foo<(char,), Output = ()>: Eq>` is not satisfied --> $DIR/unboxed-closure-sugar-equiv.rs:43:5 | -LL | / eq::< Foo<(),Output=()>, -LL | | Foo(char) >(); - | |___________________________________________________________________^ the trait `Eq>` is not implemented for `dyn Foo<(char,), Output = ()>` +LL | / eq::< dyn Foo<(),Output=()>, +LL | | dyn Foo(char) >(); + | |_______________________________________________________________________^ the trait `Eq>` is not implemented for `dyn Foo<(char,), Output = ()>` | note: required by `eq` --> $DIR/unboxed-closure-sugar-equiv.rs:16:1 diff --git a/src/test/ui/unboxed-closures/unboxed-closure-sugar-lifetime-elision.rs b/src/test/ui/unboxed-closures/unboxed-closure-sugar-lifetime-elision.rs index b61d8b8c8c790..d11d663f17261 100644 --- a/src/test/ui/unboxed-closures/unboxed-closure-sugar-lifetime-elision.rs +++ b/src/test/ui/unboxed-closures/unboxed-closure-sugar-lifetime-elision.rs @@ -18,10 +18,10 @@ impl Eq for X { } fn eq>() { } fn main() { - eq::< for<'a> Foo<(&'a isize,), Output=&'a isize>, - Foo(&isize) -> &isize >(); - eq::< for<'a> Foo<(&'a isize,), Output=(&'a isize, &'a isize)>, - Foo(&isize) -> (&isize, &isize) >(); + eq::< dyn for<'a> Foo<(&'a isize,), Output=&'a isize>, + dyn Foo(&isize) -> &isize >(); + eq::< dyn for<'a> Foo<(&'a isize,), Output=(&'a isize, &'a isize)>, + dyn Foo(&isize) -> (&isize, &isize) >(); - let _: Foo(&isize, &usize) -> &usize; //~ ERROR missing lifetime specifier + let _: dyn Foo(&isize, &usize) -> &usize; //~ ERROR missing lifetime specifier } diff --git a/src/test/ui/unboxed-closures/unboxed-closure-sugar-lifetime-elision.stderr b/src/test/ui/unboxed-closures/unboxed-closure-sugar-lifetime-elision.stderr index 8c3480744fe3d..9fb9a07166f84 100644 --- a/src/test/ui/unboxed-closures/unboxed-closure-sugar-lifetime-elision.stderr +++ b/src/test/ui/unboxed-closures/unboxed-closure-sugar-lifetime-elision.stderr @@ -1,8 +1,8 @@ error[E0106]: missing lifetime specifier - --> $DIR/unboxed-closure-sugar-lifetime-elision.rs:26:35 + --> $DIR/unboxed-closure-sugar-lifetime-elision.rs:26:39 | -LL | let _: Foo(&isize, &usize) -> &usize; - | ^ expected lifetime parameter +LL | let _: dyn Foo(&isize, &usize) -> &usize; + | ^ expected lifetime parameter | = help: this function's return type contains a borrowed value, but the signature does not say whether it is borrowed from argument 1 or argument 2 diff --git a/src/test/ui/unboxed-closures/unboxed-closure-sugar-not-used-on-fn.rs b/src/test/ui/unboxed-closures/unboxed-closure-sugar-not-used-on-fn.rs index 09927a940192a..6d6ed4b568f0b 100644 --- a/src/test/ui/unboxed-closures/unboxed-closure-sugar-not-used-on-fn.rs +++ b/src/test/ui/unboxed-closures/unboxed-closure-sugar-not-used-on-fn.rs @@ -1,6 +1,6 @@ // Test that the `Fn` traits require `()` form without a feature gate. -fn bar1(x: &Fn<(), Output=()>) { +fn bar1(x: &dyn Fn<(), Output=()>) { //~^ ERROR of `Fn`-family traits' type parameters is subject to change } diff --git a/src/test/ui/unboxed-closures/unboxed-closure-sugar-not-used-on-fn.stderr b/src/test/ui/unboxed-closures/unboxed-closure-sugar-not-used-on-fn.stderr index 0901126a3fec3..e1ed85d4f4672 100644 --- a/src/test/ui/unboxed-closures/unboxed-closure-sugar-not-used-on-fn.stderr +++ b/src/test/ui/unboxed-closures/unboxed-closure-sugar-not-used-on-fn.stderr @@ -1,8 +1,8 @@ error[E0658]: the precise format of `Fn`-family traits' type parameters is subject to change. Use parenthetical notation (Fn(Foo, Bar) -> Baz) instead - --> $DIR/unboxed-closure-sugar-not-used-on-fn.rs:3:13 + --> $DIR/unboxed-closure-sugar-not-used-on-fn.rs:3:17 | -LL | fn bar1(x: &Fn<(), Output=()>) { - | ^^^^^^^^^^^^^^^^^ +LL | fn bar1(x: &dyn Fn<(), Output=()>) { + | ^^^^^^^^^^^^^^^^^ | = note: for more information, see https://github.com/rust-lang/rust/issues/29625 = help: add #![feature(unboxed_closures)] to the crate attributes to enable diff --git a/src/test/ui/unboxed-closures/unboxed-closure-sugar-region.rs b/src/test/ui/unboxed-closures/unboxed-closure-sugar-region.rs index 799d9f33e2e9d..76c928d7b6ab5 100644 --- a/src/test/ui/unboxed-closures/unboxed-closure-sugar-region.rs +++ b/src/test/ui/unboxed-closures/unboxed-closure-sugar-region.rs @@ -20,14 +20,14 @@ fn same_type>(a: A, b: B) { } fn test<'a,'b>() { // Parens are equivalent to omitting default in angle. - eq::< Foo<(isize,),Output=()>, Foo(isize) >(); + eq::< dyn Foo<(isize,),Output=()>, dyn Foo(isize) >(); // Here we specify 'static explicitly in angle-bracket version. // Parenthesized winds up getting inferred. - eq::< Foo<'static, (isize,),Output=()>, Foo(isize) >(); + eq::< dyn Foo<'static, (isize,),Output=()>, dyn Foo(isize) >(); } -fn test2(x: &Foo<(isize,),Output=()>, y: &Foo(isize)) { +fn test2(x: &dyn Foo<(isize,),Output=()>, y: &dyn Foo(isize)) { //~^ ERROR wrong number of lifetime arguments: expected 1, found 0 // Here, the omitted lifetimes are expanded to distinct things. same_type(x, y) diff --git a/src/test/ui/unboxed-closures/unboxed-closure-sugar-region.stderr b/src/test/ui/unboxed-closures/unboxed-closure-sugar-region.stderr index 8eed7d58c4666..e9d51983a7a48 100644 --- a/src/test/ui/unboxed-closures/unboxed-closure-sugar-region.stderr +++ b/src/test/ui/unboxed-closures/unboxed-closure-sugar-region.stderr @@ -1,8 +1,8 @@ error[E0107]: wrong number of lifetime arguments: expected 1, found 0 - --> $DIR/unboxed-closure-sugar-region.rs:30:43 + --> $DIR/unboxed-closure-sugar-region.rs:30:51 | -LL | fn test2(x: &Foo<(isize,),Output=()>, y: &Foo(isize)) { - | ^^^^^^^^^^ expected 1 lifetime argument +LL | fn test2(x: &dyn Foo<(isize,),Output=()>, y: &dyn Foo(isize)) { + | ^^^^^^^^^^ expected 1 lifetime argument error: aborting due to previous error diff --git a/src/test/ui/unboxed-closures/unboxed-closure-sugar-wrong-number-number-type-parameters-1.rs b/src/test/ui/unboxed-closures/unboxed-closure-sugar-wrong-number-number-type-parameters-1.rs index df0c495a11cc6..a6c86311b3772 100644 --- a/src/test/ui/unboxed-closures/unboxed-closure-sugar-wrong-number-number-type-parameters-1.rs +++ b/src/test/ui/unboxed-closures/unboxed-closure-sugar-wrong-number-number-type-parameters-1.rs @@ -2,7 +2,7 @@ trait One { fn foo(&self) -> A; } -fn foo(_: &One()) //~ ERROR associated type `Output` not found for `One<()>` +fn foo(_: &dyn One()) //~ ERROR associated type `Output` not found for `One<()>` {} fn main() { } diff --git a/src/test/ui/unboxed-closures/unboxed-closure-sugar-wrong-number-number-type-parameters-1.stderr b/src/test/ui/unboxed-closures/unboxed-closure-sugar-wrong-number-number-type-parameters-1.stderr index 304339c89e644..c59082932ddfe 100644 --- a/src/test/ui/unboxed-closures/unboxed-closure-sugar-wrong-number-number-type-parameters-1.stderr +++ b/src/test/ui/unboxed-closures/unboxed-closure-sugar-wrong-number-number-type-parameters-1.stderr @@ -1,8 +1,8 @@ error[E0220]: associated type `Output` not found for `One<()>` - --> $DIR/unboxed-closure-sugar-wrong-number-number-type-parameters-1.rs:5:15 + --> $DIR/unboxed-closure-sugar-wrong-number-number-type-parameters-1.rs:5:19 | -LL | fn foo(_: &One()) - | ^^ associated type `Output` not found +LL | fn foo(_: &dyn One()) + | ^^ associated type `Output` not found error: aborting due to previous error diff --git a/src/test/ui/unboxed-closures/unboxed-closure-sugar-wrong-number-number-type-parameters-3.rs b/src/test/ui/unboxed-closures/unboxed-closure-sugar-wrong-number-number-type-parameters-3.rs index 5f5ad7902aa3e..01c76d64c6ba0 100644 --- a/src/test/ui/unboxed-closures/unboxed-closure-sugar-wrong-number-number-type-parameters-3.rs +++ b/src/test/ui/unboxed-closures/unboxed-closure-sugar-wrong-number-number-type-parameters-3.rs @@ -2,7 +2,7 @@ trait Three { fn dummy(&self) -> (A,B,C); } -fn foo(_: &Three()) +fn foo(_: &dyn Three()) //~^ ERROR wrong number of type arguments //~| ERROR associated type `Output` not found {} diff --git a/src/test/ui/unboxed-closures/unboxed-closure-sugar-wrong-number-number-type-parameters-3.stderr b/src/test/ui/unboxed-closures/unboxed-closure-sugar-wrong-number-number-type-parameters-3.stderr index 62b3a25443055..6c61e74584a50 100644 --- a/src/test/ui/unboxed-closures/unboxed-closure-sugar-wrong-number-number-type-parameters-3.stderr +++ b/src/test/ui/unboxed-closures/unboxed-closure-sugar-wrong-number-number-type-parameters-3.stderr @@ -1,14 +1,14 @@ error[E0107]: wrong number of type arguments: expected 3, found 1 - --> $DIR/unboxed-closure-sugar-wrong-number-number-type-parameters-3.rs:5:12 + --> $DIR/unboxed-closure-sugar-wrong-number-number-type-parameters-3.rs:5:16 | -LL | fn foo(_: &Three()) - | ^^^^^^^ expected 3 type arguments +LL | fn foo(_: &dyn Three()) + | ^^^^^^^ expected 3 type arguments error[E0220]: associated type `Output` not found for `Three<(), [type error], [type error]>` - --> $DIR/unboxed-closure-sugar-wrong-number-number-type-parameters-3.rs:5:17 + --> $DIR/unboxed-closure-sugar-wrong-number-number-type-parameters-3.rs:5:21 | -LL | fn foo(_: &Three()) - | ^^ associated type `Output` not found +LL | fn foo(_: &dyn Three()) + | ^^ associated type `Output` not found error: aborting due to 2 previous errors diff --git a/src/test/ui/unboxed-closures/unboxed-closure-sugar-wrong-number-number-type-parameters.rs b/src/test/ui/unboxed-closures/unboxed-closure-sugar-wrong-number-number-type-parameters.rs index 2e87d91f8bdc0..bc9901c795b3a 100644 --- a/src/test/ui/unboxed-closures/unboxed-closure-sugar-wrong-number-number-type-parameters.rs +++ b/src/test/ui/unboxed-closures/unboxed-closure-sugar-wrong-number-number-type-parameters.rs @@ -2,7 +2,7 @@ trait Zero { fn dummy(&self); } -fn foo(_: Zero()) +fn foo(_: dyn Zero()) //~^ ERROR wrong number of type arguments //~| ERROR associated type `Output` not found for `Zero` {} diff --git a/src/test/ui/unboxed-closures/unboxed-closure-sugar-wrong-number-number-type-parameters.stderr b/src/test/ui/unboxed-closures/unboxed-closure-sugar-wrong-number-number-type-parameters.stderr index b64fc61cc8568..b96e2cbc36bb4 100644 --- a/src/test/ui/unboxed-closures/unboxed-closure-sugar-wrong-number-number-type-parameters.stderr +++ b/src/test/ui/unboxed-closures/unboxed-closure-sugar-wrong-number-number-type-parameters.stderr @@ -1,14 +1,14 @@ error[E0107]: wrong number of type arguments: expected 0, found 1 - --> $DIR/unboxed-closure-sugar-wrong-number-number-type-parameters.rs:5:15 + --> $DIR/unboxed-closure-sugar-wrong-number-number-type-parameters.rs:5:19 | -LL | fn foo(_: Zero()) - | ^^ unexpected type argument +LL | fn foo(_: dyn Zero()) + | ^^ unexpected type argument error[E0220]: associated type `Output` not found for `Zero` - --> $DIR/unboxed-closure-sugar-wrong-number-number-type-parameters.rs:5:15 + --> $DIR/unboxed-closure-sugar-wrong-number-number-type-parameters.rs:5:19 | -LL | fn foo(_: Zero()) - | ^^ associated type `Output` not found +LL | fn foo(_: dyn Zero()) + | ^^ associated type `Output` not found error: aborting due to 2 previous errors diff --git a/src/test/ui/unboxed-closures/unboxed-closures-failed-recursive-fn-1.rs b/src/test/ui/unboxed-closures/unboxed-closures-failed-recursive-fn-1.rs index 82dc536bb5693..1358ba0f953e8 100644 --- a/src/test/ui/unboxed-closures/unboxed-closures-failed-recursive-fn-1.rs +++ b/src/test/ui/unboxed-closures/unboxed-closures-failed-recursive-fn-1.rs @@ -9,7 +9,7 @@ fn a() { // iteration, but it still doesn't work. The weird structure with // the `Option` is to avoid giving any useful hints about the `Fn` // kind via the expected type. - let mut factorial: Option u32>> = None; + let mut factorial: Option u32>> = None; let f = |x: u32| -> u32 { let g = factorial.as_ref().unwrap(); @@ -22,7 +22,7 @@ fn a() { } fn b() { - let mut factorial: Option u32 + 'static>> = None; + let mut factorial: Option u32 + 'static>> = None; let f = |x: u32| -> u32 { let g = factorial.as_ref().unwrap(); diff --git a/src/test/ui/unboxed-closures/unboxed-closures-failed-recursive-fn-1.stderr b/src/test/ui/unboxed-closures/unboxed-closures-failed-recursive-fn-1.stderr index 8d39fb026b3d7..0466887e371e9 100644 --- a/src/test/ui/unboxed-closures/unboxed-closures-failed-recursive-fn-1.stderr +++ b/src/test/ui/unboxed-closures/unboxed-closures-failed-recursive-fn-1.stderr @@ -29,8 +29,8 @@ LL | factorial = Some(Box::new(f)); error[E0597]: `factorial` does not live long enough --> $DIR/unboxed-closures-failed-recursive-fn-1.rs:28:17 | -LL | let mut factorial: Option u32 + 'static>> = None; - | ------------------------------------- type annotation requires that `factorial` is borrowed for `'static` +LL | let mut factorial: Option u32 + 'static>> = None; + | ----------------------------------------- type annotation requires that `factorial` is borrowed for `'static` LL | LL | let f = |x: u32| -> u32 { | --------------- value captured here @@ -43,8 +43,8 @@ LL | } error[E0506]: cannot assign to `factorial` because it is borrowed --> $DIR/unboxed-closures-failed-recursive-fn-1.rs:33:5 | -LL | let mut factorial: Option u32 + 'static>> = None; - | ------------------------------------- type annotation requires that `factorial` is borrowed for `'static` +LL | let mut factorial: Option u32 + 'static>> = None; + | ----------------------------------------- type annotation requires that `factorial` is borrowed for `'static` LL | LL | let f = |x: u32| -> u32 { | --------------- borrow of `factorial` occurs here diff --git a/src/test/ui/unboxed-closures/unboxed-closures-recursive-fn-using-fn-mut.rs b/src/test/ui/unboxed-closures/unboxed-closures-recursive-fn-using-fn-mut.rs index 0beead1ad92c3..6a707b2096d44 100644 --- a/src/test/ui/unboxed-closures/unboxed-closures-recursive-fn-using-fn-mut.rs +++ b/src/test/ui/unboxed-closures/unboxed-closures-recursive-fn-using-fn-mut.rs @@ -17,14 +17,14 @@ impl YCombinator { } } -impl R, A) -> R> FnMut<(A,)> for YCombinator { +impl R, A) -> R> FnMut<(A,)> for YCombinator { extern "rust-call" fn call_mut(&mut self, (arg,): (A,)) -> R { (self.func)(self, arg) //~^ ERROR cannot borrow `*self` as mutable more than once at a time } } -impl R, A) -> R> FnOnce<(A,)> for YCombinator { +impl R, A) -> R> FnOnce<(A,)> for YCombinator { type Output = R; extern "rust-call" fn call_once(mut self, args: (A,)) -> R { self.call_mut(args) @@ -33,7 +33,7 @@ impl R, A) -> R> FnOnce<(A,)> for YCombinator u32, arg: u32| -> u32 { + let factorial = |recur: &mut dyn FnMut(u32) -> u32, arg: u32| -> u32 { counter += 1; if arg == 0 {1} else {arg * recur(arg-1)} }; diff --git a/src/test/ui/underscore-lifetime/underscore-lifetime-binders.rs b/src/test/ui/underscore-lifetime/underscore-lifetime-binders.rs index 614f7e49f8757..3d049cc5639c0 100644 --- a/src/test/ui/underscore-lifetime/underscore-lifetime-binders.rs +++ b/src/test/ui/underscore-lifetime/underscore-lifetime-binders.rs @@ -7,7 +7,7 @@ fn foo<'_> //~ ERROR cannot be used here trait Meh<'a> {} impl<'a> Meh<'a> for u8 {} -fn meh() -> Box Meh<'_>> //~ ERROR cannot be used here +fn meh() -> Box Meh<'_>> //~ ERROR cannot be used here //~^ ERROR missing lifetime specifier { Box::new(5u8) diff --git a/src/test/ui/underscore-lifetime/underscore-lifetime-binders.stderr b/src/test/ui/underscore-lifetime/underscore-lifetime-binders.stderr index 936e3ba55fea1..654f4285f655f 100644 --- a/src/test/ui/underscore-lifetime/underscore-lifetime-binders.stderr +++ b/src/test/ui/underscore-lifetime/underscore-lifetime-binders.stderr @@ -5,10 +5,10 @@ LL | fn foo<'_> | ^^ `'_` is a reserved lifetime name error[E0637]: `'_` cannot be used here - --> $DIR/underscore-lifetime-binders.rs:10:21 + --> $DIR/underscore-lifetime-binders.rs:10:25 | -LL | fn meh() -> Box Meh<'_>> - | ^^ `'_` is a reserved lifetime name +LL | fn meh() -> Box Meh<'_>> + | ^^ `'_` is a reserved lifetime name error[E0106]: missing lifetime specifier --> $DIR/underscore-lifetime-binders.rs:2:17 @@ -17,10 +17,10 @@ LL | struct Baz<'a>(&'_ &'a u8); | ^^ expected lifetime parameter error[E0106]: missing lifetime specifier - --> $DIR/underscore-lifetime-binders.rs:10:29 + --> $DIR/underscore-lifetime-binders.rs:10:33 | -LL | fn meh() -> Box Meh<'_>> - | ^^ help: consider giving it a 'static lifetime: `'static` +LL | fn meh() -> Box Meh<'_>> + | ^^ help: consider giving it a 'static lifetime: `'static` | = help: this function's return type contains a borrowed value, but there is no value for it to be borrowed from diff --git a/src/test/ui/unique-object-noncopyable.rs b/src/test/ui/unique-object-noncopyable.rs index 1c467a2421a2a..dd38a7190aa0e 100644 --- a/src/test/ui/unique-object-noncopyable.rs +++ b/src/test/ui/unique-object-noncopyable.rs @@ -20,6 +20,6 @@ impl Foo for Bar { fn main() { let x = box Bar { x: 10 }; - let y: Box = x as Box; + let y: Box = x as Box; let _z = y.clone(); //~ ERROR no method named `clone` found } diff --git a/src/test/ui/unsized/unsized-enum2.rs b/src/test/ui/unsized/unsized-enum2.rs index 60bfb5cb6402a..d589f5ae582c6 100644 --- a/src/test/ui/unsized/unsized-enum2.rs +++ b/src/test/ui/unsized/unsized-enum2.rs @@ -13,10 +13,10 @@ trait PathHelper2 {} trait PathHelper3 {} trait PathHelper4 {} -struct Path1(PathHelper1); -struct Path2(PathHelper2); -struct Path3(PathHelper3); -struct Path4(PathHelper4); +struct Path1(dyn PathHelper1); +struct Path2(dyn PathHelper2); +struct Path3(dyn PathHelper3); +struct Path4(dyn PathHelper4); enum E { // parameter @@ -50,13 +50,13 @@ enum E { //~^ ERROR the size for values of type // plain trait - VM(Foo), + VM(dyn Foo), //~^ ERROR the size for values of type - VN{x: Bar}, + VN{x: dyn Bar}, //~^ ERROR the size for values of type - VO(isize, FooBar), + VO(isize, dyn FooBar), //~^ ERROR the size for values of type - VP{u: isize, x: BarFoo}, + VP{u: isize, x: dyn BarFoo}, //~^ ERROR the size for values of type // projected diff --git a/src/test/ui/unsized/unsized-enum2.stderr b/src/test/ui/unsized/unsized-enum2.stderr index 9109366e4fcfd..cdd5747d86b0f 100644 --- a/src/test/ui/unsized/unsized-enum2.stderr +++ b/src/test/ui/unsized/unsized-enum2.stderr @@ -85,8 +85,8 @@ LL | VH{u: isize, x: [u32]}, error[E0277]: the size for values of type `(dyn Foo + 'static)` cannot be known at compilation time --> $DIR/unsized-enum2.rs:53:8 | -LL | VM(Foo), - | ^^^ doesn't have a size known at compile-time +LL | VM(dyn Foo), + | ^^^^^^^ doesn't have a size known at compile-time | = help: the trait `std::marker::Sized` is not implemented for `(dyn Foo + 'static)` = note: to learn more, visit @@ -95,8 +95,8 @@ LL | VM(Foo), error[E0277]: the size for values of type `(dyn Bar + 'static)` cannot be known at compilation time --> $DIR/unsized-enum2.rs:55:8 | -LL | VN{x: Bar}, - | ^^^^^^ doesn't have a size known at compile-time +LL | VN{x: dyn Bar}, + | ^^^^^^^^^^ doesn't have a size known at compile-time | = help: the trait `std::marker::Sized` is not implemented for `(dyn Bar + 'static)` = note: to learn more, visit @@ -105,8 +105,8 @@ LL | VN{x: Bar}, error[E0277]: the size for values of type `(dyn FooBar + 'static)` cannot be known at compilation time --> $DIR/unsized-enum2.rs:57:15 | -LL | VO(isize, FooBar), - | ^^^^^^ doesn't have a size known at compile-time +LL | VO(isize, dyn FooBar), + | ^^^^^^^^^^ doesn't have a size known at compile-time | = help: the trait `std::marker::Sized` is not implemented for `(dyn FooBar + 'static)` = note: to learn more, visit @@ -115,8 +115,8 @@ LL | VO(isize, FooBar), error[E0277]: the size for values of type `(dyn BarFoo + 'static)` cannot be known at compilation time --> $DIR/unsized-enum2.rs:59:18 | -LL | VP{u: isize, x: BarFoo}, - | ^^^^^^^^^ doesn't have a size known at compile-time +LL | VP{u: isize, x: dyn BarFoo}, + | ^^^^^^^^^^^^^ doesn't have a size known at compile-time | = help: the trait `std::marker::Sized` is not implemented for `(dyn BarFoo + 'static)` = note: to learn more, visit diff --git a/src/test/ui/use/use-after-move-implicity-coerced-object.rs b/src/test/ui/use/use-after-move-implicity-coerced-object.rs index 2e465ee896268..76487ef1c1409 100644 --- a/src/test/ui/use/use-after-move-implicity-coerced-object.rs +++ b/src/test/ui/use/use-after-move-implicity-coerced-object.rs @@ -13,10 +13,10 @@ impl fmt::Display for Number { } struct List { - list: Vec> } + list: Vec> } impl List { - fn push(&mut self, n: Box) { + fn push(&mut self, n: Box) { self.list.push(n); } } diff --git a/src/test/ui/variance/variance-contravariant-arg-object.nll.stderr b/src/test/ui/variance/variance-contravariant-arg-object.nll.stderr index 8b5ecbe56ff2d..69818aedd154c 100644 --- a/src/test/ui/variance/variance-contravariant-arg-object.nll.stderr +++ b/src/test/ui/variance/variance-contravariant-arg-object.nll.stderr @@ -1,7 +1,7 @@ error: lifetime may not live long enough --> $DIR/variance-contravariant-arg-object.rs:14:5 | -LL | fn get_min_from_max<'min, 'max>(v: Box>) +LL | fn get_min_from_max<'min, 'max>(v: Box>) | ---- ---- lifetime `'max` defined here | | | lifetime `'min` defined here @@ -12,7 +12,7 @@ LL | v error: lifetime may not live long enough --> $DIR/variance-contravariant-arg-object.rs:22:5 | -LL | fn get_max_from_min<'min, 'max, G>(v: Box>) +LL | fn get_max_from_min<'min, 'max, G>(v: Box>) | ---- ---- lifetime `'max` defined here | | | lifetime `'min` defined here diff --git a/src/test/ui/variance/variance-contravariant-arg-object.rs b/src/test/ui/variance/variance-contravariant-arg-object.rs index 27e5675dcde87..947f4cd8b8f4d 100644 --- a/src/test/ui/variance/variance-contravariant-arg-object.rs +++ b/src/test/ui/variance/variance-contravariant-arg-object.rs @@ -7,15 +7,15 @@ trait Get : 'static { fn get(&self, t: T); } -fn get_min_from_max<'min, 'max>(v: Box>) - -> Box> +fn get_min_from_max<'min, 'max>(v: Box>) + -> Box> where 'max : 'min { v //~ ERROR mismatched types } -fn get_max_from_min<'min, 'max, G>(v: Box>) - -> Box> +fn get_max_from_min<'min, 'max, G>(v: Box>) + -> Box> where 'max : 'min { // Previously OK: diff --git a/src/test/ui/variance/variance-contravariant-arg-object.stderr b/src/test/ui/variance/variance-contravariant-arg-object.stderr index beac05e04a8e3..263c849e19981 100644 --- a/src/test/ui/variance/variance-contravariant-arg-object.stderr +++ b/src/test/ui/variance/variance-contravariant-arg-object.stderr @@ -9,12 +9,12 @@ LL | v note: the lifetime 'min as defined on the function body at 10:21... --> $DIR/variance-contravariant-arg-object.rs:10:21 | -LL | fn get_min_from_max<'min, 'max>(v: Box>) +LL | fn get_min_from_max<'min, 'max>(v: Box>) | ^^^^ note: ...does not necessarily outlive the lifetime 'max as defined on the function body at 10:27 --> $DIR/variance-contravariant-arg-object.rs:10:27 | -LL | fn get_min_from_max<'min, 'max>(v: Box>) +LL | fn get_min_from_max<'min, 'max>(v: Box>) | ^^^^ error[E0308]: mismatched types @@ -28,12 +28,12 @@ LL | v note: the lifetime 'min as defined on the function body at 17:21... --> $DIR/variance-contravariant-arg-object.rs:17:21 | -LL | fn get_max_from_min<'min, 'max, G>(v: Box>) +LL | fn get_max_from_min<'min, 'max, G>(v: Box>) | ^^^^ note: ...does not necessarily outlive the lifetime 'max as defined on the function body at 17:27 --> $DIR/variance-contravariant-arg-object.rs:17:27 | -LL | fn get_max_from_min<'min, 'max, G>(v: Box>) +LL | fn get_max_from_min<'min, 'max, G>(v: Box>) | ^^^^ error: aborting due to 2 previous errors diff --git a/src/test/ui/variance/variance-covariant-arg-object.nll.stderr b/src/test/ui/variance/variance-covariant-arg-object.nll.stderr index acf9f2e060ce9..63ab7fe96512d 100644 --- a/src/test/ui/variance/variance-covariant-arg-object.nll.stderr +++ b/src/test/ui/variance/variance-covariant-arg-object.nll.stderr @@ -1,7 +1,7 @@ error: lifetime may not live long enough --> $DIR/variance-covariant-arg-object.rs:15:5 | -LL | fn get_min_from_max<'min, 'max>(v: Box>) +LL | fn get_min_from_max<'min, 'max>(v: Box>) | ---- ---- lifetime `'max` defined here | | | lifetime `'min` defined here @@ -12,7 +12,7 @@ LL | v error: lifetime may not live long enough --> $DIR/variance-covariant-arg-object.rs:22:5 | -LL | fn get_max_from_min<'min, 'max, G>(v: Box>) +LL | fn get_max_from_min<'min, 'max, G>(v: Box>) | ---- ---- lifetime `'max` defined here | | | lifetime `'min` defined here diff --git a/src/test/ui/variance/variance-covariant-arg-object.rs b/src/test/ui/variance/variance-covariant-arg-object.rs index 4b371841654f2..7cbf65ae3d924 100644 --- a/src/test/ui/variance/variance-covariant-arg-object.rs +++ b/src/test/ui/variance/variance-covariant-arg-object.rs @@ -7,16 +7,16 @@ trait Get : 'static { fn get(&self) -> T; } -fn get_min_from_max<'min, 'max>(v: Box>) - -> Box> +fn get_min_from_max<'min, 'max>(v: Box>) + -> Box> where 'max : 'min { // Previously OK, now an error as traits are invariant. v //~ ERROR mismatched types } -fn get_max_from_min<'min, 'max, G>(v: Box>) - -> Box> +fn get_max_from_min<'min, 'max, G>(v: Box>) + -> Box> where 'max : 'min { v //~ ERROR mismatched types diff --git a/src/test/ui/variance/variance-covariant-arg-object.stderr b/src/test/ui/variance/variance-covariant-arg-object.stderr index cdcc7a6fd55a6..94f80c2b657f5 100644 --- a/src/test/ui/variance/variance-covariant-arg-object.stderr +++ b/src/test/ui/variance/variance-covariant-arg-object.stderr @@ -9,12 +9,12 @@ LL | v note: the lifetime 'min as defined on the function body at 10:21... --> $DIR/variance-covariant-arg-object.rs:10:21 | -LL | fn get_min_from_max<'min, 'max>(v: Box>) +LL | fn get_min_from_max<'min, 'max>(v: Box>) | ^^^^ note: ...does not necessarily outlive the lifetime 'max as defined on the function body at 10:27 --> $DIR/variance-covariant-arg-object.rs:10:27 | -LL | fn get_min_from_max<'min, 'max>(v: Box>) +LL | fn get_min_from_max<'min, 'max>(v: Box>) | ^^^^ error[E0308]: mismatched types @@ -28,12 +28,12 @@ LL | v note: the lifetime 'min as defined on the function body at 18:21... --> $DIR/variance-covariant-arg-object.rs:18:21 | -LL | fn get_max_from_min<'min, 'max, G>(v: Box>) +LL | fn get_max_from_min<'min, 'max, G>(v: Box>) | ^^^^ note: ...does not necessarily outlive the lifetime 'max as defined on the function body at 18:27 --> $DIR/variance-covariant-arg-object.rs:18:27 | -LL | fn get_max_from_min<'min, 'max, G>(v: Box>) +LL | fn get_max_from_min<'min, 'max, G>(v: Box>) | ^^^^ error: aborting due to 2 previous errors diff --git a/src/test/ui/variance/variance-invariant-arg-object.nll.stderr b/src/test/ui/variance/variance-invariant-arg-object.nll.stderr index 3c1ee7fc707f8..fe2f35b63b57d 100644 --- a/src/test/ui/variance/variance-invariant-arg-object.nll.stderr +++ b/src/test/ui/variance/variance-invariant-arg-object.nll.stderr @@ -1,7 +1,7 @@ error: lifetime may not live long enough --> $DIR/variance-invariant-arg-object.rs:11:5 | -LL | fn get_min_from_max<'min, 'max>(v: Box>) +LL | fn get_min_from_max<'min, 'max>(v: Box>) | ---- ---- lifetime `'max` defined here | | | lifetime `'min` defined here @@ -12,7 +12,7 @@ LL | v error: lifetime may not live long enough --> $DIR/variance-invariant-arg-object.rs:18:5 | -LL | fn get_max_from_min<'min, 'max, G>(v: Box>) +LL | fn get_max_from_min<'min, 'max, G>(v: Box>) | ---- ---- lifetime `'max` defined here | | | lifetime `'min` defined here diff --git a/src/test/ui/variance/variance-invariant-arg-object.rs b/src/test/ui/variance/variance-invariant-arg-object.rs index 91f5982e5339f..886d263c45768 100644 --- a/src/test/ui/variance/variance-invariant-arg-object.rs +++ b/src/test/ui/variance/variance-invariant-arg-object.rs @@ -4,15 +4,15 @@ trait Get : 'static { fn get(&self, t: T) -> T; } -fn get_min_from_max<'min, 'max>(v: Box>) - -> Box> +fn get_min_from_max<'min, 'max>(v: Box>) + -> Box> where 'max : 'min { v //~ ERROR mismatched types } -fn get_max_from_min<'min, 'max, G>(v: Box>) - -> Box> +fn get_max_from_min<'min, 'max, G>(v: Box>) + -> Box> where 'max : 'min { v //~ ERROR mismatched types diff --git a/src/test/ui/variance/variance-invariant-arg-object.stderr b/src/test/ui/variance/variance-invariant-arg-object.stderr index e2ee35de1a278..50a8697d4392f 100644 --- a/src/test/ui/variance/variance-invariant-arg-object.stderr +++ b/src/test/ui/variance/variance-invariant-arg-object.stderr @@ -9,12 +9,12 @@ LL | v note: the lifetime 'min as defined on the function body at 7:21... --> $DIR/variance-invariant-arg-object.rs:7:21 | -LL | fn get_min_from_max<'min, 'max>(v: Box>) +LL | fn get_min_from_max<'min, 'max>(v: Box>) | ^^^^ note: ...does not necessarily outlive the lifetime 'max as defined on the function body at 7:27 --> $DIR/variance-invariant-arg-object.rs:7:27 | -LL | fn get_min_from_max<'min, 'max>(v: Box>) +LL | fn get_min_from_max<'min, 'max>(v: Box>) | ^^^^ error[E0308]: mismatched types @@ -28,12 +28,12 @@ LL | v note: the lifetime 'min as defined on the function body at 14:21... --> $DIR/variance-invariant-arg-object.rs:14:21 | -LL | fn get_max_from_min<'min, 'max, G>(v: Box>) +LL | fn get_max_from_min<'min, 'max, G>(v: Box>) | ^^^^ note: ...does not necessarily outlive the lifetime 'max as defined on the function body at 14:27 --> $DIR/variance-invariant-arg-object.rs:14:27 | -LL | fn get_max_from_min<'min, 'max, G>(v: Box>) +LL | fn get_max_from_min<'min, 'max, G>(v: Box>) | ^^^^ error: aborting due to 2 previous errors diff --git a/src/test/ui/variance/variance-object-types.rs b/src/test/ui/variance/variance-object-types.rs index 12af7ae8c5b8a..14e11f681b100 100644 --- a/src/test/ui/variance/variance-object-types.rs +++ b/src/test/ui/variance/variance-object-types.rs @@ -9,7 +9,7 @@ use std::cell::Cell; // get an invariant result for `'a`. #[rustc_variance] struct Foo<'a> { //~ ERROR [o] - x: Box &'a i32 + 'static> + x: Box &'a i32 + 'static> } fn main() { diff --git a/src/test/ui/variance/variance-object-types.stderr b/src/test/ui/variance/variance-object-types.stderr index be94a727a8d16..d97d222e711ad 100644 --- a/src/test/ui/variance/variance-object-types.stderr +++ b/src/test/ui/variance/variance-object-types.stderr @@ -2,7 +2,7 @@ error[E0208]: [o] --> $DIR/variance-object-types.rs:11:1 | LL | / struct Foo<'a> { -LL | | x: Box &'a i32 + 'static> +LL | | x: Box &'a i32 + 'static> LL | | } | |_^ diff --git a/src/test/ui/variance/variance-trait-object-bound.rs b/src/test/ui/variance/variance-trait-object-bound.rs index ada93b7f6efc7..ec3c973bc7639 100644 --- a/src/test/ui/variance/variance-trait-object-bound.rs +++ b/src/test/ui/variance/variance-trait-object-bound.rs @@ -12,7 +12,7 @@ trait T { fn foo(&self); } #[rustc_variance] struct TOption<'a> { //~ ERROR [-] - v: Option>, + v: Option>, } fn main() { } diff --git a/src/test/ui/variance/variance-trait-object-bound.stderr b/src/test/ui/variance/variance-trait-object-bound.stderr index 503c087fb4d38..fb0fab1950cef 100644 --- a/src/test/ui/variance/variance-trait-object-bound.stderr +++ b/src/test/ui/variance/variance-trait-object-bound.stderr @@ -2,7 +2,7 @@ error[E0208]: [-] --> $DIR/variance-trait-object-bound.rs:14:1 | LL | / struct TOption<'a> { -LL | | v: Option>, +LL | | v: Option>, LL | | } | |_^ diff --git a/src/test/ui/variance/variance-types-bounds.rs b/src/test/ui/variance/variance-types-bounds.rs index 5cbda10fbdeda..d1814dd97a0ad 100644 --- a/src/test/ui/variance/variance-types-bounds.rs +++ b/src/test/ui/variance/variance-types-bounds.rs @@ -36,8 +36,8 @@ trait Setter { #[rustc_variance] struct TestObject { //~ ERROR [o, o] - n: Box+Send>, - m: Box+Send>, + n: Box+Send>, + m: Box+Send>, } fn main() {} diff --git a/src/test/ui/variance/variance-types-bounds.stderr b/src/test/ui/variance/variance-types-bounds.stderr index 8e3e0515aec02..5cffdffc7f2d4 100644 --- a/src/test/ui/variance/variance-types-bounds.stderr +++ b/src/test/ui/variance/variance-types-bounds.stderr @@ -37,8 +37,8 @@ error[E0208]: [o, o] --> $DIR/variance-types-bounds.rs:38:1 | LL | / struct TestObject { -LL | | n: Box+Send>, -LL | | m: Box+Send>, +LL | | n: Box+Send>, +LL | | m: Box+Send>, LL | | } | |_^ diff --git a/src/test/ui/wf/wf-in-obj-type-static.rs b/src/test/ui/wf/wf-in-obj-type-static.rs index 858a75ab1ab5a..1ad2fd1edb3b8 100644 --- a/src/test/ui/wf/wf-in-obj-type-static.rs +++ b/src/test/ui/wf/wf-in-obj-type-static.rs @@ -11,7 +11,7 @@ struct MustBeCopy { struct Foo { // needs T: 'static - x: Object<&'static T> //~ ERROR E0310 + x: dyn Object<&'static T> //~ ERROR E0310 } diff --git a/src/test/ui/wf/wf-in-obj-type-static.stderr b/src/test/ui/wf/wf-in-obj-type-static.stderr index cc06b9243f707..c461da76a2576 100644 --- a/src/test/ui/wf/wf-in-obj-type-static.stderr +++ b/src/test/ui/wf/wf-in-obj-type-static.stderr @@ -4,14 +4,14 @@ error[E0310]: the parameter type `T` may not live long enough LL | struct Foo { | - help: consider adding an explicit lifetime bound `T: 'static`... LL | // needs T: 'static -LL | x: Object<&'static T> - | ^^^^^^^^^^^^^^^^^^^^^ +LL | x: dyn Object<&'static T> + | ^^^^^^^^^^^^^^^^^^^^^^^^^ | note: ...so that the reference type `&'static T` does not outlive the data it points at --> $DIR/wf-in-obj-type-static.rs:14:5 | -LL | x: Object<&'static T> - | ^^^^^^^^^^^^^^^^^^^^^ +LL | x: dyn Object<&'static T> + | ^^^^^^^^^^^^^^^^^^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/wf/wf-in-obj-type-trait.rs b/src/test/ui/wf/wf-in-obj-type-trait.rs index fad1da199ea91..170fad55f8f65 100644 --- a/src/test/ui/wf/wf-in-obj-type-trait.rs +++ b/src/test/ui/wf/wf-in-obj-type-trait.rs @@ -8,7 +8,7 @@ struct MustBeCopy { struct Bar { // needs T: Copy - x: Object> //~ ERROR E0277 + x: dyn Object> //~ ERROR E0277 } fn main() { } diff --git a/src/test/ui/wf/wf-in-obj-type-trait.stderr b/src/test/ui/wf/wf-in-obj-type-trait.stderr index 94b3de78898a7..2c85dd042e7ba 100644 --- a/src/test/ui/wf/wf-in-obj-type-trait.stderr +++ b/src/test/ui/wf/wf-in-obj-type-trait.stderr @@ -1,8 +1,8 @@ error[E0277]: the trait bound `T: std::marker::Copy` is not satisfied --> $DIR/wf-in-obj-type-trait.rs:11:5 | -LL | x: Object> - | ^^^^^^^^^^^^^^^^^^^^^^^^ the trait `std::marker::Copy` is not implemented for `T` +LL | x: dyn Object> + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `std::marker::Copy` is not implemented for `T` | = help: consider adding a `where T: std::marker::Copy` bound note: required by `MustBeCopy` diff --git a/src/test/ui/wf/wf-object-safe.rs b/src/test/ui/wf/wf-object-safe.rs index 08f68f6c004fa..42e6917551fd9 100644 --- a/src/test/ui/wf/wf-object-safe.rs +++ b/src/test/ui/wf/wf-object-safe.rs @@ -6,5 +6,5 @@ trait A { } fn main() { - let _x: &A; //~ ERROR E0038 + let _x: &dyn A; //~ ERROR E0038 } diff --git a/src/test/ui/wf/wf-object-safe.stderr b/src/test/ui/wf/wf-object-safe.stderr index 87e8105d4aff5..3b264ecd580ec 100644 --- a/src/test/ui/wf/wf-object-safe.stderr +++ b/src/test/ui/wf/wf-object-safe.stderr @@ -1,8 +1,8 @@ error[E0038]: the trait `A` cannot be made into an object --> $DIR/wf-object-safe.rs:9:13 | -LL | let _x: &A; - | ^^ the trait `A` cannot be made into an object +LL | let _x: &dyn A; + | ^^^^^^ the trait `A` cannot be made into an object | = note: method `foo` references the `Self` type in its arguments or return type diff --git a/src/test/ui/wf/wf-outlives-ty-in-fn-or-trait.rs b/src/test/ui/wf/wf-outlives-ty-in-fn-or-trait.rs index ac95cbab1f73e..85a332e244ff0 100644 --- a/src/test/ui/wf/wf-outlives-ty-in-fn-or-trait.rs +++ b/src/test/ui/wf/wf-outlives-ty-in-fn-or-trait.rs @@ -16,7 +16,7 @@ struct Foo<'a,T> { trait Baz { } impl<'a, T> Trait<'a, T> for u32 { - type Out = &'a Baz; //~ ERROR `T` may not live long enough + type Out = &'a dyn Baz; //~ ERROR `T` may not live long enough } fn main() { } diff --git a/src/test/ui/wf/wf-outlives-ty-in-fn-or-trait.stderr b/src/test/ui/wf/wf-outlives-ty-in-fn-or-trait.stderr index 8649506c870d7..f1cf514e6b298 100644 --- a/src/test/ui/wf/wf-outlives-ty-in-fn-or-trait.stderr +++ b/src/test/ui/wf/wf-outlives-ty-in-fn-or-trait.stderr @@ -17,14 +17,14 @@ error[E0309]: the parameter type `T` may not live long enough | LL | impl<'a, T> Trait<'a, T> for u32 { | - help: consider adding an explicit lifetime bound `T: 'a`... -LL | type Out = &'a Baz; - | ^^^^^^^^^^^^^^^^^^^^^^ +LL | type Out = &'a dyn Baz; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ | note: ...so that the reference type `&'a (dyn Baz + 'a)` does not outlive the data it points at --> $DIR/wf-outlives-ty-in-fn-or-trait.rs:19:5 | -LL | type Out = &'a Baz; - | ^^^^^^^^^^^^^^^^^^^^^^ +LL | type Out = &'a dyn Baz; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ error: aborting due to 2 previous errors diff --git a/src/test/ui/where-clauses/where-lifetime-resolution.rs b/src/test/ui/where-clauses/where-lifetime-resolution.rs index 4c46a77ae2916..0d426386768c8 100644 --- a/src/test/ui/where-clauses/where-lifetime-resolution.rs +++ b/src/test/ui/where-clauses/where-lifetime-resolution.rs @@ -2,10 +2,10 @@ trait Trait1<'a> {} trait Trait2<'a, 'b> {} fn f() where - for<'a> Trait1<'a>: Trait1<'a>, // OK - (for<'a> Trait1<'a>): Trait1<'a>, + for<'a> dyn Trait1<'a>: Trait1<'a>, // OK + (dyn for<'a> Trait1<'a>): Trait1<'a>, //~^ ERROR use of undeclared lifetime name `'a` - for<'a> for<'b> Trait2<'a, 'b>: Trait2<'a, 'b>, + for<'a> dyn for<'b> Trait2<'a, 'b>: Trait2<'a, 'b>, //~^ ERROR use of undeclared lifetime name `'b` //~| ERROR nested quantification of lifetimes {} diff --git a/src/test/ui/where-clauses/where-lifetime-resolution.stderr b/src/test/ui/where-clauses/where-lifetime-resolution.stderr index babf8efc23f35..0081ae07163b3 100644 --- a/src/test/ui/where-clauses/where-lifetime-resolution.stderr +++ b/src/test/ui/where-clauses/where-lifetime-resolution.stderr @@ -1,20 +1,20 @@ error[E0261]: use of undeclared lifetime name `'a` - --> $DIR/where-lifetime-resolution.rs:6:34 + --> $DIR/where-lifetime-resolution.rs:6:38 | -LL | (for<'a> Trait1<'a>): Trait1<'a>, - | ^^ undeclared lifetime +LL | (dyn for<'a> Trait1<'a>): Trait1<'a>, + | ^^ undeclared lifetime error[E0316]: nested quantification of lifetimes - --> $DIR/where-lifetime-resolution.rs:8:13 + --> $DIR/where-lifetime-resolution.rs:8:17 | -LL | for<'a> for<'b> Trait2<'a, 'b>: Trait2<'a, 'b>, - | ^^^^^^^^^^^^^^^^^^^^^^ +LL | for<'a> dyn for<'b> Trait2<'a, 'b>: Trait2<'a, 'b>, + | ^^^^^^^^^^^^^^^^^^^^^^ error[E0261]: use of undeclared lifetime name `'b` - --> $DIR/where-lifetime-resolution.rs:8:48 + --> $DIR/where-lifetime-resolution.rs:8:52 | -LL | for<'a> for<'b> Trait2<'a, 'b>: Trait2<'a, 'b>, - | ^^ undeclared lifetime +LL | for<'a> dyn for<'b> Trait2<'a, 'b>: Trait2<'a, 'b>, + | ^^ undeclared lifetime error: aborting due to 3 previous errors