@@ -2,12 +2,11 @@ use std::any::Any;
22use std:: default:: Default ;
33use std:: iter;
44use std:: path:: Component :: Prefix ;
5- use std:: path:: { Path , PathBuf } ;
5+ use std:: path:: PathBuf ;
66use std:: rc:: Rc ;
77use std:: sync:: Arc ;
88
99use rustc_ast:: attr:: MarkedAttrs ;
10- use rustc_ast:: token:: MetaVarKind ;
1110use rustc_ast:: tokenstream:: TokenStream ;
1211use rustc_ast:: visit:: { AssocCtxt , Visitor } ;
1312use rustc_ast:: { self as ast, AttrVec , Attribute , HasAttrs , Item , NodeId , PatKind , Safety } ;
@@ -22,14 +21,14 @@ use rustc_hir::limit::Limit;
2221use rustc_hir:: { Stability , find_attr} ;
2322use rustc_lint_defs:: RegisteredTools ;
2423use rustc_parse:: MACRO_ARGUMENTS ;
25- use rustc_parse:: parser:: { AllowConstBlockItems , ForceCollect , Parser } ;
24+ use rustc_parse:: parser:: Parser ;
2625use rustc_session:: Session ;
2726use rustc_session:: parse:: ParseSess ;
2827use rustc_span:: def_id:: { CrateNum , DefId , LocalDefId } ;
2928use rustc_span:: edition:: Edition ;
3029use rustc_span:: hygiene:: { AstPass , ExpnData , ExpnKind , LocalExpnId , MacroKind } ;
3130use rustc_span:: source_map:: SourceMap ;
32- use rustc_span:: { DUMMY_SP , FileName , Ident , Span , Symbol , kw, sym } ;
31+ use rustc_span:: { DUMMY_SP , Ident , Span , Symbol , kw} ;
3332use smallvec:: { SmallVec , smallvec} ;
3433use thin_vec:: ThinVec ;
3534
@@ -1421,80 +1420,3 @@ pub fn resolve_path(sess: &Session, path: impl Into<PathBuf>, span: Span) -> PRe
14211420 }
14221421 }
14231422}
1424-
1425- /// If this item looks like a specific enums from `rental`, emit a fatal error.
1426- /// See #73345 and #83125 for more details.
1427- /// FIXME(#73933): Remove this eventually.
1428- fn pretty_printing_compatibility_hack ( item : & Item , psess : & ParseSess ) {
1429- if let ast:: ItemKind :: Enum ( ident, _, enum_def) = & item. kind
1430- && ident. name == sym:: ProceduralMasqueradeDummyType
1431- && let [ variant] = & * enum_def. variants
1432- && variant. ident . name == sym:: Input
1433- && let FileName :: Real ( real) = psess. source_map ( ) . span_to_filename ( ident. span )
1434- && let Some ( c) = real
1435- . local_path ( )
1436- . unwrap_or ( Path :: new ( "" ) )
1437- . components ( )
1438- . flat_map ( |c| c. as_os_str ( ) . to_str ( ) )
1439- . find ( |c| c. starts_with ( "rental" ) || c. starts_with ( "allsorts-rental" ) )
1440- {
1441- let crate_matches = if c. starts_with ( "allsorts-rental" ) {
1442- true
1443- } else {
1444- let mut version = c. trim_start_matches ( "rental-" ) . split ( '.' ) ;
1445- version. next ( ) == Some ( "0" )
1446- && version. next ( ) == Some ( "5" )
1447- && version. next ( ) . and_then ( |c| c. parse :: < u32 > ( ) . ok ( ) ) . is_some_and ( |v| v < 6 )
1448- } ;
1449-
1450- if crate_matches {
1451- psess. dcx ( ) . emit_fatal ( errors:: ProcMacroBackCompat {
1452- crate_name : "rental" . to_string ( ) ,
1453- fixed_version : "0.5.6" . to_string ( ) ,
1454- } ) ;
1455- }
1456- }
1457- }
1458-
1459- pub ( crate ) fn ann_pretty_printing_compatibility_hack ( ann : & Annotatable , psess : & ParseSess ) {
1460- let item = match ann {
1461- Annotatable :: Item ( item) => item,
1462- Annotatable :: Stmt ( stmt) => match & stmt. kind {
1463- ast:: StmtKind :: Item ( item) => item,
1464- _ => return ,
1465- } ,
1466- _ => return ,
1467- } ;
1468- pretty_printing_compatibility_hack ( item, psess)
1469- }
1470-
1471- pub ( crate ) fn stream_pretty_printing_compatibility_hack (
1472- kind : MetaVarKind ,
1473- stream : & TokenStream ,
1474- psess : & ParseSess ,
1475- ) {
1476- let item = match kind {
1477- MetaVarKind :: Item => {
1478- let mut parser = Parser :: new ( psess, stream. clone ( ) , None ) ;
1479- // No need to collect tokens for this simple check.
1480- parser
1481- . parse_item ( ForceCollect :: No , AllowConstBlockItems :: No )
1482- . expect ( "failed to reparse item" )
1483- . expect ( "an actual item" )
1484- }
1485- MetaVarKind :: Stmt => {
1486- let mut parser = Parser :: new ( psess, stream. clone ( ) , None ) ;
1487- // No need to collect tokens for this simple check.
1488- let stmt = parser
1489- . parse_stmt ( ForceCollect :: No )
1490- . expect ( "failed to reparse" )
1491- . expect ( "an actual stmt" ) ;
1492- match & stmt. kind {
1493- ast:: StmtKind :: Item ( item) => item. clone ( ) ,
1494- _ => return ,
1495- }
1496- }
1497- _ => return ,
1498- } ;
1499- pretty_printing_compatibility_hack ( & item, psess)
1500- }
0 commit comments