Closed
Description
I tried this:
rustup update nightly
git clone https://github.com/rust-lang/git2-rs && cd git2-rs
cargo +nightly build
I expected to see this happen: build completes
Instead, this happened: build failed with this output:
error[E0495]: cannot infer an appropriate lifetime due to conflicting requirements
--> src/attr.rs:74:15
|
74 | match (self, other) {
| ^^^^^^^^^^^^^
|
note: first, the lifetime cannot outlive the anonymous lifetime defined on the method body at 73:26...
--> src/attr.rs:73:26
|
73 | fn eq(&self, other: &AttrValue<'_>) -> bool {
| ^^^^^^^^^^^^^
note: ...so that the types are compatible
--> src/attr.rs:74:15
|
74 | match (self, other) {
| ^^^^^^^^^^^^^
= note: expected `(&AttrValue<'_>, &AttrValue<'_>)`
found `(&AttrValue<'_>, &AttrValue<'_>)`
note: but, the lifetime must be valid for the lifetime `'_` as defined on the impl at 72:30...
--> src/attr.rs:72:30
|
72 | impl PartialEq for AttrValue<'_> {
| ^^
note: ...so that the types are compatible
--> src/attr.rs:79:16
|
79 | | (Self::Bytes(bytes), AttrValue::String(string)) => string.as_bytes() == *bytes,
| ^^^^^^^^^^^^^^^^^^
= note: expected `AttrValue<'_>`
found `AttrValue<'_>`
error: aborting due to previous error
For more information about this error, try `rustc --explain E0495`.
error: could not compile `git2`
To learn more, run the command again with --verbose.
Meta
rustc +nightly --version --verbose
:
rustc 1.54.0-nightly (5dc8789e3 2021-05-21)
binary: rustc
commit-hash: 5dc8789e300930751a78996da0fa906be5a344a2
commit-date: 2021-05-21
host: x86_64-unknown-linux-gnu
release: 1.54.0-nightly
LLVM version: 12.0.1
This was working with the rustc nightly from rustc 1.54.0-nightly (f94942d84 2021-05-19)
so this is a very recent regression.
Metadata
Metadata
Assignees
Labels
Type
Projects
Relationships
Development
No branches or pull requests
Activity
Mark-Simulacrum commentedon May 22, 2021
Might be #85511, but would be good to bisect.
ehuss commentedon May 22, 2021
Bisect confirmed it is #85511. This is blocking cargo's CI. Let me know if there's any way I can help.
ehuss commentedon May 22, 2021
Here's a reproduction:
I couldn't get it smaller than that.
I don't know if this is helpful, but the following will ICE on stable/beta, but returns E0495 on nightly:
matthiaskrgr commentedon May 22, 2021
Note for those also affected by this:
git2
0.12
still builds so you might be able to temporarily downgrade your git2 dependency as a workaround until there is a solution.rust: Use stable toolchain for udeps job
rust: Use stable toolchain for udeps job
Mark-Simulacrum commentedon May 22, 2021
Cc @nikomatsakis
I'd lean towards reverting for now (and potentially landing as future compat or something). I'm not sure if this is technically a soundness fix, Niko can likely give a better reading there. I think the problem is that Self::String as a constructor is now (I believe arguably correctly, but not sure if it has any soundness implications) requiring the argument to outlive the lifetime on Self - but of course this isn't necessarily true of the other branch.
This means that changing Self to the actual name of the type will fix this, so maybe patching git2 quickly is a good idea; it'll fix things before the next nightly at least for Cargo.
47 remaining items