about summary refs log tree commit diff
path: root/src/test/mir-opt
diff options
context:
space:
mode:
authorAaron Hill <aa1ronham@gmail.com>2021-12-31 16:55:34 -0500
committerAaron Hill <aa1ronham@gmail.com>2021-12-31 18:42:54 -0500
commite3a048c3c9da3ad6faa2b576de044cc52dee2c62 (patch)
tree4023e3ee26c8f6dc70da77d8d37a440c18b7561a /src/test/mir-opt
parent984a6bf9c11b7356f696c685a145d7136fff051c (diff)
downloadrust-e3a048c3c9da3ad6faa2b576de044cc52dee2c62.tar.gz
rust-e3a048c3c9da3ad6faa2b576de044cc52dee2c62.zip
Ensure that early-bound function lifetimes are always 'local'
During borrowchecking, we treat any free (early-bound) regions on
the 'defining type' as `RegionClassification::External`. According
to the doc comments, we should only have 'external' regions when
checking a closure/generator.

However, a plain function can also have some if its regions
be considered 'early bound' - this occurs when the region is
constrained by an argument, appears in a `where` clause, or
in an opaque type. This was causing us to incorrectly mark these
regions as 'external', which caused some diagnostic code
to act as if we were referring to a 'parent' region from inside
a closure.

This PR marks all instantiated region variables as 'local'
when we're borrow-checking something other than a
closure/generator/inline-const.
Diffstat (limited to 'src/test/mir-opt')
-rw-r--r--src/test/mir-opt/nll/named_lifetimes_basic.use_x.nll.0.mir4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/test/mir-opt/nll/named_lifetimes_basic.use_x.nll.0.mir b/src/test/mir-opt/nll/named_lifetimes_basic.use_x.nll.0.mir
index bfc85e98786..975e2ffbf01 100644
--- a/src/test/mir-opt/nll/named_lifetimes_basic.use_x.nll.0.mir
+++ b/src/test/mir-opt/nll/named_lifetimes_basic.use_x.nll.0.mir
@@ -2,8 +2,8 @@
 
 | Free Region Mapping
 | '_#0r | Global | ['_#2r, '_#1r, '_#0r, '_#4r, '_#3r]
-| '_#1r | External | ['_#1r, '_#4r]
-| '_#2r | External | ['_#2r, '_#1r, '_#4r]
+| '_#1r | Local | ['_#1r, '_#4r]
+| '_#2r | Local | ['_#2r, '_#1r, '_#4r]
 | '_#3r | Local | ['_#4r, '_#3r]
 | '_#4r | Local | ['_#4r]
 |