Change:
<ins> // Regression test for https://github.com/rust-lang/rust/issues/56445#issuecomment-518402995. // revisions: full min #![cfg_attr(full, feature(const_generics))] //[full]~WARN the feature `const_generics` is incomplete #![crate_type = "lib"] use std::marker::PhantomData; struct Bug<'a, const S: &'a str>(PhantomData<&'a ()>); //~^ ERROR: use of non-static lifetime `'a` in const generic impl Bug<'_, ""> {} </ins>

Discussion:
Reduced test case () from : Another repro case: Original bug report follows If I run on , I get an ICE: I'm using 2018 edition syntax, so I can only test on beta and nightly. <!-- TRIAGEBOTSTART --<!-- TRIAGEBOTASSIGNSTART --<!-- TRIAGEBOTASSIGNDATASTARTTRIAGEBOTASSIGNDATAEND --<!-- TRIAGEBOTASSIGNEND --<!-- TRIAGEBOT_END --
Commenting out the function in makes the ICE go away. The ICE occurs on a as well as a .
Replacing both instances of Self::FRAGMENTLEN in the function with the literal integer 13 makes the ICE go away.
Still reproduces on 1.35.0 and nightly (). <details<summaryClick for backtrace</summaryBacktrace: </details
triage: P-high, removing nomination, assigning to self for initial investigation.
Note: While I replicate the ICE as described on beta, I see a different ICE on nightly on this branch, namely: For reference (in case it matters e.g. for a hypothetical backport) was injected between +nightly-2019-05-25 and +nightly-2019-05-26. Further bisection thanks to rustup-toolchain-install-master "pinpointed" the change to this rollup PR: Auto merge of - Centril:rollup-wmm7qga, r=Centril I'm pretty sure the change in behavior is due to PR . <details<summaryClick for stack trace</summary</details
Okay here is reduced test case ():
another workaround, by the way, is to move the out of the (and then change the use to say instead of )
And yet another workaround is to say instead of in the return type.
I am taking a break for a few months and I wont be able to look at this; unassigning self.
from duplicate :
Another occurrence in
I've been trying to trace this down, and I think it's due to (or at least it's the same code that needs fixed there, in rustctypeck::collect::genericsof). I believe the UniversalRegionIndices aren't being properly populated for the constant, because in the HIR the constant doesn't have a parent. ConstraintConversion needs the UniversalRegionIndices to convert the ReEarlyBound into a RegionVid, but it's missing due to the previous problem.

Simply replacing with makes the last Memory examples compile, but the original example fails later in freescope. I'm super new to the rust compiler, but hopefully someone else can use this information to fix the problem :) I also believe that the const generics issue is separate, but it's possible that I'm simply trying to solve this in the wrong manner, and a correct solution would also solve the const generics issue.
triage: It would be good to at least figure out a way to give a better error message in these array length cases. (other cases include , ...)
Another case in
Triage: is now fixed in the latest nightly (rustc 1.45.0-nightly ( 2020-05-24)) (fixed by ).
Triage: is now fixed in the latest nightly (I think it's fixed by ). (And I've hidden comment as resolved to make the un-fixed ICEs easier to find.)
Triage: The reduced snippet () and are no longer ICE with the latest nightly:
claim