@@ -1240,16 +1240,35 @@ pub(crate) fn pretty_printing_compatibility_hack(nt: &Nonterminal, sess: &ParseS
1240
1240
if let ast:: ItemKind :: Enum ( enum_def, _) = & item. kind {
1241
1241
if let [ variant] = & * enum_def. variants {
1242
1242
if variant. ident . name == sym:: Input {
1243
- sess. buffer_lint_with_diagnostic (
1244
- & PROC_MACRO_BACK_COMPAT ,
1245
- item. ident . span ,
1246
- ast:: CRATE_NODE_ID ,
1247
- "using `procedural-masquerade` crate" ,
1248
- BuiltinLintDiagnostics :: ProcMacroBackCompat (
1249
- "The `procedural-masquerade` crate has been unnecessary since Rust 1.30.0. \
1250
- Versions of this crate below 0.1.7 will eventually stop compiling.". to_string ( ) )
1251
- ) ;
1252
- return true ;
1243
+ let filename = sess. source_map ( ) . span_to_filename ( variant. ident . span ) ;
1244
+ let filename = filename. prefer_local ( ) ;
1245
+ let filename = filename. to_string_lossy ( ) ;
1246
+ let rental_prefix = "rental-" ;
1247
+ if let Some ( pos) = filename. find ( rental_prefix) {
1248
+ let mut digits = filename[ ( pos + rental_prefix. len ( ) ) ..] . split ( "." ) ;
1249
+ // Check for a version before `0.5.6`
1250
+ if digits. next ( ) . and_then ( |d| d. parse ( ) . ok ( ) ) == Some ( 0usize )
1251
+ && digits
1252
+ . next ( )
1253
+ . and_then ( |d| d. parse ( ) . ok ( ) )
1254
+ . map_or ( false , |d : usize | d <= 5 )
1255
+ && digits
1256
+ . next ( )
1257
+ . and_then ( |d| d[ ..1 ] . parse ( ) . ok ( ) )
1258
+ . map_or ( false , |d : usize | d < 6 )
1259
+ {
1260
+ sess. buffer_lint_with_diagnostic (
1261
+ & PROC_MACRO_BACK_COMPAT ,
1262
+ item. ident . span ,
1263
+ ast:: CRATE_NODE_ID ,
1264
+ "using outdated version of `rental` crate" ,
1265
+ BuiltinLintDiagnostics :: ProcMacroBackCompat (
1266
+ "Versions of the `rental` crate below `0.5.6` will eventually stop compiling. \
1267
+ Please update to the latest version of `rental`". to_string ( ) )
1268
+ ) ;
1269
+ return true ;
1270
+ }
1271
+ }
1253
1272
}
1254
1273
}
1255
1274
}
0 commit comments