-
Notifications
You must be signed in to change notification settings - Fork 12.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Trait with associated function with "where self:Sized" cannot be made into an object and results in compiler bug. #47486
Labels
C-bug
Category: This is a bug.
E-needs-test
Call for participation: An issue has been fixed and does not reproduce, but no test has been added.
I-ICE
Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️
T-compiler
Relevant to the compiler team, which will review and decide on the PR/issue.
Comments
Further minimized. Playground trait Tr {
fn foo() -> usize;
fn bar() -> [(); Tr::foo()];
}
fn f(x: [Tr; 1]) {}
|
pietroalbini
added
I-ICE
Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️
T-compiler
Relevant to the compiler team, which will review and decide on the PR/issue.
C-bug
Category: This is a bug.
labels
Jan 23, 2018
I ran into this today with a slightly different variant, minimized down: fn main() {
() < std::mem::size_of::<_>();
[0u8; std::mem::size_of::<_>()];
}
|
JohnTitor
added
the
E-needs-test
Call for participation: An issue has been fixed and does not reproduce, but no test has been added.
label
Oct 13, 2019
The original and two minimized examples are not ICEs on latest nightly, it seems from 1.36.0, marked as E-needstest |
Centril
added a commit
to Centril/rust
that referenced
this issue
Oct 14, 2019
Add some tests for fixed ICEs Fixes rust-lang#44153 (from 1.23.0) Fixes rust-lang#47486 (from 1.36.0) Fixes rust-lang#48010 (from 1.38.0) Fixes rust-lang#48027 (from nightly) Fixes rust-lang#48638 (from nightly)
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
C-bug
Category: This is a bug.
E-needs-test
Call for participation: An issue has been fixed and does not reproduce, but no test has been added.
I-ICE
Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️
T-compiler
Relevant to the compiler team, which will review and decide on the PR/issue.
Hello, I have tried to create a Vector of structs which contain a box of the said trait. The compiler complains that the trait cannot be made into an object but adds that it is a compiler bug, thus I thought it is good to report it. The compiler error is Ty::fn_sig() called on non-fn type: [type error]. There is another issue here about this error but it seemed to not have anything to do with my own issue. And it seemed to be fixed, which clearly is not true in my own case.
A simplified version of my code that results in this error is found bellow and also on rust-playground here: https://play.rust-lang.org/?gist=445a7d67831cf9255d7158b10a14267c&version=stable.
fn main() {}
I expected it to compile but it doesn't because Observable + 'static is not Sized. It also seems to be a compiler bug.
##Meta
error[E0277]: the trait bound
environment::base::Observable + 'static: std::marker::Sized
is not satisfied--> src\environment\agent.rs:29:5
|
29 | sensor_list: Vec<Box<Sensor>>,
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
environment::base::Observable + 'static
does not have a constant size known at compile-time|
= help: the trait
std::marker::Sized
is not implemented forenvironment::base::Observable + 'static
= note: required by
environment::agent::Sensor
error: internal compiler error: src\librustc\ty\sty.rs:1372: Ty::fn_sig() called on non-fn type: [type error]
note: the compiler unexpectedly panicked. this is a bug.
note: we would appreciate a bug report: https://github.com/rust-lang/rust/blob/master/CONTRIBUTING.md#bug-reports
note: rustc 1.23.0 (766bd11 2018-01-01) running on x86_64-pc-windows-msvc
note: run with
RUST_BACKTRACE=1
for a backtracethread 'rustc' panicked at 'Box', src\librustc_errors\lib.rs:471:8
stack backtrace:
0: 0x7fff393d4e79 - _rdl_grow_in_place
1: 0x7fff393e6087 - std::panicking::Location::column::h28b40ec705c5e546
2: 0x7fff393e5cec - std::panicking::Location::column::h28b40ec705c5e546
3: 0x7fff393e66f1 - std::panicking::rust_panic_with_hook::h73a8ba19426dc4bc
4: 0x7fff3ae1b34a - <rustc_errors::diagnostic::SubDiagnostic as core::fmt::Debug>::fmt::h08690ad2ee761904
5: 0x7fff3ae357da - rustc_errors::Handler::bug::h1df8c4362c5e9846
6: 0x7fff3098fe7b - <rustc::ty::wf::Elaborate as core::fmt::Debug>::fmt::h22b02d36e9142746
7: 0x7fff30c32ed3 - rustc::ty::context::tls::span_debug::h25c529b6124f7a16
8: 0x7fff307de95e - rustc::session::bug_fmt::h396c28161718f8dd
9: 0x7fff307de852 - rustc::session::bug_fmt::h396c28161718f8dd
10: 0x7fff30736157 - rustc::ty::sty::<impl rustc::ty::TyS<'tcx>>::fn_sig::h3050bc278b64335e
11: 0x7fff3a781d36 - <rustc_mir::transform::check_unsafety::UnsafetyChecker<'a, 'tcx> as rustc::mir::visit::Visitor<'tcx>>::visit_terminator::h07052d3174ac97c7
12: 0x7fff3a783148 - <rustc_mir::transform::check_unsafety::UnusedUnsafeVisitor<'a> as rustc::hir::intravisit::Visitor<'tcx>>::visit_block::he2f578b5192e2ac0
13: 0x7fff30880c67 - rustc::ty::maps::<impl rustc::ty::maps::queries::unsafety_check_result<'tcx>>::ensure::h633f3ed20418ac43
14: 0x7fff30a68524 - rustc::dep_graph::graph::DepGraph::in_ignore::hf1d621baac1d7bf2
15: 0x7fff3074977e - rustc::util::ppaux::<impl core::fmt::Debug for rustc::ty::Predicate<'tcx>>::fmt::h676d3496cb3708f4
16: 0x7fff30c140c4 - <rustc::ty::_match::Match<'a, 'gcx, 'tcx> as rustc::ty::relate::TypeRelation<'a, 'gcx, 'tcx>>::tys::haf26cce42371d08b
17: 0x7fff30880d19 - rustc::ty::maps::<impl rustc::ty::maps::queries::unsafety_check_result<'tcx>>::ensure::h633f3ed20418ac43
18: 0x7fff3088165e - rustc::ty::maps::<impl rustc::ty::maps::queries::unsafety_check_result<'tcx>>::try_get::h415a98161b8c76f9
19: 0x7fff30a0476e - rustc::ty::maps::TyCtxtAt::unsafety_check_result::hf9206933e91c0e2d
20: 0x7fff30c3b70d - rustc::ty::maps::<impl rustc::ty::context::TyCtxt<'a, 'tcx, 'lcx>>::unsafety_check_result::h2a6c52c0475f25cd
21: 0x7fff3a75faa9 - rustc_mir::transform::mir_const::hea73cb1a351842f2
22: 0x7fff3087af7f - rustc::ty::maps::<impl rustc::ty::maps::queries::mir_const<'tcx>>::ensure::ha8f1c4f7b5b46573
23: 0x7fff30a42e0b - rustc::dep_graph::graph::DepGraph::in_ignore::hf1d621baac1d7bf2
24: 0x7fff30769551 - rustc::util::ppaux::<impl core::fmt::Debug for rustc::ty::Predicate<'tcx>>::fmt::h676d3496cb3708f4
25: 0x7fff30c13d04 - <rustc::ty::_match::Match<'a, 'gcx, 'tcx> as rustc::ty::relate::TypeRelation<'a, 'gcx, 'tcx>>::tys::haf26cce42371d08b
26: 0x7fff3087b01c - rustc::ty::maps::<impl rustc::ty::maps::queries::mir_const<'tcx>>::ensure::ha8f1c4f7b5b46573
27: 0x7fff3087b81a - rustc::ty::maps::<impl rustc::ty::maps::queries::mir_const<'tcx>>::try_get::h6bab209f4409e1ff
28: 0x7fff30a042eb - rustc::ty::maps::TyCtxtAt::mir_const::h7f7b58900de2e460
29: 0x7fff30c3b646 - rustc::ty::maps::<impl rustc::ty::context::TyCtxt<'a, 'tcx, 'lcx>>::mir_const::hc69e91e2e3497eda
30: 0x7fff3a8617b2 - rustc_mir::transform::qualify_consts::provide::h42deea6a65e124be
31: 0x7fff30877b57 - rustc::ty::maps::<impl rustc::ty::maps::queries::mir_const_qualif<'tcx>>::ensure::h1593aedb0b8d1c20
32: 0x7fff30a4ad44 - rustc::dep_graph::graph::DepGraph::in_ignore::hf1d621baac1d7bf2
33: 0x7fff3075be31 - rustc::util::ppaux::<impl core::fmt::Debug for rustc::ty::Predicate<'tcx>>::fmt::h676d3496cb3708f4
34: 0x7fff30bd2414 - <rustc::ty::_match::Match<'a, 'gcx, 'tcx> as rustc::ty::relate::TypeRelation<'a, 'gcx, 'tcx>>::tys::haf26cce42371d08b
35: 0x7fff30877c09 - rustc::ty::maps::<impl rustc::ty::maps::queries::mir_const_qualif<'tcx>>::ensure::h1593aedb0b8d1c20
36: 0x7fff308784d4 - rustc::ty::maps::<impl rustc::ty::maps::queries::mir_const_qualif<'tcx>>::try_get::h24ba1db0ffcee5d0
37: 0x7fff30a0409e - rustc::ty::maps::TyCtxtAt::mir_const_qualif::hc0b6bdb4d4bc569d
38: 0x7fff30c3b5dd - rustc::ty::maps::<impl rustc::ty::context::TyCtxt<'a, 'tcx, 'lcx>>::mir_const_qualif::h2bf27dced46fe731
39: 0x7fff3f6721bd - rustc_const_eval::eval::provide::h0adb0c848c7c6fc2
40: 0x7fff308951ca - rustc::ty::maps::<impl rustc::ty::maps::queries::const_eval<'tcx>>::ensure::h5d74cf56c26525a0
41: 0x7fff30a585af - rustc::dep_graph::graph::DepGraph::in_ignore::hf1d621baac1d7bf2
42: 0x7fff3077c344 - rustc::util::ppaux::<impl core::fmt::Debug for rustc::ty::Predicate<'tcx>>::fmt::h676d3496cb3708f4
43: 0x7fff30c00977 - <rustc::ty::_match::Match<'a, 'gcx, 'tcx> as rustc::ty::relate::TypeRelation<'a, 'gcx, 'tcx>>::tys::haf26cce42371d08b
44: 0x7fff30895292 - rustc::ty::maps::<impl rustc::ty::maps::queries::const_eval<'tcx>>::ensure::h5d74cf56c26525a0
45: 0x7fff30895e82 - rustc::ty::maps::<impl rustc::ty::maps::queries::const_eval<'tcx>>::try_get::h2cca1f57f34949d8
46: 0x7fff30a0567b - rustc::ty::maps::TyCtxtAt::const_eval::hc4ac4aa5a422e0d9
47: 0x7fff30ab85ae - <rustc::traits::project::AssociatedTypeNormalizer<'a, 'b, 'gcx, 'tcx> as rustc::ty::fold::TypeFolder<'gcx, 'tcx>>::fold_const::h79c58ccf8a3cae8d
48: 0x7fff3073427a - rustc::ty::structural_impls::<impl rustc::ty::context::Lift<'tcx> for rustc::ty::ParamEnv<'a>>::lift_to_tcx::h251daf03714e6023
49: 0x7fff30ab7f41 - <rustc::traits::project::AssociatedTypeNormalizer<'a, 'b, 'gcx, 'tcx> as rustc::ty::fold::TypeFolder<'gcx, 'tcx>>::fold_ty::h90177157f5e40472
50: 0x7fff3081601d - <rustc::util::common::ProfileQueriesMsg as core::fmt::Debug>::fmt::h6b3ed19705af96ac
51: 0x7fff30ba3035 - rustc::util::ppaux::<impl core::fmt::Display for rustc::ty::sty::ProjectionTy<'tcx>>::fmt::h4acd576bbff0db49
52: 0x7fff3070c735 - rustc::ty::error::<impl rustc::ty::TyS<'tcx>>::sort_string::h0db0616a53983bdc
53: 0x7fff3073424d - rustc::ty::structural_impls::<impl rustc::ty::context::Lift<'tcx> for rustc::ty::ParamEnv<'a>>::lift_to_tcx::h251daf03714e6023
54: 0x7fff30ab7f41 - <rustc::traits::project::AssociatedTypeNormalizer<'a, 'b, 'gcx, 'tcx> as rustc::ty::fold::TypeFolder<'gcx, 'tcx>>::fold_ty::h90177157f5e40472
55: 0x7fff3e36f66a - <rustc_typeck::check::wfcheck::CheckTypeWellFormedVisitor<'a, 'tcx> as rustc::hir::intravisit::Visitor<'v>>::visit_impl_item::hcece3901126b1cbd
56: 0x7fff3e3c1075 - <rustc_typeck::coherence::unsafety::UnsafetyChecker<'cx, 'tcx> as rustc::hir::itemlikevisit::ItemLikeVisitor<'v>>::visit_item::h3da78dca7718447f
57: 0x7fff3e3d3620 - <rustc_typeck::constrained_type_params::Parameter as core::fmt::Debug>::fmt::h43b8225dff655b08
58: 0x7fff3e33ea96 - <rustc_typeck::check::FnCtxt<'a, 'gcx, 'tcx> as rustc_typeck::astconv::AstConv<'gcx, 'tcx>>::record_ty::hf70a5a2a9b929b5e
59: 0x7fff3e39b582 - <rustc_typeck::check::method::probe::ProbeScope as core::fmt::Debug>::fmt::h6e9a17f517124e3c
60: 0x7fff3e407943 - <rustc_typeck::astconv::Bounds<'tcx> as core::fmt::Debug>::fmt::h01dac006432753d1
61: 0x7fff3e368504 - <rustc_typeck::check::Diverges as core::fmt::Debug>::fmt::h4031262e322927a9
62: 0x7fff3e2fef38 - <rustc_typeck::namespace::Namespace as core::fmt::Debug>::fmt::hd83feb2f4b81e514
63: 0x7fff3e3ac960 - <rustc_typeck::collect::ItemCtxt<'a, 'tcx> as rustc_typeck::astconv::AstConv<'tcx, 'tcx>>::record_ty::h1757e62b382e1508
64: 0x7fff3e3c5c66 - <rustc_typeck::coherence::unsafety::UnsafetyChecker<'cx, 'tcx> as rustc::hir::itemlikevisit::ItemLikeVisitor<'v>>::visit_item::h3da78dca7718447f
65: 0x7fff3e3fdd39 - rustc_typeck::check_crate::h0700276c41355c42
66: 0x7fff3f826edb - <rustc_driver::Compilation as core::fmt::Debug>::fmt::h970bab471a268779
67: 0x7fff3f826a63 - <rustc_driver::Compilation as core::fmt::Debug>::fmt::h970bab471a268779
68: 0x7fff3f78731f - <rustc_driver::pretty::UserIdentifiedItem as core::fmt::Debug>::fmt::h75102f2bc4758c9c
69: 0x7fff3f7d2a2b - rustc_driver::driver::compile_input::hfb39c521f477ee8d
70: 0x7fff3f816b55 - rustc_driver::run_compiler::h334a80a4b6e644f4
71: 0x7fff3f770d9d - <rustc_driver::pretty::UserIdentifiedItem as core::fmt::Debug>::fmt::h75102f2bc4758c9c
72: 0x7fff393e9f51 - _rust_maybe_catch_panic
73: 0x7fff3f809a11 - <rustc_driver::derive_registrar::Finder as rustc::hir::itemlikevisit::ItemLikeVisitor<'v>>::visit_impl_item::h73b2f332badc5ded
74: 0x7fff393e415b - std::sys::imp::thread::Thread::new::hc076c74f7dafca1e
75: 0x7fff777e1fe3 - BaseThreadInitThunk
The text was updated successfully, but these errors were encountered: