@@ -2,7 +2,7 @@ use std::convert::identity;
22
33use rustc_ast:: token:: Delimiter ;
44use rustc_ast:: tokenstream:: DelimSpan ;
5- use rustc_ast:: { AttrItem , Attribute , CRATE_NODE_ID , LitKind , ast, token} ;
5+ use rustc_ast:: { AttrItem , Attribute , LitKind , ast, token} ;
66use rustc_errors:: { Applicability , PResult , msg} ;
77use rustc_feature:: {
88 AttrSuggestionStyle , AttributeTemplate , Features , GatedCfg , find_gated_cfg, template,
@@ -78,7 +78,7 @@ pub fn parse_cfg<S: Stage>(
7878 }
7979 }
8080
81- adcx. expected_single_argument ( list. span ) ;
81+ adcx. expected_single_argument ( list. span , list . len ( ) ) ;
8282 return None ;
8383 } ;
8484 parse_cfg_entry ( cx, single) . ok ( )
@@ -93,7 +93,7 @@ pub fn parse_cfg_entry<S: Stage>(
9393 ArgParser :: List ( list) => match meta. path ( ) . word_sym ( ) {
9494 Some ( sym:: not) => {
9595 let Some ( single) = list. single ( ) else {
96- return Err ( cx. adcx ( ) . expected_single_argument ( list. span ) ) ;
96+ return Err ( cx. adcx ( ) . expected_single_argument ( list. span , list . len ( ) ) ) ;
9797 } ;
9898 CfgEntry :: Not ( Box :: new ( parse_cfg_entry ( cx, single) ?) , list. span )
9999 }
@@ -324,12 +324,13 @@ pub fn parse_cfg_attr(
324324 cfg_attr : & Attribute ,
325325 sess : & Session ,
326326 features : Option < & Features > ,
327+ lint_node_id : ast:: NodeId ,
327328) -> Option < ( CfgEntry , Vec < ( AttrItem , Span ) > ) > {
328329 match cfg_attr. get_normal_item ( ) . args . unparsed_ref ( ) . unwrap ( ) {
329330 ast:: AttrArgs :: Delimited ( ast:: DelimArgs { dspan, delim, tokens } ) if !tokens. is_empty ( ) => {
330331 check_cfg_attr_bad_delim ( & sess. psess , * dspan, * delim) ;
331332 match parse_in ( & sess. psess , tokens. clone ( ) , "`cfg_attr` input" , |p| {
332- parse_cfg_attr_internal ( p, sess, features, cfg_attr)
333+ parse_cfg_attr_internal ( p, sess, features, lint_node_id , cfg_attr)
333334 } ) {
334335 Ok ( r) => return Some ( r) ,
335336 Err ( e) => {
@@ -390,6 +391,7 @@ fn parse_cfg_attr_internal<'a>(
390391 parser : & mut Parser < ' a > ,
391392 sess : & ' a Session ,
392393 features : Option < & Features > ,
394+ lint_node_id : ast:: NodeId ,
393395 attribute : & Attribute ,
394396) -> PResult < ' a , ( CfgEntry , Vec < ( ast:: AttrItem , Span ) > ) > {
395397 // Parse cfg predicate
@@ -410,7 +412,7 @@ fn parse_cfg_attr_internal<'a>(
410412 Some ( attribute. get_normal_item ( ) . unsafety ) ,
411413 ParsedDescription :: Attribute ,
412414 pred_span,
413- CRATE_NODE_ID ,
415+ lint_node_id ,
414416 Target :: Crate ,
415417 features,
416418 ShouldEmit :: ErrorsAndLints { recovery : Recovery :: Allowed } ,
0 commit comments