-
Notifications
You must be signed in to change notification settings - Fork 13.5k
Check assoc consts and tys later like assoc fns #143519
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
This comment has been minimized.
This comment has been minimized.
2c73999
to
c90150b
Compare
This comment has been minimized.
This comment has been minimized.
c90150b
to
4cf632b
Compare
4cf632b
to
889582e
Compare
@rustbot ready |
@bors r+ |
…ems, r=petrochenkov Check assoc consts and tys later like assoc fns This PR 1. checks assoc consts and tys later like assoc fns 2. marks assoc consts appear in poly-trait-ref live For assoc consts, considering ```rust #![deny(dead_code)] trait Tr { // ERROR trait `Tr` is never used const I: Self; } struct Foo; //~ ERROR struct `Foo` is never constructed impl Tr for Foo { const I: Self = Foo; } fn main() {} ``` Current this will produce unused `I` instead of unused `Tr` and `Foo` ([play](https://play.rust-lang.org/?version=nightly&mode=debug&edition=2024&gist=e0490d4a2d522cb70437b26e514a3d9c)), because `const I: Self = Foo;` will be added into the worklist at first: ``` error: associated constant `I` is never used --> src/main.rs:4:11 | 3 | trait Tr { // ERROR trait `Tr` is never used | -- associated constant in this trait 4 | const I: Self; | ^ | note: the lint level is defined here --> src/main.rs:1:9 | 1 | #![deny(dead_code)] | ^^^^^^^^^ error: could not compile `playground` (bin "playground") due to 1 previous error ``` This also happens to assoc tys, see the [new test](https://github.com/rust-lang/rust/compare/master...mu001999-contrib:rust:dead-code/impl-items?expand=1#diff-bf45fa403934a31c9d610a073ed2603d885e7e81572e8edf38b7f4e08a1f3531) Fixes rust-lang#126729 r? `@petrochenkov`
Rollup of 9 pull requests Successful merges: - #143213 (de-duplicate condition scoping logic between AST→HIR lowering and `ScopeTree` construction) - #143461 (make `cfg_select` a builtin macro) - #143519 (Check assoc consts and tys later like assoc fns) - #143554 (slice: Mark `rotate_left`, `rotate_right` unstably const) - #143704 (Be a bit more careful around exotic cycles in in the inliner) - #143774 (constify `From` and `Into`) - #143786 (Fix fallback for CI_JOB_NAME) - #143796 (Fix ICE for parsed attributes with longer path not handled by CheckAttribute) - #143798 (Remove format short command trait) r? `@ghost` `@rustbot` modify labels: rollup
…ems, r=petrochenkov Check assoc consts and tys later like assoc fns This PR 1. checks assoc consts and tys later like assoc fns 2. marks assoc consts appear in poly-trait-ref live For assoc consts, considering ```rust #![deny(dead_code)] trait Tr { // ERROR trait `Tr` is never used const I: Self; } struct Foo; //~ ERROR struct `Foo` is never constructed impl Tr for Foo { const I: Self = Foo; } fn main() {} ``` Current this will produce unused `I` instead of unused `Tr` and `Foo` ([play](https://play.rust-lang.org/?version=nightly&mode=debug&edition=2024&gist=e0490d4a2d522cb70437b26e514a3d9c)), because `const I: Self = Foo;` will be added into the worklist at first: ``` error: associated constant `I` is never used --> src/main.rs:4:11 | 3 | trait Tr { // ERROR trait `Tr` is never used | -- associated constant in this trait 4 | const I: Self; | ^ | note: the lint level is defined here --> src/main.rs:1:9 | 1 | #![deny(dead_code)] | ^^^^^^^^^ error: could not compile `playground` (bin "playground") due to 1 previous error ``` This also happens to assoc tys, see the [new test](https://github.com/rust-lang/rust/compare/master...mu001999-contrib:rust:dead-code/impl-items?expand=1#diff-bf45fa403934a31c9d610a073ed2603d885e7e81572e8edf38b7f4e08a1f3531) Fixes rust-lang#126729 r? ``@petrochenkov``
Rollup of 14 pull requests Successful merges: - #143301 (`tests/ui`: A New Order [26/N]) - #143461 (make `cfg_select` a builtin macro) - #143519 (Check assoc consts and tys later like assoc fns) - #143554 (slice: Mark `rotate_left`, `rotate_right` unstably const) - #143634 (interpret/allocation: expose init + write_wildcards on a range) - #143679 (Preserve the .debug_gdb_scripts section) - #143685 (Resolve: merge `source_bindings` and `target_bindings` into `bindings`) - #143704 (Be a bit more careful around exotic cycles in in the inliner) - #143734 (Refactor resolve resolution bindings) - #143774 (constify `From` and `Into`) - #143785 (Add --compile-time-deps argument for x check) - #143786 (Fix fallback for CI_JOB_NAME) - #143825 (clippy: fix test filtering when TESTNAME is empty) - #143826 (Fix command trace) r? `@ghost` `@rustbot` modify labels: rollup
…ems, r=petrochenkov Check assoc consts and tys later like assoc fns This PR 1. checks assoc consts and tys later like assoc fns 2. marks assoc consts appear in poly-trait-ref live For assoc consts, considering ```rust #![deny(dead_code)] trait Tr { // ERROR trait `Tr` is never used const I: Self; } struct Foo; //~ ERROR struct `Foo` is never constructed impl Tr for Foo { const I: Self = Foo; } fn main() {} ``` Current this will produce unused `I` instead of unused `Tr` and `Foo` ([play](https://play.rust-lang.org/?version=nightly&mode=debug&edition=2024&gist=e0490d4a2d522cb70437b26e514a3d9c)), because `const I: Self = Foo;` will be added into the worklist at first: ``` error: associated constant `I` is never used --> src/main.rs:4:11 | 3 | trait Tr { // ERROR trait `Tr` is never used | -- associated constant in this trait 4 | const I: Self; | ^ | note: the lint level is defined here --> src/main.rs:1:9 | 1 | #![deny(dead_code)] | ^^^^^^^^^ error: could not compile `playground` (bin "playground") due to 1 previous error ``` This also happens to assoc tys, see the [new test](https://github.com/rust-lang/rust/compare/master...mu001999-contrib:rust:dead-code/impl-items?expand=1#diff-bf45fa403934a31c9d610a073ed2603d885e7e81572e8edf38b7f4e08a1f3531) Fixes rust-lang#126729 r? ```@petrochenkov```
Rollup of 13 pull requests Successful merges: - #143301 (`tests/ui`: A New Order [26/N]) - #143461 (make `cfg_select` a builtin macro) - #143519 (Check assoc consts and tys later like assoc fns) - #143554 (slice: Mark `rotate_left`, `rotate_right` unstably const) - #143634 (interpret/allocation: expose init + write_wildcards on a range) - #143679 (Preserve the .debug_gdb_scripts section) - #143685 (Resolve: merge `source_bindings` and `target_bindings` into `bindings`) - #143734 (Refactor resolve resolution bindings) - #143774 (constify `From` and `Into`) - #143785 (Add --compile-time-deps argument for x check) - #143786 (Fix fallback for CI_JOB_NAME) - #143825 (clippy: fix test filtering when TESTNAME is empty) - #143826 (Fix command trace) r? `@ghost` `@rustbot` modify labels: rollup
…ems, r=petrochenkov Check assoc consts and tys later like assoc fns This PR 1. checks assoc consts and tys later like assoc fns 2. marks assoc consts appear in poly-trait-ref live For assoc consts, considering ```rust #![deny(dead_code)] trait Tr { // ERROR trait `Tr` is never used const I: Self; } struct Foo; //~ ERROR struct `Foo` is never constructed impl Tr for Foo { const I: Self = Foo; } fn main() {} ``` Current this will produce unused `I` instead of unused `Tr` and `Foo` ([play](https://play.rust-lang.org/?version=nightly&mode=debug&edition=2024&gist=e0490d4a2d522cb70437b26e514a3d9c)), because `const I: Self = Foo;` will be added into the worklist at first: ``` error: associated constant `I` is never used --> src/main.rs:4:11 | 3 | trait Tr { // ERROR trait `Tr` is never used | -- associated constant in this trait 4 | const I: Self; | ^ | note: the lint level is defined here --> src/main.rs:1:9 | 1 | #![deny(dead_code)] | ^^^^^^^^^ error: could not compile `playground` (bin "playground") due to 1 previous error ``` This also happens to assoc tys, see the [new test](https://github.com/rust-lang/rust/compare/master...mu001999-contrib:rust:dead-code/impl-items?expand=1#diff-bf45fa403934a31c9d610a073ed2603d885e7e81572e8edf38b7f4e08a1f3531) Fixes rust-lang#126729 r? ````@petrochenkov````
Rollup of 11 pull requests Successful merges: - #143301 (`tests/ui`: A New Order [26/N]) - #143519 (Check assoc consts and tys later like assoc fns) - #143554 (slice: Mark `rotate_left`, `rotate_right` unstably const) - #143634 (interpret/allocation: expose init + write_wildcards on a range) - #143685 (Resolve: merge `source_bindings` and `target_bindings` into `bindings`) - #143734 (Refactor resolve resolution bindings) - #143774 (constify `From` and `Into`) - #143785 (Add --compile-time-deps argument for x check) - #143786 (Fix fallback for CI_JOB_NAME) - #143825 (clippy: fix test filtering when TESTNAME is empty) - #143826 (Fix command trace) r? `@ghost` `@rustbot` modify labels: rollup
Rollup merge of #143519 - mu001999-contrib:dead-code/impl-items, r=petrochenkov Check assoc consts and tys later like assoc fns This PR 1. checks assoc consts and tys later like assoc fns 2. marks assoc consts appear in poly-trait-ref live For assoc consts, considering ```rust #![deny(dead_code)] trait Tr { // ERROR trait `Tr` is never used const I: Self; } struct Foo; //~ ERROR struct `Foo` is never constructed impl Tr for Foo { const I: Self = Foo; } fn main() {} ``` Current this will produce unused `I` instead of unused `Tr` and `Foo` ([play](https://play.rust-lang.org/?version=nightly&mode=debug&edition=2024&gist=e0490d4a2d522cb70437b26e514a3d9c)), because `const I: Self = Foo;` will be added into the worklist at first: ``` error: associated constant `I` is never used --> src/main.rs:4:11 | 3 | trait Tr { // ERROR trait `Tr` is never used | -- associated constant in this trait 4 | const I: Self; | ^ | note: the lint level is defined here --> src/main.rs:1:9 | 1 | #![deny(dead_code)] | ^^^^^^^^^ error: could not compile `playground` (bin "playground") due to 1 previous error ``` This also happens to assoc tys, see the [new test](https://github.com/rust-lang/rust/compare/master...mu001999-contrib:rust:dead-code/impl-items?expand=1#diff-bf45fa403934a31c9d610a073ed2603d885e7e81572e8edf38b7f4e08a1f3531) Fixes #126729 r? `````@petrochenkov`````
@rust-timer build eca1577 Checking for #143888. |
This comment has been minimized.
This comment has been minimized.
Finished benchmarking commit (eca1577): comparison URL. Overall result: ❌ regressions - please read the text belowBenchmarking this pull request means it may be perf-sensitive – we'll automatically label it not fit for rolling up. You can override this, but we strongly advise not to, due to possible changes in compiler perf. Next Steps: If you can justify the regressions found in this try perf run, please do so in sufficient writing along with @bors rollup=never Instruction countOur most reliable metric. Used to determine the overall result above. However, even this metric can be noisy.
Max RSS (memory usage)Results (primary -0.8%, secondary 4.1%)A less reliable metric. May be of interest, but not used to determine the overall result above.
CyclesResults (secondary -4.6%)A less reliable metric. May be of interest, but not used to determine the overall result above.
Binary sizeThis benchmark run did not return any relevant results for this metric. Bootstrap: 465.776s -> 464.957s (-0.18%) |
Rollup of 11 pull requests Successful merges: - rust-lang/rust#143301 (`tests/ui`: A New Order [26/N]) - rust-lang/rust#143519 (Check assoc consts and tys later like assoc fns) - rust-lang/rust#143554 (slice: Mark `rotate_left`, `rotate_right` unstably const) - rust-lang/rust#143634 (interpret/allocation: expose init + write_wildcards on a range) - rust-lang/rust#143685 (Resolve: merge `source_bindings` and `target_bindings` into `bindings`) - rust-lang/rust#143734 (Refactor resolve resolution bindings) - rust-lang/rust#143774 (constify `From` and `Into`) - rust-lang/rust#143785 (Add --compile-time-deps argument for x check) - rust-lang/rust#143786 (Fix fallback for CI_JOB_NAME) - rust-lang/rust#143825 (clippy: fix test filtering when TESTNAME is empty) - rust-lang/rust#143826 (Fix command trace) r? `@ghost` `@rustbot` modify labels: rollup
This PR caused the small perf. regression in #143888. @petrochenkov Do you think there's something to improve here, or do we just eat the regression, since this was a lint improvement? |
Associated type resolution can be improved - #143519 (comment). Although I'm not sure this is the source of the regression here. |
This PR
For assoc consts, considering
Current this will produce unused
I
instead of unusedTr
andFoo
(play), becauseconst I: Self = Foo;
will be added into the worklist at first:This also happens to assoc tys, see the new test
Fixes #126729
r? @petrochenkov