@@ -80,7 +80,7 @@ impl LateLintPass for UnrootedPass {
80
80
/// All structs containing #[must_root] types must be #[must_root] themselves
81
81
fn check_struct_def ( & mut self ,
82
82
cx : & LateContext ,
83
- def : & hir:: StructDef ,
83
+ def : & hir:: VariantData ,
84
84
_n : ast:: Name ,
85
85
_gen : & hir:: Generics ,
86
86
id : ast:: NodeId ) {
@@ -89,7 +89,7 @@ impl LateLintPass for UnrootedPass {
89
89
_ => cx. tcx . map . expect_item ( cx. tcx . map . get_parent ( id) ) ,
90
90
} ;
91
91
if item. attrs . iter ( ) . all ( |a| !a. check_name ( "must_root" ) ) {
92
- for ref field in & def. fields {
92
+ for ref field in def. fields ( ) {
93
93
if is_unrooted_ty ( cx, cx. tcx . node_id_to_type ( field. node . id ) , false ) {
94
94
cx. span_lint ( UNROOTED_MUST_ROOT , field. span ,
95
95
"Type must be rooted, use #[must_root] on the struct definition to propagate" )
@@ -101,13 +101,13 @@ impl LateLintPass for UnrootedPass {
101
101
/// All enums containing #[must_root] types must be #[must_root] themselves
102
102
fn check_variant ( & mut self , cx : & LateContext , var : & hir:: Variant , _gen : & hir:: Generics ) {
103
103
let ref map = cx. tcx . map ;
104
- if map. expect_item ( map. get_parent ( var. node . id ) ) . attrs . iter ( ) . all ( |a| !a. check_name ( "must_root" ) ) {
105
- match var. node . kind {
106
- hir:: TupleVariantKind ( ref vec) => {
104
+ if map. expect_item ( map. get_parent ( var. node . data . id ( ) ) ) . attrs . iter ( ) . all ( |a| !a. check_name ( "must_root" ) ) {
105
+ match var. node . data {
106
+ hir:: VariantData :: Tuple ( ref vec, _ ) => {
107
107
for ty in vec {
108
- cx. tcx . ast_ty_to_ty_cache . borrow ( ) . get ( & ty. id ) . map ( |t| {
108
+ cx. tcx . ast_ty_to_ty_cache . borrow ( ) . get ( & ty. node . id ) . map ( |t| {
109
109
if is_unrooted_ty ( cx, t, false ) {
110
- cx. span_lint ( UNROOTED_MUST_ROOT , ty. ty . span ,
110
+ cx. span_lint ( UNROOTED_MUST_ROOT , ty. node . ty . span ,
111
111
"Type must be rooted, use #[must_root] on \
112
112
the enum definition to propagate")
113
113
}
0 commit comments