Skip to content

Commit

Permalink
Rollup merge of #118290 - compiler-errors:placeholder-implied, r=alie…
Browse files Browse the repository at this point in the history
…mjay

Don't ICE when encountering placeholders in implied bounds computation

I *could* fix this the right way, though I don't really want to think about the implications of the change. This should have minimal side-effects.

r? `@aliemjay`

Fixes #118286
  • Loading branch information
compiler-errors authored Nov 25, 2023
2 parents 58ab518 + 1279f70 commit 2eccebb
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -207,8 +207,10 @@ fn implied_bounds_from_components<'tcx>(
Component::Region(r) => Some(OutlivesBound::RegionSubRegion(sub_region, r)),
Component::Param(p) => Some(OutlivesBound::RegionSubParam(sub_region, p)),
Component::Alias(p) => Some(OutlivesBound::RegionSubAlias(sub_region, p)),
Component::Placeholder(_) => {
unimplemented!("Shouldn't expect a placeholder type in implied bounds (yet)")
Component::Placeholder(_p) => {
// FIXME(non_lifetime_binders): Placeholders don't currently
// imply anything for outlives, though they could easily.
None
}
Component::EscapingAlias(_) =>
// If the projection has escaping regions, don't
Expand Down
14 changes: 14 additions & 0 deletions tests/ui/impl-trait/in-trait/placeholder-implied-bounds.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
// check-pass

pub fn main() {}

pub trait Iced {
fn get(&self) -> &impl Sized;
}

/// Impl causes ICE
impl Iced for () {
fn get(&self) -> &impl Sized {
&()
}
}

0 comments on commit 2eccebb

Please sign in to comment.