Closed
Description
Code
trait Foo<T, T = T> {}
fn eq<A, B>() {
eq::<dyn, Foo>
}
Meta
rustc --version --verbose
:
rustc 1.55.0-nightly (6d820866a 2021-06-29)
binary: rustc
commit-hash: 6d820866a27b1949e237be79b9c8c0145fe728b7
commit-date: 2021-06-29
host: x86_64-unknown-linux-gnu
release: 1.55.0-nightly
LLVM version: 12.0.1
Error output
error[E0403]: the name `T` is already used for a generic parameter in this item's generic parameters
--> mutant.rs:1:14
|
1 | trait Foo<T, T = T> {}
| - ^ already used
| |
| first use of `T`
error[E0412]: cannot find type `dyn` in this scope
--> mutant.rs:3:10
|
2 | fn eq<A, B>() {
| - help: you might be missing a type parameter: `, dyn`
3 | eq::<dyn, Foo>
| ^^^ not found in this scope
warning: trait objects without an explicit `dyn` are deprecated
--> mutant.rs:3:15
|
3 | eq::<dyn, Foo>
| ^^^ help: use `dyn`: `dyn Foo`
|
= note: `#[warn(bare_trait_objects)]` on by default
= warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021!
= note: for more information, see issue #80165 <https://github.com/rust-lang/rust/issues/80165>
error[E0601]: `main` function not found in crate `mutant`
--> mutant.rs:1:1
|
1 | / trait Foo<T, T = T> {}
2 | | fn eq<A, B>() {
3 | | eq::<dyn, Foo>
4 | | }
| |_^ consider adding a `main` function to `mutant.rs`
error[E0107]: missing generics for trait `Foo`
--> mutant.rs:3:15
|
3 | eq::<dyn, Foo>
| ^^^ expected at least 1 generic argument
|
note: trait defined here, with at least 1 generic parameter: `T`
--> mutant.rs:1:7
|
1 | trait Foo<T, T = T> {}
| ^^^ -
help: add missing generic argument
|
3 | eq::<dyn, Foo<T>>
| ^^^^^^
error: internal compiler error: compiler/rustc_middle/src/ty/subst.rs:538:17: type parameter `T/#2` (T/2) out of range when substituting, substs=[FreshTy(0), [type error]]
--> mutant.rs:3:15
|
3 | eq::<dyn, Foo>
| ^^^
thread 'rustc' panicked at 'Box<dyn Any>', /rustc/6d820866a27b1949e237be79b9c8c0145fe728b7/compiler/rustc_errors/src/lib.rs:952: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.55.0-nightly (6d820866a 2021-06-29) running on x86_64-unknown-linux-gnu
query stack during panic:
#0 [typeck] type-checking `eq`
#1 [typeck_item_bodies] type-checking all item bodies
end of query stack
error: aborting due to 5 previous errors; 1 warning emitted
Some errors have detailed explanations: E0107, E0403, E0412, E0601.
For more information about an error, try `rustc --explain E0107`.
Backtrace
error[E0403]: the name `T` is already used for a generic parameter in this item's generic parameters
--> mutant.rs:1:14
|
1 | trait Foo<T, T = T> {}
| - ^ already used
| |
| first use of `T`
error[E0412]: cannot find type `dyn` in this scope
--> mutant.rs:3:10
|
2 | fn eq<A, B>() {
| - help: you might be missing a type parameter: `, dyn`
3 | eq::<dyn, Foo>
| ^^^ not found in this scope
warning: trait objects without an explicit `dyn` are deprecated
--> mutant.rs:3:15
|
3 | eq::<dyn, Foo>
| ^^^ help: use `dyn`: `dyn Foo`
|
= note: `#[warn(bare_trait_objects)]` on by default
= warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021!
= note: for more information, see issue #80165 <https://github.com/rust-lang/rust/issues/80165>
error[E0601]: `main` function not found in crate `mutant`
--> mutant.rs:1:1
|
1 | / trait Foo<T, T = T> {}
2 | | fn eq<A, B>() {
3 | | eq::<dyn, Foo>
4 | | }
| |_^ consider adding a `main` function to `mutant.rs`
error[E0107]: missing generics for trait `Foo`
--> mutant.rs:3:15
|
3 | eq::<dyn, Foo>
| ^^^ expected at least 1 generic argument
|
note: trait defined here, with at least 1 generic parameter: `T`
--> mutant.rs:1:7
|
1 | trait Foo<T, T = T> {}
| ^^^ -
help: add missing generic argument
|
3 | eq::<dyn, Foo<T>>
| ^^^^^^
error: internal compiler error: compiler/rustc_middle/src/ty/subst.rs:538:17: type parameter `T/#2` (T/2) out of range when substituting, substs=[FreshTy(0), [type error]]
--> mutant.rs:3:15
|
3 | eq::<dyn, Foo>
| ^^^
thread 'rustc' panicked at 'Box<dyn Any>', /rustc/6d820866a27b1949e237be79b9c8c0145fe728b7/compiler/rustc_errors/src/lib.rs:952:9
stack backtrace:
0: std::panicking::begin_panic
1: std::panic::panic_any
2: rustc_errors::HandlerInner::span_bug
3: rustc_errors::Handler::span_bug
4: rustc_middle::ty::context::tls::with_opt
5: rustc_middle::util::bug::opt_span_bug_fmt
6: rustc_middle::util::bug::span_bug_fmt
7: <rustc_middle::ty::subst::SubstFolder as rustc_middle::ty::fold::TypeFolder>::fold_ty
8: <<dyn rustc_typeck::astconv::AstConv>::create_substs_for_ast_path::SubstsForAstPathCtxt as rustc_typeck::astconv::CreateSubstsForGenericArgsCtxt>::inferred_kind
9: <dyn rustc_typeck::astconv::AstConv>::create_substs_for_ast_path
10: <dyn rustc_typeck::astconv::AstConv>::create_substs_for_ast_trait_ref
11: <dyn rustc_typeck::astconv::AstConv>::instantiate_poly_trait_ref
12: <dyn rustc_typeck::astconv::AstConv>::conv_object_ty_poly_trait_ref
13: <dyn rustc_typeck::astconv::AstConv>::ast_ty_to_ty_inner
14: <rustc_typeck::check::fn_ctxt::_impl::<impl rustc_typeck::check::fn_ctxt::FnCtxt>::instantiate_value_path::CreateCtorSubstsContext as rustc_typeck::astconv::CreateSubstsForGenericArgsCtxt>::provided_kind
15: rustc_typeck::astconv::generics::<impl dyn rustc_typeck::astconv::AstConv>::create_substs_for_generic_args
16: rustc_typeck::check::fn_ctxt::_impl::<impl rustc_typeck::check::fn_ctxt::FnCtxt>::instantiate_value_path
17: rustc_typeck::check::expr::<impl rustc_typeck::check::fn_ctxt::FnCtxt>::check_expr_kind
18: rustc_typeck::check::expr::<impl rustc_typeck::check::fn_ctxt::FnCtxt>::check_expr_with_expectation
19: rustc_typeck::check::fn_ctxt::checks::<impl rustc_typeck::check::fn_ctxt::FnCtxt>::check_block_with_expected
20: rustc_typeck::check::expr::<impl rustc_typeck::check::fn_ctxt::FnCtxt>::check_expr_with_expectation
21: rustc_typeck::check::expr::<impl rustc_typeck::check::fn_ctxt::FnCtxt>::check_return_expr
22: rustc_typeck::check::check::check_fn
23: rustc_infer::infer::InferCtxtBuilder::enter
24: rustc_typeck::check::typeck
25: rustc_query_system::query::plumbing::get_query_impl
26: <rustc_query_impl::Queries as rustc_middle::ty::query::QueryEngine>::typeck
27: rustc_middle::ty::<impl rustc_middle::ty::context::TyCtxt>::par_body_owners
28: rustc_typeck::check::typeck_item_bodies
29: rustc_query_system::query::plumbing::get_query_impl
30: <rustc_query_impl::Queries as rustc_middle::ty::query::QueryEngine>::typeck_item_bodies
31: rustc_session::utils::<impl rustc_session::session::Session>::time
32: rustc_typeck::check_crate
33: rustc_interface::passes::analysis
34: rustc_query_system::query::plumbing::get_query_impl
35: <rustc_query_impl::Queries as rustc_middle::ty::query::QueryEngine>::analysis
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.55.0-nightly (6d820866a 2021-06-29) running on x86_64-unknown-linux-gnu
query stack during panic:
#0 [typeck] type-checking `eq`
#1 [typeck_item_bodies] type-checking all item bodies
#2 [analysis] running analysis passes on this crate
end of query stack
error: aborting due to 5 previous errors; 1 warning emitted
Some errors have detailed explanations: E0107, E0403, E0412, E0601.
For more information about an error, try `rustc --explain E0107`.