diff --git a/src/librustc/hir/lowering.rs b/src/librustc/hir/lowering.rs index 9c4a208f0f9f..78670b2eb402 100644 --- a/src/librustc/hir/lowering.rs +++ b/src/librustc/hir/lowering.rs @@ -2725,7 +2725,7 @@ impl<'a> LoweringContext<'a> { // ::std::future::Future let future_path = - self.std_path(span, &[sym::future, sym::Future], Some(future_params), false); + P(self.std_path(span, &[sym::future, sym::Future], Some(future_params), false)); hir::GenericBound::Trait( hir::PolyTraitRef { @@ -3094,7 +3094,7 @@ impl<'a> LoweringContext<'a> { fn lower_trait_ref(&mut self, p: &TraitRef, itctx: ImplTraitContext<'_>) -> hir::TraitRef { let path = match self.lower_qpath(p.ref_id, &None, &p.path, ParamMode::Explicit, itctx) { - hir::QPath::Resolved(None, path) => path.and_then(|path| path), + hir::QPath::Resolved(None, path) => path, qpath => bug!("lower_trait_ref: unexpected QPath `{:?}`", qpath), }; hir::TraitRef { @@ -5577,7 +5577,7 @@ impl<'a> LoweringContext<'a> { let principal = hir::PolyTraitRef { bound_generic_params: hir::HirVec::new(), trait_ref: hir::TraitRef { - path: path.and_then(|path| path), + path, hir_ref_id: hir_id, }, span, diff --git a/src/librustc/hir/mod.rs b/src/librustc/hir/mod.rs index 6df1c2d8c77e..9f655202e796 100644 --- a/src/librustc/hir/mod.rs +++ b/src/librustc/hir/mod.rs @@ -2217,7 +2217,7 @@ pub enum UseKind { /// within the resolution map. #[derive(RustcEncodable, RustcDecodable, Debug, HashStable)] pub struct TraitRef { - pub path: Path, + pub path: P, // Don't hash the ref_id. It is tracked via the thing it is used to access #[stable_hasher(ignore)] pub hir_ref_id: HirId, diff --git a/src/librustc_typeck/collect.rs b/src/librustc_typeck/collect.rs index 87e1166b7c04..8464a710a4ae 100644 --- a/src/librustc_typeck/collect.rs +++ b/src/librustc_typeck/collect.rs @@ -1353,7 +1353,7 @@ pub fn checked_type_of<'tcx>(tcx: TyCtxt<'tcx>, def_id: DefId, fail: bool) -> Op None } } - Node::TraitRef(&hir::TraitRef { ref path, .. }) => Some(path), + Node::TraitRef(&hir::TraitRef { ref path, .. }) => Some(&**path), _ => None, };