You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
use std::intrinsics::TypeId;fnprint_type_name<T:'static>(_val:T){println!("{}",TypeId::of::<T>());}fnmain(){print_type_name(|_name:&str| {// allows non 'static &str here5i
});}// error: internal compiler error: non-static region found when hashing a type
Well, this is interesting. It's broken all the way back to 0.10. I think it's been a bug in the type id implementation since it first landed. Here's a smaller test case:
use std::intrinsics::TypeId;fn main(){TypeId::of::<fn<'a>(&'a int)>();}
@alexcrichton, is there a particular reason hash_crate_independent explicitly checks that all regions it encounters are 'static? Trans doesn't seem to go out of its way to erase late-bound regions in fn type signatures, which results in this ICE. I could add a call to normalize_ty in trans to fix this, but it would be cheaper to just ignore regions during hashing.
changed the title [-]ICE: when non-static &str argument is allowed for closure used as static generic type[/-][+]ICE: when non-static &str argument is encountered by TypeId[/+]on Dec 13, 2014
Activity
Nercury commentedon Dec 13, 2014
Backtrace:
bkoropoff commentedon Dec 13, 2014
Well, this is interesting. It's broken all the way back to 0.10. I think it's been a bug in the type id implementation since it first landed. Here's a smaller test case:
bkoropoff commentedon Dec 13, 2014
@alexcrichton, is there a particular reason
hash_crate_independent
explicitly checks that all regions it encounters are'static
? Trans doesn't seem to go out of its way to erase late-bound regions in fn type signatures, which results in this ICE. I could add a call tonormalize_ty
in trans to fix this, but it would be cheaper to just ignore regions during hashing.[-]ICE: when non-static &str argument is allowed for closure used as static generic type[/-][+]ICE: when non-static &str argument is encountered by TypeId[/+]alexcrichton commentedon Dec 13, 2014
Ended up catching me on IRC
bkoropoff commentedon Dec 13, 2014
It seems we actually want to take late-bound regions into account when hashing. For example, the following should hold: