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 with nightly in LvalyeTy<'tcx>::protection_ty #31504

Closed
kvark opened this issue Feb 9, 2016 · 15 comments
Closed

ICE with nightly in LvalyeTy<'tcx>::protection_ty #31504

kvark opened this issue Feb 9, 2016 · 15 comments
Assignees
Labels
A-MIR Area: Mid-level IR (MIR) - https://blog.rust-lang.org/2016/04/19/MIR.html I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ P-high High priority regression-from-stable-to-nightly Performance or correctness regression from stable to nightly. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@kvark
Copy link
Contributor

kvark commented Feb 9, 2016

rustc 1.8.0-nightly (9d8e3a0 2016-02-04)

It works fine with rust-beta (1.7) and rust-stable (1.6).

Repro steps:

  1. git clone http://github.com/gfx-rs/gfx
  2. build with rust nightly (cargo test), assuming you have glfw3 and X libraries installed. I'll try to narrow down the problem to a simpler case.

Backtrace:

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 'called `Option::unwrap()` on a `None` value', ../src/libcore/option.rs:330
stack backtrace:
   1:     0x7f357580d240 - sys::backtrace::tracing::imp::write::h25e8a89f9cb373ffYpu
   2:     0x7f3575814e3b - panicking::default_handler::_$u7b$$u7b$closure$u7d$$u7d$::closure.43046
   3:     0x7f3575814991 - panicking::default_handler::h2ce1c6a1dea5f1feqOy
   4:     0x7f35757ddb7c - sys_common::unwind::begin_unwind_inner::h47b5a8e37506c94ewit
   5:     0x7f35757de608 - sys_common::unwind::begin_unwind_fmt::ha90625204f89d411Cht
   6:     0x7f357580ae81 - rust_begin_unwind
   7:     0x7f357585b85f - panicking::panic_fmt::h1e48e4114ce9cc0cqYL
   8:     0x7f357585c358 - panicking::panic::h5b116cb444de10f6XWL
   9:     0x7f3572c65dbc - mir::tcx::LvalueTy<'tcx>::projection_ty::h5714fccab20a238fMPo
  10:     0x7f3572c66280 - mir::tcx::Mir<'tcx>::lvalue_ty::ha839b7f9519d497ajXo
  11:     0x7f3573ddd64f - trans::collector::MirNeighborCollector<'a, 'tcx>.MirVisitor<'tcx>::visit_lvalue::h84f7d7046786baccdNR
  12:     0x7f3573dd9769 - trans::collector::collect_items_rec::hc8cd3c9f4c3f007fSxR
  13:     0x7f3573dd9a58 - trans::collector::collect_items_rec::hc8cd3c9f4c3f007fSxR
  14:     0x7f3573dd9a58 - trans::collector::collect_items_rec::hc8cd3c9f4c3f007fSxR
  15:     0x7f3573d0b97d - trans::base::collect_translation_items::_$u7b$$u7b$closure$u7d$$u7d$::closure.61644
  16:     0x7f3573cf7ad7 - trans::base::trans_crate::h0435b9d851cf7d4f62k
  17:     0x7f3575d48bd4 - driver::phase_4_translate_to_llvm::hdd61956c6e2890eeG0a
  18:     0x7f3575d47433 - driver::compile_input::_$u7b$$u7b$closure$u7d$$u7d$::closure.28786
  19:     0x7f3575d42530 - driver::phase_3_run_analysis_passes::_$u7b$$u7b$closure$u7d$$u7d$::closure.27816
  20:     0x7f3575d21b2d - middle::ty::context::ctxt<'tcx>::create_and_enter::h8165751750365025443
  21:     0x7f3575d1c710 - driver::phase_3_run_analysis_passes::h8165887220225805103
  22:     0x7f3575ceef7c - driver::compile_input::h1d4ebbbb69cdadccAca
  23:     0x7f3575ce068e - run_compiler::h0ff710740da72a00fGc
  24:     0x7f3575cdd9b1 - sys_common::unwind::try::try_fn::h17883797362545364498
  25:     0x7f357580ae0b - __rust_try
  26:     0x7f35758029ed - sys_common::unwind::inner_try::h4dda564fff486709yft
  27:     0x7f3575cde200 - boxed::F.FnBox<A>::call_box::h2946617711430984355
  28:     0x7f35758133f0 - sys::thread::Thread::new::thread_start::hc9003707bc709661aLx
  29:     0x7f356dfaf6a9 - start_thread
  30:     0x7f357548aeec - clone
  31:                0x0 - <unknown>
@nagisa nagisa added I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ A-MIR Area: Mid-level IR (MIR) - https://blog.rust-lang.org/2016/04/19/MIR.html labels Feb 9, 2016
@nagisa nagisa self-assigned this Feb 9, 2016
@nagisa
Copy link
Member

nagisa commented Feb 9, 2016

Minimal-ish reproduction:

use std::marker::PhantomData;

pub trait DataBind {
    type Data;
}

impl<T> DataBind for Global<T> {
    type Data = T;
}

pub struct Global<T>(PhantomData<T>);

pub struct Data {
    pub offsets: <Global<[f32; 1]> as DataBind>::Data,
}

pub fn main() {
    let mut d = Data { offsets: [0.0] };
    d.offsets[0] = 0.0;
}

@nagisa
Copy link
Member

nagisa commented Feb 9, 2016

@nikomatsakis this might be more up your alley than mine.

@nagisa nagisa added the regression-from-stable-to-nightly Performance or correctness regression from stable to nightly. label Feb 9, 2016
@nagisa nagisa removed their assignment Feb 9, 2016
@arielb1
Copy link
Contributor

arielb1 commented Feb 9, 2016

This is because lvalue_ty does not normalize things. We need to pass an infcx there.

@arielb1
Copy link
Contributor

arielb1 commented Feb 9, 2016

Actually, normalizing will ruin regions, preventing borrowck from running (no, I don't want to run region inference each time). I guess that field expressions will have to store the normalized type.

What do you think of it, @nikomatsakis?

@arielb1 arielb1 added I-nominated T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Feb 9, 2016
@arielb1
Copy link
Contributor

arielb1 commented Feb 9, 2016

Nominating because regression. This issue is also visible on my MIR typeck branch.

@kvark kvark changed the title ICE with nightly in in LvalyeTy<'tcx>::protection_ty ICE with nightly in LvalyeTy<'tcx>::protection_ty Feb 10, 2016
@kvark
Copy link
Contributor Author

kvark commented Feb 10, 2016

@nagisa thanks for composing the test case!

@nikomatsakis
Copy link
Contributor

Storing the normalized type seems reasonable to me as a first step, though @arielb1 I'd expect typeck to revalidate that.

@nikomatsakis
Copy link
Contributor

However, the problem that @arielb1 referred to of having to re-run region inference suggests that perhaps there is a reason to resurrect that old patch of mine that "extracts" regions and types rather than inferring them when doing trait matching. It would avoid the need to re-run inference, I believe. (Also, lazy normalization seems like it would help here too, of course.)

@nikomatsakis
Copy link
Contributor

triage: P-high (regression)

@rust-highfive rust-highfive added P-high High priority and removed I-nominated labels Feb 11, 2016
@nikomatsakis
Copy link
Contributor

Note that this is fixed in @arielb1's branch.

@kvark
Copy link
Contributor Author

kvark commented Feb 16, 2016

Looks like it's fixed now, thanks!

@kvark kvark closed this as completed Feb 16, 2016
@kvark
Copy link
Contributor Author

kvark commented Feb 17, 2016

Actually, I can still repro this by changing our code slightly (commenting out this and this), reopening.

@kvark kvark reopened this Feb 17, 2016
@Yoric
Copy link
Contributor

Yoric commented Feb 17, 2016

If this is indeed #31603, I still encounter it with latest Nightly: https://travis-ci.org/fxbox/thinkerbell/jobs/109967451

@nagisa
Copy link
Member

nagisa commented Feb 18, 2016

Fix for this didn't land yet.
On Feb 17, 2016 10:49 PM, "David Rajchenbach-Teller" <
notifications@github.com> wrote:

If this is indeed #31603 #31603,
I still encounter it with latest Nightly:
https://travis-ci.org/fxbox/thinkerbell/jobs/109967451


Reply to this email directly or view it on GitHub
#31504 (comment).

@bors bors closed this as completed in 3c6f410 Feb 20, 2016
@Yoric
Copy link
Contributor

Yoric commented Feb 23, 2016

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-MIR Area: Mid-level IR (MIR) - https://blog.rust-lang.org/2016/04/19/MIR.html I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ P-high High priority regression-from-stable-to-nightly Performance or correctness regression from stable to nightly. 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