Skip to content

Commit ff4a253

Browse files
committed
Auto merge of #73369 - RalfJung:rollup-hl8g9zf, r=RalfJung
Rollup of 10 pull requests Successful merges: - #72707 (Use min_specialization in the remaining rustc crates) - #72740 (On recursive ADT, provide indirection structured suggestion) - #72879 (Miri: avoid tracking current location three times) - #72938 (Stabilize Option::zip) - #73086 (Rename "cyclone" to "apple-a7" per changes in upstream LLVM) - #73104 (Example about explicit mutex dropping) - #73139 (Add methods to go from a nul-terminated Vec<u8> to a CString) - #73296 (Remove vestigial CI job msvc-aux.) - #73304 (Revert heterogeneous SocketAddr PartialEq impls) - #73331 (extend network support for HermitCore) Failed merges: r? @ghost
2 parents d4ecf31 + 54bd077 commit ff4a253

File tree

92 files changed

+1061
-582
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

92 files changed

+1061
-582
lines changed

.github/workflows/ci.yml

-5
Original file line numberDiff line numberDiff line change
@@ -428,11 +428,6 @@ jobs:
428428
NO_DEBUG_ASSERTIONS: 1
429429
NO_LLVM_ASSERTIONS: 1
430430
os: windows-latest-xl
431-
- name: x86_64-msvc-aux
432-
env:
433-
RUST_CHECK_TARGET: check-aux EXCLUDE_CARGO=1
434-
RUST_CONFIGURE_ARGS: "--build=x86_64-pc-windows-msvc"
435-
os: windows-latest-xl
436431
- name: x86_64-msvc-cargo
437432
env:
438433
SCRIPT: python x.py test src/tools/cargotest src/tools/cargo

Cargo.lock

+2-2
Original file line numberDiff line numberDiff line change
@@ -1434,9 +1434,9 @@ dependencies = [
14341434

14351435
[[package]]
14361436
name = "hermit-abi"
1437-
version = "0.1.13"
1437+
version = "0.1.14"
14381438
source = "registry+https://github.com/rust-lang/crates.io-index"
1439-
checksum = "91780f809e750b0a89f5544be56617ff6b1227ee485bcb06ebe10cdf89bd3b71"
1439+
checksum = "b9586eedd4ce6b3c498bc3b4dd92fc9f11166aa908a914071953768066c67909"
14401440
dependencies = [
14411441
"compiler_builtins",
14421442
"libc",

src/bootstrap/builder.rs

-1
Original file line numberDiff line numberDiff line change
@@ -373,7 +373,6 @@ impl<'a> Builder<'a> {
373373
test::UiFullDeps,
374374
test::Rustdoc,
375375
test::Pretty,
376-
test::RunPassValgrindPretty,
377376
test::Crate,
378377
test::CrateLibrustc,
379378
test::CrateRustdoc,

src/bootstrap/mk/Makefile.in

+2-8
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,6 @@ Q := @
66
BOOTSTRAP_ARGS :=
77
endif
88

9-
ifdef EXCLUDE_CARGO
10-
AUX_ARGS :=
11-
else
12-
AUX_ARGS := src/tools/cargo src/tools/cargotest
13-
endif
14-
159
BOOTSTRAP := $(CFG_PYTHON) $(CFG_SRC_DIR)src/bootstrap/bootstrap.py
1610

1711
all:
@@ -48,8 +42,8 @@ check:
4842
$(Q)$(BOOTSTRAP) test $(BOOTSTRAP_ARGS)
4943
check-aux:
5044
$(Q)$(BOOTSTRAP) test \
51-
src/test/run-pass-valgrind/pretty \
52-
$(AUX_ARGS) \
45+
src/tools/cargo \
46+
src/tools/cargotest \
5347
$(BOOTSTRAP_ARGS)
5448
check-bootstrap:
5549
$(Q)$(CFG_PYTHON) $(CFG_SRC_DIR)src/bootstrap/bootstrap_test.py

src/bootstrap/test.rs

-7
Original file line numberDiff line numberDiff line change
@@ -930,13 +930,6 @@ host_test!(UiFullDeps { path: "src/test/ui-fulldeps", mode: "ui", suite: "ui-ful
930930
host_test!(Rustdoc { path: "src/test/rustdoc", mode: "rustdoc", suite: "rustdoc" });
931931

932932
host_test!(Pretty { path: "src/test/pretty", mode: "pretty", suite: "pretty" });
933-
test!(RunPassValgrindPretty {
934-
path: "src/test/run-pass-valgrind/pretty",
935-
mode: "pretty",
936-
suite: "run-pass-valgrind",
937-
default: false,
938-
host: true
939-
});
940933

941934
default_test!(RunMake { path: "src/test/run-make", mode: "run-make", suite: "run-make" });
942935

src/ci/azure-pipelines/auto.yml

-4
Original file line numberDiff line numberDiff line change
@@ -142,10 +142,6 @@ jobs:
142142
# FIXME(#59637)
143143
NO_DEBUG_ASSERTIONS: 1
144144
NO_LLVM_ASSERTIONS: 1
145-
# MSVC aux tests
146-
x86_64-msvc-aux:
147-
RUST_CHECK_TARGET: check-aux EXCLUDE_CARGO=1
148-
INITIAL_RUST_CONFIGURE_ARGS: --build=x86_64-pc-windows-msvc
149145
x86_64-msvc-cargo:
150146
SCRIPT: python x.py test src/tools/cargotest src/tools/cargo
151147
INITIAL_RUST_CONFIGURE_ARGS: --build=x86_64-pc-windows-msvc --enable-lld

src/ci/github-actions/ci.yml

-6
Original file line numberDiff line numberDiff line change
@@ -492,12 +492,6 @@ jobs:
492492
NO_LLVM_ASSERTIONS: 1
493493
<<: *job-windows-xl
494494

495-
- name: x86_64-msvc-aux
496-
env:
497-
RUST_CHECK_TARGET: check-aux EXCLUDE_CARGO=1
498-
RUST_CONFIGURE_ARGS: --build=x86_64-pc-windows-msvc
499-
<<: *job-windows-xl
500-
501495
- name: x86_64-msvc-cargo
502496
env:
503497
SCRIPT: python x.py test src/tools/cargotest src/tools/cargo

src/libcore/lib.rs

-1
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,6 @@
145145
#![feature(associated_type_bounds)]
146146
#![feature(const_type_id)]
147147
#![feature(const_caller_location)]
148-
#![feature(option_zip)]
149148
#![feature(no_niche)] // rust-lang/rust#68303
150149

151150
#[prelude_import]

src/libcore/option.rs

+5-3
Original file line numberDiff line numberDiff line change
@@ -926,17 +926,19 @@ impl<T> Option<T> {
926926
/// # Examples
927927
///
928928
/// ```
929-
/// #![feature(option_zip)]
930929
/// let x = Some(1);
931930
/// let y = Some("hi");
932931
/// let z = None::<u8>;
933932
///
934933
/// assert_eq!(x.zip(y), Some((1, "hi")));
935934
/// assert_eq!(x.zip(z), None);
936935
/// ```
937-
#[unstable(feature = "option_zip", issue = "70086")]
936+
#[stable(feature = "option_zip_option", since = "1.46.0")]
938937
pub fn zip<U>(self, other: Option<U>) -> Option<(T, U)> {
939-
self.zip_with(other, |a, b| (a, b))
938+
match (self, other) {
939+
(Some(a), Some(b)) => Some((a, b)),
940+
_ => None,
941+
}
940942
}
941943

942944
/// Zips `self` and another `Option` with function `f`.

src/librustc_arena/lib.rs

+19-10
Original file line numberDiff line numberDiff line change
@@ -602,7 +602,7 @@ macro_rules! which_arena_for_type {
602602

603603
#[macro_export]
604604
macro_rules! declare_arena {
605-
([], [$($a:tt $name:ident: $ty:ty,)*], $tcx:lifetime) => {
605+
([], [$($a:tt $name:ident: $ty:ty, $gen_ty:ty;)*], $tcx:lifetime) => {
606606
#[derive(Default)]
607607
pub struct Arena<$tcx> {
608608
pub dropless: $crate::DroplessArena,
@@ -611,17 +611,17 @@ macro_rules! declare_arena {
611611
}
612612

613613
#[marker]
614-
pub trait ArenaAllocatable {}
614+
pub trait ArenaAllocatable<'tcx> {}
615615

616-
impl<T: Copy> ArenaAllocatable for T {}
616+
impl<'tcx, T: Copy> ArenaAllocatable<'tcx> for T {}
617617

618-
unsafe trait ArenaField<'tcx>: Sized {
618+
unsafe trait ArenaField<'tcx>: Sized + ArenaAllocatable<'tcx> {
619619
/// Returns a specific arena to allocate from.
620620
/// If `None` is returned, the `DropArena` will be used.
621621
fn arena<'a>(arena: &'a Arena<'tcx>) -> Option<&'a $crate::TypedArena<Self>>;
622622
}
623623

624-
unsafe impl<'tcx, T> ArenaField<'tcx> for T {
624+
unsafe impl<'tcx, T: ArenaAllocatable<'tcx>> ArenaField<'tcx> for T {
625625
#[inline]
626626
default fn arena<'a>(_: &'a Arena<'tcx>) -> Option<&'a $crate::TypedArena<Self>> {
627627
panic!()
@@ -630,18 +630,27 @@ macro_rules! declare_arena {
630630

631631
$(
632632
#[allow(unused_lifetimes)]
633-
impl<$tcx> ArenaAllocatable for $ty {}
634-
unsafe impl<$tcx> ArenaField<$tcx> for $ty {
633+
impl<$tcx> ArenaAllocatable<$tcx> for $ty {}
634+
unsafe impl<$tcx, '_x, '_y, '_z, '_w> ArenaField<$tcx> for $gen_ty where Self: ArenaAllocatable<$tcx> {
635635
#[inline]
636636
fn arena<'a>(_arena: &'a Arena<$tcx>) -> Option<&'a $crate::TypedArena<Self>> {
637-
$crate::which_arena_for_type!($a[&_arena.$name])
637+
// SAFETY: We only implement `ArenaAllocatable<$tcx>` for
638+
// `$ty`, so `$ty` and Self are the same type
639+
unsafe {
640+
::std::mem::transmute::<
641+
Option<&'a $crate::TypedArena<$ty>>,
642+
Option<&'a $crate::TypedArena<Self>>,
643+
>(
644+
$crate::which_arena_for_type!($a[&_arena.$name])
645+
)
646+
}
638647
}
639648
}
640649
)*
641650

642651
impl<'tcx> Arena<'tcx> {
643652
#[inline]
644-
pub fn alloc<T: ArenaAllocatable>(&self, value: T) -> &mut T {
653+
pub fn alloc<T: ArenaAllocatable<'tcx>>(&self, value: T) -> &mut T {
645654
if !::std::mem::needs_drop::<T>() {
646655
return self.dropless.alloc(value);
647656
}
@@ -659,7 +668,7 @@ macro_rules! declare_arena {
659668
self.dropless.alloc_slice(value)
660669
}
661670

662-
pub fn alloc_from_iter<'a, T: ArenaAllocatable>(
671+
pub fn alloc_from_iter<'a, T: ArenaAllocatable<'tcx>>(
663672
&'a self,
664673
iter: impl ::std::iter::IntoIterator<Item = T>,
665674
) -> &'a mut [T] {

src/librustc_ast_lowering/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
#![feature(array_value_iter)]
3434
#![feature(crate_visibility_modifier)]
3535
#![feature(marker_trait_attr)]
36-
#![feature(specialization)] // FIXME: min_specialization does not work
36+
#![feature(min_specialization)]
3737
#![feature(or_patterns)]
3838
#![recursion_limit = "256"]
3939

src/librustc_errors/diagnostic.rs

+23
Original file line numberDiff line numberDiff line change
@@ -296,6 +296,29 @@ impl Diagnostic {
296296
self
297297
}
298298

299+
pub fn multipart_suggestions(
300+
&mut self,
301+
msg: &str,
302+
suggestions: Vec<Vec<(Span, String)>>,
303+
applicability: Applicability,
304+
) -> &mut Self {
305+
self.suggestions.push(CodeSuggestion {
306+
substitutions: suggestions
307+
.into_iter()
308+
.map(|suggestion| Substitution {
309+
parts: suggestion
310+
.into_iter()
311+
.map(|(span, snippet)| SubstitutionPart { snippet, span })
312+
.collect(),
313+
})
314+
.collect(),
315+
msg: msg.to_owned(),
316+
style: SuggestionStyle::ShowCode,
317+
applicability,
318+
});
319+
self
320+
}
321+
299322
/// Prints out a message with for a multipart suggestion without showing the suggested code.
300323
///
301324
/// This is intended to be used for suggestions that are obvious in what the changes need to

src/librustc_errors/diagnostic_builder.rs

+13
Original file line numberDiff line numberDiff line change
@@ -260,6 +260,19 @@ impl<'a> DiagnosticBuilder<'a> {
260260
self
261261
}
262262

263+
pub fn multipart_suggestions(
264+
&mut self,
265+
msg: &str,
266+
suggestions: Vec<Vec<(Span, String)>>,
267+
applicability: Applicability,
268+
) -> &mut Self {
269+
if !self.0.allow_suggestions {
270+
return self;
271+
}
272+
self.0.diagnostic.multipart_suggestions(msg, suggestions, applicability);
273+
self
274+
}
275+
263276
pub fn tool_only_multipart_suggestion(
264277
&mut self,
265278
msg: &str,

src/librustc_hir/arena.rs

+35-35
Original file line numberDiff line numberDiff line change
@@ -12,41 +12,41 @@ macro_rules! arena_types {
1212
($macro:path, $args:tt, $tcx:lifetime) => (
1313
$macro!($args, [
1414
// HIR types
15-
[few] hir_krate: rustc_hir::Crate<$tcx>,
16-
[] arm: rustc_hir::Arm<$tcx>,
17-
[] asm_operand: rustc_hir::InlineAsmOperand<$tcx>,
18-
[] asm_template: rustc_ast::ast::InlineAsmTemplatePiece,
19-
[] attribute: rustc_ast::ast::Attribute,
20-
[] block: rustc_hir::Block<$tcx>,
21-
[] bare_fn_ty: rustc_hir::BareFnTy<$tcx>,
22-
[few] global_asm: rustc_hir::GlobalAsm,
23-
[] generic_arg: rustc_hir::GenericArg<$tcx>,
24-
[] generic_args: rustc_hir::GenericArgs<$tcx>,
25-
[] generic_bound: rustc_hir::GenericBound<$tcx>,
26-
[] generic_param: rustc_hir::GenericParam<$tcx>,
27-
[] expr: rustc_hir::Expr<$tcx>,
28-
[] field: rustc_hir::Field<$tcx>,
29-
[] field_pat: rustc_hir::FieldPat<$tcx>,
30-
[] fn_decl: rustc_hir::FnDecl<$tcx>,
31-
[] foreign_item: rustc_hir::ForeignItem<$tcx>,
32-
[] impl_item_ref: rustc_hir::ImplItemRef<$tcx>,
33-
[few] inline_asm: rustc_hir::InlineAsm<$tcx>,
34-
[few] llvm_inline_asm: rustc_hir::LlvmInlineAsm<$tcx>,
35-
[] local: rustc_hir::Local<$tcx>,
36-
[few] macro_def: rustc_hir::MacroDef<$tcx>,
37-
[] param: rustc_hir::Param<$tcx>,
38-
[] pat: rustc_hir::Pat<$tcx>,
39-
[] path: rustc_hir::Path<$tcx>,
40-
[] path_segment: rustc_hir::PathSegment<$tcx>,
41-
[] poly_trait_ref: rustc_hir::PolyTraitRef<$tcx>,
42-
[] qpath: rustc_hir::QPath<$tcx>,
43-
[] stmt: rustc_hir::Stmt<$tcx>,
44-
[] struct_field: rustc_hir::StructField<$tcx>,
45-
[] trait_item_ref: rustc_hir::TraitItemRef,
46-
[] ty: rustc_hir::Ty<$tcx>,
47-
[] type_binding: rustc_hir::TypeBinding<$tcx>,
48-
[] variant: rustc_hir::Variant<$tcx>,
49-
[] where_predicate: rustc_hir::WherePredicate<$tcx>,
15+
[few] hir_krate: rustc_hir::Crate<$tcx>, rustc_hir::Crate<'_x>;
16+
[] arm: rustc_hir::Arm<$tcx>, rustc_hir::Arm<'_x>;
17+
[] asm_operand: rustc_hir::InlineAsmOperand<$tcx>, rustc_hir::InlineAsmOperand<'_x>;
18+
[] asm_template: rustc_ast::ast::InlineAsmTemplatePiece, rustc_ast::ast::InlineAsmTemplatePiece;
19+
[] attribute: rustc_ast::ast::Attribute, rustc_ast::ast::Attribute;
20+
[] block: rustc_hir::Block<$tcx>, rustc_hir::Block<'_x>;
21+
[] bare_fn_ty: rustc_hir::BareFnTy<$tcx>, rustc_hir::BareFnTy<'_x>;
22+
[few] global_asm: rustc_hir::GlobalAsm, rustc_hir::GlobalAsm;
23+
[] generic_arg: rustc_hir::GenericArg<$tcx>, rustc_hir::GenericArg<'_x>;
24+
[] generic_args: rustc_hir::GenericArgs<$tcx>, rustc_hir::GenericArgs<'_x>;
25+
[] generic_bound: rustc_hir::GenericBound<$tcx>, rustc_hir::GenericBound<'_x>;
26+
[] generic_param: rustc_hir::GenericParam<$tcx>, rustc_hir::GenericParam<'_x>;
27+
[] expr: rustc_hir::Expr<$tcx>, rustc_hir::Expr<'_x>;
28+
[] field: rustc_hir::Field<$tcx>, rustc_hir::Field<'_x>;
29+
[] field_pat: rustc_hir::FieldPat<$tcx>, rustc_hir::FieldPat<'_x>;
30+
[] fn_decl: rustc_hir::FnDecl<$tcx>, rustc_hir::FnDecl<'_x>;
31+
[] foreign_item: rustc_hir::ForeignItem<$tcx>, rustc_hir::ForeignItem<'_x>;
32+
[] impl_item_ref: rustc_hir::ImplItemRef<$tcx>, rustc_hir::ImplItemRef<'_x>;
33+
[few] inline_asm: rustc_hir::InlineAsm<$tcx>, rustc_hir::InlineAsm<'_x>;
34+
[few] llvm_inline_asm: rustc_hir::LlvmInlineAsm<$tcx>, rustc_hir::LlvmInlineAsm<'_x>;
35+
[] local: rustc_hir::Local<$tcx>, rustc_hir::Local<'_x>;
36+
[few] macro_def: rustc_hir::MacroDef<$tcx>, rustc_hir::MacroDef<'_x>;
37+
[] param: rustc_hir::Param<$tcx>, rustc_hir::Param<'_x>;
38+
[] pat: rustc_hir::Pat<$tcx>, rustc_hir::Pat<'_x>;
39+
[] path: rustc_hir::Path<$tcx>, rustc_hir::Path<'_x>;
40+
[] path_segment: rustc_hir::PathSegment<$tcx>, rustc_hir::PathSegment<'_x>;
41+
[] poly_trait_ref: rustc_hir::PolyTraitRef<$tcx>, rustc_hir::PolyTraitRef<'_x>;
42+
[] qpath: rustc_hir::QPath<$tcx>, rustc_hir::QPath<'_x>;
43+
[] stmt: rustc_hir::Stmt<$tcx>, rustc_hir::Stmt<'_x>;
44+
[] struct_field: rustc_hir::StructField<$tcx>, rustc_hir::StructField<'_x>;
45+
[] trait_item_ref: rustc_hir::TraitItemRef, rustc_hir::TraitItemRef;
46+
[] ty: rustc_hir::Ty<$tcx>, rustc_hir::Ty<'_x>;
47+
[] type_binding: rustc_hir::TypeBinding<$tcx>, rustc_hir::TypeBinding<'_x>;
48+
[] variant: rustc_hir::Variant<$tcx>, rustc_hir::Variant<'_x>;
49+
[] where_predicate: rustc_hir::WherePredicate<$tcx>, rustc_hir::WherePredicate<'_x>;
5050
], $tcx);
5151
)
5252
}

src/librustc_infer/infer/canonical/query_response.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ impl<'cx, 'tcx> InferCtxt<'cx, 'tcx> {
5656
) -> Fallible<CanonicalizedQueryResponse<'tcx, T>>
5757
where
5858
T: Debug + TypeFoldable<'tcx>,
59-
Canonical<'tcx, QueryResponse<'tcx, T>>: ArenaAllocatable,
59+
Canonical<'tcx, QueryResponse<'tcx, T>>: ArenaAllocatable<'tcx>,
6060
{
6161
let query_response = self.make_query_response(inference_vars, answer, fulfill_cx)?;
6262
let canonical_result = self.canonicalize_response(&query_response);

src/librustc_macros/src/query.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -433,7 +433,7 @@ pub fn rustc_queries(input: TokenStream) -> TokenStream {
433433

434434
try_load_from_on_disk_cache_stream.extend(quote! {
435435
::rustc_middle::dep_graph::DepKind::#name => {
436-
if <#arg as DepNodeParams<TyCtxt<'_>>>::CAN_RECONSTRUCT_QUERY_KEY {
436+
if <#arg as DepNodeParams<TyCtxt<'_>>>::can_reconstruct_query_key() {
437437
debug_assert!($tcx.dep_graph
438438
.node_color($dep_node)
439439
.map(|c| c.is_green())
@@ -490,7 +490,7 @@ pub fn rustc_queries(input: TokenStream) -> TokenStream {
490490
// Add a match arm to force the query given the dep node
491491
dep_node_force_stream.extend(quote! {
492492
::rustc_middle::dep_graph::DepKind::#name => {
493-
if <#arg as DepNodeParams<TyCtxt<'_>>>::CAN_RECONSTRUCT_QUERY_KEY {
493+
if <#arg as DepNodeParams<TyCtxt<'_>>>::can_reconstruct_query_key() {
494494
if let Some(key) = <#arg as DepNodeParams<TyCtxt<'_>>>::recover($tcx, $dep_node) {
495495
force_query::<crate::ty::query::queries::#name<'_>, _>(
496496
$tcx,

src/librustc_metadata/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
#![feature(nll)]
88
#![feature(or_patterns)]
99
#![feature(proc_macro_internals)]
10-
#![feature(specialization)] // FIXME: min_specialization ICEs
10+
#![feature(min_specialization)]
1111
#![feature(stmt_expr_attributes)]
1212
#![recursion_limit = "256"]
1313

0 commit comments

Comments
 (0)