diff options
| author | Mark Rousskov <mark.simulacrum@gmail.com> | 2019-12-22 17:42:04 -0500 |
|---|---|---|
| committer | Mark Rousskov <mark.simulacrum@gmail.com> | 2019-12-22 17:42:47 -0500 |
| commit | a06baa56b95674fc626b3c3fd680d6a65357fe60 (patch) | |
| tree | cd9d867c2ca3cff5c1d6b3bd73377c44649fb075 /src/librustc/traits/codegen/mod.rs | |
| parent | 8eb7c58dbb7b32701af113bc58722d0d1fefb1eb (diff) | |
| download | rust-a06baa56b95674fc626b3c3fd680d6a65357fe60.tar.gz rust-a06baa56b95674fc626b3c3fd680d6a65357fe60.zip | |
Format the world
Diffstat (limited to 'src/librustc/traits/codegen/mod.rs')
| -rw-r--r-- | src/librustc/traits/codegen/mod.rs | 33 |
1 files changed, 18 insertions, 15 deletions
diff --git a/src/librustc/traits/codegen/mod.rs b/src/librustc/traits/codegen/mod.rs index 9dff699deb8..8bd3f3141d5 100644 --- a/src/librustc/traits/codegen/mod.rs +++ b/src/librustc/traits/codegen/mod.rs @@ -4,11 +4,12 @@ // general routines. use crate::infer::InferCtxt; -use crate::traits::{FulfillmentContext, Obligation, ObligationCause, SelectionContext, - TraitEngine, Vtable}; -use crate::ty::{self, TyCtxt}; -use crate::ty::subst::{Subst, SubstsRef}; +use crate::traits::{ + FulfillmentContext, Obligation, ObligationCause, SelectionContext, TraitEngine, Vtable, +}; use crate::ty::fold::TypeFoldable; +use crate::ty::subst::{Subst, SubstsRef}; +use crate::ty::{self, TyCtxt}; /// Attempts to resolve an obligation to a vtable. The result is /// a shallow vtable resolution, meaning that we do not @@ -23,8 +24,11 @@ pub fn codegen_fulfill_obligation<'tcx>( // Remove any references to regions; this helps improve caching. let trait_ref = ty.erase_regions(&trait_ref); - debug!("codegen_fulfill_obligation(trait_ref={:?}, def_id={:?})", - (param_env, trait_ref), trait_ref.def_id()); + debug!( + "codegen_fulfill_obligation(trait_ref={:?}, def_id={:?})", + (param_env, trait_ref), + trait_ref.def_id() + ); // Do the initial selection for the obligation. This yields the // shallow result we are looking for -- that is, what specific impl. @@ -32,9 +36,8 @@ pub fn codegen_fulfill_obligation<'tcx>( let mut selcx = SelectionContext::new(&infcx); let obligation_cause = ObligationCause::dummy(); - let obligation = Obligation::new(obligation_cause, - param_env, - trait_ref.to_poly_trait_predicate()); + let obligation = + Obligation::new(obligation_cause, param_env, trait_ref.to_poly_trait_predicate()); let selection = match selcx.select(&obligation) { Ok(Some(selection)) => selection, @@ -45,9 +48,11 @@ pub fn codegen_fulfill_obligation<'tcx>( // leading to an ambiguous result. So report this as an // overflow bug, since I believe this is the only case // where ambiguity can result. - bug!("Encountered ambiguity selecting `{:?}` during codegen, \ + bug!( + "Encountered ambiguity selecting `{:?}` during codegen, \ presuming due to overflow", - trait_ref) + trait_ref + ) } Err(e) => { bug!("Encountered error `{:?}` selecting `{:?}` during codegen", e, trait_ref) @@ -79,7 +84,7 @@ impl<'tcx> TyCtxt<'tcx> { self, param_substs: SubstsRef<'tcx>, param_env: ty::ParamEnv<'tcx>, - value: &T + value: &T, ) -> T where T: TypeFoldable<'tcx>, @@ -89,9 +94,7 @@ impl<'tcx> TyCtxt<'tcx> { param_substs={:?}, \ value={:?}, \ param_env={:?})", - param_substs, - value, - param_env, + param_substs, value, param_env, ); let substituted = value.subst(self, param_substs); self.normalize_erasing_regions(param_env, substituted) |
