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
Directly using constant from default specialisation of type causes "erroneous constant used" error #89353
Comments
more details now that I have a local copy of the compiler:
|
Debug build of rustc gets me
Replacing
let trait_ref = tcx.normalize_erasing_regions(param_env, trait_ref); seems to stop it from hitting rust/compiler/rustc_trait_selection/src/traits/codegen.rs Lines 65 to 76 in d3e6770
|
Would this change be accepted as a PR? It's unclear to me if this assertion was testing a precondition for the argument passed to the function or just a postcondition to protect the code that caused the ICE in release. |
I believe that an earlier pass of normalization should have made the assert successful, so the change as is is likely not going to be accepted, but we clearly have a bug that needs fixing (glances at the open issue count... understatement of the century). CC @rust-lang/compiler Edit: I think that the problem is in the following: rust/compiler/rustc_ty_utils/src/instance.rs Lines 221 to 227 in ce1143e
I wonder if the following has anything to do with this (but don't know if at all): rust/compiler/rustc_ty_utils/src/instance.rs Lines 18 to 24 in ce1143e
Edit 2: as expected (almost tautologically), adding |
This appears to be fixed :D |
This works:
This fails:
with this error
Meta
Build using the Nightly version: 1.57.0-nightly (2021-09-28 8f8092c) (rust playground)
The text was updated successfully, but these errors were encountered: