Repository navigation
do not lint redundant_lifetimes on items from external macros - #165818
Merged
rust-bors[bot] merged 1 commit intoNov 12, 2026
Merged
rust-bors[bot] merged 1 commit into
rust-bors[bot] merged 1 commit into
Conversation
derived impls kept the lifetime spans of the derive input so the external macro check missed them and `#[expect(redundant_lifetimes)]` on a derived struct went unfulfilled. the lint now skips items whose own span is in an external macro.
Contributor
|
Are there any other relevant tests from #158943 that can be copied to this PR? |
Contributor
|
Ok, looks like no, @bors r+ |
Contributor
JonathanBrouwer
added a commit
to JonathanBrouwer/rust
that referenced
this pull request
Nov 11, 2026
…ternal-macro, r=petrochenkov do not lint `redundant_lifetimes` on items from external macros derived impls copy the lifetime spans from the derive input so the external macro check on the lint span never fires and the lint is reported on the generated impl. that also left `#[expect(redundant_lifetimes)]` on a derived struct unfulfillable. now the lint skips items whose own span is in an external macro. fixes rust-lang#150553 as suggested in rust-lang#150553 (comment) r? @petrochenkov
rust-bors Bot
pushed a commit
that referenced
this pull request
Nov 12, 2026
…uwer Rollup of 6 pull requests Successful merges: - #165804 (cg_llvm: Use an invariant lifetime brand for LLVM values) - #165412 (Implement `core::ops::FnAddr`) - #165487 (Migrate built-in macros `pattern_type` & `view_type` to macros 2.0 that expand to internal syntax) - #165818 (do not lint `redundant_lifetimes` on items from external macros) - #164795 (Extend support of lint `explicit_outlives_requirements` to checked type aliases) - #165824 (Add regression test for HRTB projection bound with TryFrom error)
Zalathar
added a commit
to Zalathar/rust
that referenced
this pull request
Nov 12, 2026
…ternal-macro, r=petrochenkov do not lint `redundant_lifetimes` on items from external macros derived impls copy the lifetime spans from the derive input so the external macro check on the lint span never fires and the lint is reported on the generated impl. that also left `#[expect(redundant_lifetimes)]` on a derived struct unfulfillable. now the lint skips items whose own span is in an external macro. fixes rust-lang#150553 as suggested in rust-lang#150553 (comment) r? @petrochenkov
rust-bors Bot
pushed a commit
that referenced
this pull request
Nov 12, 2026
Rollup of 12 pull requests Successful merges: - #165804 (cg_llvm: Use an invariant lifetime brand for LLVM values) - #165778 (Bump stage0 to 1.101.0-beta.1) - #165412 (Implement `core::ops::FnAddr`) - #165487 (Migrate built-in macros `pattern_type` & `view_type` to macros 2.0 that expand to internal syntax) - #165818 (do not lint `redundant_lifetimes` on items from external macros) - #163077 (feat: support nested functions with `#[offload_kernel]`) - #164795 (Extend support of lint `explicit_outlives_requirements` to checked type aliases) - #165578 (Avoid `Hash::hash` when stable-hashing various types) - #165729 (tests: Add regression test for infinite recursive dereference) - #165819 (Avoid redundant scans when extracting stage0 archives) - #165822 (Remove unused compiler modules and types) - #165824 (Add regression test for HRTB projection bound with TryFrom error)
rust-bors Bot
pushed a commit
that referenced
this pull request
Nov 12, 2026
Rollup of 11 pull requests Successful merges: - #165804 (cg_llvm: Use an invariant lifetime brand for LLVM values) - #165778 (Bump stage0 to 1.101.0-beta.1) - #165412 (Implement `core::ops::FnAddr`) - #165487 (Migrate built-in macros `pattern_type` & `view_type` to macros 2.0 that expand to internal syntax) - #165818 (do not lint `redundant_lifetimes` on items from external macros) - #163077 (feat: support nested functions with `#[offload_kernel]`) - #164795 (Extend support of lint `explicit_outlives_requirements` to checked type aliases) - #165578 (Avoid `Hash::hash` when stable-hashing various types) - #165729 (tests: Add regression test for infinite recursive dereference) - #165822 (Remove unused compiler modules and types) - #165824 (Add regression test for HRTB projection bound with TryFrom error)
rust-bors Bot
pushed a commit
that referenced
this pull request
Nov 12, 2026
Rollup merge of #165818 - Albab-Hasan:redundant-lifetimes-external-macro, r=petrochenkov do not lint `redundant_lifetimes` on items from external macros derived impls copy the lifetime spans from the derive input so the external macro check on the lint span never fires and the lint is reported on the generated impl. that also left `#[expect(redundant_lifetimes)]` on a derived struct unfulfillable. now the lint skips items whose own span is in an external macro. fixes #150553 as suggested in #150553 (comment) r? @petrochenkov
bjorn3
pushed a commit
to rust-lang/rustc_codegen_cranelift
that referenced
this pull request
Nov 13, 2026
Rollup of 11 pull requests Successful merges: - rust-lang/rust#165804 (cg_llvm: Use an invariant lifetime brand for LLVM values) - rust-lang/rust#165778 (Bump stage0 to 1.101.0-beta.1) - rust-lang/rust#165412 (Implement `core::ops::FnAddr`) - rust-lang/rust#165487 (Migrate built-in macros `pattern_type` & `view_type` to macros 2.0 that expand to internal syntax) - rust-lang/rust#165818 (do not lint `redundant_lifetimes` on items from external macros) - rust-lang/rust#163077 (feat: support nested functions with `#[offload_kernel]`) - rust-lang/rust#164795 (Extend support of lint `explicit_outlives_requirements` to checked type aliases) - rust-lang/rust#165578 (Avoid `Hash::hash` when stable-hashing various types) - rust-lang/rust#165729 (tests: Add regression test for infinite recursive dereference) - rust-lang/rust#165822 (Remove unused compiler modules and types) - rust-lang/rust#165824 (Add regression test for HRTB projection bound with TryFrom error)
mehmettoplu-rs
pushed a commit
to mehmettoplu-rs/miri
that referenced
this pull request
Nov 13, 2026
Rollup of 11 pull requests Successful merges: - rust-lang/rust#165804 (cg_llvm: Use an invariant lifetime brand for LLVM values) - rust-lang/rust#165778 (Bump stage0 to 1.101.0-beta.1) - rust-lang/rust#165412 (Implement `core::ops::FnAddr`) - rust-lang/rust#165487 (Migrate built-in macros `pattern_type` & `view_type` to macros 2.0 that expand to internal syntax) - rust-lang/rust#165818 (do not lint `redundant_lifetimes` on items from external macros) - rust-lang/rust#163077 (feat: support nested functions with `#[offload_kernel]`) - rust-lang/rust#164795 (Extend support of lint `explicit_outlives_requirements` to checked type aliases) - rust-lang/rust#165578 (Avoid `Hash::hash` when stable-hashing various types) - rust-lang/rust#165729 (tests: Add regression test for infinite recursive dereference) - rust-lang/rust#165822 (Remove unused compiler modules and types) - rust-lang/rust#165824 (Add regression test for HRTB projection bound with TryFrom error)
folkertdev
pushed a commit
to folkertdev/stdarch
that referenced
this pull request
Nov 16, 2026
Rollup of 11 pull requests Successful merges: - rust-lang/rust#165804 (cg_llvm: Use an invariant lifetime brand for LLVM values) - rust-lang/rust#165778 (Bump stage0 to 1.101.0-beta.1) - rust-lang/rust#165412 (Implement `core::ops::FnAddr`) - rust-lang/rust#165487 (Migrate built-in macros `pattern_type` & `view_type` to macros 2.0 that expand to internal syntax) - rust-lang/rust#165818 (do not lint `redundant_lifetimes` on items from external macros) - rust-lang/rust#163077 (feat: support nested functions with `#[offload_kernel]`) - rust-lang/rust#164795 (Extend support of lint `explicit_outlives_requirements` to checked type aliases) - rust-lang/rust#165578 (Avoid `Hash::hash` when stable-hashing various types) - rust-lang/rust#165729 (tests: Add regression test for infinite recursive dereference) - rust-lang/rust#165822 (Remove unused compiler modules and types) - rust-lang/rust#165824 (Add regression test for HRTB projection bound with TryFrom error)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
derived impls copy the lifetime spans from the derive input so the external macro check on the lint span never fires and the lint is reported on the generated impl. that also left
#[expect(redundant_lifetimes)]on a derived struct unfulfillable. now the lint skips items whose own span is in an external macro.fixes #150553
as suggested in #150553 (comment)
r? @petrochenkov