Adding use std::error::Error
unexpectedly breaks lifetime inference
#141673
Labels
A-lifetimes
Area: Lifetimes / regions
A-type-system
Area: Type system
C-discussion
Category: Discussion or questions that doesn't represent real issues.
T-compiler
Relevant to the compiler team, which will review and decide on the PR/issue.
T-types
Relevant to the types team, which will review and decide on the PR/issue.
Uh oh!
There was an error while loading. Please reload this page.
I tried this code:
Link to Rust Playground
I expected this to compile the same way regardless of whether
use std::error::Error;
is present.This expectation holds because Error is used later in the code via its fully qualified name (
std::error::Error
) only, and the use statement should not affect type inference or lifetime resolution.Instead, this happened:
When the
use
line is present, the compiler reports a lifetime error:Removing the
use
line eliminates the error, without changing any other code.Meta
This bug happens at least with
From a quick research, I didn't find a duplicate of this.
The text was updated successfully, but these errors were encountered: