Note about object lifetime defaults in does not live long enough error

This is a aspect of Rust that frequently trips up people who are not
aware of it yet. This diagnostic attempts to explain what's happening
and why the lifetime constraint, that was never mentioned in the source,
arose.
This commit is contained in:
Nilstrieb
2023-11-12 13:48:47 +01:00
parent ed086d86b8
commit e5c330ac48
8 changed files with 132 additions and 11 deletions

View File

@@ -341,7 +341,11 @@ pub enum ConstraintCategory<'tcx> {
UseAsConst,
UseAsStatic,
TypeAnnotation,
Cast,
Cast {
/// Whether this is an unsizing cast and if yes, this contains the target type.
/// Region variables are erased to ReErased.
unsize_to: Option<Ty<'tcx>>,
},
/// A constraint that came from checking the body of a closure.
///