Skip to content

Commit

Permalink
Rename variant AddrOfRegion of RegionVariableOrigin to `BorrowReg…
Browse files Browse the repository at this point in the history
…ion`

because "Borrow" is the more idiomatic Rust term than "AddrOf".
  • Loading branch information
gurry committed Sep 7, 2024
1 parent 59d4114 commit c0b0627
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion compiler/rustc_hir_typeck/src/expr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -447,7 +447,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
// this time with enough precision to check that the value
// whose address was taken can actually be made to live as long
// 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)
}
}
Expand Down
6 changes: 3 additions & 3 deletions compiler/rustc_infer/src/infer/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -458,8 +458,8 @@ pub enum RegionVariableOrigin {
PatternRegion(Span),

/// Regions created by `&` operator.
///
AddrOfRegion(Span),
BorrowRegion(Span),

/// Regions created as part of an autoref of a method receiver.
Autoref(Span),

Expand Down Expand Up @@ -1741,7 +1741,7 @@ impl RegionVariableOrigin {
match *self {
MiscVariable(a)
| PatternRegion(a)
| AddrOfRegion(a)
| BorrowRegion(a)
| Autoref(a)
| Coercion(a)
| RegionParameterDefinition(a, ..)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1018,7 +1018,7 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> {
let var_description = match var_origin {
infer::MiscVariable(_) => String::new(),
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::Coercion(_) => " for automatic coercion".to_string(),
infer::BoundRegion(_, br, infer::FnCall) => {
Expand Down

0 comments on commit c0b0627

Please sign in to comment.