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

ICE : ty_is_local invoked on unexpected type: [type error] #29857

Closed
elinorbgr opened this issue Nov 16, 2015 · 6 comments · Fixed by #30676
Closed

ICE : ty_is_local invoked on unexpected type: [type error] #29857

elinorbgr opened this issue Nov 16, 2015 · 6 comments · Fixed by #30676
Assignees
Labels
I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ P-high High priority regression-from-stable-to-beta Performance or correctness regression from stable to beta. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@elinorbgr
Copy link
Contributor

$ rustc --version
rustc 1.6.0-dev (af5d9d65e 2015-11-16)
$ git clone https://github.com/rust-gnome/glib
$ cd glib
$ git rev-parse HEAD
70bfcac216131ae9ac7fdd12b960450cea23e28e
$ cargo build
   Compiling pkg-config v0.3.6
   Compiling bitflags v0.3.2
   Compiling libc v0.1.12
   Compiling glib-sys v0.2.0 (https://github.com/gtk-rs/sys#52d916bc)
   Compiling gio-sys v0.2.0 (https://github.com/gtk-rs/sys#52d916bc)
   Compiling gobject-sys v0.2.0 (https://github.com/gtk-rs/sys#52d916bc)
   Compiling glib v0.0.3 (file:///home/bergevic/dev/glib)
error: internal compiler error: ty_is_local invoked on unexpected 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: run with `RUST_BACKTRACE=1` for a backtrace
thread 'rustc' panicked at 'Box<Any>', src/libsyntax/diagnostic.rs:249

Could not compile `glib`.

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

Running the rustc command with RUST_BACKTRACE=1 results in:

error: internal compiler error: ty_is_local invoked on unexpected type: [type error]
Segmentation fault
@gkoz
Copy link
Contributor

gkoz commented Nov 16, 2015

Specifically, this impl seems to cause the ICE.

@apasel422 apasel422 added the I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ label Nov 16, 2015
@gkoz
Copy link
Contributor

gkoz commented Nov 19, 2015

Reduced (play):

use std::marker::PhantomData;

pub trait Foo<P> {}

impl <P, T: Foo<P>> Foo<P> for Option<T> {}

pub struct Qux<T> (PhantomData<*mut T>);

impl<T> Foo<*mut T> for Option<Qux<T>> {}

pub trait Bar {
    type Output: 'static;
}

impl<T: 'static, W: Bar<Output = T>> Foo<*mut T> for W {}

fn main() {}

@mitaa
Copy link
Contributor

mitaa commented Nov 20, 2015

I bisected this and the ICE first occurs with commit 9c6d35d

Backtrace

   1:     0x7f1e3590ba6e - sys::backtrace::tracing::imp::write::hdb8f3a6ce10ed1b3QDt
   2:     0x7f1e359128d5 - panicking::log_panic::closure.40055
   3:     0x7f1e35912318 - panicking::log_panic::h6553372f75134a11aqx
   4:     0x7f1e358d2df3 - sys_common::unwind::begin_unwind_inner::h81f13dc38b3ea26bivs
   5:     0x7f1e30141d07 - sys_common::unwind::begin_unwind::h12312644059527862301
   6:     0x7f1e30142ba6 - diagnostic::Handler::bug::hf972c212a69e65453XA
   7:     0x7f1e33476073 - session::Session::bug::h4009ec01e7079707iKx
   8:     0x7f1e336a7b46 - middle::traits::coherence::ty_is_local_constructor::he675f3dfe701b18aGsS
   9:     0x7f1e336a6dbb - middle::traits::coherence::ty_is_local::h1a74854948ac07f0qrS
  10:     0x7f1e336a4bec - middle::traits::coherence::orphan_check_trait_ref::h710104d2aeeca983khS
  11:     0x7f1e336ce142 - middle::traits::select::SelectionContext<'cx, 'tcx>::candidate_from_obligation::h8dc7730bcf29325eFNW
  12:     0x7f1e336d678c - middle::traits::select::SelectionContext<'cx, 'tcx>::evaluate_stack::h400356913451be25fDW
  13:     0x7f1e336d5903 - middle::traits::select::SelectionContext<'cx, 'tcx>::evaluate_predicate_recursively::hd91386d690509de9euW
  14:     0x7f1e336d6b19 - middle::traits::select::SelectionContext<'cx, 'tcx>::evaluate_candidate::closure.98356
  15:     0x7f1e336d680e - middle::traits::select::SelectionContext<'cx, 'tcx>::evaluate_stack::h400356913451be25fDW
  16:     0x7f1e336d5903 - middle::traits::select::SelectionContext<'cx, 'tcx>::evaluate_predicate_recursively::hd91386d690509de9euW
  17:     0x7f1e336a07d8 - middle::traits::coherence::overlap::haaebaeb64b2f734eSYR
  18:     0x7f1e336a001c - middle::traits::coherence::overlapping_impls::he79a93edea522a6eSWR
  19:     0x7f1e3450cd75 - coherence::overlap::OverlapChecker<'cx, 'tcx>::check_if_impls_overlap::hc80010a019367cd0oYB
  20:     0x7f1e3451aacd - coherence::check_coherence::he1273e70f1681fd8UVC
  21:     0x7f1e345267b2 - check_crate::h217901857a168117vtE
  22:     0x7f1e35e2b1a8 - driver::phase_3_run_analysis_passes::closure.22323
  23:     0x7f1e35e102d3 - middle::ty::context::ctxt<'tcx>::create_and_enter::h16662906985020795600
  24:     0x7f1e35e0b495 - driver::phase_3_run_analysis_passes::h5108870721034520489
  25:     0x7f1e35debfb6 - driver::compile_input::h15e13c46e5bbac96cca
  26:     0x7f1e35f47c4b - run_compiler::h1c9f4870a0e533f6bxc
  27:     0x7f1e35f45008 - sys_common::unwind::try::try_fn::h10854872946654574945
  28:     0x7f1e35909768 - __rust_try
  29:     0x7f1e358fcb2b - sys_common::unwind::try::inner_try::h0e8a3b869031f7edQrs
  30:     0x7f1e35f45330 - boxed::F.FnBox<A>::call_box::h243303236711489140
  31:     0x7f1e35911143 - sys::thread::Thread::new::thread_start::hf1e09046ed722134TLw
  32:     0x7f1e2f97a554 - start_thread
  33:     0x7f1e35595b9c - __clone
  34:                0x0 - <unknown>

@arielb1 arielb1 added regression-from-stable-to-nightly Performance or correctness regression from stable to nightly. P-high High priority T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. I-nominated and removed P-high High priority labels Nov 20, 2015
@arielb1 arielb1 self-assigned this Nov 20, 2015
@nikomatsakis
Copy link
Contributor

triage: P-medium

@brson brson added regression-from-stable-to-beta Performance or correctness regression from stable to beta. and removed regression-from-stable-to-nightly Performance or correctness regression from stable to nightly. labels Dec 9, 2015
@nikomatsakis
Copy link
Contributor

triage: P-high

@rust-highfive rust-highfive added P-high High priority and removed I-nominated labels Dec 17, 2015
nikomatsakis added a commit to nikomatsakis/rust that referenced this issue Jan 9, 2016
bors added a commit that referenced this issue Jan 11, 2016
This is an alternative to #29954 for fixing #29857 that seems to me to be more inline with the general strategy around `TyError`. It also includes the fix for #30589 -- in fact, just the minimal change of making `ty_is_local` tolerate `TyError` avoids the ICE, but you get a lot of duplicate error reports, so in the case where the impl's trait reference already includes `TyError`, we just ignore the impl altogether.

cc @arielb1 @sanxiyn

Fixes #29857.
Fixes #30589.
@brson
Copy link
Contributor

brson commented Jan 12, 2016

Merged fix into beta.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ P-high High priority regression-from-stable-to-beta Performance or correctness regression from stable to beta. 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.

8 participants