diff options
| author | bors <bors@rust-lang.org> | 2024-03-06 02:18:22 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2024-03-06 02:18:22 +0000 |
| commit | b77e0184a95d60080f0d0605e2a3b337e904c21e (patch) | |
| tree | 02f234cb3efa0a393b0e72e8a688e6a3d57d68b4 /compiler/rustc_infer/src | |
| parent | 62415e2a95a3b0f137636f86f6a904b8ed85798e (diff) | |
| parent | 4f73d2a53c74428bd6e4fdda63b1dcc9fdf18353 (diff) | |
| download | rust-b77e0184a95d60080f0d0605e2a3b337e904c21e.tar.gz rust-b77e0184a95d60080f0d0605e2a3b337e904c21e.zip | |
Auto merge of #122045 - matthiaskrgr:rollup-5l3vpn7, r=matthiaskrgr
Rollup of 9 pull requests Successful merges: - #121065 (Add basic i18n guidance for `Display`) - #121744 (Stop using Bubble in coherence and instead emulate it with an intercrate check) - #121829 (Dummy tweaks (attempt 2)) - #121857 (Implement async closure signature deduction) - #121894 (const_eval_select: make it safe but be careful with what we expose on stable for now) - #122014 (Change some attributes to only_local.) - #122016 (will_wake tests fail on Miri and that is expected) - #122018 (only set noalias on Box with the global allocator) - #122028 (Remove some dead code) r? `@ghost` `@rustbot` modify labels: rollup
Diffstat (limited to 'compiler/rustc_infer/src')
| -rw-r--r-- | compiler/rustc_infer/src/infer/opaque_types.rs | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/compiler/rustc_infer/src/infer/opaque_types.rs b/compiler/rustc_infer/src/infer/opaque_types.rs index 9f11b3ddb61..68b6a2f62fb 100644 --- a/compiler/rustc_infer/src/infer/opaque_types.rs +++ b/compiler/rustc_infer/src/infer/opaque_types.rs @@ -100,6 +100,15 @@ impl<'tcx> InferCtxt<'tcx> { let process = |a: Ty<'tcx>, b: Ty<'tcx>| match *a.kind() { ty::Alias(ty::Opaque, ty::AliasTy { def_id, args, .. }) if def_id.is_local() => { let def_id = def_id.expect_local(); + if self.intercrate { + // See comment on `insert_hidden_type` for why this is sufficient in coherence + return Some(self.register_hidden_type( + OpaqueTypeKey { def_id, args }, + cause.clone(), + param_env, + b, + )); + } match self.defining_use_anchor { DefiningAnchor::Bind(_) => { // Check that this is `impl Trait` type is @@ -141,8 +150,10 @@ impl<'tcx> InferCtxt<'tcx> { } } DefiningAnchor::Bubble => {} - DefiningAnchor::Error => return None, - }; + DefiningAnchor::Error => { + return None; + } + } if let ty::Alias(ty::Opaque, ty::AliasTy { def_id: b_def_id, .. }) = *b.kind() { // We could accept this, but there are various ways to handle this situation, and we don't // want to make a decision on it right now. Likely this case is so super rare anyway, that |
