| 
 | 1 | +warning: trait objects without an explicit `dyn` are deprecated  | 
 | 2 | +  --> $DIR/avoid-ice-on-warning-3.rs:9:19  | 
 | 3 | +   |  | 
 | 4 | +LL | trait A { fn g(b: B) -> B; }  | 
 | 5 | +   |                   ^  | 
 | 6 | +   |  | 
 | 7 | +   = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021!  | 
 | 8 | +   = note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2021/warnings-promoted-to-error.html>  | 
 | 9 | +   = note: `B` it is not object safe, so it can't be `dyn`  | 
 | 10 | +   = note: `#[warn(bare_trait_objects)]` on by default  | 
 | 11 | +help: use a new generic type parameter, constrained by `B`  | 
 | 12 | +   |  | 
 | 13 | +LL | trait A { fn g<T: B>(b: T) -> B; }  | 
 | 14 | +   |               ++++++    ~  | 
 | 15 | +help: you can also use an opaque type, but users won't be able to specify the type parameter when calling the `fn`, having to rely exclusively on type inference  | 
 | 16 | +   |  | 
 | 17 | +LL | trait A { fn g(b: impl B) -> B; }  | 
 | 18 | +   |                   ++++  | 
 | 19 | + | 
 | 20 | +warning: trait objects without an explicit `dyn` are deprecated  | 
 | 21 | +  --> $DIR/avoid-ice-on-warning-3.rs:9:25  | 
 | 22 | +   |  | 
 | 23 | +LL | trait A { fn g(b: B) -> B; }  | 
 | 24 | +   |                         ^  | 
 | 25 | +   |  | 
 | 26 | +   = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021!  | 
 | 27 | +   = note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2021/warnings-promoted-to-error.html>  | 
 | 28 | +help: `B` is not object safe, use `impl B` to return an opaque type, as long as you return a single underlying type  | 
 | 29 | +   |  | 
 | 30 | +LL | trait A { fn g(b: B) -> impl B; }  | 
 | 31 | +   |                         ++++  | 
 | 32 | + | 
 | 33 | +warning: trait objects without an explicit `dyn` are deprecated  | 
 | 34 | +  --> $DIR/avoid-ice-on-warning-3.rs:1:19  | 
 | 35 | +   |  | 
 | 36 | +LL | trait B { fn f(a: A) -> A; }  | 
 | 37 | +   |                   ^  | 
 | 38 | +   |  | 
 | 39 | +   = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021!  | 
 | 40 | +   = note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2021/warnings-promoted-to-error.html>  | 
 | 41 | +   = note: `A` it is not object safe, so it can't be `dyn`  | 
 | 42 | +help: use a new generic type parameter, constrained by `A`  | 
 | 43 | +   |  | 
 | 44 | +LL | trait B { fn f<T: A>(a: T) -> A; }  | 
 | 45 | +   |               ++++++    ~  | 
 | 46 | +help: you can also use an opaque type, but users won't be able to specify the type parameter when calling the `fn`, having to rely exclusively on type inference  | 
 | 47 | +   |  | 
 | 48 | +LL | trait B { fn f(a: impl A) -> A; }  | 
 | 49 | +   |                   ++++  | 
 | 50 | + | 
 | 51 | +warning: trait objects without an explicit `dyn` are deprecated  | 
 | 52 | +  --> $DIR/avoid-ice-on-warning-3.rs:1:25  | 
 | 53 | +   |  | 
 | 54 | +LL | trait B { fn f(a: A) -> A; }  | 
 | 55 | +   |                         ^  | 
 | 56 | +   |  | 
 | 57 | +   = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021!  | 
 | 58 | +   = note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2021/warnings-promoted-to-error.html>  | 
 | 59 | +help: `A` is not object safe, use `impl A` to return an opaque type, as long as you return a single underlying type  | 
 | 60 | +   |  | 
 | 61 | +LL | trait B { fn f(a: A) -> impl A; }  | 
 | 62 | +   |                         ++++  | 
 | 63 | + | 
 | 64 | +warning: trait objects without an explicit `dyn` are deprecated  | 
 | 65 | +  --> $DIR/avoid-ice-on-warning-3.rs:1:19  | 
 | 66 | +   |  | 
 | 67 | +LL | trait B { fn f(a: A) -> A; }  | 
 | 68 | +   |                   ^  | 
 | 69 | +   |  | 
 | 70 | +   = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021!  | 
 | 71 | +   = note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2021/warnings-promoted-to-error.html>  | 
 | 72 | +   = note: `A` it is not object safe, so it can't be `dyn`  | 
 | 73 | +   = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`  | 
 | 74 | +help: use a new generic type parameter, constrained by `A`  | 
 | 75 | +   |  | 
 | 76 | +LL | trait B { fn f<T: A>(a: T) -> A; }  | 
 | 77 | +   |               ++++++    ~  | 
 | 78 | +help: you can also use an opaque type, but users won't be able to specify the type parameter when calling the `fn`, having to rely exclusively on type inference  | 
 | 79 | +   |  | 
 | 80 | +LL | trait B { fn f(a: impl A) -> A; }  | 
 | 81 | +   |                   ++++  | 
 | 82 | + | 
 | 83 | +error[E0038]: the trait `A` cannot be made into an object  | 
 | 84 | +  --> $DIR/avoid-ice-on-warning-3.rs:1:19  | 
 | 85 | +   |  | 
 | 86 | +LL | trait B { fn f(a: A) -> A; }  | 
 | 87 | +   |                   ^ `A` cannot be made into an object  | 
 | 88 | +   |  | 
 | 89 | +note: for a trait to be "object safe" it needs to allow building a vtable to allow the call to be resolvable dynamically; for more information visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety>  | 
 | 90 | +  --> $DIR/avoid-ice-on-warning-3.rs:9:14  | 
 | 91 | +   |  | 
 | 92 | +LL | trait A { fn g(b: B) -> B; }  | 
 | 93 | +   |       -      ^ ...because associated function `g` has no `self` parameter  | 
 | 94 | +   |       |  | 
 | 95 | +   |       this trait cannot be made into an object...  | 
 | 96 | +help: consider turning `g` into a method by giving it a `&self` argument  | 
 | 97 | +   |  | 
 | 98 | +LL | trait A { fn g(&self, b: B) -> B; }  | 
 | 99 | +   |                ++++++  | 
 | 100 | +help: alternatively, consider constraining `g` so it does not apply to trait objects  | 
 | 101 | +   |  | 
 | 102 | +LL | trait A { fn g(b: B) -> B where Self: Sized; }  | 
 | 103 | +   |                           +++++++++++++++++  | 
 | 104 | + | 
 | 105 | +warning: trait objects without an explicit `dyn` are deprecated  | 
 | 106 | +  --> $DIR/avoid-ice-on-warning-3.rs:9:19  | 
 | 107 | +   |  | 
 | 108 | +LL | trait A { fn g(b: B) -> B; }  | 
 | 109 | +   |                   ^  | 
 | 110 | +   |  | 
 | 111 | +   = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021!  | 
 | 112 | +   = note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2021/warnings-promoted-to-error.html>  | 
 | 113 | +   = note: `B` it is not object safe, so it can't be `dyn`  | 
 | 114 | +   = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`  | 
 | 115 | +help: use a new generic type parameter, constrained by `B`  | 
 | 116 | +   |  | 
 | 117 | +LL | trait A { fn g<T: B>(b: T) -> B; }  | 
 | 118 | +   |               ++++++    ~  | 
 | 119 | +help: you can also use an opaque type, but users won't be able to specify the type parameter when calling the `fn`, having to rely exclusively on type inference  | 
 | 120 | +   |  | 
 | 121 | +LL | trait A { fn g(b: impl B) -> B; }  | 
 | 122 | +   |                   ++++  | 
 | 123 | + | 
 | 124 | +error[E0038]: the trait `B` cannot be made into an object  | 
 | 125 | +  --> $DIR/avoid-ice-on-warning-3.rs:9:19  | 
 | 126 | +   |  | 
 | 127 | +LL | trait A { fn g(b: B) -> B; }  | 
 | 128 | +   |                   ^ `B` cannot be made into an object  | 
 | 129 | +   |  | 
 | 130 | +note: for a trait to be "object safe" it needs to allow building a vtable to allow the call to be resolvable dynamically; for more information visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety>  | 
 | 131 | +  --> $DIR/avoid-ice-on-warning-3.rs:1:14  | 
 | 132 | +   |  | 
 | 133 | +LL | trait B { fn f(a: A) -> A; }  | 
 | 134 | +   |       -      ^ ...because associated function `f` has no `self` parameter  | 
 | 135 | +   |       |  | 
 | 136 | +   |       this trait cannot be made into an object...  | 
 | 137 | +help: consider turning `f` into a method by giving it a `&self` argument  | 
 | 138 | +   |  | 
 | 139 | +LL | trait B { fn f(&self, a: A) -> A; }  | 
 | 140 | +   |                ++++++  | 
 | 141 | +help: alternatively, consider constraining `f` so it does not apply to trait objects  | 
 | 142 | +   |  | 
 | 143 | +LL | trait B { fn f(a: A) -> A where Self: Sized; }  | 
 | 144 | +   |                           +++++++++++++++++  | 
 | 145 | + | 
 | 146 | +error: aborting due to 2 previous errors; 6 warnings emitted  | 
 | 147 | + | 
 | 148 | +For more information about this error, try `rustc --explain E0038`.  | 
0 commit comments