-
Notifications
You must be signed in to change notification settings - Fork 13.6k
Closed
Labels
A-associated-itemsArea: Associated items (types, constants & functions)Area: Associated items (types, constants & functions)C-bugCategory: This is a bug.Category: This is a bug.E-needs-testCall for participation: An issue has been fixed and does not reproduce, but no test has been added.Call for participation: An issue has been fixed and does not reproduce, but no test has been added.I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️
Description
This code ICEs, both on stable and nightly:
trait Bar {
const X: usize;
fn return_n(&self) -> [u8; Bar::X];
}
impl Bar {}
The first error is expected, the second one is a ICE:
error[E0038]: the trait `Bar` cannot be made into an object
--> ice.rs:6:6
|
6 | impl Bar {}
| ^^^ the trait `Bar` cannot be made into an object
|
= note: the trait cannot contain associated consts like `X`
error: internal compiler error: librustc/traits/trans/mod.rs:62: Encountered ambiguity selecting `Binder(<[type error] as Bar>)` during trans, presuming due to overflow
thread 'rustc' panicked at 'Box<Any>', librustc_errors/lib.rs:535:9
Backtrace
rustc version:
rustc 1.25.0-nightly (6c04c4103 2018-02-05)
binary: rustc
commit-hash: 6c04c41034c46730fba97bfe9cfa2dd0687c2a5f
commit-date: 2018-02-05
host: x86_64-unknown-linux-gnu
release: 1.25.0-nightly
LLVM version: 4.0
Backtrace:
thread 'rustc' panicked at 'Box<Any>', librustc_errors/lib.rs:535:9
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
stack backtrace:
0: std::sys::unix::backtrace::tracing::imp::unwind_backtrace
at libstd/sys/unix/backtrace/tracing/gcc_s.rs:49
1: std::sys_common::backtrace::_print
at libstd/sys_common/backtrace.rs:71
2: std::panicking::default_hook::{{closure}}
at libstd/sys_common/backtrace.rs:59
at libstd/panicking.rs:380
3: std::panicking::default_hook
at libstd/panicking.rs:396
4: std::panicking::rust_panic_with_hook
at libstd/panicking.rs:576
5: std::panicking::begin_panic
6: rustc_errors::Handler::bug
7: rustc::session::opt_span_bug_fmt::{{closure}}
8: rustc::session::opt_span_bug_fmt
9: rustc::session::bug_fmt
10: rustc::traits::trans::trans_fulfill_obligation
11: rustc::dep_graph::graph::DepGraph::with_task_impl
12: rustc::ty::maps::<impl rustc::ty::maps::queries::trans_fulfill_obligation<'tcx>>::force
13: rustc::ty::maps::<impl rustc::ty::maps::queries::trans_fulfill_obligation<'tcx>>::try_get
14: rustc::ty::maps::TyCtxtAt::trans_fulfill_obligation
15: rustc::ty::instance::Instance::resolve
16: rustc_const_eval::eval::lookup_const_by_id
17: rustc_mir::interpret::const_eval::const_eval_provider
18: rustc::dep_graph::graph::DepGraph::with_task_impl
19: rustc::ty::maps::<impl rustc::ty::maps::queries::const_eval<'tcx>>::force
20: rustc::ty::maps::<impl rustc::ty::maps::queries::const_eval<'tcx>>::try_get
21: rustc::ty::maps::TyCtxtAt::const_eval
22: rustc_const_eval::eval::eval_const_expr_partial
23: rustc_const_eval::eval::ConstContext::eval
24: rustc_mir::interpret::const_eval::const_eval_provider
25: rustc::dep_graph::graph::DepGraph::with_task_impl
26: rustc::ty::maps::<impl rustc::ty::maps::queries::const_eval<'tcx>>::force
27: rustc::ty::maps::<impl rustc::ty::maps::queries::const_eval<'tcx>>::try_get
28: rustc::ty::maps::TyCtxtAt::const_eval
29: <rustc::traits::project::AssociatedTypeNormalizer<'a, 'b, 'gcx, 'tcx> as rustc::ty::fold::TypeFolder<'gcx, 'tcx>>::fold_const
30: rustc::ty::structural_impls::<impl rustc::ty::fold::TypeFoldable<'tcx> for &'tcx rustc::ty::TyS<'tcx>>::super_fold_with
31: <rustc::traits::project::AssociatedTypeNormalizer<'a, 'b, 'gcx, 'tcx> as rustc::ty::fold::TypeFolder<'gcx, 'tcx>>::fold_ty
32: rustc::ty::fold::TypeFoldable::fold_with
33: rustc::infer::InferCtxt::partially_normalize_associated_types_in
34: rustc_typeck::check::wfcheck::CheckTypeWellFormedVisitor::check_associated_item
35: <rustc_typeck::check::wfcheck::CheckTypeWellFormedVisitor<'a, 'tcx> as rustc::hir::intravisit::Visitor<'v>>::visit_trait_item
36: rustc_typeck::check_crate::{{closure}}
37: rustc_typeck::check_crate
38: rustc::ty::context::TyCtxt::create_and_enter
39: rustc_driver::driver::compile_input
40: rustc_driver::run_compiler
Metadata
Metadata
Assignees
Labels
A-associated-itemsArea: Associated items (types, constants & functions)Area: Associated items (types, constants & functions)C-bugCategory: This is a bug.Category: This is a bug.E-needs-testCall for participation: An issue has been fixed and does not reproduce, but no test has been added.Call for participation: An issue has been fixed and does not reproduce, but no test has been added.I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️
Type
Projects
Milestone
Relationships
Development
Select code repository
Activity
Badel2 commentedon Feb 7, 2018
I thought the
impl Bar {}
was necessary for the ICE, but other errors like a missing main function also produce it:Playground link. Uncommenting the main function produces an error, not sure if correct, but doesn't ICE:
VictorKoenders commentedon May 15, 2018
I'm running into a similar issue: playground
For some reason it compiles fine if you remove the
Network
andLayer
struct, even though those are seemingly not related to the error at all.JohnTitor commentedon Oct 14, 2019
Cannot reproduce ICEs with both examples on latest nightly. marked as E-needstest
Rollup merge of rust-lang#65395 - JohnTitor:add-tests, r=Centril
Rollup merge of rust-lang#65395 - JohnTitor:add-tests, r=Centril