Rollup merge of #94670 - xFrednet:rfc-2383-expect-impl-after-party, r=flip1995,wesleywiser
Improve `expect` impl and handle `#[expect(unfulfilled_lint_expectations)]` (RFC 2383) This PR updates unstable `ExpectationIds` in stashed diagnostics and adds some asserts to ensure that the stored expectations are really empty in the end. Additionally, it handles the `#[expect(unfulfilled_lint_expectations)]` case. According to the [Errors and lints docs](https://rustc-dev-guide.rust-lang.org/diagnostics.html#diagnostic-levels) the `error` level should only be used _"when the compiler detects a problem that makes it unable to compile the program"_. As this isn't the case with `#[expect(unfulfilled_lint_expectations)]` I decided to only create a warning. To avoid adding a new lint only for this case, I simply emit a `unfulfilled_lint_expectations` diagnostic with an additional note. --- r? `@wesleywiser` I'm requesting a review from you since you reviewed the previous PR https://github.com/rust-lang/rust/pull/87835. You are welcome to reassign it if you're busy 🙃 rfc: [RFC-2383](https://rust-lang.github.io/rfcs/2383-lint-reasons.html) tracking issue: https://github.com/rust-lang/rust/issues/85549 cc: `@flip1995` In case you're also interested in this :)
This commit is contained in:
commit
6548a368c8
8 changed files with 167 additions and 30 deletions
|
@ -204,11 +204,19 @@ pub struct LintExpectation {
|
|||
pub reason: Option<Symbol>,
|
||||
/// The [`Span`] of the attribute that this expectation originated from.
|
||||
pub emission_span: Span,
|
||||
/// Lint messages for the `unfulfilled_lint_expectations` lint will be
|
||||
/// adjusted to include an additional note. Therefore, we have to track if
|
||||
/// the expectation is for the lint.
|
||||
pub is_unfulfilled_lint_expectations: bool,
|
||||
}
|
||||
|
||||
impl LintExpectation {
|
||||
pub fn new(reason: Option<Symbol>, attr_span: Span) -> Self {
|
||||
Self { reason, emission_span: attr_span }
|
||||
pub fn new(
|
||||
reason: Option<Symbol>,
|
||||
emission_span: Span,
|
||||
is_unfulfilled_lint_expectations: bool,
|
||||
) -> Self {
|
||||
Self { reason, emission_span, is_unfulfilled_lint_expectations }
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue