Skip to content

Commit

Permalink
Auto merge of #74422 - Manishearth:rollup-7mfrf6g, r=Manishearth
Browse files Browse the repository at this point in the history
Rollup of 8 pull requests

Successful merges:

 - #73101 (Resolve items for cross-crate imports relative to the original module)
 - #73269 (Enable some timeouts in SGX platform)
 - #74033 (Add build support for Cargo's build-std feature.)
 - #74351 (Do not render unstable items for rustc doc)
 - #74357 (Some `Symbol` related improvements)
 - #74371 (Improve ayu rustdoc theme)
 - #74386 (Add RISC-V GNU/Linux to src/tools/build-manifest as a host platform)
 - #74398 (Clean up E0723 explanation)

Failed merges:

r? @ghost
  • Loading branch information
bors committed Jul 17, 2020
2 parents 5c9e5df + 5bb9bef commit 8534be7
Show file tree
Hide file tree
Showing 113 changed files with 1,312 additions and 802 deletions.
2 changes: 2 additions & 0 deletions Cargo.lock
Expand Up @@ -2056,6 +2056,7 @@ dependencies = [
name = "panic_abort"
version = "0.0.0"
dependencies = [
"cfg-if",
"compiler_builtins",
"core",
"libc",
Expand Down Expand Up @@ -4552,6 +4553,7 @@ dependencies = [
name = "test"
version = "0.0.0"
dependencies = [
"cfg-if",
"core",
"getopts",
"libc",
Expand Down
1 change: 1 addition & 0 deletions src/libpanic_abort/Cargo.toml
Expand Up @@ -11,6 +11,7 @@ bench = false
doc = false

[dependencies]
cfg-if = { version = "0.1.8", features = ['rustc-dep-of-std'] }
core = { path = "../libcore" }
libc = { version = "0.2", default-features = false }
compiler_builtins = "0.1.0"
35 changes: 19 additions & 16 deletions src/libpanic_abort/lib.rs
Expand Up @@ -40,23 +40,26 @@ pub unsafe extern "C" fn __rust_panic_cleanup(_: *mut u8) -> *mut (dyn Any + Sen
pub unsafe extern "C" fn __rust_start_panic(_payload: usize) -> u32 {
abort();

#[cfg(any(unix, target_os = "cloudabi"))]
unsafe fn abort() -> ! {
libc::abort();
}

#[cfg(any(windows, all(target_arch = "wasm32", not(target_os = "emscripten"))))]
unsafe fn abort() -> ! {
core::intrinsics::abort();
}

#[cfg(any(target_os = "hermit", all(target_vendor = "fortanix", target_env = "sgx")))]
unsafe fn abort() -> ! {
// call std::sys::abort_internal
extern "C" {
pub fn __rust_abort() -> !;
cfg_if::cfg_if! {
if #[cfg(any(unix, target_os = "cloudabi"))] {
unsafe fn abort() -> ! {
libc::abort();
}
} else if #[cfg(any(target_os = "hermit",
all(target_vendor = "fortanix", target_env = "sgx")
))] {
unsafe fn abort() -> ! {
// call std::sys::abort_internal
extern "C" {
pub fn __rust_abort() -> !;
}
__rust_abort();
}
} else {
unsafe fn abort() -> ! {
core::intrinsics::abort();
}
}
__rust_abort();
}
}

Expand Down
20 changes: 16 additions & 4 deletions src/libpanic_unwind/lib.rs
Expand Up @@ -41,21 +41,33 @@ cfg_if::cfg_if! {
if #[cfg(target_os = "emscripten")] {
#[path = "emcc.rs"]
mod real_imp;
} else if #[cfg(target_arch = "wasm32")] {
#[path = "dummy.rs"]
mod real_imp;
} else if #[cfg(target_os = "hermit")] {
#[path = "hermit.rs"]
mod real_imp;
} else if #[cfg(target_env = "msvc")] {
#[path = "seh.rs"]
mod real_imp;
} else {
} else if #[cfg(any(
all(target_family = "windows", target_env = "gnu"),
target_os = "cloudabi",
target_family = "unix",
all(target_vendor = "fortanix", target_env = "sgx"),
))] {
// Rust runtime's startup objects depend on these symbols, so make them public.
#[cfg(all(target_os="windows", target_arch = "x86", target_env="gnu"))]
pub use real_imp::eh_frame_registry::*;
#[path = "gcc.rs"]
mod real_imp;
} else {
// Targets that don't support unwinding.
// - arch=wasm32
// - os=none ("bare metal" targets)
// - os=uefi
// - nvptx64-nvidia-cuda
// - avr-unknown-unknown
// - mipsel-sony-psp
#[path = "dummy.rs"]
mod real_imp;
}
}

Expand Down
1 change: 1 addition & 0 deletions src/libproc_macro/lib.rs
Expand Up @@ -26,6 +26,7 @@
#![feature(in_band_lifetimes)]
#![feature(negative_impls)]
#![feature(optin_builtin_traits)]
#![feature(restricted_std)]
#![feature(rustc_attrs)]
#![feature(min_specialization)]
#![recursion_limit = "256"]
Expand Down
4 changes: 2 additions & 2 deletions src/librustc_builtin_macros/deriving/bounds.rs
Expand Up @@ -16,9 +16,9 @@ pub fn expand_deriving_copy(
let trait_def = TraitDef {
span,
attributes: Vec::new(),
path: path_std!(cx, marker::Copy),
path: path_std!(marker::Copy),
additional_bounds: Vec::new(),
generics: LifetimeBounds::empty(),
generics: Bounds::empty(),
is_unsafe: false,
supports_unions: true,
methods: Vec::new(),
Expand Down
8 changes: 4 additions & 4 deletions src/librustc_builtin_macros/deriving/clone.rs
Expand Up @@ -56,7 +56,7 @@ pub fn expand_deriving_clone(
}
}
ItemKind::Union(..) => {
bounds = vec![Literal(path_std!(cx, marker::Copy))];
bounds = vec![Literal(path_std!(marker::Copy))];
is_shallow = true;
substructure = combine_substructure(Box::new(|c, s, sub| {
cs_clone_shallow("Clone", c, s, sub, true)
Expand All @@ -78,14 +78,14 @@ pub fn expand_deriving_clone(
let trait_def = TraitDef {
span,
attributes: Vec::new(),
path: path_std!(cx, clone::Clone),
path: path_std!(clone::Clone),
additional_bounds: bounds,
generics: LifetimeBounds::empty(),
generics: Bounds::empty(),
is_unsafe: false,
supports_unions: true,
methods: vec![MethodDef {
name: sym::clone,
generics: LifetimeBounds::empty(),
generics: Bounds::empty(),
explicit_self: borrowed_explicit_self(),
args: Vec::new(),
ret_ty: Self_,
Expand Down
14 changes: 4 additions & 10 deletions src/librustc_builtin_macros/deriving/cmp/eq.rs
Expand Up @@ -22,14 +22,14 @@ pub fn expand_deriving_eq(
let trait_def = TraitDef {
span,
attributes: Vec::new(),
path: path_std!(cx, cmp::Eq),
path: path_std!(cmp::Eq),
additional_bounds: Vec::new(),
generics: LifetimeBounds::empty(),
generics: Bounds::empty(),
is_unsafe: false,
supports_unions: true,
methods: vec![MethodDef {
name: sym::assert_receiver_is_total_eq,
generics: LifetimeBounds::empty(),
generics: Bounds::empty(),
explicit_self: borrowed_explicit_self(),
args: vec![],
ret_ty: nil_ty(),
Expand All @@ -43,13 +43,7 @@ pub fn expand_deriving_eq(
associated_types: Vec::new(),
};

super::inject_impl_of_structural_trait(
cx,
span,
item,
path_std!(cx, marker::StructuralEq),
push,
);
super::inject_impl_of_structural_trait(cx, span, item, path_std!(marker::StructuralEq), push);

trait_def.expand_ext(cx, mitem, item, push, true)
}
Expand Down
10 changes: 5 additions & 5 deletions src/librustc_builtin_macros/deriving/cmp/ord.rs
Expand Up @@ -20,17 +20,17 @@ pub fn expand_deriving_ord(
let trait_def = TraitDef {
span,
attributes: Vec::new(),
path: path_std!(cx, cmp::Ord),
path: path_std!(cmp::Ord),
additional_bounds: Vec::new(),
generics: LifetimeBounds::empty(),
generics: Bounds::empty(),
is_unsafe: false,
supports_unions: false,
methods: vec![MethodDef {
name: sym::cmp,
generics: LifetimeBounds::empty(),
generics: Bounds::empty(),
explicit_self: borrowed_explicit_self(),
args: vec![(borrowed_self(), "other")],
ret_ty: Literal(path_std!(cx, cmp::Ordering)),
args: vec![(borrowed_self(), sym::other)],
ret_ty: Literal(path_std!(cmp::Ordering)),
attributes: attrs,
is_unsafe: false,
unify_fieldless_variants: true,
Expand Down
10 changes: 5 additions & 5 deletions src/librustc_builtin_macros/deriving/cmp/partial_eq.rs
Expand Up @@ -69,9 +69,9 @@ pub fn expand_deriving_partial_eq(
let attrs = vec![cx.attribute(inline)];
MethodDef {
name: $name,
generics: LifetimeBounds::empty(),
generics: Bounds::empty(),
explicit_self: borrowed_explicit_self(),
args: vec![(borrowed_self(), "other")],
args: vec![(borrowed_self(), sym::other)],
ret_ty: Literal(path_local!(bool)),
attributes: attrs,
is_unsafe: false,
Expand All @@ -85,7 +85,7 @@ pub fn expand_deriving_partial_eq(
cx,
span,
item,
path_std!(cx, marker::StructuralPartialEq),
path_std!(marker::StructuralPartialEq),
push,
);

Expand All @@ -100,9 +100,9 @@ pub fn expand_deriving_partial_eq(
let trait_def = TraitDef {
span,
attributes: Vec::new(),
path: path_std!(cx, cmp::PartialEq),
path: path_std!(cmp::PartialEq),
additional_bounds: Vec::new(),
generics: LifetimeBounds::empty(),
generics: Bounds::empty(),
is_unsafe: false,
supports_unions: false,
methods,
Expand Down
16 changes: 8 additions & 8 deletions src/librustc_builtin_macros/deriving/cmp/partial_ord.rs
Expand Up @@ -23,9 +23,9 @@ pub fn expand_deriving_partial_ord(
let attrs = vec![cx.attribute(inline)];
MethodDef {
name: $name,
generics: LifetimeBounds::empty(),
generics: Bounds::empty(),
explicit_self: borrowed_explicit_self(),
args: vec![(borrowed_self(), "other")],
args: vec![(borrowed_self(), sym::other)],
ret_ty: Literal(path_local!(bool)),
attributes: attrs,
is_unsafe: false,
Expand All @@ -37,9 +37,9 @@ pub fn expand_deriving_partial_ord(
}};
}

let ordering_ty = Literal(path_std!(cx, cmp::Ordering));
let ordering_ty = Literal(path_std!(cmp::Ordering));
let ret_ty = Literal(Path::new_(
pathvec_std!(cx, option::Option),
pathvec_std!(option::Option),
None,
vec![Box::new(ordering_ty)],
PathKind::Std,
Expand All @@ -50,9 +50,9 @@ pub fn expand_deriving_partial_ord(

let partial_cmp_def = MethodDef {
name: sym::partial_cmp,
generics: LifetimeBounds::empty(),
generics: Bounds::empty(),
explicit_self: borrowed_explicit_self(),
args: vec![(borrowed_self(), "other")],
args: vec![(borrowed_self(), sym::other)],
ret_ty,
attributes: attrs,
is_unsafe: false,
Expand Down Expand Up @@ -80,9 +80,9 @@ pub fn expand_deriving_partial_ord(
let trait_def = TraitDef {
span,
attributes: vec![],
path: path_std!(cx, cmp::PartialOrd),
path: path_std!(cmp::PartialOrd),
additional_bounds: vec![],
generics: LifetimeBounds::empty(),
generics: Bounds::empty(),
is_unsafe: false,
supports_unions: false,
methods,
Expand Down
21 changes: 11 additions & 10 deletions src/librustc_builtin_macros/deriving/debug.rs
Expand Up @@ -18,22 +18,22 @@ pub fn expand_deriving_debug(
) {
// &mut ::std::fmt::Formatter
let fmtr =
Ptr(Box::new(Literal(path_std!(cx, fmt::Formatter))), Borrowed(None, ast::Mutability::Mut));
Ptr(Box::new(Literal(path_std!(fmt::Formatter))), Borrowed(None, ast::Mutability::Mut));

let trait_def = TraitDef {
span,
attributes: Vec::new(),
path: path_std!(cx, fmt::Debug),
path: path_std!(fmt::Debug),
additional_bounds: Vec::new(),
generics: LifetimeBounds::empty(),
generics: Bounds::empty(),
is_unsafe: false,
supports_unions: false,
methods: vec![MethodDef {
name: sym::fmt,
generics: LifetimeBounds::empty(),
generics: Bounds::empty(),
explicit_self: borrowed_explicit_self(),
args: vec![(fmtr, "f")],
ret_ty: Literal(path_std!(cx, fmt::Result)),
args: vec![(fmtr, sym::f)],
ret_ty: Literal(path_std!(fmt::Result)),
attributes: Vec::new(),
is_unsafe: false,
unify_fieldless_variants: false,
Expand Down Expand Up @@ -62,7 +62,7 @@ fn show_substructure(cx: &mut ExtCtxt<'_>, span: Span, substr: &Substructure<'_>
// We want to make sure we have the ctxt set so that we can use unstable methods
let span = cx.with_def_site_ctxt(span);
let name = cx.expr_lit(span, ast::LitKind::Str(ident.name, ast::StrStyle::Cooked));
let builder = cx.ident_of("debug_trait_builder", span);
let builder = Ident::new(sym::debug_trait_builder, span);
let builder_expr = cx.expr_ident(span, builder);

let fmt = substr.nonself_args[0].clone();
Expand All @@ -71,7 +71,8 @@ fn show_substructure(cx: &mut ExtCtxt<'_>, span: Span, substr: &Substructure<'_>
match vdata {
ast::VariantData::Tuple(..) | ast::VariantData::Unit(..) => {
// tuple struct/"normal" variant
let expr = cx.expr_method_call(span, fmt, cx.ident_of("debug_tuple", span), vec![name]);
let expr =
cx.expr_method_call(span, fmt, Ident::new(sym::debug_tuple, span), vec![name]);
stmts.push(cx.stmt_let(span, true, builder, expr));

for field in fields {
Expand All @@ -94,7 +95,7 @@ fn show_substructure(cx: &mut ExtCtxt<'_>, span: Span, substr: &Substructure<'_>
ast::VariantData::Struct(..) => {
// normal struct/struct variant
let expr =
cx.expr_method_call(span, fmt, cx.ident_of("debug_struct", span), vec![name]);
cx.expr_method_call(span, fmt, Ident::new(sym::debug_struct, span), vec![name]);
stmts.push(cx.stmt_let(DUMMY_SP, true, builder, expr));

for field in fields {
Expand All @@ -117,7 +118,7 @@ fn show_substructure(cx: &mut ExtCtxt<'_>, span: Span, substr: &Substructure<'_>
}
}

let expr = cx.expr_method_call(span, builder_expr, cx.ident_of("finish", span), vec![]);
let expr = cx.expr_method_call(span, builder_expr, Ident::new(sym::finish, span), vec![]);

stmts.push(cx.stmt_expr(expr));
let block = cx.block(span, stmts);
Expand Down

0 comments on commit 8534be7

Please sign in to comment.