1
Fork 0

Rename variant AddrOfRegion of RegionVariableOrigin to BorrowRegion

because "Borrow" is the more idiomatic Rust term than "AddrOf".
This commit is contained in:
Gurinder Singh 2024-09-07 18:50:51 +05:30
parent 59d4114b2d
commit c0b06273f2
3 changed files with 5 additions and 5 deletions

View file

@ -447,7 +447,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
// this time with enough precision to check that the value // this time with enough precision to check that the value
// whose address was taken can actually be made to live as long // whose address was taken can actually be made to live as long
// as it needs to live. // as it needs to live.
let region = self.next_region_var(infer::AddrOfRegion(expr.span)); let region = self.next_region_var(infer::BorrowRegion(expr.span));
Ty::new_ref(self.tcx, region, ty, mutbl) Ty::new_ref(self.tcx, region, ty, mutbl)
} }
} }

View file

@ -458,8 +458,8 @@ pub enum RegionVariableOrigin {
PatternRegion(Span), PatternRegion(Span),
/// Regions created by `&` operator. /// Regions created by `&` operator.
/// BorrowRegion(Span),
AddrOfRegion(Span),
/// Regions created as part of an autoref of a method receiver. /// Regions created as part of an autoref of a method receiver.
Autoref(Span), Autoref(Span),
@ -1741,7 +1741,7 @@ impl RegionVariableOrigin {
match *self { match *self {
MiscVariable(a) MiscVariable(a)
| PatternRegion(a) | PatternRegion(a)
| AddrOfRegion(a) | BorrowRegion(a)
| Autoref(a) | Autoref(a)
| Coercion(a) | Coercion(a)
| RegionParameterDefinition(a, ..) | RegionParameterDefinition(a, ..)

View file

@ -1018,7 +1018,7 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> {
let var_description = match var_origin { let var_description = match var_origin {
infer::MiscVariable(_) => String::new(), infer::MiscVariable(_) => String::new(),
infer::PatternRegion(_) => " for pattern".to_string(), infer::PatternRegion(_) => " for pattern".to_string(),
infer::AddrOfRegion(_) => " for borrow expression".to_string(), infer::BorrowRegion(_) => " for borrow expression".to_string(),
infer::Autoref(_) => " for autoref".to_string(), infer::Autoref(_) => " for autoref".to_string(),
infer::Coercion(_) => " for automatic coercion".to_string(), infer::Coercion(_) => " for automatic coercion".to_string(),
infer::BoundRegion(_, br, infer::FnCall) => { infer::BoundRegion(_, br, infer::FnCall) => {