Repository navigation
Closed
Labels
A-MIRArea: Mid-level IR (MIR) - https://blog.rust-lang.org/2016/04/19/MIR.htmlArea: Mid-level IR (MIR) - https://blog.rust-lang.org/2016/04/19/MIR.htmlA-trait-systemArea: Trait systemArea: Trait systemC-bugCategory: This is a bug.Category: This is a bug.E-needs-testCall for participation: An issue has been fixed and does not reproduce, but no test has been added.Call for participation: An issue has been fixed and does not reproduce, but no test has been added.I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️P-highHigh priorityHigh priorityT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.glacierICE tracked in rust-lang/glacier.ICE tracked in rust-lang/glacier.
Description
(spawned off of #63154)
This variant of the code from #63154 still causes an ICE on nightly rustc (play):
trait Trait {
type Assoc;
}
impl Trait for () {
type Assoc = ();
}
trait Dummy<T> {}
impl<T> Dummy<T> for () {}
fn make<T: Trait>() -> impl Dummy<T::Assoc> {}
fn extract<T>(_: impl Dummy<T>) -> Option<T> {
None
}
pub fn ice() {
extract(make::<()>());
}yields:
error: internal compiler error: broken MIR in DefId(0:26 ~ issue_63154_b[8787]::ice[0]) (NoSolution): could not prove Binder(TraitPredicate(<impl Dummy<<() as Trait>::Assoc> as Dummy<()>>))
thread 'rustc' panicked at 'no errors encountered even though `delay_span_bug` issued', src/librustc_errors/lib.rs:391:17
Metadata
Metadata
Assignees
Labels
A-MIRArea: Mid-level IR (MIR) - https://blog.rust-lang.org/2016/04/19/MIR.htmlArea: Mid-level IR (MIR) - https://blog.rust-lang.org/2016/04/19/MIR.htmlA-trait-systemArea: Trait systemArea: Trait systemC-bugCategory: This is a bug.Category: This is a bug.E-needs-testCall for participation: An issue has been fixed and does not reproduce, but no test has been added.Call for participation: An issue has been fixed and does not reproduce, but no test has been added.I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️P-highHigh priorityHigh priorityT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.glacierICE tracked in rust-lang/glacier.ICE tracked in rust-lang/glacier.
Activity
pnkfelix commentedon Oct 31, 2019
triage: P-high, removing nomination label
Andlon commentedon Nov 22, 2019
I'm running into an issue which might be related to this, but I can't really tell if it is the same issue or not. Perhaps someone would be willing to help me determine if it is?
I'm experiencing ICEs across stable, beta and nightly.
cargo checkappears to work fine. I've turned off incremental compilation (e.g.export CARGO_INCREMENTAL=0), and the issue persists. I've attached the result ofcargo clean && cargo build, withRUST_BACKTRACE=1.buildlog.txt
The issue is also not entirely reproducible: on some computers, the issue is not triggered for the same code base, however when continuing to develop it will inevitably appear. Similarly, at present, I've just confirmed that compiling in release mode seems to have worked, whereas debug mode did not. I don't see any obvious patterns in what determines which configurations trigger the bug.
I don't see right now how I can reduce my code down to a minimal example, but since I'm working against an academic deadline and my code does not reliably compile right now, I'm in a bit of a pickle, and would really appreciate any pointers that could help me either properly report the bug or to resolve the issue.
WildCryptoFox commentedon Nov 23, 2019
@Andlon Can you provide the code?
Andlon commentedon Nov 23, 2019
@WildCryptoFox: Not publicly, at this point, unfortunately, as it contains algorithms that we need to keep a little under wraps for some time (at least until it's been accepted for publication). But it's intended to be open sourced later on, so I think it won't be a problem to provide the code to select individuals, if that could work for you?
WildCryptoFox commentedon Nov 23, 2019
@Andlon I've pinged @eddyb who does enjoy reducing code.
Do you have a function in the form of
fn make<T: Trait>() -> impl Dummy<T::Assoc>?If so, my workaround may help you. Try transforming it as
fn make<T: Trait<Assoc=Y>, Y>() -> impl Dummy<Y>.Andlon commentedon Nov 23, 2019
@WildCryptoFox: I don't think I have a function like that in the code that the compiler actually complains about, but there's a whole lot of generic and associated types used in various ways in general.
Actually, I looked at the code again and tried to reduce it a little, and it seems as if the problem is independent of the function signature, but instead has something to do with the interaction between
nalgebratypesVector1,Vector2and conversion toPoint2, so it might be entirely unrelated to this issue after all. I'll try to see if I can reduce it further and come back to you (hopefully today, if not then tomorrow).WildCryptoFox commentedon Nov 23, 2019
@Andlon It might hit the same problem via a different route. Good luck with reducing. I've pinged you in a private gist. I could take a look at the code; though I'm a bit busy right now so no guarantee for when.
pnkfelix commentedon Nov 23, 2019
By the way I wrote a recent blog post on generic techniques for reducing compiler bugs in Rust. It might give you ideas.
http://blog.pnkfx.org/blog/2019/11/18/rust-bug-minimization-patterns/
7 remaining items
WildCryptoFox commentedon Nov 26, 2019
@Andlon Testing with both
2019-11-24and2019-11-25; only the build on the 24th triggers the ICE, indicating it was fixed in the build on the 25th.Try updating your
rust-toolchaintonightly-2019-11-25.Edit: I tested with
nightly-2019-11-26too and that does ICE!rustup updatemay have avoided the newest version due to missing optional components (clippy?) for that version at the time.I can confirm the ICE of this issue remains in play.
I think you should open a new issue.
WildCryptoFox commentedon Nov 26, 2019
@Andlon Curiously when adding
default-features = falsetonalgebrathe ICE goes away, and stays away if you enable itsstdfeature. This is odd because nalgebra's default only impliesstdand none of its code is conditional to thefeature = "default".To add to the ICE reducing tips: remove everything the
dead_codelint signals (including your things renamed with the underscore prefix), set your ICE-trigger as public (and make everything else you can private), usedefault-features = falseon dependencies to reduce features and use#[no_std]to reducestdtocore.WildCryptoFox commentedon Nov 26, 2019
@Andlon I've reduced your code by ~100 lines
Andlon commentedon Nov 26, 2019
@WildCryptoFox: that's great, thanks! As you suggested, I've opened a new issue here: #66768.
WildCryptoFox commentedon Nov 26, 2019
@pnkfelix I just noticed the test you included is the partially reduced variant, not the most reduced variant. Per @eddyb 's post in the previous issue. This smaller variant actually triggers two MIR errors - one more than the variant above.
Aaron1011 commentedon Jan 3, 2020
It looks like this is cauesd by the un-normalized projection
<() as Trait>::Assocappearing in the result oftcx.predicate_offor the opaque return type ofunit. This causesSelectionContext.match_projection_obligation_against_definition_boundsto fail to find a candidate from the opaque type's predicates, resulting in the ICE.I've not entirely certain where the normalization should be taking place. Should
tcx.predicates_ofperform the normalization, or shouldSelectionContextbe doing it?eddyb commentedon Jan 16, 2020
AFAIK no,
predicates_ofshould be "as written", and the caller should do any necessary normalization. (pretty sure lazy normalization of associated type projections would fix this)WildCryptoFox commentedon May 13, 2020
Update: This still triggers an ICE on the latest nightly.
WildCryptoFox commentedon Aug 17, 2020
(Still triggers ICE on latest nightly)
JohnTitor commentedon Oct 7, 2020
Triage: This is no longer ICE with the latest nightly, marking as E-needs-test.
Auto merge of rust-lang#77741 - JohnTitor:add-tests, r=matthewjasper