mirror of
https://github.com/rust-lang/rust.git
synced 2025-02-18 18:04:13 +00:00
review comments
This commit is contained in:
parent
ae0e3d0511
commit
88f5e110db
@ -54,7 +54,7 @@ pub fn report_object_safety_error(
|
||||
"the trait `{}` cannot be made into an object",
|
||||
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 multi_span = vec![];
|
||||
|
@ -647,7 +647,7 @@ impl ObjectSafetyViolation {
|
||||
ObjectSafetyViolation::SizedSelf(_) => "it requires `Self: Sized`".into(),
|
||||
ObjectSafetyViolation::SupertraitSelf(ref spans) => {
|
||||
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 {
|
||||
"it cannot use `Self` as a type parameter in a supertrait or `where`-clause"
|
||||
.into()
|
||||
|
@ -100,51 +100,7 @@ fn object_safety_violations_for_trait(
|
||||
span,
|
||||
) = violation
|
||||
{
|
||||
// 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();
|
||||
},
|
||||
);
|
||||
lint_object_unsafe_trait(tcx, *span, trait_def_id, violation);
|
||||
false
|
||||
} else {
|
||||
true
|
||||
@ -182,6 +138,51 @@ fn object_safety_violations_for_trait(
|
||||
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>(
|
||||
tcx: TyCtxt<'tcx>,
|
||||
bounds: hir::GenericBounds<'tcx>,
|
||||
|
@ -2,7 +2,7 @@ error[E0038]: the trait `Trait` cannot be made into an object
|
||||
--> $DIR/associated-const-in-trait.rs:9:6
|
||||
|
|
||||
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
|
||||
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>
|
||||
|
@ -2,7 +2,7 @@ error[E0038]: the trait `Bar` cannot be made into an object
|
||||
--> $DIR/issue-48027.rs:6:6
|
||||
|
|
||||
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
|
||||
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>
|
||||
|
@ -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
|
||||
|
|
||||
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
|
||||
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>
|
||||
|
@ -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
|
||||
|
|
||||
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: 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>
|
||||
|
@ -8,7 +8,7 @@ error[E0038]: the trait `SomeTrait` cannot be made into an object
|
||||
--> $DIR/E0033-teach.rs:8:20
|
||||
|
|
||||
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>
|
||||
--> $DIR/E0033-teach.rs:4:8
|
||||
|
@ -8,7 +8,7 @@ error[E0038]: the trait `SomeTrait` cannot be made into an object
|
||||
--> $DIR/E0033.rs:6:20
|
||||
|
|
||||
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>
|
||||
--> $DIR/E0033.rs:2:8
|
||||
|
@ -2,7 +2,7 @@ error[E0038]: the trait `Trait` cannot be made into an object
|
||||
--> $DIR/E0038.rs:5:16
|
||||
|
|
||||
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
|
||||
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>
|
||||
|
@ -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
|
||||
|
|
||||
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>
|
||||
--> $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
|
||||
|
|
||||
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>
|
||||
--> $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
|
||||
|
|
||||
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
|
||||
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
|
||||
|
|
||||
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
|
||||
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
|
||||
|
|
||||
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>
|
||||
--> $DIR/feature-gate-object_safe_for_dispatch.rs:4:23
|
||||
|
@ -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
|
||||
|
|
||||
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>
|
||||
--> $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
|
||||
|
|
||||
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>
|
||||
--> $DIR/object-unsafe-trait-in-return-position-dyn-trait.rs:3:8
|
||||
|
@ -2,7 +2,7 @@ error[E0038]: the trait `Bar` cannot be made into an object
|
||||
--> $DIR/issue-18959.rs:11:11
|
||||
|
|
||||
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
|
||||
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>
|
||||
|
@ -2,7 +2,7 @@ error[E0038]: the trait `Qiz` cannot be made into an object
|
||||
--> $DIR/issue-19380.rs:11:9
|
||||
|
|
||||
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>
|
||||
--> $DIR/issue-19380.rs:2:6
|
||||
|
@ -2,7 +2,7 @@ error[E0038]: the trait `Bar` cannot be made into an object
|
||||
--> $DIR/issue-19538.rs:17:15
|
||||
|
|
||||
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
|
||||
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
|
||||
|
|
||||
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
|
||||
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>
|
||||
|
@ -2,7 +2,7 @@ error[E0038]: the trait `Array` cannot be made into an object
|
||||
--> $DIR/issue-20692.rs:7:5
|
||||
|
|
||||
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>
|
||||
--> $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
|
||||
|
|
||||
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>
|
||||
--> $DIR/issue-20692.rs:1:14
|
||||
|
@ -2,13 +2,13 @@ error[E0038]: the trait `Map` cannot be made into an object
|
||||
--> $DIR/issue-26056.rs:20:13
|
||||
|
|
||||
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>
|
||||
--> $DIR/issue-26056.rs:9:12
|
||||
|
|
||||
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...
|
||||
|
||||
|
@ -3,7 +3,7 @@ error[E0038]: the trait `Bar` cannot be made into an object
|
||||
|
|
||||
LL | / dyn Bar
|
||||
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>
|
||||
--> $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=()> {
|
||||
| --- ^^^^^^^^^^^^^
|
||||
| | | |
|
||||
| | | ...because it uses `Self` as a type parameter in this
|
||||
| | ...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
|
||||
| this trait cannot be made into an object...
|
||||
|
||||
error: aborting due to previous error
|
||||
|
@ -2,13 +2,13 @@ error[E0038]: the trait `B` cannot be made into an object
|
||||
--> $DIR/issue-38404.rs:3:15
|
||||
|
|
||||
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>
|
||||
--> $DIR/issue-38404.rs:1:13
|
||||
|
|
||||
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> {}
|
||||
| - this trait cannot be made into an object...
|
||||
|
||||
|
@ -2,13 +2,13 @@ error[E0038]: the trait `Foo` cannot be made into an object
|
||||
--> $DIR/issue-38604.rs:14:13
|
||||
|
|
||||
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>
|
||||
--> $DIR/issue-38604.rs:2:22
|
||||
|
|
||||
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...
|
||||
|
||||
@ -16,13 +16,13 @@ error[E0038]: the trait `Foo` cannot be made into an object
|
||||
--> $DIR/issue-38604.rs:15:9
|
||||
|
|
||||
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>
|
||||
--> $DIR/issue-38604.rs:2:22
|
||||
|
|
||||
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...
|
||||
= note: required because of the requirements on the impl of `CoerceUnsized<Box<dyn Foo>>` for `Box<()>`
|
||||
|
@ -13,7 +13,7 @@ error[E0038]: the trait `Foo` cannot be made into an object
|
||||
--> $DIR/kindck-inherited-copy-bound.rs:28:19
|
||||
|
|
||||
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>
|
||||
--> $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
|
||||
|
|
||||
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>
|
||||
--> $DIR/kindck-inherited-copy-bound.rs:10:13
|
||||
|
@ -13,7 +13,7 @@ error[E0038]: the trait `Foo` cannot be made into an object
|
||||
--> $DIR/kindck-inherited-copy-bound.rs:28:13
|
||||
|
|
||||
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>
|
||||
--> $DIR/kindck-inherited-copy-bound.rs:10:13
|
||||
|
@ -2,7 +2,7 @@ error[E0038]: the trait `Bar` cannot be made into an object
|
||||
--> $DIR/object-safety-associated-consts.rs:12:30
|
||||
|
|
||||
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
|
||||
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>
|
||||
|
@ -2,7 +2,7 @@ error[E0038]: the trait `Bar` cannot be made into an object
|
||||
--> $DIR/object-safety-associated-consts.rs:14:5
|
||||
|
|
||||
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
|
||||
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>
|
||||
|
@ -2,7 +2,7 @@ error[E0038]: the trait `X` cannot be made into an object
|
||||
--> $DIR/object-safety-bounds.rs:7:11
|
||||
|
|
||||
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>
|
||||
--> $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 {
|
||||
| - this trait cannot be made into an object...
|
||||
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
|
||||
|
||||
|
@ -2,7 +2,7 @@ error[E0038]: the trait `Bar` cannot be made into an object
|
||||
--> $DIR/object-safety-generics.rs:18:30
|
||||
|
|
||||
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
|
||||
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
|
||||
|
|
||||
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
|
||||
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>
|
||||
|
@ -2,7 +2,7 @@ error[E0038]: the trait `Bar` cannot be made into an object
|
||||
--> $DIR/object-safety-generics.rs:20:5
|
||||
|
|
||||
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
|
||||
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
|
||||
|
|
||||
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
|
||||
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>
|
||||
|
@ -2,13 +2,13 @@ error[E0038]: the trait `Expr` cannot be made into an object
|
||||
--> $DIR/object-safety-issue-22040.rs:12:23
|
||||
|
|
||||
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>
|
||||
--> $DIR/object-safety-issue-22040.rs:5:21
|
||||
|
|
||||
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...
|
||||
|
||||
|
@ -2,7 +2,7 @@ error[E0038]: the trait `Bar` cannot be made into an object
|
||||
--> $DIR/object-safety-mentions-Self.rs:22:30
|
||||
|
|
||||
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
|
||||
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
|
||||
|
|
||||
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
|
||||
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>
|
||||
|
@ -2,7 +2,7 @@ error[E0038]: the trait `Bar` cannot be made into an object
|
||||
--> $DIR/object-safety-mentions-Self.rs:24:5
|
||||
|
|
||||
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
|
||||
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
|
||||
|
|
||||
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
|
||||
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>
|
||||
|
@ -2,7 +2,7 @@ error[E0038]: the trait `Foo` cannot be made into an object
|
||||
--> $DIR/object-safety-no-static.rs:12:18
|
||||
|
|
||||
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>
|
||||
--> $DIR/object-safety-no-static.rs:9:8
|
||||
|
@ -2,7 +2,7 @@ error[E0038]: the trait `Foo` cannot be made into an object
|
||||
--> $DIR/object-safety-no-static.rs:22:27
|
||||
|
|
||||
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>
|
||||
--> $DIR/object-safety-no-static.rs:9:8
|
||||
|
@ -2,7 +2,7 @@ error[E0038]: the trait `Bar` cannot be made into an object
|
||||
--> $DIR/object-safety-sized-2.rs:14:30
|
||||
|
|
||||
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>
|
||||
--> $DIR/object-safety-sized-2.rs:9:18
|
||||
|
@ -2,7 +2,7 @@ error[E0038]: the trait `Bar` cannot be made into an object
|
||||
--> $DIR/object-safety-sized-2.rs:16:5
|
||||
|
|
||||
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>
|
||||
--> $DIR/object-safety-sized-2.rs:9:18
|
||||
|
@ -2,7 +2,7 @@ error[E0038]: the trait `Bar` cannot be made into an object
|
||||
--> $DIR/object-safety-sized.rs:12:30
|
||||
|
|
||||
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>
|
||||
--> $DIR/object-safety-sized.rs:8:13
|
||||
|
@ -2,7 +2,7 @@ error[E0038]: the trait `Bar` cannot be made into an object
|
||||
--> $DIR/object-safety-sized.rs:14:5
|
||||
|
|
||||
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>
|
||||
--> $DIR/object-safety-sized.rs:8:13
|
||||
|
@ -2,13 +2,13 @@ error[E0038]: the trait `Baz` cannot be made into an object
|
||||
--> $DIR/object-safety-supertrait-mentions-Self.rs:15:31
|
||||
|
|
||||
LL | fn make_baz<T: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>
|
||||
--> $DIR/object-safety-supertrait-mentions-Self.rs:8:13
|
||||
|
|
||||
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...
|
||||
|
||||
|
@ -2,7 +2,7 @@ error[E0038]: the trait `issue_3907::Foo` cannot be made into an object
|
||||
--> $DIR/issue-3907-2.rs:11:12
|
||||
|
|
||||
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>
|
||||
--> $DIR/auxiliary/issue-3907.rs:2:8
|
||||
|
@ -5,7 +5,7 @@ LL | fn foo(self: &Rc<Self>) -> usize;
|
||||
| --------- help: consider changing method `foo`'s `self` parameter to be `&self`: `&Self`
|
||||
...
|
||||
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>
|
||||
--> $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`
|
||||
...
|
||||
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>
|
||||
--> $DIR/arbitrary-self-types-not-object-safe.rs:8:18
|
||||
|
@ -5,7 +5,7 @@ LL | fn foo(self: &Rc<Self>) -> usize;
|
||||
| --------- help: consider changing method `foo`'s `self` parameter to be `&self`: `&Self`
|
||||
...
|
||||
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>
|
||||
--> $DIR/arbitrary-self-types-not-object-safe.rs:8:18
|
||||
|
@ -2,7 +2,7 @@ error[E0038]: the trait `Trait` cannot be made into an object
|
||||
--> $DIR/object-unsafe-trait-references-self.rs:6:11
|
||||
|
|
||||
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 `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
|
||||
|
|
||||
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>
|
||||
--> $DIR/object-unsafe-trait-references-self.rs:8:14
|
||||
|
@ -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
|
||||
|
|
||||
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>
|
||||
--> $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
|
||||
|
|
||||
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>
|
||||
--> $DIR/object-unsafe-trait-should-use-self.rs:8:8
|
||||
|
@ -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
|
||||
|
|
||||
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>
|
||||
--> $DIR/object-unsafe-trait-should-use-where-sized.rs:5:8
|
||||
|
@ -2,7 +2,7 @@ error[E0038]: the trait `Bar` cannot be made into an object
|
||||
--> $DIR/issue-72410.rs:14:19
|
||||
|
|
||||
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>
|
||||
--> $DIR/issue-72410.rs:13:8
|
||||
|
@ -2,13 +2,13 @@ error[E0038]: the trait `Eq` cannot be made into an object
|
||||
--> $DIR/trait-alias-object-fail.rs:7:13
|
||||
|
|
||||
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>
|
||||
--> $SRC_DIR/core/src/cmp.rs:LL:COL
|
||||
|
|
||||
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
|
||||
--> $DIR/trait-alias-object-fail.rs:9:17
|
||||
|
@ -113,7 +113,7 @@ error[E0038]: the trait `assoc_const::C` cannot be made into an object
|
||||
--> $DIR/trait-item-privacy.rs:101:5
|
||||
|
|
||||
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 `B` to another trait
|
||||
|
@ -8,7 +8,7 @@ error[E0038]: the trait `Copy` cannot be made into an object
|
||||
--> $DIR/trait-object-macro-matcher.rs:8:8
|
||||
|
|
||||
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: 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>
|
||||
|
@ -2,7 +2,7 @@ error[E0038]: the trait `Tr` cannot be made into an object
|
||||
--> $DIR/trait-object-safety.rs:15:22
|
||||
|
|
||||
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>
|
||||
--> $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
|
||||
|
|
||||
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>
|
||||
--> $DIR/trait-object-safety.rs:4:8
|
||||
|
@ -14,7 +14,7 @@ error[E0038]: the trait `bar` cannot be made into an object
|
||||
--> $DIR/trait-test-2.rs:11:16
|
||||
|
|
||||
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 `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
|
||||
|
|
||||
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 `blah` to another trait
|
||||
|
@ -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
|
||||
|
|
||||
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
|
||||
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>
|
||||
|
@ -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
|
||||
|
|
||||
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>
|
||||
--> $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
|
||||
|
|
||||
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>
|
||||
--> $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
|
||||
|
|
||||
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>
|
||||
--> $DIR/wf-convert-unsafe-trait-obj-box.rs:6:14
|
||||
|
@ -2,7 +2,7 @@ error[E0038]: the trait `Trait` cannot be made into an object
|
||||
--> $DIR/wf-convert-unsafe-trait-obj.rs:16:25
|
||||
|
|
||||
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>
|
||||
--> $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
|
||||
|
|
||||
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>
|
||||
--> $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
|
||||
|
|
||||
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>
|
||||
--> $DIR/wf-convert-unsafe-trait-obj.rs:6:14
|
||||
|
@ -34,7 +34,7 @@ error[E0038]: the trait `Copy` cannot be made into an object
|
||||
--> $DIR/wf-fn-where-clause.rs:12:16
|
||||
|
|
||||
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: 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>
|
||||
|
@ -2,7 +2,7 @@ error[E0038]: the trait `A` cannot be made into an object
|
||||
--> $DIR/wf-object-safe.rs:9:13
|
||||
|
|
||||
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
|
||||
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>
|
||||
|
@ -16,7 +16,7 @@ error[E0038]: the trait `Trait` cannot be made into an object
|
||||
--> $DIR/wf-unsafe-trait-obj-match.rs:26:21
|
||||
|
|
||||
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>
|
||||
--> $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
|
||||
|
|
||||
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>
|
||||
--> $DIR/wf-unsafe-trait-obj-match.rs:6:14
|
||||
|
Loading…
Reference in New Issue
Block a user