Closed
Description
Code
use std::ops::DispatchFromDyn;
struct Smaht<T, MISC>(PhantomData);
impl<T> DispatchFromDyn<Smaht<U, MISC>> for T {}
trait Foo: X<u32> {}
trait X<T> {
fn foo(self: Smaht<Self, T>);
}
trait Marker {}
impl Marker for Foo {}
Meta
rustc --version --verbose
:
binary: rustc
commit-hash: ffa2e7ae8fbf9badc035740db949b9dae271c29f
commit-date: 2020-10-24
host: x86_64-unknown-linux-gnu
release: 1.49.0-nightly
LLVM version: 11.0
Error output
error[E0412]: cannot find type `PhantomData` in this scope
--> reduced_mutant.rs:2:23
|
2 | struct Smaht<T, MISC>(PhantomData);
| ^^^^^^^^^^^ not found in this scope
|
help: consider importing this struct
|
1 | use std::marker::PhantomData;
|
error[E0412]: cannot find type `U` in this scope
--> reduced_mutant.rs:3:31
|
3 | impl<T> DispatchFromDyn<Smaht<U, MISC>> for T {}
| - ^ help: a type parameter with a similar name exists: `T`
| |
| similarly named type parameter `T` defined here
error[E0412]: cannot find type `MISC` in this scope
--> reduced_mutant.rs:3:34
|
3 | impl<T> DispatchFromDyn<Smaht<U, MISC>> for T {}
| - ^^^^ not found in this scope
| |
| help: you might be missing a type parameter: `, MISC`
warning: trait objects without an explicit `dyn` are deprecated
--> reduced_mutant.rs:9:17
|
9 | impl Marker for Foo {}
| ^^^ help: use `dyn`: `dyn Foo`
|
= note: `#[warn(bare_trait_objects)]` on by default
error[E0601]: `main` function not found in crate `reduced_mutant`
--> reduced_mutant.rs:1:1
|
1 | / use std::ops::DispatchFromDyn;
2 | | struct Smaht<T, MISC>(PhantomData);
3 | | impl<T> DispatchFromDyn<Smaht<U, MISC>> for T {}
4 | | trait Foo: X<u32> {}
... |
8 | | trait Marker {}
9 | | impl Marker for Foo {}
| |______________________^ consider adding a `main` function to `reduced_mutant.rs`
error[E0658]: use of unstable library feature 'dispatch_from_dyn'
--> reduced_mutant.rs:1:5
|
1 | use std::ops::DispatchFromDyn;
| ^^^^^^^^^^^^^^^^^^^^^^^^^
|
= help: add `#![feature(dispatch_from_dyn)]` to the crate attributes to enable
error[E0658]: use of unstable library feature 'dispatch_from_dyn'
--> reduced_mutant.rs:3:9
|
3 | impl<T> DispatchFromDyn<Smaht<U, MISC>> for T {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= help: add `#![feature(dispatch_from_dyn)]` to the crate attributes to enable
error: internal compiler error: compiler/rustc_trait_selection/src/traits/object_safety.rs:469:33: error: the type `[type error]` has an unknown layout
while computing layout for type Smaht<(), T>
thread 'rustc' panicked at 'Box<Any>', compiler/rustc_errors/src/lib.rs:945:9
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
note: the compiler unexpectedly panicked. this is a bug.
note: we would appreciate a bug report: https://github.com/rust-lang/rust/issues/new?labels=C-bug%2C+I-ICE%2C+T-compiler&template=ice.md
note: rustc 1.49.0-nightly (ffa2e7ae8 2020-10-24) running on x86_64-unknown-linux-gnu
query stack during panic:
#0 [object_safety_violations] determine object safety of trait `Foo`
#1 [coherent_trait] coherence checking all impls of trait `Marker`
end of query stack
error: aborting due to 7 previous errors; 1 warning emitted
Some errors have detailed explanations: E0412, E0601, E0658.
For more information about an error, try `rustc --explain E0412`.
Backtrace
error: internal compiler error: compiler/rustc_trait_selection/src/traits/object_safety.rs:469:33: error: the type `[type error]` has an unknown layout
while computing layout for type Smaht<(), T>
thread 'rustc' panicked at 'Box<Any>', compiler/rustc_errors/src/lib.rs:945:9
stack backtrace:
0: std::panicking::begin_panic
1: rustc_errors::HandlerInner::bug
2: rustc_errors::Handler::bug
3: rustc_middle::util::bug::opt_span_bug_fmt::{{closure}}
4: rustc_middle::ty::context::tls::with_opt::{{closure}}
5: rustc_middle::ty::context::tls::with_opt
6: rustc_middle::util::bug::opt_span_bug_fmt
7: rustc_middle::util::bug::bug_fmt
8: rustc_trait_selection::traits::object_safety::virtual_call_violation_for_method::{{closure}}
9: rustc_trait_selection::traits::object_safety::virtual_call_violation_for_method
10: rustc_trait_selection::traits::object_safety::object_safety_violation_for_method
11: <core::iter::adapters::Map<I,F> as core::iter::traits::iterator::Iterator>::try_fold
12: <alloc::vec::Vec<T> as alloc::vec::SpecFromIter<T,I>>::from_iter
13: core::ops::function::impls::<impl core::ops::function::FnOnce<A> for &mut F>::call_once
14: <core::iter::adapters::flatten::FlatMap<I,U,F> as core::iter::traits::iterator::Iterator>::next
15: <smallvec::SmallVec<A> as core::iter::traits::collect::Extend<<A as smallvec::Array>::Item>>::extend
16: rustc_middle::arena::Arena::alloc_from_iter
17: rustc_trait_selection::traits::object_safety::object_safety_violations
18: rustc_query_system::dep_graph::graph::DepGraph<K>::with_task_impl
19: rustc_data_structures::stack::ensure_sufficient_stack
20: rustc_query_system::query::plumbing::get_query_impl
21: rustc_middle::ty::<impl rustc_middle::ty::context::TyCtxt>::is_object_safe
22: rustc_typeck::coherence::coherent_trait
23: rustc_middle::ty::query::<impl rustc_query_system::query::config::QueryAccessors<rustc_middle::ty::context::TyCtxt> for rustc_middle::ty::query::queries::coherent_trait>::compute
24: rustc_query_system::dep_graph::graph::DepGraph<K>::with_task_impl
25: rustc_data_structures::stack::ensure_sufficient_stack
26: rustc_query_system::query::plumbing::get_query_impl
27: rustc_query_system::query::plumbing::ensure_query_impl
28: rustc_session::session::Session::track_errors
29: rustc_typeck::check_crate
30: rustc_interface::passes::analysis
31: rustc_middle::ty::query::<impl rustc_query_system::query::config::QueryAccessors<rustc_middle::ty::context::TyCtxt> for rustc_middle::ty::query::queries::analysis>::compute
32: rustc_query_system::dep_graph::graph::DepGraph<K>::with_task_impl
33: rustc_middle::ty::query::plumbing::<impl rustc_query_system::query::QueryContext for rustc_middle::ty::context::TyCtxt>::start_query::{{closure}}::{{closure}}::{{closure}}
34: rustc_query_system::query::plumbing::get_query_impl
35: rustc_interface::passes::QueryContext::enter
36: rustc_interface::queries::<impl rustc_interface::interface::Compiler>::enter
37: rustc_span::with_source_map
38: rustc_interface::interface::create_compiler_and_run
39: scoped_tls::ScopedKey<T>::set
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
note: the compiler unexpectedly panicked. this is a bug.
note: we would appreciate a bug report: https://github.com/rust-lang/rust/issues/new?labels=C-bug%2C+I-ICE%2C+T-compiler&template=ice.md
note: rustc 1.49.0-nightly (ffa2e7ae8 2020-10-24) running on x86_64-unknown-linux-gnu
NOTE: The bug is found by our work-in-progress compiler testing tool Kira, and the test program is reduced/minimized by Perses