Skip to content
This repository was archived by the owner on May 28, 2025. It is now read-only.

Commit a44a2b8

Browse files
committed
Auto merge of rust-lang#124945 - matthiaskrgr:rollup-r6395sn, r=matthiaskrgr
Rollup of 4 pull requests Successful merges: - rust-lang#124915 (`rustc_target` cleanups) - rust-lang#124927 (opt-dist: use xz2 instead of xz crate) - rust-lang#124936 (analyse visitor: build proof tree in probe) - rust-lang#124943 (always use `GenericArgsRef`) r? `@ghost` `@rustbot` modify labels: rollup
2 parents 8f9080d + 2f7df58 commit a44a2b8

File tree

21 files changed

+139
-77
lines changed

21 files changed

+139
-77
lines changed

Cargo.lock

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2760,7 +2760,7 @@ dependencies = [
27602760
"tabled",
27612761
"tar",
27622762
"tempfile",
2763-
"xz",
2763+
"xz2",
27642764
"zip",
27652765
]
27662766

@@ -6586,15 +6586,6 @@ dependencies = [
65866586
"rustix",
65876587
]
65886588

6589-
[[package]]
6590-
name = "xz"
6591-
version = "0.1.0"
6592-
source = "registry+https://github.com/rust-lang/crates.io-index"
6593-
checksum = "3c887690ff2a2e233e8e49633461521f98ec57fbff9d59a884c9a4f04ec1da34"
6594-
dependencies = [
6595-
"xz2",
6596-
]
6597-
65986589
[[package]]
65996590
name = "xz2"
66006591
version = "0.1.7"

compiler/rustc_hir_typeck/src/method/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -315,7 +315,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
315315
trait_def_id: DefId,
316316
self_ty: Ty<'tcx>,
317317
opt_input_types: Option<&[Ty<'tcx>]>,
318-
) -> (traits::PredicateObligation<'tcx>, &'tcx ty::List<ty::GenericArg<'tcx>>) {
318+
) -> (traits::PredicateObligation<'tcx>, ty::GenericArgsRef<'tcx>) {
319319
// Construct a trait-reference `self_ty : Trait<input_tys>`
320320
let args = GenericArgs::for_item(self.tcx, trait_def_id, |param, _| {
321321
match param.kind {
@@ -365,7 +365,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
365365
m_name: Ident,
366366
trait_def_id: DefId,
367367
obligation: traits::PredicateObligation<'tcx>,
368-
args: &'tcx ty::List<ty::GenericArg<'tcx>>,
368+
args: ty::GenericArgsRef<'tcx>,
369369
) -> Option<InferOk<'tcx, MethodCallee<'tcx>>> {
370370
debug!(?obligation);
371371

compiler/rustc_hir_typeck/src/pat.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1676,7 +1676,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
16761676
unmentioned_fields: &mut Vec<(&'tcx ty::FieldDef, Ident)>,
16771677
pat: &'tcx Pat<'tcx>,
16781678
variant: &ty::VariantDef,
1679-
args: &'tcx ty::List<ty::GenericArg<'tcx>>,
1679+
args: ty::GenericArgsRef<'tcx>,
16801680
) -> Diag<'tcx> {
16811681
let tcx = self.tcx;
16821682
let (field_names, t, plural) = if let [field] = inexistent_fields {

compiler/rustc_lint/src/for_loops_over_fallibles.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ use crate::{
99
use hir::{Expr, Pat};
1010
use rustc_hir as hir;
1111
use rustc_infer::{infer::TyCtxtInferExt, traits::ObligationCause};
12-
use rustc_middle::ty::{self, List};
12+
use rustc_middle::ty;
1313
use rustc_session::{declare_lint, declare_lint_pass};
1414
use rustc_span::{sym, Span};
1515
use rustc_trait_selection::traits::ObligationCtxt;
@@ -123,7 +123,7 @@ fn extract_iterator_next_call<'tcx>(
123123
fn suggest_question_mark<'tcx>(
124124
cx: &LateContext<'tcx>,
125125
adt: ty::AdtDef<'tcx>,
126-
args: &List<ty::GenericArg<'tcx>>,
126+
args: ty::GenericArgsRef<'tcx>,
127127
span: Span,
128128
) -> bool {
129129
let Some(body_id) = cx.enclosing_body else { return false };

compiler/rustc_middle/src/ty/context.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2331,7 +2331,7 @@ impl<'tcx> TyCtxt<'tcx> {
23312331
pub fn mk_args_from_iter<I, T>(self, iter: I) -> T::Output
23322332
where
23332333
I: Iterator<Item = T>,
2334-
T: CollectAndApply<GenericArg<'tcx>, &'tcx List<GenericArg<'tcx>>>,
2334+
T: CollectAndApply<GenericArg<'tcx>, ty::GenericArgsRef<'tcx>>,
23352335
{
23362336
T::collect_and_apply(iter, |xs| self.mk_args(xs))
23372337
}

compiler/rustc_middle/src/ty/print/pretty.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -977,7 +977,7 @@ pub trait PrettyPrinter<'tcx>: Printer<'tcx> + fmt::Write {
977977
fn pretty_print_opaque_impl_type(
978978
&mut self,
979979
def_id: DefId,
980-
args: &'tcx ty::List<ty::GenericArg<'tcx>>,
980+
args: ty::GenericArgsRef<'tcx>,
981981
) -> Result<(), PrintError> {
982982
let tcx = self.tcx();
983983

compiler/rustc_target/src/lib.rs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,16 +7,17 @@
77
//! more 'stuff' here in the future. It does not have a dependency on
88
//! LLVM.
99
10+
// tidy-alphabetical-start
11+
#![allow(internal_features)]
1012
#![doc(html_root_url = "https://doc.rust-lang.org/nightly/nightly-rustc/")]
1113
#![doc(rust_logo)]
12-
#![feature(min_exhaustive_patterns)]
13-
#![feature(rustdoc_internals)]
1414
#![feature(assert_matches)]
1515
#![feature(iter_intersperse)]
1616
#![feature(let_chains)]
17+
#![feature(min_exhaustive_patterns)]
1718
#![feature(rustc_attrs)]
18-
#![feature(step_trait)]
19-
#![allow(internal_features)]
19+
#![feature(rustdoc_internals)]
20+
// tidy-alphabetical-end
2021

2122
use std::path::{Path, PathBuf};
2223

compiler/rustc_target/src/spec/mod.rs

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -603,19 +603,6 @@ impl LinkSelfContainedDefault {
603603
self == LinkSelfContainedDefault::False
604604
}
605605

606-
/// Returns whether the target spec explicitly requests self-contained linking, i.e. not via
607-
/// inference.
608-
pub fn is_linker_enabled(self) -> bool {
609-
match self {
610-
LinkSelfContainedDefault::True => true,
611-
LinkSelfContainedDefault::False => false,
612-
LinkSelfContainedDefault::WithComponents(c) => {
613-
c.contains(LinkSelfContainedComponents::LINKER)
614-
}
615-
_ => false,
616-
}
617-
}
618-
619606
/// Returns the key to use when serializing the setting to json:
620607
/// - individual components in a `link-self-contained` object value
621608
/// - the other variants as a backwards-compatible `crt-objects-fallback` string

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -409,6 +409,7 @@ pub(in crate::solve) fn make_canonical_state<'tcx, T: TypeFoldable<TyCtxt<'tcx>>
409409
/// This currently assumes that unifying the var values trivially succeeds.
410410
/// Adding any inference constraints which weren't present when originally
411411
/// computing the canonical query can result in bugs.
412+
#[instrument(level = "debug", skip(infcx, span, param_env))]
412413
pub(in crate::solve) fn instantiate_canonical_state<'tcx, T: TypeFoldable<TyCtxt<'tcx>>>(
413414
infcx: &InferCtxt<'tcx>,
414415
span: Span,

compiler/rustc_trait_selection/src/solve/inspect/analyse.rs

Lines changed: 33 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,11 @@ impl<'a, 'tcx> InspectCandidate<'a, 'tcx> {
146146
/// inference constraints, and optionally the args of an impl if this candidate
147147
/// came from a `CandidateSource::Impl`. This function modifies the state of the
148148
/// `infcx`.
149+
#[instrument(
150+
level = "debug",
151+
skip_all,
152+
fields(goal = ?self.goal.goal, nested_goals = ?self.nested_goals)
153+
)]
149154
pub fn instantiate_nested_goals_and_opt_impl_args(
150155
&self,
151156
span: Span,
@@ -213,10 +218,23 @@ impl<'a, 'tcx> InspectCandidate<'a, 'tcx> {
213218
};
214219
let goal =
215220
goal.with(infcx.tcx, ty::NormalizesTo { alias, term: unconstrained_term });
216-
let proof_tree = EvalCtxt::enter_root(infcx, GenerateProofTree::Yes, |ecx| {
217-
ecx.evaluate_goal_raw(GoalEvaluationKind::Root, GoalSource::Misc, goal)
218-
})
219-
.1;
221+
// We have to use a `probe` here as evaluating a `NormalizesTo` can constrain the
222+
// expected term. This means that candidates which only fail due to nested goals
223+
// and which normalize to a different term then the final result could ICE: when
224+
// building their proof tree, the expected term was unconstrained, but when
225+
// instantiating the candidate it is already constrained to the result of another
226+
// candidate.
227+
let proof_tree = infcx
228+
.probe(|_| {
229+
EvalCtxt::enter_root(infcx, GenerateProofTree::Yes, |ecx| {
230+
ecx.evaluate_goal_raw(
231+
GoalEvaluationKind::Root,
232+
GoalSource::Misc,
233+
goal,
234+
)
235+
})
236+
})
237+
.1;
220238
InspectGoal::new(
221239
infcx,
222240
self.goal.depth + 1,
@@ -225,13 +243,17 @@ impl<'a, 'tcx> InspectCandidate<'a, 'tcx> {
225243
source,
226244
)
227245
}
228-
_ => InspectGoal::new(
229-
infcx,
230-
self.goal.depth + 1,
231-
infcx.evaluate_root_goal(goal, GenerateProofTree::Yes).1.unwrap(),
232-
None,
233-
source,
234-
),
246+
_ => {
247+
// We're using a probe here as evaluating a goal could constrain
248+
// inference variables by choosing one candidate. If we then recurse
249+
// into another candidate who ends up with different inference
250+
// constraints, we get an ICE if we already applied the constraints
251+
// from the chosen candidate.
252+
let proof_tree = infcx
253+
.probe(|_| infcx.evaluate_root_goal(goal, GenerateProofTree::Yes).1)
254+
.unwrap();
255+
InspectGoal::new(infcx, self.goal.depth + 1, proof_tree, None, source)
256+
}
235257
})
236258
.collect();
237259

0 commit comments

Comments
 (0)