Change:
<!-- Thank you for finding an Internal Compiler Error! If possible, try to provide a minimal verifiable example. You can read "Rust Bug Minimization Patterns" for how to create smaller examples. --Not sure how this passes the test suite :upsidedownface: Original code from reduced &lt;!-- If you're using the stable version of the compiler, you should also check if the bug also exists in the beta or nightly versions. --: &lt;!-- Include a backtrace in the code block by setting in your environment. E.g. . --&lt;details&lt;summary&lt;strongBacktrace&lt;/strong&lt;/summary&lt;p&lt;/p&lt;/details
This is caused by The fix is to either enable in - this improves diagnostics but pessimizes compile times for successful compilations. do not use spans of const generic parameters from other crates in diagnostics - this makes diagnostics worse but optimizes compile times for successful compilations.
I can't reproduce this either locally or in playground.
Weird, I can still repro locally with and master :shrug:
mcve from a different file:
This is also weird for me to reproduce: I must be doing something wrong, both my and toolchains are the same rustc/cargo commits ( and ): a (or rustc) ICEs on that stdsimd repro a (or rustc) does not a ICEs (but not rustc)
Yeah, something is very weird. I didn't manage to properly this when I tried. I also failed to reproduce on playground or godbolt, but I have encountered maybe around 20 more or less similar files that hit this ICE when checking reports.
Same for me, found a nightly but failed with the CI artifacts. If somehow invoking differently manually or with/without rustup makes things work or fail, maybe the tool also invokes things in the way that doesn't repro...
I forgot to mention: this does also reproduce on master and reverting seems to fix the ICE indeed, as vadim suggested above.
I'm going to remove has-mcve since we're not sure why it sometimes doesn't ICE.
I think this is the better solution. Otherwise, we'll have more and more special cases in diagnostic code which is already very complex.
Couple more reproducers:

Discussion:
| DefKind::TraitAlias | DefKind::AssocTy | DefKind::TyParam <ins> | DefKind::ConstParam </ins> | DefKind::Fn | DefKind::Const | DefKind::Static(_)

| DefKind::Impl { .. } | DefKind::Closure | DefKind::Generator => true, <del> DefKind::ConstParam | DefKind::ExternCrate </del> <ins> DefKind::ExternCrate </ins> | DefKind::Use | DefKind::ForeignMod | DefKind::ImplTraitPlaceholder

<ins> pub fn test<const N: usize, T>() {} </ins>

<ins> // aux-build: foreign-generic-mismatch-with-const-arg.rs extern crate foreign_generic_mismatch_with_const_arg; fn main() { foreign_generic_mismatch_with_const_arg::test::<1>(); //~^ ERROR function takes 2 generic arguments but 1 generic argument was supplied } </ins>

<ins> error[E0107]: function takes 2 generic arguments but 1 generic argument was supplied --> $DIR/foreign-generic-mismatch-with-const-arg.rs:6:46 | LL |     foreign_generic_mismatch_with_const_arg::test::<1>(); |                                              ^^^^   - supplied 1 generic argument |                                              | |                                              expected 2 generic arguments | note: function defined here, with 2 generic parameters: `N`, `T` --> $DIR/auxiliary/foreign-generic-mismatch-with-const-arg.rs:1:8 | LL | pub fn test<const N: usize, T>() {} |        ^^^^ --------------  - help: add missing generic argument | LL |     foreign_generic_mismatch_with_const_arg::test::<1, T>(); |                                                      +++ error: aborting due to previous error For more information about this error, try `rustc --explain E0107`. </ins>