1
Fork 0

Auto merge of #94062 - Mark-Simulacrum:drop-print-cfg, r=oli-obk

Move ty::print methods to Drop-based scope guards

Primary goal is reducing codegen of the TLS access for each closure, which shaves ~3 seconds of bootstrap time over rustc as a whole.
This commit is contained in:
bors 2022-02-20 18:12:59 +00:00
commit 523a1b1d38
30 changed files with 142 additions and 142 deletions

View file

@ -161,7 +161,7 @@ impl<'a, 'tcx> InferCtxtExt<'tcx> for InferCtxt<'a, 'tcx> {
}
// Add all types without trimmed paths.
ty::print::with_no_trimmed_paths(|| {
ty::print::with_no_trimmed_paths!({
let generics = self.tcx.generics_of(def_id);
let self_ty = trait_ref.self_ty();
// This is also included through the generics list as `Self`,

View file

@ -443,9 +443,9 @@ impl<'a, 'tcx> InferCtxtExt<'tcx> for InferCtxt<'a, 'tcx> {
{
// Missing generic type parameter bound.
let param_name = self_ty.to_string();
let constraint = with_no_trimmed_paths(|| {
let constraint = with_no_trimmed_paths!(
trait_pred.print_modifiers_and_trait_path().to_string()
});
);
if suggest_constraining_type_param(
self.tcx,
generics,

View file

@ -92,7 +92,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
if !candidate_set.ambiguous && no_candidates_apply {
let trait_ref = stack.obligation.predicate.skip_binder().trait_ref;
let self_ty = trait_ref.self_ty();
let (trait_desc, self_desc) = with_no_trimmed_paths(|| {
let (trait_desc, self_desc) = with_no_trimmed_paths!({
let trait_desc = trait_ref.print_only_trait_path().to_string();
let self_desc = if self_ty.has_concrete_skeleton() {
Some(self_ty.to_string())

View file

@ -922,7 +922,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
if !candidate_set.ambiguous && candidate_set.vec.is_empty() {
let trait_ref = stack.obligation.predicate.skip_binder().trait_ref;
let self_ty = trait_ref.self_ty();
let cause = with_no_trimmed_paths(|| {
let cause = with_no_trimmed_paths!({
IntercrateAmbiguityCause::DownstreamCrate {
trait_desc: trait_ref.print_only_trait_path().to_string(),
self_desc: if self_ty.has_concrete_skeleton() {

View file

@ -106,7 +106,7 @@ impl ChildrenExt<'_> for Children {
let self_ty = trait_ref.self_ty();
// FIXME: should postpone string formatting until we decide to actually emit.
with_no_trimmed_paths(|| {
with_no_trimmed_paths!({
OverlapError {
with_impl: possible_sibling,
trait_desc: trait_ref.print_only_trait_path().to_string(),