File tree 2 files changed +13
-4
lines changed
compiler/rustc_lint_defs/src
2 files changed +13
-4
lines changed Original file line number Diff line number Diff line change @@ -3803,7 +3803,7 @@ declare_lint! {
3803
3803
///
3804
3804
/// ### Example
3805
3805
///
3806
- /// ```rust,compile_fail
3806
+ /// ```rust,edition2018, compile_fail
3807
3807
/// #![deny(rust_2021_incompatible_or_patterns)]
3808
3808
///
3809
3809
/// macro_rules! match_any {
@@ -3843,7 +3843,7 @@ declare_lint! {
3843
3843
///
3844
3844
/// ### Example
3845
3845
///
3846
- /// ```rust,compile_fail
3846
+ /// ```rust,edition2018, compile_fail
3847
3847
/// #![deny(rust_2021_prelude_collisions)]
3848
3848
///
3849
3849
/// trait Foo {
Original file line number Diff line number Diff line change @@ -441,10 +441,19 @@ impl<'a> LintExtractor<'a> {
441
441
fs:: write ( & tempfile, source)
442
442
. map_err ( |e| format ! ( "failed to write {}: {}" , tempfile. display( ) , e) ) ?;
443
443
let mut cmd = Command :: new ( self . rustc_path ) ;
444
- if options. contains ( & "edition2015" ) {
444
+ if options. contains ( & "edition2024" ) {
445
+ cmd. arg ( "--edition=2024" ) ;
446
+ } else if options. contains ( & "edition2021" ) {
447
+ cmd. arg ( "--edition=2021" ) ;
448
+ } else if options. contains ( & "edition2018" ) {
449
+ cmd. arg ( "--edition=2018" ) ;
450
+ } else if options. contains ( & "edition2015" ) {
445
451
cmd. arg ( "--edition=2015" ) ;
452
+ } else if options. contains ( & "edition" ) {
453
+ panic ! ( "lint-docs: unknown edition" ) ;
446
454
} else {
447
- cmd. arg ( "--edition=2018" ) ;
455
+ // defaults to latest edition
456
+ cmd. arg ( "--edition=2021" ) ;
448
457
}
449
458
cmd. arg ( "--error-format=json" ) ;
450
459
cmd. arg ( "--target" ) . arg ( self . rustc_target ) ;
You can’t perform that action at this time.
0 commit comments