Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't ICE when encountering placeholders in implied bounds computation #118290

Merged
merged 1 commit into from
Nov 26, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 {
&()
}
}