Skip to content

Fix ICE in DerivePass #666

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

Closed
wants to merge 1 commit into from
Closed

Fix ICE in DerivePass #666

wants to merge 1 commit into from

Conversation

Manishearth
Copy link
Member

We don't provide the correct parameter env, which casues https://gist.github.com/Amanieu/67fa4d9aceb7d2da18a6

We don't provide the correct parameter env, which casues https://gist.github.com/Amanieu/67fa4d9aceb7d2da18a6
@mcarton
Copy link
Member

mcarton commented Feb 14, 2016

Oups, my bad. I must have found that somewhere and reused it without too much thoughts.

@Manishearth
Copy link
Member Author

@mcarton this still fails on @Amanieu's code, though.

http://vanquished.zapto.org/~amanieu/intrusive.zip

Could you have a look?

@Manishearth
Copy link
Member Author

ICE, for reference:

[23:28:18] मanishearth@tevatron ~/sand/bar O_o 
$ RUST_BACKTRACE=1 cargo rustc --  -L ~/Mozilla/Wall/clippy2/target/debug/ -Zextra-plugins=clippy
   Compiling intrusive v0.1.0 (file:///home/manishearth/sand/bar)
src/linked_list.rs:209:1: 214:2 error: internal compiler error: cannot relate bound region: '_#0r <= ReEarlyBound(TypeSpace, 0, 'a)
src/linked_list.rs:209 impl<'a, A: Adaptor<Link> + 'a> Clone for Cursor<'a, A> {
src/linked_list.rs:210     #[inline]
src/linked_list.rs:211     fn clone(&self) -> Cursor<'a, A> {
src/linked_list.rs:212         *self
src/linked_list.rs:213     }
src/linked_list.rs:214 }
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
thread 'rustc' panicked at 'Box<Any>', ../src/libsyntax/errors/mod.rs:530
stack backtrace:
   1:     0x7f5b0b6f8010 - sys::backtrace::tracing::imp::write::h777bcf35f5f62316pru
   2:     0x7f5b0b700fcb - panicking::default_handler::_$u7b$$u7b$closure$u7d$$u7d$::closure.43419
   3:     0x7f5b0b700b23 - panicking::default_handler::he9bc2fc9631cb5acdZy
   4:     0x7f5b0b6c994c - sys_common::unwind::begin_unwind_inner::h180f7a790497cb1fegt
   5:     0x7f5b0896f608 - sys_common::unwind::begin_unwind::h4294729060292046515
   6:     0x7f5b0896f5ab - errors::Handler::span_bug::h11698000558896720860
   7:     0x7f5b08a19cb9 - middle::infer::region_inference::RegionVarBindings<'a, 'tcx>::make_subregion::h53c0357d981e0e2bQ7z
   8:     0x7f5b08a478b7 - middle::infer::region_inference::RegionVarBindings<'a, 'tcx>::make_eqregion::hc44881b906a8a1ee16z
   9:     0x7f5b08a217c9 - middle::infer::equate::Equate<'a, 'tcx>.TypeRelation<'a, 'tcx>::regions::h1050fac7c2e92793RXu
  10:     0x7f5b08a21442 - iter::_&'a mut I.Iterator::next::h7717617927084158238
  11:     0x7f5b08a2062d - middle::ty::relate::relate_substs::h17924253548416520716
  12:     0x7f5b08a1e8fb - middle::ty::relate::relate_item_substs::h13767101613293165095
  13:     0x7f5b08a181ac - middle::infer::equate::Equate<'a, 'tcx>.TypeRelation<'a, 'tcx>::tys::h180910299d673ceazTu
  14:     0x7f5b08a20f3f - middle::ty::relate::relate_type_params::_$u7b$$u7b$closure$u7d$$u7d$::closure.86157
  15:     0x7f5b08a20cb4 - vec::Vec<T>.FromIterator<T>::from_iter::h2817250850572013919
  16:     0x7f5b08a2006f - middle::ty::relate::relate_substs::h17924253548416520716
  17:     0x7f5b08a1e8fb - middle::ty::relate::relate_item_substs::h13767101613293165095
  18:     0x7f5b08a1e683 - middle::ty::relate::ty..TraitRef<'tcx>.Relate<'a, 'tcx>::relate::h10390092453350669558
  19:     0x7f5b08a1a6a5 - middle::infer::InferCtxt<'a, 'tcx>::eq_trait_refs::hb2ff4fea626542a2Y1D
  20:     0x7f5b08b2aaca - middle::traits::select::SelectionContext<'cx, 'tcx>::match_impl::h413c13b6ee95084d0u0
  21:     0x7f5b08b2943c - middle::ty::trait_def::TraitDef<'tcx>::for_each_relevant_impl::h9359870499058487061
  22:     0x7f5b08b2668f - middle::traits::select::SelectionContext<'cx, 'tcx>::assemble_candidates::h0ad6d6878691261dZtY
  23:     0x7f5b08b1b8d5 - middle::traits::select::SelectionContext<'cx, 'tcx>::candidate_from_obligation::hc007c7f7e7324640w8X
  24:     0x7f5b08b250ec - middle::traits::select::SelectionContext<'cx, 'tcx>::evaluate_stack::h9876d273acd3d713QXX
  25:     0x7f5b08b242fa - middle::traits::select::SelectionContext<'cx, 'tcx>::evaluate_predicate_recursively::hb24455e0f5c7957c3OX
  26:     0x7f5b08a32b37 - middle::traits::type_known_to_meet_builtin_bound::h0f9f6d59d50c260ayo2
  27:     0x7f5b08a32ff9 - middle::ty::util::ty..TyS<'tcx>::moves_by_default::ha27419c519a38cecwP8
  28:     0x7f5b00438266 - derive::check_copy_clone::h8e1e89b18c9ce41ayjl
                        at src/derive.rs:136
  29:     0x7f5b002966c5 - derive::Derive.LateLintPass::check_item::h939175e59e734fd44fl
                        at src/derive.rs:83
  30:     0x7f5b08ba0214 - lint::context::LateContext<'a, 'tcx>.hir_visit..Visitor<'v>::visit_item::hc587fe68866b8e37v2u
  31:     0x7f5b08ba53cb - lint::context::LateContext<'a, 'tcx>.hir_visit..Visitor<'v>::visit_mod::h4d850862e2c6a55bsdv
  32:     0x7f5b08ba1227 - lint::context::LateContext<'a, 'tcx>.hir_visit..Visitor<'v>::visit_item::hc587fe68866b8e37v2u
  33:     0x7f5b08ba53cb - lint::context::LateContext<'a, 'tcx>.hir_visit..Visitor<'v>::visit_mod::h4d850862e2c6a55bsdv
  34:     0x7f5b08bc5b58 - lint::context::check_crate::ha0f4e48a7941dff2EXv
  35:     0x7f5b0bc17775 - driver::phase_3_run_analysis_passes::_$u7b$$u7b$closure$u7d$$u7d$::closure.28028
  36:     0x7f5b0bc10fd4 - middle::ty::context::ctxt<'tcx>::create_and_enter::h9052857365067484405
  37:     0x7f5b0bc0d131 - driver::phase_3_run_analysis_passes::h16529546982204799597
  38:     0x7f5b0bbdeaba - driver::compile_input::ha4fd080cbc61cb8eBca
  39:     0x7f5b0bbce9d2 - run_compiler::h784c0b63acee3c98bHc
  40:     0x7f5b0bbcbe91 - sys_common::unwind::try::try_fn::h12199866095266630469
  41:     0x7f5b0b6f593b - __rust_try
  42:     0x7f5b0b6edf6d - sys_common::unwind::inner_try::h6356de3d206e2a61gdt
  43:     0x7f5b0bbcc6e0 - boxed::F.FnBox<A>::call_box::h13644564803090113305
  44:     0x7f5b0b6ff590 - sys::thread::Thread::new::thread_start::ha3fa12507cdb7617xWx
  45:     0x7f5b03eac6a9 - start_thread
  46:     0x7f5b0b375eec - clone
  47:                0x0 - <unknown>

Could not compile `intrusive`.

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

@mcarton
Copy link
Member

mcarton commented Feb 14, 2016

Minimal example:

#![feature(plugin)]
#![plugin(clippy)]

pub struct Cursor<'a> {
    _foo: &'a u8,
}

impl<'a> Copy for Cursor<'a> {}
impl<'a> Clone for Cursor<'a> {
    fn clone(&self) -> Cursor<'a> {
        unimplemented!();
    }
}

@eddyb
Copy link
Member

eddyb commented Feb 14, 2016

Please avoid ast_ty_to_ty_cache, it's not what the compiler uses.
In this case, that would be the Self substitution in the TraitRef from impl_trait_ref.
This is the only issue I could see just by looking at the code.

@llogiq
Copy link
Contributor

llogiq commented Feb 14, 2016

Could we have a run-pass test case?

@mcarton
Copy link
Member

mcarton commented Feb 14, 2016

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants