review comments

This commit is contained in:
Esteban Küber 2020-10-19 17:57:18 -07:00
parent ae0e3d0511
commit 88f5e110db
55 changed files with 133 additions and 132 deletions

View file

@ -54,7 +54,7 @@ pub fn report_object_safety_error(
"the trait `{}` cannot be made into an object", "the trait `{}` cannot be made into an object",
trait_str trait_str
); );
err.span_label(span, format!("the trait `{}` cannot be made into an object", trait_str)); err.span_label(span, format!("`{}` cannot be made into an object", trait_str));
let mut reported_violations = FxHashSet::default(); let mut reported_violations = FxHashSet::default();
let mut multi_span = vec![]; let mut multi_span = vec![];

View file

@ -647,7 +647,7 @@ impl ObjectSafetyViolation {
ObjectSafetyViolation::SizedSelf(_) => "it requires `Self: Sized`".into(), ObjectSafetyViolation::SizedSelf(_) => "it requires `Self: Sized`".into(),
ObjectSafetyViolation::SupertraitSelf(ref spans) => { ObjectSafetyViolation::SupertraitSelf(ref spans) => {
if spans.iter().any(|sp| *sp != DUMMY_SP) { if spans.iter().any(|sp| *sp != DUMMY_SP) {
"it uses `Self` as a type parameter in this".into() "it uses `Self` as a type parameter".into()
} else { } else {
"it cannot use `Self` as a type parameter in a supertrait or `where`-clause" "it cannot use `Self` as a type parameter in a supertrait or `where`-clause"
.into() .into()

View file

@ -100,51 +100,7 @@ fn object_safety_violations_for_trait(
span, span,
) = violation ) = violation
{ {
// Using `CRATE_NODE_ID` is wrong, but it's hard to get a more precise id. lint_object_unsafe_trait(tcx, *span, trait_def_id, violation);
// It's also hard to get a use site span, so we use the method definition span.
tcx.struct_span_lint_hir(
WHERE_CLAUSES_OBJECT_SAFETY,
hir::CRATE_HIR_ID,
*span,
|lint| {
let mut err = lint.build(&format!(
"the trait `{}` cannot be made into an object",
tcx.def_path_str(trait_def_id)
));
let node = tcx.hir().get_if_local(trait_def_id);
let mut spans = MultiSpan::from_span(*span);
if let Some(hir::Node::Item(item)) = node {
spans.push_span_label(
item.ident.span,
"this trait cannot be made into an object...".into(),
);
spans.push_span_label(
*span,
format!("...because {}", violation.error_msg()),
);
} else {
spans.push_span_label(
*span,
format!(
"the trait cannot be made into an object because {}",
violation.error_msg()
),
);
};
err.span_note(
spans,
"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>",
);
if node.is_some() {
// Only provide the help if its a local trait, otherwise it's not
violation.solution(&mut err);
}
err.emit();
},
);
false false
} else { } else {
true true
@ -182,6 +138,51 @@ fn object_safety_violations_for_trait(
violations violations
} }
/// Lint object-unsafe trait.
fn lint_object_unsafe_trait(
tcx: TyCtxt<'_>,
span: Span,
trait_def_id: DefId,
violation: &ObjectSafetyViolation,
) {
// Using `CRATE_NODE_ID` is wrong, but it's hard to get a more precise id.
// It's also hard to get a use site span, so we use the method definition span.
tcx.struct_span_lint_hir(WHERE_CLAUSES_OBJECT_SAFETY, hir::CRATE_HIR_ID, span, |lint| {
let mut err = lint.build(&format!(
"the trait `{}` cannot be made into an object",
tcx.def_path_str(trait_def_id)
));
let node = tcx.hir().get_if_local(trait_def_id);
let mut spans = MultiSpan::from_span(span);
if let Some(hir::Node::Item(item)) = node {
spans.push_span_label(
item.ident.span,
"this trait cannot be made into an object...".into(),
);
spans.push_span_label(span, format!("...because {}", violation.error_msg()));
} else {
spans.push_span_label(
span,
format!(
"the trait cannot be made into an object because {}",
violation.error_msg()
),
);
};
err.span_note(
spans,
"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>",
);
if node.is_some() {
// Only provide the help if its a local trait, otherwise it's not
violation.solution(&mut err);
}
err.emit();
});
}
fn sized_trait_bound_spans<'tcx>( fn sized_trait_bound_spans<'tcx>(
tcx: TyCtxt<'tcx>, tcx: TyCtxt<'tcx>,
bounds: hir::GenericBounds<'tcx>, bounds: hir::GenericBounds<'tcx>,

View file

@ -2,7 +2,7 @@ error[E0038]: the trait `Trait` cannot be made into an object
--> $DIR/associated-const-in-trait.rs:9:6 --> $DIR/associated-const-in-trait.rs:9:6
| |
LL | impl dyn Trait { LL | impl dyn Trait {
| ^^^^^^^^^ the trait `Trait` cannot be made into an object | ^^^^^^^^^ `Trait` cannot be made into an object
| |
= help: consider moving `N` to another trait = help: consider moving `N` to another trait
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> 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>

View file

@ -2,7 +2,7 @@ error[E0038]: the trait `Bar` cannot be made into an object
--> $DIR/issue-48027.rs:6:6 --> $DIR/issue-48027.rs:6:6
| |
LL | impl dyn Bar {} LL | impl dyn Bar {}
| ^^^^^^^ the trait `Bar` cannot be made into an object | ^^^^^^^ `Bar` cannot be made into an object
| |
= help: consider moving `X` to another trait = help: consider moving `X` to another trait
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> 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>

View file

@ -2,7 +2,7 @@ error[E0038]: the trait `NotObjectSafe` cannot be made into an object
--> $DIR/coherence-impl-trait-for-trait-object-safe.rs:7:24 --> $DIR/coherence-impl-trait-for-trait-object-safe.rs:7:24
| |
LL | impl NotObjectSafe for dyn NotObjectSafe { } LL | impl NotObjectSafe for dyn NotObjectSafe { }
| ^^^^^^^^^^^^^^^^^ the trait `NotObjectSafe` cannot be made into an object | ^^^^^^^^^^^^^^^^^ `NotObjectSafe` cannot be made into an object
| |
= help: consider moving `eq` to another trait = help: consider moving `eq` to another trait
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> 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>

View file

@ -14,7 +14,7 @@ error[E0038]: the trait `Copy` cannot be made into an object
--> $DIR/trait-object-reference-without-parens-suggestion.rs:4:12 --> $DIR/trait-object-reference-without-parens-suggestion.rs:4:12
| |
LL | let _: &Copy + 'static; LL | let _: &Copy + 'static;
| ^^^^^ the trait `Copy` cannot be made into an object | ^^^^^ `Copy` cannot be made into an object
| |
= note: the trait cannot be made into an object because it requires `Self: Sized` = 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> = 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>

View file

@ -8,7 +8,7 @@ error[E0038]: the trait `SomeTrait` cannot be made into an object
--> $DIR/E0033-teach.rs:8:20 --> $DIR/E0033-teach.rs:8:20
| |
LL | let trait_obj: &dyn SomeTrait = SomeTrait; LL | let trait_obj: &dyn SomeTrait = SomeTrait;
| ^^^^^^^^^^^^^^ the trait `SomeTrait` cannot be made into an object | ^^^^^^^^^^^^^^ `SomeTrait` cannot be made into an object
| |
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> 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>
--> $DIR/E0033-teach.rs:4:8 --> $DIR/E0033-teach.rs:4:8

View file

@ -8,7 +8,7 @@ error[E0038]: the trait `SomeTrait` cannot be made into an object
--> $DIR/E0033.rs:6:20 --> $DIR/E0033.rs:6:20
| |
LL | let trait_obj: &dyn SomeTrait = SomeTrait; LL | let trait_obj: &dyn SomeTrait = SomeTrait;
| ^^^^^^^^^^^^^^ the trait `SomeTrait` cannot be made into an object | ^^^^^^^^^^^^^^ `SomeTrait` cannot be made into an object
| |
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> 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>
--> $DIR/E0033.rs:2:8 --> $DIR/E0033.rs:2:8

View file

@ -2,7 +2,7 @@ error[E0038]: the trait `Trait` cannot be made into an object
--> $DIR/E0038.rs:5:16 --> $DIR/E0038.rs:5:16
| |
LL | fn call_foo(x: Box<dyn Trait>) { LL | fn call_foo(x: Box<dyn Trait>) {
| ^^^^^^^^^^^^^^ the trait `Trait` cannot be made into an object | ^^^^^^^^^^^^^^ `Trait` cannot be made into an object
| |
= help: consider moving `foo` to another trait = help: consider moving `foo` to another trait
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> 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>

View file

@ -2,7 +2,7 @@ error[E0038]: the trait `NonObjectSafe1` cannot be made into an object
--> $DIR/feature-gate-object_safe_for_dispatch.rs:18:38 --> $DIR/feature-gate-object_safe_for_dispatch.rs:18:38
| |
LL | fn takes_non_object_safe_ref<T>(obj: &dyn NonObjectSafe1) { LL | fn takes_non_object_safe_ref<T>(obj: &dyn NonObjectSafe1) {
| ^^^^^^^^^^^^^^^^^^^ the trait `NonObjectSafe1` cannot be made into an object | ^^^^^^^^^^^^^^^^^^^ `NonObjectSafe1` cannot be made into an object
| |
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> 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>
--> $DIR/feature-gate-object_safe_for_dispatch.rs:4:23 --> $DIR/feature-gate-object_safe_for_dispatch.rs:4:23
@ -16,7 +16,7 @@ error[E0038]: the trait `NonObjectSafe2` cannot be made into an object
--> $DIR/feature-gate-object_safe_for_dispatch.rs:22:36 --> $DIR/feature-gate-object_safe_for_dispatch.rs:22:36
| |
LL | fn return_non_object_safe_ref() -> &'static dyn NonObjectSafe2 { LL | fn return_non_object_safe_ref() -> &'static dyn NonObjectSafe2 {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `NonObjectSafe2` cannot be made into an object | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ `NonObjectSafe2` cannot be made into an object
| |
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> 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>
--> $DIR/feature-gate-object_safe_for_dispatch.rs:7:8 --> $DIR/feature-gate-object_safe_for_dispatch.rs:7:8
@ -38,7 +38,7 @@ error[E0038]: the trait `NonObjectSafe3` cannot be made into an object
--> $DIR/feature-gate-object_safe_for_dispatch.rs:27:35 --> $DIR/feature-gate-object_safe_for_dispatch.rs:27:35
| |
LL | fn takes_non_object_safe_box(obj: Box<dyn NonObjectSafe3>) { LL | fn takes_non_object_safe_box(obj: Box<dyn NonObjectSafe3>) {
| ^^^^^^^^^^^^^^^^^^^^^^^ the trait `NonObjectSafe3` cannot be made into an object | ^^^^^^^^^^^^^^^^^^^^^^^ `NonObjectSafe3` cannot be made into an object
| |
= help: consider moving `foo` to another trait = help: consider moving `foo` to another trait
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> 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>
@ -53,7 +53,7 @@ error[E0038]: the trait `NonObjectSafe4` cannot be made into an object
--> $DIR/feature-gate-object_safe_for_dispatch.rs:31:35 --> $DIR/feature-gate-object_safe_for_dispatch.rs:31:35
| |
LL | fn return_non_object_safe_rc() -> std::rc::Rc<dyn NonObjectSafe4> { LL | fn return_non_object_safe_rc() -> std::rc::Rc<dyn NonObjectSafe4> {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `NonObjectSafe4` cannot be made into an object | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `NonObjectSafe4` cannot be made into an object
| |
= help: consider moving `foo` to another trait = help: consider moving `foo` to another trait
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> 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>
@ -68,7 +68,7 @@ error[E0038]: the trait `NonObjectSafe1` cannot be made into an object
--> $DIR/feature-gate-object_safe_for_dispatch.rs:38:16 --> $DIR/feature-gate-object_safe_for_dispatch.rs:38:16
| |
LL | impl Trait for dyn NonObjectSafe1 {} LL | impl Trait for dyn NonObjectSafe1 {}
| ^^^^^^^^^^^^^^^^^^ the trait `NonObjectSafe1` cannot be made into an object | ^^^^^^^^^^^^^^^^^^ `NonObjectSafe1` cannot be made into an object
| |
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> 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>
--> $DIR/feature-gate-object_safe_for_dispatch.rs:4:23 --> $DIR/feature-gate-object_safe_for_dispatch.rs:4:23

View file

@ -2,7 +2,7 @@ error[E0038]: the trait `NotObjectSafe` cannot be made into an object
--> $DIR/object-unsafe-trait-in-return-position-dyn-trait.rs:21:13 --> $DIR/object-unsafe-trait-in-return-position-dyn-trait.rs:21:13
| |
LL | fn car() -> dyn NotObjectSafe { LL | fn car() -> dyn NotObjectSafe {
| ^^^^^^^^^^^^^^^^^ the trait `NotObjectSafe` cannot be made into an object | ^^^^^^^^^^^^^^^^^ `NotObjectSafe` cannot be made into an object
| |
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> 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>
--> $DIR/object-unsafe-trait-in-return-position-dyn-trait.rs:3:8 --> $DIR/object-unsafe-trait-in-return-position-dyn-trait.rs:3:8
@ -24,7 +24,7 @@ error[E0038]: the trait `NotObjectSafe` cannot be made into an object
--> $DIR/object-unsafe-trait-in-return-position-dyn-trait.rs:28:13 --> $DIR/object-unsafe-trait-in-return-position-dyn-trait.rs:28:13
| |
LL | fn cat() -> Box<dyn NotObjectSafe> { LL | fn cat() -> Box<dyn NotObjectSafe> {
| ^^^^^^^^^^^^^^^^^^^^^^ the trait `NotObjectSafe` cannot be made into an object | ^^^^^^^^^^^^^^^^^^^^^^ `NotObjectSafe` cannot be made into an object
| |
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> 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>
--> $DIR/object-unsafe-trait-in-return-position-dyn-trait.rs:3:8 --> $DIR/object-unsafe-trait-in-return-position-dyn-trait.rs:3:8

View file

@ -2,7 +2,7 @@ error[E0038]: the trait `Bar` cannot be made into an object
--> $DIR/issue-18959.rs:11:11 --> $DIR/issue-18959.rs:11:11
| |
LL | fn foo(b: &dyn Bar) { LL | fn foo(b: &dyn Bar) {
| ^^^^^^^^ the trait `Bar` cannot be made into an object | ^^^^^^^^ `Bar` cannot be made into an object
| |
= help: consider moving `foo` to another trait = help: consider moving `foo` to another trait
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> 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>

View file

@ -2,7 +2,7 @@ error[E0038]: the trait `Qiz` cannot be made into an object
--> $DIR/issue-19380.rs:11:9 --> $DIR/issue-19380.rs:11:9
| |
LL | foos: &'static [&'static (dyn Qiz + 'static)] LL | foos: &'static [&'static (dyn Qiz + 'static)]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Qiz` cannot be made into an object | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `Qiz` cannot be made into an object
| |
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> 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>
--> $DIR/issue-19380.rs:2:6 --> $DIR/issue-19380.rs:2:6

View file

@ -2,7 +2,7 @@ error[E0038]: the trait `Bar` cannot be made into an object
--> $DIR/issue-19538.rs:17:15 --> $DIR/issue-19538.rs:17:15
| |
LL | let test: &mut dyn Bar = &mut thing; LL | let test: &mut dyn Bar = &mut thing;
| ^^^^^^^^^^^^ the trait `Bar` cannot be made into an object | ^^^^^^^^^^^^ `Bar` cannot be made into an object
| |
= help: consider moving `foo` to another trait = help: consider moving `foo` to another trait
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> 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>
@ -18,7 +18,7 @@ error[E0038]: the trait `Bar` cannot be made into an object
--> $DIR/issue-19538.rs:17:30 --> $DIR/issue-19538.rs:17:30
| |
LL | let test: &mut dyn Bar = &mut thing; LL | let test: &mut dyn Bar = &mut thing;
| ^^^^^^^^^^ the trait `Bar` cannot be made into an object | ^^^^^^^^^^ `Bar` cannot be made into an object
| |
= help: consider moving `foo` to another trait = help: consider moving `foo` to another trait
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> 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>

View file

@ -2,7 +2,7 @@ error[E0038]: the trait `Array` cannot be made into an object
--> $DIR/issue-20692.rs:7:5 --> $DIR/issue-20692.rs:7:5
| |
LL | &dyn Array; LL | &dyn Array;
| ^^^^^^^^^^ the trait `Array` cannot be made into an object | ^^^^^^^^^^ `Array` cannot be made into an object
| |
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> 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>
--> $DIR/issue-20692.rs:1:14 --> $DIR/issue-20692.rs:1:14
@ -17,7 +17,7 @@ error[E0038]: the trait `Array` cannot be made into an object
--> $DIR/issue-20692.rs:4:13 --> $DIR/issue-20692.rs:4:13
| |
LL | let _ = x LL | let _ = x
| ^ the trait `Array` cannot be made into an object | ^ `Array` cannot be made into an object
| |
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> 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>
--> $DIR/issue-20692.rs:1:14 --> $DIR/issue-20692.rs:1:14

View file

@ -2,13 +2,13 @@ error[E0038]: the trait `Map` cannot be made into an object
--> $DIR/issue-26056.rs:20:13 --> $DIR/issue-26056.rs:20:13
| |
LL | as &dyn Map<Key=u32,MapValue=u32>; LL | as &dyn Map<Key=u32,MapValue=u32>;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Map` cannot be made into an object | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `Map` cannot be made into an object
| |
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> 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>
--> $DIR/issue-26056.rs:9:12 --> $DIR/issue-26056.rs:9:12
| |
LL | trait Map: MapLookup<<Self as Map>::Key> { LL | trait Map: MapLookup<<Self as Map>::Key> {
| --- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ...because it uses `Self` as a type parameter in this | --- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ...because it uses `Self` as a type parameter
| | | |
| this trait cannot be made into an object... | this trait cannot be made into an object...

View file

@ -3,7 +3,7 @@ error[E0038]: the trait `Bar` cannot be made into an object
| |
LL | / dyn Bar LL | / dyn Bar
LL | | <Assoc=()> LL | | <Assoc=()>
| |________________________^ the trait `Bar` cannot be made into an object | |________________________^ `Bar` cannot be made into an object
| |
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> 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>
--> $DIR/issue-28576.rs:5:16 --> $DIR/issue-28576.rs:5:16
@ -11,8 +11,8 @@ note: for a trait to be "object safe" it needs to allow building a vtable to all
LL | pub trait Bar: Foo<Assoc=()> { LL | pub trait Bar: Foo<Assoc=()> {
| --- ^^^^^^^^^^^^^ | --- ^^^^^^^^^^^^^
| | | | | | | |
| | | ...because it uses `Self` as a type parameter in this | | | ...because it uses `Self` as a type parameter
| | ...because it uses `Self` as a type parameter in this | | ...because it uses `Self` as a type parameter
| this trait cannot be made into an object... | this trait cannot be made into an object...
error: aborting due to previous error error: aborting due to previous error

View file

@ -2,13 +2,13 @@ error[E0038]: the trait `B` cannot be made into an object
--> $DIR/issue-38404.rs:3:15 --> $DIR/issue-38404.rs:3:15
| |
LL | trait C<T>: A<dyn B<T, Output=usize>> {} LL | trait C<T>: A<dyn B<T, Output=usize>> {}
| ^^^^^^^^^^^^^^^^^^^^^^ the trait `B` cannot be made into an object | ^^^^^^^^^^^^^^^^^^^^^^ `B` cannot be made into an object
| |
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> 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>
--> $DIR/issue-38404.rs:1:13 --> $DIR/issue-38404.rs:1:13
| |
LL | trait A<T>: std::ops::Add<Self> + Sized {} LL | trait A<T>: std::ops::Add<Self> + Sized {}
| ^^^^^^^^^^^^^^^^^^^ ...because it uses `Self` as a type parameter in this | ^^^^^^^^^^^^^^^^^^^ ...because it uses `Self` as a type parameter
LL | trait B<T>: A<T> {} LL | trait B<T>: A<T> {}
| - this trait cannot be made into an object... | - this trait cannot be made into an object...

View file

@ -2,13 +2,13 @@ error[E0038]: the trait `Foo` cannot be made into an object
--> $DIR/issue-38604.rs:14:13 --> $DIR/issue-38604.rs:14:13
| |
LL | let _f: Box<dyn Foo> = LL | let _f: Box<dyn Foo> =
| ^^^^^^^^^^^^ the trait `Foo` cannot be made into an object | ^^^^^^^^^^^^ `Foo` cannot be made into an object
| |
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> 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>
--> $DIR/issue-38604.rs:2:22 --> $DIR/issue-38604.rs:2:22
| |
LL | trait Foo where u32: Q<Self> { LL | trait Foo where u32: Q<Self> {
| --- ^^^^^^^ ...because it uses `Self` as a type parameter in this | --- ^^^^^^^ ...because it uses `Self` as a type parameter
| | | |
| this trait cannot be made into an object... | this trait cannot be made into an object...
@ -16,13 +16,13 @@ error[E0038]: the trait `Foo` cannot be made into an object
--> $DIR/issue-38604.rs:15:9 --> $DIR/issue-38604.rs:15:9
| |
LL | Box::new(()); LL | Box::new(());
| ^^^^^^^^^^^^ the trait `Foo` cannot be made into an object | ^^^^^^^^^^^^ `Foo` cannot be made into an object
| |
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> 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>
--> $DIR/issue-38604.rs:2:22 --> $DIR/issue-38604.rs:2:22
| |
LL | trait Foo where u32: Q<Self> { LL | trait Foo where u32: Q<Self> {
| --- ^^^^^^^ ...because it uses `Self` as a type parameter in this | --- ^^^^^^^ ...because it uses `Self` as a type parameter
| | | |
| this trait cannot be made into an object... | this trait cannot be made into an object...
= note: required because of the requirements on the impl of `CoerceUnsized<Box<dyn Foo>>` for `Box<()>` = note: required because of the requirements on the impl of `CoerceUnsized<Box<dyn Foo>>` for `Box<()>`

View file

@ -13,7 +13,7 @@ error[E0038]: the trait `Foo` cannot be made into an object
--> $DIR/kindck-inherited-copy-bound.rs:28:19 --> $DIR/kindck-inherited-copy-bound.rs:28:19
| |
LL | let z = &x as &dyn Foo; LL | let z = &x as &dyn Foo;
| ^^^^^^^^ the trait `Foo` cannot be made into an object | ^^^^^^^^ `Foo` cannot be made into an object
| |
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> 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>
--> $DIR/kindck-inherited-copy-bound.rs:10:13 --> $DIR/kindck-inherited-copy-bound.rs:10:13
@ -27,7 +27,7 @@ error[E0038]: the trait `Foo` cannot be made into an object
--> $DIR/kindck-inherited-copy-bound.rs:28:13 --> $DIR/kindck-inherited-copy-bound.rs:28:13
| |
LL | let z = &x as &dyn Foo; LL | let z = &x as &dyn Foo;
| ^^ the trait `Foo` cannot be made into an object | ^^ `Foo` cannot be made into an object
| |
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> 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>
--> $DIR/kindck-inherited-copy-bound.rs:10:13 --> $DIR/kindck-inherited-copy-bound.rs:10:13

View file

@ -13,7 +13,7 @@ error[E0038]: the trait `Foo` cannot be made into an object
--> $DIR/kindck-inherited-copy-bound.rs:28:13 --> $DIR/kindck-inherited-copy-bound.rs:28:13
| |
LL | let z = &x as &dyn Foo; LL | let z = &x as &dyn Foo;
| ^^ the trait `Foo` cannot be made into an object | ^^ `Foo` cannot be made into an object
| |
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> 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>
--> $DIR/kindck-inherited-copy-bound.rs:10:13 --> $DIR/kindck-inherited-copy-bound.rs:10:13

View file

@ -2,7 +2,7 @@ error[E0038]: the trait `Bar` cannot be made into an object
--> $DIR/object-safety-associated-consts.rs:12:30 --> $DIR/object-safety-associated-consts.rs:12:30
| |
LL | fn make_bar<T:Bar>(t: &T) -> &dyn Bar { LL | fn make_bar<T:Bar>(t: &T) -> &dyn Bar {
| ^^^^^^^^ the trait `Bar` cannot be made into an object | ^^^^^^^^ `Bar` cannot be made into an object
| |
= help: consider moving `X` to another trait = help: consider moving `X` to another trait
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> 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>

View file

@ -2,7 +2,7 @@ error[E0038]: the trait `Bar` cannot be made into an object
--> $DIR/object-safety-associated-consts.rs:14:5 --> $DIR/object-safety-associated-consts.rs:14:5
| |
LL | t LL | t
| ^ the trait `Bar` cannot be made into an object | ^ `Bar` cannot be made into an object
| |
= help: consider moving `X` to another trait = help: consider moving `X` to another trait
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> 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>

View file

@ -2,7 +2,7 @@ error[E0038]: the trait `X` cannot be made into an object
--> $DIR/object-safety-bounds.rs:7:11 --> $DIR/object-safety-bounds.rs:7:11
| |
LL | fn f() -> Box<dyn X<U = u32>> { LL | fn f() -> Box<dyn X<U = u32>> {
| ^^^^^^^^^^^^^^^^^^^ the trait `X` cannot be made into an object | ^^^^^^^^^^^^^^^^^^^ `X` cannot be made into an object
| |
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> 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>
--> $DIR/object-safety-bounds.rs:4:13 --> $DIR/object-safety-bounds.rs:4:13
@ -10,7 +10,7 @@ note: for a trait to be "object safe" it needs to allow building a vtable to all
LL | trait X { LL | trait X {
| - this trait cannot be made into an object... | - this trait cannot be made into an object...
LL | type U: PartialEq<Self>; LL | type U: PartialEq<Self>;
| ^^^^^^^^^^^^^^^ ...because it uses `Self` as a type parameter in this | ^^^^^^^^^^^^^^^ ...because it uses `Self` as a type parameter
error: aborting due to previous error error: aborting due to previous error

View file

@ -2,7 +2,7 @@ error[E0038]: the trait `Bar` cannot be made into an object
--> $DIR/object-safety-generics.rs:18:30 --> $DIR/object-safety-generics.rs:18:30
| |
LL | fn make_bar<T:Bar>(t: &T) -> &dyn Bar { LL | fn make_bar<T:Bar>(t: &T) -> &dyn Bar {
| ^^^^^^^^ the trait `Bar` cannot be made into an object | ^^^^^^^^ `Bar` cannot be made into an object
| |
= help: consider moving `bar` to another trait = help: consider moving `bar` to another trait
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> 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>
@ -17,7 +17,7 @@ error[E0038]: the trait `Bar` cannot be made into an object
--> $DIR/object-safety-generics.rs:24:39 --> $DIR/object-safety-generics.rs:24:39
| |
LL | fn make_bar_explicit<T:Bar>(t: &T) -> &dyn Bar { LL | fn make_bar_explicit<T:Bar>(t: &T) -> &dyn Bar {
| ^^^^^^^^ the trait `Bar` cannot be made into an object | ^^^^^^^^ `Bar` cannot be made into an object
| |
= help: consider moving `bar` to another trait = help: consider moving `bar` to another trait
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> 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>

View file

@ -2,7 +2,7 @@ error[E0038]: the trait `Bar` cannot be made into an object
--> $DIR/object-safety-generics.rs:20:5 --> $DIR/object-safety-generics.rs:20:5
| |
LL | t LL | t
| ^ the trait `Bar` cannot be made into an object | ^ `Bar` cannot be made into an object
| |
= help: consider moving `bar` to another trait = help: consider moving `bar` to another trait
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> 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>
@ -19,7 +19,7 @@ error[E0038]: the trait `Bar` cannot be made into an object
--> $DIR/object-safety-generics.rs:26:5 --> $DIR/object-safety-generics.rs:26:5
| |
LL | t as &dyn Bar LL | t as &dyn Bar
| ^ the trait `Bar` cannot be made into an object | ^ `Bar` cannot be made into an object
| |
= help: consider moving `bar` to another trait = help: consider moving `bar` to another trait
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> 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>

View file

@ -2,13 +2,13 @@ error[E0038]: the trait `Expr` cannot be made into an object
--> $DIR/object-safety-issue-22040.rs:12:23 --> $DIR/object-safety-issue-22040.rs:12:23
| |
LL | elements: Vec<Box<dyn Expr + 'x>>, LL | elements: Vec<Box<dyn Expr + 'x>>,
| ^^^^^^^^^^^^^ the trait `Expr` cannot be made into an object | ^^^^^^^^^^^^^ `Expr` cannot be made into an object
| |
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> 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>
--> $DIR/object-safety-issue-22040.rs:5:21 --> $DIR/object-safety-issue-22040.rs:5:21
| |
LL | trait Expr: Debug + PartialEq { LL | trait Expr: Debug + PartialEq {
| ---- ^^^^^^^^^ ...because it uses `Self` as a type parameter in this | ---- ^^^^^^^^^ ...because it uses `Self` as a type parameter
| | | |
| this trait cannot be made into an object... | this trait cannot be made into an object...

View file

@ -2,7 +2,7 @@ error[E0038]: the trait `Bar` cannot be made into an object
--> $DIR/object-safety-mentions-Self.rs:22:30 --> $DIR/object-safety-mentions-Self.rs:22:30
| |
LL | fn make_bar<T:Bar>(t: &T) -> &dyn Bar { LL | fn make_bar<T:Bar>(t: &T) -> &dyn Bar {
| ^^^^^^^^ the trait `Bar` cannot be made into an object | ^^^^^^^^ `Bar` cannot be made into an object
| |
= help: consider moving `bar` to another trait = help: consider moving `bar` to another trait
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> 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>
@ -17,7 +17,7 @@ error[E0038]: the trait `Baz` cannot be made into an object
--> $DIR/object-safety-mentions-Self.rs:28:30 --> $DIR/object-safety-mentions-Self.rs:28:30
| |
LL | fn make_baz<T:Baz>(t: &T) -> &dyn Baz { LL | fn make_baz<T:Baz>(t: &T) -> &dyn Baz {
| ^^^^^^^^ the trait `Baz` cannot be made into an object | ^^^^^^^^ `Baz` cannot be made into an object
| |
= help: consider moving `baz` to another trait = help: consider moving `baz` to another trait
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> 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>

View file

@ -2,7 +2,7 @@ error[E0038]: the trait `Bar` cannot be made into an object
--> $DIR/object-safety-mentions-Self.rs:24:5 --> $DIR/object-safety-mentions-Self.rs:24:5
| |
LL | t LL | t
| ^ the trait `Bar` cannot be made into an object | ^ `Bar` cannot be made into an object
| |
= help: consider moving `bar` to another trait = help: consider moving `bar` to another trait
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> 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>
@ -19,7 +19,7 @@ error[E0038]: the trait `Baz` cannot be made into an object
--> $DIR/object-safety-mentions-Self.rs:30:5 --> $DIR/object-safety-mentions-Self.rs:30:5
| |
LL | t LL | t
| ^ the trait `Baz` cannot be made into an object | ^ `Baz` cannot be made into an object
| |
= help: consider moving `baz` to another trait = help: consider moving `baz` to another trait
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> 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>

View file

@ -2,7 +2,7 @@ error[E0038]: the trait `Foo` cannot be made into an object
--> $DIR/object-safety-no-static.rs:12:18 --> $DIR/object-safety-no-static.rs:12:18
| |
LL | fn diverges() -> Box<dyn Foo> { LL | fn diverges() -> Box<dyn Foo> {
| ^^^^^^^^^^^^ the trait `Foo` cannot be made into an object | ^^^^^^^^^^^^ `Foo` cannot be made into an object
| |
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> 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>
--> $DIR/object-safety-no-static.rs:9:8 --> $DIR/object-safety-no-static.rs:9:8

View file

@ -2,7 +2,7 @@ error[E0038]: the trait `Foo` cannot be made into an object
--> $DIR/object-safety-no-static.rs:22:27 --> $DIR/object-safety-no-static.rs:22:27
| |
LL | let b: Box<dyn Foo> = Box::new(Bar); LL | let b: Box<dyn Foo> = Box::new(Bar);
| ^^^^^^^^^^^^^ the trait `Foo` cannot be made into an object | ^^^^^^^^^^^^^ `Foo` cannot be made into an object
| |
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> 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>
--> $DIR/object-safety-no-static.rs:9:8 --> $DIR/object-safety-no-static.rs:9:8

View file

@ -2,7 +2,7 @@ error[E0038]: the trait `Bar` cannot be made into an object
--> $DIR/object-safety-sized-2.rs:14:30 --> $DIR/object-safety-sized-2.rs:14:30
| |
LL | fn make_bar<T:Bar>(t: &T) -> &dyn Bar { LL | fn make_bar<T:Bar>(t: &T) -> &dyn Bar {
| ^^^^^^^^ the trait `Bar` cannot be made into an object | ^^^^^^^^ `Bar` cannot be made into an object
| |
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> 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>
--> $DIR/object-safety-sized-2.rs:9:18 --> $DIR/object-safety-sized-2.rs:9:18

View file

@ -2,7 +2,7 @@ error[E0038]: the trait `Bar` cannot be made into an object
--> $DIR/object-safety-sized-2.rs:16:5 --> $DIR/object-safety-sized-2.rs:16:5
| |
LL | t LL | t
| ^ the trait `Bar` cannot be made into an object | ^ `Bar` cannot be made into an object
| |
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> 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>
--> $DIR/object-safety-sized-2.rs:9:18 --> $DIR/object-safety-sized-2.rs:9:18

View file

@ -2,7 +2,7 @@ error[E0038]: the trait `Bar` cannot be made into an object
--> $DIR/object-safety-sized.rs:12:30 --> $DIR/object-safety-sized.rs:12:30
| |
LL | fn make_bar<T:Bar>(t: &T) -> &dyn Bar { LL | fn make_bar<T:Bar>(t: &T) -> &dyn Bar {
| ^^^^^^^^ the trait `Bar` cannot be made into an object | ^^^^^^^^ `Bar` cannot be made into an object
| |
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> 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>
--> $DIR/object-safety-sized.rs:8:13 --> $DIR/object-safety-sized.rs:8:13

View file

@ -2,7 +2,7 @@ error[E0038]: the trait `Bar` cannot be made into an object
--> $DIR/object-safety-sized.rs:14:5 --> $DIR/object-safety-sized.rs:14:5
| |
LL | t LL | t
| ^ the trait `Bar` cannot be made into an object | ^ `Bar` cannot be made into an object
| |
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> 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>
--> $DIR/object-safety-sized.rs:8:13 --> $DIR/object-safety-sized.rs:8:13

View file

@ -2,13 +2,13 @@ error[E0038]: the trait `Baz` cannot be made into an object
--> $DIR/object-safety-supertrait-mentions-Self.rs:15:31 --> $DIR/object-safety-supertrait-mentions-Self.rs:15:31
| |
LL | fn make_baz<T:Baz>(t: &T) -> &dyn Baz { LL | fn make_baz<T:Baz>(t: &T) -> &dyn Baz {
| ^^^^^^^ the trait `Baz` cannot be made into an object | ^^^^^^^ `Baz` cannot be made into an object
| |
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> 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>
--> $DIR/object-safety-supertrait-mentions-Self.rs:8:13 --> $DIR/object-safety-supertrait-mentions-Self.rs:8:13
| |
LL | trait Baz : Bar<Self> { LL | trait Baz : Bar<Self> {
| --- ^^^^^^^^^ ...because it uses `Self` as a type parameter in this | --- ^^^^^^^^^ ...because it uses `Self` as a type parameter
| | | |
| this trait cannot be made into an object... | this trait cannot be made into an object...

View file

@ -2,7 +2,7 @@ error[E0038]: the trait `issue_3907::Foo` cannot be made into an object
--> $DIR/issue-3907-2.rs:11:12 --> $DIR/issue-3907-2.rs:11:12
| |
LL | fn bar(_x: Foo) {} LL | fn bar(_x: Foo) {}
| ^^^ the trait `issue_3907::Foo` cannot be made into an object | ^^^ `issue_3907::Foo` cannot be made into an object
| |
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> 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>
--> $DIR/auxiliary/issue-3907.rs:2:8 --> $DIR/auxiliary/issue-3907.rs:2:8

View file

@ -5,7 +5,7 @@ LL | fn foo(self: &Rc<Self>) -> usize;
| --------- help: consider changing method `foo`'s `self` parameter to be `&self`: `&Self` | --------- help: consider changing method `foo`'s `self` parameter to be `&self`: `&Self`
... ...
LL | let x = Rc::new(5usize) as Rc<dyn Foo>; LL | let x = Rc::new(5usize) as Rc<dyn Foo>;
| ^^^^^^^^^^^ the trait `Foo` cannot be made into an object | ^^^^^^^^^^^ `Foo` cannot be made into an object
| |
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> 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>
--> $DIR/arbitrary-self-types-not-object-safe.rs:8:18 --> $DIR/arbitrary-self-types-not-object-safe.rs:8:18
@ -22,7 +22,7 @@ LL | fn foo(self: &Rc<Self>) -> usize;
| --------- help: consider changing method `foo`'s `self` parameter to be `&self`: `&Self` | --------- help: consider changing method `foo`'s `self` parameter to be `&self`: `&Self`
... ...
LL | let x = Rc::new(5usize) as Rc<dyn Foo>; LL | let x = Rc::new(5usize) as Rc<dyn Foo>;
| ^^^^^^^^^^^^^^^ the trait `Foo` cannot be made into an object | ^^^^^^^^^^^^^^^ `Foo` cannot be made into an object
| |
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> 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>
--> $DIR/arbitrary-self-types-not-object-safe.rs:8:18 --> $DIR/arbitrary-self-types-not-object-safe.rs:8:18

View file

@ -5,7 +5,7 @@ LL | fn foo(self: &Rc<Self>) -> usize;
| --------- help: consider changing method `foo`'s `self` parameter to be `&self`: `&Self` | --------- help: consider changing method `foo`'s `self` parameter to be `&self`: `&Self`
... ...
LL | let x = Rc::new(5usize) as Rc<dyn Foo>; LL | let x = Rc::new(5usize) as Rc<dyn Foo>;
| ^^^^^^^^^^^^^^^ the trait `Foo` cannot be made into an object | ^^^^^^^^^^^^^^^ `Foo` cannot be made into an object
| |
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> 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>
--> $DIR/arbitrary-self-types-not-object-safe.rs:8:18 --> $DIR/arbitrary-self-types-not-object-safe.rs:8:18

View file

@ -2,7 +2,7 @@ error[E0038]: the trait `Trait` cannot be made into an object
--> $DIR/object-unsafe-trait-references-self.rs:6:11 --> $DIR/object-unsafe-trait-references-self.rs:6:11
| |
LL | fn bar(x: &dyn Trait) {} LL | fn bar(x: &dyn Trait) {}
| ^^^^^^^^^^ the trait `Trait` cannot be made into an object | ^^^^^^^^^^ `Trait` cannot be made into an object
| |
= help: consider moving `baz` to another trait = help: consider moving `baz` to another trait
= help: consider moving `bat` to another trait = help: consider moving `bat` to another trait
@ -20,7 +20,7 @@ error[E0038]: the trait `Other` cannot be made into an object
--> $DIR/object-unsafe-trait-references-self.rs:10:11 --> $DIR/object-unsafe-trait-references-self.rs:10:11
| |
LL | fn foo(x: &dyn Other) {} LL | fn foo(x: &dyn Other) {}
| ^^^^^^^^^^ the trait `Other` cannot be made into an object | ^^^^^^^^^^ `Other` cannot be made into an object
| |
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> 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>
--> $DIR/object-unsafe-trait-references-self.rs:8:14 --> $DIR/object-unsafe-trait-references-self.rs:8:14

View file

@ -15,7 +15,7 @@ error[E0038]: the trait `A` cannot be made into an object
--> $DIR/object-unsafe-trait-should-use-self.rs:3:13 --> $DIR/object-unsafe-trait-should-use-self.rs:3:13
| |
LL | fn f(a: A) -> A; LL | fn f(a: A) -> A;
| ^ the trait `A` cannot be made into an object | ^ `A` cannot be made into an object
| |
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> 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>
--> $DIR/object-unsafe-trait-should-use-self.rs:2:10 --> $DIR/object-unsafe-trait-should-use-self.rs:2:10
@ -42,7 +42,7 @@ error[E0038]: the trait `B` cannot be made into an object
--> $DIR/object-unsafe-trait-should-use-self.rs:8:13 --> $DIR/object-unsafe-trait-should-use-self.rs:8:13
| |
LL | fn f(a: B) -> B; LL | fn f(a: B) -> B;
| ^ the trait `B` cannot be made into an object | ^ `B` cannot be made into an object
| |
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> 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>
--> $DIR/object-unsafe-trait-should-use-self.rs:8:8 --> $DIR/object-unsafe-trait-should-use-self.rs:8:8

View file

@ -2,7 +2,7 @@ error[E0038]: the trait `Trait` cannot be made into an object
--> $DIR/object-unsafe-trait-should-use-where-sized.rs:9:11 --> $DIR/object-unsafe-trait-should-use-where-sized.rs:9:11
| |
LL | fn bar(x: &dyn Trait) {} LL | fn bar(x: &dyn Trait) {}
| ^^^^^^^^^^ the trait `Trait` cannot be made into an object | ^^^^^^^^^^ `Trait` cannot be made into an object
| |
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> 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>
--> $DIR/object-unsafe-trait-should-use-where-sized.rs:5:8 --> $DIR/object-unsafe-trait-should-use-where-sized.rs:5:8

View file

@ -2,7 +2,7 @@ error[E0038]: the trait `Bar` cannot be made into an object
--> $DIR/issue-72410.rs:14:19 --> $DIR/issue-72410.rs:14:19
| |
LL | where for<'a> &'a mut [dyn Bar]: ; LL | where for<'a> &'a mut [dyn Bar]: ;
| ^^^^^^^^^^^^^^^^^ the trait `Bar` cannot be made into an object | ^^^^^^^^^^^^^^^^^ `Bar` cannot be made into an object
| |
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> 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>
--> $DIR/issue-72410.rs:13:8 --> $DIR/issue-72410.rs:13:8

View file

@ -2,13 +2,13 @@ error[E0038]: the trait `Eq` cannot be made into an object
--> $DIR/trait-alias-object-fail.rs:7:13 --> $DIR/trait-alias-object-fail.rs:7:13
| |
LL | let _: &dyn EqAlias = &123; LL | let _: &dyn EqAlias = &123;
| ^^^^^^^^^^^ the trait `Eq` cannot be made into an object | ^^^^^^^^^^^ `Eq` cannot be made into an object
| |
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> 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>
--> $SRC_DIR/core/src/cmp.rs:LL:COL --> $SRC_DIR/core/src/cmp.rs:LL:COL
| |
LL | pub trait Eq: PartialEq<Self> { LL | pub trait Eq: PartialEq<Self> {
| ^^^^^^^^^^^^^^^ the trait cannot be made into an object because it uses `Self` as a type parameter in this | ^^^^^^^^^^^^^^^ the trait cannot be made into an object because it uses `Self` as a type parameter
error[E0191]: the value of the associated type `Item` (from trait `Iterator`) must be specified error[E0191]: the value of the associated type `Item` (from trait `Iterator`) must be specified
--> $DIR/trait-alias-object-fail.rs:9:17 --> $DIR/trait-alias-object-fail.rs:9:17

View file

@ -113,7 +113,7 @@ error[E0038]: the trait `assoc_const::C` cannot be made into an object
--> $DIR/trait-item-privacy.rs:101:5 --> $DIR/trait-item-privacy.rs:101:5
| |
LL | C::A; LL | C::A;
| ^^^^ the trait `assoc_const::C` cannot be made into an object | ^^^^ `assoc_const::C` cannot be made into an object
| |
= help: consider moving `C` to another trait = help: consider moving `C` to another trait
= help: consider moving `B` to another trait = help: consider moving `B` to another trait

View file

@ -8,7 +8,7 @@ error[E0038]: the trait `Copy` cannot be made into an object
--> $DIR/trait-object-macro-matcher.rs:8:8 --> $DIR/trait-object-macro-matcher.rs:8:8
| |
LL | m!(dyn Copy + Send + 'static); LL | m!(dyn Copy + Send + 'static);
| ^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Copy` cannot be made into an object | ^^^^^^^^^^^^^^^^^^^^^^^^^ `Copy` cannot be made into an object
| |
= note: the trait cannot be made into an object because it requires `Self: Sized` = 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> = 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>

View file

@ -2,7 +2,7 @@ error[E0038]: the trait `Tr` cannot be made into an object
--> $DIR/trait-object-safety.rs:15:22 --> $DIR/trait-object-safety.rs:15:22
| |
LL | let _: &dyn Tr = &St; LL | let _: &dyn Tr = &St;
| ^^^ the trait `Tr` cannot be made into an object | ^^^ `Tr` cannot be made into an object
| |
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> 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>
--> $DIR/trait-object-safety.rs:4:8 --> $DIR/trait-object-safety.rs:4:8
@ -26,7 +26,7 @@ error[E0038]: the trait `Tr` cannot be made into an object
--> $DIR/trait-object-safety.rs:15:12 --> $DIR/trait-object-safety.rs:15:12
| |
LL | let _: &dyn Tr = &St; LL | let _: &dyn Tr = &St;
| ^^^^^^^ the trait `Tr` cannot be made into an object | ^^^^^^^ `Tr` cannot be made into an object
| |
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> 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>
--> $DIR/trait-object-safety.rs:4:8 --> $DIR/trait-object-safety.rs:4:8

View file

@ -14,7 +14,7 @@ error[E0038]: the trait `bar` cannot be made into an object
--> $DIR/trait-test-2.rs:11:16 --> $DIR/trait-test-2.rs:11:16
| |
LL | (box 10 as Box<dyn bar>).dup(); LL | (box 10 as Box<dyn bar>).dup();
| ^^^^^^^^^^^^ the trait `bar` cannot be made into an object | ^^^^^^^^^^^^ `bar` cannot be made into an object
| |
= help: consider moving `dup` to another trait = help: consider moving `dup` to another trait
= help: consider moving `blah` to another trait = help: consider moving `blah` to another trait
@ -31,7 +31,7 @@ error[E0038]: the trait `bar` cannot be made into an object
--> $DIR/trait-test-2.rs:11:6 --> $DIR/trait-test-2.rs:11:6
| |
LL | (box 10 as Box<dyn bar>).dup(); LL | (box 10 as Box<dyn bar>).dup();
| ^^^^^^ the trait `bar` cannot be made into an object | ^^^^^^ `bar` cannot be made into an object
| |
= help: consider moving `dup` to another trait = help: consider moving `dup` to another trait
= help: consider moving `blah` to another trait = help: consider moving `blah` to another trait

View file

@ -14,7 +14,7 @@ error[E0038]: the trait `MyAdd` cannot be made into an object
--> $DIR/type-parameter-defaults-referencing-Self-ppaux.rs:14:18 --> $DIR/type-parameter-defaults-referencing-Self-ppaux.rs:14:18
| |
LL | let y = x as dyn MyAdd<i32>; LL | let y = x as dyn MyAdd<i32>;
| ^^^^^^^^^^^^^^ the trait `MyAdd` cannot be made into an object | ^^^^^^^^^^^^^^ `MyAdd` cannot be made into an object
| |
= help: consider moving `add` to another trait = help: consider moving `add` to another trait
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> 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>

View file

@ -2,7 +2,7 @@ error[E0038]: the trait `Trait` cannot be made into an object
--> $DIR/wf-convert-unsafe-trait-obj-box.rs:16:33 --> $DIR/wf-convert-unsafe-trait-obj-box.rs:16:33
| |
LL | let t_box: Box<dyn Trait> = Box::new(S); LL | let t_box: Box<dyn Trait> = Box::new(S);
| ^^^^^^^^^^^ the trait `Trait` cannot be made into an object | ^^^^^^^^^^^ `Trait` cannot be made into an object
| |
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> 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>
--> $DIR/wf-convert-unsafe-trait-obj-box.rs:6:14 --> $DIR/wf-convert-unsafe-trait-obj-box.rs:6:14
@ -18,7 +18,7 @@ error[E0038]: the trait `Trait` cannot be made into an object
--> $DIR/wf-convert-unsafe-trait-obj-box.rs:17:15 --> $DIR/wf-convert-unsafe-trait-obj-box.rs:17:15
| |
LL | takes_box(Box::new(S)); LL | takes_box(Box::new(S));
| ^^^^^^^^^^^ the trait `Trait` cannot be made into an object | ^^^^^^^^^^^ `Trait` cannot be made into an object
| |
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> 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>
--> $DIR/wf-convert-unsafe-trait-obj-box.rs:6:14 --> $DIR/wf-convert-unsafe-trait-obj-box.rs:6:14
@ -34,7 +34,7 @@ error[E0038]: the trait `Trait` cannot be made into an object
--> $DIR/wf-convert-unsafe-trait-obj-box.rs:15:5 --> $DIR/wf-convert-unsafe-trait-obj-box.rs:15:5
| |
LL | Box::new(S) as Box<dyn Trait>; LL | Box::new(S) as Box<dyn Trait>;
| ^^^^^^^^^^^ the trait `Trait` cannot be made into an object | ^^^^^^^^^^^ `Trait` cannot be made into an object
| |
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> 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>
--> $DIR/wf-convert-unsafe-trait-obj-box.rs:6:14 --> $DIR/wf-convert-unsafe-trait-obj-box.rs:6:14

View file

@ -2,7 +2,7 @@ error[E0038]: the trait `Trait` cannot be made into an object
--> $DIR/wf-convert-unsafe-trait-obj.rs:16:25 --> $DIR/wf-convert-unsafe-trait-obj.rs:16:25
| |
LL | let t: &dyn Trait = &S; LL | let t: &dyn Trait = &S;
| ^^ the trait `Trait` cannot be made into an object | ^^ `Trait` cannot be made into an object
| |
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> 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>
--> $DIR/wf-convert-unsafe-trait-obj.rs:6:14 --> $DIR/wf-convert-unsafe-trait-obj.rs:6:14
@ -18,7 +18,7 @@ error[E0038]: the trait `Trait` cannot be made into an object
--> $DIR/wf-convert-unsafe-trait-obj.rs:17:17 --> $DIR/wf-convert-unsafe-trait-obj.rs:17:17
| |
LL | takes_trait(&S); LL | takes_trait(&S);
| ^^ the trait `Trait` cannot be made into an object | ^^ `Trait` cannot be made into an object
| |
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> 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>
--> $DIR/wf-convert-unsafe-trait-obj.rs:6:14 --> $DIR/wf-convert-unsafe-trait-obj.rs:6:14
@ -34,7 +34,7 @@ error[E0038]: the trait `Trait` cannot be made into an object
--> $DIR/wf-convert-unsafe-trait-obj.rs:15:5 --> $DIR/wf-convert-unsafe-trait-obj.rs:15:5
| |
LL | &S as &dyn Trait; LL | &S as &dyn Trait;
| ^^ the trait `Trait` cannot be made into an object | ^^ `Trait` cannot be made into an object
| |
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> 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>
--> $DIR/wf-convert-unsafe-trait-obj.rs:6:14 --> $DIR/wf-convert-unsafe-trait-obj.rs:6:14

View file

@ -34,7 +34,7 @@ error[E0038]: the trait `Copy` cannot be made into an object
--> $DIR/wf-fn-where-clause.rs:12:16 --> $DIR/wf-fn-where-clause.rs:12:16
| |
LL | fn bar() where Vec<dyn Copy>:, {} LL | fn bar() where Vec<dyn Copy>:, {}
| ^^^^^^^^^^^^^ the trait `Copy` cannot be made into an object | ^^^^^^^^^^^^^ `Copy` cannot be made into an object
| |
= note: the trait cannot be made into an object because it requires `Self: Sized` = 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> = 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>

View file

@ -2,7 +2,7 @@ error[E0038]: the trait `A` cannot be made into an object
--> $DIR/wf-object-safe.rs:9:13 --> $DIR/wf-object-safe.rs:9:13
| |
LL | let _x: &dyn A; LL | let _x: &dyn A;
| ^^^^^^ the trait `A` cannot be made into an object | ^^^^^^ `A` cannot be made into an object
| |
= help: consider moving `foo` to another trait = help: consider moving `foo` to another trait
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> 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>

View file

@ -16,7 +16,7 @@ error[E0038]: the trait `Trait` cannot be made into an object
--> $DIR/wf-unsafe-trait-obj-match.rs:26:21 --> $DIR/wf-unsafe-trait-obj-match.rs:26:21
| |
LL | Some(()) => &S, LL | Some(()) => &S,
| ^^ the trait `Trait` cannot be made into an object | ^^ `Trait` cannot be made into an object
| |
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> 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>
--> $DIR/wf-unsafe-trait-obj-match.rs:6:14 --> $DIR/wf-unsafe-trait-obj-match.rs:6:14
@ -32,7 +32,7 @@ error[E0038]: the trait `Trait` cannot be made into an object
--> $DIR/wf-unsafe-trait-obj-match.rs:25:25 --> $DIR/wf-unsafe-trait-obj-match.rs:25:25
| |
LL | let t: &dyn Trait = match opt() { LL | let t: &dyn Trait = match opt() {
| ^^^^^^^^^^^ the trait `Trait` cannot be made into an object | ^^^^^^^^^^^ `Trait` cannot be made into an object
| |
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> 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>
--> $DIR/wf-unsafe-trait-obj-match.rs:6:14 --> $DIR/wf-unsafe-trait-obj-match.rs:6:14