@@ -3538,7 +3538,7 @@ pub fn store_trait_methods(cx: ctxt, id: ast::node_id, ms: @~[method]) {
3538
3538
pub fn provided_trait_methods ( cx : ctxt , id : ast:: def_id ) -> ~[ ast:: ident ] {
3539
3539
if is_local ( id) {
3540
3540
match cx. items . find ( & id. node ) {
3541
- Some ( ast_map:: node_item( @ast:: item {
3541
+ Some ( & ast_map:: node_item( @ast:: item {
3542
3542
node : item_trait( _, _, ref ms) ,
3543
3543
_
3544
3544
} , _) ) =>
@@ -3627,7 +3627,7 @@ pub fn impl_traits(cx: ctxt, id: ast::def_id, store: TraitStore) -> ~[t] {
3627
3627
if id. crate == ast:: local_crate {
3628
3628
debug ! ( "(impl_traits) searching for trait impl %?" , id) ;
3629
3629
match cx. items . find ( & id. node ) {
3630
- Some ( ast_map:: node_item( @ast:: item {
3630
+ Some ( & ast_map:: node_item( @ast:: item {
3631
3631
node : ast:: item_impl( _, opt_trait, _, _) ,
3632
3632
_} ,
3633
3633
_) ) => {
@@ -3663,7 +3663,7 @@ fn struct_ctor_id(cx: ctxt, struct_did: ast::def_id) -> Option<ast::def_id> {
3663
3663
}
3664
3664
3665
3665
match cx. items . find ( & struct_did. node ) {
3666
- Some ( ast_map:: node_item( item, _) ) => {
3666
+ Some ( & ast_map:: node_item( item, _) ) => {
3667
3667
match item. node {
3668
3668
ast:: item_struct( struct_def, _) => {
3669
3669
struct_def. ctor_id . map ( |ctor_id|
@@ -3735,7 +3735,7 @@ pub fn ty_dtor(cx: ctxt, struct_id: def_id) -> DtorKind {
3735
3735
3736
3736
if is_local ( struct_id) {
3737
3737
match cx. items . find ( & struct_id. node ) {
3738
- Some ( ast_map:: node_item( @ast:: item {
3738
+ Some ( & ast_map:: node_item( @ast:: item {
3739
3739
node : ast:: item_struct( @ast:: struct_def { dtor : Some ( ref dtor) ,
3740
3740
_ } ,
3741
3741
_) ,
@@ -3762,8 +3762,12 @@ pub fn item_path(cx: ctxt, id: ast::def_id) -> ast_map::path {
3762
3762
if id. crate != ast:: local_crate {
3763
3763
csearch:: get_item_path ( cx, id)
3764
3764
} else {
3765
- let node = cx. items . get ( & id. node ) ;
3766
- match node {
3765
+ // FIXME (#5521): uncomment this code and don't have a catch-all at the
3766
+ // end of the match statement. Favor explicitly listing
3767
+ // each variant.
3768
+ // let node = cx.items.get(&id.node);
3769
+ // match *node {
3770
+ match * cx. items . get ( & id. node ) {
3767
3771
ast_map:: node_item( item, path) => {
3768
3772
let item_elt = match item. node {
3769
3773
item_mod( _) | item_foreign_mod( _) => {
@@ -3805,9 +3809,7 @@ pub fn item_path(cx: ctxt, id: ast::def_id) -> ast_map::path {
3805
3809
vec:: append_one ( /*bad*/ copy * path, ast_map:: path_name ( item. ident ) )
3806
3810
}
3807
3811
3808
- ast_map:: node_stmt( * ) | ast_map:: node_expr( * ) |
3809
- ast_map:: node_arg( * ) | ast_map:: node_local( * ) |
3810
- ast_map:: node_block( * ) => {
3812
+ ref node => {
3811
3813
cx. sess . bug ( fmt ! ( "cannot find item_path for node %?" , node) ) ;
3812
3814
}
3813
3815
}
@@ -3839,7 +3841,7 @@ pub fn enum_variants(cx: ctxt, id: ast::def_id) -> @~[VariantInfo] {
3839
3841
call eval_const_expr, it should never get called twice for the same
3840
3842
expr, since check_enum_variants also updates the enum_var_cache
3841
3843
*/
3842
- match cx. items . get ( & id. node ) {
3844
+ match * cx. items . get ( & id. node ) {
3843
3845
ast_map:: node_item( @ast:: item {
3844
3846
node : ast:: item_enum( ref enum_definition, _) ,
3845
3847
_
@@ -3955,15 +3957,15 @@ pub fn lookup_field_type(tcx: ctxt,
3955
3957
pub fn lookup_struct_fields(cx: ctxt, did: ast::def_id) -> ~[field_ty] {
3956
3958
if did.crate == ast::local_crate {
3957
3959
match cx.items.find(&did.node) {
3958
- Some(ast_map::node_item(i,_)) => {
3960
+ Some(& ast_map::node_item(i,_)) => {
3959
3961
match i.node {
3960
3962
ast::item_struct(struct_def, _) => {
3961
3963
struct_field_tys(struct_def.fields)
3962
3964
}
3963
3965
_ => cx.sess.bug(~" struct ID bound to non-struct ")
3964
3966
}
3965
3967
}
3966
- Some(ast_map::node_variant(ref variant, _, _)) => {
3968
+ Some(& ast_map::node_variant(ref variant, _, _)) => {
3967
3969
match (*variant).node.kind {
3968
3970
ast::struct_variant_kind(struct_def) => {
3969
3971
struct_field_tys(struct_def.fields)
0 commit comments