You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Rustc panics when running clippy with the lint needless_pass_by_value from the pedantic group. The error seems to be triggered when type_allowed_to_implement_copy is checked for parameters with erased lifetimes. I've produced a minimal failing input and found the first nightly release impacted.
Up to date beta and nightly toolchains are impacted but not stable. I bisected nightly toolchains and found that nightly-2023-01-21 is not impacted but nightly-2023-1-22 is impacted.
The text was updated successfully, but these errors were encountered:
I've taken an initial look, but I'm not very familiar with rustc internals.
On the offending code path, needless_pass_by_value.rs is checking if the parameter is allowed to implement copy. type_allowed_to_implement_copy checks each field in the parameter with the lexical region resolver to determine which lifetimes (regions) outlive which others.
This is where I am most unsure. The lexical region resolver wants to pin down all of the lifetimes. It typically does this by looking for the least-upper-bound (lub in the resolver code). The lifetime for foo and for bar should probably both be Empty. The lifetime of bar should be empty because it isn't ever used. foo's lifetime must be at least as long as bar's lifetime (Empty), and as long as 'a, but we never need to borrow from behind 'a.
One of the lifetimes, however, is re_erased rather than Empty. IIUC this is the error, and re_erased shouldn't leak backwards in time from code generation to type checking.
Summary
Rustc panics when running clippy with the lint
needless_pass_by_value
from the pedantic group. The error seems to be triggered whentype_allowed_to_implement_copy
is checked for parameters with erased lifetimes. I've produced a minimal failing input and found the first nightly release impacted.Error
Internal compiler error:
compiler/rustc_infer/src/infer/lexical_region_resolve/mod.rs:203:17: cannot relate region: ReErased
.Full backtrace copied into this gist.
Reproduction
Versions
Up to date
beta
andnightly
toolchains are impacted but notstable
. I bisected nightly toolchains and found thatnightly-2023-01-21
is not impacted butnightly-2023-1-22
is impacted.The text was updated successfully, but these errors were encountered: