Lifetimes not inferred when using Self
constructor instead of named one
#102494
Labels
C-bug
Category: This is a bug.
Self
constructor instead of named one
#102494
I tried this code:
Link to playground: https://play.rust-lang.org/?version=stable&mode=debug&edition=2021&gist=c11bc82b8e33841719b8e1fb765d0529.
I expected to see this happen:
The code to compile, the same way this snippet compiles (notice that only
Self -> A
changed)Instead, this happened:
The actual fix is to unify the lifetimes, but the fact that changing the constructor from
Self
to named fixed the issue is confusing and unexpected. Seems like an edge-case during compiler lifetime resolution.Real world occurrence: durch/rust-s3@a6adbf2 (fails before this commit, but works after the
Self -> HyperRequest
change).Meta
rustc --version --verbose
:I see same behavior on
rustc 1.65.0-beta.2 (e5da98475 2022-09-24)
andrustc 1.66.0-nightly (98ad6a551 2022-09-17)
.The text was updated successfully, but these errors were encountered: