diff options
| author | lcnr <rust@lcnr.de> | 2022-07-12 15:21:58 +0200 |
|---|---|---|
| committer | lcnr <rust@lcnr.de> | 2022-07-12 15:27:24 +0200 |
| commit | baefd42861b948510e2a2ede067f8fcaf475249b (patch) | |
| tree | 9ef20c8cf587f41bd289569da7a0909a6fd8fe89 /compiler/rustc_trait_selection/src/traits | |
| parent | b3f4c3119957aa0a250cab08ab586b7a9a680ef1 (diff) | |
| download | rust-baefd42861b948510e2a2ede067f8fcaf475249b.tar.gz rust-baefd42861b948510e2a2ede067f8fcaf475249b.zip | |
arena > Rc for query results
Diffstat (limited to 'compiler/rustc_trait_selection/src/traits')
| -rw-r--r-- | compiler/rustc_trait_selection/src/traits/query/type_op/custom.rs | 3 | ||||
| -rw-r--r-- | compiler/rustc_trait_selection/src/traits/query/type_op/mod.rs | 10 |
2 files changed, 7 insertions, 6 deletions
diff --git a/compiler/rustc_trait_selection/src/traits/query/type_op/custom.rs b/compiler/rustc_trait_selection/src/traits/query/type_op/custom.rs index c9d46b2810d..c99564936aa 100644 --- a/compiler/rustc_trait_selection/src/traits/query/type_op/custom.rs +++ b/compiler/rustc_trait_selection/src/traits/query/type_op/custom.rs @@ -9,7 +9,6 @@ use rustc_infer::traits::TraitEngineExt as _; use rustc_span::source_map::DUMMY_SP; use std::fmt; -use std::rc::Rc; pub struct CustomTypeOp<F, G> { closure: F, @@ -109,7 +108,7 @@ pub fn scrape_region_constraints<'tcx, Op: super::TypeOp<'tcx, Output = R>, R>( Ok(( TypeOpOutput { output: value, - constraints: Some(Rc::new(region_constraints)), + constraints: Some(infcx.tcx.arena.alloc(region_constraints)), error_info: None, }, region_constraint_data, diff --git a/compiler/rustc_trait_selection/src/traits/query/type_op/mod.rs b/compiler/rustc_trait_selection/src/traits/query/type_op/mod.rs index 1e72dd69339..f4733c9bab2 100644 --- a/compiler/rustc_trait_selection/src/traits/query/type_op/mod.rs +++ b/compiler/rustc_trait_selection/src/traits/query/type_op/mod.rs @@ -10,7 +10,6 @@ use rustc_infer::traits::PredicateObligations; use rustc_middle::ty::fold::TypeFoldable; use rustc_middle::ty::{ParamEnvAnd, TyCtxt}; use std::fmt; -use std::rc::Rc; pub mod ascribe_user_type; pub mod custom; @@ -41,7 +40,7 @@ pub struct TypeOpOutput<'tcx, Op: TypeOp<'tcx>> { /// The output from the type op. pub output: Op::Output, /// Any region constraints from performing the type op. - pub constraints: Option<Rc<QueryRegionConstraints<'tcx>>>, + pub constraints: Option<&'tcx QueryRegionConstraints<'tcx>>, /// Used for error reporting to be able to rerun the query pub error_info: Option<Op::ErrorInfo>, } @@ -158,8 +157,11 @@ where // Promote the final query-region-constraints into a // (optional) ref-counted vector: - let region_constraints = - if region_constraints.is_empty() { None } else { Some(Rc::new(region_constraints)) }; + let region_constraints = if region_constraints.is_empty() { + None + } else { + Some(&*infcx.tcx.arena.alloc(region_constraints)) + }; Ok(TypeOpOutput { output, constraints: region_constraints, error_info }) } |
