diff options
| author | Matthias Krüger <matthias.krueger@famsik.de> | 2023-06-30 08:01:13 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-06-30 08:01:13 +0200 |
| commit | c8f50ee11170166e86ab9c9b10c208f51ad998a1 (patch) | |
| tree | 33d76684935eb33b0b891a138b5cfbd09b3ba970 | |
| parent | 0b96b25bdf3aee2bfe3b8645b353da4cf835ed37 (diff) | |
| parent | 0506250f8c36394916800da92592acaab747738e (diff) | |
| download | rust-c8f50ee11170166e86ab9c9b10c208f51ad998a1.tar.gz rust-c8f50ee11170166e86ab9c9b10c208f51ad998a1.zip | |
Rollup merge of #113165 - compiler-errors:rpitits-foreign-bounds, r=spastorino
Encode item bounds for `DefKind::ImplTraitPlaceholder` This was lost in a refactoring -- `hir::ItemKind::OpaqueTy` doesn't always map to `DefKind::Opaque`, specifically for RPITITs, so the check was migrated subtly wrong, and unfortunately I never had a test for this 🙃 Fixes #113155 r? ``@cjgillot``
| -rw-r--r-- | compiler/rustc_metadata/src/rmeta/encoder.rs | 3 | ||||
| -rw-r--r-- | tests/ui/impl-trait/in-trait/foreign.rs | 4 |
2 files changed, 7 insertions, 0 deletions
diff --git a/compiler/rustc_metadata/src/rmeta/encoder.rs b/compiler/rustc_metadata/src/rmeta/encoder.rs index b80019bf155..efe49d687c9 100644 --- a/compiler/rustc_metadata/src/rmeta/encoder.rs +++ b/compiler/rustc_metadata/src/rmeta/encoder.rs @@ -1447,6 +1447,9 @@ impl<'a, 'tcx> EncodeContext<'a, 'tcx> { .is_type_alias_impl_trait .set(def_id.index, self.tcx.is_type_alias_impl_trait(def_id)); } + if let DefKind::ImplTraitPlaceholder = def_kind { + self.encode_explicit_item_bounds(def_id); + } if tcx.impl_method_has_trait_impl_trait_tys(def_id) && let Ok(table) = self.tcx.collect_return_position_impl_trait_in_trait_tys(def_id) { diff --git a/tests/ui/impl-trait/in-trait/foreign.rs b/tests/ui/impl-trait/in-trait/foreign.rs index 98417b343a1..b0fbe3a3d4a 100644 --- a/tests/ui/impl-trait/in-trait/foreign.rs +++ b/tests/ui/impl-trait/in-trait/foreign.rs @@ -14,6 +14,10 @@ impl Foo for Local { fn bar(self) -> Arc<String> { Arc::new(String::new()) } } +fn generic(f: impl Foo) { + let x = &*f.bar(); +} + fn main() { // Witness an RPITIT from another crate. let &() = Foreign.bar(); |
