-
Notifications
You must be signed in to change notification settings - Fork 13.4k
ICE: expected const for .. but found Type(usize) when instantiating args=[usize]
#121429
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Comments
After #133610, this particular code no longer crashes, but adding definitions causes it to start crashing again: //@ known-bug: #121429
#![feature(generic_const_exprs)]
struct FixedI8<const X: usize>;
const FRAC_LHS: usize = 0;
const FRAC_RHS: usize = 1;
pub trait True {}
impl<const N: usize = { const { 3 } }> PartialEq<FixedI8<FRAC_RHS>> for FixedI8<FRAC_LHS> where
If<{}>: True
{
} |
The test in the test suite wasn't minimal. #![feature(generic_const_exprs)]
struct FixedI8<const X: usize>;
const FRAC_LHS: usize = 0;
trait Foo<const N: usize> {}
impl<const N: usize = { const { 3 } }> Foo<FRAC_LHS> for () {} is a bit reduced in what things it uses. Please only add minimal (human reduced, removing unrelated errors by adding definitions and simplifying types that are not relevant to the repro) tests to the test suite. I removed it without replacement when it stopped ICEing again, it seemed like a not useful test to me either way |
Remove CollectItemTypesVisitor I always felt like we were very unnecessarily walking the HIR, let's see if perf agrees There is lots to ~~improve~~ consolidate further here, as we still have 3 item wfchecks: * check_item (matching on the hir::ItemKind) * actually doing trait solver based checks (by using HIR spans) * lower_item (matching on the hir::ItemKind after loading it again??) * just ensure_ok-ing a bunch of queries * check_item_type (matching on DefKind) * some type based checks, mostly ensure_ok-ing a bunch of queries fixes rust-lang/rust#121429
Remove CollectItemTypesVisitor I always felt like we were very unnecessarily walking the HIR, let's see if perf agrees There is lots to ~~improve~~ consolidate further here, as we still have 3 item wfchecks: * check_item (matching on the hir::ItemKind) * actually doing trait solver based checks (by using HIR spans) * lower_item (matching on the hir::ItemKind after loading it again??) * just ensure_ok-ing a bunch of queries * check_item_type (matching on DefKind) * some type based checks, mostly ensure_ok-ing a bunch of queries fixes rust-lang/rust#121429
Remove CollectItemTypesVisitor I always felt like we were very unnecessarily walking the HIR, let's see if perf agrees There is lots to ~~improve~~ consolidate further here, as we still have 3 item wfchecks: * check_item (matching on the hir::ItemKind) * actually doing trait solver based checks (by using HIR spans) * lower_item (matching on the hir::ItemKind after loading it again??) * just ensure_ok-ing a bunch of queries * check_item_type (matching on DefKind) * some type based checks, mostly ensure_ok-ing a bunch of queries fixes rust-lang/rust#121429
Remove CollectItemTypesVisitor I always felt like we were very unnecessarily walking the HIR, let's see if perf agrees There is lots to ~~improve~~ consolidate further here, as we still have 3 item wfchecks: * check_item (matching on the hir::ItemKind) * actually doing trait solver based checks (by using HIR spans) * lower_item (matching on the hir::ItemKind after loading it again??) * just ensure_ok-ing a bunch of queries * check_item_type (matching on DefKind) * some type based checks, mostly ensure_ok-ing a bunch of queries fixes rust-lang/rust#121429
snippet:
Version information
Command:
/home/matthias/.rustup/toolchains/master/bin/rustc
Program output
The text was updated successfully, but these errors were encountered: