Skip to content

Commit

Permalink
Auto merge of #73369 - RalfJung:rollup-hl8g9zf, r=RalfJung
Browse files Browse the repository at this point in the history
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
  • Loading branch information
bors committed Jun 15, 2020
2 parents d4ecf31 + 54bd077 commit ff4a253
Show file tree
Hide file tree
Showing 92 changed files with 1,061 additions and 582 deletions.
5 changes: 0 additions & 5 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -428,11 +428,6 @@ jobs:
NO_DEBUG_ASSERTIONS: 1
NO_LLVM_ASSERTIONS: 1
os: windows-latest-xl
- name: x86_64-msvc-aux
env:
RUST_CHECK_TARGET: check-aux EXCLUDE_CARGO=1
RUST_CONFIGURE_ARGS: "--build=x86_64-pc-windows-msvc"
os: windows-latest-xl
- name: x86_64-msvc-cargo
env:
SCRIPT: python x.py test src/tools/cargotest src/tools/cargo
Expand Down
4 changes: 2 additions & 2 deletions Cargo.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1434,9 +1434,9 @@ dependencies = [

[[package]]
name = "hermit-abi"
version = "0.1.13"
version = "0.1.14"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "91780f809e750b0a89f5544be56617ff6b1227ee485bcb06ebe10cdf89bd3b71"
checksum = "b9586eedd4ce6b3c498bc3b4dd92fc9f11166aa908a914071953768066c67909"
dependencies = [
"compiler_builtins",
"libc",
Expand Down
1 change: 0 additions & 1 deletion src/bootstrap/builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -373,7 +373,6 @@ impl<'a> Builder<'a> {
test::UiFullDeps,
test::Rustdoc,
test::Pretty,
test::RunPassValgrindPretty,
test::Crate,
test::CrateLibrustc,
test::CrateRustdoc,
Expand Down
10 changes: 2 additions & 8 deletions src/bootstrap/mk/Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,6 @@ Q := @
BOOTSTRAP_ARGS :=
endif

ifdef EXCLUDE_CARGO
AUX_ARGS :=
else
AUX_ARGS := src/tools/cargo src/tools/cargotest
endif

BOOTSTRAP := $(CFG_PYTHON) $(CFG_SRC_DIR)src/bootstrap/bootstrap.py

all:
Expand Down Expand Up @@ -48,8 +42,8 @@ check:
$(Q)$(BOOTSTRAP) test $(BOOTSTRAP_ARGS)
check-aux:
$(Q)$(BOOTSTRAP) test \
src/test/run-pass-valgrind/pretty \
$(AUX_ARGS) \
src/tools/cargo \
src/tools/cargotest \
$(BOOTSTRAP_ARGS)
check-bootstrap:
$(Q)$(CFG_PYTHON) $(CFG_SRC_DIR)src/bootstrap/bootstrap_test.py
Expand Down
7 changes: 0 additions & 7 deletions src/bootstrap/test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -930,13 +930,6 @@ host_test!(UiFullDeps { path: "src/test/ui-fulldeps", mode: "ui", suite: "ui-ful
host_test!(Rustdoc { path: "src/test/rustdoc", mode: "rustdoc", suite: "rustdoc" });

host_test!(Pretty { path: "src/test/pretty", mode: "pretty", suite: "pretty" });
test!(RunPassValgrindPretty {
path: "src/test/run-pass-valgrind/pretty",
mode: "pretty",
suite: "run-pass-valgrind",
default: false,
host: true
});

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

Expand Down
4 changes: 0 additions & 4 deletions src/ci/azure-pipelines/auto.yml
Original file line number Diff line number Diff line change
Expand Up @@ -142,10 +142,6 @@ jobs:
# FIXME(#59637)
NO_DEBUG_ASSERTIONS: 1
NO_LLVM_ASSERTIONS: 1
# MSVC aux tests
x86_64-msvc-aux:
RUST_CHECK_TARGET: check-aux EXCLUDE_CARGO=1
INITIAL_RUST_CONFIGURE_ARGS: --build=x86_64-pc-windows-msvc
x86_64-msvc-cargo:
SCRIPT: python x.py test src/tools/cargotest src/tools/cargo
INITIAL_RUST_CONFIGURE_ARGS: --build=x86_64-pc-windows-msvc --enable-lld
Expand Down
6 changes: 0 additions & 6 deletions src/ci/github-actions/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -492,12 +492,6 @@ jobs:
NO_LLVM_ASSERTIONS: 1
<<: *job-windows-xl

- name: x86_64-msvc-aux
env:
RUST_CHECK_TARGET: check-aux EXCLUDE_CARGO=1
RUST_CONFIGURE_ARGS: --build=x86_64-pc-windows-msvc
<<: *job-windows-xl

- name: x86_64-msvc-cargo
env:
SCRIPT: python x.py test src/tools/cargotest src/tools/cargo
Expand Down
1 change: 0 additions & 1 deletion src/libcore/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,6 @@
#![feature(associated_type_bounds)]
#![feature(const_type_id)]
#![feature(const_caller_location)]
#![feature(option_zip)]
#![feature(no_niche)] // rust-lang/rust#68303

#[prelude_import]
Expand Down
8 changes: 5 additions & 3 deletions src/libcore/option.rs
Original file line number Diff line number Diff line change
Expand Up @@ -926,17 +926,19 @@ impl<T> Option<T> {
/// # Examples
///
/// ```
/// #![feature(option_zip)]
/// let x = Some(1);
/// let y = Some("hi");
/// let z = None::<u8>;
///
/// assert_eq!(x.zip(y), Some((1, "hi")));
/// assert_eq!(x.zip(z), None);
/// ```
#[unstable(feature = "option_zip", issue = "70086")]
#[stable(feature = "option_zip_option", since = "1.46.0")]
pub fn zip<U>(self, other: Option<U>) -> Option<(T, U)> {
self.zip_with(other, |a, b| (a, b))
match (self, other) {
(Some(a), Some(b)) => Some((a, b)),
_ => None,
}
}

/// Zips `self` and another `Option` with function `f`.
Expand Down
29 changes: 19 additions & 10 deletions src/librustc_arena/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -602,7 +602,7 @@ macro_rules! which_arena_for_type {

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

#[marker]
pub trait ArenaAllocatable {}
pub trait ArenaAllocatable<'tcx> {}

impl<T: Copy> ArenaAllocatable for T {}
impl<'tcx, T: Copy> ArenaAllocatable<'tcx> for T {}

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

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

$(
#[allow(unused_lifetimes)]
impl<$tcx> ArenaAllocatable for $ty {}
unsafe impl<$tcx> ArenaField<$tcx> for $ty {
impl<$tcx> ArenaAllocatable<$tcx> for $ty {}
unsafe impl<$tcx, '_x, '_y, '_z, '_w> ArenaField<$tcx> for $gen_ty where Self: ArenaAllocatable<$tcx> {
#[inline]
fn arena<'a>(_arena: &'a Arena<$tcx>) -> Option<&'a $crate::TypedArena<Self>> {
$crate::which_arena_for_type!($a[&_arena.$name])
// SAFETY: We only implement `ArenaAllocatable<$tcx>` for
// `$ty`, so `$ty` and Self are the same type
unsafe {
::std::mem::transmute::<
Option<&'a $crate::TypedArena<$ty>>,
Option<&'a $crate::TypedArena<Self>>,
>(
$crate::which_arena_for_type!($a[&_arena.$name])
)
}
}
}
)*

impl<'tcx> Arena<'tcx> {
#[inline]
pub fn alloc<T: ArenaAllocatable>(&self, value: T) -> &mut T {
pub fn alloc<T: ArenaAllocatable<'tcx>>(&self, value: T) -> &mut T {
if !::std::mem::needs_drop::<T>() {
return self.dropless.alloc(value);
}
Expand All @@ -659,7 +668,7 @@ macro_rules! declare_arena {
self.dropless.alloc_slice(value)
}

pub fn alloc_from_iter<'a, T: ArenaAllocatable>(
pub fn alloc_from_iter<'a, T: ArenaAllocatable<'tcx>>(
&'a self,
iter: impl ::std::iter::IntoIterator<Item = T>,
) -> &'a mut [T] {
Expand Down
2 changes: 1 addition & 1 deletion src/librustc_ast_lowering/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
#![feature(array_value_iter)]
#![feature(crate_visibility_modifier)]
#![feature(marker_trait_attr)]
#![feature(specialization)] // FIXME: min_specialization does not work
#![feature(min_specialization)]
#![feature(or_patterns)]
#![recursion_limit = "256"]

Expand Down
23 changes: 23 additions & 0 deletions src/librustc_errors/diagnostic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -296,6 +296,29 @@ impl Diagnostic {
self
}

pub fn multipart_suggestions(
&mut self,
msg: &str,
suggestions: Vec<Vec<(Span, String)>>,
applicability: Applicability,
) -> &mut Self {
self.suggestions.push(CodeSuggestion {
substitutions: suggestions
.into_iter()
.map(|suggestion| Substitution {
parts: suggestion
.into_iter()
.map(|(span, snippet)| SubstitutionPart { snippet, span })
.collect(),
})
.collect(),
msg: msg.to_owned(),
style: SuggestionStyle::ShowCode,
applicability,
});
self
}

/// Prints out a message with for a multipart suggestion without showing the suggested code.
///
/// This is intended to be used for suggestions that are obvious in what the changes need to
Expand Down
13 changes: 13 additions & 0 deletions src/librustc_errors/diagnostic_builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -260,6 +260,19 @@ impl<'a> DiagnosticBuilder<'a> {
self
}

pub fn multipart_suggestions(
&mut self,
msg: &str,
suggestions: Vec<Vec<(Span, String)>>,
applicability: Applicability,
) -> &mut Self {
if !self.0.allow_suggestions {
return self;
}
self.0.diagnostic.multipart_suggestions(msg, suggestions, applicability);
self
}

pub fn tool_only_multipart_suggestion(
&mut self,
msg: &str,
Expand Down
70 changes: 35 additions & 35 deletions src/librustc_hir/arena.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,41 +12,41 @@ macro_rules! arena_types {
($macro:path, $args:tt, $tcx:lifetime) => (
$macro!($args, [
// HIR types
[few] hir_krate: rustc_hir::Crate<$tcx>,
[] arm: rustc_hir::Arm<$tcx>,
[] asm_operand: rustc_hir::InlineAsmOperand<$tcx>,
[] asm_template: rustc_ast::ast::InlineAsmTemplatePiece,
[] attribute: rustc_ast::ast::Attribute,
[] block: rustc_hir::Block<$tcx>,
[] bare_fn_ty: rustc_hir::BareFnTy<$tcx>,
[few] global_asm: rustc_hir::GlobalAsm,
[] generic_arg: rustc_hir::GenericArg<$tcx>,
[] generic_args: rustc_hir::GenericArgs<$tcx>,
[] generic_bound: rustc_hir::GenericBound<$tcx>,
[] generic_param: rustc_hir::GenericParam<$tcx>,
[] expr: rustc_hir::Expr<$tcx>,
[] field: rustc_hir::Field<$tcx>,
[] field_pat: rustc_hir::FieldPat<$tcx>,
[] fn_decl: rustc_hir::FnDecl<$tcx>,
[] foreign_item: rustc_hir::ForeignItem<$tcx>,
[] impl_item_ref: rustc_hir::ImplItemRef<$tcx>,
[few] inline_asm: rustc_hir::InlineAsm<$tcx>,
[few] llvm_inline_asm: rustc_hir::LlvmInlineAsm<$tcx>,
[] local: rustc_hir::Local<$tcx>,
[few] macro_def: rustc_hir::MacroDef<$tcx>,
[] param: rustc_hir::Param<$tcx>,
[] pat: rustc_hir::Pat<$tcx>,
[] path: rustc_hir::Path<$tcx>,
[] path_segment: rustc_hir::PathSegment<$tcx>,
[] poly_trait_ref: rustc_hir::PolyTraitRef<$tcx>,
[] qpath: rustc_hir::QPath<$tcx>,
[] stmt: rustc_hir::Stmt<$tcx>,
[] struct_field: rustc_hir::StructField<$tcx>,
[] trait_item_ref: rustc_hir::TraitItemRef,
[] ty: rustc_hir::Ty<$tcx>,
[] type_binding: rustc_hir::TypeBinding<$tcx>,
[] variant: rustc_hir::Variant<$tcx>,
[] where_predicate: rustc_hir::WherePredicate<$tcx>,
[few] hir_krate: rustc_hir::Crate<$tcx>, rustc_hir::Crate<'_x>;
[] arm: rustc_hir::Arm<$tcx>, rustc_hir::Arm<'_x>;
[] asm_operand: rustc_hir::InlineAsmOperand<$tcx>, rustc_hir::InlineAsmOperand<'_x>;
[] asm_template: rustc_ast::ast::InlineAsmTemplatePiece, rustc_ast::ast::InlineAsmTemplatePiece;
[] attribute: rustc_ast::ast::Attribute, rustc_ast::ast::Attribute;
[] block: rustc_hir::Block<$tcx>, rustc_hir::Block<'_x>;
[] bare_fn_ty: rustc_hir::BareFnTy<$tcx>, rustc_hir::BareFnTy<'_x>;
[few] global_asm: rustc_hir::GlobalAsm, rustc_hir::GlobalAsm;
[] generic_arg: rustc_hir::GenericArg<$tcx>, rustc_hir::GenericArg<'_x>;
[] generic_args: rustc_hir::GenericArgs<$tcx>, rustc_hir::GenericArgs<'_x>;
[] generic_bound: rustc_hir::GenericBound<$tcx>, rustc_hir::GenericBound<'_x>;
[] generic_param: rustc_hir::GenericParam<$tcx>, rustc_hir::GenericParam<'_x>;
[] expr: rustc_hir::Expr<$tcx>, rustc_hir::Expr<'_x>;
[] field: rustc_hir::Field<$tcx>, rustc_hir::Field<'_x>;
[] field_pat: rustc_hir::FieldPat<$tcx>, rustc_hir::FieldPat<'_x>;
[] fn_decl: rustc_hir::FnDecl<$tcx>, rustc_hir::FnDecl<'_x>;
[] foreign_item: rustc_hir::ForeignItem<$tcx>, rustc_hir::ForeignItem<'_x>;
[] impl_item_ref: rustc_hir::ImplItemRef<$tcx>, rustc_hir::ImplItemRef<'_x>;
[few] inline_asm: rustc_hir::InlineAsm<$tcx>, rustc_hir::InlineAsm<'_x>;
[few] llvm_inline_asm: rustc_hir::LlvmInlineAsm<$tcx>, rustc_hir::LlvmInlineAsm<'_x>;
[] local: rustc_hir::Local<$tcx>, rustc_hir::Local<'_x>;
[few] macro_def: rustc_hir::MacroDef<$tcx>, rustc_hir::MacroDef<'_x>;
[] param: rustc_hir::Param<$tcx>, rustc_hir::Param<'_x>;
[] pat: rustc_hir::Pat<$tcx>, rustc_hir::Pat<'_x>;
[] path: rustc_hir::Path<$tcx>, rustc_hir::Path<'_x>;
[] path_segment: rustc_hir::PathSegment<$tcx>, rustc_hir::PathSegment<'_x>;
[] poly_trait_ref: rustc_hir::PolyTraitRef<$tcx>, rustc_hir::PolyTraitRef<'_x>;
[] qpath: rustc_hir::QPath<$tcx>, rustc_hir::QPath<'_x>;
[] stmt: rustc_hir::Stmt<$tcx>, rustc_hir::Stmt<'_x>;
[] struct_field: rustc_hir::StructField<$tcx>, rustc_hir::StructField<'_x>;
[] trait_item_ref: rustc_hir::TraitItemRef, rustc_hir::TraitItemRef;
[] ty: rustc_hir::Ty<$tcx>, rustc_hir::Ty<'_x>;
[] type_binding: rustc_hir::TypeBinding<$tcx>, rustc_hir::TypeBinding<'_x>;
[] variant: rustc_hir::Variant<$tcx>, rustc_hir::Variant<'_x>;
[] where_predicate: rustc_hir::WherePredicate<$tcx>, rustc_hir::WherePredicate<'_x>;
], $tcx);
)
}
2 changes: 1 addition & 1 deletion src/librustc_infer/infer/canonical/query_response.rs
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ impl<'cx, 'tcx> InferCtxt<'cx, 'tcx> {
) -> Fallible<CanonicalizedQueryResponse<'tcx, T>>
where
T: Debug + TypeFoldable<'tcx>,
Canonical<'tcx, QueryResponse<'tcx, T>>: ArenaAllocatable,
Canonical<'tcx, QueryResponse<'tcx, T>>: ArenaAllocatable<'tcx>,
{
let query_response = self.make_query_response(inference_vars, answer, fulfill_cx)?;
let canonical_result = self.canonicalize_response(&query_response);
Expand Down
4 changes: 2 additions & 2 deletions src/librustc_macros/src/query.rs
Original file line number Diff line number Diff line change
Expand Up @@ -433,7 +433,7 @@ pub fn rustc_queries(input: TokenStream) -> TokenStream {

try_load_from_on_disk_cache_stream.extend(quote! {
::rustc_middle::dep_graph::DepKind::#name => {
if <#arg as DepNodeParams<TyCtxt<'_>>>::CAN_RECONSTRUCT_QUERY_KEY {
if <#arg as DepNodeParams<TyCtxt<'_>>>::can_reconstruct_query_key() {
debug_assert!($tcx.dep_graph
.node_color($dep_node)
.map(|c| c.is_green())
Expand Down Expand Up @@ -490,7 +490,7 @@ pub fn rustc_queries(input: TokenStream) -> TokenStream {
// Add a match arm to force the query given the dep node
dep_node_force_stream.extend(quote! {
::rustc_middle::dep_graph::DepKind::#name => {
if <#arg as DepNodeParams<TyCtxt<'_>>>::CAN_RECONSTRUCT_QUERY_KEY {
if <#arg as DepNodeParams<TyCtxt<'_>>>::can_reconstruct_query_key() {
if let Some(key) = <#arg as DepNodeParams<TyCtxt<'_>>>::recover($tcx, $dep_node) {
force_query::<crate::ty::query::queries::#name<'_>, _>(
$tcx,
Expand Down
2 changes: 1 addition & 1 deletion src/librustc_metadata/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
#![feature(nll)]
#![feature(or_patterns)]
#![feature(proc_macro_internals)]
#![feature(specialization)] // FIXME: min_specialization ICEs
#![feature(min_specialization)]
#![feature(stmt_expr_attributes)]
#![recursion_limit = "256"]

Expand Down
Loading

0 comments on commit ff4a253

Please sign in to comment.