@@ -31,7 +31,6 @@ use crate::tokenstream::{DelimSpan, TokenStream, TokenTree};
3131use rustc_data_structures:: stable_hasher:: { HashStable , StableHasher } ;
3232use rustc_data_structures:: sync:: Lrc ;
3333use rustc_data_structures:: thin_vec:: ThinVec ;
34- use rustc_index:: vec:: Idx ;
3534use rustc_macros:: HashStable_Generic ;
3635use rustc_serialize:: { self , Decoder , Encoder } ;
3736use rustc_span:: source_map:: { respan, Spanned } ;
@@ -2251,27 +2250,22 @@ pub enum AttrStyle {
22512250 Inner ,
22522251}
22532252
2254- #[ derive( Clone , PartialEq , Eq , Hash , Debug , PartialOrd , Ord , Copy ) ]
2255- pub struct AttrId ( pub usize ) ;
2256-
2257- impl Idx for AttrId {
2258- fn new ( idx : usize ) -> Self {
2259- AttrId ( idx)
2260- }
2261- fn index ( self ) -> usize {
2262- self . 0
2253+ rustc_index:: newtype_index! {
2254+ pub struct AttrId {
2255+ ENCODABLE = custom
2256+ DEBUG_FORMAT = "AttrId({})"
22632257 }
22642258}
22652259
22662260impl rustc_serialize:: Encodable for AttrId {
2267- fn encode < S : Encoder > ( & self , s : & mut S ) -> Result < ( ) , S :: Error > {
2268- s . emit_unit ( )
2261+ fn encode < S : Encoder > ( & self , _ : & mut S ) -> Result < ( ) , S :: Error > {
2262+ Ok ( ( ) )
22692263 }
22702264}
22712265
22722266impl rustc_serialize:: Decodable for AttrId {
2273- fn decode < D : Decoder > ( d : & mut D ) -> Result < AttrId , D :: Error > {
2274- d . read_nil ( ) . map ( |_| crate :: attr:: mk_attr_id ( ) )
2267+ fn decode < D : Decoder > ( _ : & mut D ) -> Result < AttrId , D :: Error > {
2268+ Ok ( crate :: attr:: mk_attr_id ( ) )
22752269 }
22762270}
22772271
0 commit comments