Change:
In a folder , I have a blank library crate with the following : In a folder , I have a blank binary crate with the follow : 's uses crate with the following line: Running or in will produce the following ICE:
triage: P-high. Assigning to self for initial investigation. Removing I-nominated label. assigning as well, as someone who will likely resolve this faster than it will take me to build
Oh, given that this is using const generics (an unstable feature), it probably should be P-medium rather than P-high. I won't change the label yet, but if triage on thursday rolls around and I haven't seen a good reason to keep it P-high, I'll change the label then.
If downstream crates could ICE because they're using a type alias with const generics, even if they don't enable themselves, it seems like slightly more of an issue. (Sorry, I don't have time to look into this issue at the moment.)
It's not just type aliases, but also other constellations of cross-crate usage that are giving this ICE:
I continue to have the impression that if you use stable Rust, it will be used on all of your crates, and therefore you won't hit this bug. (don't get me wrong; I've commented elsewhere, rust-call bug in particular, where I do worry about impact on downstream crates from upstream crates using certain features that have bugs) But I still think this only warrants P-medium. Reclassifying as such.
Encountered this issue and documented it . The associated code is .
I just hit this issue as well in my project. Unfortunately I cannot share the code I'm hitting this with. A repro would look very similar to est31's example , but in my case the affected type isn't even exposed to the bin application. It's only. <details<summaryClick for stack</summary<p</p</details
Also when the type is wrapped privately (i.e., ) and exported like that, it seems to be triggered.

Discussion:
EncodedMetadata, ForeignModule}; use rustc::hir::def::CtorKind; use rustc::hir::def_id::{CrateNum, CRATE_DEF_INDEX, DefIndex, DefId, LocalDefId, LOCAL_CRATE}; <del> use rustc::hir::GenericParamKind; </del> <ins> use rustc::hir::{GenericParamKind, AnonConst}; </ins> use rustc::hir::map::definitions::DefPathTable; use rustc_data_structures::fingerprint::Fingerprint; use rustc_index::vec::IndexVec;

intravisit::walk_expr(self, ex); self.encode_info_for_expr(ex); } <ins> fn visit_anon_const(&mut self, c: &'tcx AnonConst) { intravisit::walk_anon_const(self, c); let def_id = self.tcx.hir().local_def_id(c.hir_id); self.record(def_id, EncodeContext::encode_info_for_anon_const, def_id); } </ins> fn visit_item(&mut self, item: &'tcx hir::Item) { intravisit::walk_item(self, item); let def_id = self.tcx.hir().local_def_id(item.hir_id);

EncodeContext::encode_info_for_foreign_item, (def_id, ni)); } <del> fn visit_variant(&mut self, v: &'tcx hir::Variant, g: &'tcx hir::Generics, id: hir::HirId) { intravisit::walk_variant(self, v, g, id); if let Some(ref discr) = v.disr_expr { let def_id = self.tcx.hir().local_def_id(discr.hir_id); self.record(def_id, EncodeContext::encode_info_for_anon_const, def_id); } } </del> fn visit_generics(&mut self, generics: &'tcx hir::Generics) { intravisit::walk_generics(self, generics); self.encode_info_for_generics(generics); } <del> fn visit_ty(&mut self, ty: &'tcx hir::Ty) { intravisit::walk_ty(self, ty); self.encode_info_for_ty(ty); } </del> fn visit_macro_def(&mut self, macro_def: &'tcx hir::MacroDef) { let def_id = self.tcx.hir().local_def_id(macro_def.hir_id); self.record(def_id, EncodeContext::encode_info_for_macro_def, macro_def);

} } <del> fn encode_info_for_ty(&mut self, ty: &hir::Ty) { match ty.kind { hir::TyKind::Array(_, ref length) => { let def_id = self.tcx.hir().local_def_id(length.hir_id); self.record(def_id, EncodeContext::encode_info_for_anon_const, def_id); } _ => {} } } </del> fn encode_info_for_expr(&mut self, expr: &hir::Expr) { match expr.kind { hir::ExprKind::Closure(..) => {

<ins> #![feature(const_generics)] pub struct Struct<const N: usize>(pub [u8; N]); pub type Alias = Struct<2>; pub fn function(value: Struct<3>) -> u8 { value.0[0] } </ins>

<ins> // aux-build:const_generic_lib.rs extern crate const_generic_lib; fn main() { let _ = const_generic_lib::function(const_generic_lib::Struct([0u8, 1u8])); //~^ ERROR mismatched types let _: const_generic_lib::Alias = const_generic_lib::Struct([0u8, 1u8, 2u8]); //~^ ERROR mismatched types } </ins>

<ins> error[E0308]: mismatched types --> $DIR/const-argument-cross-crate-mismatch.rs:6:41 | LL |     let _ = const_generic_lib::function(const_generic_lib::Struct([0u8, 1u8])); |                                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `3usize`, found `2usize` | = note: expected type `const_generic_lib::Struct<3usize>` found type `const_generic_lib::Struct<_: usize>` error[E0308]: mismatched types --> $DIR/const-argument-cross-crate-mismatch.rs:8:39 | LL |     let _: const_generic_lib::Alias = const_generic_lib::Struct([0u8, 1u8, 2u8]); |                                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `2usize`, found `3usize` | = note: expected type `const_generic_lib::Struct<2usize>` found type `const_generic_lib::Struct<_: usize>` error: aborting due to 2 previous errors For more information about this error, try `rustc --explain E0308`. </ins>

<ins> // run-pass // aux-build:const_generic_lib.rs extern crate const_generic_lib; struct Container(const_generic_lib::Alias); fn main() { let res = const_generic_lib::function(const_generic_lib::Struct([14u8, 1u8, 2u8])); assert_eq!(res, 14u8); let _ = Container(const_generic_lib::Struct([0u8, 1u8])); } </ins>