Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rustc_mir: use nicer path printing for #[rustc_regions] NLL tests. #66911

Merged
merged 1 commit into from
Dec 6, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 10 additions & 12 deletions src/librustc_mir/borrow_check/nll/universal_regions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -312,9 +312,9 @@ impl<'tcx> UniversalRegions<'tcx> {
match self.defining_ty {
DefiningTy::Closure(def_id, substs) => {
err.note(&format!(
"defining type: {:?} with closure substs {:#?}",
def_id,
&substs[..]
"defining type: {} with closure substs {:#?}",
tcx.def_path_str_with_substs(def_id, substs),
&substs[tcx.generics_of(def_id).parent_count..],
));

// FIXME: It'd be nice to print the late-bound regions
Expand All @@ -332,9 +332,9 @@ impl<'tcx> UniversalRegions<'tcx> {
}
DefiningTy::Generator(def_id, substs, _) => {
err.note(&format!(
"defining type: {:?} with generator substs {:#?}",
def_id,
&substs[..]
"defining type: {} with generator substs {:#?}",
tcx.def_path_str_with_substs(def_id, substs),
&substs[tcx.generics_of(def_id).parent_count..],
));

// FIXME: As above, we'd like to print out the region
Expand All @@ -350,16 +350,14 @@ impl<'tcx> UniversalRegions<'tcx> {
}
DefiningTy::FnDef(def_id, substs) => {
err.note(&format!(
"defining type: {:?} with substs {:#?}",
def_id,
&substs[..]
"defining type: {}",
tcx.def_path_str_with_substs(def_id, substs),
));
}
DefiningTy::Const(def_id, substs) => {
err.note(&format!(
"defining constant type: {:?} with substs {:#?}",
def_id,
&substs[..]
"defining constant type: {}",
tcx.def_path_str_with_substs(def_id, substs),
));
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ note: No external requirements
LL | let mut closure = expect_sig(|p, y| *p = y);
| ^^^^^^^^^^^^^
|
= note: defining type: DefId(0:4 ~ escape_argument_callee[317d]::test[0]::{{closure}}[0]) with closure substs [
= note: defining type: test::{{closure}}#0 with closure substs [
i16,
for<'r, 's, 't0> extern "rust-call" fn((&ReLateBound(DebruijnIndex(0), BrNamed(crate0:DefIndex(0), 'r)) mut &ReLateBound(DebruijnIndex(0), BrNamed(crate0:DefIndex(0), 's)) i32, &ReLateBound(DebruijnIndex(0), BrNamed(crate0:DefIndex(0), 't0)) i32)),
]
Expand All @@ -30,7 +30,7 @@ LL | | deref(p);
LL | | }
| |_^
|
= note: defining type: DefId(0:3 ~ escape_argument_callee[317d]::test[0]) with substs []
= note: defining type: test

error: aborting due to previous error

4 changes: 2 additions & 2 deletions src/test/ui/nll/closure-requirements/escape-argument.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ note: No external requirements
LL | let mut closure = expect_sig(|p, y| *p = y);
| ^^^^^^^^^^^^^
|
= note: defining type: DefId(0:4 ~ escape_argument[317d]::test[0]::{{closure}}[0]) with closure substs [
= note: defining type: test::{{closure}}#0 with closure substs [
i16,
for<'r, 's> extern "rust-call" fn((&ReLateBound(DebruijnIndex(0), BrNamed(crate0:DefIndex(0), 'r)) mut &ReLateBound(DebruijnIndex(0), BrNamed(crate0:DefIndex(0), 's)) i32, &ReLateBound(DebruijnIndex(0), BrNamed(crate0:DefIndex(0), 's)) i32)),
]
Expand All @@ -21,7 +21,7 @@ LL | | deref(p);
LL | | }
| |_^
|
= note: defining type: DefId(0:3 ~ escape_argument[317d]::test[0]) with substs []
= note: defining type: test

error[E0597]: `y` does not live long enough
--> $DIR/escape-argument.rs:27:25
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ note: External requirements
LL | let mut closure1 = || p = &y;
| ^^^^^^^^^
|
= note: defining type: DefId(0:5 ~ escape_upvar_nested[317d]::test[0]::{{closure}}[0]::{{closure}}[0]) with closure substs [
= note: defining type: test::{{closure}}#0::{{closure}}#0 with closure substs [
i16,
extern "rust-call" fn(()),
&'_#1r i32,
Expand All @@ -23,7 +23,7 @@ LL | | closure1();
LL | | };
| |_________^
|
= note: defining type: DefId(0:4 ~ escape_upvar_nested[317d]::test[0]::{{closure}}[0]) with closure substs [
= note: defining type: test::{{closure}}#0 with closure substs [
i16,
extern "rust-call" fn(()),
&'_#1r i32,
Expand All @@ -44,7 +44,7 @@ LL | | deref(p);
LL | | }
| |_^
|
= note: defining type: DefId(0:3 ~ escape_upvar_nested[317d]::test[0]) with substs []
= note: defining type: test

error[E0597]: `y` does not live long enough
--> $DIR/escape-upvar-nested.rs:21:40
Expand Down
4 changes: 2 additions & 2 deletions src/test/ui/nll/closure-requirements/escape-upvar-ref.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ note: External requirements
LL | let mut closure = || p = &y;
| ^^^^^^^^^
|
= note: defining type: DefId(0:4 ~ escape_upvar_ref[317d]::test[0]::{{closure}}[0]) with closure substs [
= note: defining type: test::{{closure}}#0 with closure substs [
i16,
extern "rust-call" fn(()),
&'_#1r i32,
Expand All @@ -25,7 +25,7 @@ LL | | deref(p);
LL | | }
| |_^
|
= note: defining type: DefId(0:3 ~ escape_upvar_ref[317d]::test[0]) with substs []
= note: defining type: test

error[E0597]: `y` does not live long enough
--> $DIR/escape-upvar-ref.rs:23:35
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ LL | | demand_y(x, y, p)
LL | | },
| |_________^
|
= note: defining type: DefId(0:18 ~ propagate_approximated_fail_no_postdom[317d]::supply[0]::{{closure}}[0]) with closure substs [
= note: defining type: supply::{{closure}}#0 with closure substs [
i16,
for<'r, 's> extern "rust-call" fn((std::cell::Cell<&'_#1r &ReLateBound(DebruijnIndex(0), BrNamed(crate0:DefIndex(0), 'r)) u32>, std::cell::Cell<&'_#2r &ReLateBound(DebruijnIndex(0), BrNamed(crate0:DefIndex(0), 'r)) u32>, std::cell::Cell<&ReLateBound(DebruijnIndex(0), BrNamed(crate0:DefIndex(0), 's)) &'_#3r u32>, std::cell::Cell<&ReLateBound(DebruijnIndex(0), BrNamed(crate0:DefIndex(0), 'r)) u32>, std::cell::Cell<&ReLateBound(DebruijnIndex(0), BrNamed(crate0:DefIndex(0), 's)) u32>)),
]
Expand Down Expand Up @@ -39,7 +39,7 @@ LL | | );
LL | | }
| |_^
|
= note: defining type: DefId(0:14 ~ propagate_approximated_fail_no_postdom[317d]::supply[0]) with substs []
= note: defining type: supply

error: aborting due to previous error

Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ LL | |
LL | | });
| |_____^
|
= note: defining type: DefId(0:16 ~ propagate_approximated_ref[317d]::supply[0]::{{closure}}[0]) with closure substs [
= note: defining type: supply::{{closure}}#0 with closure substs [
i16,
for<'r, 's, 't0, 't1, 't2, 't3> extern "rust-call" fn((&ReLateBound(DebruijnIndex(0), BrNamed(crate0:DefIndex(0), 'r)) std::cell::Cell<&'_#1r &ReLateBound(DebruijnIndex(0), BrNamed(crate0:DefIndex(0), 's)) u32>, &ReLateBound(DebruijnIndex(0), BrNamed(crate0:DefIndex(0), 't0)) std::cell::Cell<&ReLateBound(DebruijnIndex(0), BrNamed(crate0:DefIndex(0), 't1)) &'_#2r u32>, &ReLateBound(DebruijnIndex(0), BrNamed(crate0:DefIndex(0), 't2)) std::cell::Cell<&ReLateBound(DebruijnIndex(0), BrNamed(crate0:DefIndex(0), 's)) u32>, &ReLateBound(DebruijnIndex(0), BrNamed(crate0:DefIndex(0), 't3)) std::cell::Cell<&ReLateBound(DebruijnIndex(0), BrNamed(crate0:DefIndex(0), 't1)) u32>)),
]
Expand All @@ -30,7 +30,7 @@ LL | | });
LL | | }
| |_^
|
= note: defining type: DefId(0:13 ~ propagate_approximated_ref[317d]::supply[0]) with substs []
= note: defining type: supply

error: lifetime may not live long enough
--> $DIR/propagate-approximated-ref.rs:45:9
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ LL | |
LL | | })
| |_____^
|
= note: defining type: DefId(0:9 ~ propagate_approximated_shorter_to_static_comparing_against_free[317d]::case1[0]::{{closure}}[0]) with closure substs [
= note: defining type: case1::{{closure}}#0 with closure substs [
i32,
for<'r> extern "rust-call" fn((std::cell::Cell<&'_#1r u32>, std::cell::Cell<&ReLateBound(DebruijnIndex(0), BrNamed(crate0:DefIndex(0), 'r)) u32>)),
]
Expand All @@ -35,7 +35,7 @@ LL | | })
LL | | }
| |_^
|
= note: defining type: DefId(0:8 ~ propagate_approximated_shorter_to_static_comparing_against_free[317d]::case1[0]) with substs []
= note: defining type: case1

note: External requirements
--> $DIR/propagate-approximated-shorter-to-static-comparing-against-free.rs:35:15
Expand All @@ -46,7 +46,7 @@ LL | | cell_x.set(cell_a.get()); // forces 'a: 'x, implies 'a = 'static
LL | | })
| |_____^
|
= note: defining type: DefId(0:11 ~ propagate_approximated_shorter_to_static_comparing_against_free[317d]::case2[0]::{{closure}}[0]) with closure substs [
= note: defining type: case2::{{closure}}#0 with closure substs [
i32,
for<'r> extern "rust-call" fn((std::cell::Cell<&'_#1r u32>, std::cell::Cell<&ReLateBound(DebruijnIndex(0), BrNamed(crate0:DefIndex(0), 'r)) u32>)),
]
Expand All @@ -65,7 +65,7 @@ LL | | })
LL | | }
| |_^
|
= note: defining type: DefId(0:10 ~ propagate_approximated_shorter_to_static_comparing_against_free[317d]::case2[0]) with substs []
= note: defining type: case2

error[E0597]: `a` does not live long enough
--> $DIR/propagate-approximated-shorter-to-static-comparing-against-free.rs:30:26
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ LL | | demand_y(x, y, x.get())
LL | | });
| |_____^
|
= note: defining type: DefId(0:16 ~ propagate_approximated_shorter_to_static_no_bound[317d]::supply[0]::{{closure}}[0]) with closure substs [
= note: defining type: supply::{{closure}}#0 with closure substs [
i16,
for<'r, 's, 't0, 't1, 't2> extern "rust-call" fn((&ReLateBound(DebruijnIndex(0), BrNamed(crate0:DefIndex(0), 'r)) std::cell::Cell<&'_#1r &ReLateBound(DebruijnIndex(0), BrNamed(crate0:DefIndex(0), 's)) u32>, &ReLateBound(DebruijnIndex(0), BrNamed(crate0:DefIndex(0), 't0)) std::cell::Cell<&ReLateBound(DebruijnIndex(0), BrNamed(crate0:DefIndex(0), 's)) u32>, &ReLateBound(DebruijnIndex(0), BrNamed(crate0:DefIndex(0), 't1)) std::cell::Cell<&ReLateBound(DebruijnIndex(0), BrNamed(crate0:DefIndex(0), 't2)) u32>)),
]
Expand All @@ -31,7 +31,7 @@ LL | | });
LL | | }
| |_^
|
= note: defining type: DefId(0:13 ~ propagate_approximated_shorter_to_static_no_bound[317d]::supply[0]) with substs []
= note: defining type: supply

error[E0521]: borrowed data escapes outside of function
--> $DIR/propagate-approximated-shorter-to-static-no-bound.rs:32:5
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ LL | | demand_y(x, y, x.get())
LL | | });
| |_____^
|
= note: defining type: DefId(0:16 ~ propagate_approximated_shorter_to_static_wrong_bound[317d]::supply[0]::{{closure}}[0]) with closure substs [
= note: defining type: supply::{{closure}}#0 with closure substs [
i16,
for<'r, 's, 't0, 't1, 't2, 't3> extern "rust-call" fn((&ReLateBound(DebruijnIndex(0), BrNamed(crate0:DefIndex(0), 'r)) std::cell::Cell<&'_#1r &ReLateBound(DebruijnIndex(0), BrNamed(crate0:DefIndex(0), 's)) u32>, &ReLateBound(DebruijnIndex(0), BrNamed(crate0:DefIndex(0), 't0)) std::cell::Cell<&'_#2r &ReLateBound(DebruijnIndex(0), BrNamed(crate0:DefIndex(0), 't1)) u32>, &ReLateBound(DebruijnIndex(0), BrNamed(crate0:DefIndex(0), 't2)) std::cell::Cell<&ReLateBound(DebruijnIndex(0), BrNamed(crate0:DefIndex(0), 's)) u32>, &ReLateBound(DebruijnIndex(0), BrNamed(crate0:DefIndex(0), 't3)) std::cell::Cell<&ReLateBound(DebruijnIndex(0), BrNamed(crate0:DefIndex(0), 't1)) u32>)),
]
Expand All @@ -31,7 +31,7 @@ LL | | });
LL | | }
| |_^
|
= note: defining type: DefId(0:13 ~ propagate_approximated_shorter_to_static_wrong_bound[317d]::supply[0]) with substs []
= note: defining type: supply

error[E0521]: borrowed data escapes outside of function
--> $DIR/propagate-approximated-shorter-to-static-wrong-bound.rs:35:5
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ LL | |
LL | | });
| |_____^
|
= note: defining type: DefId(0:16 ~ propagate_approximated_val[317d]::test[0]::{{closure}}[0]) with closure substs [
= note: defining type: test::{{closure}}#0 with closure substs [
i16,
for<'r, 's> extern "rust-call" fn((std::cell::Cell<&'_#1r &ReLateBound(DebruijnIndex(0), BrNamed(crate0:DefIndex(0), 'r)) u32>, std::cell::Cell<&ReLateBound(DebruijnIndex(0), BrNamed(crate0:DefIndex(0), 's)) &'_#2r u32>, std::cell::Cell<&ReLateBound(DebruijnIndex(0), BrNamed(crate0:DefIndex(0), 'r)) u32>, std::cell::Cell<&ReLateBound(DebruijnIndex(0), BrNamed(crate0:DefIndex(0), 's)) u32>)),
]
Expand All @@ -30,7 +30,7 @@ LL | | });
LL | | }
| |_^
|
= note: defining type: DefId(0:13 ~ propagate_approximated_val[317d]::test[0]) with substs []
= note: defining type: test

error: lifetime may not live long enough
--> $DIR/propagate-approximated-val.rs:38:9
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ LL | | demand_y(x, y, p)
LL | | },
| |_________^
|
= note: defining type: DefId(0:14 ~ propagate_despite_same_free_region[317d]::supply[0]::{{closure}}[0]) with closure substs [
= note: defining type: supply::{{closure}}#0 with closure substs [
i16,
for<'r, 's> extern "rust-call" fn((std::cell::Cell<&'_#1r &ReLateBound(DebruijnIndex(0), BrNamed(crate0:DefIndex(0), 'r)) u32>, std::cell::Cell<&ReLateBound(DebruijnIndex(0), BrNamed(crate0:DefIndex(0), 's)) &'_#2r u32>, std::cell::Cell<&ReLateBound(DebruijnIndex(0), BrNamed(crate0:DefIndex(0), 'r)) u32>, std::cell::Cell<&ReLateBound(DebruijnIndex(0), BrNamed(crate0:DefIndex(0), 's)) u32>)),
]
Expand All @@ -28,5 +28,5 @@ LL | | );
LL | | }
| |_^
|
= note: defining type: DefId(0:12 ~ propagate_despite_same_free_region[317d]::supply[0]) with substs []
= note: defining type: supply

Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ LL | |
LL | | });
| |_____^
|
= note: defining type: DefId(0:16 ~ propagate_fail_to_approximate_longer_no_bounds[317d]::supply[0]::{{closure}}[0]) with closure substs [
= note: defining type: supply::{{closure}}#0 with closure substs [
i16,
for<'r, 's, 't0, 't1, 't2> extern "rust-call" fn((&ReLateBound(DebruijnIndex(0), BrNamed(crate0:DefIndex(0), 'r)) std::cell::Cell<&ReLateBound(DebruijnIndex(0), BrNamed(crate0:DefIndex(0), 's)) &'_#1r u32>, &ReLateBound(DebruijnIndex(0), BrNamed(crate0:DefIndex(0), 't0)) std::cell::Cell<&ReLateBound(DebruijnIndex(0), BrNamed(crate0:DefIndex(0), 't1)) u32>, &ReLateBound(DebruijnIndex(0), BrNamed(crate0:DefIndex(0), 't2)) std::cell::Cell<&ReLateBound(DebruijnIndex(0), BrNamed(crate0:DefIndex(0), 's)) u32>)),
]
Expand Down Expand Up @@ -39,7 +39,7 @@ LL | | });
LL | | }
| |_^
|
= note: defining type: DefId(0:13 ~ propagate_fail_to_approximate_longer_no_bounds[317d]::supply[0]) with substs []
= note: defining type: supply

error: aborting due to previous error

Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ LL | |
LL | | });
| |_____^
|
= note: defining type: DefId(0:16 ~ propagate_fail_to_approximate_longer_wrong_bounds[317d]::supply[0]::{{closure}}[0]) with closure substs [
= note: defining type: supply::{{closure}}#0 with closure substs [
i16,
for<'r, 's, 't0, 't1, 't2, 't3> extern "rust-call" fn((&ReLateBound(DebruijnIndex(0), BrNamed(crate0:DefIndex(0), 'r)) std::cell::Cell<&ReLateBound(DebruijnIndex(0), BrNamed(crate0:DefIndex(0), 's)) &'_#1r u32>, &ReLateBound(DebruijnIndex(0), BrNamed(crate0:DefIndex(0), 't0)) std::cell::Cell<&ReLateBound(DebruijnIndex(0), BrNamed(crate0:DefIndex(0), 't1)) &'_#2r u32>, &ReLateBound(DebruijnIndex(0), BrNamed(crate0:DefIndex(0), 't2)) std::cell::Cell<&ReLateBound(DebruijnIndex(0), BrNamed(crate0:DefIndex(0), 's)) u32>, &ReLateBound(DebruijnIndex(0), BrNamed(crate0:DefIndex(0), 't3)) std::cell::Cell<&ReLateBound(DebruijnIndex(0), BrNamed(crate0:DefIndex(0), 't1)) u32>)),
]
Expand Down Expand Up @@ -39,7 +39,7 @@ LL | | });
LL | | }
| |_^
|
= note: defining type: DefId(0:13 ~ propagate_fail_to_approximate_longer_wrong_bounds[317d]::supply[0]) with substs []
= note: defining type: supply

error: aborting due to previous error

Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,7 @@ LL | | require(value);
LL | | });
| |_____^
|
= note: defining type: DefId(0:14 ~ propagate_from_trait_match[317d]::supply[0]::{{closure}}[0]) with closure substs [
'_#1r,
T,
= note: defining type: supply::<'_#1r, T>::{{closure}}#0 with closure substs [
i32,
extern "rust-call" fn((T,)),
]
Expand All @@ -32,10 +30,7 @@ LL | | });
LL | | }
| |_^
|
= note: defining type: DefId(0:11 ~ propagate_from_trait_match[317d]::supply[0]) with substs [
'_#1r,
T,
]
= note: defining type: supply::<'_#1r, T>

error[E0309]: the parameter type `T` may not live long enough
--> $DIR/propagate-from-trait-match.rs:32:36
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ note: No external requirements
LL | expect_sig(|a, b| b); // ought to return `a`
| ^^^^^^^^
|
= note: defining type: DefId(0:4 ~ return_wrong_bound_region[317d]::test[0]::{{closure}}[0]) with closure substs [
= note: defining type: test::{{closure}}#0 with closure substs [
i16,
for<'r, 's> extern "rust-call" fn((&ReLateBound(DebruijnIndex(0), BrNamed(crate0:DefIndex(0), 'r)) i32, &ReLateBound(DebruijnIndex(0), BrNamed(crate0:DefIndex(0), 's)) i32)) -> &ReLateBound(DebruijnIndex(0), BrNamed(crate0:DefIndex(0), 'r)) i32,
]
Expand All @@ -27,7 +27,7 @@ LL | |
LL | | }
| |_^
|
= note: defining type: DefId(0:3 ~ return_wrong_bound_region[317d]::test[0]) with substs []
= note: defining type: test

error: aborting due to previous error

Loading