Skip to content

Commit 5b5b468

Browse files
committed
don't decompress when expanding opaques (old solver)
1 parent bbee9fa commit 5b5b468

6 files changed

Lines changed: 13 additions & 11 deletions

File tree

‎compiler/rustc_middle/src/queries.rs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2729,7 +2729,7 @@ rustc_queries! {
27292729
desc { "resolving instance `{}`", ty::Instance::new_raw(key.value.0, key.value.1) }
27302730
}
27312731

2732-
query reveal_opaque_types_in_bounds(key: ty::Clauses<'tcx>) -> ty::Clauses<'tcx> {
2732+
query reveal_opaque_types_in_bounds(key: ty::ParamEnv<'tcx>) -> ty::ParamEnv<'tcx> {
27332733
desc { "revealing opaque types in `{:?}`", key }
27342734
}
27352735

‎compiler/rustc_middle/src/query/keys.rs‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -290,6 +290,12 @@ impl<'tcx> QueryKey for ty::Clauses<'tcx> {
290290
}
291291
}
292292

293+
impl<'tcx> QueryKey for ty::ParamEnv<'tcx> {
294+
fn default_span(&self, _: TyCtxt<'_>) -> Span {
295+
DUMMY_SP
296+
}
297+
}
298+
293299
impl<'tcx> QueryKey for ty::AliasTyKind<'tcx> {
294300
fn default_span(&self, tcx: TyCtxt<'_>) -> Span {
295301
let def_id = match self {

‎compiler/rustc_middle/src/ty/mod.rs‎

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1144,12 +1144,7 @@ impl<'tcx> ParamEnv<'tcx> {
11441144
if tcx.next_trait_solver_globally() {
11451145
self
11461146
} else {
1147-
ParamEnv::new(
1148-
tcx,
1149-
tcx.reveal_opaque_types_in_bounds(
1150-
tcx.mk_clauses_from_iter(self.caller_bounds().all_clauses(tcx).iter()),
1151-
),
1152-
)
1147+
tcx.reveal_opaque_types_in_bounds(self)
11531148
}
11541149
}
11551150
}

‎compiler/rustc_middle/src/ty/util.rs‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1696,8 +1696,8 @@ pub struct AlwaysRequiresDrop;
16961696
/// with their underlying types.
16971697
pub fn reveal_opaque_types_in_bounds<'tcx>(
16981698
tcx: TyCtxt<'tcx>,
1699-
val: ty::Clauses<'tcx>,
1700-
) -> ty::Clauses<'tcx> {
1699+
val: ty::ParamEnv<'tcx>,
1700+
) -> ty::ParamEnv<'tcx> {
17011701
assert!(!tcx.next_trait_solver_globally());
17021702
let mut visitor = OpaqueTypeExpander {
17031703
seen_opaque_tys: FxHashSet::default(),

‎src/librustdoc/clean/auto_trait.rs‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@ use rustc_trait_selection::traits::auto_trait::{self, RegionTarget};
1010
use tracing::{debug, instrument};
1111

1212
use crate::clean::{
13-
self, Lifetime, clean_clause_uninterned, clean_generic_param_def, clean_middle_ty, clean_trait_ref_with_constraints, clean_ty_generics_inner, simplify,
13+
self, Lifetime, clean_clause_uninterned, clean_generic_param_def, clean_middle_ty,
14+
clean_trait_ref_with_constraints, clean_ty_generics_inner, simplify,
1415
};
1516
use crate::core::DocContext;
1617

‎tests/ui/type-alias-impl-trait/in-where-clause.stderr‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ note: ...which requires computing revealed normalized predicates of `foo::{const
2121
|
2222
LL | [0; 1 + 2]
2323
| ^^^^^
24-
= note: ...which requires revealing opaque types in `[Binder { value: TraitClause(<Bar as core::marker::Send>, polarity:Positive), bound_vars: [] }]`...
24+
= note: ...which requires revealing opaque types in `ParamEnv { caller_bounds: [Binder { value: CompressedTrait([Alias(No, Alias { kind: Opaque { def_id: DefId(0:4 ~ in_where_clause[cb1b]::Bar::{opaque#0}) }, args: [], .. })] as SEND), bound_vars: [] }] }`...
2525
note: ...which requires computing type of `Bar::{opaque#0}`...
2626
--> $DIR/in-where-clause.rs:5:12
2727
|

0 commit comments

Comments
 (0)