about summary refs log tree commit diff
diff options
context:
space:
mode:
authorJoshua Nelson <jnelson@cloudflare.com>2022-09-19 18:43:15 -0500
committerJoshua Nelson <jnelson@cloudflare.com>2022-09-19 22:14:39 -0500
commit5922d6cf60169ad0fd792581c9da11bd633533da (patch)
tree40a02bba9c053a0b2c97a4e2b5549a2ba2a0db74
parent88a192257ce110e7fb1732aa2b65e481f811db7a (diff)
downloadrust-5922d6cf60169ad0fd792581c9da11bd633533da.tar.gz
rust-5922d6cf60169ad0fd792581c9da11bd633533da.zip
slightly cleanup building SelectionContext
-rw-r--r--compiler/rustc_trait_selection/src/traits/select/mod.rs16
1 files changed, 2 insertions, 14 deletions
diff --git a/compiler/rustc_trait_selection/src/traits/select/mod.rs b/compiler/rustc_trait_selection/src/traits/select/mod.rs
index 8b15e10ba9c..6bdd613be5a 100644
--- a/compiler/rustc_trait_selection/src/traits/select/mod.rs
+++ b/compiler/rustc_trait_selection/src/traits/select/mod.rs
@@ -226,13 +226,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
     }
 
     pub fn intercrate(infcx: &'cx InferCtxt<'cx, 'tcx>) -> SelectionContext<'cx, 'tcx> {
-        SelectionContext {
-            infcx,
-            freshener: infcx.freshener_keep_static(),
-            intercrate: true,
-            intercrate_ambiguity_causes: None,
-            query_mode: TraitQueryMode::Standard,
-        }
+        SelectionContext { intercrate: true, ..SelectionContext::new(infcx) }
     }
 
     pub fn with_query_mode(
@@ -240,13 +234,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
         query_mode: TraitQueryMode,
     ) -> SelectionContext<'cx, 'tcx> {
         debug!(?query_mode, "with_query_mode");
-        SelectionContext {
-            infcx,
-            freshener: infcx.freshener_keep_static(),
-            intercrate: false,
-            intercrate_ambiguity_causes: None,
-            query_mode,
-        }
+        SelectionContext { query_mode, ..SelectionContext::new(infcx) }
     }
 
     /// Enables tracking of intercrate ambiguity causes. See