Occurs higher-ranked lifetime error
by dyn-trait, associated types, and Send constraints.
#102870
Labels
A-diagnostics
Area: Messages for errors, warnings, and lints
A-higher-ranked
Area: Higher-ranked things (e.g., lifetimes, types, trait bounds aka HRTBs)
A-lifetimes
Area: Lifetimes / regions
D-terse
Diagnostics: An error or lint that doesn't give enough information about the problem at hand.
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.
A program using dyn-trait and associae types fails to infer a Send constraint and gives a
higher-ranked lifetime error
.I think this is either a bug in rustc or the error message needs to be improved.
Here is the (probably near-minimal) code that produces this error.
When compiling this program, rustc outputs the following error.
I tried some changes to the program to see if this error would go away. The results are described below.
NG1
and uncomment eitherOK1
orOK2
-> succeed to compilation.NG1
and uncomment bothOK1
andOK2
-> failed to compilation.NG1
and uncommentNG2
-> failed to compilation.NG0
and uncommentOK0
-> succeed to compilation regardless of the contents of function f.ResultType
to a non-dyn-trait type likeBox<()>
(and make the program consistent) -> succeed to compilation regardless of the contents of function f.Trait
to be implemented only forOption<ResultType>
-> receive a different error message belowI am not familiar with the internals of rustc, but I hope this investigation helps.
Meta
I have seen this error in several rustc below.
The text was updated successfully, but these errors were encountered: