Skip to content
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

Closed
mihaiandrei1294 opened this issue Jan 16, 2018 · 3 comments · Fixed by #65395
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

@mihaiandrei1294
Copy link

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.

pub trait Observable{
    fn get_number_of_phases() -> usize where Self: Sized;
    fn get_elements(&self) -> Box<[f64; Observable::get_number_of_phases()]>;
}

struct Sensor<T: Observable>{
    observed_item: Box<T>,
}

impl<T: Observable> Sensor<T>{
    pub fn new(observed_item:T) -> Sensor<T>{
        Sensor{ observed_item: Box::new(observed_item),}
    }
    pub fn get_elements(&self) -> Box<[f64; <Sensor<T> as Observable>::get_elements()]>{
        return self.observed_item.get_elements(self.sensor_dependencies.clone());
    }
}

pub struct Agent{
    sensor_list: Vec<Box<Sensor<Observable>>>,
}

impl Agent{
    pub fn new(sensor_list: Vec<Sensor<Observable>>) -> Agent {
        Agent{sensor_list,}
    }
}

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 for environment::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 backtrace

thread '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

@qnighy
Copy link
Contributor

qnighy commented Jan 16, 2018

Further minimized. Playground

trait Tr {
    fn foo() -> usize;
    fn bar() -> [(); Tr::foo()];
}
fn f(x: [Tr; 1]) {}
   Compiling playground v0.0.1 (file:///playground)
error[E0277]: the trait bound `Tr + 'static: std::marker::Sized` is not satisfied
 --> src/main.rs:5:1
  |
5 | fn f(x: [Tr; 1]) {}
  | ^^^^^^^^^^^^^^^^^^^ `Tr + 'static` does not have a constant size known at compile-time
  |
  = help: the trait `std::marker::Sized` is not implemented for `Tr + 'static`
  = note: slice and array elements must have `Sized` type

error[E0038]: the trait `Tr` cannot be made into an object
 --> src/main.rs:5:1
  |
5 | fn f(x: [Tr; 1]) {}
  | ^^^^^^^^^^^^^^^^ the trait `Tr` cannot be made into an object
  |
  = note: method `foo` has no receiver
  = note: method `bar` has no receiver

error: internal compiler error: /checkout/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 (766bd11c8 2018-01-01) running on x86_64-unknown-linux-gnu

thread 'rustc' panicked at 'Box<Any>', /checkout/src/librustc_errors/lib.rs:471:8
note: Run with `RUST_BACKTRACE=1` for a backtrace.

error: Could not compile `playground`.

To learn more, run the command again with --verbose.

@pietroalbini 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
@gamozolabs
Copy link

gamozolabs commented Feb 16, 2019

I ran into this today with a slightly different variant, minimized down:

fn main() {
    () < std::mem::size_of::<_>();
    [0u8; std::mem::size_of::<_>()];
}
Compiling playground v0.0.1 (/playground)
error[E0308]: mismatched types
 --> src/main.rs:2:10
  |
2 |     () < std::mem::size_of::<_>();
  |          ^^^^^^^^^^^^^^^^^^^^^^^^ expected (), found usize
  |
  = note: expected type `()`
             found type `usize`

error: internal compiler error: src/librustc/ty/sty.rs:1837: Ty::fn_sig() called on non-fn type: [type error]

thread 'main' panicked at 'Box<Any>', src/librustc_errors/lib.rs:600:9
stack backtrace:
   0: std::sys::unix::backtrace::tracing::imp::unwind_backtrace
             at src/libstd/sys/unix/backtrace/tracing/gcc_s.rs:49
   1: std::sys_common::backtrace::_print
             at src/libstd/sys_common/backtrace.rs:71
   2: std::panicking::default_hook::{{closure}}
             at src/libstd/sys_common/backtrace.rs:59
             at src/libstd/panicking.rs:211
   3: std::panicking::default_hook
             at src/libstd/panicking.rs:227
   4: rustc::util::common::panic_hook
   5: std::panicking::rust_panic_with_hook
             at src/libstd/panicking.rs:495
   6: std::panicking::begin_panic
   7: rustc_errors::Handler::bug
   8: rustc::util::bug::opt_span_bug_fmt::{{closure}}
   9: rustc::ty::context::tls::with_opt::{{closure}}
  10: rustc::ty::context::tls::with_context_opt
  11: rustc::ty::context::tls::with_opt
  12: rustc::util::bug::opt_span_bug_fmt
  13: rustc::util::bug::bug_fmt
  14: rustc::ty::sty::<impl rustc::ty::TyS<'tcx>>::fn_sig
  15: <rustc_mir::transform::check_unsafety::UnsafetyChecker<'a, 'tcx> as rustc::mir::visit::Visitor<'tcx>>::visit_terminator
  16: rustc_mir::transform::check_unsafety::unsafety_check_result
  17: rustc::ty::query::__query_compute::unsafety_check_result
  18: rustc::ty::query::<impl rustc::ty::query::config::QueryAccessors<'tcx> for rustc::ty::query::queries::unsafety_check_result<'tcx>>::compute
  19: rustc::dep_graph::graph::DepGraph::with_task_impl
  20: <rustc::ty::query::plumbing::JobOwner<'a, 'tcx, Q>>::start
  21: rustc::ty::query::plumbing::<impl rustc::ty::context::TyCtxt<'a, 'gcx, 'tcx>>::force_query_with_job
  22: rustc::ty::query::plumbing::<impl rustc::ty::context::TyCtxt<'a, 'gcx, 'tcx>>::get_query
  23: rustc::ty::query::<impl rustc::ty::context::TyCtxt<'a, 'tcx, 'lcx>>::unsafety_check_result
  24: rustc_mir::transform::mir_const
  25: rustc::ty::query::<impl rustc::ty::query::config::QueryAccessors<'tcx> for rustc::ty::query::queries::mir_const<'tcx>>::compute
  26: rustc::dep_graph::graph::DepGraph::with_task_impl
  27: <rustc::ty::query::plumbing::JobOwner<'a, 'tcx, Q>>::start
  28: rustc::ty::query::plumbing::<impl rustc::ty::context::TyCtxt<'a, 'gcx, 'tcx>>::force_query_with_job
  29: rustc::ty::query::plumbing::<impl rustc::ty::context::TyCtxt<'a, 'gcx, 'tcx>>::get_query
  30: rustc_mir::transform::qualify_consts::mir_const_qualif
  31: rustc::ty::query::<impl rustc::ty::query::config::QueryAccessors<'tcx> for rustc::ty::query::queries::mir_const_qualif<'tcx>>::compute
  32: rustc::dep_graph::graph::DepGraph::with_task_impl
  33: <rustc::ty::query::plumbing::JobOwner<'a, 'tcx, Q>>::start
  34: rustc::ty::query::plumbing::<impl rustc::ty::context::TyCtxt<'a, 'gcx, 'tcx>>::force_query_with_job
  35: rustc::ty::query::plumbing::<impl rustc::ty::context::TyCtxt<'a, 'gcx, 'tcx>>::get_query
  36: rustc_mir::const_eval::const_eval_raw_provider
  37: rustc::ty::query::__query_compute::const_eval_raw
  38: rustc::ty::query::<impl rustc::ty::query::config::QueryAccessors<'tcx> for rustc::ty::query::queries::const_eval_raw<'tcx>>::compute
  39: rustc::dep_graph::graph::DepGraph::with_task_impl
  40: <rustc::ty::query::plumbing::JobOwner<'a, 'tcx, Q>>::start
  41: rustc::ty::query::plumbing::<impl rustc::ty::context::TyCtxt<'a, 'gcx, 'tcx>>::force_query_with_job
  42: rustc::ty::query::plumbing::<impl rustc::ty::context::TyCtxt<'a, 'gcx, 'tcx>>::get_query
  43: rustc::ty::query::<impl rustc::ty::context::TyCtxt<'a, 'tcx, 'lcx>>::const_eval_raw
  44: rustc_mir::const_eval::const_eval_provider
  45: rustc::ty::query::__query_compute::const_eval
  46: rustc::ty::query::<impl rustc::ty::query::config::QueryAccessors<'tcx> for rustc::ty::query::queries::const_eval<'tcx>>::compute
  47: rustc::dep_graph::graph::DepGraph::with_task_impl
  48: <rustc::ty::query::plumbing::JobOwner<'a, 'tcx, Q>>::start
  49: rustc::ty::query::plumbing::<impl rustc::ty::context::TyCtxt<'a, 'gcx, 'tcx>>::force_query_with_job
  50: rustc::ty::query::plumbing::<impl rustc::ty::context::TyCtxt<'a, 'gcx, 'tcx>>::get_query
  51: rustc::ty::query::<impl rustc::ty::context::TyCtxt<'a, 'tcx, 'lcx>>::const_eval
  52: rustc_typeck::check::FnCtxt::check_expr_kind
  53: rustc_typeck::check::FnCtxt::check_expr_with_expectation_and_needs
  54: rustc_typeck::check::FnCtxt::check_block_with_expected
  55: rustc_typeck::check::FnCtxt::check_expr_kind
  56: rustc_typeck::check::FnCtxt::check_expr_with_expectation_and_needs
  57: rustc_typeck::check::FnCtxt::check_return_expr
  58: rustc_typeck::check::check_fn
  59: rustc::ty::context::tls::with_related_context
  60: rustc::infer::InferCtxtBuilder::enter
  61: rustc_typeck::check::typeck_tables_of
  62: rustc::ty::query::<impl rustc::ty::query::config::QueryAccessors<'tcx> for rustc::ty::query::queries::typeck_tables_of<'tcx>>::compute
  63: rustc::dep_graph::graph::DepGraph::with_task_impl
  64: <rustc::ty::query::plumbing::JobOwner<'a, 'tcx, Q>>::start
  65: rustc::ty::query::plumbing::<impl rustc::ty::context::TyCtxt<'a, 'gcx, 'tcx>>::force_query_with_job
  66: rustc::ty::query::plumbing::<impl rustc::ty::context::TyCtxt<'a, 'gcx, 'tcx>>::get_query
  67: rustc::ty::query::plumbing::<impl rustc::ty::context::TyCtxt<'a, 'gcx, 'tcx>>::ensure_query
  68: rustc::session::Session::track_errors
  69: rustc_typeck::check::typeck_item_bodies
  70: rustc::ty::query::<impl rustc::ty::query::config::QueryAccessors<'tcx> for rustc::ty::query::queries::typeck_item_bodies<'tcx>>::compute
  71: rustc::dep_graph::graph::DepGraph::with_task_impl
  72: <rustc::ty::query::plumbing::JobOwner<'a, 'tcx, Q>>::start
  73: rustc::ty::query::plumbing::<impl rustc::ty::context::TyCtxt<'a, 'gcx, 'tcx>>::force_query_with_job
  74: rustc::ty::query::plumbing::<impl rustc::ty::context::TyCtxt<'a, 'gcx, 'tcx>>::get_query
  75: rustc::util::common::time
  76: rustc_typeck::check_crate
  77: rustc::ty::context::tls::enter_context
  78: <std::thread::local::LocalKey<T>>::with
  79: rustc::ty::context::TyCtxt::create_and_enter
  80: rustc_driver::driver::compile_input
  81: rustc_driver::run_compiler_with_pool
  82: <scoped_tls::ScopedKey<T>>::set
  83: rustc_driver::run_compiler
  84: rustc_driver::monitor::{{closure}}
  85: __rust_maybe_catch_panic
             at src/libpanic_unwind/lib.rs:102
  86: rustc_driver::run
  87: rustc_driver::main
  88: std::rt::lang_start::{{closure}}
  89: std::panicking::try::do_call
             at src/libstd/rt.rs:59
             at src/libstd/panicking.rs:310
  90: __rust_maybe_catch_panic
             at src/libpanic_unwind/lib.rs:102
  91: std::rt::lang_start_internal
             at src/libstd/panicking.rs:289
             at src/libstd/panic.rs:398
             at src/libstd/rt.rs:58
  92: main
  93: __libc_start_main
  94: <unknown>
query stack during panic:
#0 [unsafety_check_result] processing `main::{{constant}}`
#1 [mir_const] processing `main::{{constant}}`
#2 [mir_const_qualif] processing `main::{{constant}}`
#3 [const_eval_raw] const-evaluating `main::{{constant}}`
#4 [const_eval] const-evaluating + checking `main::{{constant}}`
#5 [typeck_tables_of] processing `main`
#6 [typeck_item_bodies] type-checking all item bodies
end of query stack
error: aborting due to 2 previous errors

For more information about this error, try `rustc --explain E0308`.

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.32.0 (9fda7c223 2019-01-16) running on x86_64-unknown-linux-gnu

note: compiler flags: -C codegen-units=1 -C debuginfo=2 --crate-type bin

note: some of the compiler flags provided by cargo are hidden

error: Could not compile `playground`.

To learn more, run the command again with --verbose.

@JohnTitor 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
@JohnTitor
Copy link
Member

JohnTitor commented 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)
@bors bors closed this as completed in a73e073 Oct 14, 2019
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.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants