Skip to content

Lint unused assoc tys although the trait is used #127714

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Closed
wants to merge 1 commit into from

Conversation

mu001999
Copy link
Contributor

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. T-libs Relevant to the library team, which will review and decide on the PR/issue. labels Jul 14, 2024
@rust-log-analyzer

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

@mu001999
Copy link
Contributor Author

  error: associated type `Bar` is never used
     --> library/core/tests/any.rs:137:14
      |
  136 |     trait Foo {
      |           --- associated type in this trait
  137 |         type Bar;
      |              ^^^
      |
      = note: `-D dead-code` implied by `-D warnings`
      = help: to override `-D warnings` add `#[allow(dead_code)]`

the code is:

#[test]
fn dyn_type_name() {
    trait Foo {
        type Bar;
    }

    assert_eq!(
        "dyn core::ops::function::Fn(i32, i32) -> i32",
        std::any::type_name::<dyn Fn(i32, i32) -> i32>()
    );
    assert_eq!(
        "dyn coretests::any::dyn_type_name::Foo<Bar = i32> \
        + core::marker::Send + core::marker::Sync",
        std::any::type_name::<dyn Foo<Bar = i32> + Send + Sync>()
    );
}

seems the assoc type is not marked live if it was used in the trait object.

@rust-log-analyzer

This comment has been minimized.

@bors
Copy link
Collaborator

bors commented Jul 29, 2024

☔ The latest upstream changes (presumably #125443) made this pull request unmergeable. Please resolve the merge conflicts.

@bors
Copy link
Collaborator

bors commented Aug 3, 2024

☔ The latest upstream changes (presumably #128404) made this pull request unmergeable. Please resolve the merge conflicts.

@mu001999 mu001999 closed this Aug 4, 2024
@mu001999 mu001999 deleted the dead/enhance-2 branch February 7, 2025 15:11
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. T-libs Relevant to the library team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants