Skip to content

Commit abf7479

Browse files
committed
Auto merge of rust-lang#132042 - matthiaskrgr:rollup-eloj566, r=matthiaskrgr
Rollup of 4 pull requests Successful merges: - rust-lang#132002 (abi/compatibility: also test Option-like types) - rust-lang#132026 (analyse: remove unused uncanonicalized field) - rust-lang#132036 (Add a test case for rust-lang#131164) - rust-lang#132040 (relnotes: fix stabilizations of `assume_init`) r? `@ghost` `@rustbot` modify labels: rollup
2 parents 86d69c7 + 9aaeadc commit abf7479

File tree

10 files changed

+54
-29
lines changed

10 files changed

+54
-29
lines changed

RELEASES.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -68,15 +68,15 @@ Stabilized APIs
6868
- [`impl Default for std::collections::vec_deque::Iter`](https://doc.rust-lang.org/nightly/std/collections/vec_deque/struct.Iter.html#impl-Default-for-Iter%3C'_,+T%3E)
6969
- [`impl Default for std::collections::vec_deque::IterMut`](https://doc.rust-lang.org/nightly/std/collections/vec_deque/struct.IterMut.html#impl-Default-for-IterMut%3C'_,+T%3E)
7070
- [`Rc<T>::new_uninit`](https://doc.rust-lang.org/nightly/std/rc/struct.Rc.html#method.new_uninit)
71-
- [`Rc<T>::assume_init`](https://doc.rust-lang.org/nightly/std/rc/struct.Rc.html#method.assume_init)
71+
- [`Rc<MaybeUninit<T>>::assume_init`](https://doc.rust-lang.org/nightly/std/rc/struct.Rc.html#method.assume_init)
7272
- [`Rc<[T]>::new_uninit_slice`](https://doc.rust-lang.org/nightly/std/rc/struct.Rc.html#method.new_uninit_slice)
7373
- [`Rc<[MaybeUninit<T>]>::assume_init`](https://doc.rust-lang.org/nightly/std/rc/struct.Rc.html#method.assume_init-1)
7474
- [`Arc<T>::new_uninit`](https://doc.rust-lang.org/nightly/std/sync/struct.Arc.html#method.new_uninit)
75-
- [`Arc<T>::assume_init`](https://doc.rust-lang.org/nightly/std/sync/struct.Arc.html#method.assume_init)
75+
- [`Arc<MaybeUninit<T>>::assume_init`](https://doc.rust-lang.org/nightly/std/sync/struct.Arc.html#method.assume_init)
7676
- [`Arc<[T]>::new_uninit_slice`](https://doc.rust-lang.org/nightly/std/sync/struct.Arc.html#method.new_uninit_slice)
7777
- [`Arc<[MaybeUninit<T>]>::assume_init`](https://doc.rust-lang.org/nightly/std/sync/struct.Arc.html#method.assume_init-1)
7878
- [`Box<T>::new_uninit`](https://doc.rust-lang.org/nightly/std/boxed/struct.Box.html#method.new_uninit)
79-
- [`Box<T>::assume_init`](https://doc.rust-lang.org/nightly/std/boxed/struct.Box.html#method.assume_init)
79+
- [`Box<MaybeUninit<T>>::assume_init`](https://doc.rust-lang.org/nightly/std/boxed/struct.Box.html#method.assume_init)
8080
- [`Box<[T]>::new_uninit_slice`](https://doc.rust-lang.org/nightly/std/boxed/struct.Box.html#method.new_uninit_slice)
8181
- [`Box<[MaybeUninit<T>]>::assume_init`](https://doc.rust-lang.org/nightly/std/boxed/struct.Box.html#method.assume_init-1)
8282
- [`core::arch::x86_64::_bextri_u64`](https://doc.rust-lang.org/stable/core/arch/x86_64/fn._bextri_u64.html)

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@ where
170170
//
171171
// We don't do so for `NormalizesTo` goals as we erased the expected term and
172172
// bailing with overflow here would prevent us from detecting a type-mismatch,
173-
// causing a coherence error in diesel, see #131969. We still bail with verflow
173+
// causing a coherence error in diesel, see #131969. We still bail with overflow
174174
// when later returning from the parent AliasRelate goal.
175175
if !self.is_normalizes_to_goal {
176176
let num_non_region_vars =

compiler/rustc_next_trait_solver/src/solve/eval_ctxt/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -291,7 +291,7 @@ where
291291
search_graph,
292292
nested_goals: NestedGoals::new(),
293293
tainted: Ok(()),
294-
inspect: canonical_goal_evaluation.new_goal_evaluation_step(var_values, input),
294+
inspect: canonical_goal_evaluation.new_goal_evaluation_step(var_values),
295295
};
296296

297297
for &(key, ty) in &input.predefined_opaques_in_body.opaque_types {

compiler/rustc_next_trait_solver/src/solve/inspect/build.rs

+6-10
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ use rustc_type_ir::{self as ty, Interner};
1313
use crate::delegate::SolverDelegate;
1414
use crate::solve::eval_ctxt::canonical;
1515
use crate::solve::{
16-
CanonicalInput, Certainty, GenerateProofTree, Goal, GoalEvaluationKind, GoalSource, QueryInput,
16+
CanonicalInput, Certainty, GenerateProofTree, Goal, GoalEvaluationKind, GoalSource,
1717
QueryResult, inspect,
1818
};
1919

@@ -119,6 +119,9 @@ impl<I: Interner> WipCanonicalGoalEvaluation<I> {
119119
}
120120
}
121121

122+
/// This only exists during proof tree building and does not have
123+
/// a corresponding struct in `inspect`. We need this to track a
124+
/// bunch of metadata about the current evaluation.
122125
#[derive_where(PartialEq, Eq, Debug; I: Interner)]
123126
struct WipCanonicalGoalEvaluationStep<I: Interner> {
124127
/// Unlike `EvalCtxt::var_values`, we append a new
@@ -128,7 +131,6 @@ struct WipCanonicalGoalEvaluationStep<I: Interner> {
128131
/// This is necessary as we otherwise don't unify these
129132
/// vars when instantiating multiple `CanonicalState`.
130133
var_values: Vec<I::GenericArg>,
131-
instantiated_goal: QueryInput<I, I::Predicate>,
132134
probe_depth: usize,
133135
evaluation: WipProbe<I>,
134136
}
@@ -145,16 +147,12 @@ impl<I: Interner> WipCanonicalGoalEvaluationStep<I> {
145147
current
146148
}
147149

148-
fn finalize(self) -> inspect::CanonicalGoalEvaluationStep<I> {
150+
fn finalize(self) -> inspect::Probe<I> {
149151
let evaluation = self.evaluation.finalize();
150152
match evaluation.kind {
151-
inspect::ProbeKind::Root { .. } => (),
153+
inspect::ProbeKind::Root { .. } => evaluation,
152154
_ => unreachable!("unexpected root evaluation: {evaluation:?}"),
153155
}
154-
inspect::CanonicalGoalEvaluationStep {
155-
instantiated_goal: self.instantiated_goal,
156-
evaluation,
157-
}
158156
}
159157
}
160158

@@ -328,11 +326,9 @@ impl<D: SolverDelegate<Interner = I>, I: Interner> ProofTreeBuilder<D> {
328326
pub(crate) fn new_goal_evaluation_step(
329327
&mut self,
330328
var_values: ty::CanonicalVarValues<I>,
331-
instantiated_goal: QueryInput<I, I::Predicate>,
332329
) -> ProofTreeBuilder<D> {
333330
self.nested(|| WipCanonicalGoalEvaluationStep {
334331
var_values: var_values.var_values.to_vec(),
335-
instantiated_goal,
336332
evaluation: WipProbe {
337333
initial_num_var_values: var_values.len(),
338334
steps: vec![],

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -344,7 +344,7 @@ impl<'a, 'tcx> InspectGoal<'a, 'tcx> {
344344
};
345345

346346
let mut nested_goals = vec![];
347-
self.candidates_recur(&mut candidates, &mut nested_goals, &last_eval_step.evaluation);
347+
self.candidates_recur(&mut candidates, &mut nested_goals, &last_eval_step);
348348

349349
candidates
350350
}

compiler/rustc_type_ir/src/solve/inspect.rs

+5-12
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,7 @@ use std::hash::Hash;
2323
use derive_where::derive_where;
2424
use rustc_type_ir_macros::{TypeFoldable_Generic, TypeVisitable_Generic};
2525

26-
use crate::solve::{
27-
CandidateSource, CanonicalInput, Certainty, Goal, GoalSource, QueryInput, QueryResult,
28-
};
26+
use crate::solve::{CandidateSource, CanonicalInput, Certainty, Goal, GoalSource, QueryResult};
2927
use crate::{Canonical, CanonicalVarValues, Interner};
3028

3129
/// Some `data` together with information about how they relate to the input
@@ -69,15 +67,10 @@ pub struct CanonicalGoalEvaluation<I: Interner> {
6967
#[derive_where(PartialEq, Eq, Hash, Debug; I: Interner)]
7068
pub enum CanonicalGoalEvaluationKind<I: Interner> {
7169
Overflow,
72-
Evaluation { final_revision: CanonicalGoalEvaluationStep<I> },
73-
}
74-
75-
#[derive_where(PartialEq, Eq, Hash, Debug; I: Interner)]
76-
pub struct CanonicalGoalEvaluationStep<I: Interner> {
77-
pub instantiated_goal: QueryInput<I, I::Predicate>,
78-
79-
/// The actual evaluation of the goal, always `ProbeKind::Root`.
80-
pub evaluation: Probe<I>,
70+
Evaluation {
71+
/// This is always `ProbeKind::Root`.
72+
final_revision: Probe<I>,
73+
},
8174
}
8275

8376
/// A self-contained computation during trait solving. This either
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
#[no_mangle]
2+
fn foo() {}
3+
4+
#[no_mangle]
5+
fn bar() {}
6+
7+
fn main() {}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
// This test ensures that the “symbol not found” error does not occur
2+
// when the symbols in the `PROVIDE` of the link script can be eliminated.
3+
// This is a regression test for #131164.
4+
5+
//@ needs-rust-lld
6+
//@ only-x86_64-unknown-linux-gnu
7+
8+
use run_make_support::rustc;
9+
10+
fn main() {
11+
rustc().input("main.rs").arg("-Zlinker-features=+lld").link_arg("-Tscript.t").run();
12+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
PROVIDE(foo = bar);

tests/ui/abi/compatibility.rs

+17-1
Original file line numberDiff line numberDiff line change
@@ -211,6 +211,15 @@ impl Clone for Zst {
211211
}
212212
}
213213

214+
enum Either<T, U> {
215+
Left(T),
216+
Right(U),
217+
}
218+
enum Either2<T, U> {
219+
Left(T),
220+
Right(U, ()),
221+
}
222+
214223
#[repr(C)]
215224
enum ReprCEnum<T> {
216225
Variant1,
@@ -328,7 +337,8 @@ mod unsized_ {
328337
test_transparent_unsized!(dyn_trait, dyn Any);
329338
}
330339

331-
// RFC 3391 <https://rust-lang.github.io/rfcs/3391-result_ffi_guarantees.html>.
340+
// RFC 3391 <https://rust-lang.github.io/rfcs/3391-result_ffi_guarantees.html>, including the
341+
// extension ratified at <https://github.com/rust-lang/rust/pull/130628#issuecomment-2402761599>.
332342
macro_rules! test_nonnull {
333343
($name:ident, $t:ty) => {
334344
mod $name {
@@ -340,6 +350,12 @@ macro_rules! test_nonnull {
340350
test_abi_compatible!(result_ok_zst, Result<Zst, $t>, $t);
341351
test_abi_compatible!(result_err_arr, Result<$t, [i8; 0]>, $t);
342352
test_abi_compatible!(result_ok_arr, Result<[i8; 0], $t>, $t);
353+
test_abi_compatible!(result_err_void, Result<$t, Void>, $t);
354+
test_abi_compatible!(result_ok_void, Result<Void, $t>, $t);
355+
test_abi_compatible!(either_err_zst, Either<$t, Zst>, $t);
356+
test_abi_compatible!(either_ok_zst, Either<Zst, $t>, $t);
357+
test_abi_compatible!(either2_err_zst, Either2<$t, Zst>, $t);
358+
test_abi_compatible!(either2_err_arr, Either2<$t, [i8; 0]>, $t);
343359
}
344360
}
345361
}

0 commit comments

Comments
 (0)