Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
45 commits
Select commit Hold shift + click to select a range
b852e50
Merge ref '1be6b13be73d' from rust-lang/rust
invalid-email-address Nov 27, 2025
2fc8657
Merge pull request #21143 from rust-lang/rustc-pull
lnicola Nov 27, 2025
46cfd80
Merge pull request #20685 from A4-Tacks/enum-multi-gen-is-as
ShoyuVanilla Nov 27, 2025
191e3c5
Merge pull request #21028 from A4-Tacks/comp-pattern-alias
ShoyuVanilla Nov 27, 2025
e9467f0
Merge pull request #20976 from A4-Tacks/comp-after-top-inner-attr
ShoyuVanilla Nov 27, 2025
87578e8
Merge pull request #21095 from A4-Tacks/autoderef-skipiter
Veykril Nov 27, 2025
d57e248
Merge pull request #21145 from Veykril/push-prwwrlwmoxzx
Veykril Nov 27, 2025
2f96836
Merge pull request #21144 from A4-Tacks/abi-qualifier-extern-crate-comp
ChayimFriedman2 Nov 28, 2025
f39f615
Merge pull request #21141 from Wilfred/scip_enclosing_range
ChayimFriedman2 Nov 28, 2025
68ba74c
Merge pull request #20163 from ChayimFriedman2/parser-per-token-edition
Veykril Nov 28, 2025
3fdc8eb
Merge pull request #20217 from ChayimFriedman2/spec-resolve-hygiene
Veykril Nov 28, 2025
5dfb30f
Merge pull request #21023 from A4-Tacks/syntax-editor-duplicate-changed
ShoyuVanilla Nov 28, 2025
3581269
Merge ref 'dfe1b8c97bcd' from rust-lang/rust
invalid-email-address Dec 1, 2025
7d0cde0
Merge pull request #21185 from rust-lang/rustc-pull
lnicola Dec 1, 2025
ea2ba7c
Auto merge of #142821 - cjgillot:jump-threading-single, r=saethlin
bors Dec 1, 2025
5b4ed9b
Merge pull request #21182 from ChayimFriedman2/param-env
ChayimFriedman2 Dec 2, 2025
2eba8e6
Auto merge of #149125 - zachs18:btreemap-eq-perf, r=workingjubilee
bors Dec 2, 2025
6ada98f
Merge pull request #21157 from Wilfred/task_queue_naming
lnicola Dec 2, 2025
7655eab
Merge pull request #21188 from Wilfred/fix_rustdoc_and_add_ci
Veykril Dec 3, 2025
d3f1324
Merge pull request #21198 from A4-Tacks/nested-incomplete-let-semi
ChayimFriedman2 Dec 3, 2025
06f2eea
Merge pull request #21183 from ChayimFriedman2/define-opaque
Veykril Dec 4, 2025
0fa3e49
Rollup merge of #149684 - tshepang:rdg-sync, r=tshepang
jhpratt Dec 6, 2025
e7220f0
Auto merge of #149701 - jhpratt:rollup-cnlzfbv, r=jhpratt
bors Dec 6, 2025
be6df4e
Rollup merge of #146826 - bluurryy:impl-allocator-for-mut-a, r=scottmcm
matthiaskrgr Dec 6, 2025
988c444
Rollup merge of #148487 - Qelxiros:148441-option-into-flat-iter, r=sc…
matthiaskrgr Dec 6, 2025
de08967
Auto merge of #149495 - scottmcm:assume-filter-count, r=Mark-Simulacrum
bors Dec 6, 2025
9ab4e57
Auto merge of #149704 - matthiaskrgr:rollup-u4zhw99, r=matthiaskrgr
bors Dec 6, 2025
16062f8
Auto merge of #149657 - Kobzol:revert-149147, r=chenyukang
bors Dec 7, 2025
749d985
Auto merge of #149690 - RustyYato:inline-layout-helper, r=saethlin
bors Dec 7, 2025
c3ab1b8
Auto merge of #149060 - jdonszelmann:duplicate-span-lowering, r=Waffl…
bors Dec 7, 2025
5ff90d8
Auto merge of #149517 - WaffleLapkin:alphabet-blessing, r=jdonszelmann
bors Dec 7, 2025
e64a8f9
Auto merge of #147754 - Dan54:friendly-clamp, r=Mark-Simulacrum
bors Dec 8, 2025
790e8d0
Auto merge of #149766 - lnicola:sync-from-ra, r=lnicola
bors Dec 8, 2025
2f243ef
Auto merge of #149426 - antoyo:libgccjit-targets, r=Kobzol
bors Dec 9, 2025
4fc9c16
Auto merge of #147602 - JohnTitor:dedup-lifetime-capture-errors, r=es…
bors Dec 10, 2025
83cfe36
introduce fcw macro
jdonszelmann Dec 10, 2025
050bf0e
update docs
jdonszelmann Dec 10, 2025
15b35af
Rollup merge of #148052 - tgross35:stabilize-const_mul_add, r=RalfJung
matthiaskrgr Dec 10, 2025
7eaae9d
Rollup merge of #149386 - WaffleLapkin:display-funding, r=Kobzol
matthiaskrgr Dec 10, 2025
0878779
Rollup merge of #149846 - jdonszelmann:links-for-all-fcws, r=wafflela…
matthiaskrgr Dec 10, 2025
db96736
Auto merge of #149853 - matthiaskrgr:rollup-m2rkwqr, r=matthiaskrgr
bors Dec 10, 2025
90317ca
Auto merge of #149645 - GuillaumeGomez:doc-attr-based, r=jdonszelmann…
bors Dec 11, 2025
3be97ed
Auto merge of #148477 - lqd:crater-wfcheck, r=lcnr,BoxyUwU
bors Dec 12, 2025
fec3b64
Prepare for merging from rust-lang/rust
invalid-email-address Dec 13, 2025
cde2934
Merge ref 'ce63e5d9ea20' from rust-lang/rust
invalid-email-address Dec 13, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion rust-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
dfe1b8c97bcde283102f706d5dcdc3649e5e12e3
ce63e5d9ea20f15a70c6fdc4d4de7aee352fd965
85 changes: 47 additions & 38 deletions src/bug-fix-procedure.md
Original file line number Diff line number Diff line change
Expand Up @@ -91,40 +91,46 @@ future-compatibility warnings. These are a special category of lint warning.
Adding a new future-compatibility warning can be done as follows.

```rust
// 1. Define the lint in `compiler/rustc_middle/src/lint/builtin.rs`:
// 1. Define the lint in `compiler/rustc_lint/src/builtin.rs` and
// add the metadata for the future incompatibility:
declare_lint! {
pub YOUR_ERROR_HERE,
pub YOUR_LINT_HERE,
Warn,
"illegal use of foo bar baz"
@future_incompatible = FutureIncompatibleInfo {
reason: fcw!(FutureReleaseError #1234) // your tracking issue here!
},
}

// 2. Add to the list of HardwiredLints in the same file:
impl LintPass for HardwiredLints {
fn get_lints(&self) -> LintArray {
lint_array!(
..,
YOUR_ERROR_HERE
)
}
// 2. Add a decidacted lint pass for it.
// This step can be skipped if you emit the lint as part of an existing pass.

#[derive(Default)]
pub struct MyLintPass {
...
}

// 3. Register the lint in `compiler/rustc_lint/src/lib.rs`:
store.register_future_incompatible(sess, vec![
...,
FutureIncompatibleInfo {
id: LintId::of(YOUR_ERROR_HERE),
reference: "issue #1234", // your tracking issue here!
impl {Early,Late}LintPass for MyLintPass {
...
}

impl_lint_pass!(MyLintPass => [YOUR_LINT_HERE]);

// 3. emit the lint somewhere in your lint pass:
cx.emit_span_lint(
YOUR_LINT_HERE,
pat.span,
// some diagnostic struct
MyDiagnostic {
...
},
]);

// 4. Report the lint:
tcx.lint_node(
lint::builtin::YOUR_ERROR_HERE,
path_id,
binding.span,
format!("some helper message here"));
);

```

Finally, register the lint in `compiler/rustc_lint/src/lib.rs`.
There are many examples in that file that already show how to do so.

#### Helpful techniques

It can often be challenging to filter out new warnings from older, pre-existing
Expand Down Expand Up @@ -221,7 +227,10 @@ The first reference you will likely find is the lint definition [in
declare_lint! {
pub OVERLAPPING_INHERENT_IMPLS,
Deny, // this may also say Warning
"two overlapping inherent impls define an item with the same name were erroneously allowed"
"two overlapping inherent impls define an item with the same name were erroneously allowed",
@future_incompatible = FutureIncompatibleInfo {
reason: fcw!(FutureReleaseError #1234), // your tracking issue here!
},
}
```

Expand All @@ -231,19 +240,6 @@ the file as [part of a `lint_array!`][lintarraysource]; remove it too.

[lintarraysource]: https://github.com/rust-lang/rust/blob/085d71c3efe453863739c1fb68fd9bd1beff214f/src/librustc/lint/builtin.rs#L252-L290

Next, you see [a reference to `OVERLAPPING_INHERENT_IMPLS` in
`rustc_lint/src/lib.rs`][futuresource]. This is defining the lint as a "future
compatibility lint":

```rust
FutureIncompatibleInfo {
id: LintId::of(OVERLAPPING_INHERENT_IMPLS),
reference: "issue #36889 <https://github.com/rust-lang/rust/issues/36889>",
},
```

Remove this too.

#### Add the lint to the list of removed lints.

In `compiler/rustc_lint/src/lib.rs` there is a list of "renamed and removed lints".
Expand All @@ -269,6 +265,8 @@ self.tcx.sess.add_lint(lint::builtin::OVERLAPPING_INHERENT_IMPLS,
msg);
```

You'll also often find `node_span_lint` used for this.

We want to convert this into an error. In some cases, there may be an
existing error for this scenario. In others, we will need to allocate a
fresh diagnostic code. [Instructions for allocating a fresh diagnostic
Expand All @@ -285,6 +283,17 @@ struct_span_code_err!(self.dcx(), self.tcx.span_of_impl(item1).unwrap(), E0592,
.emit();
```

Or better: a structured diagnostic like this:

```rust
#[derive(Diagnostic)]
struct MyDiagnostic {
#[label]
span: Span,
...
}
```

#### Update tests

Finally, run the test suite. These should be some tests that used to reference
Expand Down
3 changes: 1 addition & 2 deletions src/diagnostics.md
Original file line number Diff line number Diff line change
Expand Up @@ -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")
};
}
```
Expand Down
3 changes: 1 addition & 2 deletions src/guides/editions.md
Original file line number Diff line number Diff line change
Expand Up @@ -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")
};
}
```
Expand Down
Loading