mirror of
https://github.com/rust-lang/rust.git
synced 2024-10-31 14:31:55 +00:00
tweak debug output and bless tests
This commit is contained in:
parent
97381d2f1e
commit
427dc18c25
@ -10,10 +10,9 @@ use rustc_middle::mir::{
|
||||
BasicBlock, Body, ClosureOutlivesSubject, ClosureRegionRequirements, LocalKind, Location,
|
||||
Promoted,
|
||||
};
|
||||
use rustc_middle::ty::{self, OpaqueHiddenType, Region, RegionVid};
|
||||
use rustc_middle::ty::{self, OpaqueHiddenType, Region, RegionVid, TyCtxt};
|
||||
use rustc_span::symbol::sym;
|
||||
use std::env;
|
||||
use std::fmt::Debug;
|
||||
use std::io;
|
||||
use std::path::PathBuf;
|
||||
use std::rc::Rc;
|
||||
@ -325,7 +324,7 @@ pub(super) fn dump_mir_results<'tcx>(
|
||||
infcx: &BorrowckInferCtxt<'_, 'tcx>,
|
||||
body: &Body<'tcx>,
|
||||
regioncx: &RegionInferenceContext<'tcx>,
|
||||
closure_region_requirements: &Option<ClosureRegionRequirements<'_>>,
|
||||
closure_region_requirements: &Option<ClosureRegionRequirements<'tcx>>,
|
||||
) {
|
||||
if !dump_enabled(infcx.tcx, "nll", body.source.def_id()) {
|
||||
return;
|
||||
@ -340,9 +339,11 @@ pub(super) fn dump_mir_results<'tcx>(
|
||||
|
||||
if let Some(closure_region_requirements) = closure_region_requirements {
|
||||
writeln!(out, "| Free Region Constraints")?;
|
||||
for_each_region_constraint(closure_region_requirements, &mut |msg| {
|
||||
writeln!(out, "| {}", msg)
|
||||
})?;
|
||||
for_each_region_constraint(
|
||||
infcx.tcx,
|
||||
closure_region_requirements,
|
||||
&mut |msg| writeln!(out, "| {}", msg),
|
||||
)?;
|
||||
writeln!(out, "|")?;
|
||||
}
|
||||
}
|
||||
@ -375,7 +376,7 @@ pub(super) fn dump_annotation<'tcx>(
|
||||
infcx: &BorrowckInferCtxt<'_, 'tcx>,
|
||||
body: &Body<'tcx>,
|
||||
regioncx: &RegionInferenceContext<'tcx>,
|
||||
closure_region_requirements: &Option<ClosureRegionRequirements<'_>>,
|
||||
closure_region_requirements: &Option<ClosureRegionRequirements<'tcx>>,
|
||||
opaque_type_values: &VecMap<LocalDefId, OpaqueHiddenType<'tcx>>,
|
||||
errors: &mut crate::error::BorrowckErrors<'tcx>,
|
||||
) {
|
||||
@ -405,7 +406,7 @@ pub(super) fn dump_annotation<'tcx>(
|
||||
|
||||
// Dump the region constraints we are imposing *between* those
|
||||
// newly created variables.
|
||||
for_each_region_constraint(closure_region_requirements, &mut |msg| {
|
||||
for_each_region_constraint(tcx, closure_region_requirements, &mut |msg| {
|
||||
err.note(msg);
|
||||
Ok(())
|
||||
})
|
||||
@ -426,16 +427,19 @@ pub(super) fn dump_annotation<'tcx>(
|
||||
errors.buffer_non_error_diag(err);
|
||||
}
|
||||
|
||||
fn for_each_region_constraint(
|
||||
closure_region_requirements: &ClosureRegionRequirements<'_>,
|
||||
fn for_each_region_constraint<'tcx>(
|
||||
tcx: TyCtxt<'tcx>,
|
||||
closure_region_requirements: &ClosureRegionRequirements<'tcx>,
|
||||
with_msg: &mut dyn FnMut(&str) -> io::Result<()>,
|
||||
) -> io::Result<()> {
|
||||
for req in &closure_region_requirements.outlives_requirements {
|
||||
let subject: &dyn Debug = match &req.subject {
|
||||
ClosureOutlivesSubject::Region(subject) => subject,
|
||||
ClosureOutlivesSubject::Ty(ty) => ty,
|
||||
let subject = match req.subject {
|
||||
ClosureOutlivesSubject::Region(subject) => format!("{:?}", subject),
|
||||
ClosureOutlivesSubject::Ty(ty) => {
|
||||
format!("{:?}", ty.instantiate(tcx, |vid| tcx.mk_re_var(vid)))
|
||||
}
|
||||
};
|
||||
with_msg(&format!("where {:?}: {:?}", subject, req.outlived_free_region,))?;
|
||||
with_msg(&format!("where {}: {:?}", subject, req.outlived_free_region,))?;
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
|
@ -110,7 +110,7 @@ LL | with_signature(cell, t, |cell, t| require(cell, t));
|
||||
(),
|
||||
]
|
||||
= note: number of external vids: 4
|
||||
= note: where <T as Anything<ReEarlyBound(1, 'b)>>::AssocType: '_#3r
|
||||
= note: where <T as Anything<'_#2r>>::AssocType: '_#3r
|
||||
|
||||
note: no external requirements
|
||||
--> $DIR/projection-one-region-closure.rs:62:1
|
||||
|
@ -86,7 +86,7 @@ LL | with_signature(cell, t, |cell, t| require(cell, t));
|
||||
(),
|
||||
]
|
||||
= note: number of external vids: 4
|
||||
= note: where <T as Anything<ReEarlyBound(1, 'b)>>::AssocType: '_#3r
|
||||
= note: where <T as Anything<'_#2r>>::AssocType: '_#3r
|
||||
|
||||
note: no external requirements
|
||||
--> $DIR/projection-one-region-trait-bound-closure.rs:52:1
|
||||
|
@ -11,7 +11,7 @@ LL | with_signature(cell, t, |cell, t| require(cell, t));
|
||||
]
|
||||
= note: late-bound region is '_#4r
|
||||
= note: number of external vids: 5
|
||||
= note: where <T as Anything<ReEarlyBound(0, 'b), ReEarlyBound(1, 'c)>>::AssocType: '_#3r
|
||||
= note: where <T as Anything<'_#1r, '_#2r>>::AssocType: '_#3r
|
||||
|
||||
note: no external requirements
|
||||
--> $DIR/projection-two-region-trait-bound-closure.rs:34:1
|
||||
@ -23,14 +23,14 @@ LL | | T: Anything<'b, 'c>,
|
||||
|
|
||||
= note: defining type: no_relationships_late::<'_#1r, '_#2r, T>
|
||||
|
||||
error[E0309]: the associated type `<T as Anything<ReEarlyBound(0, 'b), ReEarlyBound(1, 'c)>>::AssocType` may not live long enough
|
||||
error[E0309]: the associated type `<T as Anything<'_#5r, '_#6r>>::AssocType` may not live long enough
|
||||
--> $DIR/projection-two-region-trait-bound-closure.rs:38:39
|
||||
|
|
||||
LL | with_signature(cell, t, |cell, t| require(cell, t));
|
||||
| ^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= help: consider adding an explicit lifetime bound `<T as Anything<ReEarlyBound(0, 'b), ReEarlyBound(1, 'c)>>::AssocType: 'a`...
|
||||
= note: ...so that the type `<T as Anything<ReEarlyBound(0, 'b), ReEarlyBound(1, 'c)>>::AssocType` will meet its required lifetime bounds
|
||||
= help: consider adding an explicit lifetime bound `<T as Anything<'_#5r, '_#6r>>::AssocType: 'a`...
|
||||
= note: ...so that the type `<T as Anything<'_#5r, '_#6r>>::AssocType` will meet its required lifetime bounds
|
||||
|
||||
note: external requirements
|
||||
--> $DIR/projection-two-region-trait-bound-closure.rs:48:29
|
||||
@ -44,7 +44,7 @@ LL | with_signature(cell, t, |cell, t| require(cell, t));
|
||||
(),
|
||||
]
|
||||
= note: number of external vids: 5
|
||||
= note: where <T as Anything<ReEarlyBound(1, 'b), ReEarlyBound(2, 'c)>>::AssocType: '_#4r
|
||||
= note: where <T as Anything<'_#2r, '_#3r>>::AssocType: '_#4r
|
||||
|
||||
note: no external requirements
|
||||
--> $DIR/projection-two-region-trait-bound-closure.rs:43:1
|
||||
@ -57,14 +57,14 @@ LL | | 'a: 'a,
|
||||
|
|
||||
= note: defining type: no_relationships_early::<'_#1r, '_#2r, '_#3r, T>
|
||||
|
||||
error[E0309]: the associated type `<T as Anything<ReEarlyBound(1, 'b), ReEarlyBound(2, 'c)>>::AssocType` may not live long enough
|
||||
error[E0309]: the associated type `<T as Anything<'_#6r, '_#7r>>::AssocType` may not live long enough
|
||||
--> $DIR/projection-two-region-trait-bound-closure.rs:48:39
|
||||
|
|
||||
LL | with_signature(cell, t, |cell, t| require(cell, t));
|
||||
| ^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= help: consider adding an explicit lifetime bound `<T as Anything<ReEarlyBound(1, 'b), ReEarlyBound(2, 'c)>>::AssocType: 'a`...
|
||||
= note: ...so that the type `<T as Anything<ReEarlyBound(1, 'b), ReEarlyBound(2, 'c)>>::AssocType` will meet its required lifetime bounds
|
||||
= help: consider adding an explicit lifetime bound `<T as Anything<'_#6r, '_#7r>>::AssocType: 'a`...
|
||||
= note: ...so that the type `<T as Anything<'_#6r, '_#7r>>::AssocType` will meet its required lifetime bounds
|
||||
|
||||
note: external requirements
|
||||
--> $DIR/projection-two-region-trait-bound-closure.rs:61:29
|
||||
@ -78,7 +78,7 @@ LL | with_signature(cell, t, |cell, t| require(cell, t));
|
||||
(),
|
||||
]
|
||||
= note: number of external vids: 5
|
||||
= note: where <T as Anything<ReEarlyBound(1, 'b), ReEarlyBound(2, 'c)>>::AssocType: '_#4r
|
||||
= note: where <T as Anything<'_#2r, '_#3r>>::AssocType: '_#4r
|
||||
|
||||
note: no external requirements
|
||||
--> $DIR/projection-two-region-trait-bound-closure.rs:53:1
|
||||
@ -103,7 +103,7 @@ LL | with_signature(cell, t, |cell, t| require(cell, t));
|
||||
(),
|
||||
]
|
||||
= note: number of external vids: 5
|
||||
= note: where <T as Anything<ReEarlyBound(1, 'b), ReEarlyBound(2, 'c)>>::AssocType: '_#4r
|
||||
= note: where <T as Anything<'_#2r, '_#3r>>::AssocType: '_#4r
|
||||
|
||||
note: no external requirements
|
||||
--> $DIR/projection-two-region-trait-bound-closure.rs:65:1
|
||||
@ -128,7 +128,7 @@ LL | with_signature(cell, t, |cell, t| require(cell, t));
|
||||
(),
|
||||
]
|
||||
= note: number of external vids: 5
|
||||
= note: where <T as Anything<ReEarlyBound(1, 'b), ReEarlyBound(2, 'c)>>::AssocType: '_#4r
|
||||
= note: where <T as Anything<'_#2r, '_#3r>>::AssocType: '_#4r
|
||||
|
||||
note: no external requirements
|
||||
--> $DIR/projection-two-region-trait-bound-closure.rs:74:1
|
||||
@ -154,7 +154,7 @@ LL | with_signature(cell, t, |cell, t| require(cell, t));
|
||||
]
|
||||
= note: late-bound region is '_#3r
|
||||
= note: number of external vids: 4
|
||||
= note: where <T as Anything<ReEarlyBound(0, 'b), ReEarlyBound(0, 'b)>>::AssocType: '_#2r
|
||||
= note: where <T as Anything<'_#1r, '_#1r>>::AssocType: '_#2r
|
||||
|
||||
note: no external requirements
|
||||
--> $DIR/projection-two-region-trait-bound-closure.rs:83:1
|
||||
@ -194,7 +194,7 @@ LL | with_signature(cell, t, |cell, t| require(cell, t));
|
||||
(),
|
||||
]
|
||||
= note: number of external vids: 4
|
||||
= note: where <T as Anything<ReEarlyBound(1, 'b), ReEarlyBound(1, 'b)>>::AssocType: '_#3r
|
||||
= note: where <T as Anything<'_#2r, '_#2r>>::AssocType: '_#3r
|
||||
|
||||
note: no external requirements
|
||||
--> $DIR/projection-two-region-trait-bound-closure.rs:92:1
|
||||
@ -219,7 +219,7 @@ LL | with_signature(cell, t, |cell, t| require(cell, t));
|
||||
(),
|
||||
]
|
||||
= note: number of external vids: 3
|
||||
= note: where <T as Anything<ReEarlyBound(0, 'a), ReEarlyBound(0, 'a)>>::AssocType: '_#2r
|
||||
= note: where <T as Anything<'_#1r, '_#1r>>::AssocType: '_#2r
|
||||
|
||||
note: no external requirements
|
||||
--> $DIR/projection-two-region-trait-bound-closure.rs:101:1
|
||||
|
Loading…
Reference in New Issue
Block a user