Skip to content

Commit c8f50ee

Browse files
authored
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``
2 parents 0b96b25 + 0506250 commit c8f50ee

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed

Diff for: compiler/rustc_metadata/src/rmeta/encoder.rs

+3
Original file line numberDiff line numberDiff line change
@@ -1447,6 +1447,9 @@ impl<'a, 'tcx> EncodeContext<'a, 'tcx> {
14471447
.is_type_alias_impl_trait
14481448
.set(def_id.index, self.tcx.is_type_alias_impl_trait(def_id));
14491449
}
1450+
if let DefKind::ImplTraitPlaceholder = def_kind {
1451+
self.encode_explicit_item_bounds(def_id);
1452+
}
14501453
if tcx.impl_method_has_trait_impl_trait_tys(def_id)
14511454
&& let Ok(table) = self.tcx.collect_return_position_impl_trait_in_trait_tys(def_id)
14521455
{

Diff for: tests/ui/impl-trait/in-trait/foreign.rs

+4
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,10 @@ impl Foo for Local {
1414
fn bar(self) -> Arc<String> { Arc::new(String::new()) }
1515
}
1616

17+
fn generic(f: impl Foo) {
18+
let x = &*f.bar();
19+
}
20+
1721
fn main() {
1822
// Witness an RPITIT from another crate.
1923
let &() = Foreign.bar();

0 commit comments

Comments
 (0)