Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit dde8cfa

Browse files
committedMay 12, 2024
Auto merge of rust-lang#125045 - GuillaumeGomez:rollup-em6qdzw, r=GuillaumeGomez
Rollup of 4 pull requests Successful merges: - rust-lang#125021 (Update reference safety requirements) - rust-lang#125022 (Migrate rustdoc scrape examples ordering) - rust-lang#125030 (Fix some minor issues from the ui-test auto-porting) - rust-lang#125036 (solve: all "non-structural" logging to trace) r? `@ghost` `@rustbot` modify labels: rollup
2 parents b71fa82 + d3625fc commit dde8cfa

35 files changed

+173
-99
lines changed
 

‎compiler/rustc_trait_selection/src/solve/alias_relate.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ use rustc_middle::traits::solve::{Certainty, Goal, QueryResult};
2020
use rustc_middle::ty;
2121

2222
impl<'tcx> EvalCtxt<'_, 'tcx> {
23-
#[instrument(level = "debug", skip(self), ret)]
23+
#[instrument(level = "trace", skip(self), ret)]
2424
pub(super) fn compute_alias_relate_goal(
2525
&mut self,
2626
goal: Goal<'tcx, (ty::Term<'tcx>, ty::Term<'tcx>, ty::AliasRelationDirection)>,
@@ -50,7 +50,7 @@ impl<'tcx> EvalCtxt<'_, 'tcx> {
5050
self.try_evaluate_added_goals()?;
5151
let lhs = self.resolve_vars_if_possible(lhs);
5252
let rhs = self.resolve_vars_if_possible(rhs);
53-
debug!(?lhs, ?rhs);
53+
trace!(?lhs, ?rhs);
5454

5555
let variance = match direction {
5656
ty::AliasRelationDirection::Equate => ty::Variance::Invariant,

‎compiler/rustc_trait_selection/src/solve/assembly/mod.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -331,7 +331,7 @@ impl<'tcx> EvalCtxt<'_, 'tcx> {
331331
.enter(|this| this.evaluate_added_goals_and_make_canonical_response(certainty))
332332
}
333333

334-
#[instrument(level = "debug", skip_all)]
334+
#[instrument(level = "trace", skip_all)]
335335
fn assemble_non_blanket_impl_candidates<G: GoalKind<'tcx>>(
336336
&mut self,
337337
goal: Goal<'tcx, G>,
@@ -447,7 +447,7 @@ impl<'tcx> EvalCtxt<'_, 'tcx> {
447447
}
448448
}
449449

450-
#[instrument(level = "debug", skip_all)]
450+
#[instrument(level = "trace", skip_all)]
451451
fn assemble_blanket_impl_candidates<G: GoalKind<'tcx>>(
452452
&mut self,
453453
goal: Goal<'tcx, G>,
@@ -470,7 +470,7 @@ impl<'tcx> EvalCtxt<'_, 'tcx> {
470470
}
471471
}
472472

473-
#[instrument(level = "debug", skip_all)]
473+
#[instrument(level = "trace", skip_all)]
474474
fn assemble_builtin_impl_candidates<G: GoalKind<'tcx>>(
475475
&mut self,
476476
goal: Goal<'tcx, G>,
@@ -544,7 +544,7 @@ impl<'tcx> EvalCtxt<'_, 'tcx> {
544544
}
545545
}
546546

547-
#[instrument(level = "debug", skip_all)]
547+
#[instrument(level = "trace", skip_all)]
548548
fn assemble_param_env_candidates<G: GoalKind<'tcx>>(
549549
&mut self,
550550
goal: Goal<'tcx, G>,
@@ -561,7 +561,7 @@ impl<'tcx> EvalCtxt<'_, 'tcx> {
561561
}
562562
}
563563

564-
#[instrument(level = "debug", skip_all)]
564+
#[instrument(level = "trace", skip_all)]
565565
fn assemble_alias_bound_candidates<G: GoalKind<'tcx>>(
566566
&mut self,
567567
goal: Goal<'tcx, G>,
@@ -665,7 +665,7 @@ impl<'tcx> EvalCtxt<'_, 'tcx> {
665665
}
666666
}
667667

668-
#[instrument(level = "debug", skip_all)]
668+
#[instrument(level = "trace", skip_all)]
669669
fn assemble_object_bound_candidates<G: GoalKind<'tcx>>(
670670
&mut self,
671671
goal: Goal<'tcx, G>,
@@ -756,7 +756,7 @@ impl<'tcx> EvalCtxt<'_, 'tcx> {
756756
///
757757
/// To do so we add an ambiguous candidate in case such an unknown impl could
758758
/// apply to the current goal.
759-
#[instrument(level = "debug", skip_all)]
759+
#[instrument(level = "trace", skip_all)]
760760
fn assemble_coherence_unknowable_candidates<G: GoalKind<'tcx>>(
761761
&mut self,
762762
goal: Goal<'tcx, G>,

‎compiler/rustc_trait_selection/src/solve/assembly/structural_traits.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ use crate::solve::EvalCtxt;
1717
//
1818
// For types with an "existential" binder, i.e. coroutine witnesses, we also
1919
// instantiate the binder with placeholders eagerly.
20-
#[instrument(level = "debug", skip(ecx), ret)]
20+
#[instrument(level = "trace", skip(ecx), ret)]
2121
pub(in crate::solve) fn instantiate_constituent_tys_for_auto_trait<'tcx>(
2222
ecx: &EvalCtxt<'_, 'tcx>,
2323
ty: Ty<'tcx>,
@@ -96,7 +96,7 @@ pub(in crate::solve) fn instantiate_constituent_tys_for_auto_trait<'tcx>(
9696
}
9797
}
9898

99-
#[instrument(level = "debug", skip(ecx), ret)]
99+
#[instrument(level = "trace", skip(ecx), ret)]
100100
pub(in crate::solve) fn instantiate_constituent_tys_for_sized_trait<'tcx>(
101101
ecx: &EvalCtxt<'_, 'tcx>,
102102
ty: Ty<'tcx>,
@@ -160,7 +160,7 @@ pub(in crate::solve) fn instantiate_constituent_tys_for_sized_trait<'tcx>(
160160
}
161161
}
162162

163-
#[instrument(level = "debug", skip(ecx), ret)]
163+
#[instrument(level = "trace", skip(ecx), ret)]
164164
pub(in crate::solve) fn instantiate_constituent_tys_for_copy_clone_trait<'tcx>(
165165
ecx: &EvalCtxt<'_, 'tcx>,
166166
ty: Ty<'tcx>,

‎compiler/rustc_trait_selection/src/solve/eval_ctxt/canonical.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ impl<'tcx> EvalCtxt<'_, 'tcx> {
8383
/// the values inferred while solving the instantiated goal.
8484
/// - `external_constraints`: additional constraints which aren't expressible
8585
/// using simple unification of inference variables.
86-
#[instrument(level = "debug", skip(self), ret)]
86+
#[instrument(level = "trace", skip(self), ret)]
8787
pub(in crate::solve) fn evaluate_added_goals_and_make_canonical_response(
8888
&mut self,
8989
certainty: Certainty,
@@ -166,15 +166,15 @@ impl<'tcx> EvalCtxt<'_, 'tcx> {
166166
/// external constraints do not need to record that opaque, since if it is
167167
/// further constrained by inference, that will be passed back in the var
168168
/// values.
169-
#[instrument(level = "debug", skip(self), ret)]
169+
#[instrument(level = "trace", skip(self), ret)]
170170
fn compute_external_query_constraints(
171171
&self,
172172
normalization_nested_goals: NestedNormalizationGoals<'tcx>,
173173
) -> Result<ExternalConstraintsData<'tcx>, NoSolution> {
174174
// We only check for leaks from universes which were entered inside
175175
// of the query.
176176
self.infcx.leak_check(self.max_input_universe, None).map_err(|e| {
177-
debug!(?e, "failed the leak check");
177+
trace!(?e, "failed the leak check");
178178
NoSolution
179179
})?;
180180

@@ -334,7 +334,7 @@ impl<'tcx> EvalCtxt<'_, 'tcx> {
334334
/// whether an alias is rigid by using the trait solver. When instantiating a response
335335
/// from the solver we assume that the solver correctly handled aliases and therefore
336336
/// always relate them structurally here.
337-
#[instrument(level = "debug", skip(infcx))]
337+
#[instrument(level = "trace", skip(infcx))]
338338
fn unify_query_var_values(
339339
infcx: &InferCtxt<'tcx>,
340340
param_env: ty::ParamEnv<'tcx>,
@@ -407,7 +407,7 @@ pub(in crate::solve) fn make_canonical_state<'tcx, T: TypeFoldable<TyCtxt<'tcx>>
407407
/// This currently assumes that unifying the var values trivially succeeds.
408408
/// Adding any inference constraints which weren't present when originally
409409
/// computing the canonical query can result in bugs.
410-
#[instrument(level = "debug", skip(infcx, span, param_env))]
410+
#[instrument(level = "trace", skip(infcx, span, param_env))]
411411
pub(in crate::solve) fn instantiate_canonical_state<'tcx, T: TypeFoldable<TyCtxt<'tcx>>>(
412412
infcx: &InferCtxt<'tcx>,
413413
span: Span,

‎compiler/rustc_trait_selection/src/solve/eval_ctxt/mod.rs

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -458,7 +458,7 @@ impl<'a, 'tcx> EvalCtxt<'a, 'tcx> {
458458
}
459459
}
460460

461-
#[instrument(level = "debug", skip(self))]
461+
#[instrument(level = "trace", skip(self))]
462462
pub(super) fn add_normalizes_to_goal(&mut self, goal: Goal<'tcx, ty::NormalizesTo<'tcx>>) {
463463
self.inspect.add_normalizes_to_goal(self.infcx, self.max_input_universe, goal);
464464
self.nested_goals.normalizes_to_goals.push(goal);
@@ -472,7 +472,7 @@ impl<'a, 'tcx> EvalCtxt<'a, 'tcx> {
472472

473473
// Recursively evaluates all the goals added to this `EvalCtxt` to completion, returning
474474
// the certainty of all the goals.
475-
#[instrument(level = "debug", skip(self))]
475+
#[instrument(level = "trace", skip(self))]
476476
pub(super) fn try_evaluate_added_goals(&mut self) -> Result<Certainty, NoSolution> {
477477
self.inspect.start_evaluate_added_goals();
478478
let mut response = Ok(Certainty::overflow(false));
@@ -526,7 +526,7 @@ impl<'a, 'tcx> EvalCtxt<'a, 'tcx> {
526526
unconstrained_goal,
527527
)?;
528528
// Add the nested goals from normalization to our own nested goals.
529-
debug!(?nested_goals);
529+
trace!(?nested_goals);
530530
goals.goals.extend(nested_goals);
531531

532532
// Finally, equate the goal's RHS with the unconstrained var.
@@ -622,7 +622,7 @@ impl<'tcx> EvalCtxt<'_, 'tcx> {
622622
///
623623
/// This is the case if the `term` does not occur in any other part of the predicate
624624
/// and is able to name all other placeholder and inference variables.
625-
#[instrument(level = "debug", skip(self), ret)]
625+
#[instrument(level = "trace", skip(self), ret)]
626626
pub(super) fn term_is_fully_unconstrained(
627627
&self,
628628
goal: Goal<'tcx, ty::NormalizesTo<'tcx>>,
@@ -718,7 +718,7 @@ impl<'tcx> EvalCtxt<'_, 'tcx> {
718718
&& goal.param_env.visit_with(&mut visitor).is_continue()
719719
}
720720

721-
#[instrument(level = "debug", skip(self, param_env), ret)]
721+
#[instrument(level = "trace", skip(self, param_env), ret)]
722722
pub(super) fn eq<T: ToTrace<'tcx>>(
723723
&mut self,
724724
param_env: ty::ParamEnv<'tcx>,
@@ -733,7 +733,7 @@ impl<'tcx> EvalCtxt<'_, 'tcx> {
733733
self.add_goals(GoalSource::Misc, obligations.into_iter().map(|o| o.into()));
734734
})
735735
.map_err(|e| {
736-
debug!(?e, "failed to equate");
736+
trace!(?e, "failed to equate");
737737
NoSolution
738738
})
739739
}
@@ -743,7 +743,7 @@ impl<'tcx> EvalCtxt<'_, 'tcx> {
743743
/// Normally we emit a nested `AliasRelate` when equating an inference
744744
/// variable and an alias. This causes us to instead constrain the inference
745745
/// variable to the alias without emitting a nested alias relate goals.
746-
#[instrument(level = "debug", skip(self, param_env), ret)]
746+
#[instrument(level = "trace", skip(self, param_env), ret)]
747747
pub(super) fn relate_rigid_alias_non_alias(
748748
&mut self,
749749
param_env: ty::ParamEnv<'tcx>,
@@ -781,7 +781,7 @@ impl<'tcx> EvalCtxt<'_, 'tcx> {
781781
/// This sohuld only be used when we're either instantiating a previously
782782
/// unconstrained "return value" or when we're sure that all aliases in
783783
/// the types are rigid.
784-
#[instrument(level = "debug", skip(self, param_env), ret)]
784+
#[instrument(level = "trace", skip(self, param_env), ret)]
785785
pub(super) fn eq_structurally_relating_aliases<T: ToTrace<'tcx>>(
786786
&mut self,
787787
param_env: ty::ParamEnv<'tcx>,
@@ -798,7 +798,7 @@ impl<'tcx> EvalCtxt<'_, 'tcx> {
798798
Ok(())
799799
}
800800

801-
#[instrument(level = "debug", skip(self, param_env), ret)]
801+
#[instrument(level = "trace", skip(self, param_env), ret)]
802802
pub(super) fn sub<T: ToTrace<'tcx>>(
803803
&mut self,
804804
param_env: ty::ParamEnv<'tcx>,
@@ -813,12 +813,12 @@ impl<'tcx> EvalCtxt<'_, 'tcx> {
813813
self.add_goals(GoalSource::Misc, obligations.into_iter().map(|o| o.into()));
814814
})
815815
.map_err(|e| {
816-
debug!(?e, "failed to subtype");
816+
trace!(?e, "failed to subtype");
817817
NoSolution
818818
})
819819
}
820820

821-
#[instrument(level = "debug", skip(self, param_env), ret)]
821+
#[instrument(level = "trace", skip(self, param_env), ret)]
822822
pub(super) fn relate<T: ToTrace<'tcx>>(
823823
&mut self,
824824
param_env: ty::ParamEnv<'tcx>,
@@ -834,7 +834,7 @@ impl<'tcx> EvalCtxt<'_, 'tcx> {
834834
self.add_goals(GoalSource::Misc, obligations.into_iter().map(|o| o.into()));
835835
})
836836
.map_err(|e| {
837-
debug!(?e, "failed to relate");
837+
trace!(?e, "failed to relate");
838838
NoSolution
839839
})
840840
}
@@ -859,7 +859,7 @@ impl<'tcx> EvalCtxt<'_, 'tcx> {
859859
obligations.into_iter().map(|o| o.into()).collect()
860860
})
861861
.map_err(|e| {
862-
debug!(?e, "failed to equate");
862+
trace!(?e, "failed to equate");
863863
NoSolution
864864
})
865865
}

‎compiler/rustc_trait_selection/src/solve/eval_ctxt/probe.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ impl<'tcx, F> TraitProbeCtxt<'_, '_, 'tcx, F>
5858
where
5959
F: FnOnce(&QueryResult<'tcx>) -> inspect::ProbeKind<'tcx>,
6060
{
61+
#[instrument(level = "debug", skip_all, fields(source = ?self.source))]
6162
pub(in crate::solve) fn enter(
6263
self,
6364
f: impl FnOnce(&mut EvalCtxt<'_, 'tcx>) -> QueryResult<'tcx>,

‎compiler/rustc_trait_selection/src/solve/fulfill.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ impl<'tcx> FulfillmentCtxt<'tcx> {
119119
}
120120

121121
impl<'tcx> TraitEngine<'tcx> for FulfillmentCtxt<'tcx> {
122-
#[instrument(level = "debug", skip(self, infcx))]
122+
#[instrument(level = "trace", skip(self, infcx))]
123123
fn register_predicate_obligation(
124124
&mut self,
125125
infcx: &InferCtxt<'tcx>,

‎compiler/rustc_trait_selection/src/solve/mod.rs

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ impl<'tcx> Canonical<'tcx, Response<'tcx>> {
8282
}
8383

8484
impl<'a, 'tcx> EvalCtxt<'a, 'tcx> {
85-
#[instrument(level = "debug", skip(self))]
85+
#[instrument(level = "trace", skip(self))]
8686
fn compute_type_outlives_goal(
8787
&mut self,
8888
goal: Goal<'tcx, TypeOutlivesPredicate<'tcx>>,
@@ -92,7 +92,7 @@ impl<'a, 'tcx> EvalCtxt<'a, 'tcx> {
9292
self.evaluate_added_goals_and_make_canonical_response(Certainty::Yes)
9393
}
9494

95-
#[instrument(level = "debug", skip(self))]
95+
#[instrument(level = "trace", skip(self))]
9696
fn compute_region_outlives_goal(
9797
&mut self,
9898
goal: Goal<'tcx, RegionOutlivesPredicate<'tcx>>,
@@ -102,7 +102,7 @@ impl<'a, 'tcx> EvalCtxt<'a, 'tcx> {
102102
self.evaluate_added_goals_and_make_canonical_response(Certainty::Yes)
103103
}
104104

105-
#[instrument(level = "debug", skip(self))]
105+
#[instrument(level = "trace", skip(self))]
106106
fn compute_coerce_goal(
107107
&mut self,
108108
goal: Goal<'tcx, CoercePredicate<'tcx>>,
@@ -117,7 +117,7 @@ impl<'a, 'tcx> EvalCtxt<'a, 'tcx> {
117117
})
118118
}
119119

120-
#[instrument(level = "debug", skip(self))]
120+
#[instrument(level = "trace", skip(self))]
121121
fn compute_subtype_goal(
122122
&mut self,
123123
goal: Goal<'tcx, SubtypePredicate<'tcx>>,
@@ -138,7 +138,7 @@ impl<'a, 'tcx> EvalCtxt<'a, 'tcx> {
138138
}
139139
}
140140

141-
#[instrument(level = "debug", skip(self))]
141+
#[instrument(level = "trace", skip(self))]
142142
fn compute_well_formed_goal(
143143
&mut self,
144144
goal: Goal<'tcx, ty::GenericArg<'tcx>>,
@@ -152,7 +152,7 @@ impl<'a, 'tcx> EvalCtxt<'a, 'tcx> {
152152
}
153153
}
154154

155-
#[instrument(level = "debug", skip(self))]
155+
#[instrument(level = "trace", skip(self))]
156156
fn compute_const_evaluatable_goal(
157157
&mut self,
158158
Goal { param_env, predicate: ct }: Goal<'tcx, ty::Const<'tcx>>,
@@ -189,7 +189,7 @@ impl<'a, 'tcx> EvalCtxt<'a, 'tcx> {
189189
}
190190
}
191191

192-
#[instrument(level = "debug", skip(self), ret)]
192+
#[instrument(level = "trace", skip(self), ret)]
193193
fn compute_const_arg_has_type_goal(
194194
&mut self,
195195
goal: Goal<'tcx, (ty::Const<'tcx>, Ty<'tcx>)>,
@@ -201,7 +201,7 @@ impl<'a, 'tcx> EvalCtxt<'a, 'tcx> {
201201
}
202202

203203
impl<'tcx> EvalCtxt<'_, 'tcx> {
204-
#[instrument(level = "debug", skip(self, goals))]
204+
#[instrument(level = "trace", skip(self, goals))]
205205
fn add_goals(
206206
&mut self,
207207
source: GoalSource,
@@ -215,7 +215,7 @@ impl<'tcx> EvalCtxt<'_, 'tcx> {
215215
/// Try to merge multiple possible ways to prove a goal, if that is not possible returns `None`.
216216
///
217217
/// In this case we tend to flounder and return ambiguity by calling `[EvalCtxt::flounder]`.
218-
#[instrument(level = "debug", skip(self), ret)]
218+
#[instrument(level = "trace", skip(self), ret)]
219219
fn try_merge_responses(
220220
&mut self,
221221
responses: &[CanonicalResponse<'tcx>],
@@ -241,7 +241,7 @@ impl<'tcx> EvalCtxt<'_, 'tcx> {
241241
}
242242

243243
/// If we fail to merge responses we flounder and return overflow or ambiguity.
244-
#[instrument(level = "debug", skip(self), ret)]
244+
#[instrument(level = "trace", skip(self), ret)]
245245
fn flounder(&mut self, responses: &[CanonicalResponse<'tcx>]) -> QueryResult<'tcx> {
246246
if responses.is_empty() {
247247
return Err(NoSolution);
@@ -263,7 +263,7 @@ impl<'tcx> EvalCtxt<'_, 'tcx> {
263263
/// This function is necessary in nearly all cases before matching on a type.
264264
/// Not doing so is likely to be incomplete and therefore unsound during
265265
/// coherence.
266-
#[instrument(level = "debug", skip(self, param_env), ret)]
266+
#[instrument(level = "trace", skip(self, param_env), ret)]
267267
fn structurally_normalize_ty(
268268
&mut self,
269269
param_env: ty::ParamEnv<'tcx>,

‎compiler/rustc_trait_selection/src/solve/normalize.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ impl<'tcx> FallibleTypeFolder<TyCtxt<'tcx>> for NormalizationFolder<'_, 'tcx> {
162162
Ok(t)
163163
}
164164

165-
#[instrument(level = "debug", skip(self), ret)]
165+
#[instrument(level = "trace", skip(self), ret)]
166166
fn try_fold_ty(&mut self, ty: Ty<'tcx>) -> Result<Ty<'tcx>, Self::Error> {
167167
let infcx = self.at.infcx;
168168
debug_assert_eq!(ty, infcx.shallow_resolve(ty));
@@ -189,7 +189,7 @@ impl<'tcx> FallibleTypeFolder<TyCtxt<'tcx>> for NormalizationFolder<'_, 'tcx> {
189189
}
190190
}
191191

192-
#[instrument(level = "debug", skip(self), ret)]
192+
#[instrument(level = "trace", skip(self), ret)]
193193
fn try_fold_const(&mut self, ct: ty::Const<'tcx>) -> Result<ty::Const<'tcx>, Self::Error> {
194194
let infcx = self.at.infcx;
195195
debug_assert_eq!(ct, infcx.shallow_resolve_const(ct));

‎compiler/rustc_trait_selection/src/solve/normalizes_to/anon_const.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ use rustc_middle::traits::solve::{Certainty, Goal, QueryResult};
33
use rustc_middle::ty;
44

55
impl<'tcx> EvalCtxt<'_, 'tcx> {
6-
#[instrument(level = "debug", skip(self), ret)]
6+
#[instrument(level = "trace", skip(self), ret)]
77
pub(super) fn normalize_anon_const(
88
&mut self,
99
goal: Goal<'tcx, ty::NormalizesTo<'tcx>>,

‎compiler/rustc_trait_selection/src/solve/normalizes_to/mod.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ mod opaque_types;
2525
mod weak_types;
2626

2727
impl<'tcx> EvalCtxt<'_, 'tcx> {
28-
#[instrument(level = "debug", skip(self), ret)]
28+
#[instrument(level = "trace", skip(self), ret)]
2929
pub(super) fn compute_normalizes_to_goal(
3030
&mut self,
3131
goal: Goal<'tcx, NormalizesTo<'tcx>>,
@@ -59,7 +59,7 @@ impl<'tcx> EvalCtxt<'_, 'tcx> {
5959

6060
/// Normalize the given alias by at least one step. If the alias is rigid, this
6161
/// returns `NoSolution`.
62-
#[instrument(level = "debug", skip(self), ret)]
62+
#[instrument(level = "trace", skip(self), ret)]
6363
fn normalize_at_least_one_step(
6464
&mut self,
6565
goal: Goal<'tcx, NormalizesTo<'tcx>>,
@@ -897,7 +897,7 @@ impl<'tcx> assembly::GoalKind<'tcx> for NormalizesTo<'tcx> {
897897
///
898898
/// FIXME: We should merge these 3 implementations as it's likely that they otherwise
899899
/// diverge.
900-
#[instrument(level = "debug", skip(ecx, param_env), ret)]
900+
#[instrument(level = "trace", skip(ecx, param_env), ret)]
901901
fn fetch_eligible_assoc_item_def<'tcx>(
902902
ecx: &EvalCtxt<'_, 'tcx>,
903903
param_env: ty::ParamEnv<'tcx>,
@@ -920,7 +920,7 @@ fn fetch_eligible_assoc_item_def<'tcx>(
920920
let poly_trait_ref = ecx.resolve_vars_if_possible(goal_trait_ref);
921921
!poly_trait_ref.still_further_specializable()
922922
} else {
923-
debug!(?node_item.item.def_id, "not eligible due to default");
923+
trace!(?node_item.item.def_id, "not eligible due to default");
924924
false
925925
}
926926
};

‎compiler/rustc_trait_selection/src/solve/project_goals.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ use rustc_middle::traits::solve::{Certainty, Goal, QueryResult};
55
use rustc_middle::ty::{self, ProjectionPredicate};
66

77
impl<'tcx> EvalCtxt<'_, 'tcx> {
8-
#[instrument(level = "debug", skip(self), ret)]
8+
#[instrument(level = "trace", skip(self), ret)]
99
pub(super) fn compute_projection_goal(
1010
&mut self,
1111
goal: Goal<'tcx, ProjectionPredicate<'tcx>>,

‎compiler/rustc_trait_selection/src/solve/search_graph.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ impl<'tcx> SearchGraph<'tcx> {
130130
}
131131

132132
/// Update the stack and reached depths on cache hits.
133-
#[instrument(level = "debug", skip(self))]
133+
#[instrument(level = "trace", skip(self))]
134134
fn on_cache_hit(&mut self, additional_depth: usize, encountered_overflow: bool) {
135135
let reached_depth = self.stack.next_index().plus(additional_depth);
136136
if let Some(last) = self.stack.raw.last_mut() {
@@ -296,6 +296,7 @@ impl<'tcx> SearchGraph<'tcx> {
296296
}
297297

298298
self.on_cache_hit(reached_depth, encountered_overflow);
299+
debug!("global cache hit");
299300
return result;
300301
}
301302

@@ -315,6 +316,7 @@ impl<'tcx> SearchGraph<'tcx> {
315316
.filter(|p| !Self::stack_coinductive_from(tcx, &self.stack, p.head))
316317
})
317318
{
319+
debug!("provisional cache hit");
318320
// We have a nested goal which is already in the provisional cache, use
319321
// its result. We do not provide any usage kind as that should have been
320322
// already set correctly while computing the cache entry.

‎compiler/rustc_trait_selection/src/solve/trait_goals.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1130,7 +1130,7 @@ impl<'tcx> EvalCtxt<'_, 'tcx> {
11301130
},
11311131
);
11321132
if let Some(def_id) = disqualifying_impl {
1133-
debug!(?def_id, ?goal, "disqualified auto-trait implementation");
1133+
trace!(?def_id, ?goal, "disqualified auto-trait implementation");
11341134
// No need to actually consider the candidate here,
11351135
// since we do that in `consider_impl_candidate`.
11361136
return Some(Err(NoSolution));
@@ -1171,7 +1171,7 @@ impl<'tcx> EvalCtxt<'_, 'tcx> {
11711171
})
11721172
}
11731173

1174-
#[instrument(level = "debug", skip(self))]
1174+
#[instrument(level = "trace", skip(self))]
11751175
pub(super) fn compute_trait_goal(
11761176
&mut self,
11771177
goal: Goal<'tcx, TraitPredicate<'tcx>>,

‎library/core/src/primitive_docs.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1467,8 +1467,9 @@ mod prim_usize {}
14671467
/// For all types, `T: ?Sized`, and for all `t: &T` or `t: &mut T`, when such values cross an API
14681468
/// boundary, the following invariants must generally be upheld:
14691469
///
1470+
/// * `t` is non-null
14701471
/// * `t` is aligned to `align_of_val(t)`
1471-
/// * `t` is dereferenceable for `size_of_val(t)` many bytes
1472+
/// * if `size_of_val(t) > 0`, then `t` is dereferenceable for `size_of_val(t)` many bytes
14721473
///
14731474
/// If `t` points at address `a`, being "dereferenceable" for N bytes means that the memory range
14741475
/// `[a, a + N)` is all contained within a single [allocated object].

‎src/tools/run-make-support/src/lib.rs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,15 @@ pub fn static_lib(name: &str) -> PathBuf {
5454
tmp_dir().join(static_lib_name(name))
5555
}
5656

57+
pub fn python_command() -> Command {
58+
let python_path = std::env::var("PYTHON").expect("PYTHON environment variable does not exist");
59+
Command::new(python_path)
60+
}
61+
62+
pub fn source_path() -> PathBuf {
63+
std::env::var("S").expect("S variable does not exist").into()
64+
}
65+
5766
/// Construct the static library name based on the platform.
5867
pub fn static_lib_name(name: &str) -> String {
5968
// See tools.mk (irrelevant lines omitted):

‎src/tools/run-make-support/src/rustc.rs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
use std::env;
2-
use std::ffi::OsString;
2+
use std::ffi::{OsStr, OsString};
33
use std::io::Write;
44
use std::path::Path;
55
use std::process::{Command, Output, Stdio};
@@ -176,6 +176,13 @@ impl Rustc {
176176
self
177177
}
178178

179+
/// Specify the crate name.
180+
pub fn crate_name<S: AsRef<OsStr>>(&mut self, name: S) -> &mut Self {
181+
self.cmd.arg("--crate-name");
182+
self.cmd.arg(name.as_ref());
183+
self
184+
}
185+
179186
/// Get the [`Output`][::std::process::Output] of the finished process.
180187
#[track_caller]
181188
pub fn command_output(&mut self) -> ::std::process::Output {

‎src/tools/run-make-support/src/rustdoc.rs

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
use std::env;
2+
use std::ffi::OsStr;
23
use std::io::Write;
34
use std::path::Path;
45
use std::process::{Command, Output, Stdio};
@@ -45,6 +46,21 @@ impl Rustdoc {
4546
Self { cmd, stdin: None }
4647
}
4748

49+
/// Specify where an external library is located.
50+
pub fn extern_<P: AsRef<Path>>(&mut self, crate_name: &str, path: P) -> &mut Self {
51+
assert!(
52+
!crate_name.contains(|c: char| c.is_whitespace() || c == '\\' || c == '/'),
53+
"crate name cannot contain whitespace or path separators"
54+
);
55+
56+
let path = path.as_ref().to_string_lossy();
57+
58+
self.cmd.arg("--extern");
59+
self.cmd.arg(format!("{crate_name}={path}"));
60+
61+
self
62+
}
63+
4864
/// Specify path to the input file.
4965
pub fn input<P: AsRef<Path>>(&mut self, path: P) -> &mut Self {
5066
self.cmd.arg(path.as_ref());
@@ -107,6 +123,20 @@ impl Rustdoc {
107123
self
108124
}
109125

126+
/// Specify the crate type.
127+
pub fn crate_type(&mut self, crate_type: &str) -> &mut Self {
128+
self.cmd.arg("--crate-type");
129+
self.cmd.arg(crate_type);
130+
self
131+
}
132+
133+
/// Specify the crate name.
134+
pub fn crate_name<S: AsRef<OsStr>>(&mut self, name: S) -> &mut Self {
135+
self.cmd.arg("--crate-name");
136+
self.cmd.arg(name.as_ref());
137+
self
138+
}
139+
110140
#[track_caller]
111141
pub fn run_fail_assert_exit_code(&mut self, code: i32) -> Output {
112142
let caller_location = std::panic::Location::caller();

‎src/tools/tidy/src/allowed_run_make_makefiles.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -248,7 +248,6 @@ run-make/rustdoc-io-error/Makefile
248248
run-make/rustdoc-scrape-examples-invalid-expr/Makefile
249249
run-make/rustdoc-scrape-examples-macros/Makefile
250250
run-make/rustdoc-scrape-examples-multiple/Makefile
251-
run-make/rustdoc-scrape-examples-ordering/Makefile
252251
run-make/rustdoc-scrape-examples-remap/Makefile
253252
run-make/rustdoc-scrape-examples-test/Makefile
254253
run-make/rustdoc-scrape-examples-whitespace/Makefile

‎tests/codegen-units/partitioning/extern-drop-glue.rs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,4 @@
1-
//
2-
3-
// We specify incremental here because we want to test the partitioning for
4-
//@ incremental compilation
1+
// We specify incremental here because we want to test the partitioning for incremental compilation
52
// We specify opt-level=0 because `drop_in_place` is `Internal` when optimizing
63
//@ incremental
74
//@ compile-flags:-Zprint-mono-items=lazy

‎tests/codegen-units/partitioning/extern-generic.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
1-
//
2-
// We specify incremental here because we want to test the partitioning for
3-
//@ incremental compilation
1+
// We specify incremental here because we want to test the partitioning for incremental compilation
42
//@ incremental
53
//@ compile-flags:-Zprint-mono-items=eager -Zshare-generics=y
64

‎tests/codegen-units/partitioning/incremental-merging.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
// We specify incremental here because we want to test the partitioning for
2-
//@ incremental compilation
1+
// We specify incremental here because we want to test the partitioning for incremental compilation
32
//@ incremental
43
//@ compile-flags:-Zprint-mono-items=lazy
54
//@ compile-flags:-Ccodegen-units=3

‎tests/codegen-units/partitioning/inlining-from-extern-crate.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
1-
//
2-
// We specify incremental here because we want to test the partitioning for
3-
//@ incremental compilation
1+
// We specify incremental here because we want to test the partitioning for incremental compilation
42
//@ incremental
53
//@ compile-flags:-Zprint-mono-items=lazy
64
//@ compile-flags:-Zinline-in-all-cgus

‎tests/codegen-units/partitioning/local-drop-glue.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
1-
//
2-
// We specify incremental here because we want to test the partitioning for
3-
//@ incremental compilation
1+
// We specify incremental here because we want to test the partitioning for incremental compilation
42
// We specify opt-level=0 because `drop_in_place` is `Internal` when optimizing
53
//@ incremental
64
//@ compile-flags:-Zprint-mono-items=lazy

‎tests/codegen-units/partitioning/local-generic.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
// We specify incremental here because we want to test the partitioning for
2-
//@ incremental compilation
1+
// We specify incremental here because we want to test the partitioning for incremental compilation
32
//@ incremental
43
//@ compile-flags:-Zprint-mono-items=eager
54

‎tests/codegen-units/partitioning/local-inlining-but-not-all.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
1-
//
2-
// We specify incremental here because we want to test the partitioning for
3-
//@ incremental compilation
1+
// We specify incremental here because we want to test the partitioning for incremental compilation
42
//@ incremental
53
//@ compile-flags:-Zprint-mono-items=lazy
64
//@ compile-flags:-Zinline-in-all-cgus=no

‎tests/codegen-units/partitioning/local-inlining.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
1-
//
2-
// We specify incremental here because we want to test the partitioning for
3-
//@ incremental compilation
1+
// We specify incremental here because we want to test the partitioning for incremental compilation
42
//@ incremental
53
//@ compile-flags:-Zprint-mono-items=lazy
64
//@ compile-flags:-Zinline-in-all-cgus

‎tests/codegen-units/partitioning/local-transitive-inlining.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
1-
//
2-
// We specify incremental here because we want to test the partitioning for
3-
//@ incremental compilation
1+
// We specify incremental here because we want to test the partitioning for incremental compilation
42
//@ incremental
53
//@ compile-flags:-Zprint-mono-items=lazy
64
//@ compile-flags:-Zinline-in-all-cgus

‎tests/codegen-units/partitioning/methods-are-with-self-type.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,7 @@
33
// much sense at the moment.
44
//@ ignore-test
55

6-
//
7-
// We specify incremental here because we want to test the partitioning for
8-
//@ incremental compilation
6+
// We specify incremental here because we want to test the partitioning for incremental compilation
97
//@ incremental
108
//@ compile-flags:-Zprint-mono-items=lazy
119

‎tests/codegen-units/partitioning/regular-modules.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
// We specify incremental here because we want to test the partitioning for
2-
//@ incremental compilation
1+
// We specify incremental here because we want to test the partitioning for incremental compilation
32
//@ incremental
43
//@ compile-flags:-Zprint-mono-items=eager
54

‎tests/codegen-units/partitioning/shared-generics.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
//
21
//@ no-prefer-dynamic
32
// NOTE: We always compile this test with -Copt-level=0 because higher opt-levels
43
// prevent drop-glue from participating in share-generics.

‎tests/codegen-units/partitioning/statics.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
// We specify incremental here because we want to test the partitioning for
2-
//@ incremental compilation
1+
// We specify incremental here because we want to test the partitioning for incremental compilation
32
//@ incremental
43
//@ compile-flags:-Zprint-mono-items=lazy
54

‎tests/codegen-units/partitioning/vtable-through-const.rs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,4 @@
1-
//
2-
3-
// We specify incremental here because we want to test the partitioning for
4-
//@ incremental compilation
1+
// We specify incremental here because we want to test the partitioning for incremental compilation
52
//@ incremental
63
//@ compile-flags:-Zprint-mono-items=lazy
74
//@ compile-flags:-Zinline-in-all-cgus

‎tests/run-make/rustdoc-scrape-examples-ordering/Makefile

Lines changed: 0 additions & 5 deletions
This file was deleted.
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
use run_make_support::{python_command, rustc, rustdoc, source_path, tmp_dir};
2+
use std::fs::read_dir;
3+
use std::path::Path;
4+
5+
fn main() {
6+
let lib_dir = tmp_dir();
7+
let out_dir = tmp_dir().join("rustdoc");
8+
let crate_name = "foobar";
9+
let deps = read_dir("examples")
10+
.unwrap()
11+
.filter_map(|entry| entry.ok().map(|e| e.path()))
12+
.filter(|path| path.is_file() && path.extension().is_some_and(|ext| ext == "rs"))
13+
.collect::<Vec<_>>();
14+
15+
rustc().input("src/lib.rs").crate_name(crate_name).crate_type("lib").emit("metadata").run();
16+
17+
let mut out_deps = Vec::with_capacity(deps.len());
18+
for dep in deps {
19+
let dep_stem = dep.file_stem().unwrap();
20+
let out_example = out_dir.join(format!("{}.calls", dep_stem.to_str().unwrap()));
21+
rustdoc()
22+
.input(&dep)
23+
.crate_name(&dep_stem)
24+
.crate_type("bin")
25+
.output(&out_dir)
26+
.extern_(crate_name, lib_dir.join(format!("lib{crate_name}.rmeta")))
27+
.arg("-Zunstable-options")
28+
.arg("--scrape-examples-output-path")
29+
.arg(&out_example)
30+
.arg("--scrape-examples-target-crate")
31+
.arg(crate_name)
32+
.run();
33+
out_deps.push(out_example);
34+
}
35+
36+
let mut rustdoc = rustdoc();
37+
rustdoc
38+
.input("src/lib.rs")
39+
.output(&out_dir)
40+
.crate_name(crate_name)
41+
.crate_type("lib")
42+
.arg("-Zunstable-options");
43+
for dep in out_deps {
44+
rustdoc.arg("--with-examples").arg(dep);
45+
}
46+
rustdoc.run();
47+
48+
python_command()
49+
.arg(source_path().join("/src/etc/htmldocck.py"))
50+
.arg(out_dir)
51+
.arg("src/lib.rs")
52+
.status()
53+
.unwrap()
54+
.success();
55+
}

0 commit comments

Comments
 (0)
Please sign in to comment.