Skip to content

regression: cannot infer lifetime #119873

Description

@Mark-Simulacrum
INFO] [stdout] error[E0495]: cannot infer an appropriate lifetime for lifetime parameter '_ in generic type due to conflicting requirements
[INFO] [stdout]    --> /opt/rustwide/cargo-home/registry/src/index.crates.io-6f17d22bba15001f/assertor-0.0.1/src/assertions/map.rs:121:5
[INFO] [stdout]     |
[INFO] [stdout] 121 |     fn key_set(&self) -> Subject<'a, Keys<K, V>, (), R> {
[INFO] [stdout]     |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
[INFO] [stdout]     |
[INFO] [stdout] note: first, the lifetime cannot outlive the anonymous lifetime defined here...
[INFO] [stdout]    --> /opt/rustwide/cargo-home/registry/src/index.crates.io-6f17d22bba15001f/assertor-0.0.1/src/assertions/map.rs:78:16
[INFO] [stdout]     |
[INFO] [stdout] 78  |     fn key_set(&self) -> Subject<Keys<K, V>, (), R>;
[INFO] [stdout]     |                ^^^^^
[INFO] [stdout] note: ...so that the method type is compatible with trait
[INFO] [stdout]    --> /opt/rustwide/cargo-home/registry/src/index.crates.io-6f17d22bba15001f/assertor-0.0.1/src/assertions/map.rs:121:5
[INFO] [stdout]     |
[INFO] [stdout] 121 |     fn key_set(&self) -> Subject<'a, Keys<K, V>, (), R> {
[INFO] [stdout]     |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
[INFO] [stdout]     = note: expected `fn(&Subject<'_, _, _, _>) -> Subject<'_, std::collections::hash_map::Keys<'_, _, _>, _, _>`
[INFO] [stdout]                found `fn(&Subject<'_, _, _, _>) -> Subject<'a, std::collections::hash_map::Keys<'_, _, _>, _, _>`
[INFO] [stdout] note: but, the lifetime must be valid for the lifetime `'a` as defined here...
[INFO] [stdout]    --> /opt/rustwide/cargo-home/registry/src/index.crates.io-6f17d22bba15001f/assertor-0.0.1/src/assertions/map.rs:81:6
[INFO] [stdout]     |
[INFO] [stdout] 81  | impl<'a, K, V, R> MapAssertion<'a, K, V, R> for Subject<'a, HashMap<K, V>, (), R>
[INFO] [stdout]     |      ^^
[INFO] [stdout] note: ...so that the type `std::collections::hash_map::Keys<'_, K, V>` will meet its required lifetime bounds...
[INFO] [stdout]    --> /opt/rustwide/cargo-home/registry/src/index.crates.io-6f17d22bba15001f/assertor-0.0.1/src/assertions/map.rs:121:5
[INFO] [stdout]     |
[INFO] [stdout] 121 |     fn key_set(&self) -> Subject<'a, Keys<K, V>, (), R> {
[INFO] [stdout]     |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
[INFO] [stdout] note: ...that is required by this bound
[INFO] [stdout]    --> /opt/rustwide/cargo-home/registry/src/index.crates.io-6f17d22bba15001f/assertor-0.0.1/src/base.rs:111:14
[INFO] [stdout]     |
[INFO] [stdout] 111 |     Borrowed(&'a S),
[INFO] [stdout]     |              ^^^^^
[INFO] [stdout] 

https://crater-reports.s3.amazonaws.com/beta-1.76-3/beta-2024-01-09/gh/penso.ex/log.txt

Activity

  1. added
    T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.
    E-needs-bisectionCall for participation: This issue needs bisection: https://github.com/rust-lang/cargo-bisect-rustc
    E-needs-mcveCall for participation: This issue has a repro, but needs a Minimal Complete and Verifiable Example
    on Jan 12, 2024
  2. added this to the 1.76.0 milestone on Jan 12, 2024
  3. added
    I-prioritizeIssue needs a team member to assess the impact. Will be replaced by P-{low,medium,high,critical}
    needs-triageThis issue may need triage. Remove when done. See docs forge.rust-lang.org/release/issue-triaging
    on Jan 12, 2024
  4. compiler-errors commented on Jan 12, 2024

    @compiler-errors
  5. compiler-errors commented on Jan 12, 2024

    @compiler-errors
    Contributor

    Whoops wrong issue!

  6. compiler-errors commented on Jan 12, 2024

    @compiler-errors
    Contributor

    Well, this also is expected fallout from making the IMPLIED_BOUNDS_ENTAILMENT lint into a hard error. lcnr also tried to fix this, google/assertor#1 but the PR was never accepted.

  7. Mark-Simulacrum commented on Jan 12, 2024

    @Mark-Simulacrum
    MemberAuthor

    Closing as won't fix then. Thanks!

  8. removed
    I-prioritizeIssue needs a team member to assess the impact. Will be replaced by P-{low,medium,high,critical}
    on Jan 15, 2024
  9. removed
    needs-triageThis issue may need triage. Remove when done. See docs forge.rust-lang.org/release/issue-triaging
    on Jan 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    E-needs-bisectionCall for participation: This issue needs bisection: https://github.com/rust-lang/cargo-bisect-rustcE-needs-mcveCall for participation: This issue has a repro, but needs a Minimal Complete and Verifiable ExampleT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.regression-from-stable-to-betaPerformance or correctness regression from stable to beta.

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions