Skip to content

Commit 3d46687

Browse files
committed
Silence errors in experssions caused by bare traits in paths
Address rust-lang#51077 in editions>=2021 by treating `<Trait>` as a `<{type error}>` instead of `<dyn Trait>`, silencing subsequent errors. We new emit a single error ("missing `dyn`"). ``` error[E0782]: trait objects must include the `dyn` keyword --> f800.rs:2:15 | 2 | let x: u32 = <Default>::default(); | ^^^^^^^ | help: add `dyn` keyword before this trait | 2 | let x: u32 = <dyn Default>::default(); | +++ ``` instead of 6 ``` error[E0782]: trait objects must include the `dyn` keyword --> f800.rs:2:15 | 2 | let x: u32 = <Default>::default(); | ^^^^^^^ | help: add `dyn` keyword before this trait | 2 | let x: u32 = <dyn Default>::default(); | +++ error[E0038]: the trait `Default` cannot be made into an object --> f800.rs:2:15 | 2 | let x: u32 = <Default>::default(); | ^^^^^^^ `Default` cannot be made into an object | = note: the trait cannot be made into an object because it requires `Self: Sized` = 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> error[E0277]: the size for values of type `dyn Default` cannot be known at compilation time --> f800.rs:2:15 | 2 | let x: u32 = <Default>::default(); | ^^^^^^^ doesn't have a size known at compile-time | = help: the trait `Sized` is not implemented for `dyn Default` note: required by a bound in `default` --> /home/gh-estebank/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/default.rs:104:20 | 104 | pub trait Default: Sized { | ^^^^^ required by this bound in `Default::default` ... 136 | fn default() -> Self; | ------- required by a bound in this associated function error[E0308]: mismatched types --> f800.rs:2:14 | 2 | let x: u32 = <Default>::default(); | --- ^^^^^^^^^^^^^^^^^^^^ expected `u32`, found `dyn Default` | | | expected due to this | = note: expected type `u32` found trait object `dyn Default` = help: `u32` implements `Default` so you could change the expected type to `Box<dyn Default>` error[E0038]: the trait `Default` cannot be made into an object --> f800.rs:2:14 | 2 | let x: u32 = <Default>::default(); | ^^^^^^^^^^^^^^^^^^^^ `Default` cannot be made into an object | = note: the trait cannot be made into an object because it requires `Self: Sized` = 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> error[E0277]: the size for values of type `dyn Default` cannot be known at compilation time --> f800.rs:2:14 | 2 | let x: u32 = <Default>::default(); | ^^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time | = help: the trait `Sized` is not implemented for `dyn Default` = note: the return type of a function must have a statically known size ```
1 parent 8c4db85 commit 3d46687

15 files changed

+131
-114
lines changed

compiler/rustc_hir_analysis/src/hir_ty_lowering/lint.rs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
use rustc_ast::TraitObjectSyntax;
2-
use rustc_errors::{codes::*, Diag, EmissionGuarantee, StashKey};
2+
use rustc_errors::{codes::*, Diag, EmissionGuarantee, ErrorGuaranteed, StashKey};
33
use rustc_hir as hir;
44
use rustc_hir::def::{DefKind, Res};
55
use rustc_lint_defs::{builtin::BARE_TRAIT_OBJECTS, Applicability};
@@ -17,13 +17,13 @@ impl<'tcx> dyn HirTyLowerer<'tcx> + '_ {
1717
&self,
1818
self_ty: &hir::Ty<'_>,
1919
in_path: bool,
20-
) {
20+
) -> Option<ErrorGuaranteed> {
2121
let tcx = self.tcx();
2222

2323
let hir::TyKind::TraitObject([poly_trait_ref, ..], _, TraitObjectSyntax::None) =
2424
self_ty.kind
2525
else {
26-
return;
26+
return None;
2727
};
2828

2929
let needs_bracket = in_path
@@ -70,7 +70,7 @@ impl<'tcx> dyn HirTyLowerer<'tcx> + '_ {
7070
// Check if the impl trait that we are considering is an impl of a local trait.
7171
self.maybe_suggest_blanket_trait_impl(self_ty, &mut diag);
7272
self.maybe_suggest_assoc_ty_bound(self_ty, &mut diag);
73-
diag.stash(self_ty.span, StashKey::TraitMissingMethod);
73+
diag.stash(self_ty.span, StashKey::TraitMissingMethod)
7474
} else {
7575
tcx.node_span_lint(BARE_TRAIT_OBJECTS, self_ty.hir_id, self_ty.span, |lint| {
7676
lint.primary_message("trait objects without an explicit `dyn` are deprecated");
@@ -83,6 +83,7 @@ impl<'tcx> dyn HirTyLowerer<'tcx> + '_ {
8383
}
8484
self.maybe_suggest_blanket_trait_impl(self_ty, lint);
8585
});
86+
None
8687
}
8788
}
8889

compiler/rustc_hir_analysis/src/hir_ty_lowering/mod.rs

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2080,7 +2080,18 @@ impl<'tcx> dyn HirTyLowerer<'tcx> + '_ {
20802080
)
20812081
}
20822082
hir::TyKind::TraitObject(bounds, lifetime, repr) => {
2083-
self.prohibit_or_lint_bare_trait_object_ty(hir_ty, in_path);
2083+
if let Some(guard) = self.prohibit_or_lint_bare_trait_object_ty(hir_ty, in_path) {
2084+
if let hir::Node::Item(_) | hir::Node::TraitItem(_) | hir::Node::ImplItem(_) =
2085+
tcx.parent_hir_node(hir_ty.hir_id)
2086+
{
2087+
// `tests/ui/suggestions/issue-116434-2021.rs` and others would otherwise
2088+
// fail with no error beign emitted. We restrict the silencing only to
2089+
// expressions, as those *will* emit the error *and* also produce further
2090+
// knock-down errors.
2091+
} else {
2092+
return Ty::new_error(tcx, guard);
2093+
}
2094+
}
20842095

20852096
let repr = match repr {
20862097
TraitObjectSyntax::Dyn | TraitObjectSyntax::None => ty::Dyn,

tests/ui/associated-type-bounds/suggest-assoc-ty-bound-on-eq-bound.rs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,11 @@ fn f(_: impl Trait<T = Copy>) {}
55
//~^ ERROR trait objects must include the `dyn` keyword
66
//~| HELP add `dyn` keyword before this trait
77
//~| HELP you might have meant to write a bound here
8-
//~| ERROR the trait `Copy` cannot be made into an object
98

109
fn g(_: impl Trait<T = std::fmt::Debug + Eq>) {}
1110
//~^ ERROR trait objects must include the `dyn` keyword
1211
//~| HELP add `dyn` keyword before this trait
1312
//~| HELP you might have meant to write a bound here
14-
//~| ERROR only auto traits can be used as additional traits in a trait object
15-
//~| HELP consider creating a new trait
16-
//~| ERROR the trait `Eq` cannot be made into an object
1713

1814
fn h(_: impl Trait<T<> = 'static + for<'a> Fn(&'a ())>) {}
1915
//~^ ERROR trait objects must include the `dyn` keyword
Lines changed: 5 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,3 @@
1-
error[E0038]: the trait `Copy` cannot be made into an object
2-
--> $DIR/suggest-assoc-ty-bound-on-eq-bound.rs:4:20
3-
|
4-
LL | fn f(_: impl Trait<T = Copy>) {}
5-
| ^^^^^^^^ `Copy` cannot be made into an object
6-
|
7-
= note: the trait cannot be made into an object because it requires `Self: Sized`
8-
= 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>
9-
10-
error[E0225]: only auto traits can be used as additional traits in a trait object
11-
--> $DIR/suggest-assoc-ty-bound-on-eq-bound.rs:10:42
12-
|
13-
LL | fn g(_: impl Trait<T = std::fmt::Debug + Eq>) {}
14-
| --------------- ^^ additional non-auto trait
15-
| |
16-
| first non-auto trait
17-
|
18-
= help: consider creating a new trait with all of these as supertraits and using that trait here instead: `trait NewTrait: Debug + Eq {}`
19-
= note: auto-traits like `Send` and `Sync` are traits that have special properties; for more information on them, visit <https://doc.rust-lang.org/reference/special-types-and-traits.html#auto-traits>
20-
21-
error[E0038]: the trait `Eq` cannot be made into an object
22-
--> $DIR/suggest-assoc-ty-bound-on-eq-bound.rs:10:24
23-
|
24-
LL | fn g(_: impl Trait<T = std::fmt::Debug + Eq>) {}
25-
| ^^^^^^^^^^^^^^^^^^^^ `Eq` cannot be made into an object
26-
|
27-
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>
28-
--> $SRC_DIR/core/src/cmp.rs:LL:COL
29-
|
30-
= note: the trait cannot be made into an object because it uses `Self` as a type parameter
31-
321
error[E0782]: trait objects must include the `dyn` keyword
332
--> $DIR/suggest-assoc-ty-bound-on-eq-bound.rs:4:24
343
|
@@ -45,7 +14,7 @@ LL | fn f(_: impl Trait<T: Copy>) {}
4514
| ~
4615

4716
error[E0782]: trait objects must include the `dyn` keyword
48-
--> $DIR/suggest-assoc-ty-bound-on-eq-bound.rs:10:24
17+
--> $DIR/suggest-assoc-ty-bound-on-eq-bound.rs:9:24
4918
|
5019
LL | fn g(_: impl Trait<T = std::fmt::Debug + Eq>) {}
5120
| ^^^^^^^^^^^^^^^^^^^^
@@ -60,7 +29,7 @@ LL | fn g(_: impl Trait<T: std::fmt::Debug + Eq>) {}
6029
| ~
6130

6231
error[E0782]: trait objects must include the `dyn` keyword
63-
--> $DIR/suggest-assoc-ty-bound-on-eq-bound.rs:18:26
32+
--> $DIR/suggest-assoc-ty-bound-on-eq-bound.rs:14:26
6433
|
6534
LL | fn h(_: impl Trait<T<> = 'static + for<'a> Fn(&'a ())>) {}
6635
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -75,7 +44,7 @@ LL | fn h(_: impl Trait<T<>: 'static + for<'a> Fn(&'a ())>) {}
7544
| ~
7645

7746
error[E0782]: trait objects must include the `dyn` keyword
78-
--> $DIR/suggest-assoc-ty-bound-on-eq-bound.rs:24:26
47+
--> $DIR/suggest-assoc-ty-bound-on-eq-bound.rs:20:26
7948
|
8049
LL | type Obj = dyn Trait<T = Clone>;
8150
| ^^^^^
@@ -85,7 +54,6 @@ help: add `dyn` keyword before this trait
8554
LL | type Obj = dyn Trait<T = dyn Clone>;
8655
| +++
8756

88-
error: aborting due to 7 previous errors
57+
error: aborting due to 4 previous errors
8958

90-
Some errors have detailed explanations: E0038, E0225, E0782.
91-
For more information about an error, try `rustc --explain E0038`.
59+
For more information about this error, try `rustc --explain E0782`.

tests/ui/const-generics/generic_const_exprs/expected-type-of-closure-body-to-be-a-closure-or-coroutine-ice-113776.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,8 @@ fn f<T>(
1414
1
1515
}],
1616
) -> impl Iterator<Item = SubAssign> {
17-
//~^ ERROR the type parameter `Rhs` must be explicitly specified
18-
//~| ERROR `()` is not an iterator
17+
//~^ ERROR `()` is not an iterator
1918
//~| ERROR trait objects must include the `dyn` keyword
20-
//~| ERROR the type parameter `Rhs` must be explicitly specified [E0393]
2119
}
2220

2321
pub fn main() {}

tests/ui/const-generics/generic_const_exprs/expected-type-of-closure-body-to-be-a-closure-or-coroutine-ice-113776.stderr

Lines changed: 2 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -16,29 +16,6 @@ help: you might be missing a type parameter
1616
LL | fn f<T, F>(
1717
| +++
1818

19-
error[E0393]: the type parameter `Rhs` must be explicitly specified
20-
--> $DIR/expected-type-of-closure-body-to-be-a-closure-or-coroutine-ice-113776.rs:16:27
21-
|
22-
LL | ) -> impl Iterator<Item = SubAssign> {
23-
| ^^^^^^^^^ help: set the type parameter to the desired type: `SubAssign<Rhs>`
24-
--> $SRC_DIR/core/src/ops/arith.rs:LL:COL
25-
|
26-
= note: type parameter `Rhs` must be specified for this
27-
|
28-
= note: because of the default `Self` reference, type parameters must be specified on object types
29-
30-
error[E0393]: the type parameter `Rhs` must be explicitly specified
31-
--> $DIR/expected-type-of-closure-body-to-be-a-closure-or-coroutine-ice-113776.rs:16:27
32-
|
33-
LL | ) -> impl Iterator<Item = SubAssign> {
34-
| ^^^^^^^^^ help: set the type parameter to the desired type: `SubAssign<Rhs>`
35-
--> $SRC_DIR/core/src/ops/arith.rs:LL:COL
36-
|
37-
= note: type parameter `Rhs` must be specified for this
38-
|
39-
= note: because of the default `Self` reference, type parameters must be specified on object types
40-
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
41-
4219
error[E0277]: `()` is not an iterator
4320
--> $DIR/expected-type-of-closure-body-to-be-a-closure-or-coroutine-ice-113776.rs:16:6
4421
|
@@ -62,7 +39,7 @@ help: you might have meant to write a bound here
6239
LL | ) -> impl Iterator<Item: SubAssign> {
6340
| ~
6441

65-
error: aborting due to 5 previous errors
42+
error: aborting due to 3 previous errors
6643

67-
Some errors have detailed explanations: E0277, E0393, E0412, E0782.
44+
Some errors have detailed explanations: E0277, E0412, E0782.
6845
For more information about an error, try `rustc --explain E0277`.
Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
warning: trait objects without an explicit `dyn` are deprecated
2+
--> $DIR/trait-missing-dyn-in-qualified-path.rs:5:19
3+
|
4+
LL | let x: u32 = <Default>::default();
5+
| ^^^^^^^
6+
|
7+
= warning: this is accepted in the current edition (Rust 2018) 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: `#[warn(bare_trait_objects)]` on by default
10+
help: if this is an object-safe trait, use `dyn`
11+
|
12+
LL | let x: u32 = <dyn Default>::default();
13+
| +++
14+
15+
error[E0038]: the trait `Default` cannot be made into an object
16+
--> $DIR/trait-missing-dyn-in-qualified-path.rs:5:19
17+
|
18+
LL | let x: u32 = <Default>::default();
19+
| ^^^^^^^ `Default` cannot be made into an object
20+
|
21+
= note: the trait cannot be made into an object because it requires `Self: Sized`
22+
= 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>
23+
24+
error[E0277]: the size for values of type `dyn Default` cannot be known at compilation time
25+
--> $DIR/trait-missing-dyn-in-qualified-path.rs:5:19
26+
|
27+
LL | let x: u32 = <Default>::default();
28+
| ^^^^^^^ doesn't have a size known at compile-time
29+
|
30+
= help: the trait `Sized` is not implemented for `dyn Default`
31+
note: required by a bound in `default`
32+
--> $SRC_DIR/core/src/default.rs:LL:COL
33+
34+
error[E0308]: mismatched types
35+
--> $DIR/trait-missing-dyn-in-qualified-path.rs:5:18
36+
|
37+
LL | let x: u32 = <Default>::default();
38+
| --- ^^^^^^^^^^^^^^^^^^^^ expected `u32`, found `dyn Default`
39+
| |
40+
| expected due to this
41+
|
42+
= note: expected type `u32`
43+
found trait object `dyn Default`
44+
= help: `u32` implements `Default` so you could change the expected type to `Box<dyn Default>`
45+
46+
error[E0038]: the trait `Default` cannot be made into an object
47+
--> $DIR/trait-missing-dyn-in-qualified-path.rs:5:18
48+
|
49+
LL | let x: u32 = <Default>::default();
50+
| ^^^^^^^^^^^^^^^^^^^^ `Default` cannot be made into an object
51+
|
52+
= note: the trait cannot be made into an object because it requires `Self: Sized`
53+
= 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>
54+
55+
error[E0277]: the size for values of type `dyn Default` cannot be known at compilation time
56+
--> $DIR/trait-missing-dyn-in-qualified-path.rs:5:18
57+
|
58+
LL | let x: u32 = <Default>::default();
59+
| ^^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time
60+
|
61+
= help: the trait `Sized` is not implemented for `dyn Default`
62+
= note: the return type of a function must have a statically known size
63+
64+
error: aborting due to 5 previous errors; 1 warning emitted
65+
66+
Some errors have detailed explanations: E0038, E0277, E0308.
67+
For more information about an error, try `rustc --explain E0038`.
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
error[E0782]: trait objects must include the `dyn` keyword
2+
--> $DIR/trait-missing-dyn-in-qualified-path.rs:5:19
3+
|
4+
LL | let x: u32 = <Default>::default();
5+
| ^^^^^^^
6+
|
7+
help: add `dyn` keyword before this trait
8+
|
9+
LL | let x: u32 = <dyn Default>::default();
10+
| +++
11+
12+
error: aborting due to 1 previous error
13+
14+
For more information about this error, try `rustc --explain E0782`.
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
//@revisions: edition2018 edition2021
2+
//@[edition2018] edition:2018
3+
//@[edition2021] edition:2021
4+
fn main() {
5+
let x: u32 = <Default>::default();
6+
//[edition2021]~^ ERROR trait objects must include the `dyn` keyword
7+
//[edition2018]~^^ WARNING trait objects without an explicit `dyn` are deprecated
8+
//[edition2018]~| WARNING this is accepted in the current edition (Rust 2018) but is a hard error in Rust 2021!
9+
//[edition2018]~| ERROR trait `Default` cannot be made into an object
10+
//[edition2018]~| ERROR trait `Default` cannot be made into an object
11+
//[edition2018]~| ERROR the size for values of type `dyn Default` cannot be known at compilation time
12+
//[edition2018]~| ERROR the size for values of type `dyn Default` cannot be known at compilation time
13+
//[edition2018]~| ERROR mismatched types
14+
}
Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,3 @@
1-
error[E0277]: the trait bound `(): AsRef<(dyn for<'a> Fn(&'a ()) + 'static)>` is not satisfied
2-
--> $DIR/generic-with-implicit-hrtb-without-dyn.rs:6:13
3-
|
4-
LL | fn ice() -> impl AsRef<Fn(&())> {
5-
| ^^^^^^^^^^^^^^^^^^^ the trait `AsRef<(dyn for<'a> Fn(&'a ()) + 'static)>` is not implemented for `()`
6-
71
error[E0782]: trait objects must include the `dyn` keyword
82
--> $DIR/generic-with-implicit-hrtb-without-dyn.rs:6:24
93
|
@@ -15,7 +9,6 @@ help: add `dyn` keyword before this trait
159
LL | fn ice() -> impl AsRef<dyn Fn(&())> {
1610
| +++
1711

18-
error: aborting due to 2 previous errors
12+
error: aborting due to 1 previous error
1913

20-
Some errors have detailed explanations: E0277, E0782.
21-
For more information about an error, try `rustc --explain E0277`.
14+
For more information about this error, try `rustc --explain E0782`.

tests/ui/impl-trait/generic-with-implicit-hrtb-without-dyn.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
fn ice() -> impl AsRef<Fn(&())> {
77
//[edition2015]~^ ERROR: the trait bound `(): AsRef<(dyn for<'a> Fn(&'a ()) + 'static)>` is not satisfied [E0277]
88
//[edition2021]~^^ ERROR: trait objects must include the `dyn` keyword [E0782]
9-
//[edition2021]~| ERROR: the trait bound `(): AsRef<(dyn for<'a> Fn(&'a ()) + 'static)>` is not satisfied [E0277]
109
todo!()
1110
}
1211

tests/ui/resolve/issue-111312.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ trait Has {
77
trait HasNot {}
88

99
fn main() {
10-
HasNot::has();
11-
//~^ ERROR trait objects must include the `dyn` keyword
12-
//~| ERROR no function or associated item named `has` found for trait `HasNot`
10+
<dyn HasNot>::has();
11+
//~^ ERROR no function or associated item named `has` found for trait `HasNot`
1312
}

tests/ui/resolve/issue-111312.stderr

Lines changed: 5 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,15 @@
1-
error[E0782]: trait objects must include the `dyn` keyword
2-
--> $DIR/issue-111312.rs:10:5
3-
|
4-
LL | HasNot::has();
5-
| ^^^^^^
6-
|
7-
help: add `dyn` keyword before this trait
8-
|
9-
LL | <dyn HasNot>::has();
10-
| ++++ +
11-
121
error[E0599]: no function or associated item named `has` found for trait `HasNot`
13-
--> $DIR/issue-111312.rs:10:13
2+
--> $DIR/issue-111312.rs:10:19
143
|
15-
LL | HasNot::has();
16-
| ^^^ function or associated item not found in `HasNot`
4+
LL | <dyn HasNot>::has();
5+
| ^^^ function or associated item not found in `HasNot`
176
|
187
note: `Has` defines an item `has`
198
--> $DIR/issue-111312.rs:3:1
209
|
2110
LL | trait Has {
2211
| ^^^^^^^^^
2312

24-
error: aborting due to 2 previous errors
13+
error: aborting due to 1 previous error
2514

26-
Some errors have detailed explanations: E0599, E0782.
27-
For more information about an error, try `rustc --explain E0599`.
15+
For more information about this error, try `rustc --explain E0599`.

tests/ui/resolve/issue-111727.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,4 @@
33
fn main() {
44
std::any::Any::create();
55
//~^ ERROR trait objects must include the `dyn` keyword
6-
//~| ERROR no function or associated item named `create` found for trait `Any`
76
}

tests/ui/resolve/issue-111727.stderr

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,6 @@ help: add `dyn` keyword before this trait
99
LL | <dyn std::any::Any>::create();
1010
| ++++ +
1111

12-
error[E0599]: no function or associated item named `create` found for trait `Any`
13-
--> $DIR/issue-111727.rs:4:20
14-
|
15-
LL | std::any::Any::create();
16-
| ^^^^^^ function or associated item not found in `Any`
17-
18-
error: aborting due to 2 previous errors
12+
error: aborting due to 1 previous error
1913

20-
Some errors have detailed explanations: E0599, E0782.
21-
For more information about an error, try `rustc --explain E0599`.
14+
For more information about this error, try `rustc --explain E0782`.

0 commit comments

Comments
 (0)