introduce fcw macro
This commit is contained in:
parent
d5525a7300
commit
0eed5ab550
12 changed files with 197 additions and 158 deletions
|
|
@ -35,9 +35,9 @@ use rustc_middle::lint::LevelAndSource;
|
|||
use rustc_middle::ty::layout::LayoutOf;
|
||||
use rustc_middle::ty::print::with_no_trimmed_paths;
|
||||
use rustc_middle::ty::{self, AssocContainer, Ty, TyCtxt, TypeVisitableExt, Upcast, VariantDef};
|
||||
use rustc_session::lint::FutureIncompatibilityReason;
|
||||
// hardwired lints from rustc_lint_defs
|
||||
pub use rustc_session::lint::builtin::*;
|
||||
use rustc_session::lint::fcw;
|
||||
use rustc_session::{declare_lint, declare_lint_pass, impl_lint_pass};
|
||||
use rustc_span::edition::Edition;
|
||||
use rustc_span::source_map::Spanned;
|
||||
|
|
@ -777,8 +777,7 @@ declare_lint! {
|
|||
Warn,
|
||||
"detects anonymous parameters",
|
||||
@future_incompatible = FutureIncompatibleInfo {
|
||||
reason: FutureIncompatibilityReason::EditionError(Edition::Edition2018),
|
||||
reference: "issue #41686 <https://github.com/rust-lang/rust/issues/41686>",
|
||||
reason: fcw!(EditionError 2018 "trait-fn-parameters"),
|
||||
};
|
||||
}
|
||||
|
||||
|
|
@ -1664,8 +1663,7 @@ declare_lint! {
|
|||
Warn,
|
||||
"`...` range patterns are deprecated",
|
||||
@future_incompatible = FutureIncompatibleInfo {
|
||||
reason: FutureIncompatibilityReason::EditionError(Edition::Edition2021),
|
||||
reference: "<https://doc.rust-lang.org/edition-guide/rust-2021/warnings-promoted-to-error.html>",
|
||||
reason: fcw!(EditionError 2021 "warnings-promoted-to-error"),
|
||||
};
|
||||
}
|
||||
|
||||
|
|
@ -1800,8 +1798,7 @@ declare_lint! {
|
|||
Allow,
|
||||
"detects edition keywords being used as an identifier",
|
||||
@future_incompatible = FutureIncompatibleInfo {
|
||||
reason: FutureIncompatibilityReason::EditionError(Edition::Edition2018),
|
||||
reference: "issue #49716 <https://github.com/rust-lang/rust/issues/49716>",
|
||||
reason: fcw!(EditionError 2018 "new-keywords"),
|
||||
};
|
||||
}
|
||||
|
||||
|
|
@ -1845,8 +1842,7 @@ declare_lint! {
|
|||
Allow,
|
||||
"detects edition keywords being used as an identifier",
|
||||
@future_incompatible = FutureIncompatibleInfo {
|
||||
reason: FutureIncompatibilityReason::EditionError(Edition::Edition2024),
|
||||
reference: "<https://doc.rust-lang.org/edition-guide/rust-2024/gen-keyword.html>",
|
||||
reason: fcw!(EditionError 2024 "gen-keyword"),
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -11,9 +11,8 @@ use rustc_middle::ty::significant_drop_order::{
|
|||
extract_component_with_significant_dtor, ty_dtor_span,
|
||||
};
|
||||
use rustc_middle::ty::{self, Ty, TyCtxt};
|
||||
use rustc_session::lint::{FutureIncompatibilityReason, LintId};
|
||||
use rustc_session::lint::{LintId, fcw};
|
||||
use rustc_session::{declare_lint, impl_lint_pass};
|
||||
use rustc_span::edition::Edition;
|
||||
use rustc_span::{DUMMY_SP, Span};
|
||||
use smallvec::SmallVec;
|
||||
|
||||
|
|
@ -86,8 +85,7 @@ declare_lint! {
|
|||
"`if let` assigns a shorter lifetime to temporary values being pattern-matched against in Edition 2024 and \
|
||||
rewriting in `match` is an option to preserve the semantics up to Edition 2021",
|
||||
@future_incompatible = FutureIncompatibleInfo {
|
||||
reason: FutureIncompatibilityReason::EditionSemanticsChange(Edition::Edition2024),
|
||||
reference: "<https://doc.rust-lang.org/edition-guide/rust-2024/temporary-if-let-scope.html>",
|
||||
reason: fcw!(EditionSemanticsChange 2024 "temporary-if-let-scope"),
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -19,9 +19,8 @@ use rustc_middle::ty::{
|
|||
self, Ty, TyCtxt, TypeSuperVisitable, TypeVisitable, TypeVisitableExt, TypeVisitor,
|
||||
};
|
||||
use rustc_middle::{bug, span_bug};
|
||||
use rustc_session::lint::FutureIncompatibilityReason;
|
||||
use rustc_session::lint::fcw;
|
||||
use rustc_session::{declare_lint, declare_lint_pass};
|
||||
use rustc_span::edition::Edition;
|
||||
use rustc_span::{Span, Symbol};
|
||||
use rustc_trait_selection::errors::{
|
||||
AddPreciseCapturingForOvercapture, impl_trait_overcapture_suggestion,
|
||||
|
|
@ -71,8 +70,7 @@ declare_lint! {
|
|||
Allow,
|
||||
"`impl Trait` will capture more lifetimes than possibly intended in edition 2024",
|
||||
@future_incompatible = FutureIncompatibleInfo {
|
||||
reason: FutureIncompatibilityReason::EditionSemanticsChange(Edition::Edition2024),
|
||||
reference: "<https://doc.rust-lang.org/edition-guide/rust-2024/rpit-lifetime-capture.html>",
|
||||
reason: fcw!(EditionSemanticsChange 2024 "rpit-lifetime-capture"),
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
use rustc_ast::token::{Token, TokenKind};
|
||||
use rustc_ast::tokenstream::{TokenStream, TokenTree};
|
||||
use rustc_session::lint::FutureIncompatibilityReason;
|
||||
use rustc_session::lint::fcw;
|
||||
use rustc_session::{declare_lint, declare_lint_pass};
|
||||
use rustc_span::edition::Edition;
|
||||
use rustc_span::sym;
|
||||
|
|
@ -72,8 +72,7 @@ declare_lint! {
|
|||
"The `expr` fragment specifier will accept more expressions in the 2024 edition. \
|
||||
To keep the existing behavior, use the `expr_2021` fragment specifier.",
|
||||
@future_incompatible = FutureIncompatibleInfo {
|
||||
reason: FutureIncompatibilityReason::EditionSemanticsChange(Edition::Edition2024),
|
||||
reference: "Migration Guide <https://doc.rust-lang.org/edition-guide/rust-2024/macro-fragment-specifiers.html>",
|
||||
reason: fcw!(EditionSemanticsChange 2024 "macro-fragment-specifiers"),
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -4,9 +4,8 @@ use rustc_hir::{self as hir, LangItem};
|
|||
use rustc_infer::infer::TyCtxtInferExt;
|
||||
use rustc_middle::{bug, ty};
|
||||
use rustc_parse_format::{ParseMode, Parser, Piece};
|
||||
use rustc_session::lint::FutureIncompatibilityReason;
|
||||
use rustc_session::lint::fcw;
|
||||
use rustc_session::{declare_lint, declare_lint_pass};
|
||||
use rustc_span::edition::Edition;
|
||||
use rustc_span::{InnerSpan, Span, Symbol, hygiene, sym};
|
||||
use rustc_trait_selection::infer::InferCtxtExt;
|
||||
|
||||
|
|
@ -38,7 +37,7 @@ declare_lint! {
|
|||
Warn,
|
||||
"detect single-argument panic!() invocations in which the argument is not a format string",
|
||||
@future_incompatible = FutureIncompatibleInfo {
|
||||
reason: FutureIncompatibilityReason::EditionSemanticsChange(Edition::Edition2021),
|
||||
reason: fcw!(EditionSemanticsChange 2021 "panic-macro-consistency"),
|
||||
explain_reason: false,
|
||||
};
|
||||
report_in_external_macro
|
||||
|
|
|
|||
|
|
@ -1,8 +1,7 @@
|
|||
use rustc_hir::{self as hir, LangItem};
|
||||
use rustc_middle::ty::{self, Ty};
|
||||
use rustc_session::lint::FutureIncompatibilityReason;
|
||||
use rustc_session::lint::fcw;
|
||||
use rustc_session::{declare_lint, impl_lint_pass};
|
||||
use rustc_span::edition::Edition;
|
||||
|
||||
use crate::lints::{ShadowedIntoIterDiag, ShadowedIntoIterDiagSub};
|
||||
use crate::{LateContext, LateLintPass, LintContext};
|
||||
|
|
@ -31,8 +30,7 @@ declare_lint! {
|
|||
Warn,
|
||||
"detects calling `into_iter` on arrays in Rust 2015 and 2018",
|
||||
@future_incompatible = FutureIncompatibleInfo {
|
||||
reason: FutureIncompatibilityReason::EditionSemanticsChange(Edition::Edition2021),
|
||||
reference: "<https://doc.rust-lang.org/edition-guide/rust-2021/IntoIterator-for-arrays.html>",
|
||||
reason: fcw!(EditionSemanticsChange 2021 "IntoIterator-for-arrays"),
|
||||
};
|
||||
}
|
||||
|
||||
|
|
@ -60,8 +58,7 @@ declare_lint! {
|
|||
Warn,
|
||||
"detects calling `into_iter` on boxed slices in Rust 2015, 2018, and 2021",
|
||||
@future_incompatible = FutureIncompatibleInfo {
|
||||
reason: FutureIncompatibilityReason::EditionSemanticsChange(Edition::Edition2024),
|
||||
reference: "<https://doc.rust-lang.org/edition-guide/rust-2024/intoiterator-box-slice.html>"
|
||||
reason: fcw!(EditionSemanticsChange 2024 "intoiterator-box-slice"),
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,9 +1,8 @@
|
|||
use rustc_hir as hir;
|
||||
use rustc_hir::{Expr, Stmt};
|
||||
use rustc_middle::ty::{Mutability, TyKind};
|
||||
use rustc_session::lint::FutureIncompatibilityReason;
|
||||
use rustc_session::lint::fcw;
|
||||
use rustc_session::{declare_lint, declare_lint_pass};
|
||||
use rustc_span::edition::Edition;
|
||||
use rustc_span::{BytePos, Span};
|
||||
|
||||
use crate::lints::{MutRefSugg, RefOfMutStatic};
|
||||
|
|
@ -53,8 +52,7 @@ declare_lint! {
|
|||
Warn,
|
||||
"creating a shared reference to mutable static",
|
||||
@future_incompatible = FutureIncompatibleInfo {
|
||||
reason: FutureIncompatibilityReason::EditionError(Edition::Edition2024),
|
||||
reference: "<https://doc.rust-lang.org/edition-guide/rust-2024/static-mut-references.html>",
|
||||
reason: fcw!(EditionError 2024 "static-mut-references"),
|
||||
explain_reason: false,
|
||||
};
|
||||
@edition Edition2024 => Deny;
|
||||
|
|
|
|||
|
|
@ -7,9 +7,7 @@
|
|||
//! When removing a lint, make sure to also add a call to `register_removed` in
|
||||
//! compiler/rustc_lint/src/lib.rs.
|
||||
|
||||
use rustc_span::edition::Edition;
|
||||
|
||||
use crate::{FutureIncompatibilityReason, declare_lint, declare_lint_pass};
|
||||
use crate::{declare_lint, declare_lint_pass, fcw};
|
||||
|
||||
declare_lint_pass! {
|
||||
/// Does nothing as a lint pass, but registers some `Lint`s
|
||||
|
|
@ -182,8 +180,7 @@ declare_lint! {
|
|||
Warn,
|
||||
"applying forbid to lint-groups",
|
||||
@future_incompatible = FutureIncompatibleInfo {
|
||||
reason: FutureIncompatibilityReason::FutureReleaseError,
|
||||
reference: "issue #81670 <https://github.com/rust-lang/rust/issues/81670>",
|
||||
reason: fcw!(FutureReleaseError #81670),
|
||||
report_in_deps: true,
|
||||
};
|
||||
}
|
||||
|
|
@ -219,8 +216,7 @@ declare_lint! {
|
|||
Deny,
|
||||
"ill-formed attribute inputs that were previously accepted and used in practice",
|
||||
@future_incompatible = FutureIncompatibleInfo {
|
||||
reason: FutureIncompatibilityReason::FutureReleaseError,
|
||||
reference: "issue #57571 <https://github.com/rust-lang/rust/issues/57571>",
|
||||
reason: fcw!(FutureReleaseError #57571),
|
||||
report_in_deps: true,
|
||||
};
|
||||
crate_level_only
|
||||
|
|
@ -257,8 +253,7 @@ declare_lint! {
|
|||
Deny,
|
||||
"conflicts between `#[repr(..)]` hints that were previously accepted and used in practice",
|
||||
@future_incompatible = FutureIncompatibleInfo {
|
||||
reason: FutureIncompatibilityReason::FutureReleaseError,
|
||||
reference: "issue #68585 <https://github.com/rust-lang/rust/issues/68585>",
|
||||
reason: fcw!(FutureReleaseError #68585),
|
||||
report_in_deps: true,
|
||||
};
|
||||
}
|
||||
|
|
@ -1267,8 +1262,7 @@ declare_lint! {
|
|||
Deny,
|
||||
"detect public re-exports of private extern crates",
|
||||
@future_incompatible = FutureIncompatibleInfo {
|
||||
reason: FutureIncompatibilityReason::FutureReleaseError,
|
||||
reference: "issue #127909 <https://github.com/rust-lang/rust/issues/127909>",
|
||||
reason: fcw!(FutureReleaseError #127909),
|
||||
report_in_deps: true,
|
||||
};
|
||||
}
|
||||
|
|
@ -1298,8 +1292,7 @@ declare_lint! {
|
|||
Deny,
|
||||
"type parameter default erroneously allowed in invalid location",
|
||||
@future_incompatible = FutureIncompatibleInfo {
|
||||
reason: FutureIncompatibilityReason::FutureReleaseError,
|
||||
reference: "issue #36887 <https://github.com/rust-lang/rust/issues/36887>",
|
||||
reason: fcw!(FutureReleaseError #36887),
|
||||
report_in_deps: true,
|
||||
};
|
||||
}
|
||||
|
|
@ -1438,8 +1431,7 @@ declare_lint! {
|
|||
Deny,
|
||||
"patterns in functions without body were erroneously allowed",
|
||||
@future_incompatible = FutureIncompatibleInfo {
|
||||
reason: FutureIncompatibilityReason::FutureReleaseError,
|
||||
reference: "issue #35203 <https://github.com/rust-lang/rust/issues/35203>",
|
||||
reason: fcw!(FutureReleaseError #35203),
|
||||
};
|
||||
}
|
||||
|
||||
|
|
@ -1480,8 +1472,7 @@ declare_lint! {
|
|||
Warn,
|
||||
"detects generic lifetime arguments in path segments with late bound lifetime parameters",
|
||||
@future_incompatible = FutureIncompatibleInfo {
|
||||
reason: FutureIncompatibilityReason::FutureReleaseError,
|
||||
reference: "issue #42868 <https://github.com/rust-lang/rust/issues/42868>",
|
||||
reason: fcw!(FutureReleaseError #42868),
|
||||
};
|
||||
}
|
||||
|
||||
|
|
@ -1520,8 +1511,7 @@ declare_lint! {
|
|||
Warn,
|
||||
"distinct impls distinguished only by the leak-check code",
|
||||
@future_incompatible = FutureIncompatibleInfo {
|
||||
reason: FutureIncompatibilityReason::Custom("the behavior may change in a future release"),
|
||||
reference: "issue #56105 <https://github.com/rust-lang/rust/issues/56105>",
|
||||
reason: fcw!("the behavior may change in a future release" #56105),
|
||||
};
|
||||
}
|
||||
|
||||
|
|
@ -1624,8 +1614,7 @@ declare_lint! {
|
|||
Allow,
|
||||
"detects patterns whose meaning will change in Rust 2024",
|
||||
@future_incompatible = FutureIncompatibleInfo {
|
||||
reason: FutureIncompatibilityReason::EditionSemanticsChange(Edition::Edition2024),
|
||||
reference: "<https://doc.rust-lang.org/edition-guide/rust-2024/match-ergonomics.html>",
|
||||
reason: fcw!(EditionSemanticsChange 2024 "match-ergonomics"),
|
||||
};
|
||||
}
|
||||
|
||||
|
|
@ -1772,8 +1761,7 @@ declare_lint! {
|
|||
Warn,
|
||||
"raw pointer to an inference variable",
|
||||
@future_incompatible = FutureIncompatibleInfo {
|
||||
reason: FutureIncompatibilityReason::EditionError(Edition::Edition2018),
|
||||
reference: "issue #46906 <https://github.com/rust-lang/rust/issues/46906>",
|
||||
reason: fcw!(EditionError 2018 "tyvar-behind-raw-pointer"),
|
||||
};
|
||||
}
|
||||
|
||||
|
|
@ -1839,8 +1827,7 @@ declare_lint! {
|
|||
Warn,
|
||||
"suggest using `dyn Trait` for trait objects",
|
||||
@future_incompatible = FutureIncompatibleInfo {
|
||||
reason: FutureIncompatibilityReason::EditionError(Edition::Edition2021),
|
||||
reference: "<https://doc.rust-lang.org/edition-guide/rust-2021/warnings-promoted-to-error.html>",
|
||||
reason: fcw!(EditionError 2021 "warnings-promoted-to-error"),
|
||||
};
|
||||
}
|
||||
|
||||
|
|
@ -1894,8 +1881,7 @@ declare_lint! {
|
|||
"fully qualified paths that start with a module name \
|
||||
instead of `crate`, `self`, or an extern crate name",
|
||||
@future_incompatible = FutureIncompatibleInfo {
|
||||
reason: FutureIncompatibilityReason::EditionError(Edition::Edition2018),
|
||||
reference: "issue #53130 <https://github.com/rust-lang/rust/issues/53130>",
|
||||
reason: fcw!(EditionError 2018 "path-changes"),
|
||||
};
|
||||
}
|
||||
|
||||
|
|
@ -1942,11 +1928,11 @@ declare_lint! {
|
|||
Warn,
|
||||
"detects name collision with an existing but unstable method",
|
||||
@future_incompatible = FutureIncompatibleInfo {
|
||||
reason: FutureIncompatibilityReason::Custom(
|
||||
reason: fcw!(
|
||||
"once this associated item is added to the standard library, \
|
||||
the ambiguity may cause an error or change in behavior!"
|
||||
#48919
|
||||
),
|
||||
reference: "issue #48919 <https://github.com/rust-lang/rust/issues/48919>",
|
||||
// Note: this item represents future incompatibility of all unstable functions in the
|
||||
// standard library, and thus should never be removed or changed to an error.
|
||||
};
|
||||
|
|
@ -2075,8 +2061,7 @@ declare_lint! {
|
|||
Deny,
|
||||
"detects proc macro derives using inaccessible names from parent modules",
|
||||
@future_incompatible = FutureIncompatibleInfo {
|
||||
reason: FutureIncompatibilityReason::FutureReleaseError,
|
||||
reference: "issue #83583 <https://github.com/rust-lang/rust/issues/83583>",
|
||||
reason: fcw!(FutureReleaseError #83583),
|
||||
report_in_deps: true,
|
||||
};
|
||||
}
|
||||
|
|
@ -2179,8 +2164,7 @@ declare_lint! {
|
|||
"macro-expanded `macro_export` macros from the current crate \
|
||||
cannot be referred to by absolute paths",
|
||||
@future_incompatible = FutureIncompatibleInfo {
|
||||
reason: FutureIncompatibilityReason::FutureReleaseError,
|
||||
reference: "issue #52234 <https://github.com/rust-lang/rust/issues/52234>",
|
||||
reason: fcw!(FutureReleaseError #52234),
|
||||
report_in_deps: true,
|
||||
};
|
||||
crate_level_only
|
||||
|
|
@ -2301,8 +2285,7 @@ declare_lint! {
|
|||
Deny,
|
||||
"ambiguous associated items",
|
||||
@future_incompatible = FutureIncompatibleInfo {
|
||||
reason: FutureIncompatibilityReason::FutureReleaseError,
|
||||
reference: "issue #57644 <https://github.com/rust-lang/rust/issues/57644>",
|
||||
reason: fcw!(FutureReleaseError #57644),
|
||||
};
|
||||
}
|
||||
|
||||
|
|
@ -2317,8 +2300,7 @@ declare_lint! {
|
|||
Deny,
|
||||
"a feature gate that doesn't break dependent crates",
|
||||
@future_incompatible = FutureIncompatibleInfo {
|
||||
reason: FutureIncompatibilityReason::FutureReleaseError,
|
||||
reference: "issue #64266 <https://github.com/rust-lang/rust/issues/64266>",
|
||||
reason: fcw!(FutureReleaseError #64266),
|
||||
report_in_deps: true,
|
||||
};
|
||||
}
|
||||
|
|
@ -2529,8 +2511,7 @@ declare_lint! {
|
|||
Allow,
|
||||
"unsafe operations in unsafe functions without an explicit unsafe block are deprecated",
|
||||
@future_incompatible = FutureIncompatibleInfo {
|
||||
reason: FutureIncompatibilityReason::EditionSemanticsChange(Edition::Edition2024),
|
||||
reference: "<https://doc.rust-lang.org/edition-guide/rust-2024/unsafe-op-in-unsafe-fn.html>",
|
||||
reason: fcw!(EditionError 2024 "unsafe-op-in-unsafe-fn"),
|
||||
explain_reason: false
|
||||
};
|
||||
@edition Edition2024 => Warn;
|
||||
|
|
@ -2661,8 +2642,7 @@ declare_lint! {
|
|||
Warn,
|
||||
"detects a generic constant is used in a type without a emitting a warning",
|
||||
@future_incompatible = FutureIncompatibleInfo {
|
||||
reason: FutureIncompatibilityReason::FutureReleaseError,
|
||||
reference: "issue #76200 <https://github.com/rust-lang/rust/issues/76200>",
|
||||
reason: fcw!(FutureReleaseError #76200),
|
||||
};
|
||||
}
|
||||
|
||||
|
|
@ -2720,8 +2700,7 @@ declare_lint! {
|
|||
Warn,
|
||||
"uninhabited static",
|
||||
@future_incompatible = FutureIncompatibleInfo {
|
||||
reason: FutureIncompatibilityReason::FutureReleaseError,
|
||||
reference: "issue #74840 <https://github.com/rust-lang/rust/issues/74840>",
|
||||
reason: fcw!(FutureReleaseError #74840),
|
||||
};
|
||||
}
|
||||
|
||||
|
|
@ -2853,8 +2832,7 @@ declare_lint! {
|
|||
Warn,
|
||||
"detect unsupported use of `Self` from outer item",
|
||||
@future_incompatible = FutureIncompatibleInfo {
|
||||
reason: FutureIncompatibilityReason::FutureReleaseError,
|
||||
reference: "issue #124186 <https://github.com/rust-lang/rust/issues/124186>",
|
||||
reason: fcw!(FutureReleaseError #124186),
|
||||
};
|
||||
}
|
||||
|
||||
|
|
@ -2899,8 +2877,7 @@ declare_lint! {
|
|||
Deny,
|
||||
"trailing semicolon in macro body used as expression",
|
||||
@future_incompatible = FutureIncompatibleInfo {
|
||||
reason: FutureIncompatibilityReason::FutureReleaseError,
|
||||
reference: "issue #79813 <https://github.com/rust-lang/rust/issues/79813>",
|
||||
reason: fcw!(FutureReleaseError #79813),
|
||||
report_in_deps: true,
|
||||
};
|
||||
}
|
||||
|
|
@ -2947,8 +2924,7 @@ declare_lint! {
|
|||
Deny,
|
||||
"detects derive helper attributes that are used before they are introduced",
|
||||
@future_incompatible = FutureIncompatibleInfo {
|
||||
reason: FutureIncompatibilityReason::FutureReleaseError,
|
||||
reference: "issue #79202 <https://github.com/rust-lang/rust/issues/79202>",
|
||||
reason: fcw!(FutureReleaseError #79202),
|
||||
report_in_deps: true,
|
||||
};
|
||||
}
|
||||
|
|
@ -3131,8 +3107,7 @@ declare_lint! {
|
|||
Deny,
|
||||
"transparent type contains an external ZST that is marked #[non_exhaustive] or contains private fields",
|
||||
@future_incompatible = FutureIncompatibleInfo {
|
||||
reason: FutureIncompatibilityReason::FutureReleaseError,
|
||||
reference: "issue #78586 <https://github.com/rust-lang/rust/issues/78586>",
|
||||
reason: fcw!(FutureReleaseError #78586),
|
||||
report_in_deps: true,
|
||||
};
|
||||
}
|
||||
|
|
@ -3183,8 +3158,7 @@ declare_lint! {
|
|||
Warn,
|
||||
"unstable syntax can change at any point in the future, causing a hard error!",
|
||||
@future_incompatible = FutureIncompatibleInfo {
|
||||
reason: FutureIncompatibilityReason::FutureReleaseError,
|
||||
reference: "issue #65860 <https://github.com/rust-lang/rust/issues/65860>",
|
||||
reason: fcw!(FutureReleaseError #65860),
|
||||
};
|
||||
}
|
||||
|
||||
|
|
@ -3425,7 +3399,7 @@ declare_lint! {
|
|||
Allow,
|
||||
"detects closures affected by Rust 2021 changes",
|
||||
@future_incompatible = FutureIncompatibleInfo {
|
||||
reason: FutureIncompatibilityReason::EditionSemanticsChange(Edition::Edition2021),
|
||||
reason: fcw!(EditionSemanticsChange 2021 "disjoint-capture-in-closures"),
|
||||
explain_reason: false,
|
||||
};
|
||||
}
|
||||
|
|
@ -3520,8 +3494,7 @@ declare_lint! {
|
|||
Allow,
|
||||
"detects usage of old versions of or-patterns",
|
||||
@future_incompatible = FutureIncompatibleInfo {
|
||||
reason: FutureIncompatibilityReason::EditionError(Edition::Edition2021),
|
||||
reference: "<https://doc.rust-lang.org/edition-guide/rust-2021/or-patterns-macro-rules.html>",
|
||||
reason: fcw!(EditionError 2021 "or-patterns-macro-rules"),
|
||||
};
|
||||
}
|
||||
|
||||
|
|
@ -3569,8 +3542,7 @@ declare_lint! {
|
|||
"detects the usage of trait methods which are ambiguous with traits added to the \
|
||||
prelude in future editions",
|
||||
@future_incompatible = FutureIncompatibleInfo {
|
||||
reason: FutureIncompatibilityReason::EditionError(Edition::Edition2021),
|
||||
reference: "<https://doc.rust-lang.org/edition-guide/rust-2021/prelude.html>",
|
||||
reason: fcw!(EditionError 2021 "prelude"),
|
||||
};
|
||||
}
|
||||
|
||||
|
|
@ -3609,8 +3581,7 @@ declare_lint! {
|
|||
"detects the usage of trait methods which are ambiguous with traits added to the \
|
||||
prelude in future editions",
|
||||
@future_incompatible = FutureIncompatibleInfo {
|
||||
reason: FutureIncompatibilityReason::EditionError(Edition::Edition2024),
|
||||
reference: "<https://doc.rust-lang.org/edition-guide/rust-2024/prelude.html>",
|
||||
reason: fcw!(EditionError 2024 "prelude"),
|
||||
};
|
||||
}
|
||||
|
||||
|
|
@ -3646,8 +3617,7 @@ declare_lint! {
|
|||
Allow,
|
||||
"identifiers that will be parsed as a prefix in Rust 2021",
|
||||
@future_incompatible = FutureIncompatibleInfo {
|
||||
reason: FutureIncompatibilityReason::EditionError(Edition::Edition2021),
|
||||
reference: "<https://doc.rust-lang.org/edition-guide/rust-2021/reserving-syntax.html>",
|
||||
reason: fcw!(EditionError 2021 "reserving-syntax"),
|
||||
};
|
||||
crate_level_only
|
||||
}
|
||||
|
|
@ -3694,9 +3664,8 @@ declare_lint! {
|
|||
Warn,
|
||||
"use of unsupported calling convention",
|
||||
@future_incompatible = FutureIncompatibleInfo {
|
||||
reason: FutureIncompatibilityReason::FutureReleaseError,
|
||||
reason: fcw!(FutureReleaseError #137018),
|
||||
report_in_deps: false,
|
||||
reference: "issue #137018 <https://github.com/rust-lang/rust/issues/137018>",
|
||||
};
|
||||
}
|
||||
|
||||
|
|
@ -3739,8 +3708,7 @@ declare_lint! {
|
|||
Warn,
|
||||
"use of unsupported calling convention for function pointer",
|
||||
@future_incompatible = FutureIncompatibleInfo {
|
||||
reason: FutureIncompatibilityReason::FutureReleaseError,
|
||||
reference: "issue #130260 <https://github.com/rust-lang/rust/issues/130260>",
|
||||
reason: fcw!(FutureReleaseError #130260),
|
||||
report_in_deps: true,
|
||||
};
|
||||
}
|
||||
|
|
@ -4174,8 +4142,7 @@ declare_lint! {
|
|||
Deny,
|
||||
"never type fallback affecting unsafe function calls",
|
||||
@future_incompatible = FutureIncompatibleInfo {
|
||||
reason: FutureIncompatibilityReason::EditionAndFutureReleaseSemanticsChange(Edition::Edition2024),
|
||||
reference: "<https://doc.rust-lang.org/edition-guide/rust-2024/never-type-fallback.html>",
|
||||
reason: fcw!(EditionAndFutureReleaseSemanticsChange 2024 "never-type-fallback"),
|
||||
report_in_deps: true,
|
||||
};
|
||||
@edition Edition2024 => Deny;
|
||||
|
|
@ -4229,8 +4196,7 @@ declare_lint! {
|
|||
Deny,
|
||||
"never type fallback affecting unsafe function calls",
|
||||
@future_incompatible = FutureIncompatibleInfo {
|
||||
reason: FutureIncompatibilityReason::EditionAndFutureReleaseError(Edition::Edition2024),
|
||||
reference: "<https://doc.rust-lang.org/edition-guide/rust-2024/never-type-fallback.html>",
|
||||
reason: fcw!(EditionAndFutureReleaseError 2024 "never-type-fallback"),
|
||||
report_in_deps: true,
|
||||
};
|
||||
report_in_external_macro
|
||||
|
|
@ -4265,8 +4231,7 @@ declare_lint! {
|
|||
Deny,
|
||||
"\"invalid_parameter\" isn't a valid argument for `#[macro_export]`",
|
||||
@future_incompatible = FutureIncompatibleInfo {
|
||||
reason: FutureIncompatibilityReason::FutureReleaseError,
|
||||
reference: "issue #57571 <https://github.com/rust-lang/rust/issues/57571>",
|
||||
reason: fcw!(FutureReleaseError #57571),
|
||||
report_in_deps: true,
|
||||
};
|
||||
}
|
||||
|
|
@ -4503,8 +4468,7 @@ declare_lint! {
|
|||
Deny,
|
||||
"detects certain glob imports that require reporting an ambiguity error",
|
||||
@future_incompatible = FutureIncompatibleInfo {
|
||||
reason: FutureIncompatibilityReason::FutureReleaseError,
|
||||
reference: "issue #114095 <https://github.com/rust-lang/rust/issues/114095>",
|
||||
reason: fcw!(FutureReleaseError #114095),
|
||||
report_in_deps: true,
|
||||
};
|
||||
}
|
||||
|
|
@ -4659,8 +4623,7 @@ declare_lint! {
|
|||
Deny,
|
||||
"elided lifetimes cannot be used in associated constants in impls",
|
||||
@future_incompatible = FutureIncompatibleInfo {
|
||||
reason: FutureIncompatibilityReason::FutureReleaseError,
|
||||
reference: "issue #115010 <https://github.com/rust-lang/rust/issues/115010>",
|
||||
reason: fcw!(FutureReleaseError #115010),
|
||||
};
|
||||
}
|
||||
|
||||
|
|
@ -4706,8 +4669,7 @@ declare_lint! {
|
|||
Deny,
|
||||
"detects certain macro bindings that should not be re-exported",
|
||||
@future_incompatible = FutureIncompatibleInfo {
|
||||
reason: FutureIncompatibilityReason::FutureReleaseError,
|
||||
reference: "issue #120192 <https://github.com/rust-lang/rust/issues/120192>",
|
||||
reason: fcw!(FutureReleaseError #120192),
|
||||
report_in_deps: true,
|
||||
};
|
||||
}
|
||||
|
|
@ -4772,8 +4734,7 @@ declare_lint! {
|
|||
Warn,
|
||||
"impl contains type parameters that are not covered",
|
||||
@future_incompatible = FutureIncompatibleInfo {
|
||||
reason: FutureIncompatibilityReason::FutureReleaseError,
|
||||
reference: "issue #124559 <https://github.com/rust-lang/rust/issues/124559>",
|
||||
reason: fcw!(FutureReleaseError #124559),
|
||||
};
|
||||
}
|
||||
|
||||
|
|
@ -4820,8 +4781,7 @@ declare_lint! {
|
|||
Allow,
|
||||
"detects unsafe functions being used as safe functions",
|
||||
@future_incompatible = FutureIncompatibleInfo {
|
||||
reason: FutureIncompatibilityReason::EditionError(Edition::Edition2024),
|
||||
reference: "<https://doc.rust-lang.org/edition-guide/rust-2024/newly-unsafe-functions.html>",
|
||||
reason: fcw!(EditionError 2024 "newly-unsafe-functions"),
|
||||
};
|
||||
}
|
||||
|
||||
|
|
@ -4856,8 +4816,7 @@ declare_lint! {
|
|||
Allow,
|
||||
"detects missing unsafe keyword on extern declarations",
|
||||
@future_incompatible = FutureIncompatibleInfo {
|
||||
reason: FutureIncompatibilityReason::EditionError(Edition::Edition2024),
|
||||
reference: "<https://doc.rust-lang.org/edition-guide/rust-2024/unsafe-extern.html>",
|
||||
reason: fcw!(EditionError 2024 "unsafe-extern"),
|
||||
};
|
||||
}
|
||||
|
||||
|
|
@ -4897,8 +4856,7 @@ declare_lint! {
|
|||
Allow,
|
||||
"detects unsafe attributes outside of unsafe",
|
||||
@future_incompatible = FutureIncompatibleInfo {
|
||||
reason: FutureIncompatibilityReason::EditionError(Edition::Edition2024),
|
||||
reference: "<https://doc.rust-lang.org/edition-guide/rust-2024/unsafe-attributes.html>",
|
||||
reason: fcw!(EditionError 2024 "unsafe-attributes"),
|
||||
};
|
||||
}
|
||||
|
||||
|
|
@ -4936,8 +4894,7 @@ declare_lint! {
|
|||
Deny,
|
||||
"detects out of scope calls to `macro_rules` in key-value attributes",
|
||||
@future_incompatible = FutureIncompatibleInfo {
|
||||
reason: FutureIncompatibilityReason::FutureReleaseError,
|
||||
reference: "issue #124535 <https://github.com/rust-lang/rust/issues/124535>",
|
||||
reason: fcw!(FutureReleaseError #124535),
|
||||
report_in_deps: true,
|
||||
};
|
||||
}
|
||||
|
|
@ -5099,8 +5056,7 @@ declare_lint! {
|
|||
Allow,
|
||||
"Detect and warn on significant change in drop order in tail expression location",
|
||||
@future_incompatible = FutureIncompatibleInfo {
|
||||
reason: FutureIncompatibilityReason::EditionSemanticsChange(Edition::Edition2024),
|
||||
reference: "<https://doc.rust-lang.org/edition-guide/rust-2024/temporary-tail-expr-scope.html>",
|
||||
reason: fcw!(EditionSemanticsChange 2024 "temporary-tail-expr-scope"),
|
||||
};
|
||||
}
|
||||
|
||||
|
|
@ -5138,8 +5094,7 @@ declare_lint! {
|
|||
Allow,
|
||||
"will be parsed as a guarded string in Rust 2024",
|
||||
@future_incompatible = FutureIncompatibleInfo {
|
||||
reason: FutureIncompatibilityReason::EditionError(Edition::Edition2024),
|
||||
reference: "<https://doc.rust-lang.org/edition-guide/rust-2024/reserved-syntax.html>",
|
||||
reason: fcw!(EditionError 2024 "reserved-syntax"),
|
||||
};
|
||||
crate_level_only
|
||||
}
|
||||
|
|
@ -5180,8 +5135,7 @@ declare_lint! {
|
|||
Warn,
|
||||
"detects code that could be affected by ABI issues on aarch64 softfloat targets",
|
||||
@future_incompatible = FutureIncompatibleInfo {
|
||||
reason: FutureIncompatibilityReason::FutureReleaseError,
|
||||
reference: "issue #134375 <https://github.com/rust-lang/rust/issues/134375>",
|
||||
reason: fcw!(FutureReleaseError #134375),
|
||||
report_in_deps: true,
|
||||
};
|
||||
}
|
||||
|
|
@ -5316,8 +5270,7 @@ declare_lint! {
|
|||
Warn,
|
||||
"repr(C) enums with discriminant values that do not fit into a C int",
|
||||
@future_incompatible = FutureIncompatibleInfo {
|
||||
reason: FutureIncompatibilityReason::FutureReleaseError,
|
||||
reference: "issue #124403 <https://github.com/rust-lang/rust/issues/124403>",
|
||||
reason: fcw!(FutureReleaseError #124403),
|
||||
report_in_deps: false,
|
||||
};
|
||||
}
|
||||
|
|
@ -5363,8 +5316,7 @@ declare_lint! {
|
|||
Warn,
|
||||
"detects usage of `...` arguments without a pattern in non-foreign items",
|
||||
@future_incompatible = FutureIncompatibleInfo {
|
||||
reason: FutureIncompatibilityReason::FutureReleaseError,
|
||||
reference: "issue #145544 <https://github.com/rust-lang/rust/issues/145544>",
|
||||
reason: fcw!(FutureReleaseError #145544),
|
||||
report_in_deps: false,
|
||||
};
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
use std::borrow::Cow;
|
||||
use std::fmt::Display;
|
||||
|
||||
use rustc_ast::AttrId;
|
||||
use rustc_ast::attr::AttributeExt;
|
||||
|
|
@ -356,8 +357,6 @@ pub struct Lint {
|
|||
/// Extra information for a future incompatibility lint.
|
||||
#[derive(Copy, Clone, Debug)]
|
||||
pub struct FutureIncompatibleInfo {
|
||||
/// e.g., a URL for an issue/PR/RFC or error code
|
||||
pub reference: &'static str,
|
||||
/// The reason for the lint used by diagnostics to provide
|
||||
/// the right help message
|
||||
pub reason: FutureIncompatibilityReason,
|
||||
|
|
@ -380,6 +379,17 @@ pub struct FutureIncompatibleInfo {
|
|||
pub report_in_deps: bool,
|
||||
}
|
||||
|
||||
#[derive(Copy, Clone, Debug)]
|
||||
pub struct EditionFcw {
|
||||
pub edition: Edition,
|
||||
pub page_slug: &'static str,
|
||||
}
|
||||
|
||||
#[derive(Copy, Clone, Debug)]
|
||||
pub struct ReleaseFcw {
|
||||
pub issue_number: usize,
|
||||
}
|
||||
|
||||
/// The reason for future incompatibility
|
||||
///
|
||||
/// Future-incompatible lints come in roughly two categories:
|
||||
|
|
@ -409,14 +419,14 @@ pub enum FutureIncompatibilityReason {
|
|||
/// hard errors (and the lint removed). Preferably when there is some
|
||||
/// confidence that the number of impacted projects is very small (few
|
||||
/// should have a broken dependency in their dependency tree).
|
||||
FutureReleaseError,
|
||||
FutureReleaseError(ReleaseFcw),
|
||||
/// Code that changes meaning in some way in a
|
||||
/// future release.
|
||||
///
|
||||
/// Choose this variant when the semantics of existing code is changing,
|
||||
/// (as opposed to [`FutureIncompatibilityReason::FutureReleaseError`],
|
||||
/// which is for when code is going to be rejected in the future).
|
||||
FutureReleaseSemanticsChange,
|
||||
FutureReleaseSemanticsChange(ReleaseFcw),
|
||||
/// Previously accepted code that will become an
|
||||
/// error in the provided edition
|
||||
///
|
||||
|
|
@ -437,7 +447,7 @@ pub enum FutureIncompatibilityReason {
|
|||
/// See also [`FutureIncompatibilityReason::EditionSemanticsChange`] if
|
||||
/// you have code that is changing semantics across the edition (as
|
||||
/// opposed to being rejected).
|
||||
EditionError(Edition),
|
||||
EditionError(EditionFcw),
|
||||
/// Code that changes meaning in some way in
|
||||
/// the provided edition
|
||||
///
|
||||
|
|
@ -445,7 +455,7 @@ pub enum FutureIncompatibilityReason {
|
|||
/// except for situations where the semantics change across an edition. It
|
||||
/// slightly changes the text of the diagnostic, but is otherwise the
|
||||
/// same.
|
||||
EditionSemanticsChange(Edition),
|
||||
EditionSemanticsChange(EditionFcw),
|
||||
/// This will be an error in the provided edition *and* in a future
|
||||
/// release.
|
||||
///
|
||||
|
|
@ -455,7 +465,7 @@ pub enum FutureIncompatibilityReason {
|
|||
///
|
||||
/// [`EditionError`]: FutureIncompatibilityReason::EditionError
|
||||
/// [`FutureReleaseError`]: FutureIncompatibilityReason::FutureReleaseError
|
||||
EditionAndFutureReleaseError(Edition),
|
||||
EditionAndFutureReleaseError(EditionFcw),
|
||||
/// This will change meaning in the provided edition *and* in a future
|
||||
/// release.
|
||||
///
|
||||
|
|
@ -466,14 +476,29 @@ pub enum FutureIncompatibilityReason {
|
|||
///
|
||||
/// [`EditionSemanticsChange`]: FutureIncompatibilityReason::EditionSemanticsChange
|
||||
/// [`FutureReleaseSemanticsChange`]: FutureIncompatibilityReason::FutureReleaseSemanticsChange
|
||||
EditionAndFutureReleaseSemanticsChange(Edition),
|
||||
EditionAndFutureReleaseSemanticsChange(EditionFcw),
|
||||
/// A custom reason.
|
||||
///
|
||||
/// Choose this variant if the built-in text of the diagnostic of the
|
||||
/// other variants doesn't match your situation. This is behaviorally
|
||||
/// equivalent to
|
||||
/// [`FutureIncompatibilityReason::FutureReleaseError`].
|
||||
Custom(&'static str),
|
||||
Custom(&'static str, ReleaseFcw),
|
||||
|
||||
/// Using the declare_lint macro a reason always needs to be specified.
|
||||
/// So, this case can't actually be reached but a variant needs to exist for it.
|
||||
/// Any code panics on seeing this varaint. Do not use.
|
||||
Unreachable,
|
||||
}
|
||||
|
||||
impl FutureIncompatibleInfo {
|
||||
pub const fn default_fields_for_macro() -> Self {
|
||||
FutureIncompatibleInfo {
|
||||
reason: FutureIncompatibilityReason::Unreachable,
|
||||
explain_reason: true,
|
||||
report_in_deps: false,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl FutureIncompatibilityReason {
|
||||
|
|
@ -482,23 +507,52 @@ impl FutureIncompatibilityReason {
|
|||
Self::EditionError(e)
|
||||
| Self::EditionSemanticsChange(e)
|
||||
| Self::EditionAndFutureReleaseError(e)
|
||||
| Self::EditionAndFutureReleaseSemanticsChange(e) => Some(e),
|
||||
| Self::EditionAndFutureReleaseSemanticsChange(e) => Some(e.edition),
|
||||
|
||||
FutureIncompatibilityReason::FutureReleaseError
|
||||
| FutureIncompatibilityReason::FutureReleaseSemanticsChange
|
||||
| FutureIncompatibilityReason::Custom(_) => None,
|
||||
FutureIncompatibilityReason::FutureReleaseError(_)
|
||||
| FutureIncompatibilityReason::FutureReleaseSemanticsChange(_)
|
||||
| FutureIncompatibilityReason::Custom(_, _) => None,
|
||||
Self::Unreachable => unreachable!(),
|
||||
}
|
||||
}
|
||||
|
||||
fn fmt_reason(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
||||
match self {
|
||||
Self::FutureReleaseSemanticsChange(release_fcw)
|
||||
| Self::FutureReleaseError(release_fcw)
|
||||
| Self::Custom(_, release_fcw) => release_fcw.fmt_reason(f),
|
||||
Self::EditionError(edition_fcw)
|
||||
| Self::EditionSemanticsChange(edition_fcw)
|
||||
| Self::EditionAndFutureReleaseError(edition_fcw)
|
||||
| Self::EditionAndFutureReleaseSemanticsChange(edition_fcw) => {
|
||||
edition_fcw.fmt_reason(f)
|
||||
}
|
||||
Self::Unreachable => unreachable!(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl FutureIncompatibleInfo {
|
||||
pub const fn default_fields_for_macro() -> Self {
|
||||
FutureIncompatibleInfo {
|
||||
reference: "",
|
||||
reason: FutureIncompatibilityReason::FutureReleaseError,
|
||||
explain_reason: true,
|
||||
report_in_deps: false,
|
||||
}
|
||||
impl ReleaseFcw {
|
||||
fn fmt_reason(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
||||
let issue_number = self.issue_number;
|
||||
write!(f, "issue #{issue_number} <https://github.com/rust-lang/rust/issues/{issue_number}>")
|
||||
}
|
||||
}
|
||||
|
||||
impl EditionFcw {
|
||||
fn fmt_reason(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
||||
write!(
|
||||
f,
|
||||
"<https://doc.rust-lang.org/edition-guide/{}/{}.html>",
|
||||
match self.edition {
|
||||
Edition::Edition2015 => "rust-2015",
|
||||
Edition::Edition2018 => "rust-2018",
|
||||
Edition::Edition2021 => "rust-2021",
|
||||
Edition::Edition2024 => "rust-2024",
|
||||
Edition::EditionFuture => "future",
|
||||
},
|
||||
self.page_slug,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -901,3 +955,53 @@ macro_rules! declare_lint_pass {
|
|||
$crate::impl_lint_pass!($name => [$($lint),*]);
|
||||
};
|
||||
}
|
||||
|
||||
#[macro_export]
|
||||
macro_rules! fcw {
|
||||
(FutureReleaseError # $issue_number: literal) => {
|
||||
$crate:: FutureIncompatibilityReason::FutureReleaseError($crate::ReleaseFcw { issue_number: $issue_number })
|
||||
};
|
||||
(FutureReleaseSemanticsChange # $issue_number: literal) => {
|
||||
$crate::FutureIncompatibilityReason::FutureReleaseSemanticsChange($crate::ReleaseFcw {
|
||||
issue_number: $issue_number,
|
||||
})
|
||||
};
|
||||
($description: literal # $issue_number: literal) => {
|
||||
$crate::FutureIncompatibilityReason::Custom($description, $crate::ReleaseFcw {
|
||||
issue_number: $issue_number,
|
||||
})
|
||||
};
|
||||
(EditionError $edition_name: tt $page_slug: literal) => {
|
||||
$crate::FutureIncompatibilityReason::EditionError($crate::EditionFcw {
|
||||
edition: fcw!(@edition $edition_name),
|
||||
page_slug: $page_slug,
|
||||
})
|
||||
};
|
||||
(EditionSemanticsChange $edition_name: tt $page_slug: literal) => {
|
||||
$crate::FutureIncompatibilityReason::EditionSemanticsChange($crate::EditionFcw {
|
||||
edition: fcw!(@edition $edition_name),
|
||||
page_slug: $page_slug,
|
||||
})
|
||||
};
|
||||
(EditionAndFutureReleaseSemanticsChange $edition_name: tt $page_slug: literal) => {
|
||||
$crate::FutureIncompatibilityReason::EditionAndFutureReleaseSemanticsChange($crate::EditionFcw {
|
||||
edition: fcw!(@edition $edition_name),
|
||||
page_slug: $page_slug,
|
||||
})
|
||||
};
|
||||
(EditionAndFutureReleaseError $edition_name: tt $page_slug: literal) => {
|
||||
$crate::FutureIncompatibilityReason::EditionAndFutureReleaseError($crate::EditionFcw {
|
||||
edition: fcw!(@edition $edition_name),
|
||||
page_slug: $page_slug,
|
||||
})
|
||||
};
|
||||
(@edition 2024) => {
|
||||
rustc_span::edition::Edition::Edition2024
|
||||
};
|
||||
(@edition 2021) => {
|
||||
rustc_span::edition::Edition::Edition2021
|
||||
};
|
||||
(@edition 2018) => {
|
||||
rustc_span::edition::Edition::Edition2018
|
||||
};
|
||||
}
|
||||
|
|
|
|||
|
|
@ -113,7 +113,7 @@ store.register_future_incompatible(sess, vec![
|
|||
...,
|
||||
FutureIncompatibleInfo {
|
||||
id: LintId::of(YOUR_ERROR_HERE),
|
||||
reference: "issue #1234", // your tracking issue here!
|
||||
reason: fcw!(FutureReleaseError #1234) // your tracking issue here!
|
||||
},
|
||||
]);
|
||||
|
||||
|
|
@ -238,7 +238,7 @@ compatibility lint":
|
|||
```rust
|
||||
FutureIncompatibleInfo {
|
||||
id: LintId::of(OVERLAPPING_INHERENT_IMPLS),
|
||||
reference: "issue #36889 <https://github.com/rust-lang/rust/issues/36889>",
|
||||
reason: fcw!(FutureReleaseError #1234), // your tracking issue here!
|
||||
},
|
||||
```
|
||||
|
||||
|
|
|
|||
|
|
@ -732,8 +732,7 @@ declare_lint! {
|
|||
Allow,
|
||||
"detects anonymous parameters",
|
||||
@future_incompatible = FutureIncompatibleInfo {
|
||||
reference: "issue #41686 <https://github.com/rust-lang/rust/issues/41686>",
|
||||
reason: FutureIncompatibilityReason::EditionError(Edition::Edition2018),
|
||||
reason: fcw!(EditionError 2018 "slug-of-edition-guide-page")
|
||||
};
|
||||
}
|
||||
```
|
||||
|
|
|
|||
|
|
@ -179,8 +179,7 @@ declare_lint! {
|
|||
Allow,
|
||||
"detects edition keywords being used as an identifier",
|
||||
@future_incompatible = FutureIncompatibleInfo {
|
||||
reason: FutureIncompatibilityReason::EditionError(Edition::Edition2018),
|
||||
reference: "issue #49716 <https://github.com/rust-lang/rust/issues/49716>",
|
||||
reason: fcw!(EditionError 2018 "slug-of-edition-guide-page")
|
||||
};
|
||||
}
|
||||
```
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue