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: 'rustc' panicked at 'assertion failed: concrete_substs.is_normalized_for_trans()' #36381

Closed
Marwes opened this issue Sep 10, 2016 · 5 comments
Assignees
Labels
I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ P-high High priority regression-from-stable-to-stable Performance or correctness regression from one stable version to another. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@Marwes
Copy link
Contributor

Marwes commented Sep 10, 2016

The ICE goes away if &str is changed to () so it might have something to do with lifetimes.

pub trait StreamOnce {
    type Position;
}

impl<'a> StreamOnce for &'a str {
    type Position = usize;
}

pub fn parser<F>(_: F) {
    panic!()
}

fn follow(_: &str) -> <&str as StreamOnce>::Position {
    panic!()
}

fn main() {
    parser(follow);
}
thread 'rustc' panicked at 'assertion failed: concrete_substs.is_normalized_for_trans()', ../src/librustc_trans\collector.rs:1038
stack backtrace:
   0:     0x7ff943c76fda - <std::rand::OsRng as rand::Rng>::fill_bytes::h076068e3d5c70638
   1:     0x7ff943c74d40 - std::panicking::Location::line::h1d71b2da86bcc037
   2:     0x7ff943c757cd - std::panicking::rust_panic_with_hook::hb1322e5f2588b4db
   3:     0x7ff943057be3 - <unknown>
   4:     0x7ff94310ac65 - <rustc_trans::collector::MirNeighborCollector<'a, 'tcx> as rustc::mir::visit::Visitor<'tcx>>::visit_terminator_kind::h6eab751b04fbd7ab
   5:     0x7ff943109f08 - <rustc_trans::collector::MirNeighborCollector<'a, 'tcx> as rustc::mir::visit::Visitor<'tcx>>::visit_operand::h33e5e243ea282334
   6:     0x7ff94310a4fb - <rustc_trans::collector::MirNeighborCollector<'a, 'tcx> as rustc::mir::visit::Visitor<'tcx>>::visit_terminator_kind::h6eab751b04fbd7ab
   7:     0x7ff94307927b - <unknown>
   8:     0x7ff943106ef3 - <rustc_trans::collector::TransItemCollectionMode as core::fmt::Debug>::fmt::h6c44aead55c9bfdb
   9:     0x7ff94318ec35 - <rustc_trans::ModuleSource as core::clone::Clone>::clone::h3d702b4981d13b3c
  10:     0x7ff9430e85a8 - rustc_trans::base::trans_crate::hf067cf9d0a8bcbf2
  11:     0x7ff9430e1847 - rustc_trans::base::trans_crate::hf067cf9d0a8bcbf2
  12:     0x7ff94422e7ba - rustc_driver::driver::phase_4_translate_to_llvm::he9d5d0022988d46e
  13:     0x7ff94427f893 - rustc_driver::main::h5a1049f207c7c577
  14:     0x7ff9442616d6 - rustc_driver::main::h5a1049f207c7c577
  15:     0x7ff94419e5c2 - <unknown>
  16:     0x7ff94421db6a - rustc_driver::driver::compile_input::h7dacd98cd2fd7d2b
  17:     0x7ff94424b789 - rustc_driver::run_compiler::h37c4294ab73436f7
  18:     0x7ff94416b051 - <unknown>
  19:     0x7ff943c7fa31 - _rust_maybe_catch_panic
  20:     0x7ff9441884e4 - <unknown>
  21:     0x7ff943c729ce - std::sys::thread::Thread::new::h117e066ad5633902
  22:     0x7ff978638101 - BaseThreadInitThunk
rustc 1.13.0-nightly (a7b2232d2 2016-09-07)
binary: rustc
commit-hash: a7b2232d20320dc3b4044a2aec1d51a129e7e17d
commit-date: 2016-09-07
host: x86_64-pc-windows-msvc
release: 1.13.0-nightly
@TimNN
Copy link
Contributor

TimNN commented Sep 10, 2016

This is a regression from stable to stable (1.10 is fine, 1.11 ICE's).

Edit: introduced between nightly-2016-05-26 and nightly-2016-05-27 (Changes)

@TimNN
Copy link
Contributor

TimNN commented Sep 11, 2016

So, as far as I can tell, the problem is that in something like fn follow<'a>() -> <&'a str as StreamOnce>::Position, <&'a str as StreamOnce>::Position is not resolved to usize in normalize_associated_type.

@TimNN
Copy link
Contributor

TimNN commented Sep 11, 2016

There's an interesting comment in rustc::traits::project, which I think could explain that behaviour:

       // We don't want to normalize associated types that occur inside of region
       // binders, because they may contain bound regions, and we can't cope with that.
       //
       // Example:
       //
       //     for<'a> fn(<T as Foo<&'a>>::A)
       //
       // Instead of normalizing `<T as Foo<&'a>>::A` here, we'll
       // normalize it when we instantiate those bound regions (which
       // should occur eventually).

@TimNN
Copy link
Contributor

TimNN commented Sep 11, 2016

This may be a duplicate of #35570.

Also, the root cause is the same as #34430, I believe.

Also cc #30472.

@apasel422 apasel422 added the I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ label Sep 13, 2016
@TimNN TimNN added the regression-from-stable-to-stable Performance or correctness regression from one stable version to another. label Sep 15, 2016
@arielb1 arielb1 added the T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. label Sep 15, 2016
@nrc nrc added the P-high High priority label Sep 15, 2016
@nrc
Copy link
Member

nrc commented Sep 15, 2016

discussed at compiler meeting. Needs investigation, may be a dup, assigning to @nikomatsakis for initial investigation

bors added a commit that referenced this issue Oct 4, 2016
loosen assertion against proj in collector

The collector was asserting a total absence of projections, but some projections are expected, even in trans: in particular, projections containing higher-ranked regions, which we don't currently normalize.

r? @pnkfelix

Fixes #36381
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-stable Performance or correctness regression from one stable version to another. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

No branches or pull requests

6 participants