Skip to content

regression: cannot infer lifetime #119873

Closed as not planned
Closed as not planned
@Mark-Simulacrum

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

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