Repository navigation
Compiler crash when dealing with Any and Ref #60622
Description
Activity
Reduced:
trait Any {} trait AsAny { fn as_any(self); } impl<T> AsAny for T where T: Any + AsAny { fn as_any(self) {} } impl dyn AsAny { fn borrow<'a>(&'a self) -> &'a dyn AsAny { self } } fn demo<'a>(cell: &'a (dyn AsAny + 'static)) { cell.borrow::<'a, _>().as_any(); }
- addedI-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.regression-from-stable-to-betaPerformance or correctness regression from stable to beta.Performance or correctness regression from stable to beta.regression-from-stable-to-stablePerformance or correctness regression from one stable version to another.Performance or correctness regression from one stable version to another.and removedregression-from-stable-to-betaPerformance or correctness regression from stable to beta.Performance or correctness regression from stable to beta.
on May 8, 2019 Regression first occurred in 1.30 according to godbolt.
One can leave out the
Anytrait in your MCVE, still crashes.Bug was introduced somewhere between 33b923f...63d6649
Sadly that's a very big range, but there are no nightlys available in between and also no bors artifacts because they are older than 167triage: P-high
Smaller example from #60842:
fn run_wild<T, DL: Borked<T>>(dl: &DL) { dl.a::<'_, T>(); } pub trait Borked<T> { fn a(&self); } fn main() {}
I was trying to remove as many type parameters as possible, and ended up with this:
struct Borked {} impl Borked { fn a(&self) {} } fn run_wild<T>(b: &Borked) { b.a::<'_, T>(); }
Removing
<T>afterrun_wildstill cuases an ICE. Adding a<T>afterastops causing the ICE. Removing the'_also stops causing the ICE.Not sure if it's any more or less helpful, but just putting this here.
@rustbot claim
Looks like that didn't work, either way, I'm taking a look into this issue.
Error: The feature
assignis not enabled in this repository.
To enable it add its section in thetriagebot.tomlin the root of the repository.Please let
@rust-lang/releaseknow if you're having trouble with this bot.Error: The feature
assignis not enabled in this repository.
To enable it add its section in thetriagebot.tomlin the root of the repository.Please let
@rust-lang/releaseknow if you're having trouble with this bot.
Compiler crashes with
Also, I wonder what is the right way (or is there any way) to write a
demowith expected behavior. Thanks.