Skip to content
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

Lint unused assoc tys although the trait is used #127714

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
Contributor

bors commented Jul 29, 2024

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

@bors
Copy link
Contributor

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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in 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