reserve variable for empty root region
This commit is contained in:
parent
771fdd9985
commit
b8caef423d
|
@ -472,6 +472,9 @@ pub enum NLLRegionVariableOrigin {
|
||||||
/// from a `for<'a> T` binder). Meant to represent "any region".
|
/// from a `for<'a> T` binder). Meant to represent "any region".
|
||||||
Placeholder(ty::PlaceholderRegion),
|
Placeholder(ty::PlaceholderRegion),
|
||||||
|
|
||||||
|
/// The variable we create to represent `'empty(U0)`.
|
||||||
|
RootEmptyRegion,
|
||||||
|
|
||||||
Existential {
|
Existential {
|
||||||
/// If this is true, then this variable was created to represent a lifetime
|
/// If this is true, then this variable was created to represent a lifetime
|
||||||
/// bound in a `for` binder. For example, it might have been created to
|
/// bound in a `for` binder. For example, it might have been created to
|
||||||
|
@ -493,6 +496,7 @@ impl NLLRegionVariableOrigin {
|
||||||
NLLRegionVariableOrigin::FreeRegion => true,
|
NLLRegionVariableOrigin::FreeRegion => true,
|
||||||
NLLRegionVariableOrigin::Placeholder(..) => true,
|
NLLRegionVariableOrigin::Placeholder(..) => true,
|
||||||
NLLRegionVariableOrigin::Existential { .. } => false,
|
NLLRegionVariableOrigin::Existential { .. } => false,
|
||||||
|
NLLRegionVariableOrigin::RootEmptyRegion => false,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -481,7 +481,8 @@ impl<'tcx> RegionInferenceContext<'tcx> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
NLLRegionVariableOrigin::Existential { .. } => {
|
NLLRegionVariableOrigin::RootEmptyRegion
|
||||||
|
| NLLRegionVariableOrigin::Existential { .. } => {
|
||||||
// For existential, regions, nothing to do.
|
// For existential, regions, nothing to do.
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1323,7 +1324,8 @@ impl<'tcx> RegionInferenceContext<'tcx> {
|
||||||
self.check_bound_universal_region(fr, placeholder, errors_buffer);
|
self.check_bound_universal_region(fr, placeholder, errors_buffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
NLLRegionVariableOrigin::Existential { .. } => {
|
NLLRegionVariableOrigin::RootEmptyRegion
|
||||||
|
| NLLRegionVariableOrigin::Existential { .. } => {
|
||||||
// nothing to check here
|
// nothing to check here
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1425,7 +1427,8 @@ impl<'tcx> RegionInferenceContext<'tcx> {
|
||||||
self.check_bound_universal_region(fr, placeholder, errors_buffer);
|
self.check_bound_universal_region(fr, placeholder, errors_buffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
NLLRegionVariableOrigin::Existential { .. } => {
|
NLLRegionVariableOrigin::RootEmptyRegion
|
||||||
|
| NLLRegionVariableOrigin::Existential { .. } => {
|
||||||
// nothing to check here
|
// nothing to check here
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1698,9 +1701,9 @@ impl<'tcx> RegionInferenceContext<'tcx> {
|
||||||
universe1.cannot_name(placeholder.universe)
|
universe1.cannot_name(placeholder.universe)
|
||||||
}
|
}
|
||||||
|
|
||||||
NLLRegionVariableOrigin::FreeRegion | NLLRegionVariableOrigin::Existential { .. } => {
|
NLLRegionVariableOrigin::RootEmptyRegion
|
||||||
false
|
| NLLRegionVariableOrigin::FreeRegion
|
||||||
}
|
| NLLRegionVariableOrigin::Existential { .. } => false,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2019,7 +2022,8 @@ impl<'tcx> RegionInferenceContext<'tcx> {
|
||||||
let blame_source = match from_region_origin {
|
let blame_source = match from_region_origin {
|
||||||
NLLRegionVariableOrigin::FreeRegion
|
NLLRegionVariableOrigin::FreeRegion
|
||||||
| NLLRegionVariableOrigin::Existential { from_forall: false } => true,
|
| NLLRegionVariableOrigin::Existential { from_forall: false } => true,
|
||||||
NLLRegionVariableOrigin::Placeholder(_)
|
NLLRegionVariableOrigin::RootEmptyRegion
|
||||||
|
| NLLRegionVariableOrigin::Placeholder(_)
|
||||||
| NLLRegionVariableOrigin::Existential { from_forall: true } => false,
|
| NLLRegionVariableOrigin::Existential { from_forall: true } => false,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -160,10 +160,6 @@ impl<'a, 'b, 'tcx> TypeOutlivesDelegate<'tcx> for &'a mut ConstraintConversion<'
|
||||||
a: ty::Region<'tcx>,
|
a: ty::Region<'tcx>,
|
||||||
b: ty::Region<'tcx>,
|
b: ty::Region<'tcx>,
|
||||||
) {
|
) {
|
||||||
// FIXME -- this is not the fix I would prefer
|
|
||||||
if let ty::ReEmpty(ty::UniverseIndex::ROOT) = a {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
let b = self.to_region_vid(b);
|
let b = self.to_region_vid(b);
|
||||||
let a = self.to_region_vid(a);
|
let a = self.to_region_vid(a);
|
||||||
self.add_outlives(b, a);
|
self.add_outlives(b, a);
|
||||||
|
@ -176,10 +172,6 @@ impl<'a, 'b, 'tcx> TypeOutlivesDelegate<'tcx> for &'a mut ConstraintConversion<'
|
||||||
a: ty::Region<'tcx>,
|
a: ty::Region<'tcx>,
|
||||||
bound: VerifyBound<'tcx>,
|
bound: VerifyBound<'tcx>,
|
||||||
) {
|
) {
|
||||||
// FIXME: I'd prefer if NLL had a notion of empty
|
|
||||||
if let ty::ReEmpty(ty::UniverseIndex::ROOT) = a {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
let type_test = self.verify_to_type_test(kind, a, bound);
|
let type_test = self.verify_to_type_test(kind, a, bound);
|
||||||
self.add_type_test(type_test);
|
self.add_type_test(type_test);
|
||||||
}
|
}
|
||||||
|
|
|
@ -54,6 +54,13 @@ pub struct UniversalRegions<'tcx> {
|
||||||
/// The total number of universal region variables instantiated.
|
/// The total number of universal region variables instantiated.
|
||||||
num_universals: usize,
|
num_universals: usize,
|
||||||
|
|
||||||
|
/// A special region variable created for the `'empty(U0)` region.
|
||||||
|
/// Note that this is **not** a "universal" region, as it doesn't
|
||||||
|
/// represent a universally bound placeholder or any such thing.
|
||||||
|
/// But we do create it here in this type because it's a useful region
|
||||||
|
/// to have around in a few limited cases.
|
||||||
|
pub root_empty: RegionVid,
|
||||||
|
|
||||||
/// The "defining" type for this function, with all universal
|
/// The "defining" type for this function, with all universal
|
||||||
/// regions instantiated. For a closure or generator, this is the
|
/// regions instantiated. For a closure or generator, this is the
|
||||||
/// closure type, but for a top-level function it's the `FnDef`.
|
/// closure type, but for a top-level function it's the `FnDef`.
|
||||||
|
@ -316,7 +323,11 @@ impl<'tcx> UniversalRegions<'tcx> {
|
||||||
|
|
||||||
/// See `UniversalRegionIndices::to_region_vid`.
|
/// See `UniversalRegionIndices::to_region_vid`.
|
||||||
pub fn to_region_vid(&self, r: ty::Region<'tcx>) -> RegionVid {
|
pub fn to_region_vid(&self, r: ty::Region<'tcx>) -> RegionVid {
|
||||||
self.indices.to_region_vid(r)
|
if let ty::ReEmpty(ty::UniverseIndex::ROOT) = r {
|
||||||
|
self.root_empty
|
||||||
|
} else {
|
||||||
|
self.indices.to_region_vid(r)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// As part of the NLL unit tests, you can annotate a function with
|
/// As part of the NLL unit tests, you can annotate a function with
|
||||||
|
@ -472,10 +483,16 @@ impl<'cx, 'tcx> UniversalRegionsBuilder<'cx, 'tcx> {
|
||||||
_ => None,
|
_ => None,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
let root_empty = self
|
||||||
|
.infcx
|
||||||
|
.next_nll_region_var(NLLRegionVariableOrigin::RootEmptyRegion)
|
||||||
|
.to_region_vid();
|
||||||
|
|
||||||
UniversalRegions {
|
UniversalRegions {
|
||||||
indices,
|
indices,
|
||||||
fr_static,
|
fr_static,
|
||||||
fr_fn_body,
|
fr_fn_body,
|
||||||
|
root_empty,
|
||||||
first_extern_index,
|
first_extern_index,
|
||||||
first_local_index,
|
first_local_index,
|
||||||
num_universals,
|
num_universals,
|
||||||
|
|
|
@ -13,10 +13,11 @@
|
||||||
| '_#2r | U0 | {bb0[0..=1], '_#2r}
|
| '_#2r | U0 | {bb0[0..=1], '_#2r}
|
||||||
| '_#3r | U0 | {bb0[0..=1], '_#3r}
|
| '_#3r | U0 | {bb0[0..=1], '_#3r}
|
||||||
| '_#4r | U0 | {bb0[0..=1], '_#4r}
|
| '_#4r | U0 | {bb0[0..=1], '_#4r}
|
||||||
| '_#5r | U0 | {bb0[0..=1], '_#1r}
|
| '_#5r | U0 | {}
|
||||||
| '_#6r | U0 | {bb0[0..=1], '_#2r}
|
| '_#6r | U0 | {bb0[0..=1], '_#1r}
|
||||||
| '_#7r | U0 | {bb0[0..=1], '_#1r}
|
| '_#7r | U0 | {bb0[0..=1], '_#2r}
|
||||||
| '_#8r | U0 | {bb0[0..=1], '_#3r}
|
| '_#8r | U0 | {bb0[0..=1], '_#1r}
|
||||||
|
| '_#9r | U0 | {bb0[0..=1], '_#3r}
|
||||||
|
|
|
|
||||||
| Inference Constraints
|
| Inference Constraints
|
||||||
| '_#0r live at {bb0[0..=1]}
|
| '_#0r live at {bb0[0..=1]}
|
||||||
|
@ -24,16 +25,16 @@
|
||||||
| '_#2r live at {bb0[0..=1]}
|
| '_#2r live at {bb0[0..=1]}
|
||||||
| '_#3r live at {bb0[0..=1]}
|
| '_#3r live at {bb0[0..=1]}
|
||||||
| '_#4r live at {bb0[0..=1]}
|
| '_#4r live at {bb0[0..=1]}
|
||||||
| '_#1r: '_#5r due to BoringNoLocation at All($DIR/named-lifetimes-basic.rs:12:26: 12:27)
|
| '_#1r: '_#6r due to BoringNoLocation at All($DIR/named-lifetimes-basic.rs:12:26: 12:27)
|
||||||
| '_#1r: '_#7r due to BoringNoLocation at All($DIR/named-lifetimes-basic.rs:12:54: 12:55)
|
| '_#1r: '_#8r due to BoringNoLocation at All($DIR/named-lifetimes-basic.rs:12:54: 12:55)
|
||||||
| '_#2r: '_#6r due to BoringNoLocation at All($DIR/named-lifetimes-basic.rs:12:42: 12:43)
|
| '_#2r: '_#7r due to BoringNoLocation at All($DIR/named-lifetimes-basic.rs:12:42: 12:43)
|
||||||
| '_#3r: '_#8r due to BoringNoLocation at All($DIR/named-lifetimes-basic.rs:12:66: 12:67)
|
| '_#3r: '_#9r due to BoringNoLocation at All($DIR/named-lifetimes-basic.rs:12:66: 12:67)
|
||||||
| '_#5r: '_#1r due to BoringNoLocation at All($DIR/named-lifetimes-basic.rs:12:26: 12:27)
|
| '_#6r: '_#1r due to BoringNoLocation at All($DIR/named-lifetimes-basic.rs:12:26: 12:27)
|
||||||
| '_#6r: '_#2r due to BoringNoLocation at All($DIR/named-lifetimes-basic.rs:12:42: 12:43)
|
| '_#7r: '_#2r due to BoringNoLocation at All($DIR/named-lifetimes-basic.rs:12:42: 12:43)
|
||||||
| '_#7r: '_#1r due to BoringNoLocation at All($DIR/named-lifetimes-basic.rs:12:54: 12:55)
|
| '_#8r: '_#1r due to BoringNoLocation at All($DIR/named-lifetimes-basic.rs:12:54: 12:55)
|
||||||
| '_#8r: '_#3r due to BoringNoLocation at All($DIR/named-lifetimes-basic.rs:12:66: 12:67)
|
| '_#9r: '_#3r due to BoringNoLocation at All($DIR/named-lifetimes-basic.rs:12:66: 12:67)
|
||||||
|
|
|
|
||||||
fn use_x(_1: &'_#5r mut i32, _2: &'_#6r u32, _3: &'_#7r u32, _4: &'_#8r u32) -> bool {
|
fn use_x(_1: &'_#6r mut i32, _2: &'_#7r u32, _3: &'_#8r u32, _4: &'_#9r u32) -> bool {
|
||||||
debug w => _1; // in scope 0 at $DIR/named-lifetimes-basic.rs:12:26: 12:27
|
debug w => _1; // in scope 0 at $DIR/named-lifetimes-basic.rs:12:26: 12:27
|
||||||
debug x => _2; // in scope 0 at $DIR/named-lifetimes-basic.rs:12:42: 12:43
|
debug x => _2; // in scope 0 at $DIR/named-lifetimes-basic.rs:12:42: 12:43
|
||||||
debug y => _3; // in scope 0 at $DIR/named-lifetimes-basic.rs:12:54: 12:55
|
debug y => _3; // in scope 0 at $DIR/named-lifetimes-basic.rs:12:54: 12:55
|
||||||
|
|
|
@ -7,7 +7,9 @@
|
||||||
|
|
||||||
#![allow(warnings)]
|
#![allow(warnings)]
|
||||||
|
|
||||||
fn use_x(_: usize) -> bool { true }
|
fn use_x(_: usize) -> bool {
|
||||||
|
true
|
||||||
|
}
|
||||||
|
|
||||||
// EMIT_MIR_FOR_EACH_BIT_WIDTH
|
// EMIT_MIR_FOR_EACH_BIT_WIDTH
|
||||||
// EMIT_MIR rustc.main.nll.0.mir
|
// EMIT_MIR rustc.main.nll.0.mir
|
||||||
|
|
|
@ -7,164 +7,165 @@
|
||||||
| Inferred Region Values
|
| Inferred Region Values
|
||||||
| '_#0r | U0 | {bb0[0..=8], bb1[0], bb2[0..=8], bb3[0], bb4[0..=1], bb5[0..=3], bb6[0..=3], bb7[0..=2], bb8[0..=5], '_#0r, '_#1r}
|
| '_#0r | U0 | {bb0[0..=8], bb1[0], bb2[0..=8], bb3[0], bb4[0..=1], bb5[0..=3], bb6[0..=3], bb7[0..=2], bb8[0..=5], '_#0r, '_#1r}
|
||||||
| '_#1r | U0 | {bb0[0..=8], bb1[0], bb2[0..=8], bb3[0], bb4[0..=1], bb5[0..=3], bb6[0..=3], bb7[0..=2], bb8[0..=5], '_#1r}
|
| '_#1r | U0 | {bb0[0..=8], bb1[0], bb2[0..=8], bb3[0], bb4[0..=1], bb5[0..=3], bb6[0..=3], bb7[0..=2], bb8[0..=5], '_#1r}
|
||||||
| '_#2r | U0 | {bb2[0..=8], bb3[0], bb5[0..=2]}
|
| '_#2r | U0 | {}
|
||||||
| '_#3r | U0 | {bb2[1..=8], bb3[0], bb5[0..=2]}
|
| '_#3r | U0 | {bb2[0..=8], bb3[0], bb5[0..=2]}
|
||||||
| '_#4r | U0 | {bb2[4..=8], bb3[0], bb5[0..=2]}
|
| '_#4r | U0 | {bb2[1..=8], bb3[0], bb5[0..=2]}
|
||||||
|
| '_#5r | U0 | {bb2[4..=8], bb3[0], bb5[0..=2]}
|
||||||
|
|
|
|
||||||
| Inference Constraints
|
| Inference Constraints
|
||||||
| '_#0r live at {bb0[0..=8], bb1[0], bb2[0..=8], bb3[0], bb4[0..=1], bb5[0..=3], bb6[0..=3], bb7[0..=2], bb8[0..=5]}
|
| '_#0r live at {bb0[0..=8], bb1[0], bb2[0..=8], bb3[0], bb4[0..=1], bb5[0..=3], bb6[0..=3], bb7[0..=2], bb8[0..=5]}
|
||||||
| '_#1r live at {bb0[0..=8], bb1[0], bb2[0..=8], bb3[0], bb4[0..=1], bb5[0..=3], bb6[0..=3], bb7[0..=2], bb8[0..=5]}
|
| '_#1r live at {bb0[0..=8], bb1[0], bb2[0..=8], bb3[0], bb4[0..=1], bb5[0..=3], bb6[0..=3], bb7[0..=2], bb8[0..=5]}
|
||||||
| '_#2r live at {bb2[0]}
|
| '_#3r live at {bb2[0]}
|
||||||
| '_#3r live at {bb2[1..=3]}
|
| '_#4r live at {bb2[1..=3]}
|
||||||
| '_#4r live at {bb2[4..=8], bb3[0], bb5[0..=2]}
|
| '_#5r live at {bb2[4..=8], bb3[0], bb5[0..=2]}
|
||||||
| '_#2r: '_#3r due to Assignment at Single(bb2[0])
|
| '_#3r: '_#4r due to Assignment at Single(bb2[0])
|
||||||
| '_#3r: '_#4r due to Assignment at Single(bb2[3])
|
| '_#4r: '_#5r due to Assignment at Single(bb2[3])
|
||||||
|
|
|
|
||||||
fn main() -> () {
|
fn main() -> () {
|
||||||
let mut _0: (); // return place in scope 0 at $DIR/region-subtyping-basic.rs:14:11: 14:11
|
let mut _0: (); // return place in scope 0 at $DIR/region-subtyping-basic.rs:16:11: 16:11
|
||||||
let mut _1: [usize; Const { ty: usize, val: Value(Scalar(0x0000000000000003)) }]; // in scope 0 at $DIR/region-subtyping-basic.rs:15:9: 15:14
|
let mut _1: [usize; Const { ty: usize, val: Value(Scalar(0x0000000000000003)) }]; // in scope 0 at $DIR/region-subtyping-basic.rs:17:9: 17:14
|
||||||
let _3: usize; // in scope 0 at $DIR/region-subtyping-basic.rs:16:16: 16:17
|
let _3: usize; // in scope 0 at $DIR/region-subtyping-basic.rs:18:16: 18:17
|
||||||
let mut _4: usize; // in scope 0 at $DIR/region-subtyping-basic.rs:16:14: 16:18
|
let mut _4: usize; // in scope 0 at $DIR/region-subtyping-basic.rs:18:14: 18:18
|
||||||
let mut _5: bool; // in scope 0 at $DIR/region-subtyping-basic.rs:16:14: 16:18
|
let mut _5: bool; // in scope 0 at $DIR/region-subtyping-basic.rs:18:14: 18:18
|
||||||
let mut _7: bool; // in scope 0 at $DIR/region-subtyping-basic.rs:18:8: 18:12
|
let mut _7: bool; // in scope 0 at $DIR/region-subtyping-basic.rs:20:8: 20:12
|
||||||
let _8: bool; // in scope 0 at $DIR/region-subtyping-basic.rs:19:9: 19:18
|
let _8: bool; // in scope 0 at $DIR/region-subtyping-basic.rs:21:9: 21:18
|
||||||
let mut _9: usize; // in scope 0 at $DIR/region-subtyping-basic.rs:19:15: 19:17
|
let mut _9: usize; // in scope 0 at $DIR/region-subtyping-basic.rs:21:15: 21:17
|
||||||
let _10: bool; // in scope 0 at $DIR/region-subtyping-basic.rs:21:9: 21:18
|
let _10: bool; // in scope 0 at $DIR/region-subtyping-basic.rs:23:9: 23:18
|
||||||
scope 1 {
|
scope 1 {
|
||||||
debug v => _1; // in scope 1 at $DIR/region-subtyping-basic.rs:15:9: 15:14
|
debug v => _1; // in scope 1 at $DIR/region-subtyping-basic.rs:17:9: 17:14
|
||||||
let _2: &'_#3r usize; // in scope 1 at $DIR/region-subtyping-basic.rs:16:9: 16:10
|
let _2: &'_#4r usize; // in scope 1 at $DIR/region-subtyping-basic.rs:18:9: 18:10
|
||||||
scope 2 {
|
scope 2 {
|
||||||
debug p => _2; // in scope 2 at $DIR/region-subtyping-basic.rs:16:9: 16:10
|
debug p => _2; // in scope 2 at $DIR/region-subtyping-basic.rs:18:9: 18:10
|
||||||
let _6: &'_#4r usize; // in scope 2 at $DIR/region-subtyping-basic.rs:17:9: 17:10
|
let _6: &'_#5r usize; // in scope 2 at $DIR/region-subtyping-basic.rs:19:9: 19:10
|
||||||
scope 3 {
|
scope 3 {
|
||||||
debug q => _6; // in scope 3 at $DIR/region-subtyping-basic.rs:17:9: 17:10
|
debug q => _6; // in scope 3 at $DIR/region-subtyping-basic.rs:19:9: 19:10
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bb0: {
|
bb0: {
|
||||||
StorageLive(_1); // bb0[0]: scope 0 at $DIR/region-subtyping-basic.rs:15:9: 15:14
|
StorageLive(_1); // bb0[0]: scope 0 at $DIR/region-subtyping-basic.rs:17:9: 17:14
|
||||||
_1 = [const Const(Value(Scalar(0x0000000000000001)): usize), const Const(Value(Scalar(0x0000000000000002)): usize), const Const(Value(Scalar(0x0000000000000003)): usize)]; // bb0[1]: scope 0 at $DIR/region-subtyping-basic.rs:15:17: 15:26
|
_1 = [const Const(Value(Scalar(0x0000000000000001)): usize), const Const(Value(Scalar(0x0000000000000002)): usize), const Const(Value(Scalar(0x0000000000000003)): usize)]; // bb0[1]: scope 0 at $DIR/region-subtyping-basic.rs:17:17: 17:26
|
||||||
// ty::Const
|
// ty::Const
|
||||||
// + ty: usize
|
// + ty: usize
|
||||||
// + val: Value(Scalar(0x0000000000000001))
|
// + val: Value(Scalar(0x0000000000000001))
|
||||||
// mir::Constant
|
// mir::Constant
|
||||||
// + span: $DIR/region-subtyping-basic.rs:15:18: 15:19
|
// + span: $DIR/region-subtyping-basic.rs:17:18: 17:19
|
||||||
// + literal: Const { ty: usize, val: Value(Scalar(0x0000000000000001)) }
|
// + literal: Const { ty: usize, val: Value(Scalar(0x0000000000000001)) }
|
||||||
// ty::Const
|
// ty::Const
|
||||||
// + ty: usize
|
// + ty: usize
|
||||||
// + val: Value(Scalar(0x0000000000000002))
|
// + val: Value(Scalar(0x0000000000000002))
|
||||||
// mir::Constant
|
// mir::Constant
|
||||||
// + span: $DIR/region-subtyping-basic.rs:15:21: 15:22
|
// + span: $DIR/region-subtyping-basic.rs:17:21: 17:22
|
||||||
// + literal: Const { ty: usize, val: Value(Scalar(0x0000000000000002)) }
|
// + literal: Const { ty: usize, val: Value(Scalar(0x0000000000000002)) }
|
||||||
// ty::Const
|
// ty::Const
|
||||||
// + ty: usize
|
// + ty: usize
|
||||||
// + val: Value(Scalar(0x0000000000000003))
|
// + val: Value(Scalar(0x0000000000000003))
|
||||||
// mir::Constant
|
// mir::Constant
|
||||||
// + span: $DIR/region-subtyping-basic.rs:15:24: 15:25
|
// + span: $DIR/region-subtyping-basic.rs:17:24: 17:25
|
||||||
// + literal: Const { ty: usize, val: Value(Scalar(0x0000000000000003)) }
|
// + literal: Const { ty: usize, val: Value(Scalar(0x0000000000000003)) }
|
||||||
FakeRead(ForLet, _1); // bb0[2]: scope 0 at $DIR/region-subtyping-basic.rs:15:9: 15:14
|
FakeRead(ForLet, _1); // bb0[2]: scope 0 at $DIR/region-subtyping-basic.rs:17:9: 17:14
|
||||||
StorageLive(_2); // bb0[3]: scope 1 at $DIR/region-subtyping-basic.rs:16:9: 16:10
|
StorageLive(_2); // bb0[3]: scope 1 at $DIR/region-subtyping-basic.rs:18:9: 18:10
|
||||||
StorageLive(_3); // bb0[4]: scope 1 at $DIR/region-subtyping-basic.rs:16:16: 16:17
|
StorageLive(_3); // bb0[4]: scope 1 at $DIR/region-subtyping-basic.rs:18:16: 18:17
|
||||||
_3 = const Const(Value(Scalar(0x0000000000000000)): usize); // bb0[5]: scope 1 at $DIR/region-subtyping-basic.rs:16:16: 16:17
|
_3 = const Const(Value(Scalar(0x0000000000000000)): usize); // bb0[5]: scope 1 at $DIR/region-subtyping-basic.rs:18:16: 18:17
|
||||||
// ty::Const
|
// ty::Const
|
||||||
// + ty: usize
|
// + ty: usize
|
||||||
// + val: Value(Scalar(0x0000000000000000))
|
// + val: Value(Scalar(0x0000000000000000))
|
||||||
// mir::Constant
|
// mir::Constant
|
||||||
// + span: $DIR/region-subtyping-basic.rs:16:16: 16:17
|
// + span: $DIR/region-subtyping-basic.rs:18:16: 18:17
|
||||||
// + literal: Const { ty: usize, val: Value(Scalar(0x0000000000000000)) }
|
// + literal: Const { ty: usize, val: Value(Scalar(0x0000000000000000)) }
|
||||||
_4 = Len(_1); // bb0[6]: scope 1 at $DIR/region-subtyping-basic.rs:16:14: 16:18
|
_4 = Len(_1); // bb0[6]: scope 1 at $DIR/region-subtyping-basic.rs:18:14: 18:18
|
||||||
_5 = Lt(_3, _4); // bb0[7]: scope 1 at $DIR/region-subtyping-basic.rs:16:14: 16:18
|
_5 = Lt(_3, _4); // bb0[7]: scope 1 at $DIR/region-subtyping-basic.rs:18:14: 18:18
|
||||||
assert(move _5, "index out of bounds: the len is {} but the index is {}", move _4, _3) -> [success: bb2, unwind: bb1]; // bb0[8]: scope 1 at $DIR/region-subtyping-basic.rs:16:14: 16:18
|
assert(move _5, "index out of bounds: the len is {} but the index is {}", move _4, _3) -> [success: bb2, unwind: bb1]; // bb0[8]: scope 1 at $DIR/region-subtyping-basic.rs:18:14: 18:18
|
||||||
}
|
}
|
||||||
|
|
||||||
bb1 (cleanup): {
|
bb1 (cleanup): {
|
||||||
resume; // bb1[0]: scope 0 at $DIR/region-subtyping-basic.rs:14:1: 23:2
|
resume; // bb1[0]: scope 0 at $DIR/region-subtyping-basic.rs:16:1: 25:2
|
||||||
}
|
}
|
||||||
|
|
||||||
bb2: {
|
bb2: {
|
||||||
_2 = &'_#2r _1[_3]; // bb2[0]: scope 1 at $DIR/region-subtyping-basic.rs:16:13: 16:18
|
_2 = &'_#3r _1[_3]; // bb2[0]: scope 1 at $DIR/region-subtyping-basic.rs:18:13: 18:18
|
||||||
FakeRead(ForLet, _2); // bb2[1]: scope 1 at $DIR/region-subtyping-basic.rs:16:9: 16:10
|
FakeRead(ForLet, _2); // bb2[1]: scope 1 at $DIR/region-subtyping-basic.rs:18:9: 18:10
|
||||||
StorageLive(_6); // bb2[2]: scope 2 at $DIR/region-subtyping-basic.rs:17:9: 17:10
|
StorageLive(_6); // bb2[2]: scope 2 at $DIR/region-subtyping-basic.rs:19:9: 19:10
|
||||||
_6 = _2; // bb2[3]: scope 2 at $DIR/region-subtyping-basic.rs:17:13: 17:14
|
_6 = _2; // bb2[3]: scope 2 at $DIR/region-subtyping-basic.rs:19:13: 19:14
|
||||||
FakeRead(ForLet, _6); // bb2[4]: scope 2 at $DIR/region-subtyping-basic.rs:17:9: 17:10
|
FakeRead(ForLet, _6); // bb2[4]: scope 2 at $DIR/region-subtyping-basic.rs:19:9: 19:10
|
||||||
StorageLive(_7); // bb2[5]: scope 3 at $DIR/region-subtyping-basic.rs:18:8: 18:12
|
StorageLive(_7); // bb2[5]: scope 3 at $DIR/region-subtyping-basic.rs:20:8: 20:12
|
||||||
_7 = const Const(Value(Scalar(0x01)): bool); // bb2[6]: scope 3 at $DIR/region-subtyping-basic.rs:18:8: 18:12
|
_7 = const Const(Value(Scalar(0x01)): bool); // bb2[6]: scope 3 at $DIR/region-subtyping-basic.rs:20:8: 20:12
|
||||||
// ty::Const
|
// ty::Const
|
||||||
// + ty: bool
|
// + ty: bool
|
||||||
// + val: Value(Scalar(0x01))
|
// + val: Value(Scalar(0x01))
|
||||||
// mir::Constant
|
// mir::Constant
|
||||||
// + span: $DIR/region-subtyping-basic.rs:18:8: 18:12
|
// + span: $DIR/region-subtyping-basic.rs:20:8: 20:12
|
||||||
// + literal: Const { ty: bool, val: Value(Scalar(0x01)) }
|
// + literal: Const { ty: bool, val: Value(Scalar(0x01)) }
|
||||||
FakeRead(ForMatchedPlace, _7); // bb2[7]: scope 3 at $DIR/region-subtyping-basic.rs:18:8: 18:12
|
FakeRead(ForMatchedPlace, _7); // bb2[7]: scope 3 at $DIR/region-subtyping-basic.rs:20:8: 20:12
|
||||||
switchInt(_7) -> [Const(Value(Scalar(0x00)): bool): bb4, otherwise: bb3]; // bb2[8]: scope 3 at $DIR/region-subtyping-basic.rs:18:5: 22:6
|
switchInt(_7) -> [Const(Value(Scalar(0x00)): bool): bb4, otherwise: bb3]; // bb2[8]: scope 3 at $DIR/region-subtyping-basic.rs:20:5: 24:6
|
||||||
}
|
}
|
||||||
|
|
||||||
bb3: {
|
bb3: {
|
||||||
falseEdges -> [real: bb5, imaginary: bb4]; // bb3[0]: scope 3 at $DIR/region-subtyping-basic.rs:18:5: 22:6
|
falseEdges -> [real: bb5, imaginary: bb4]; // bb3[0]: scope 3 at $DIR/region-subtyping-basic.rs:20:5: 24:6
|
||||||
}
|
}
|
||||||
|
|
||||||
bb4: {
|
bb4: {
|
||||||
StorageLive(_10); // bb4[0]: scope 3 at $DIR/region-subtyping-basic.rs:21:9: 21:18
|
StorageLive(_10); // bb4[0]: scope 3 at $DIR/region-subtyping-basic.rs:23:9: 23:18
|
||||||
_10 = const Const(Value(Scalar(<ZST>)): fn(usize) -> bool {use_x})(const Const(Value(Scalar(0x0000000000000016)): usize)) -> [return: bb7, unwind: bb1]; // bb4[1]: scope 3 at $DIR/region-subtyping-basic.rs:21:9: 21:18
|
_10 = const Const(Value(Scalar(<ZST>)): fn(usize) -> bool {use_x})(const Const(Value(Scalar(0x0000000000000016)): usize)) -> [return: bb7, unwind: bb1]; // bb4[1]: scope 3 at $DIR/region-subtyping-basic.rs:23:9: 23:18
|
||||||
|
// ty::Const
|
||||||
|
// + ty: fn(usize) -> bool {use_x}
|
||||||
|
// + val: Value(Scalar(<ZST>))
|
||||||
|
// mir::Constant
|
||||||
|
// + span: $DIR/region-subtyping-basic.rs:23:9: 23:14
|
||||||
|
// + literal: Const { ty: fn(usize) -> bool {use_x}, val: Value(Scalar(<ZST>)) }
|
||||||
|
// ty::Const
|
||||||
|
// + ty: usize
|
||||||
|
// + val: Value(Scalar(0x0000000000000016))
|
||||||
|
// mir::Constant
|
||||||
|
// + span: $DIR/region-subtyping-basic.rs:23:15: 23:17
|
||||||
|
// + literal: Const { ty: usize, val: Value(Scalar(0x0000000000000016)) }
|
||||||
|
}
|
||||||
|
|
||||||
|
bb5: {
|
||||||
|
StorageLive(_8); // bb5[0]: scope 3 at $DIR/region-subtyping-basic.rs:21:9: 21:18
|
||||||
|
StorageLive(_9); // bb5[1]: scope 3 at $DIR/region-subtyping-basic.rs:21:15: 21:17
|
||||||
|
_9 = (*_6); // bb5[2]: scope 3 at $DIR/region-subtyping-basic.rs:21:15: 21:17
|
||||||
|
_8 = const Const(Value(Scalar(<ZST>)): fn(usize) -> bool {use_x})(move _9) -> [return: bb6, unwind: bb1]; // bb5[3]: scope 3 at $DIR/region-subtyping-basic.rs:21:9: 21:18
|
||||||
// ty::Const
|
// ty::Const
|
||||||
// + ty: fn(usize) -> bool {use_x}
|
// + ty: fn(usize) -> bool {use_x}
|
||||||
// + val: Value(Scalar(<ZST>))
|
// + val: Value(Scalar(<ZST>))
|
||||||
// mir::Constant
|
// mir::Constant
|
||||||
// + span: $DIR/region-subtyping-basic.rs:21:9: 21:14
|
// + span: $DIR/region-subtyping-basic.rs:21:9: 21:14
|
||||||
// + literal: Const { ty: fn(usize) -> bool {use_x}, val: Value(Scalar(<ZST>)) }
|
// + literal: Const { ty: fn(usize) -> bool {use_x}, val: Value(Scalar(<ZST>)) }
|
||||||
// ty::Const
|
|
||||||
// + ty: usize
|
|
||||||
// + val: Value(Scalar(0x0000000000000016))
|
|
||||||
// mir::Constant
|
|
||||||
// + span: $DIR/region-subtyping-basic.rs:21:15: 21:17
|
|
||||||
// + literal: Const { ty: usize, val: Value(Scalar(0x0000000000000016)) }
|
|
||||||
}
|
|
||||||
|
|
||||||
bb5: {
|
|
||||||
StorageLive(_8); // bb5[0]: scope 3 at $DIR/region-subtyping-basic.rs:19:9: 19:18
|
|
||||||
StorageLive(_9); // bb5[1]: scope 3 at $DIR/region-subtyping-basic.rs:19:15: 19:17
|
|
||||||
_9 = (*_6); // bb5[2]: scope 3 at $DIR/region-subtyping-basic.rs:19:15: 19:17
|
|
||||||
_8 = const Const(Value(Scalar(<ZST>)): fn(usize) -> bool {use_x})(move _9) -> [return: bb6, unwind: bb1]; // bb5[3]: scope 3 at $DIR/region-subtyping-basic.rs:19:9: 19:18
|
|
||||||
// ty::Const
|
|
||||||
// + ty: fn(usize) -> bool {use_x}
|
|
||||||
// + val: Value(Scalar(<ZST>))
|
|
||||||
// mir::Constant
|
|
||||||
// + span: $DIR/region-subtyping-basic.rs:19:9: 19:14
|
|
||||||
// + literal: Const { ty: fn(usize) -> bool {use_x}, val: Value(Scalar(<ZST>)) }
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bb6: {
|
bb6: {
|
||||||
StorageDead(_9); // bb6[0]: scope 3 at $DIR/region-subtyping-basic.rs:19:17: 19:18
|
StorageDead(_9); // bb6[0]: scope 3 at $DIR/region-subtyping-basic.rs:21:17: 21:18
|
||||||
StorageDead(_8); // bb6[1]: scope 3 at $DIR/region-subtyping-basic.rs:19:18: 19:19
|
StorageDead(_8); // bb6[1]: scope 3 at $DIR/region-subtyping-basic.rs:21:18: 21:19
|
||||||
_0 = const Const(Value(Scalar(<ZST>)): ()); // bb6[2]: scope 3 at $DIR/region-subtyping-basic.rs:18:13: 20:6
|
_0 = const Const(Value(Scalar(<ZST>)): ()); // bb6[2]: scope 3 at $DIR/region-subtyping-basic.rs:20:13: 22:6
|
||||||
// ty::Const
|
// ty::Const
|
||||||
// + ty: ()
|
// + ty: ()
|
||||||
// + val: Value(Scalar(<ZST>))
|
// + val: Value(Scalar(<ZST>))
|
||||||
// mir::Constant
|
// mir::Constant
|
||||||
// + span: $DIR/region-subtyping-basic.rs:18:13: 20:6
|
// + span: $DIR/region-subtyping-basic.rs:20:13: 22:6
|
||||||
// + literal: Const { ty: (), val: Value(Scalar(<ZST>)) }
|
// + literal: Const { ty: (), val: Value(Scalar(<ZST>)) }
|
||||||
goto -> bb8; // bb6[3]: scope 3 at $DIR/region-subtyping-basic.rs:18:5: 22:6
|
goto -> bb8; // bb6[3]: scope 3 at $DIR/region-subtyping-basic.rs:20:5: 24:6
|
||||||
}
|
}
|
||||||
|
|
||||||
bb7: {
|
bb7: {
|
||||||
StorageDead(_10); // bb7[0]: scope 3 at $DIR/region-subtyping-basic.rs:21:18: 21:19
|
StorageDead(_10); // bb7[0]: scope 3 at $DIR/region-subtyping-basic.rs:23:18: 23:19
|
||||||
_0 = const Const(Value(Scalar(<ZST>)): ()); // bb7[1]: scope 3 at $DIR/region-subtyping-basic.rs:20:12: 22:6
|
_0 = const Const(Value(Scalar(<ZST>)): ()); // bb7[1]: scope 3 at $DIR/region-subtyping-basic.rs:22:12: 24:6
|
||||||
// ty::Const
|
// ty::Const
|
||||||
// + ty: ()
|
// + ty: ()
|
||||||
// + val: Value(Scalar(<ZST>))
|
// + val: Value(Scalar(<ZST>))
|
||||||
// mir::Constant
|
// mir::Constant
|
||||||
// + span: $DIR/region-subtyping-basic.rs:20:12: 22:6
|
// + span: $DIR/region-subtyping-basic.rs:22:12: 24:6
|
||||||
// + literal: Const { ty: (), val: Value(Scalar(<ZST>)) }
|
// + literal: Const { ty: (), val: Value(Scalar(<ZST>)) }
|
||||||
goto -> bb8; // bb7[2]: scope 3 at $DIR/region-subtyping-basic.rs:18:5: 22:6
|
goto -> bb8; // bb7[2]: scope 3 at $DIR/region-subtyping-basic.rs:20:5: 24:6
|
||||||
}
|
}
|
||||||
|
|
||||||
bb8: {
|
bb8: {
|
||||||
StorageDead(_6); // bb8[0]: scope 2 at $DIR/region-subtyping-basic.rs:23:1: 23:2
|
StorageDead(_6); // bb8[0]: scope 2 at $DIR/region-subtyping-basic.rs:25:1: 25:2
|
||||||
StorageDead(_3); // bb8[1]: scope 1 at $DIR/region-subtyping-basic.rs:23:1: 23:2
|
StorageDead(_3); // bb8[1]: scope 1 at $DIR/region-subtyping-basic.rs:25:1: 25:2
|
||||||
StorageDead(_2); // bb8[2]: scope 1 at $DIR/region-subtyping-basic.rs:23:1: 23:2
|
StorageDead(_2); // bb8[2]: scope 1 at $DIR/region-subtyping-basic.rs:25:1: 25:2
|
||||||
StorageDead(_1); // bb8[3]: scope 0 at $DIR/region-subtyping-basic.rs:23:1: 23:2
|
StorageDead(_1); // bb8[3]: scope 0 at $DIR/region-subtyping-basic.rs:25:1: 25:2
|
||||||
StorageDead(_7); // bb8[4]: scope 0 at $DIR/region-subtyping-basic.rs:23:1: 23:2
|
StorageDead(_7); // bb8[4]: scope 0 at $DIR/region-subtyping-basic.rs:25:1: 25:2
|
||||||
return; // bb8[5]: scope 0 at $DIR/region-subtyping-basic.rs:23:2: 23:2
|
return; // bb8[5]: scope 0 at $DIR/region-subtyping-basic.rs:25:2: 25:2
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,15 +7,16 @@
|
||||||
| Inferred Region Values
|
| Inferred Region Values
|
||||||
| '_#0r | U0 | {bb0[0..=22], '_#0r, '_#1r}
|
| '_#0r | U0 | {bb0[0..=22], '_#0r, '_#1r}
|
||||||
| '_#1r | U0 | {bb0[0..=22], '_#1r}
|
| '_#1r | U0 | {bb0[0..=22], '_#1r}
|
||||||
| '_#2r | U0 | {bb0[10..=11]}
|
| '_#2r | U0 | {}
|
||||||
| '_#3r | U0 | {bb0[11]}
|
| '_#3r | U0 | {bb0[10..=11]}
|
||||||
|
| '_#4r | U0 | {bb0[11]}
|
||||||
|
|
|
|
||||||
| Inference Constraints
|
| Inference Constraints
|
||||||
| '_#0r live at {bb0[0..=22]}
|
| '_#0r live at {bb0[0..=22]}
|
||||||
| '_#1r live at {bb0[0..=22]}
|
| '_#1r live at {bb0[0..=22]}
|
||||||
| '_#2r live at {bb0[10]}
|
| '_#3r live at {bb0[10]}
|
||||||
| '_#3r live at {bb0[11]}
|
| '_#4r live at {bb0[11]}
|
||||||
| '_#2r: '_#3r due to Assignment at Single(bb0[10])
|
| '_#3r: '_#4r due to Assignment at Single(bb0[10])
|
||||||
|
|
|
|
||||||
fn main() -> () {
|
fn main() -> () {
|
||||||
let mut _0: (); // return place in scope 0 at $DIR/storage_ranges.rs:3:11: 3:11
|
let mut _0: (); // return place in scope 0 at $DIR/storage_ranges.rs:3:11: 3:11
|
||||||
|
|
|
@ -34,7 +34,7 @@ LL | | (a, b)
|
||||||
LL | | }
|
LL | | }
|
||||||
| |_^
|
| |_^
|
||||||
|
|
|
|
||||||
= note: hidden type `(&u8, &u8)` captures lifetime '_#4r
|
= note: hidden type `(&u8, &u8)` captures lifetime '_#5r
|
||||||
|
|
||||||
error[E0700]: hidden type for `impl Trait` captures lifetime that does not appear in bounds
|
error[E0700]: hidden type for `impl Trait` captures lifetime that does not appear in bounds
|
||||||
--> $DIR/ret-impl-trait-no-fg.rs:9:1
|
--> $DIR/ret-impl-trait-no-fg.rs:9:1
|
||||||
|
@ -48,7 +48,7 @@ LL | | (a, b)
|
||||||
LL | | }
|
LL | | }
|
||||||
| |_^
|
| |_^
|
||||||
|
|
|
|
||||||
= note: hidden type `(&u8, &u8)` captures lifetime '_#5r
|
= note: hidden type `(&u8, &u8)` captures lifetime '_#6r
|
||||||
|
|
||||||
error: aborting due to 5 previous errors
|
error: aborting due to 5 previous errors
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,7 @@ error: higher-ranked subtype error
|
||||||
--> $DIR/due-to-where-clause.rs:2:5
|
--> $DIR/due-to-where-clause.rs:2:5
|
||||||
|
|
|
|
||||||
LL | test::<FooS>(&mut 42);
|
LL | test::<FooS>(&mut 42);
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^
|
||||||
|
|
||||||
error: aborting due to previous error
|
error: aborting due to previous error
|
||||||
|
|
||||||
|
|
|
@ -4,7 +4,7 @@ error[E0700]: hidden type for `impl Trait` captures lifetime that does not appea
|
||||||
LL | fn upper_bounds<'a, 'b, 'c, 'd, 'e>(a: Ordinary<'a>, b: Ordinary<'b>) -> impl Trait<'d, 'e>
|
LL | fn upper_bounds<'a, 'b, 'c, 'd, 'e>(a: Ordinary<'a>, b: Ordinary<'b>) -> impl Trait<'d, 'e>
|
||||||
| ^^^^^^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^^^^^^
|
||||||
|
|
|
|
||||||
= note: hidden type `Ordinary<'_>` captures lifetime '_#8r
|
= note: hidden type `Ordinary<'_>` captures lifetime '_#9r
|
||||||
|
|
||||||
error: aborting due to previous error
|
error: aborting due to previous error
|
||||||
|
|
||||||
|
|
|
@ -4,7 +4,7 @@ error[E0700]: hidden type for `impl Trait` captures lifetime that does not appea
|
||||||
LL | fn upper_bounds<'a, 'b>(a: Ordinary<'a>, b: Ordinary<'b>) -> impl Trait<'a, 'b>
|
LL | fn upper_bounds<'a, 'b>(a: Ordinary<'a>, b: Ordinary<'b>) -> impl Trait<'a, 'b>
|
||||||
| ^^^^^^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^^^^^^
|
||||||
|
|
|
|
||||||
= note: hidden type `Ordinary<'_>` captures lifetime '_#5r
|
= note: hidden type `Ordinary<'_>` captures lifetime '_#6r
|
||||||
|
|
||||||
error: aborting due to previous error
|
error: aborting due to previous error
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,15 @@
|
||||||
|
// Regression test for issue #68550.
|
||||||
|
//
|
||||||
|
// The `&'static A:` where clause was triggering
|
||||||
|
// ICEs because it wound up being compiled to reference
|
||||||
|
// the `'empty(U0)` region.
|
||||||
|
|
||||||
|
fn run<'a, A>(x: A)
|
||||||
|
where
|
||||||
|
A: 'static,
|
||||||
|
&'static A: ,
|
||||||
|
{
|
||||||
|
let _: &'a A = &x; //~ ERROR `x` does not live long enough
|
||||||
|
}
|
||||||
|
|
||||||
|
fn main() {}
|
|
@ -0,0 +1,16 @@
|
||||||
|
error[E0597]: `x` does not live long enough
|
||||||
|
--> $DIR/issue-68550.rs:12:20
|
||||||
|
|
|
||||||
|
LL | fn run<'a, A>(x: A)
|
||||||
|
| -- lifetime `'a` defined here
|
||||||
|
...
|
||||||
|
LL | let _: &'a A = &x;
|
||||||
|
| ----- ^^ borrowed value does not live long enough
|
||||||
|
| |
|
||||||
|
| type annotation requires that `x` is borrowed for `'a`
|
||||||
|
LL | }
|
||||||
|
| - `x` dropped here while still borrowed
|
||||||
|
|
||||||
|
error: aborting due to previous error
|
||||||
|
|
||||||
|
For more information about this error, try `rustc --explain E0597`.
|
Loading…
Reference in New Issue