diff options
| author | Michael Goulet <michael@errs.io> | 2023-11-25 17:23:35 -0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-11-25 17:23:35 -0500 |
| commit | 2eccebb84d9963445ca75d9c38d35e7ad8590a4b (patch) | |
| tree | 3c30e74371860e98c8adcebc816e785854836840 | |
| parent | 58ab518e1d54672aa6b8ca34173092711b9919e6 (diff) | |
| parent | 1279f70bf43c7f807abdedf818ca9680f0e9676f (diff) | |
| download | rust-2eccebb84d9963445ca75d9c38d35e7ad8590a4b.tar.gz rust-2eccebb84d9963445ca75d9c38d35e7ad8590a4b.zip | |
Rollup merge of #118290 - compiler-errors:placeholder-implied, r=aliemjay
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
| -rw-r--r-- | compiler/rustc_trait_selection/src/traits/query/type_op/implied_outlives_bounds.rs | 6 | ||||
| -rw-r--r-- | tests/ui/impl-trait/in-trait/placeholder-implied-bounds.rs | 14 |
2 files changed, 18 insertions, 2 deletions
diff --git a/compiler/rustc_trait_selection/src/traits/query/type_op/implied_outlives_bounds.rs b/compiler/rustc_trait_selection/src/traits/query/type_op/implied_outlives_bounds.rs index 94d6b15fe43..56844f39478 100644 --- a/compiler/rustc_trait_selection/src/traits/query/type_op/implied_outlives_bounds.rs +++ b/compiler/rustc_trait_selection/src/traits/query/type_op/implied_outlives_bounds.rs @@ -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 diff --git a/tests/ui/impl-trait/in-trait/placeholder-implied-bounds.rs b/tests/ui/impl-trait/in-trait/placeholder-implied-bounds.rs new file mode 100644 index 00000000000..33d3487030e --- /dev/null +++ b/tests/ui/impl-trait/in-trait/placeholder-implied-bounds.rs @@ -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 { + &() + } +} |
