Rename Ty.node
to Ty.kind
This commit is contained in:
parent
d4573c9c1e
commit
c3d8791373
50 changed files with 138 additions and 137 deletions
|
@ -594,7 +594,7 @@ pub fn walk_variant<'v, V: Visitor<'v>>(visitor: &mut V,
|
||||||
pub fn walk_ty<'v, V: Visitor<'v>>(visitor: &mut V, typ: &'v Ty) {
|
pub fn walk_ty<'v, V: Visitor<'v>>(visitor: &mut V, typ: &'v Ty) {
|
||||||
visitor.visit_id(typ.hir_id);
|
visitor.visit_id(typ.hir_id);
|
||||||
|
|
||||||
match typ.node {
|
match typ.kind {
|
||||||
TyKind::Slice(ref ty) => {
|
TyKind::Slice(ref ty) => {
|
||||||
visitor.visit_ty(ty)
|
visitor.visit_ty(ty)
|
||||||
}
|
}
|
||||||
|
|
|
@ -346,7 +346,7 @@ struct ImplTraitTypeIdVisitor<'a> { ids: &'a mut SmallVec<[NodeId; 1]> }
|
||||||
|
|
||||||
impl<'a, 'b> Visitor<'a> for ImplTraitTypeIdVisitor<'b> {
|
impl<'a, 'b> Visitor<'a> for ImplTraitTypeIdVisitor<'b> {
|
||||||
fn visit_ty(&mut self, ty: &'a Ty) {
|
fn visit_ty(&mut self, ty: &'a Ty) {
|
||||||
match ty.node {
|
match ty.kind {
|
||||||
| TyKind::Typeof(_)
|
| TyKind::Typeof(_)
|
||||||
| TyKind::BareFn(_)
|
| TyKind::BareFn(_)
|
||||||
=> return,
|
=> return,
|
||||||
|
@ -497,7 +497,7 @@ impl<'a> LoweringContext<'a> {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn visit_ty(&mut self, t: &'tcx Ty) {
|
fn visit_ty(&mut self, t: &'tcx Ty) {
|
||||||
match t.node {
|
match t.kind {
|
||||||
// Mirrors the case in visit::walk_ty
|
// Mirrors the case in visit::walk_ty
|
||||||
TyKind::BareFn(ref f) => {
|
TyKind::BareFn(ref f) => {
|
||||||
walk_list!(
|
walk_list!(
|
||||||
|
@ -1104,7 +1104,7 @@ impl<'a> LoweringContext<'a> {
|
||||||
let ty = this.lower_ty(
|
let ty = this.lower_ty(
|
||||||
&Ty {
|
&Ty {
|
||||||
id: this.sess.next_node_id(),
|
id: this.sess.next_node_id(),
|
||||||
node: TyKind::ImplTrait(impl_trait_node_id, bounds.clone()),
|
kind: TyKind::ImplTrait(impl_trait_node_id, bounds.clone()),
|
||||||
span: constraint.span,
|
span: constraint.span,
|
||||||
},
|
},
|
||||||
itctx,
|
itctx,
|
||||||
|
@ -1165,14 +1165,14 @@ impl<'a> LoweringContext<'a> {
|
||||||
let id = self.lower_node_id(t.id);
|
let id = self.lower_node_id(t.id);
|
||||||
let qpath = self.lower_qpath(t.id, qself, path, param_mode, itctx);
|
let qpath = self.lower_qpath(t.id, qself, path, param_mode, itctx);
|
||||||
let ty = self.ty_path(id, t.span, qpath);
|
let ty = self.ty_path(id, t.span, qpath);
|
||||||
if let hir::TyKind::TraitObject(..) = ty.node {
|
if let hir::TyKind::TraitObject(..) = ty.kind {
|
||||||
self.maybe_lint_bare_trait(t.span, t.id, qself.is_none() && path.is_global());
|
self.maybe_lint_bare_trait(t.span, t.id, qself.is_none() && path.is_global());
|
||||||
}
|
}
|
||||||
ty
|
ty
|
||||||
}
|
}
|
||||||
|
|
||||||
fn lower_ty_direct(&mut self, t: &Ty, mut itctx: ImplTraitContext<'_>) -> hir::Ty {
|
fn lower_ty_direct(&mut self, t: &Ty, mut itctx: ImplTraitContext<'_>) -> hir::Ty {
|
||||||
let kind = match t.node {
|
let kind = match t.kind {
|
||||||
TyKind::Infer => hir::TyKind::Infer,
|
TyKind::Infer => hir::TyKind::Infer,
|
||||||
TyKind::Err => hir::TyKind::Err,
|
TyKind::Err => hir::TyKind::Err,
|
||||||
TyKind::Slice(ref ty) => hir::TyKind::Slice(self.lower_ty(ty, itctx)),
|
TyKind::Slice(ref ty) => hir::TyKind::Slice(self.lower_ty(ty, itctx)),
|
||||||
|
@ -1345,7 +1345,7 @@ impl<'a> LoweringContext<'a> {
|
||||||
};
|
};
|
||||||
|
|
||||||
hir::Ty {
|
hir::Ty {
|
||||||
node: kind,
|
kind,
|
||||||
span: t.span,
|
span: t.span,
|
||||||
hir_id: self.lower_node_id(t.id),
|
hir_id: self.lower_node_id(t.id),
|
||||||
}
|
}
|
||||||
|
@ -1505,7 +1505,7 @@ impl<'a> LoweringContext<'a> {
|
||||||
|
|
||||||
fn visit_ty(&mut self, t: &'v hir::Ty) {
|
fn visit_ty(&mut self, t: &'v hir::Ty) {
|
||||||
// Don't collect elided lifetimes used inside of `fn()` syntax.
|
// Don't collect elided lifetimes used inside of `fn()` syntax.
|
||||||
if let hir::TyKind::BareFn(_) = t.node {
|
if let hir::TyKind::BareFn(_) = t.kind {
|
||||||
let old_collect_elided_lifetimes = self.collect_elided_lifetimes;
|
let old_collect_elided_lifetimes = self.collect_elided_lifetimes;
|
||||||
self.collect_elided_lifetimes = false;
|
self.collect_elided_lifetimes = false;
|
||||||
|
|
||||||
|
@ -2026,7 +2026,7 @@ impl<'a> LoweringContext<'a> {
|
||||||
.map(|ty| this.lower_ty_direct(ty, ImplTraitContext::disallowed()))
|
.map(|ty| this.lower_ty_direct(ty, ImplTraitContext::disallowed()))
|
||||||
.collect();
|
.collect();
|
||||||
let mk_tup = |this: &mut Self, tys, span| {
|
let mk_tup = |this: &mut Self, tys, span| {
|
||||||
hir::Ty { node: hir::TyKind::Tup(tys), hir_id: this.next_id(), span }
|
hir::Ty { kind: hir::TyKind::Tup(tys), hir_id: this.next_id(), span }
|
||||||
};
|
};
|
||||||
(
|
(
|
||||||
hir::GenericArgs {
|
hir::GenericArgs {
|
||||||
|
@ -2179,16 +2179,16 @@ impl<'a> LoweringContext<'a> {
|
||||||
_ => false,
|
_ => false,
|
||||||
};
|
};
|
||||||
|
|
||||||
match arg.ty.node {
|
match arg.ty.kind {
|
||||||
TyKind::ImplicitSelf if is_mutable_pat => hir::ImplicitSelfKind::Mut,
|
TyKind::ImplicitSelf if is_mutable_pat => hir::ImplicitSelfKind::Mut,
|
||||||
TyKind::ImplicitSelf => hir::ImplicitSelfKind::Imm,
|
TyKind::ImplicitSelf => hir::ImplicitSelfKind::Imm,
|
||||||
// Given we are only considering `ImplicitSelf` types, we needn't consider
|
// Given we are only considering `ImplicitSelf` types, we needn't consider
|
||||||
// the case where we have a mutable pattern to a reference as that would
|
// the case where we have a mutable pattern to a reference as that would
|
||||||
// no longer be an `ImplicitSelf`.
|
// no longer be an `ImplicitSelf`.
|
||||||
TyKind::Rptr(_, ref mt) if mt.ty.node.is_implicit_self() &&
|
TyKind::Rptr(_, ref mt) if mt.ty.kind.is_implicit_self() &&
|
||||||
mt.mutbl == ast::Mutability::Mutable =>
|
mt.mutbl == ast::Mutability::Mutable =>
|
||||||
hir::ImplicitSelfKind::MutRef,
|
hir::ImplicitSelfKind::MutRef,
|
||||||
TyKind::Rptr(_, ref mt) if mt.ty.node.is_implicit_self() =>
|
TyKind::Rptr(_, ref mt) if mt.ty.kind.is_implicit_self() =>
|
||||||
hir::ImplicitSelfKind::ImmRef,
|
hir::ImplicitSelfKind::ImmRef,
|
||||||
_ => hir::ImplicitSelfKind::None,
|
_ => hir::ImplicitSelfKind::None,
|
||||||
}
|
}
|
||||||
|
@ -2403,7 +2403,7 @@ impl<'a> LoweringContext<'a> {
|
||||||
let opaque_ty_ref = hir::TyKind::Def(hir::ItemId { id: opaque_ty_id }, generic_args.into());
|
let opaque_ty_ref = hir::TyKind::Def(hir::ItemId { id: opaque_ty_id }, generic_args.into());
|
||||||
|
|
||||||
hir::FunctionRetTy::Return(P(hir::Ty {
|
hir::FunctionRetTy::Return(P(hir::Ty {
|
||||||
node: opaque_ty_ref,
|
kind: opaque_ty_ref,
|
||||||
span,
|
span,
|
||||||
hir_id: self.next_id(),
|
hir_id: self.next_id(),
|
||||||
}))
|
}))
|
||||||
|
@ -2424,7 +2424,7 @@ impl<'a> LoweringContext<'a> {
|
||||||
FunctionRetTy::Default(ret_ty_span) => {
|
FunctionRetTy::Default(ret_ty_span) => {
|
||||||
P(hir::Ty {
|
P(hir::Ty {
|
||||||
hir_id: self.next_id(),
|
hir_id: self.next_id(),
|
||||||
node: hir::TyKind::Tup(hir_vec![]),
|
kind: hir::TyKind::Tup(hir_vec![]),
|
||||||
span: *ret_ty_span,
|
span: *ret_ty_span,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
@ -3164,7 +3164,7 @@ impl<'a> LoweringContext<'a> {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn ty_path(&mut self, mut hir_id: hir::HirId, span: Span, qpath: hir::QPath) -> hir::Ty {
|
fn ty_path(&mut self, mut hir_id: hir::HirId, span: Span, qpath: hir::QPath) -> hir::Ty {
|
||||||
let node = match qpath {
|
let kind = match qpath {
|
||||||
hir::QPath::Resolved(None, path) => {
|
hir::QPath::Resolved(None, path) => {
|
||||||
// Turn trait object paths into `TyKind::TraitObject` instead.
|
// Turn trait object paths into `TyKind::TraitObject` instead.
|
||||||
match path.res {
|
match path.res {
|
||||||
|
@ -3188,9 +3188,10 @@ impl<'a> LoweringContext<'a> {
|
||||||
}
|
}
|
||||||
_ => hir::TyKind::Path(qpath),
|
_ => hir::TyKind::Path(qpath),
|
||||||
};
|
};
|
||||||
|
|
||||||
hir::Ty {
|
hir::Ty {
|
||||||
hir_id,
|
hir_id,
|
||||||
node,
|
kind,
|
||||||
span,
|
span,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3394,7 +3395,7 @@ pub fn is_range_literal(sess: &Session, expr: &hir::Expr) -> bool {
|
||||||
// `..=` desugars into `::std::ops::RangeInclusive::new(...)`.
|
// `..=` desugars into `::std::ops::RangeInclusive::new(...)`.
|
||||||
ExprKind::Call(ref func, _) => {
|
ExprKind::Call(ref func, _) => {
|
||||||
if let ExprKind::Path(QPath::TypeRelative(ref ty, ref segment)) = func.kind {
|
if let ExprKind::Path(QPath::TypeRelative(ref ty, ref segment)) = func.kind {
|
||||||
if let TyKind::Path(QPath::Resolved(None, ref path)) = ty.node {
|
if let TyKind::Path(QPath::Resolved(None, ref path)) = ty.kind {
|
||||||
let new_call = segment.ident.as_str() == "new";
|
let new_call = segment.ident.as_str() == "new";
|
||||||
return is_range_path(&path) && is_lit(sess, &expr.span) && new_call;
|
return is_range_path(&path) && is_lit(sess, &expr.span) && new_call;
|
||||||
}
|
}
|
||||||
|
|
|
@ -789,7 +789,7 @@ impl LoweringContext<'_> {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn lower_struct_field(&mut self, (index, f): (usize, &StructField)) -> hir::StructField {
|
fn lower_struct_field(&mut self, (index, f): (usize, &StructField)) -> hir::StructField {
|
||||||
let ty = if let TyKind::Path(ref qself, ref path) = f.ty.node {
|
let ty = if let TyKind::Path(ref qself, ref path) = f.ty.kind {
|
||||||
let t = self.lower_path_ty(
|
let t = self.lower_path_ty(
|
||||||
&f.ty,
|
&f.ty,
|
||||||
qself,
|
qself,
|
||||||
|
@ -1343,7 +1343,7 @@ impl LoweringContext<'_> {
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
// Check if the where clause type is a plain type parameter.
|
// Check if the where clause type is a plain type parameter.
|
||||||
match bound_pred.bounded_ty.node {
|
match bound_pred.bounded_ty.kind {
|
||||||
TyKind::Path(None, ref path)
|
TyKind::Path(None, ref path)
|
||||||
if path.segments.len() == 1
|
if path.segments.len() == 1
|
||||||
&& bound_pred.bound_generic_params.is_empty() =>
|
&& bound_pred.bound_generic_params.is_empty() =>
|
||||||
|
|
|
@ -292,7 +292,7 @@ impl<'a> visit::Visitor<'a> for DefCollector<'a> {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn visit_ty(&mut self, ty: &'a Ty) {
|
fn visit_ty(&mut self, ty: &'a Ty) {
|
||||||
match ty.node {
|
match ty.kind {
|
||||||
TyKind::Mac(..) => return self.visit_macro_invoc(ty.id),
|
TyKind::Mac(..) => return self.visit_macro_invoc(ty.id),
|
||||||
TyKind::ImplTrait(node_id, _) => {
|
TyKind::ImplTrait(node_id, _) => {
|
||||||
self.create_def(node_id, DefPathData::ImplTrait, ty.span);
|
self.create_def(node_id, DefPathData::ImplTrait, ty.span);
|
||||||
|
|
|
@ -479,7 +479,7 @@ impl GenericArgs {
|
||||||
match arg {
|
match arg {
|
||||||
GenericArg::Lifetime(_) => {}
|
GenericArg::Lifetime(_) => {}
|
||||||
GenericArg::Type(ref ty) => {
|
GenericArg::Type(ref ty) => {
|
||||||
if let TyKind::Tup(ref tys) = ty.node {
|
if let TyKind::Tup(ref tys) = ty.kind {
|
||||||
return tys;
|
return tys;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -1939,7 +1939,7 @@ impl TypeBinding {
|
||||||
#[derive(RustcEncodable, RustcDecodable)]
|
#[derive(RustcEncodable, RustcDecodable)]
|
||||||
pub struct Ty {
|
pub struct Ty {
|
||||||
pub hir_id: HirId,
|
pub hir_id: HirId,
|
||||||
pub node: TyKind,
|
pub kind: TyKind,
|
||||||
pub span: Span,
|
pub span: Span,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -286,7 +286,7 @@ impl<'a> State<'a> {
|
||||||
pub fn print_type(&mut self, ty: &hir::Ty) {
|
pub fn print_type(&mut self, ty: &hir::Ty) {
|
||||||
self.maybe_print_comment(ty.span.lo());
|
self.maybe_print_comment(ty.span.lo());
|
||||||
self.ibox(0);
|
self.ibox(0);
|
||||||
match ty.node {
|
match ty.kind {
|
||||||
hir::TyKind::Slice(ref ty) => {
|
hir::TyKind::Slice(ref ty) => {
|
||||||
self.s.word("[");
|
self.s.word("[");
|
||||||
self.print_type(&ty);
|
self.print_type(&ty);
|
||||||
|
@ -1880,7 +1880,7 @@ impl<'a> State<'a> {
|
||||||
s.ann.nested(s, Nested::BodyParamPat(body_id, i));
|
s.ann.nested(s, Nested::BodyParamPat(body_id, i));
|
||||||
i += 1;
|
i += 1;
|
||||||
|
|
||||||
if let hir::TyKind::Infer = ty.node {
|
if let hir::TyKind::Infer = ty.kind {
|
||||||
// Print nothing.
|
// Print nothing.
|
||||||
} else {
|
} else {
|
||||||
s.s.word(":");
|
s.s.word(":");
|
||||||
|
|
|
@ -144,11 +144,11 @@ impl<'a> HashStable<StableHashingContext<'a>> for hir::Ty {
|
||||||
hcx.while_hashing_hir_bodies(true, |hcx| {
|
hcx.while_hashing_hir_bodies(true, |hcx| {
|
||||||
let hir::Ty {
|
let hir::Ty {
|
||||||
hir_id: _,
|
hir_id: _,
|
||||||
ref node,
|
ref kind,
|
||||||
ref span,
|
ref span,
|
||||||
} = *self;
|
} = *self;
|
||||||
|
|
||||||
node.hash_stable(hcx, hasher);
|
kind.hash_stable(hcx, hasher);
|
||||||
span.hash_stable(hcx, hasher);
|
span.hash_stable(hcx, hasher);
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
|
@ -98,7 +98,7 @@ impl Visitor<'tcx> for FindNestedTypeVisitor<'tcx> {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn visit_ty(&mut self, arg: &'tcx hir::Ty) {
|
fn visit_ty(&mut self, arg: &'tcx hir::Ty) {
|
||||||
match arg.node {
|
match arg.kind {
|
||||||
hir::TyKind::BareFn(_) => {
|
hir::TyKind::BareFn(_) => {
|
||||||
self.current_index.shift_in(1);
|
self.current_index.shift_in(1);
|
||||||
intravisit::walk_ty(self, arg);
|
intravisit::walk_ty(self, arg);
|
||||||
|
|
|
@ -87,7 +87,7 @@ impl<'a, 'tcx> NiceRegionError<'a, 'tcx> {
|
||||||
return None;
|
return None;
|
||||||
}
|
}
|
||||||
if let FunctionRetTy::Return(ty) = &fndecl.output {
|
if let FunctionRetTy::Return(ty) = &fndecl.output {
|
||||||
if let (TyKind::Def(_, _), ty::ReStatic) = (&ty.node, sub) {
|
if let (TyKind::Def(_, _), ty::ReStatic) = (&ty.kind, sub) {
|
||||||
// This is an impl Trait return that evaluates de need of 'static.
|
// This is an impl Trait return that evaluates de need of 'static.
|
||||||
// We handle this case better in `static_impl_trait`.
|
// We handle this case better in `static_impl_trait`.
|
||||||
return None;
|
return None;
|
||||||
|
|
|
@ -94,7 +94,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for TyTyKind {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn check_ty(&mut self, cx: &LateContext<'_, '_>, ty: &'tcx Ty) {
|
fn check_ty(&mut self, cx: &LateContext<'_, '_>, ty: &'tcx Ty) {
|
||||||
match &ty.node {
|
match &ty.kind {
|
||||||
TyKind::Path(qpath) => {
|
TyKind::Path(qpath) => {
|
||||||
if let QPath::Resolved(_, path) = qpath {
|
if let QPath::Resolved(_, path) = qpath {
|
||||||
if let Some(last) = path.segments.iter().last() {
|
if let Some(last) = path.segments.iter().last() {
|
||||||
|
@ -169,7 +169,7 @@ fn lint_ty_kind_usage(cx: &LateContext<'_, '_>, segment: &PathSegment) -> bool {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn is_ty_or_ty_ctxt(cx: &LateContext<'_, '_>, ty: &Ty) -> Option<String> {
|
fn is_ty_or_ty_ctxt(cx: &LateContext<'_, '_>, ty: &Ty) -> Option<String> {
|
||||||
match &ty.node {
|
match &ty.kind {
|
||||||
TyKind::Path(qpath) => {
|
TyKind::Path(qpath) => {
|
||||||
if let QPath::Resolved(_, path) = qpath {
|
if let QPath::Resolved(_, path) = qpath {
|
||||||
let did = path.res.opt_def_id()?;
|
let did = path.res.opt_def_id()?;
|
||||||
|
|
|
@ -292,7 +292,7 @@ impl<'a, 'tcx> Visitor<'tcx> for MarkSymbolVisitor<'a, 'tcx> {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn visit_ty(&mut self, ty: &'tcx hir::Ty) {
|
fn visit_ty(&mut self, ty: &'tcx hir::Ty) {
|
||||||
match ty.node {
|
match ty.kind {
|
||||||
TyKind::Def(item_id, _) => {
|
TyKind::Def(item_id, _) => {
|
||||||
let item = self.tcx.hir().expect_item(item_id.id);
|
let item = self.tcx.hir().expect_item(item_id.id);
|
||||||
intravisit::walk_item(self, item);
|
intravisit::walk_item(self, item);
|
||||||
|
|
|
@ -558,8 +558,8 @@ impl<'a, 'tcx> Visitor<'tcx> for LifetimeContext<'a, 'tcx> {
|
||||||
|
|
||||||
fn visit_ty(&mut self, ty: &'tcx hir::Ty) {
|
fn visit_ty(&mut self, ty: &'tcx hir::Ty) {
|
||||||
debug!("visit_ty: id={:?} ty={:?}", ty.hir_id, ty);
|
debug!("visit_ty: id={:?} ty={:?}", ty.hir_id, ty);
|
||||||
debug!("visit_ty: ty.node={:?}", ty.node);
|
debug!("visit_ty: ty.kind={:?}", ty.kind);
|
||||||
match ty.node {
|
match ty.kind {
|
||||||
hir::TyKind::BareFn(ref c) => {
|
hir::TyKind::BareFn(ref c) => {
|
||||||
let next_early_index = self.next_early_index();
|
let next_early_index = self.next_early_index();
|
||||||
let was_in_fn_syntax = self.is_in_fn_syntax;
|
let was_in_fn_syntax = self.is_in_fn_syntax;
|
||||||
|
@ -1352,7 +1352,7 @@ fn object_lifetime_defaults_for_item(
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
let res = match data.bounded_ty.node {
|
let res = match data.bounded_ty.kind {
|
||||||
hir::TyKind::Path(hir::QPath::Resolved(None, ref path)) => path.res,
|
hir::TyKind::Path(hir::QPath::Resolved(None, ref path)) => path.res,
|
||||||
_ => continue,
|
_ => continue,
|
||||||
};
|
};
|
||||||
|
@ -1487,7 +1487,7 @@ impl<'a, 'tcx> LifetimeContext<'a, 'tcx> {
|
||||||
let mut elide_use = None;
|
let mut elide_use = None;
|
||||||
let mut find_arg_use_span = |inputs: &hir::HirVec<hir::Ty>| {
|
let mut find_arg_use_span = |inputs: &hir::HirVec<hir::Ty>| {
|
||||||
for input in inputs {
|
for input in inputs {
|
||||||
match input.node {
|
match input.kind {
|
||||||
hir::TyKind::Rptr(lt, _) => {
|
hir::TyKind::Rptr(lt, _) => {
|
||||||
if lt.name.ident() == name {
|
if lt.name.ident() == name {
|
||||||
// include the trailing whitespace between the lifetime and type names
|
// include the trailing whitespace between the lifetime and type names
|
||||||
|
@ -2270,8 +2270,8 @@ impl<'a, 'tcx> LifetimeContext<'a, 'tcx> {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn visit_ty(&mut self, ty: &'a hir::Ty) {
|
fn visit_ty(&mut self, ty: &'a hir::Ty) {
|
||||||
if let hir::TyKind::Rptr(lifetime_ref, ref mt) = ty.node {
|
if let hir::TyKind::Rptr(lifetime_ref, ref mt) = ty.kind {
|
||||||
if let hir::TyKind::Path(hir::QPath::Resolved(None, ref path)) = mt.ty.node
|
if let hir::TyKind::Path(hir::QPath::Resolved(None, ref path)) = mt.ty.kind
|
||||||
{
|
{
|
||||||
if self.is_self_ty(path.res) {
|
if self.is_self_ty(path.res) {
|
||||||
if let Some(lifetime) = self.map.defs.get(&lifetime_ref.hir_id) {
|
if let Some(lifetime) = self.map.defs.get(&lifetime_ref.hir_id) {
|
||||||
|
@ -2286,7 +2286,7 @@ impl<'a, 'tcx> LifetimeContext<'a, 'tcx> {
|
||||||
|
|
||||||
let mut visitor = SelfVisitor {
|
let mut visitor = SelfVisitor {
|
||||||
map: self.map,
|
map: self.map,
|
||||||
impl_self: impl_self.map(|ty| &ty.node),
|
impl_self: impl_self.map(|ty| &ty.kind),
|
||||||
lifetime: Set1::Empty,
|
lifetime: Set1::Empty,
|
||||||
};
|
};
|
||||||
visitor.visit_ty(&inputs[0]);
|
visitor.visit_ty(&inputs[0]);
|
||||||
|
@ -2364,10 +2364,10 @@ impl<'a, 'tcx> LifetimeContext<'a, 'tcx> {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn visit_ty(&mut self, ty: &hir::Ty) {
|
fn visit_ty(&mut self, ty: &hir::Ty) {
|
||||||
if let hir::TyKind::BareFn(_) = ty.node {
|
if let hir::TyKind::BareFn(_) = ty.kind {
|
||||||
self.outer_index.shift_in(1);
|
self.outer_index.shift_in(1);
|
||||||
}
|
}
|
||||||
match ty.node {
|
match ty.kind {
|
||||||
hir::TyKind::TraitObject(ref bounds, ref lifetime) => {
|
hir::TyKind::TraitObject(ref bounds, ref lifetime) => {
|
||||||
for bound in bounds {
|
for bound in bounds {
|
||||||
self.visit_poly_trait_ref(bound, hir::TraitBoundModifier::None);
|
self.visit_poly_trait_ref(bound, hir::TraitBoundModifier::None);
|
||||||
|
@ -2384,7 +2384,7 @@ impl<'a, 'tcx> LifetimeContext<'a, 'tcx> {
|
||||||
intravisit::walk_ty(self, ty);
|
intravisit::walk_ty(self, ty);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if let hir::TyKind::BareFn(_) = ty.node {
|
if let hir::TyKind::BareFn(_) = ty.kind {
|
||||||
self.outer_index.shift_out(1);
|
self.outer_index.shift_out(1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2991,7 +2991,7 @@ fn insert_late_bound_lifetimes(
|
||||||
}
|
}
|
||||||
|
|
||||||
fn visit_ty(&mut self, ty: &'v hir::Ty) {
|
fn visit_ty(&mut self, ty: &'v hir::Ty) {
|
||||||
match ty.node {
|
match ty.kind {
|
||||||
hir::TyKind::Path(hir::QPath::Resolved(Some(_), _))
|
hir::TyKind::Path(hir::QPath::Resolved(Some(_), _))
|
||||||
| hir::TyKind::Path(hir::QPath::TypeRelative(..)) => {
|
| hir::TyKind::Path(hir::QPath::TypeRelative(..)) => {
|
||||||
// ignore lifetimes appearing in associated type
|
// ignore lifetimes appearing in associated type
|
||||||
|
|
|
@ -1177,7 +1177,7 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
|
||||||
..
|
..
|
||||||
}) => {
|
}) => {
|
||||||
(self.tcx.sess.source_map().def_span(span), decl.inputs.iter()
|
(self.tcx.sess.source_map().def_span(span), decl.inputs.iter()
|
||||||
.map(|arg| match arg.clone().node {
|
.map(|arg| match arg.clone().kind {
|
||||||
hir::TyKind::Tup(ref tys) => ArgKind::Tuple(
|
hir::TyKind::Tup(ref tys) => ArgKind::Tuple(
|
||||||
Some(arg.span),
|
Some(arg.span),
|
||||||
vec![("_".to_owned(), "_".to_owned()); tys.len()]
|
vec![("_".to_owned(), "_".to_owned()); tys.len()]
|
||||||
|
|
|
@ -738,7 +738,7 @@ impl<'a> ReplaceBodyWithLoop<'a> {
|
||||||
fn should_ignore_fn(ret_ty: &ast::FnDecl) -> bool {
|
fn should_ignore_fn(ret_ty: &ast::FnDecl) -> bool {
|
||||||
if let ast::FunctionRetTy::Ty(ref ty) = ret_ty.output {
|
if let ast::FunctionRetTy::Ty(ref ty) = ret_ty.output {
|
||||||
fn involves_impl_trait(ty: &ast::Ty) -> bool {
|
fn involves_impl_trait(ty: &ast::Ty) -> bool {
|
||||||
match ty.node {
|
match ty.kind {
|
||||||
ast::TyKind::ImplTrait(..) => true,
|
ast::TyKind::ImplTrait(..) => true,
|
||||||
ast::TyKind::Slice(ref subty) |
|
ast::TyKind::Slice(ref subty) |
|
||||||
ast::TyKind::Array(ref subty, _) |
|
ast::TyKind::Array(ref subty, _) |
|
||||||
|
|
|
@ -1090,7 +1090,7 @@ impl TypeAliasBounds {
|
||||||
match *qpath {
|
match *qpath {
|
||||||
hir::QPath::TypeRelative(ref ty, _) => {
|
hir::QPath::TypeRelative(ref ty, _) => {
|
||||||
// If this is a type variable, we found a `T::Assoc`.
|
// If this is a type variable, we found a `T::Assoc`.
|
||||||
match ty.node {
|
match ty.kind {
|
||||||
hir::TyKind::Path(hir::QPath::Resolved(None, ref path)) => {
|
hir::TyKind::Path(hir::QPath::Resolved(None, ref path)) => {
|
||||||
match path.res {
|
match path.res {
|
||||||
Res::Def(DefKind::TyParam, _) => true,
|
Res::Def(DefKind::TyParam, _) => true,
|
||||||
|
@ -1750,7 +1750,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for ExplicitOutlivesRequirements {
|
||||||
hir::WherePredicate::BoundPredicate(predicate) => {
|
hir::WherePredicate::BoundPredicate(predicate) => {
|
||||||
// FIXME we can also infer bounds on associated types,
|
// FIXME we can also infer bounds on associated types,
|
||||||
// and should check for them here.
|
// and should check for them here.
|
||||||
match predicate.bounded_ty.node {
|
match predicate.bounded_ty.kind {
|
||||||
hir::TyKind::Path(hir::QPath::Resolved(
|
hir::TyKind::Path(hir::QPath::Resolved(
|
||||||
None,
|
None,
|
||||||
ref path,
|
ref path,
|
||||||
|
|
|
@ -1799,7 +1799,7 @@ impl EncodeContext<'tcx> {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn encode_info_for_ty(&mut self, ty: &hir::Ty) {
|
fn encode_info_for_ty(&mut self, ty: &hir::Ty) {
|
||||||
match ty.node {
|
match ty.kind {
|
||||||
hir::TyKind::Array(_, ref length) => {
|
hir::TyKind::Array(_, ref length) => {
|
||||||
let def_id = self.tcx.hir().local_def_id(length.hir_id);
|
let def_id = self.tcx.hir().local_def_id(length.hir_id);
|
||||||
self.record(def_id, EncodeContext::encode_info_for_anon_const, def_id);
|
self.record(def_id, EncodeContext::encode_info_for_anon_const, def_id);
|
||||||
|
|
|
@ -1845,7 +1845,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
|
||||||
// Need to use the `rustc::ty` types to compare against the
|
// Need to use the `rustc::ty` types to compare against the
|
||||||
// `return_region`. Then use the `rustc::hir` type to get only
|
// `return_region`. Then use the `rustc::hir` type to get only
|
||||||
// the lifetime span.
|
// the lifetime span.
|
||||||
if let hir::TyKind::Rptr(lifetime, _) = &fn_decl.inputs[index].node {
|
if let hir::TyKind::Rptr(lifetime, _) = &fn_decl.inputs[index].kind {
|
||||||
// With access to the lifetime, we can get
|
// With access to the lifetime, we can get
|
||||||
// the span of it.
|
// the span of it.
|
||||||
arguments.push((*argument, lifetime.span));
|
arguments.push((*argument, lifetime.span));
|
||||||
|
@ -1866,7 +1866,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
|
||||||
let return_ty = *sig.output().skip_binder();
|
let return_ty = *sig.output().skip_binder();
|
||||||
let mut return_span = fn_decl.output.span();
|
let mut return_span = fn_decl.output.span();
|
||||||
if let hir::FunctionRetTy::Return(ty) = &fn_decl.output {
|
if let hir::FunctionRetTy::Return(ty) = &fn_decl.output {
|
||||||
if let hir::TyKind::Rptr(lifetime, _) = ty.node {
|
if let hir::TyKind::Rptr(lifetime, _) = ty.kind {
|
||||||
return_span = lifetime.span;
|
return_span = lifetime.span;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -642,7 +642,7 @@ fn annotate_struct_field(
|
||||||
if let hir::TyKind::Rptr(lifetime, hir::MutTy {
|
if let hir::TyKind::Rptr(lifetime, hir::MutTy {
|
||||||
mutbl: hir::Mutability::MutImmutable,
|
mutbl: hir::Mutability::MutImmutable,
|
||||||
ref ty
|
ref ty
|
||||||
}) = field.ty.node {
|
}) = field.ty.kind {
|
||||||
// Get the snippets in two parts - the named lifetime (if there is one) and
|
// Get the snippets in two parts - the named lifetime (if there is one) and
|
||||||
// type being referenced, that way we can reconstruct the snippet without loss
|
// type being referenced, that way we can reconstruct the snippet without loss
|
||||||
// of detail.
|
// of detail.
|
||||||
|
|
|
@ -425,7 +425,7 @@ impl<'tcx> RegionInferenceContext<'tcx> {
|
||||||
let mir_hir_id = infcx.tcx.hir().as_local_hir_id(mir_def_id)?;
|
let mir_hir_id = infcx.tcx.hir().as_local_hir_id(mir_def_id)?;
|
||||||
let fn_decl = infcx.tcx.hir().fn_decl_by_hir_id(mir_hir_id)?;
|
let fn_decl = infcx.tcx.hir().fn_decl_by_hir_id(mir_hir_id)?;
|
||||||
let argument_hir_ty: &hir::Ty = &fn_decl.inputs[argument_index];
|
let argument_hir_ty: &hir::Ty = &fn_decl.inputs[argument_index];
|
||||||
match argument_hir_ty.node {
|
match argument_hir_ty.kind {
|
||||||
// This indicates a variable with no type annotation, like
|
// This indicates a variable with no type annotation, like
|
||||||
// `|x|`... in that case, we can't highlight the type but
|
// `|x|`... in that case, we can't highlight the type but
|
||||||
// must highlight the variable.
|
// must highlight the variable.
|
||||||
|
@ -527,7 +527,7 @@ impl<'tcx> RegionInferenceContext<'tcx> {
|
||||||
&mut vec![(argument_ty, argument_hir_ty)];
|
&mut vec![(argument_ty, argument_hir_ty)];
|
||||||
|
|
||||||
while let Some((ty, hir_ty)) = search_stack.pop() {
|
while let Some((ty, hir_ty)) = search_stack.pop() {
|
||||||
match (&ty.kind, &hir_ty.node) {
|
match (&ty.kind, &hir_ty.kind) {
|
||||||
// Check if the `argument_ty` is `&'X ..` where `'X`
|
// Check if the `argument_ty` is `&'X ..` where `'X`
|
||||||
// is the region we are looking for -- if so, and we have a `&T`
|
// is the region we are looking for -- if so, and we have a `&T`
|
||||||
// on the RHS, then we want to highlight the `&` like so:
|
// on the RHS, then we want to highlight the `&` like so:
|
||||||
|
|
|
@ -107,7 +107,7 @@ impl<'a> AstValidator<'a> {
|
||||||
// rust-lang/rust#57979: bug in old `visit_generic_args` called
|
// rust-lang/rust#57979: bug in old `visit_generic_args` called
|
||||||
// `walk_ty` rather than `visit_ty`, skipping outer `impl Trait`
|
// `walk_ty` rather than `visit_ty`, skipping outer `impl Trait`
|
||||||
// if it happened to occur at `ty`.
|
// if it happened to occur at `ty`.
|
||||||
if let TyKind::ImplTrait(..) = ty.node {
|
if let TyKind::ImplTrait(..) = ty.kind {
|
||||||
self.warning_period_57979_didnt_record_next_impl_trait = true;
|
self.warning_period_57979_didnt_record_next_impl_trait = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -126,7 +126,7 @@ impl<'a> AstValidator<'a> {
|
||||||
// rust-lang/rust#57979: bug in old `visit_generic_args` called
|
// rust-lang/rust#57979: bug in old `visit_generic_args` called
|
||||||
// `walk_ty` rather than `visit_ty`, skippping outer `impl Trait`
|
// `walk_ty` rather than `visit_ty`, skippping outer `impl Trait`
|
||||||
// if it happened to occur at `ty`.
|
// if it happened to occur at `ty`.
|
||||||
if let TyKind::ImplTrait(..) = ty.node {
|
if let TyKind::ImplTrait(..) = ty.kind {
|
||||||
self.warning_period_57979_didnt_record_next_impl_trait = true;
|
self.warning_period_57979_didnt_record_next_impl_trait = true;
|
||||||
}
|
}
|
||||||
self.visit_ty(ty);
|
self.visit_ty(ty);
|
||||||
|
@ -149,7 +149,7 @@ impl<'a> AstValidator<'a> {
|
||||||
|
|
||||||
// Mirrors `visit::walk_ty`, but tracks relevant state.
|
// Mirrors `visit::walk_ty`, but tracks relevant state.
|
||||||
fn walk_ty(&mut self, t: &'a Ty) {
|
fn walk_ty(&mut self, t: &'a Ty) {
|
||||||
match t.node {
|
match t.kind {
|
||||||
TyKind::ImplTrait(..) => {
|
TyKind::ImplTrait(..) => {
|
||||||
let outer_impl_trait = self.outer_impl_trait(t.span);
|
let outer_impl_trait = self.outer_impl_trait(t.span);
|
||||||
self.with_impl_trait(Some(outer_impl_trait), |this| visit::walk_ty(this, t))
|
self.with_impl_trait(Some(outer_impl_trait), |this| visit::walk_ty(this, t))
|
||||||
|
@ -456,7 +456,7 @@ impl<'a> Visitor<'a> for AstValidator<'a> {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn visit_ty(&mut self, ty: &'a Ty) {
|
fn visit_ty(&mut self, ty: &'a Ty) {
|
||||||
match ty.node {
|
match ty.kind {
|
||||||
TyKind::BareFn(ref bfty) => {
|
TyKind::BareFn(ref bfty) => {
|
||||||
self.check_fn_decl(&bfty.decl);
|
self.check_fn_decl(&bfty.decl);
|
||||||
self.check_decl_no_pat(&bfty.decl, |span, _| {
|
self.check_decl_no_pat(&bfty.decl, |span, _| {
|
||||||
|
@ -541,7 +541,7 @@ impl<'a> Visitor<'a> for AstValidator<'a> {
|
||||||
match item.node {
|
match item.node {
|
||||||
ItemKind::Impl(unsafety, polarity, _, _, Some(..), ref ty, ref impl_items) => {
|
ItemKind::Impl(unsafety, polarity, _, _, Some(..), ref ty, ref impl_items) => {
|
||||||
self.invalid_visibility(&item.vis, None);
|
self.invalid_visibility(&item.vis, None);
|
||||||
if let TyKind::Err = ty.node {
|
if let TyKind::Err = ty.kind {
|
||||||
self.err_handler()
|
self.err_handler()
|
||||||
.struct_span_err(item.span, "`impl Trait for .. {}` is an obsolete syntax")
|
.struct_span_err(item.span, "`impl Trait for .. {}` is an obsolete syntax")
|
||||||
.help("use `auto trait Trait {}` instead").emit();
|
.help("use `auto trait Trait {}` instead").emit();
|
||||||
|
|
|
@ -1389,14 +1389,14 @@ impl<'a, 'b, 'tcx, 'v> Visitor<'v> for ObsoleteCheckTypeForPrivatenessVisitor<'a
|
||||||
}
|
}
|
||||||
|
|
||||||
fn visit_ty(&mut self, ty: &hir::Ty) {
|
fn visit_ty(&mut self, ty: &hir::Ty) {
|
||||||
if let hir::TyKind::Path(hir::QPath::Resolved(_, ref path)) = ty.node {
|
if let hir::TyKind::Path(hir::QPath::Resolved(_, ref path)) = ty.kind {
|
||||||
if self.inner.path_is_private_type(path) {
|
if self.inner.path_is_private_type(path) {
|
||||||
self.contains_private = true;
|
self.contains_private = true;
|
||||||
// Found what we're looking for, so let's stop working.
|
// Found what we're looking for, so let's stop working.
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if let hir::TyKind::Path(_) = ty.node {
|
if let hir::TyKind::Path(_) = ty.kind {
|
||||||
if self.at_outer_type {
|
if self.at_outer_type {
|
||||||
self.outer_type_is_public_path = true;
|
self.outer_type_is_public_path = true;
|
||||||
}
|
}
|
||||||
|
@ -1628,7 +1628,7 @@ impl<'a, 'tcx> Visitor<'tcx> for ObsoleteVisiblePrivateTypesVisitor<'a, 'tcx> {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn visit_ty(&mut self, t: &'tcx hir::Ty) {
|
fn visit_ty(&mut self, t: &'tcx hir::Ty) {
|
||||||
if let hir::TyKind::Path(hir::QPath::Resolved(_, ref path)) = t.node {
|
if let hir::TyKind::Path(hir::QPath::Resolved(_, ref path)) = t.kind {
|
||||||
if self.path_is_private_type(path) {
|
if self.path_is_private_type(path) {
|
||||||
self.old_error_set.insert(t.hir_id);
|
self.old_error_set.insert(t.hir_id);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1120,9 +1120,9 @@ impl<'a, 'b> BuildReducedGraphVisitor<'a, 'b> {
|
||||||
}
|
}
|
||||||
|
|
||||||
macro_rules! method {
|
macro_rules! method {
|
||||||
($visit:ident: $ty:ty, $invoc:path, $walk:ident, $kind:ident) => {
|
($visit:ident: $ty:ty, $invoc:path, $walk:ident) => {
|
||||||
fn $visit(&mut self, node: &'b $ty) {
|
fn $visit(&mut self, node: &'b $ty) {
|
||||||
if let $invoc(..) = node.$kind {
|
if let $invoc(..) = node.kind {
|
||||||
self.visit_invoc(node.id);
|
self.visit_invoc(node.id);
|
||||||
} else {
|
} else {
|
||||||
visit::$walk(self, node);
|
visit::$walk(self, node);
|
||||||
|
@ -1132,10 +1132,10 @@ macro_rules! method {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a, 'b> Visitor<'b> for BuildReducedGraphVisitor<'a, 'b> {
|
impl<'a, 'b> Visitor<'b> for BuildReducedGraphVisitor<'a, 'b> {
|
||||||
method!(visit_impl_item: ast::ImplItem, ast::ImplItemKind::Macro, walk_impl_item, kind);
|
method!(visit_impl_item: ast::ImplItem, ast::ImplItemKind::Macro, walk_impl_item);
|
||||||
method!(visit_expr: ast::Expr, ast::ExprKind::Mac, walk_expr, kind);
|
method!(visit_expr: ast::Expr, ast::ExprKind::Mac, walk_expr);
|
||||||
method!(visit_pat: ast::Pat, ast::PatKind::Mac, walk_pat, kind);
|
method!(visit_pat: ast::Pat, ast::PatKind::Mac, walk_pat);
|
||||||
method!(visit_ty: ast::Ty, ast::TyKind::Mac, walk_ty, node);
|
method!(visit_ty: ast::Ty, ast::TyKind::Mac, walk_ty);
|
||||||
|
|
||||||
fn visit_item(&mut self, item: &'b Item) {
|
fn visit_item(&mut self, item: &'b Item) {
|
||||||
let macro_use = match item.node {
|
let macro_use = match item.node {
|
||||||
|
|
|
@ -384,7 +384,7 @@ impl<'a, 'tcx> Visitor<'tcx> for LateResolutionVisitor<'a, '_> {
|
||||||
self.resolve_local(local);
|
self.resolve_local(local);
|
||||||
}
|
}
|
||||||
fn visit_ty(&mut self, ty: &'tcx Ty) {
|
fn visit_ty(&mut self, ty: &'tcx Ty) {
|
||||||
match ty.node {
|
match ty.kind {
|
||||||
TyKind::Path(ref qself, ref path) => {
|
TyKind::Path(ref qself, ref path) => {
|
||||||
self.smart_resolve_path(ty.id, qself.as_ref(), path, PathSource::Type);
|
self.smart_resolve_path(ty.id, qself.as_ref(), path, PathSource::Type);
|
||||||
}
|
}
|
||||||
|
|
|
@ -472,7 +472,7 @@ impl<'a> LateResolutionVisitor<'a, '_> {
|
||||||
where FilterFn: Fn(Res) -> bool
|
where FilterFn: Fn(Res) -> bool
|
||||||
{
|
{
|
||||||
fn extract_node_id(t: &Ty) -> Option<NodeId> {
|
fn extract_node_id(t: &Ty) -> Option<NodeId> {
|
||||||
match t.node {
|
match t.kind {
|
||||||
TyKind::Path(None, _) => Some(t.id),
|
TyKind::Path(None, _) => Some(t.id),
|
||||||
TyKind::Rptr(_, ref mut_ty) => extract_node_id(&mut_ty.ty),
|
TyKind::Rptr(_, ref mut_ty) => extract_node_id(&mut_ty.ty),
|
||||||
// This doesn't handle the remaining `Ty` variants as they are not
|
// This doesn't handle the remaining `Ty` variants as they are not
|
||||||
|
|
|
@ -385,7 +385,7 @@ impl<'l, 'tcx> DumpVisitor<'l, 'tcx> {
|
||||||
}
|
}
|
||||||
|
|
||||||
if let ast::FunctionRetTy::Ty(ref ret_ty) = decl.output {
|
if let ast::FunctionRetTy::Ty(ref ret_ty) = decl.output {
|
||||||
if let ast::TyKind::ImplTrait(..) = ret_ty.node {
|
if let ast::TyKind::ImplTrait(..) = ret_ty.kind {
|
||||||
// FIXME: Opaque type desugaring prevents us from easily
|
// FIXME: Opaque type desugaring prevents us from easily
|
||||||
// processing trait bounds. See `visit_ty` for more details.
|
// processing trait bounds. See `visit_ty` for more details.
|
||||||
} else {
|
} else {
|
||||||
|
@ -1421,7 +1421,7 @@ impl<'l, 'tcx> Visitor<'l> for DumpVisitor<'l, 'tcx> {
|
||||||
|
|
||||||
fn visit_ty(&mut self, t: &'l ast::Ty) {
|
fn visit_ty(&mut self, t: &'l ast::Ty) {
|
||||||
self.process_macro_use(t.span);
|
self.process_macro_use(t.span);
|
||||||
match t.node {
|
match t.kind {
|
||||||
ast::TyKind::Path(_, ref path) => {
|
ast::TyKind::Path(_, ref path) => {
|
||||||
if generated_code(t.span) {
|
if generated_code(t.span) {
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -301,7 +301,7 @@ impl<'l, 'tcx> SaveContext<'l, 'tcx> {
|
||||||
}))
|
}))
|
||||||
}
|
}
|
||||||
ast::ItemKind::Impl(.., ref trait_ref, ref typ, ref impls) => {
|
ast::ItemKind::Impl(.., ref trait_ref, ref typ, ref impls) => {
|
||||||
if let ast::TyKind::Path(None, ref path) = typ.node {
|
if let ast::TyKind::Path(None, ref path) = typ.kind {
|
||||||
// Common case impl for a struct or something basic.
|
// Common case impl for a struct or something basic.
|
||||||
if generated_code(path.span) {
|
if generated_code(path.span) {
|
||||||
return None;
|
return None;
|
||||||
|
@ -652,7 +652,7 @@ impl<'l, 'tcx> SaveContext<'l, 'tcx> {
|
||||||
..
|
..
|
||||||
}) |
|
}) |
|
||||||
Node::Ty(&hir::Ty {
|
Node::Ty(&hir::Ty {
|
||||||
node: hir::TyKind::Path(ref qpath),
|
kind: hir::TyKind::Path(ref qpath),
|
||||||
..
|
..
|
||||||
}) => {
|
}) => {
|
||||||
self.tables.qpath_res(qpath, hir_id)
|
self.tables.qpath_res(qpath, hir_id)
|
||||||
|
|
|
@ -160,7 +160,7 @@ fn text_sig(text: String) -> Signature {
|
||||||
impl Sig for ast::Ty {
|
impl Sig for ast::Ty {
|
||||||
fn make(&self, offset: usize, _parent_id: Option<NodeId>, scx: &SaveContext<'_, '_>) -> Result {
|
fn make(&self, offset: usize, _parent_id: Option<NodeId>, scx: &SaveContext<'_, '_>) -> Result {
|
||||||
let id = Some(self.id);
|
let id = Some(self.id);
|
||||||
match self.node {
|
match self.kind {
|
||||||
ast::TyKind::Slice(ref ty) => {
|
ast::TyKind::Slice(ref ty) => {
|
||||||
let nested = ty.make(offset + 1, id, scx)?;
|
let nested = ty.make(offset + 1, id, scx)?;
|
||||||
let text = format!("[{}]", nested.text);
|
let text = format!("[{}]", nested.text);
|
||||||
|
|
|
@ -2075,11 +2075,11 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
|
||||||
/// internal notion of a type.
|
/// internal notion of a type.
|
||||||
pub fn ast_ty_to_ty(&self, ast_ty: &hir::Ty) -> Ty<'tcx> {
|
pub fn ast_ty_to_ty(&self, ast_ty: &hir::Ty) -> Ty<'tcx> {
|
||||||
debug!("ast_ty_to_ty(id={:?}, ast_ty={:?} ty_ty={:?})",
|
debug!("ast_ty_to_ty(id={:?}, ast_ty={:?} ty_ty={:?})",
|
||||||
ast_ty.hir_id, ast_ty, ast_ty.node);
|
ast_ty.hir_id, ast_ty, ast_ty.kind);
|
||||||
|
|
||||||
let tcx = self.tcx();
|
let tcx = self.tcx();
|
||||||
|
|
||||||
let result_ty = match ast_ty.node {
|
let result_ty = match ast_ty.kind {
|
||||||
hir::TyKind::Slice(ref ty) => {
|
hir::TyKind::Slice(ref ty) => {
|
||||||
tcx.mk_slice(self.ast_ty_to_ty(&ty))
|
tcx.mk_slice(self.ast_ty_to_ty(&ty))
|
||||||
}
|
}
|
||||||
|
@ -2123,7 +2123,7 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
|
||||||
debug!("ast_ty_to_ty: qself={:?} segment={:?}", qself, segment);
|
debug!("ast_ty_to_ty: qself={:?} segment={:?}", qself, segment);
|
||||||
let ty = self.ast_ty_to_ty(qself);
|
let ty = self.ast_ty_to_ty(qself);
|
||||||
|
|
||||||
let res = if let hir::TyKind::Path(hir::QPath::Resolved(_, ref path)) = qself.node {
|
let res = if let hir::TyKind::Path(hir::QPath::Resolved(_, ref path)) = qself.kind {
|
||||||
path.res
|
path.res
|
||||||
} else {
|
} else {
|
||||||
Res::Err
|
Res::Err
|
||||||
|
@ -2270,7 +2270,7 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
|
||||||
expected_ty: Option<Ty<'tcx>>)
|
expected_ty: Option<Ty<'tcx>>)
|
||||||
-> Ty<'tcx>
|
-> Ty<'tcx>
|
||||||
{
|
{
|
||||||
match ty.node {
|
match ty.kind {
|
||||||
hir::TyKind::Infer if expected_ty.is_some() => {
|
hir::TyKind::Infer if expected_ty.is_some() => {
|
||||||
self.record_ty(ty.hir_id, expected_ty.unwrap(), ty.span);
|
self.record_ty(ty.hir_id, expected_ty.unwrap(), ty.span);
|
||||||
expected_ty.unwrap()
|
expected_ty.unwrap()
|
||||||
|
|
|
@ -445,7 +445,7 @@ fn extract_spans_for_error_reporting<'a, 'tcx>(
|
||||||
};
|
};
|
||||||
|
|
||||||
impl_m_iter.zip(trait_m_iter).find(|&(ref impl_arg, ref trait_arg)| {
|
impl_m_iter.zip(trait_m_iter).find(|&(ref impl_arg, ref trait_arg)| {
|
||||||
match (&impl_arg.node, &trait_arg.node) {
|
match (&impl_arg.kind, &trait_arg.kind) {
|
||||||
(&hir::TyKind::Rptr(_, ref impl_mt), &hir::TyKind::Rptr(_, ref trait_mt)) |
|
(&hir::TyKind::Rptr(_, ref impl_mt), &hir::TyKind::Rptr(_, ref trait_mt)) |
|
||||||
(&hir::TyKind::Ptr(ref impl_mt), &hir::TyKind::Ptr(ref trait_mt)) => {
|
(&hir::TyKind::Ptr(ref impl_mt), &hir::TyKind::Ptr(ref trait_mt)) => {
|
||||||
impl_mt.mutbl != trait_mt.mutbl
|
impl_mt.mutbl != trait_mt.mutbl
|
||||||
|
@ -892,7 +892,7 @@ fn compare_synthetic_generics<'tcx>(
|
||||||
fn visit_ty(&mut self, ty: &'v hir::Ty) {
|
fn visit_ty(&mut self, ty: &'v hir::Ty) {
|
||||||
hir::intravisit::walk_ty(self, ty);
|
hir::intravisit::walk_ty(self, ty);
|
||||||
if let hir::TyKind::Path(
|
if let hir::TyKind::Path(
|
||||||
hir::QPath::Resolved(None, ref path)) = ty.node
|
hir::QPath::Resolved(None, ref path)) = ty.kind
|
||||||
{
|
{
|
||||||
if let Res::Def(DefKind::TyParam, def_id) = path.res {
|
if let Res::Def(DefKind::TyParam, def_id) = path.res {
|
||||||
if def_id == self.1 {
|
if def_id == self.1 {
|
||||||
|
|
|
@ -596,7 +596,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
||||||
if let (
|
if let (
|
||||||
hir::TyKind::Path(hir::QPath::Resolved(None, base_ty_path)),
|
hir::TyKind::Path(hir::QPath::Resolved(None, base_ty_path)),
|
||||||
sym::from,
|
sym::from,
|
||||||
) = (&base_ty.node, path_segment.ident.name) {
|
) = (&base_ty.kind, path_segment.ident.name) {
|
||||||
if let Some(ident) = &base_ty_path.segments.iter().map(|s| s.ident).next() {
|
if let Some(ident) = &base_ty_path.segments.iter().map(|s| s.ident).next() {
|
||||||
match ident.name {
|
match ident.name {
|
||||||
sym::i128 | sym::i64 | sym::i32 | sym::i16 | sym::i8 |
|
sym::i128 | sym::i64 | sym::i32 | sym::i16 | sym::i8 |
|
||||||
|
|
|
@ -886,7 +886,7 @@ fn typeck_tables_of(tcx: TyCtxt<'_>, def_id: DefId) -> &ty::TypeckTables<'_> {
|
||||||
fcx
|
fcx
|
||||||
} else {
|
} else {
|
||||||
let fcx = FnCtxt::new(&inh, param_env, body.value.hir_id);
|
let fcx = FnCtxt::new(&inh, param_env, body.value.hir_id);
|
||||||
let expected_type = body_ty.and_then(|ty| match ty.node {
|
let expected_type = body_ty.and_then(|ty| match ty.kind {
|
||||||
hir::TyKind::Infer => Some(AstConv::ast_ty_to_ty(&fcx, ty)),
|
hir::TyKind::Infer => Some(AstConv::ast_ty_to_ty(&fcx, ty)),
|
||||||
_ => None
|
_ => None
|
||||||
}).unwrap_or_else(|| tcx.type_of(def_id));
|
}).unwrap_or_else(|| tcx.type_of(def_id));
|
||||||
|
@ -3509,7 +3509,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
||||||
if let hir::GenericArg::Type(hir_ty) = &arg {
|
if let hir::GenericArg::Type(hir_ty) = &arg {
|
||||||
if let hir::TyKind::Path(
|
if let hir::TyKind::Path(
|
||||||
hir::QPath::TypeRelative(..),
|
hir::QPath::TypeRelative(..),
|
||||||
) = &hir_ty.node {
|
) = &hir_ty.kind {
|
||||||
// Avoid ICE with associated types. As this is best
|
// Avoid ICE with associated types. As this is best
|
||||||
// effort only, it's ok to ignore the case. It
|
// effort only, it's ok to ignore the case. It
|
||||||
// would trigger in `is_send::<T::AssocType>();`
|
// would trigger in `is_send::<T::AssocType>();`
|
||||||
|
@ -3722,7 +3722,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
||||||
QPath::TypeRelative(ref qself, ref segment) => {
|
QPath::TypeRelative(ref qself, ref segment) => {
|
||||||
let ty = self.to_ty(qself);
|
let ty = self.to_ty(qself);
|
||||||
|
|
||||||
let res = if let hir::TyKind::Path(QPath::Resolved(_, ref path)) = qself.node {
|
let res = if let hir::TyKind::Path(QPath::Resolved(_, ref path)) = qself.kind {
|
||||||
path.res
|
path.res
|
||||||
} else {
|
} else {
|
||||||
Res::Err
|
Res::Err
|
||||||
|
@ -4450,7 +4450,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
||||||
(&hir::FunctionRetTy::Return(ref ty), _, _, _) => {
|
(&hir::FunctionRetTy::Return(ref ty), _, _, _) => {
|
||||||
// Only point to return type if the expected type is the return type, as if they
|
// Only point to return type if the expected type is the return type, as if they
|
||||||
// are not, the expectation must have been caused by something else.
|
// are not, the expectation must have been caused by something else.
|
||||||
debug!("suggest_missing_return_type: return type {:?} node {:?}", ty, ty.node);
|
debug!("suggest_missing_return_type: return type {:?} node {:?}", ty, ty.kind);
|
||||||
let sp = ty.span;
|
let sp = ty.span;
|
||||||
let ty = AstConv::ast_ty_to_ty(self, ty);
|
let ty = AstConv::ast_ty_to_ty(self, ty);
|
||||||
debug!("suggest_missing_return_type: return type {:?}", ty);
|
debug!("suggest_missing_return_type: return type {:?}", ty);
|
||||||
|
|
|
@ -387,7 +387,7 @@ impl ItemCtxt<'tcx> {
|
||||||
/// `ast_ty_to_ty`, because we want to avoid triggering an all-out
|
/// `ast_ty_to_ty`, because we want to avoid triggering an all-out
|
||||||
/// conversion of the type to avoid inducing unnecessary cycles.
|
/// conversion of the type to avoid inducing unnecessary cycles.
|
||||||
fn is_param(tcx: TyCtxt<'_>, ast_ty: &hir::Ty, param_id: hir::HirId) -> bool {
|
fn is_param(tcx: TyCtxt<'_>, ast_ty: &hir::Ty, param_id: hir::HirId) -> bool {
|
||||||
if let hir::TyKind::Path(hir::QPath::Resolved(None, ref path)) = ast_ty.node {
|
if let hir::TyKind::Path(hir::QPath::Resolved(None, ref path)) = ast_ty.kind {
|
||||||
match path.res {
|
match path.res {
|
||||||
Res::SelfTy(Some(def_id), None) | Res::Def(DefKind::TyParam, def_id) => {
|
Res::SelfTy(Some(def_id), None) | Res::Def(DefKind::TyParam, def_id) => {
|
||||||
def_id == tcx.hir().local_def_id(param_id)
|
def_id == tcx.hir().local_def_id(param_id)
|
||||||
|
@ -796,7 +796,7 @@ fn has_late_bound_regions<'tcx>(tcx: TyCtxt<'tcx>, node: Node<'tcx>) -> Option<S
|
||||||
if self.has_late_bound_regions.is_some() {
|
if self.has_late_bound_regions.is_some() {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
match ty.node {
|
match ty.kind {
|
||||||
hir::TyKind::BareFn(..) => {
|
hir::TyKind::BareFn(..) => {
|
||||||
self.outer_index.shift_in(1);
|
self.outer_index.shift_in(1);
|
||||||
intravisit::walk_ty(self, ty);
|
intravisit::walk_ty(self, ty);
|
||||||
|
@ -1214,7 +1214,7 @@ pub fn checked_type_of(tcx: TyCtxt<'_>, def_id: DefId, fail: bool) -> Option<Ty<
|
||||||
}
|
}
|
||||||
TraitItemKind::Const(ref ty, body_id) => {
|
TraitItemKind::Const(ref ty, body_id) => {
|
||||||
body_id.and_then(|body_id| {
|
body_id.and_then(|body_id| {
|
||||||
if let hir::TyKind::Infer = ty.node {
|
if let hir::TyKind::Infer = ty.kind {
|
||||||
Some(infer_placeholder_type(tcx, def_id, body_id, ty.span, item.ident))
|
Some(infer_placeholder_type(tcx, def_id, body_id, ty.span, item.ident))
|
||||||
} else {
|
} else {
|
||||||
None
|
None
|
||||||
|
@ -1236,7 +1236,7 @@ pub fn checked_type_of(tcx: TyCtxt<'_>, def_id: DefId, fail: bool) -> Option<Ty<
|
||||||
tcx.mk_fn_def(def_id, substs)
|
tcx.mk_fn_def(def_id, substs)
|
||||||
}
|
}
|
||||||
ImplItemKind::Const(ref ty, body_id) => {
|
ImplItemKind::Const(ref ty, body_id) => {
|
||||||
if let hir::TyKind::Infer = ty.node {
|
if let hir::TyKind::Infer = ty.kind {
|
||||||
infer_placeholder_type(tcx, def_id, body_id, ty.span, item.ident)
|
infer_placeholder_type(tcx, def_id, body_id, ty.span, item.ident)
|
||||||
} else {
|
} else {
|
||||||
icx.to_ty(ty)
|
icx.to_ty(ty)
|
||||||
|
@ -1268,7 +1268,7 @@ pub fn checked_type_of(tcx: TyCtxt<'_>, def_id: DefId, fail: bool) -> Option<Ty<
|
||||||
match item.node {
|
match item.node {
|
||||||
ItemKind::Static(ref ty, .., body_id)
|
ItemKind::Static(ref ty, .., body_id)
|
||||||
| ItemKind::Const(ref ty, body_id) => {
|
| ItemKind::Const(ref ty, body_id) => {
|
||||||
if let hir::TyKind::Infer = ty.node {
|
if let hir::TyKind::Infer = ty.kind {
|
||||||
infer_placeholder_type(tcx, def_id, body_id, ty.span, item.ident)
|
infer_placeholder_type(tcx, def_id, body_id, ty.span, item.ident)
|
||||||
} else {
|
} else {
|
||||||
icx.to_ty(ty)
|
icx.to_ty(ty)
|
||||||
|
@ -1373,11 +1373,11 @@ pub fn checked_type_of(tcx: TyCtxt<'_>, def_id: DefId, fail: bool) -> Option<Ty<
|
||||||
let parent_node = tcx.hir().get(tcx.hir().get_parent_node(hir_id));
|
let parent_node = tcx.hir().get(tcx.hir().get_parent_node(hir_id));
|
||||||
match parent_node {
|
match parent_node {
|
||||||
Node::Ty(&hir::Ty {
|
Node::Ty(&hir::Ty {
|
||||||
node: hir::TyKind::Array(_, ref constant),
|
kind: hir::TyKind::Array(_, ref constant),
|
||||||
..
|
..
|
||||||
})
|
})
|
||||||
| Node::Ty(&hir::Ty {
|
| Node::Ty(&hir::Ty {
|
||||||
node: hir::TyKind::Typeof(ref constant),
|
kind: hir::TyKind::Typeof(ref constant),
|
||||||
..
|
..
|
||||||
})
|
})
|
||||||
| Node::Expr(&hir::Expr {
|
| Node::Expr(&hir::Expr {
|
||||||
|
@ -1399,13 +1399,13 @@ pub fn checked_type_of(tcx: TyCtxt<'_>, def_id: DefId, fail: bool) -> Option<Ty<
|
||||||
.to_ty(tcx)
|
.to_ty(tcx)
|
||||||
}
|
}
|
||||||
|
|
||||||
Node::Ty(&hir::Ty { node: hir::TyKind::Path(_), .. }) |
|
Node::Ty(&hir::Ty { kind: hir::TyKind::Path(_), .. }) |
|
||||||
Node::Expr(&hir::Expr { kind: ExprKind::Struct(..), .. }) |
|
Node::Expr(&hir::Expr { kind: ExprKind::Struct(..), .. }) |
|
||||||
Node::Expr(&hir::Expr { kind: ExprKind::Path(_), .. }) |
|
Node::Expr(&hir::Expr { kind: ExprKind::Path(_), .. }) |
|
||||||
Node::TraitRef(..) => {
|
Node::TraitRef(..) => {
|
||||||
let path = match parent_node {
|
let path = match parent_node {
|
||||||
Node::Ty(&hir::Ty {
|
Node::Ty(&hir::Ty {
|
||||||
node: hir::TyKind::Path(QPath::Resolved(_, ref path)),
|
kind: hir::TyKind::Path(QPath::Resolved(_, ref path)),
|
||||||
..
|
..
|
||||||
})
|
})
|
||||||
| Node::Expr(&hir::Expr {
|
| Node::Expr(&hir::Expr {
|
||||||
|
@ -1769,7 +1769,7 @@ fn find_opaque_ty_constraints(tcx: TyCtxt<'_>, def_id: DefId) -> Ty<'_> {
|
||||||
|
|
||||||
pub fn get_infer_ret_ty(output: &'_ hir::FunctionRetTy) -> Option<&hir::Ty> {
|
pub fn get_infer_ret_ty(output: &'_ hir::FunctionRetTy) -> Option<&hir::Ty> {
|
||||||
if let hir::FunctionRetTy::Return(ref ty) = output {
|
if let hir::FunctionRetTy::Return(ref ty) = output {
|
||||||
if let hir::TyKind::Infer = ty.node {
|
if let hir::TyKind::Infer = ty.kind {
|
||||||
return Some(&**ty)
|
return Some(&**ty)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -2835,7 +2835,7 @@ impl Clean<Type> for hir::Ty {
|
||||||
fn clean(&self, cx: &DocContext<'_>) -> Type {
|
fn clean(&self, cx: &DocContext<'_>) -> Type {
|
||||||
use rustc::hir::*;
|
use rustc::hir::*;
|
||||||
|
|
||||||
match self.node {
|
match self.kind {
|
||||||
TyKind::Never => Never,
|
TyKind::Never => Never,
|
||||||
TyKind::Ptr(ref m) => RawPointer(m.mutbl.clean(cx), box m.ty.clean(cx)),
|
TyKind::Ptr(ref m) => RawPointer(m.mutbl.clean(cx), box m.ty.clean(cx)),
|
||||||
TyKind::Rptr(ref l, ref m) => {
|
TyKind::Rptr(ref l, ref m) => {
|
||||||
|
@ -3031,7 +3031,7 @@ impl Clean<Type> for hir::Ty {
|
||||||
}
|
}
|
||||||
TyKind::BareFn(ref barefn) => BareFunction(box barefn.clean(cx)),
|
TyKind::BareFn(ref barefn) => BareFunction(box barefn.clean(cx)),
|
||||||
TyKind::Infer | TyKind::Err => Infer,
|
TyKind::Infer | TyKind::Err => Infer,
|
||||||
TyKind::Typeof(..) => panic!("unimplemented type {:?}", self.node),
|
TyKind::Typeof(..) => panic!("unimplemented type {:?}", self.kind),
|
||||||
TyKind::CVarArgs(_) => CVarArgs,
|
TyKind::CVarArgs(_) => CVarArgs,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -525,7 +525,7 @@ impl Pat {
|
||||||
/// Attempt reparsing the pattern as a type.
|
/// Attempt reparsing the pattern as a type.
|
||||||
/// This is intended for use by diagnostics.
|
/// This is intended for use by diagnostics.
|
||||||
pub(super) fn to_ty(&self) -> Option<P<Ty>> {
|
pub(super) fn to_ty(&self) -> Option<P<Ty>> {
|
||||||
let node = match &self.kind {
|
let kind = match &self.kind {
|
||||||
// In a type expression `_` is an inference variable.
|
// In a type expression `_` is an inference variable.
|
||||||
PatKind::Wild => TyKind::Infer,
|
PatKind::Wild => TyKind::Infer,
|
||||||
// An IDENT pattern with no binding mode would be valid as path to a type. E.g. `u32`.
|
// An IDENT pattern with no binding mode would be valid as path to a type. E.g. `u32`.
|
||||||
|
@ -555,7 +555,7 @@ impl Pat {
|
||||||
};
|
};
|
||||||
|
|
||||||
Some(P(Ty {
|
Some(P(Ty {
|
||||||
node,
|
kind,
|
||||||
id: self.id,
|
id: self.id,
|
||||||
span: self.span,
|
span: self.span,
|
||||||
}))
|
}))
|
||||||
|
@ -1051,7 +1051,7 @@ impl Expr {
|
||||||
};
|
};
|
||||||
|
|
||||||
Some(P(Ty {
|
Some(P(Ty {
|
||||||
node: kind,
|
kind,
|
||||||
id: self.id,
|
id: self.id,
|
||||||
span: self.span,
|
span: self.span,
|
||||||
}))
|
}))
|
||||||
|
@ -1664,7 +1664,7 @@ pub enum AssocTyConstraintKind {
|
||||||
#[derive(Clone, RustcEncodable, RustcDecodable)]
|
#[derive(Clone, RustcEncodable, RustcDecodable)]
|
||||||
pub struct Ty {
|
pub struct Ty {
|
||||||
pub id: NodeId,
|
pub id: NodeId,
|
||||||
pub node: TyKind,
|
pub kind: TyKind,
|
||||||
pub span: Span,
|
pub span: Span,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1823,9 +1823,9 @@ impl Param {
|
||||||
pub fn to_self(&self) -> Option<ExplicitSelf> {
|
pub fn to_self(&self) -> Option<ExplicitSelf> {
|
||||||
if let PatKind::Ident(BindingMode::ByValue(mutbl), ident, _) = self.pat.kind {
|
if let PatKind::Ident(BindingMode::ByValue(mutbl), ident, _) = self.pat.kind {
|
||||||
if ident.name == kw::SelfLower {
|
if ident.name == kw::SelfLower {
|
||||||
return match self.ty.node {
|
return match self.ty.kind {
|
||||||
TyKind::ImplicitSelf => Some(respan(self.pat.span, SelfKind::Value(mutbl))),
|
TyKind::ImplicitSelf => Some(respan(self.pat.span, SelfKind::Value(mutbl))),
|
||||||
TyKind::Rptr(lt, MutTy { ref ty, mutbl }) if ty.node.is_implicit_self() => {
|
TyKind::Rptr(lt, MutTy { ref ty, mutbl }) if ty.kind.is_implicit_self() => {
|
||||||
Some(respan(self.pat.span, SelfKind::Region(lt, mutbl)))
|
Some(respan(self.pat.span, SelfKind::Region(lt, mutbl)))
|
||||||
}
|
}
|
||||||
_ => Some(respan(
|
_ => Some(respan(
|
||||||
|
@ -1850,7 +1850,7 @@ impl Param {
|
||||||
let span = eself.span.to(eself_ident.span);
|
let span = eself.span.to(eself_ident.span);
|
||||||
let infer_ty = P(Ty {
|
let infer_ty = P(Ty {
|
||||||
id: DUMMY_NODE_ID,
|
id: DUMMY_NODE_ID,
|
||||||
node: TyKind::ImplicitSelf,
|
kind: TyKind::ImplicitSelf,
|
||||||
span,
|
span,
|
||||||
});
|
});
|
||||||
let param = |mutbl, ty| Param {
|
let param = |mutbl, ty| Param {
|
||||||
|
@ -1872,7 +1872,7 @@ impl Param {
|
||||||
Mutability::Immutable,
|
Mutability::Immutable,
|
||||||
P(Ty {
|
P(Ty {
|
||||||
id: DUMMY_NODE_ID,
|
id: DUMMY_NODE_ID,
|
||||||
node: TyKind::Rptr(
|
kind: TyKind::Rptr(
|
||||||
lt,
|
lt,
|
||||||
MutTy {
|
MutTy {
|
||||||
ty: infer_ty,
|
ty: infer_ty,
|
||||||
|
|
|
@ -568,7 +568,7 @@ impl DummyResult {
|
||||||
pub fn raw_ty(sp: Span, is_error: bool) -> P<ast::Ty> {
|
pub fn raw_ty(sp: Span, is_error: bool) -> P<ast::Ty> {
|
||||||
P(ast::Ty {
|
P(ast::Ty {
|
||||||
id: ast::DUMMY_NODE_ID,
|
id: ast::DUMMY_NODE_ID,
|
||||||
node: if is_error { ast::TyKind::Err } else { ast::TyKind::Tup(Vec::new()) },
|
kind: if is_error { ast::TyKind::Err } else { ast::TyKind::Tup(Vec::new()) },
|
||||||
span: sp
|
span: sp
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
|
@ -54,11 +54,11 @@ impl<'a> ExtCtxt<'a> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn ty(&self, span: Span, ty: ast::TyKind) -> P<ast::Ty> {
|
pub fn ty(&self, span: Span, kind: ast::TyKind) -> P<ast::Ty> {
|
||||||
P(ast::Ty {
|
P(ast::Ty {
|
||||||
id: ast::DUMMY_NODE_ID,
|
id: ast::DUMMY_NODE_ID,
|
||||||
span,
|
span,
|
||||||
node: ty
|
kind,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1348,13 +1348,13 @@ impl<'a, 'b> MutVisitor for InvocationCollector<'a, 'b> {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn visit_ty(&mut self, ty: &mut P<ast::Ty>) {
|
fn visit_ty(&mut self, ty: &mut P<ast::Ty>) {
|
||||||
match ty.node {
|
match ty.kind {
|
||||||
ast::TyKind::Mac(_) => {}
|
ast::TyKind::Mac(_) => {}
|
||||||
_ => return noop_visit_ty(ty, self),
|
_ => return noop_visit_ty(ty, self),
|
||||||
};
|
};
|
||||||
|
|
||||||
visit_clobber(ty, |mut ty| {
|
visit_clobber(ty, |mut ty| {
|
||||||
match mem::replace(&mut ty.node, ast::TyKind::Err) {
|
match mem::replace(&mut ty.kind, ast::TyKind::Err) {
|
||||||
ast::TyKind::Mac(mac) =>
|
ast::TyKind::Mac(mac) =>
|
||||||
self.collect_bang(mac, ty.span, AstFragmentKind::Ty).make_ty(),
|
self.collect_bang(mac, ty.span, AstFragmentKind::Ty).make_ty(),
|
||||||
_ => unreachable!(),
|
_ => unreachable!(),
|
||||||
|
|
|
@ -34,7 +34,7 @@ pub fn placeholder(kind: AstFragmentKind, id: ast::NodeId) -> AstFragment {
|
||||||
});
|
});
|
||||||
let ty = P(ast::Ty {
|
let ty = P(ast::Ty {
|
||||||
id,
|
id,
|
||||||
node: ast::TyKind::Mac(mac_placeholder()),
|
kind: ast::TyKind::Mac(mac_placeholder()),
|
||||||
span,
|
span,
|
||||||
});
|
});
|
||||||
let pat = P(ast::Pat {
|
let pat = P(ast::Pat {
|
||||||
|
@ -71,7 +71,7 @@ pub fn placeholder(kind: AstFragmentKind, id: ast::NodeId) -> AstFragment {
|
||||||
id, span, kind: ast::PatKind::Mac(mac_placeholder()),
|
id, span, kind: ast::PatKind::Mac(mac_placeholder()),
|
||||||
})),
|
})),
|
||||||
AstFragmentKind::Ty => AstFragment::Ty(P(ast::Ty {
|
AstFragmentKind::Ty => AstFragment::Ty(P(ast::Ty {
|
||||||
id, span, node: ast::TyKind::Mac(mac_placeholder()),
|
id, span, kind: ast::TyKind::Mac(mac_placeholder()),
|
||||||
})),
|
})),
|
||||||
AstFragmentKind::Stmts => AstFragment::Stmts(smallvec![{
|
AstFragmentKind::Stmts => AstFragment::Stmts(smallvec![{
|
||||||
let mac = P((mac_placeholder(), ast::MacStmtStyle::Braces, ThinVec::new()));
|
let mac = P((mac_placeholder(), ast::MacStmtStyle::Braces, ThinVec::new()));
|
||||||
|
@ -318,7 +318,7 @@ impl<'a, 'b> MutVisitor for PlaceholderExpander<'a, 'b> {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn visit_ty(&mut self, ty: &mut P<ast::Ty>) {
|
fn visit_ty(&mut self, ty: &mut P<ast::Ty>) {
|
||||||
match ty.node {
|
match ty.kind {
|
||||||
ast::TyKind::Mac(_) => *ty = self.remove(ty.id).make_ty(),
|
ast::TyKind::Mac(_) => *ty = self.remove(ty.id).make_ty(),
|
||||||
_ => noop_visit_ty(ty, self),
|
_ => noop_visit_ty(ty, self),
|
||||||
}
|
}
|
||||||
|
|
|
@ -432,7 +432,7 @@ impl<'a> Visitor<'a> for PostExpansionVisitor<'a> {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn visit_ty(&mut self, ty: &'a ast::Ty) {
|
fn visit_ty(&mut self, ty: &'a ast::Ty) {
|
||||||
match ty.node {
|
match ty.kind {
|
||||||
ast::TyKind::BareFn(ref bare_fn_ty) => {
|
ast::TyKind::BareFn(ref bare_fn_ty) => {
|
||||||
self.check_abi(bare_fn_ty.abi, ty.span);
|
self.check_abi(bare_fn_ty.abi, ty.span);
|
||||||
}
|
}
|
||||||
|
@ -447,7 +447,7 @@ impl<'a> Visitor<'a> for PostExpansionVisitor<'a> {
|
||||||
|
|
||||||
fn visit_fn_ret_ty(&mut self, ret_ty: &'a ast::FunctionRetTy) {
|
fn visit_fn_ret_ty(&mut self, ret_ty: &'a ast::FunctionRetTy) {
|
||||||
if let ast::FunctionRetTy::Ty(ref output_ty) = *ret_ty {
|
if let ast::FunctionRetTy::Ty(ref output_ty) = *ret_ty {
|
||||||
if let ast::TyKind::Never = output_ty.node {
|
if let ast::TyKind::Never = output_ty.kind {
|
||||||
// Do nothing.
|
// Do nothing.
|
||||||
} else {
|
} else {
|
||||||
self.visit_ty(output_ty)
|
self.visit_ty(output_ty)
|
||||||
|
|
|
@ -432,9 +432,9 @@ pub fn noop_visit_ty_constraint<T: MutVisitor>(
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn noop_visit_ty<T: MutVisitor>(ty: &mut P<Ty>, vis: &mut T) {
|
pub fn noop_visit_ty<T: MutVisitor>(ty: &mut P<Ty>, vis: &mut T) {
|
||||||
let Ty { id, node, span } = ty.deref_mut();
|
let Ty { id, kind, span } = ty.deref_mut();
|
||||||
vis.visit_id(id);
|
vis.visit_id(id);
|
||||||
match node {
|
match kind {
|
||||||
TyKind::Infer | TyKind::ImplicitSelf | TyKind::Err |
|
TyKind::Infer | TyKind::ImplicitSelf | TyKind::Err |
|
||||||
TyKind::Never | TyKind::CVarArgs => {}
|
TyKind::Never | TyKind::CVarArgs => {}
|
||||||
TyKind::Slice(ty) => vis.visit_ty(ty),
|
TyKind::Slice(ty) => vis.visit_ty(ty),
|
||||||
|
|
|
@ -25,7 +25,7 @@ crate fn dummy_arg(ident: Ident) -> Param {
|
||||||
span: ident.span,
|
span: ident.span,
|
||||||
});
|
});
|
||||||
let ty = Ty {
|
let ty = Ty {
|
||||||
node: TyKind::Err,
|
kind: TyKind::Err,
|
||||||
span: ident.span,
|
span: ident.span,
|
||||||
id: ast::DUMMY_NODE_ID
|
id: ast::DUMMY_NODE_ID
|
||||||
};
|
};
|
||||||
|
@ -135,7 +135,7 @@ impl RecoverQPath for Ty {
|
||||||
fn recovered(qself: Option<QSelf>, path: ast::Path) -> Self {
|
fn recovered(qself: Option<QSelf>, path: ast::Path) -> Self {
|
||||||
Self {
|
Self {
|
||||||
span: path.span,
|
span: path.span,
|
||||||
node: TyKind::Path(qself, path),
|
kind: TyKind::Path(qself, path),
|
||||||
id: ast::DUMMY_NODE_ID,
|
id: ast::DUMMY_NODE_ID,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -663,7 +663,7 @@ impl<'a> Parser<'a> {
|
||||||
pprust::ty_to_string(ty)
|
pprust::ty_to_string(ty)
|
||||||
);
|
);
|
||||||
|
|
||||||
match ty.node {
|
match ty.kind {
|
||||||
TyKind::Rptr(ref lifetime, ref mut_ty) => {
|
TyKind::Rptr(ref lifetime, ref mut_ty) => {
|
||||||
let sum_with_parens = pprust::to_string(|s| {
|
let sum_with_parens = pprust::to_string(|s| {
|
||||||
s.s.word("&");
|
s.s.word("&");
|
||||||
|
@ -1296,7 +1296,7 @@ impl<'a> Parser<'a> {
|
||||||
is_trait_item: bool,
|
is_trait_item: bool,
|
||||||
) -> PResult<'a, ast::Param> {
|
) -> PResult<'a, ast::Param> {
|
||||||
let sp = param.pat.span;
|
let sp = param.pat.span;
|
||||||
param.ty.node = TyKind::Err;
|
param.ty.kind = TyKind::Err;
|
||||||
let mut err = self.struct_span_err(sp, "unexpected `self` parameter in function");
|
let mut err = self.struct_span_err(sp, "unexpected `self` parameter in function");
|
||||||
if is_trait_item {
|
if is_trait_item {
|
||||||
err.span_label(sp, "must be the first associated function parameter");
|
err.span_label(sp, "must be the first associated function parameter");
|
||||||
|
@ -1360,7 +1360,7 @@ impl<'a> Parser<'a> {
|
||||||
let mut seen_inputs = FxHashSet::default();
|
let mut seen_inputs = FxHashSet::default();
|
||||||
for input in fn_inputs.iter_mut() {
|
for input in fn_inputs.iter_mut() {
|
||||||
let opt_ident = if let (PatKind::Ident(_, ident, _), TyKind::Err) = (
|
let opt_ident = if let (PatKind::Ident(_, ident, _), TyKind::Err) = (
|
||||||
&input.pat.kind, &input.ty.node,
|
&input.pat.kind, &input.ty.kind,
|
||||||
) {
|
) {
|
||||||
Some(*ident)
|
Some(*ident)
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -1212,7 +1212,7 @@ impl<'a> Parser<'a> {
|
||||||
do_not_enforce_named_arguments_for_c_variadic
|
do_not_enforce_named_arguments_for_c_variadic
|
||||||
) {
|
) {
|
||||||
Ok(param) => {
|
Ok(param) => {
|
||||||
if let TyKind::CVarArgs = param.ty.node {
|
if let TyKind::CVarArgs = param.ty.kind {
|
||||||
c_variadic = true;
|
c_variadic = true;
|
||||||
if p.token != token::CloseDelim(token::Paren) {
|
if p.token != token::CloseDelim(token::Paren) {
|
||||||
let span = p.token.span;
|
let span = p.token.span;
|
||||||
|
|
|
@ -555,7 +555,7 @@ impl<'a> Parser<'a> {
|
||||||
let span_after_type = parser_snapshot_after_type.token.span;
|
let span_after_type = parser_snapshot_after_type.token.span;
|
||||||
let expr = mk_expr(self, P(Ty {
|
let expr = mk_expr(self, P(Ty {
|
||||||
span: path.span,
|
span: path.span,
|
||||||
node: TyKind::Path(None, path),
|
kind: TyKind::Path(None, path),
|
||||||
id: DUMMY_NODE_ID,
|
id: DUMMY_NODE_ID,
|
||||||
}));
|
}));
|
||||||
|
|
||||||
|
@ -1190,7 +1190,7 @@ impl<'a> Parser<'a> {
|
||||||
} else {
|
} else {
|
||||||
P(Ty {
|
P(Ty {
|
||||||
id: DUMMY_NODE_ID,
|
id: DUMMY_NODE_ID,
|
||||||
node: TyKind::Infer,
|
kind: TyKind::Infer,
|
||||||
span: self.prev_span,
|
span: self.prev_span,
|
||||||
})
|
})
|
||||||
};
|
};
|
||||||
|
|
|
@ -678,7 +678,7 @@ impl<'a> Parser<'a> {
|
||||||
self.look_ahead(1, |t| t != &token::Lt) {
|
self.look_ahead(1, |t| t != &token::Lt) {
|
||||||
let span = self.prev_span.between(self.token.span);
|
let span = self.prev_span.between(self.token.span);
|
||||||
self.struct_span_err(span, "missing trait in a trait impl").emit();
|
self.struct_span_err(span, "missing trait in a trait impl").emit();
|
||||||
P(Ty { node: TyKind::Path(None, err_path(span)), span, id: DUMMY_NODE_ID })
|
P(Ty { kind: TyKind::Path(None, err_path(span)), span, id: DUMMY_NODE_ID })
|
||||||
} else {
|
} else {
|
||||||
self.parse_ty()?
|
self.parse_ty()?
|
||||||
};
|
};
|
||||||
|
@ -715,7 +715,7 @@ impl<'a> Parser<'a> {
|
||||||
}
|
}
|
||||||
|
|
||||||
let ty_first = ty_first.into_inner();
|
let ty_first = ty_first.into_inner();
|
||||||
let path = match ty_first.node {
|
let path = match ty_first.kind {
|
||||||
// This notably includes paths passed through `ty` macro fragments (#46438).
|
// This notably includes paths passed through `ty` macro fragments (#46438).
|
||||||
TyKind::Path(None, path) => path,
|
TyKind::Path(None, path) => path,
|
||||||
_ => {
|
_ => {
|
||||||
|
@ -1526,7 +1526,7 @@ impl<'a> Parser<'a> {
|
||||||
// The user intended that the type be inferred,
|
// The user intended that the type be inferred,
|
||||||
// so treat this as if the user wrote e.g. `const A: _ = expr;`.
|
// so treat this as if the user wrote e.g. `const A: _ = expr;`.
|
||||||
P(Ty {
|
P(Ty {
|
||||||
node: TyKind::Infer,
|
kind: TyKind::Infer,
|
||||||
span: id.span,
|
span: id.span,
|
||||||
id: ast::DUMMY_NODE_ID,
|
id: ast::DUMMY_NODE_ID,
|
||||||
})
|
})
|
||||||
|
|
|
@ -55,7 +55,7 @@ impl<'a> Parser<'a> {
|
||||||
|
|
||||||
let lo = self.token.span;
|
let lo = self.token.span;
|
||||||
let mut impl_dyn_multi = false;
|
let mut impl_dyn_multi = false;
|
||||||
let node = if self.eat(&token::OpenDelim(token::Paren)) {
|
let kind = if self.eat(&token::OpenDelim(token::Paren)) {
|
||||||
// `(TYPE)` is a parenthesized type.
|
// `(TYPE)` is a parenthesized type.
|
||||||
// `(TYPE,)` is a tuple with a single field of type TYPE.
|
// `(TYPE,)` is a tuple with a single field of type TYPE.
|
||||||
let mut ts = vec![];
|
let mut ts = vec![];
|
||||||
|
@ -75,7 +75,7 @@ impl<'a> Parser<'a> {
|
||||||
if ts.len() == 1 && !last_comma {
|
if ts.len() == 1 && !last_comma {
|
||||||
let ty = ts.into_iter().nth(0).unwrap().into_inner();
|
let ty = ts.into_iter().nth(0).unwrap().into_inner();
|
||||||
let maybe_bounds = allow_plus && self.token.is_like_plus();
|
let maybe_bounds = allow_plus && self.token.is_like_plus();
|
||||||
match ty.node {
|
match ty.kind {
|
||||||
// `(TY_BOUND_NOPAREN) + BOUND + ...`.
|
// `(TY_BOUND_NOPAREN) + BOUND + ...`.
|
||||||
TyKind::Path(None, ref path) if maybe_bounds => {
|
TyKind::Path(None, ref path) if maybe_bounds => {
|
||||||
self.parse_remaining_bounds(Vec::new(), path.clone(), lo, true)?
|
self.parse_remaining_bounds(Vec::new(), path.clone(), lo, true)?
|
||||||
|
@ -211,7 +211,7 @@ impl<'a> Parser<'a> {
|
||||||
};
|
};
|
||||||
|
|
||||||
let span = lo.to(self.prev_span);
|
let span = lo.to(self.prev_span);
|
||||||
let ty = P(Ty { node, span, id: ast::DUMMY_NODE_ID });
|
let ty = P(Ty { kind, span, id: ast::DUMMY_NODE_ID });
|
||||||
|
|
||||||
// Try to recover from use of `+` with incorrect priority.
|
// Try to recover from use of `+` with incorrect priority.
|
||||||
self.maybe_report_ambiguous_plus(allow_plus, impl_dyn_multi, &ty);
|
self.maybe_report_ambiguous_plus(allow_plus, impl_dyn_multi, &ty);
|
||||||
|
|
|
@ -966,7 +966,7 @@ impl<'a> State<'a> {
|
||||||
crate fn print_type(&mut self, ty: &ast::Ty) {
|
crate fn print_type(&mut self, ty: &ast::Ty) {
|
||||||
self.maybe_print_comment(ty.span.lo());
|
self.maybe_print_comment(ty.span.lo());
|
||||||
self.ibox(0);
|
self.ibox(0);
|
||||||
match ty.node {
|
match ty.kind {
|
||||||
ast::TyKind::Slice(ref ty) => {
|
ast::TyKind::Slice(ref ty) => {
|
||||||
self.s.word("[");
|
self.s.word("[");
|
||||||
self.print_type(ty);
|
self.print_type(ty);
|
||||||
|
@ -2760,7 +2760,7 @@ impl<'a> State<'a> {
|
||||||
|
|
||||||
self.print_outer_attributes_inline(&input.attrs);
|
self.print_outer_attributes_inline(&input.attrs);
|
||||||
|
|
||||||
match input.ty.node {
|
match input.ty.kind {
|
||||||
ast::TyKind::Infer if is_closure => self.print_pat(&input.pat),
|
ast::TyKind::Infer if is_closure => self.print_pat(&input.pat),
|
||||||
_ => {
|
_ => {
|
||||||
if let Some(eself) = input.to_self() {
|
if let Some(eself) = input.to_self() {
|
||||||
|
|
|
@ -333,7 +333,7 @@ pub fn walk_field_pattern<'a, V: Visitor<'a>>(visitor: &mut V, fp: &'a FieldPat)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn walk_ty<'a, V: Visitor<'a>>(visitor: &mut V, typ: &'a Ty) {
|
pub fn walk_ty<'a, V: Visitor<'a>>(visitor: &mut V, typ: &'a Ty) {
|
||||||
match typ.node {
|
match typ.kind {
|
||||||
TyKind::Slice(ref ty) | TyKind::Paren(ref ty) => {
|
TyKind::Slice(ref ty) | TyKind::Paren(ref ty) => {
|
||||||
visitor.visit_ty(ty)
|
visitor.visit_ty(ty)
|
||||||
}
|
}
|
||||||
|
|
|
@ -56,7 +56,7 @@ pub fn expand_concat_idents<'cx>(cx: &'cx mut ExtCtxt<'_>,
|
||||||
fn make_ty(self: Box<Self>) -> Option<P<ast::Ty>> {
|
fn make_ty(self: Box<Self>) -> Option<P<ast::Ty>> {
|
||||||
Some(P(ast::Ty {
|
Some(P(ast::Ty {
|
||||||
id: ast::DUMMY_NODE_ID,
|
id: ast::DUMMY_NODE_ID,
|
||||||
node: ast::TyKind::Path(None, ast::Path::from_ident(self.ident)),
|
kind: ast::TyKind::Path(None, ast::Path::from_ident(self.ident)),
|
||||||
span: self.ident.span,
|
span: self.ident.span,
|
||||||
}))
|
}))
|
||||||
}
|
}
|
||||||
|
|
|
@ -355,7 +355,7 @@ fn find_type_parameters(
|
||||||
|
|
||||||
impl<'a, 'b> visit::Visitor<'a> for Visitor<'a, 'b> {
|
impl<'a, 'b> visit::Visitor<'a> for Visitor<'a, 'b> {
|
||||||
fn visit_ty(&mut self, ty: &'a ast::Ty) {
|
fn visit_ty(&mut self, ty: &'a ast::Ty) {
|
||||||
if let ast::TyKind::Path(_, ref path) = ty.node {
|
if let ast::TyKind::Path(_, ref path) = ty.kind {
|
||||||
if let Some(segment) = path.segments.first() {
|
if let Some(segment) = path.segments.first() {
|
||||||
if self.ty_param_names.contains(&segment.ident.name) {
|
if self.ty_param_names.contains(&segment.ident.name) {
|
||||||
self.types.push(P(ty.clone()));
|
self.types.push(P(ty.clone()));
|
||||||
|
@ -612,7 +612,7 @@ impl<'a> TraitDef<'a> {
|
||||||
|
|
||||||
for ty in tys {
|
for ty in tys {
|
||||||
// if we have already handled this type, skip it
|
// if we have already handled this type, skip it
|
||||||
if let ast::TyKind::Path(_, ref p) = ty.node {
|
if let ast::TyKind::Path(_, ref p) = ty.kind {
|
||||||
if p.segments.len() == 1 &&
|
if p.segments.len() == 1 &&
|
||||||
ty_param_names.contains(&p.segments[0].ident.name) {
|
ty_param_names.contains(&p.segments[0].ident.name) {
|
||||||
continue;
|
continue;
|
||||||
|
|
|
@ -285,7 +285,7 @@ fn has_test_signature(cx: &ExtCtxt<'_>, i: &ast::Item) -> bool {
|
||||||
// type implements the `Termination` trait as `libtest` enforces that.
|
// type implements the `Termination` trait as `libtest` enforces that.
|
||||||
let has_output = match decl.output {
|
let has_output = match decl.output {
|
||||||
ast::FunctionRetTy::Default(..) => false,
|
ast::FunctionRetTy::Default(..) => false,
|
||||||
ast::FunctionRetTy::Ty(ref t) if t.node.is_unit() => false,
|
ast::FunctionRetTy::Ty(ref t) if t.kind.is_unit() => false,
|
||||||
_ => true
|
_ => true
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue