Use multipart suggestions.

This commit is contained in:
Camille GILLOT 2021-11-01 10:01:42 +01:00
parent 6152b1d722
commit d3a6d4b1a0
19 changed files with 254 additions and 62 deletions

View file

@ -2617,30 +2617,39 @@ fn maybe_lint_bare_trait(&self, self_ty: &hir::Ty<'_>, in_path: bool) {
if let hir::TyKind::TraitObject([poly_trait_ref, ..], _, TraitObjectSyntax::None) = if let hir::TyKind::TraitObject([poly_trait_ref, ..], _, TraitObjectSyntax::None) =
self_ty.kind self_ty.kind
{ {
let (mut sugg, app) = match tcx.sess.source_map().span_to_snippet(self_ty.span) { let needs_bracket = in_path
Ok(s) if poly_trait_ref.trait_ref.path.is_global() => { && !tcx
(format!("dyn ({})", s), Applicability::MachineApplicable)
}
Ok(s) => (format!("dyn {}", s), Applicability::MachineApplicable),
Err(_) => ("dyn <type>".to_string(), Applicability::HasPlaceholders),
};
if in_path {
let has_bracket = tcx
.sess .sess
.source_map() .source_map()
.span_to_prev_source(self_ty.span) .span_to_prev_source(self_ty.span)
.ok() .ok()
.map_or(false, |s| s.trim_end().ends_with('<')); .map_or(false, |s| s.trim_end().ends_with('<'));
if !has_bracket {
sugg = format!("<{}>", sugg); let is_global = poly_trait_ref.trait_ref.path.is_global();
} let sugg = Vec::from_iter([
} (
self_ty.span.shrink_to_lo(),
format!(
"{}dyn {}",
if needs_bracket { "<" } else { "" },
if is_global { "(" } else { "" },
),
),
(
self_ty.span.shrink_to_hi(),
format!(
"{}{}",
if is_global { ")" } else { "" },
if needs_bracket { ">" } else { "" },
),
),
]);
if self_ty.span.edition() >= Edition::Edition2021 { if self_ty.span.edition() >= Edition::Edition2021 {
let msg = "trait objects must include the `dyn` keyword"; let msg = "trait objects must include the `dyn` keyword";
let label = "add `dyn` keyword before this trait"; let label = "add `dyn` keyword before this trait";
let mut err = rustc_errors::struct_span_err!(tcx.sess, self_ty.span, E0782, "{}", msg)
rustc_errors::struct_span_err!(tcx.sess, self_ty.span, E0782, "{}", msg); .multipart_suggestion_verbose(label, sugg, Applicability::MachineApplicable)
err.span_suggestion_verbose(self_ty.span, label, sugg, app).emit(); .emit();
} else { } else {
let msg = "trait objects without an explicit `dyn` are deprecated"; let msg = "trait objects without an explicit `dyn` are deprecated";
tcx.struct_span_lint_hir( tcx.struct_span_lint_hir(
@ -2648,9 +2657,13 @@ fn maybe_lint_bare_trait(&self, self_ty: &hir::Ty<'_>, in_path: bool) {
self_ty.hir_id, self_ty.hir_id,
self_ty.span, self_ty.span,
|lint| { |lint| {
let mut db = lint.build(msg); lint.build(msg)
db.span_suggestion(self_ty.span, "use `dyn`", sugg, app); .multipart_suggestion_verbose(
db.emit() "use `dyn`",
sugg,
Applicability::MachineApplicable,
)
.emit()
}, },
); );
} }

View file

@ -103,11 +103,15 @@ warning: trait objects without an explicit `dyn` are deprecated
--> $DIR/bad-assoc-ty.rs:33:10 --> $DIR/bad-assoc-ty.rs:33:10
| |
LL | type H = Fn(u8) -> (u8)::Output; LL | type H = Fn(u8) -> (u8)::Output;
| ^^^^^^^^^^^^^^ help: use `dyn`: `<dyn Fn(u8) -> (u8)>` | ^^^^^^^^^^^^^^
| |
= note: `#[warn(bare_trait_objects)]` on by default = note: `#[warn(bare_trait_objects)]` on by default
= warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021! = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021!
= note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2021/warnings-promoted-to-error.html> = note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2021/warnings-promoted-to-error.html>
help: use `dyn`
|
LL | type H = <dyn Fn(u8) -> (u8)>::Output;
| ++++ +
error[E0223]: ambiguous associated type error[E0223]: ambiguous associated type
--> $DIR/bad-assoc-ty.rs:33:10 --> $DIR/bad-assoc-ty.rs:33:10

View file

@ -2,7 +2,7 @@ error: trait objects without an explicit `dyn` are deprecated
--> $DIR/dyn-2018-edition-lint.rs:4:17 --> $DIR/dyn-2018-edition-lint.rs:4:17
| |
LL | fn function(x: &SomeTrait, y: Box<SomeTrait>) { LL | fn function(x: &SomeTrait, y: Box<SomeTrait>) {
| ^^^^^^^^^ help: use `dyn`: `dyn SomeTrait` | ^^^^^^^^^
| |
note: the lint level is defined here note: the lint level is defined here
--> $DIR/dyn-2018-edition-lint.rs:2:8 --> $DIR/dyn-2018-edition-lint.rs:2:8
@ -11,15 +11,25 @@ LL | #[deny(bare_trait_objects)]
| ^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^
= warning: this is accepted in the current edition (Rust 2018) but is a hard error in Rust 2021! = warning: this is accepted in the current edition (Rust 2018) but is a hard error in Rust 2021!
= note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2021/warnings-promoted-to-error.html> = note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2021/warnings-promoted-to-error.html>
help: use `dyn`
|
LL - fn function(x: &SomeTrait, y: Box<SomeTrait>) {
LL + fn function(x: &dyn SomeTrait, y: Box<SomeTrait>) {
|
error: trait objects without an explicit `dyn` are deprecated error: trait objects without an explicit `dyn` are deprecated
--> $DIR/dyn-2018-edition-lint.rs:4:35 --> $DIR/dyn-2018-edition-lint.rs:4:35
| |
LL | fn function(x: &SomeTrait, y: Box<SomeTrait>) { LL | fn function(x: &SomeTrait, y: Box<SomeTrait>) {
| ^^^^^^^^^ help: use `dyn`: `dyn SomeTrait` | ^^^^^^^^^
| |
= warning: this is accepted in the current edition (Rust 2018) but is a hard error in Rust 2021! = warning: this is accepted in the current edition (Rust 2018) but is a hard error in Rust 2021!
= note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2021/warnings-promoted-to-error.html> = note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2021/warnings-promoted-to-error.html>
help: use `dyn`
|
LL - fn function(x: &SomeTrait, y: Box<SomeTrait>) {
LL + fn function(x: &SomeTrait, y: Box<dyn SomeTrait>) {
|
error: aborting due to 2 previous errors error: aborting due to 2 previous errors

View file

@ -6,8 +6,9 @@ LL | fn function(x: &SomeTrait, y: Box<SomeTrait>) {
| |
help: add `dyn` keyword before this trait help: add `dyn` keyword before this trait
| |
LL | fn function(x: &dyn SomeTrait, y: Box<SomeTrait>) { LL - fn function(x: &SomeTrait, y: Box<SomeTrait>) {
| ~~~~~~~~~~~~~ LL + fn function(x: &dyn SomeTrait, y: Box<SomeTrait>) {
|
error[E0782]: trait objects must include the `dyn` keyword error[E0782]: trait objects must include the `dyn` keyword
--> $DIR/dyn-2021-edition-error.rs:3:35 --> $DIR/dyn-2021-edition-error.rs:3:35
@ -17,8 +18,9 @@ LL | fn function(x: &SomeTrait, y: Box<SomeTrait>) {
| |
help: add `dyn` keyword before this trait help: add `dyn` keyword before this trait
| |
LL | fn function(x: &SomeTrait, y: Box<dyn SomeTrait>) { LL - fn function(x: &SomeTrait, y: Box<SomeTrait>) {
| ~~~~~~~~~~~~~ LL + fn function(x: &SomeTrait, y: Box<dyn SomeTrait>) {
|
error: aborting due to 2 previous errors error: aborting due to 2 previous errors

View file

@ -2,7 +2,7 @@ error: trait objects without an explicit `dyn` are deprecated
--> $DIR/dyn-angle-brackets.rs:15:10 --> $DIR/dyn-angle-brackets.rs:15:10
| |
LL | <fmt::Debug>::fmt(self, f) LL | <fmt::Debug>::fmt(self, f)
| ^^^^^^^^^^ help: use `dyn`: `dyn fmt::Debug` | ^^^^^^^^^^
| |
note: the lint level is defined here note: the lint level is defined here
--> $DIR/dyn-angle-brackets.rs:4:9 --> $DIR/dyn-angle-brackets.rs:4:9
@ -11,6 +11,11 @@ LL | #![deny(bare_trait_objects)]
| ^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^
= warning: this is accepted in the current edition (Rust 2018) but is a hard error in Rust 2021! = warning: this is accepted in the current edition (Rust 2018) but is a hard error in Rust 2021!
= note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2021/warnings-promoted-to-error.html> = note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2021/warnings-promoted-to-error.html>
help: use `dyn`
|
LL - <fmt::Debug>::fmt(self, f)
LL + <dyn fmt::Debug>::fmt(self, f)
|
error: aborting due to previous error error: aborting due to previous error

View file

@ -7,7 +7,7 @@ LL | Foo::hi(123);
help: add `dyn` keyword before this trait help: add `dyn` keyword before this trait
| |
LL | <dyn Foo>::hi(123); LL | <dyn Foo>::hi(123);
| ~~~~~~~~~ | ++++ +
error: aborting due to previous error error: aborting due to previous error

View file

@ -2,11 +2,15 @@ warning: trait objects without an explicit `dyn` are deprecated
--> $DIR/issue-28344.rs:4:17 --> $DIR/issue-28344.rs:4:17
| |
LL | let x: u8 = BitXor::bitor(0 as u8, 0 as u8); LL | let x: u8 = BitXor::bitor(0 as u8, 0 as u8);
| ^^^^^^ help: use `dyn`: `<dyn BitXor>` | ^^^^^^
| |
= note: `#[warn(bare_trait_objects)]` on by default = note: `#[warn(bare_trait_objects)]` on by default
= warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021! = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021!
= note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2021/warnings-promoted-to-error.html> = note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2021/warnings-promoted-to-error.html>
help: use `dyn`
|
LL | let x: u8 = <dyn BitXor>::bitor(0 as u8, 0 as u8);
| ++++ +
error[E0191]: the value of the associated type `Output` (from trait `BitXor`) must be specified error[E0191]: the value of the associated type `Output` (from trait `BitXor`) must be specified
--> $DIR/issue-28344.rs:4:17 --> $DIR/issue-28344.rs:4:17
@ -27,10 +31,14 @@ warning: trait objects without an explicit `dyn` are deprecated
--> $DIR/issue-28344.rs:10:13 --> $DIR/issue-28344.rs:10:13
| |
LL | let g = BitXor::bitor; LL | let g = BitXor::bitor;
| ^^^^^^ help: use `dyn`: `<dyn BitXor>` | ^^^^^^
| |
= warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021! = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021!
= note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2021/warnings-promoted-to-error.html> = note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2021/warnings-promoted-to-error.html>
help: use `dyn`
|
LL | let g = <dyn BitXor>::bitor;
| ++++ +
error[E0191]: the value of the associated type `Output` (from trait `BitXor`) must be specified error[E0191]: the value of the associated type `Output` (from trait `BitXor`) must be specified
--> $DIR/issue-28344.rs:10:13 --> $DIR/issue-28344.rs:10:13

View file

@ -2,11 +2,15 @@ warning: trait objects without an explicit `dyn` are deprecated
--> $DIR/issue-58734.rs:20:5 --> $DIR/issue-58734.rs:20:5
| |
LL | Trait::nonexistent(()); LL | Trait::nonexistent(());
| ^^^^^ help: use `dyn`: `<dyn Trait>` | ^^^^^
| |
= note: `#[warn(bare_trait_objects)]` on by default = note: `#[warn(bare_trait_objects)]` on by default
= warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021! = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021!
= note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2021/warnings-promoted-to-error.html> = note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2021/warnings-promoted-to-error.html>
help: use `dyn`
|
LL | <dyn Trait>::nonexistent(());
| ++++ +
error[E0599]: no function or associated item named `nonexistent` found for trait object `dyn Trait` in the current scope error[E0599]: no function or associated item named `nonexistent` found for trait object `dyn Trait` in the current scope
--> $DIR/issue-58734.rs:20:12 --> $DIR/issue-58734.rs:20:12

View file

@ -18,11 +18,16 @@ warning: trait objects without an explicit `dyn` are deprecated
--> $DIR/issue-86756.rs:5:15 --> $DIR/issue-86756.rs:5:15
| |
LL | eq::<dyn, Foo> LL | eq::<dyn, Foo>
| ^^^ help: use `dyn`: `dyn Foo` | ^^^
| |
= note: `#[warn(bare_trait_objects)]` on by default = note: `#[warn(bare_trait_objects)]` on by default
= warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021! = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021!
= note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2021/warnings-promoted-to-error.html> = note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2021/warnings-promoted-to-error.html>
help: use `dyn`
|
LL - eq::<dyn, Foo>
LL + eq::<dyn, dyn Foo>
|
error[E0107]: missing generics for trait `Foo` error[E0107]: missing generics for trait `Foo`
--> $DIR/issue-86756.rs:5:15 --> $DIR/issue-86756.rs:5:15

View file

@ -2,11 +2,15 @@ warning: trait objects without an explicit `dyn` are deprecated
--> $DIR/bare-trait-objects-path.rs:23:12 --> $DIR/bare-trait-objects-path.rs:23:12
| |
LL | let _: Dyn::Ty; LL | let _: Dyn::Ty;
| ^^^ help: use `dyn`: `<dyn Dyn>` | ^^^
| |
= note: `#[warn(bare_trait_objects)]` on by default = note: `#[warn(bare_trait_objects)]` on by default
= warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021! = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021!
= note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2021/warnings-promoted-to-error.html> = note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2021/warnings-promoted-to-error.html>
help: use `dyn`
|
LL | let _: <dyn Dyn>::Ty;
| ++++ +
error[E0223]: ambiguous associated type error[E0223]: ambiguous associated type
--> $DIR/bare-trait-objects-path.rs:23:12 --> $DIR/bare-trait-objects-path.rs:23:12
@ -18,28 +22,40 @@ warning: trait objects without an explicit `dyn` are deprecated
--> $DIR/bare-trait-objects-path.rs:14:5 --> $DIR/bare-trait-objects-path.rs:14:5
| |
LL | Dyn::func(); LL | Dyn::func();
| ^^^ help: use `dyn`: `<dyn Dyn>` | ^^^
| |
= warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021! = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021!
= note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2021/warnings-promoted-to-error.html> = note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2021/warnings-promoted-to-error.html>
help: use `dyn`
|
LL | <dyn Dyn>::func();
| ++++ +
warning: trait objects without an explicit `dyn` are deprecated warning: trait objects without an explicit `dyn` are deprecated
--> $DIR/bare-trait-objects-path.rs:17:5 --> $DIR/bare-trait-objects-path.rs:17:5
| |
LL | ::Dyn::func(); LL | ::Dyn::func();
| ^^^^^ help: use `dyn`: `<dyn (::Dyn)>` | ^^^^^
| |
= warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021! = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021!
= note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2021/warnings-promoted-to-error.html> = note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2021/warnings-promoted-to-error.html>
help: use `dyn`
|
LL | <dyn (::Dyn)>::func();
| ++++++ ++
warning: trait objects without an explicit `dyn` are deprecated warning: trait objects without an explicit `dyn` are deprecated
--> $DIR/bare-trait-objects-path.rs:20:5 --> $DIR/bare-trait-objects-path.rs:20:5
| |
LL | Dyn::CONST; LL | Dyn::CONST;
| ^^^ help: use `dyn`: `<dyn Dyn>` | ^^^
| |
= warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021! = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021!
= note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2021/warnings-promoted-to-error.html> = note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2021/warnings-promoted-to-error.html>
help: use `dyn`
|
LL | <dyn Dyn>::CONST;
| ++++ +
error: aborting due to previous error; 4 warnings emitted error: aborting due to previous error; 4 warnings emitted

View file

@ -2,29 +2,44 @@ warning: trait objects without an explicit `dyn` are deprecated
--> $DIR/allowed-group-warn-by-default-lint.rs:10:25 --> $DIR/allowed-group-warn-by-default-lint.rs:10:25
| |
LL | pub fn function(_x: Box<SomeTrait>) {} LL | pub fn function(_x: Box<SomeTrait>) {}
| ^^^^^^^^^ help: use `dyn`: `dyn SomeTrait` | ^^^^^^^^^
| |
= note: requested on the command line with `--force-warn bare-trait-objects` = note: requested on the command line with `--force-warn bare-trait-objects`
= warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021! = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021!
= note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2021/warnings-promoted-to-error.html> = note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2021/warnings-promoted-to-error.html>
help: use `dyn`
|
LL - pub fn function(_x: Box<SomeTrait>) {}
LL + pub fn function(_x: Box<dyn SomeTrait>) {}
|
warning: trait objects without an explicit `dyn` are deprecated warning: trait objects without an explicit `dyn` are deprecated
--> $DIR/allowed-group-warn-by-default-lint.rs:10:25 --> $DIR/allowed-group-warn-by-default-lint.rs:10:25
| |
LL | pub fn function(_x: Box<SomeTrait>) {} LL | pub fn function(_x: Box<SomeTrait>) {}
| ^^^^^^^^^ help: use `dyn`: `dyn SomeTrait` | ^^^^^^^^^
| |
= warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021! = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021!
= note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2021/warnings-promoted-to-error.html> = note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2021/warnings-promoted-to-error.html>
help: use `dyn`
|
LL - pub fn function(_x: Box<SomeTrait>) {}
LL + pub fn function(_x: Box<dyn SomeTrait>) {}
|
warning: trait objects without an explicit `dyn` are deprecated warning: trait objects without an explicit `dyn` are deprecated
--> $DIR/allowed-group-warn-by-default-lint.rs:10:25 --> $DIR/allowed-group-warn-by-default-lint.rs:10:25
| |
LL | pub fn function(_x: Box<SomeTrait>) {} LL | pub fn function(_x: Box<SomeTrait>) {}
| ^^^^^^^^^ help: use `dyn`: `dyn SomeTrait` | ^^^^^^^^^
| |
= warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021! = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021!
= note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2021/warnings-promoted-to-error.html> = note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2021/warnings-promoted-to-error.html>
help: use `dyn`
|
LL - pub fn function(_x: Box<SomeTrait>) {}
LL + pub fn function(_x: Box<dyn SomeTrait>) {}
|
warning: 3 warnings emitted warning: 3 warnings emitted

View file

@ -2,29 +2,44 @@ warning: trait objects without an explicit `dyn` are deprecated
--> $DIR/cap-lints-allow.rs:8:25 --> $DIR/cap-lints-allow.rs:8:25
| |
LL | pub fn function(_x: Box<SomeTrait>) {} LL | pub fn function(_x: Box<SomeTrait>) {}
| ^^^^^^^^^ help: use `dyn`: `dyn SomeTrait` | ^^^^^^^^^
| |
= note: requested on the command line with `--force-warn bare-trait-objects` = note: requested on the command line with `--force-warn bare-trait-objects`
= warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021! = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021!
= note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2021/warnings-promoted-to-error.html> = note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2021/warnings-promoted-to-error.html>
help: use `dyn`
|
LL - pub fn function(_x: Box<SomeTrait>) {}
LL + pub fn function(_x: Box<dyn SomeTrait>) {}
|
warning: trait objects without an explicit `dyn` are deprecated warning: trait objects without an explicit `dyn` are deprecated
--> $DIR/cap-lints-allow.rs:8:25 --> $DIR/cap-lints-allow.rs:8:25
| |
LL | pub fn function(_x: Box<SomeTrait>) {} LL | pub fn function(_x: Box<SomeTrait>) {}
| ^^^^^^^^^ help: use `dyn`: `dyn SomeTrait` | ^^^^^^^^^
| |
= warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021! = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021!
= note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2021/warnings-promoted-to-error.html> = note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2021/warnings-promoted-to-error.html>
help: use `dyn`
|
LL - pub fn function(_x: Box<SomeTrait>) {}
LL + pub fn function(_x: Box<dyn SomeTrait>) {}
|
warning: trait objects without an explicit `dyn` are deprecated warning: trait objects without an explicit `dyn` are deprecated
--> $DIR/cap-lints-allow.rs:8:25 --> $DIR/cap-lints-allow.rs:8:25
| |
LL | pub fn function(_x: Box<SomeTrait>) {} LL | pub fn function(_x: Box<SomeTrait>) {}
| ^^^^^^^^^ help: use `dyn`: `dyn SomeTrait` | ^^^^^^^^^
| |
= warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021! = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021!
= note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2021/warnings-promoted-to-error.html> = note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2021/warnings-promoted-to-error.html>
help: use `dyn`
|
LL - pub fn function(_x: Box<SomeTrait>) {}
LL + pub fn function(_x: Box<dyn SomeTrait>) {}
|
warning: 3 warnings emitted warning: 3 warnings emitted

View file

@ -2,29 +2,44 @@ warning: trait objects without an explicit `dyn` are deprecated
--> $DIR/lint-group-allowed-cli-warn-by-default-lint.rs:8:25 --> $DIR/lint-group-allowed-cli-warn-by-default-lint.rs:8:25
| |
LL | pub fn function(_x: Box<SomeTrait>) {} LL | pub fn function(_x: Box<SomeTrait>) {}
| ^^^^^^^^^ help: use `dyn`: `dyn SomeTrait` | ^^^^^^^^^
| |
= note: `--force-warn bare-trait-objects` implied by `--force-warn rust-2018-idioms` = note: `--force-warn bare-trait-objects` implied by `--force-warn rust-2018-idioms`
= warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021! = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021!
= note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2021/warnings-promoted-to-error.html> = note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2021/warnings-promoted-to-error.html>
help: use `dyn`
|
LL - pub fn function(_x: Box<SomeTrait>) {}
LL + pub fn function(_x: Box<dyn SomeTrait>) {}
|
warning: trait objects without an explicit `dyn` are deprecated warning: trait objects without an explicit `dyn` are deprecated
--> $DIR/lint-group-allowed-cli-warn-by-default-lint.rs:8:25 --> $DIR/lint-group-allowed-cli-warn-by-default-lint.rs:8:25
| |
LL | pub fn function(_x: Box<SomeTrait>) {} LL | pub fn function(_x: Box<SomeTrait>) {}
| ^^^^^^^^^ help: use `dyn`: `dyn SomeTrait` | ^^^^^^^^^
| |
= warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021! = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021!
= note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2021/warnings-promoted-to-error.html> = note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2021/warnings-promoted-to-error.html>
help: use `dyn`
|
LL - pub fn function(_x: Box<SomeTrait>) {}
LL + pub fn function(_x: Box<dyn SomeTrait>) {}
|
warning: trait objects without an explicit `dyn` are deprecated warning: trait objects without an explicit `dyn` are deprecated
--> $DIR/lint-group-allowed-cli-warn-by-default-lint.rs:8:25 --> $DIR/lint-group-allowed-cli-warn-by-default-lint.rs:8:25
| |
LL | pub fn function(_x: Box<SomeTrait>) {} LL | pub fn function(_x: Box<SomeTrait>) {}
| ^^^^^^^^^ help: use `dyn`: `dyn SomeTrait` | ^^^^^^^^^
| |
= warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021! = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021!
= note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2021/warnings-promoted-to-error.html> = note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2021/warnings-promoted-to-error.html>
help: use `dyn`
|
LL - pub fn function(_x: Box<SomeTrait>) {}
LL + pub fn function(_x: Box<dyn SomeTrait>) {}
|
warning: 3 warnings emitted warning: 3 warnings emitted

View file

@ -2,29 +2,44 @@ warning: trait objects without an explicit `dyn` are deprecated
--> $DIR/lint-group-allowed-lint-group.rs:10:25 --> $DIR/lint-group-allowed-lint-group.rs:10:25
| |
LL | pub fn function(_x: Box<SomeTrait>) {} LL | pub fn function(_x: Box<SomeTrait>) {}
| ^^^^^^^^^ help: use `dyn`: `dyn SomeTrait` | ^^^^^^^^^
| |
= note: `--force-warn bare-trait-objects` implied by `--force-warn rust-2018-idioms` = note: `--force-warn bare-trait-objects` implied by `--force-warn rust-2018-idioms`
= warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021! = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021!
= note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2021/warnings-promoted-to-error.html> = note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2021/warnings-promoted-to-error.html>
help: use `dyn`
|
LL - pub fn function(_x: Box<SomeTrait>) {}
LL + pub fn function(_x: Box<dyn SomeTrait>) {}
|
warning: trait objects without an explicit `dyn` are deprecated warning: trait objects without an explicit `dyn` are deprecated
--> $DIR/lint-group-allowed-lint-group.rs:10:25 --> $DIR/lint-group-allowed-lint-group.rs:10:25
| |
LL | pub fn function(_x: Box<SomeTrait>) {} LL | pub fn function(_x: Box<SomeTrait>) {}
| ^^^^^^^^^ help: use `dyn`: `dyn SomeTrait` | ^^^^^^^^^
| |
= warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021! = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021!
= note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2021/warnings-promoted-to-error.html> = note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2021/warnings-promoted-to-error.html>
help: use `dyn`
|
LL - pub fn function(_x: Box<SomeTrait>) {}
LL + pub fn function(_x: Box<dyn SomeTrait>) {}
|
warning: trait objects without an explicit `dyn` are deprecated warning: trait objects without an explicit `dyn` are deprecated
--> $DIR/lint-group-allowed-lint-group.rs:10:25 --> $DIR/lint-group-allowed-lint-group.rs:10:25
| |
LL | pub fn function(_x: Box<SomeTrait>) {} LL | pub fn function(_x: Box<SomeTrait>) {}
| ^^^^^^^^^ help: use `dyn`: `dyn SomeTrait` | ^^^^^^^^^
| |
= warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021! = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021!
= note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2021/warnings-promoted-to-error.html> = note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2021/warnings-promoted-to-error.html>
help: use `dyn`
|
LL - pub fn function(_x: Box<SomeTrait>) {}
LL + pub fn function(_x: Box<dyn SomeTrait>) {}
|
warning: 3 warnings emitted warning: 3 warnings emitted

View file

@ -2,29 +2,44 @@ warning: trait objects without an explicit `dyn` are deprecated
--> $DIR/lint-group-allowed-warn-by-default-lint.rs:10:25 --> $DIR/lint-group-allowed-warn-by-default-lint.rs:10:25
| |
LL | pub fn function(_x: Box<SomeTrait>) {} LL | pub fn function(_x: Box<SomeTrait>) {}
| ^^^^^^^^^ help: use `dyn`: `dyn SomeTrait` | ^^^^^^^^^
| |
= note: `--force-warn bare-trait-objects` implied by `--force-warn rust-2018-idioms` = note: `--force-warn bare-trait-objects` implied by `--force-warn rust-2018-idioms`
= warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021! = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021!
= note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2021/warnings-promoted-to-error.html> = note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2021/warnings-promoted-to-error.html>
help: use `dyn`
|
LL - pub fn function(_x: Box<SomeTrait>) {}
LL + pub fn function(_x: Box<dyn SomeTrait>) {}
|
warning: trait objects without an explicit `dyn` are deprecated warning: trait objects without an explicit `dyn` are deprecated
--> $DIR/lint-group-allowed-warn-by-default-lint.rs:10:25 --> $DIR/lint-group-allowed-warn-by-default-lint.rs:10:25
| |
LL | pub fn function(_x: Box<SomeTrait>) {} LL | pub fn function(_x: Box<SomeTrait>) {}
| ^^^^^^^^^ help: use `dyn`: `dyn SomeTrait` | ^^^^^^^^^
| |
= warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021! = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021!
= note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2021/warnings-promoted-to-error.html> = note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2021/warnings-promoted-to-error.html>
help: use `dyn`
|
LL - pub fn function(_x: Box<SomeTrait>) {}
LL + pub fn function(_x: Box<dyn SomeTrait>) {}
|
warning: trait objects without an explicit `dyn` are deprecated warning: trait objects without an explicit `dyn` are deprecated
--> $DIR/lint-group-allowed-warn-by-default-lint.rs:10:25 --> $DIR/lint-group-allowed-warn-by-default-lint.rs:10:25
| |
LL | pub fn function(_x: Box<SomeTrait>) {} LL | pub fn function(_x: Box<SomeTrait>) {}
| ^^^^^^^^^ help: use `dyn`: `dyn SomeTrait` | ^^^^^^^^^
| |
= warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021! = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021!
= note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2021/warnings-promoted-to-error.html> = note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2021/warnings-promoted-to-error.html>
help: use `dyn`
|
LL - pub fn function(_x: Box<SomeTrait>) {}
LL + pub fn function(_x: Box<dyn SomeTrait>) {}
|
warning: 3 warnings emitted warning: 3 warnings emitted

View file

@ -20,11 +20,16 @@ warning: trait objects without an explicit `dyn` are deprecated
--> $DIR/trait-object-trait-parens.rs:8:16 --> $DIR/trait-object-trait-parens.rs:8:16
| |
LL | let _: Box<(Obj) + (?Sized) + (for<'a> Trait<'a>)>; LL | let _: Box<(Obj) + (?Sized) + (for<'a> Trait<'a>)>;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use `dyn`: `dyn (Obj) + (?Sized) + (for<'a> Trait<'a>)` | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
| |
= note: `#[warn(bare_trait_objects)]` on by default = note: `#[warn(bare_trait_objects)]` on by default
= warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021! = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021!
= note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2021/warnings-promoted-to-error.html> = note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2021/warnings-promoted-to-error.html>
help: use `dyn`
|
LL - let _: Box<(Obj) + (?Sized) + (for<'a> Trait<'a>)>;
LL + let _: Box<dyn (Obj) + (?Sized) + (for<'a> Trait<'a>)>;
|
error[E0225]: only auto traits can be used as additional traits in a trait object error[E0225]: only auto traits can be used as additional traits in a trait object
--> $DIR/trait-object-trait-parens.rs:8:35 --> $DIR/trait-object-trait-parens.rs:8:35
@ -41,10 +46,15 @@ warning: trait objects without an explicit `dyn` are deprecated
--> $DIR/trait-object-trait-parens.rs:13:16 --> $DIR/trait-object-trait-parens.rs:13:16
| |
LL | let _: Box<?Sized + (for<'a> Trait<'a>) + (Obj)>; LL | let _: Box<?Sized + (for<'a> Trait<'a>) + (Obj)>;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use `dyn`: `dyn ?Sized + (for<'a> Trait<'a>) + (Obj)` | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
| |
= warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021! = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021!
= note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2021/warnings-promoted-to-error.html> = note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2021/warnings-promoted-to-error.html>
help: use `dyn`
|
LL - let _: Box<?Sized + (for<'a> Trait<'a>) + (Obj)>;
LL + let _: Box<dyn ?Sized + (for<'a> Trait<'a>) + (Obj)>;
|
error[E0225]: only auto traits can be used as additional traits in a trait object error[E0225]: only auto traits can be used as additional traits in a trait object
--> $DIR/trait-object-trait-parens.rs:13:47 --> $DIR/trait-object-trait-parens.rs:13:47
@ -61,10 +71,15 @@ warning: trait objects without an explicit `dyn` are deprecated
--> $DIR/trait-object-trait-parens.rs:18:16 --> $DIR/trait-object-trait-parens.rs:18:16
| |
LL | let _: Box<for<'a> Trait<'a> + (Obj) + (?Sized)>; LL | let _: Box<for<'a> Trait<'a> + (Obj) + (?Sized)>;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use `dyn`: `dyn for<'a> Trait<'a> + (Obj) + (?Sized)` | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
| |
= warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021! = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021!
= note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2021/warnings-promoted-to-error.html> = note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2021/warnings-promoted-to-error.html>
help: use `dyn`
|
LL - let _: Box<for<'a> Trait<'a> + (Obj) + (?Sized)>;
LL + let _: Box<dyn for<'a> Trait<'a> + (Obj) + (?Sized)>;
|
error[E0225]: only auto traits can be used as additional traits in a trait object error[E0225]: only auto traits can be used as additional traits in a trait object
--> $DIR/trait-object-trait-parens.rs:18:36 --> $DIR/trait-object-trait-parens.rs:18:36

View file

@ -2,7 +2,7 @@ error: trait objects without an explicit `dyn` are deprecated
--> $DIR/issue-61963.rs:22:14 --> $DIR/issue-61963.rs:22:14
| |
LL | bar: Box<Bar>, LL | bar: Box<Bar>,
| ^^^ help: use `dyn`: `dyn Bar` | ^^^
| |
note: the lint level is defined here note: the lint level is defined here
--> $DIR/issue-61963.rs:3:9 --> $DIR/issue-61963.rs:3:9
@ -11,15 +11,25 @@ LL | #![deny(bare_trait_objects)]
| ^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^
= warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021! = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021!
= note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2021/warnings-promoted-to-error.html> = note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2021/warnings-promoted-to-error.html>
help: use `dyn`
|
LL - bar: Box<Bar>,
LL + bar: Box<dyn Bar>,
|
error: trait objects without an explicit `dyn` are deprecated error: trait objects without an explicit `dyn` are deprecated
--> $DIR/issue-61963.rs:18:1 --> $DIR/issue-61963.rs:18:1
| |
LL | pub struct Foo { LL | pub struct Foo {
| ^^^ help: use `dyn`: `dyn pub` | ^^^
| |
= warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021! = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021!
= note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2021/warnings-promoted-to-error.html> = note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2021/warnings-promoted-to-error.html>
help: use `dyn`
|
LL - pub struct Foo {
LL + dyn pub struct Foo {
|
error: aborting due to 2 previous errors error: aborting due to 2 previous errors

View file

@ -2,11 +2,16 @@ warning: trait objects without an explicit `dyn` are deprecated
--> $DIR/not-on-bare-trait.rs:7:12 --> $DIR/not-on-bare-trait.rs:7:12
| |
LL | fn foo(_x: Foo + Send) { LL | fn foo(_x: Foo + Send) {
| ^^^^^^^^^^ help: use `dyn`: `dyn Foo + Send` | ^^^^^^^^^^
| |
= note: `#[warn(bare_trait_objects)]` on by default = note: `#[warn(bare_trait_objects)]` on by default
= warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021! = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021!
= note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2021/warnings-promoted-to-error.html> = note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2021/warnings-promoted-to-error.html>
help: use `dyn`
|
LL - fn foo(_x: Foo + Send) {
LL + fn foo(_x: dyn Foo + Send) {
|
error[E0277]: the size for values of type `(dyn Foo + Send + 'static)` cannot be known at compilation time error[E0277]: the size for values of type `(dyn Foo + Send + 'static)` cannot be known at compilation time
--> $DIR/not-on-bare-trait.rs:7:8 --> $DIR/not-on-bare-trait.rs:7:8

View file

@ -2,11 +2,15 @@ warning: trait objects without an explicit `dyn` are deprecated
--> $DIR/unspecified-self-in-trait-ref.rs:10:13 --> $DIR/unspecified-self-in-trait-ref.rs:10:13
| |
LL | let a = Foo::lol(); LL | let a = Foo::lol();
| ^^^ help: use `dyn`: `<dyn Foo>` | ^^^
| |
= note: `#[warn(bare_trait_objects)]` on by default = note: `#[warn(bare_trait_objects)]` on by default
= warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021! = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021!
= note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2021/warnings-promoted-to-error.html> = note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2021/warnings-promoted-to-error.html>
help: use `dyn`
|
LL | let a = <dyn Foo>::lol();
| ++++ +
error[E0599]: no function or associated item named `lol` found for trait object `dyn Foo<_>` in the current scope error[E0599]: no function or associated item named `lol` found for trait object `dyn Foo<_>` in the current scope
--> $DIR/unspecified-self-in-trait-ref.rs:10:18 --> $DIR/unspecified-self-in-trait-ref.rs:10:18
@ -18,10 +22,14 @@ warning: trait objects without an explicit `dyn` are deprecated
--> $DIR/unspecified-self-in-trait-ref.rs:14:13 --> $DIR/unspecified-self-in-trait-ref.rs:14:13
| |
LL | let b = Foo::<_>::lol(); LL | let b = Foo::<_>::lol();
| ^^^^^^^^ help: use `dyn`: `<dyn Foo::<_>>` | ^^^^^^^^
| |
= warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021! = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021!
= note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2021/warnings-promoted-to-error.html> = note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2021/warnings-promoted-to-error.html>
help: use `dyn`
|
LL | let b = <dyn Foo::<_>>::lol();
| ++++ +
error[E0599]: no function or associated item named `lol` found for trait object `dyn Foo<_>` in the current scope error[E0599]: no function or associated item named `lol` found for trait object `dyn Foo<_>` in the current scope
--> $DIR/unspecified-self-in-trait-ref.rs:14:23 --> $DIR/unspecified-self-in-trait-ref.rs:14:23
@ -33,10 +41,14 @@ warning: trait objects without an explicit `dyn` are deprecated
--> $DIR/unspecified-self-in-trait-ref.rs:18:13 --> $DIR/unspecified-self-in-trait-ref.rs:18:13
| |
LL | let c = Bar::lol(); LL | let c = Bar::lol();
| ^^^ help: use `dyn`: `<dyn Bar>` | ^^^
| |
= warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021! = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021!
= note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2021/warnings-promoted-to-error.html> = note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2021/warnings-promoted-to-error.html>
help: use `dyn`
|
LL | let c = <dyn Bar>::lol();
| ++++ +
error[E0599]: no function or associated item named `lol` found for trait object `dyn Bar<_, _>` in the current scope error[E0599]: no function or associated item named `lol` found for trait object `dyn Bar<_, _>` in the current scope
--> $DIR/unspecified-self-in-trait-ref.rs:18:18 --> $DIR/unspecified-self-in-trait-ref.rs:18:18
@ -48,10 +60,14 @@ warning: trait objects without an explicit `dyn` are deprecated
--> $DIR/unspecified-self-in-trait-ref.rs:22:13 --> $DIR/unspecified-self-in-trait-ref.rs:22:13
| |
LL | let d = Bar::<usize, _>::lol(); LL | let d = Bar::<usize, _>::lol();
| ^^^^^^^^^^^^^^^ help: use `dyn`: `<dyn Bar::<usize, _>>` | ^^^^^^^^^^^^^^^
| |
= warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021! = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021!
= note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2021/warnings-promoted-to-error.html> = note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2021/warnings-promoted-to-error.html>
help: use `dyn`
|
LL | let d = <dyn Bar::<usize, _>>::lol();
| ++++ +
error[E0599]: no function or associated item named `lol` found for trait object `dyn Bar<usize, _>` in the current scope error[E0599]: no function or associated item named `lol` found for trait object `dyn Bar<usize, _>` in the current scope
--> $DIR/unspecified-self-in-trait-ref.rs:22:30 --> $DIR/unspecified-self-in-trait-ref.rs:22:30
@ -63,10 +79,14 @@ warning: trait objects without an explicit `dyn` are deprecated
--> $DIR/unspecified-self-in-trait-ref.rs:26:13 --> $DIR/unspecified-self-in-trait-ref.rs:26:13
| |
LL | let e = Bar::<usize>::lol(); LL | let e = Bar::<usize>::lol();
| ^^^^^^^^^^^^ help: use `dyn`: `<dyn Bar::<usize>>` | ^^^^^^^^^^^^
| |
= warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021! = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021!
= note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2021/warnings-promoted-to-error.html> = note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2021/warnings-promoted-to-error.html>
help: use `dyn`
|
LL | let e = <dyn Bar::<usize>>::lol();
| ++++ +
error[E0393]: the type parameter `A` must be explicitly specified error[E0393]: the type parameter `A` must be explicitly specified
--> $DIR/unspecified-self-in-trait-ref.rs:26:13 --> $DIR/unspecified-self-in-trait-ref.rs:26:13