-
Notifications
You must be signed in to change notification settings - Fork 12.7k
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
Panic when compiling gluon on 1.46 #75313
Comments
It looks like the bound regions are preventing us from normalizing an opaque type, leading us to conclude that the LHS and RHS types are not actually equal. |
cc @RalfJung |
Well I thought our subtyping check would catch such things? Cc @eddyb It would be great to get a minimal testcase out of this. |
I thought something like this could be used to reproduce the problem, but so far I could not get it to ICE: struct Regex;
fn nested(x: (for<'r, 's> fn(&'r Regex, &'s str), String)) -> (fn(&Regex, &str), String) {
x
}
fn main() {
nested((|_x, _y| (), String::new()));
} |
@RalfJung You're missing the fn iter_slice<'a, T>(xs: &'a [T]) -> impl Iterator<Item = &'a T> {
xs.iter()
}
fn main() {
iter_slice::<()> as fn(_) -> _;
} For the record, the thing of note about The function is fn captures<'a>(
re: &Regex,
text: &'a str,
) -> Option<Collect<impl Iterator<Item = Option<Match<'a>>>>> |
Nice, a repro! So return-position impl-trait is crucial here. (We don't really need a bisect as we know that this got introduced by checking that MIR assignments are properly typed, so removing that label as well.) Any proposal for how this could be handled? I don't even understand why it doesn't work, I thought we are deleting all the lifetimes, but clearly not enough of them.^^ |
Marked this as p-critical as per the wg-prioritization discussion |
I'm afraid I have no idea how to fix this. I tried using a The only thing I can offer is disabling the sanity check for assignments entirely. |
I thought that code was already getting a |
Is the problem really due to
|
Late-bound lifetimes work elsewhere though and the |
Are you normalizing? The (so the bottom-up folder could erase lifetimes then normalize, at every single step) |
It does handle this. I just tried to compile the repro with cg_clif. Compilation fails on the same |
What was the link to that check again? |
@RalfJung for the record, I specifically meant after removing all the bound lifetimes. miri already normalizes, so it would have to be stronger than that. (EDIT: #75419 appears to do what I was suggesting, although it shouldn't be necessary, see below) However, I believe I may have found the bug, and it's actually in normalization itself:
That While for associated type projections it makes sense, due to having to look up the |
@eddyb the old code doesn't normalize, so I don't see how changes to normalization could help. Also I don't know any of that code so it likely makes more sense for someone else to take over then. |
This regressed in #72796. I removed the label because we knew that, but it's not helpful -- we don't want to just revert that PR as that would mean not checking MIR assignments any more. |
@RalfJung right, I was going over the prioritization process and noticed that the PR where this regressed was lacking. I wasn't suggesting more than just that :). |
Reopening as the problem remains on beta. @lcnr can you do a backport? |
Oh I thought the beta PR would get nominated? |
Hm, when you say "beta PR" -- is there a dedicated PR intended for beta backport? Or is #75443 slated for beta backport? Whichever PR's commits should be cherry-picked onto beta should get nominated. |
Oh gosh now I confused everyone.^^ |
@RalfJung the way it works is ... a PR that was made against master is labelled with |
We experienced a minor regression with the fix in PR #75443, but there are known workarounds. The fix caused new "reached the type-length limit" compiler errors in our project. In our particular case, we didn't need the tracing::instrument spans that were creating the large types, so we deleted them (see ZcashFoundation/zebra#923). This is a known issue in tracing tokio-rs/tracing#616 - they increase the type-length limit as a workaround. It's also a known issue in rustc (#54540). I added the bisect-rustc regression report to that issue as #54540 (comment). |
The fix seems to have been backported to beta. Can we close this? |
What's the link to the beta PR? Yes I think it can be closed then. |
revert rust-lang#75443, update mir validator This PR reverts rust-lang#75443 to fix rust-lang#75992 and instead uses rust-lang#75419 to fix rust-lang#75313. Adapts rust-lang#75419 to correctly deal with unevaluated constants as otherwise some `feature(const_evaluatable_checked)` tests would ICE. Note that rust-lang#72793 was also fixed by rust-lang#75443, but as that issue only concerns `feature(type_alias_impl_trait)` I deleted that test case for now and would reopen that issue. rust-lang#75443 may have also allowed some other code to now successfully compile which would make this revert a breaking change after 2 stable versions, but I hope that this is a purely theoretical concern. See https://rust-lang.zulipchat.com/#narrow/stream/182449-t-compiler.2Fhelp/topic/generator.20upvars/near/214617274 for more reasoning about this. r? `@nikomatsakis` `@eddyb` `@RalfJung`
I created an empty hello world project with Cargo, added the "gluon" library to it, then tried to compile.
I understand this is something more than just an incompatibility between the nightly compiler and the library.
Does not occur on stable.
Code
There's no code, I added
gluon = "0.16.1"
to Cargo.toml of an empty project.Meta
rustc --version --verbose
:Error output
The text was updated successfully, but these errors were encountered: