From 62ac10ffdec716ca1763bf0a1e45430449a7bbde Mon Sep 17 00:00:00 2001 From: Mazdak Farrokhzad Date: Sun, 5 Jan 2020 01:50:05 +0100 Subject: [PATCH] simplify reexports in rustc::hir --- src/librustc/hir.rs | 11 --------- src/librustc/hir/intravisit.rs | 2 +- src/librustc_ast_lowering/expr.rs | 8 +++---- src/librustc_ast_lowering/lib.rs | 24 ++++++++++++-------- src/librustc_lint/types.rs | 4 ++-- src/librustc_mir/hair/pattern/mod.rs | 2 +- src/librustc_mir/transform/check_unsafety.rs | 2 +- src/librustc_passes/region.rs | 2 +- src/librustc_resolve/lib.rs | 2 +- src/librustc_resolve/lifetimes.rs | 4 ++-- src/librustc_typeck/astconv.rs | 16 ++++++------- src/librustc_typeck/check/closure.rs | 6 ++--- src/librustc_typeck/check/expr.rs | 12 +++++----- src/librustc_typeck/check/method/confirm.rs | 4 ++-- src/librustc_typeck/check/mod.rs | 9 ++++---- src/librustc_typeck/check/op.rs | 12 +++++----- src/librustc_typeck/check/regionck.rs | 4 ++-- src/librustc_typeck/check/writeback.rs | 4 ++-- src/librustc_typeck/collect.rs | 2 +- src/librustc_typeck/expr_use_visitor.rs | 2 +- src/librustc_typeck/mem_categorization.rs | 2 +- src/librustdoc/clean/mod.rs | 4 ++-- src/librustdoc/clean/utils.rs | 12 +++++----- 23 files changed, 72 insertions(+), 78 deletions(-) diff --git a/src/librustc/hir.rs b/src/librustc/hir.rs index 62160fed1bc6..f20ad2036850 100644 --- a/src/librustc/hir.rs +++ b/src/librustc/hir.rs @@ -3,22 +3,11 @@ //! [rustc guide]: https://rust-lang.github.io/rustc-guide/hir.html pub mod check_attr; -pub use rustc_hir::def; pub mod exports; -pub use rustc_hir::def_id; -pub use rustc_hir::hir_id::*; pub mod intravisit; -pub use rustc_hir::itemlikevisit; pub mod map; -pub use rustc_hir::pat_util; -pub use rustc_hir::print; pub mod upvars; -pub use rustc_hir::BlockCheckMode::*; -pub use rustc_hir::FunctionRetTy::*; -pub use rustc_hir::PrimTy::*; -pub use rustc_hir::UnOp::*; -pub use rustc_hir::UnsafeSource::*; pub use rustc_hir::*; use crate::ty::query::Providers; diff --git a/src/librustc/hir/intravisit.rs b/src/librustc/hir/intravisit.rs index 780b0e36b5e4..2c0da208d87a 100644 --- a/src/librustc/hir/intravisit.rs +++ b/src/librustc/hir/intravisit.rs @@ -867,7 +867,7 @@ pub fn walk_where_predicate<'v, V: Visitor<'v>>( } pub fn walk_fn_ret_ty<'v, V: Visitor<'v>>(visitor: &mut V, ret_ty: &'v FunctionRetTy<'v>) { - if let Return(ref output_ty) = *ret_ty { + if let FunctionRetTy::Return(ref output_ty) = *ret_ty { visitor.visit_ty(output_ty) } } diff --git a/src/librustc_ast_lowering/expr.rs b/src/librustc_ast_lowering/expr.rs index 591e869193d8..6caba1a18a22 100644 --- a/src/librustc_ast_lowering/expr.rs +++ b/src/librustc_ast_lowering/expr.rs @@ -207,9 +207,9 @@ impl<'hir> LoweringContext<'_, 'hir> { fn lower_unop(&mut self, u: UnOp) -> hir::UnOp { match u { - UnOp::Deref => hir::UnDeref, - UnOp::Not => hir::UnNot, - UnOp::Neg => hir::UnNeg, + UnOp::Deref => hir::UnOp::UnDeref, + UnOp::Not => hir::UnOp::UnNot, + UnOp::Neg => hir::UnOp::UnNeg, } } @@ -1374,7 +1374,7 @@ impl<'hir> LoweringContext<'_, 'hir> { stmts: &[], expr: Some(expr), hir_id, - rules: hir::UnsafeBlock(hir::CompilerGenerated), + rules: hir::BlockCheckMode::UnsafeBlock(hir::UnsafeSource::CompilerGenerated), span, targeted_by_break: false, }), diff --git a/src/librustc_ast_lowering/lib.rs b/src/librustc_ast_lowering/lib.rs index 5694bedb1993..2c61255f96dc 100644 --- a/src/librustc_ast_lowering/lib.rs +++ b/src/librustc_ast_lowering/lib.rs @@ -2144,12 +2144,14 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> { } else { match decl.output { FunctionRetTy::Ty(ref ty) => match in_band_ty_params { - Some((def_id, _)) if impl_trait_return_allow => { - hir::Return(self.lower_ty(ty, ImplTraitContext::OpaqueTy(Some(def_id)))) - } - _ => hir::Return(self.lower_ty(ty, ImplTraitContext::disallowed())), + Some((def_id, _)) if impl_trait_return_allow => hir::FunctionRetTy::Return( + self.lower_ty(ty, ImplTraitContext::OpaqueTy(Some(def_id))), + ), + _ => hir::FunctionRetTy::Return( + self.lower_ty(ty, ImplTraitContext::disallowed()), + ), }, - FunctionRetTy::Default(span) => hir::DefaultReturn(span), + FunctionRetTy::Default(span) => hir::FunctionRetTy::DefaultReturn(span), } }; @@ -2940,8 +2942,10 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> { fn lower_block_check_mode(&mut self, b: &BlockCheckMode) -> hir::BlockCheckMode { match *b { - BlockCheckMode::Default => hir::DefaultBlock, - BlockCheckMode::Unsafe(u) => hir::UnsafeBlock(self.lower_unsafe_source(u)), + BlockCheckMode::Default => hir::BlockCheckMode::DefaultBlock, + BlockCheckMode::Unsafe(u) => { + hir::BlockCheckMode::UnsafeBlock(self.lower_unsafe_source(u)) + } } } @@ -2956,8 +2960,8 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> { fn lower_unsafe_source(&mut self, u: UnsafeSource) -> hir::UnsafeSource { match u { - CompilerGenerated => hir::CompilerGenerated, - UserProvided => hir::UserProvided, + CompilerGenerated => hir::UnsafeSource::CompilerGenerated, + UserProvided => hir::UnsafeSource::UserProvided, } } @@ -3004,7 +3008,7 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> { stmts, expr, hir_id: self.next_id(), - rules: hir::DefaultBlock, + rules: hir::BlockCheckMode::DefaultBlock, span, targeted_by_break: false, }; diff --git a/src/librustc_lint/types.rs b/src/librustc_lint/types.rs index 7944c88c7cbd..c494a285bf87 100644 --- a/src/librustc_lint/types.rs +++ b/src/librustc_lint/types.rs @@ -376,7 +376,7 @@ fn lint_literal<'a, 'tcx>( impl<'a, 'tcx> LateLintPass<'a, 'tcx> for TypeLimits { fn check_expr(&mut self, cx: &LateContext<'a, 'tcx>, e: &'tcx hir::Expr<'tcx>) { match e.kind { - hir::ExprKind::Unary(hir::UnNeg, ref expr) => { + hir::ExprKind::Unary(hir::UnOp::UnNeg, ref expr) => { // propagate negation, if the negation itself isn't negated if self.negated_expr_id != e.hir_id { self.negated_expr_id = expr.hir_id; @@ -969,7 +969,7 @@ impl<'a, 'tcx> ImproperCTypesVisitor<'a, 'tcx> { self.check_type_for_ffi_and_report_errors(input_hir.span, input_ty, false); } - if let hir::Return(ref ret_hir) = decl.output { + if let hir::FunctionRetTy::Return(ref ret_hir) = decl.output { let ret_ty = sig.output(); if !ret_ty.is_unit() { self.check_type_for_ffi_and_report_errors(ret_hir.span, ret_ty, false); diff --git a/src/librustc_mir/hair/pattern/mod.rs b/src/librustc_mir/hair/pattern/mod.rs index f5d8ed877ec5..235821f0936a 100644 --- a/src/librustc_mir/hair/pattern/mod.rs +++ b/src/librustc_mir/hair/pattern/mod.rs @@ -814,7 +814,7 @@ impl<'a, 'tcx> PatCtxt<'a, 'tcx> { } } hir::ExprKind::Path(ref qpath) => *self.lower_path(qpath, expr.hir_id, expr.span).kind, - hir::ExprKind::Unary(hir::UnNeg, ref expr) => { + hir::ExprKind::Unary(hir::UnOp::UnNeg, ref expr) => { let ty = self.tables.expr_ty(expr); let lit = match expr.kind { hir::ExprKind::Lit(ref lit) => lit, diff --git a/src/librustc_mir/transform/check_unsafety.rs b/src/librustc_mir/transform/check_unsafety.rs index c63755734417..26f59bf895f6 100644 --- a/src/librustc_mir/transform/check_unsafety.rs +++ b/src/librustc_mir/transform/check_unsafety.rs @@ -482,7 +482,7 @@ impl<'a, 'tcx> hir::intravisit::Visitor<'tcx> for UnusedUnsafeVisitor<'a> { fn visit_block(&mut self, block: &'tcx hir::Block<'tcx>) { hir::intravisit::walk_block(self, block); - if let hir::UnsafeBlock(hir::UserProvided) = block.rules { + if let hir::BlockCheckMode::UnsafeBlock(hir::UnsafeSource::UserProvided) = block.rules { self.unsafe_blocks.push((block.hir_id, self.used_unsafe.contains(&block.hir_id))); } } diff --git a/src/librustc_passes/region.rs b/src/librustc_passes/region.rs index 7652d5a36ee1..2fc30ccd4e08 100644 --- a/src/librustc_passes/region.rs +++ b/src/librustc_passes/region.rs @@ -651,7 +651,7 @@ fn resolve_local<'tcx>( match expr.kind { hir::ExprKind::AddrOf(_, _, ref subexpr) - | hir::ExprKind::Unary(hir::UnDeref, ref subexpr) + | hir::ExprKind::Unary(hir::UnOp::UnDeref, ref subexpr) | hir::ExprKind::Field(ref subexpr, _) | hir::ExprKind::Index(ref subexpr, _) => { expr = &subexpr; diff --git a/src/librustc_resolve/lib.rs b/src/librustc_resolve/lib.rs index 72e0dc32c210..87a10d117050 100644 --- a/src/librustc_resolve/lib.rs +++ b/src/librustc_resolve/lib.rs @@ -26,7 +26,7 @@ use rustc::hir::def::{self, CtorKind, CtorOf, DefKind, NonMacroAttrKind, Partial use rustc::hir::def_id::{CrateNum, DefId, DefIdMap, CRATE_DEF_INDEX, LOCAL_CRATE}; use rustc::hir::exports::ExportMap; use rustc::hir::map::Definitions; -use rustc::hir::{Bool, Char, Float, Int, PrimTy, Str, Uint}; +use rustc::hir::PrimTy::{self, Bool, Char, Float, Int, Str, Uint}; use rustc::hir::{GlobMap, TraitMap}; use rustc::lint; use rustc::middle::cstore::{CrateStore, MetadataLoaderDyn}; diff --git a/src/librustc_resolve/lifetimes.rs b/src/librustc_resolve/lifetimes.rs index 5d82c1772594..7f51aeb46cd4 100644 --- a/src/librustc_resolve/lifetimes.rs +++ b/src/librustc_resolve/lifetimes.rs @@ -846,8 +846,8 @@ impl<'a, 'tcx> Visitor<'tcx> for LifetimeContext<'a, 'tcx> { fn visit_fn_decl(&mut self, fd: &'tcx hir::FnDecl<'tcx>) { let output = match fd.output { - hir::DefaultReturn(_) => None, - hir::Return(ref ty) => Some(&**ty), + hir::FunctionRetTy::DefaultReturn(_) => None, + hir::FunctionRetTy::Return(ref ty) => Some(&**ty), }; self.visit_fn_like_elision(&fd.inputs, output); } diff --git a/src/librustc_typeck/astconv.rs b/src/librustc_typeck/astconv.rs index 601a46ad345c..b9a2eeb55fcf 100644 --- a/src/librustc_typeck/astconv.rs +++ b/src/librustc_typeck/astconv.rs @@ -2554,12 +2554,12 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o { assert_eq!(opt_self_ty, None); self.prohibit_generics(path.segments); match prim_ty { - hir::Bool => tcx.types.bool, - hir::Char => tcx.types.char, - hir::Int(it) => tcx.mk_mach_int(it), - hir::Uint(uit) => tcx.mk_mach_uint(uit), - hir::Float(ft) => tcx.mk_mach_float(ft), - hir::Str => tcx.mk_str(), + hir::PrimTy::Bool => tcx.types.bool, + hir::PrimTy::Char => tcx.types.char, + hir::PrimTy::Int(it) => tcx.mk_mach_int(it), + hir::PrimTy::Uint(uit) => tcx.mk_mach_uint(uit), + hir::PrimTy::Float(ft) => tcx.mk_mach_float(ft), + hir::PrimTy::Str => tcx.mk_str(), } } Res::Err => { @@ -2773,11 +2773,11 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o { } let input_tys = decl.inputs.iter().map(|a| self.ty_of_arg(a, None)); let output_ty = match decl.output { - hir::Return(ref output) => { + hir::FunctionRetTy::Return(ref output) => { visitor.visit_ty(output); self.ast_ty_to_ty(output) } - hir::DefaultReturn(..) => tcx.mk_unit(), + hir::FunctionRetTy::DefaultReturn(..) => tcx.mk_unit(), }; debug!("ty_of_fn: output_ty={:?}", output_ty); diff --git a/src/librustc_typeck/check/closure.rs b/src/librustc_typeck/check/closure.rs index 8bff95cd4974..89b82ca3e54a 100644 --- a/src/librustc_typeck/check/closure.rs +++ b/src/librustc_typeck/check/closure.rs @@ -548,8 +548,8 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { // First, convert the types that the user supplied (if any). let supplied_arguments = decl.inputs.iter().map(|a| astconv.ast_ty_to_ty(a)); let supplied_return = match decl.output { - hir::Return(ref output) => astconv.ast_ty_to_ty(&output), - hir::DefaultReturn(_) => match body.generator_kind { + hir::FunctionRetTy::Return(ref output) => astconv.ast_ty_to_ty(&output), + hir::FunctionRetTy::DefaultReturn(_) => match body.generator_kind { // In the case of the async block that we create for a function body, // we expect the return type of the block to match that of the enclosing // function. @@ -696,7 +696,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { self.tcx.types.err }); - if let hir::Return(ref output) = decl.output { + if let hir::FunctionRetTy::Return(ref output) = decl.output { astconv.ast_ty_to_ty(&output); } diff --git a/src/librustc_typeck/check/expr.rs b/src/librustc_typeck/check/expr.rs index 743a2c6b5439..753f9b9c9349 100644 --- a/src/librustc_typeck/check/expr.rs +++ b/src/librustc_typeck/check/expr.rs @@ -306,11 +306,11 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { ) -> Ty<'tcx> { let tcx = self.tcx; let expected_inner = match unop { - hir::UnNot | hir::UnNeg => expected, - hir::UnDeref => NoExpectation, + hir::UnOp::UnNot | hir::UnOp::UnNeg => expected, + hir::UnOp::UnDeref => NoExpectation, }; let needs = match unop { - hir::UnDeref => needs, + hir::UnOp::UnDeref => needs, _ => Needs::None, }; let mut oprnd_t = self.check_expr_with_expectation_and_needs(&oprnd, expected_inner, needs); @@ -318,7 +318,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { if !oprnd_t.references_error() { oprnd_t = self.structurally_resolved_type(expr.span, oprnd_t); match unop { - hir::UnDeref => { + hir::UnOp::UnDeref => { if let Some(mt) = oprnd_t.builtin_deref(true) { oprnd_t = mt.ty; } else if let Some(ok) = self.try_overloaded_deref(expr.span, oprnd_t, needs) { @@ -362,14 +362,14 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { oprnd_t = tcx.types.err; } } - hir::UnNot => { + hir::UnOp::UnNot => { let result = self.check_user_unop(expr, oprnd_t, unop); // If it's builtin, we can reuse the type, this helps inference. if !(oprnd_t.is_integral() || oprnd_t.kind == ty::Bool) { oprnd_t = result; } } - hir::UnNeg => { + hir::UnOp::UnNeg => { let result = self.check_user_unop(expr, oprnd_t, unop); // If it's builtin, we can reuse the type, this helps inference. if !oprnd_t.is_numeric() { diff --git a/src/librustc_typeck/check/method/confirm.rs b/src/librustc_typeck/check/method/confirm.rs index 0f4d7e24df02..43a27ec3f339 100644 --- a/src/librustc_typeck/check/method/confirm.rs +++ b/src/librustc_typeck/check/method/confirm.rs @@ -425,7 +425,7 @@ impl<'a, 'tcx> ConfirmContext<'a, 'tcx> { match exprs.last().unwrap().kind { hir::ExprKind::Field(ref expr, _) | hir::ExprKind::Index(ref expr, _) - | hir::ExprKind::Unary(hir::UnDeref, ref expr) => exprs.push(&expr), + | hir::ExprKind::Unary(hir::UnOp::UnDeref, ref expr) => exprs.push(&expr), _ => break, } } @@ -471,7 +471,7 @@ impl<'a, 'tcx> ConfirmContext<'a, 'tcx> { &[index_expr_ty], ); } - hir::ExprKind::Unary(hir::UnDeref, ref base_expr) => { + hir::ExprKind::Unary(hir::UnOp::UnDeref, ref base_expr) => { self.convert_place_op_to_mutable(PlaceOp::Deref, expr, base_expr, &[]); } _ => {} diff --git a/src/librustc_typeck/check/mod.rs b/src/librustc_typeck/check/mod.rs index 312208626cf2..85c349542549 100644 --- a/src/librustc_typeck/check/mod.rs +++ b/src/librustc_typeck/check/mod.rs @@ -390,6 +390,7 @@ impl UnsafetyState { } pub fn recurse(&mut self, blk: &hir::Block<'_>) -> UnsafetyState { + use hir::BlockCheckMode; match self.unsafety { // If this unsafe, then if the outer function was already marked as // unsafe we shouldn't attribute the unsafe'ness to the block. This @@ -399,16 +400,16 @@ impl UnsafetyState { unsafety => { let (unsafety, def, count) = match blk.rules { - hir::PushUnsafeBlock(..) => { + BlockCheckMode::PushUnsafeBlock(..) => { (unsafety, blk.hir_id, self.unsafe_push_count.checked_add(1).unwrap()) } - hir::PopUnsafeBlock(..) => { + BlockCheckMode::PopUnsafeBlock(..) => { (unsafety, blk.hir_id, self.unsafe_push_count.checked_sub(1).unwrap()) } - hir::UnsafeBlock(..) => { + BlockCheckMode::UnsafeBlock(..) => { (hir::Unsafety::Unsafe, blk.hir_id, self.unsafe_push_count) } - hir::DefaultBlock => (unsafety, self.def, self.unsafe_push_count), + BlockCheckMode::DefaultBlock => (unsafety, self.def, self.unsafe_push_count), }; UnsafetyState { def, unsafety, unsafe_push_count: count, from_fn: false } } diff --git a/src/librustc_typeck/check/op.rs b/src/librustc_typeck/check/op.rs index e0035c4afc7c..35e4e3849543 100644 --- a/src/librustc_typeck/check/op.rs +++ b/src/librustc_typeck/check/op.rs @@ -689,16 +689,16 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { ), ); match actual.kind { - Uint(_) if op == hir::UnNeg => { + Uint(_) if op == hir::UnOp::UnNeg => { err.note("unsigned values cannot be negated"); } Str | Never | Char | Tuple(_) | Array(_, _) => {} Ref(_, ref lty, _) if lty.kind == Str => {} _ => { let missing_trait = match op { - hir::UnNeg => "std::ops::Neg", - hir::UnNot => "std::ops::Not", - hir::UnDeref => "std::ops::UnDerf", + hir::UnOp::UnNeg => "std::ops::Neg", + hir::UnOp::UnNot => "std::ops::Not", + hir::UnOp::UnDeref => "std::ops::UnDerf", }; err.note(&format!( "an implementation of `{}` might \ @@ -771,9 +771,9 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { span_bug!(span, "&& and || are not overloadable") } } - } else if let Op::Unary(hir::UnNot, _) = op { + } else if let Op::Unary(hir::UnOp::UnNot, _) = op { ("not", lang.not_trait()) - } else if let Op::Unary(hir::UnNeg, _) = op { + } else if let Op::Unary(hir::UnOp::UnNeg, _) = op { ("neg", lang.neg_trait()) } else { bug!("lookup_op_method: op not supported: {:?}", op) diff --git a/src/librustc_typeck/check/regionck.rs b/src/librustc_typeck/check/regionck.rs index 90d8d0623a75..367c455fe493 100644 --- a/src/librustc_typeck/check/regionck.rs +++ b/src/librustc_typeck/check/regionck.rs @@ -492,7 +492,7 @@ impl<'a, 'tcx> Visitor<'tcx> for RegionCtxt<'a, 'tcx> { if is_method_call { let origin = match expr.kind { hir::ExprKind::MethodCall(..) => infer::ParameterOrigin::MethodCall, - hir::ExprKind::Unary(op, _) if op == hir::UnDeref => { + hir::ExprKind::Unary(op, _) if op == hir::UnOp::UnDeref => { infer::ParameterOrigin::OverloadedDeref } _ => infer::ParameterOrigin::OverloadedOperator, @@ -577,7 +577,7 @@ impl<'a, 'tcx> Visitor<'tcx> for RegionCtxt<'a, 'tcx> { intravisit::walk_expr(self, expr); } - hir::ExprKind::Unary(hir::UnDeref, ref base) => { + hir::ExprKind::Unary(hir::UnOp::UnDeref, ref base) => { // For *a, the lifetime of a must enclose the deref if is_method_call { self.constrain_call(expr, Some(base), None::>.iter()); diff --git a/src/librustc_typeck/check/writeback.rs b/src/librustc_typeck/check/writeback.rs index 0fbc14a71737..51cee12cfdd0 100644 --- a/src/librustc_typeck/check/writeback.rs +++ b/src/librustc_typeck/check/writeback.rs @@ -133,8 +133,8 @@ impl<'cx, 'tcx> WritebackCx<'cx, 'tcx> { // operating on scalars, we clear the overload. fn fix_scalar_builtin_expr(&mut self, e: &hir::Expr<'_>) { match e.kind { - hir::ExprKind::Unary(hir::UnNeg, ref inner) - | hir::ExprKind::Unary(hir::UnNot, ref inner) => { + hir::ExprKind::Unary(hir::UnOp::UnNeg, ref inner) + | hir::ExprKind::Unary(hir::UnOp::UnNot, ref inner) => { let inner_ty = self.fcx.node_ty(inner.hir_id); let inner_ty = self.fcx.resolve_vars_if_possible(&inner_ty); diff --git a/src/librustc_typeck/collect.rs b/src/librustc_typeck/collect.rs index bc39856e14d7..fb2e04191ee1 100644 --- a/src/librustc_typeck/collect.rs +++ b/src/librustc_typeck/collect.rs @@ -2499,7 +2499,7 @@ fn compute_sig_of_foreign_fn_decl<'tcx>( for (input, ty) in decl.inputs.iter().zip(*fty.inputs().skip_binder()) { check(&input, ty) } - if let hir::Return(ref ty) = decl.output { + if let hir::FunctionRetTy::Return(ref ty) = decl.output { check(&ty, *fty.output().skip_binder()) } } diff --git a/src/librustc_typeck/expr_use_visitor.rs b/src/librustc_typeck/expr_use_visitor.rs index 030b8a621494..0c631d69f474 100644 --- a/src/librustc_typeck/expr_use_visitor.rs +++ b/src/librustc_typeck/expr_use_visitor.rs @@ -192,7 +192,7 @@ impl<'a, 'tcx> ExprUseVisitor<'a, 'tcx> { hir::ExprKind::Type(ref subexpr, _) => self.walk_expr(subexpr), - hir::ExprKind::Unary(hir::UnDeref, ref base) => { + hir::ExprKind::Unary(hir::UnOp::UnDeref, ref base) => { // *base self.select_from_expr(base); } diff --git a/src/librustc_typeck/mem_categorization.rs b/src/librustc_typeck/mem_categorization.rs index 4c5e7c81b27f..3e003f00f6ea 100644 --- a/src/librustc_typeck/mem_categorization.rs +++ b/src/librustc_typeck/mem_categorization.rs @@ -347,7 +347,7 @@ impl<'a, 'tcx> MemCategorizationContext<'a, 'tcx> { let expr_ty = self.expr_ty(expr)?; match expr.kind { - hir::ExprKind::Unary(hir::UnDeref, ref e_base) => { + hir::ExprKind::Unary(hir::UnOp::UnDeref, ref e_base) => { if self.tables.is_method_call(expr) { self.cat_overloaded_place(expr, e_base) } else { diff --git a/src/librustdoc/clean/mod.rs b/src/librustdoc/clean/mod.rs index fad2bab43b99..f6ccc79ba582 100644 --- a/src/librustdoc/clean/mod.rs +++ b/src/librustdoc/clean/mod.rs @@ -1003,8 +1003,8 @@ impl<'tcx> Clean for (DefId, ty::PolyFnSig<'tcx>) { impl Clean for hir::FunctionRetTy<'_> { fn clean(&self, cx: &DocContext<'_>) -> FunctionRetTy { match *self { - hir::Return(ref typ) => Return(typ.clean(cx)), - hir::DefaultReturn(..) => DefaultReturn, + Self::Return(ref typ) => Return(typ.clean(cx)), + Self::DefaultReturn(..) => DefaultReturn, } } } diff --git a/src/librustdoc/clean/utils.rs b/src/librustdoc/clean/utils.rs index d17b3ce0b1bc..d50084322ea6 100644 --- a/src/librustdoc/clean/utils.rs +++ b/src/librustdoc/clean/utils.rs @@ -567,12 +567,12 @@ pub fn resolve_type(cx: &DocContext<'_>, path: Path, id: hir::HirId) -> Type { let is_generic = match path.res { Res::PrimTy(p) => match p { - hir::Str => return Primitive(PrimitiveType::Str), - hir::Bool => return Primitive(PrimitiveType::Bool), - hir::Char => return Primitive(PrimitiveType::Char), - hir::Int(int_ty) => return Primitive(int_ty.into()), - hir::Uint(uint_ty) => return Primitive(uint_ty.into()), - hir::Float(float_ty) => return Primitive(float_ty.into()), + hir::PrimTy::Str => return Primitive(PrimitiveType::Str), + hir::PrimTy::Bool => return Primitive(PrimitiveType::Bool), + hir::PrimTy::Char => return Primitive(PrimitiveType::Char), + hir::PrimTy::Int(int_ty) => return Primitive(int_ty.into()), + hir::PrimTy::Uint(uint_ty) => return Primitive(uint_ty.into()), + hir::PrimTy::Float(float_ty) => return Primitive(float_ty.into()), }, Res::SelfTy(..) if path.segments.len() == 1 => { return Generic(kw::SelfUpper.to_string());