Skip to content

Commit 8534be7

Browse files
committed
Auto merge of rust-lang#74422 - Manishearth:rollup-7mfrf6g, r=Manishearth
Rollup of 8 pull requests Successful merges: - rust-lang#73101 (Resolve items for cross-crate imports relative to the original module) - rust-lang#73269 (Enable some timeouts in SGX platform) - rust-lang#74033 (Add build support for Cargo's build-std feature.) - rust-lang#74351 (Do not render unstable items for rustc doc) - rust-lang#74357 (Some `Symbol` related improvements) - rust-lang#74371 (Improve ayu rustdoc theme) - rust-lang#74386 (Add RISC-V GNU/Linux to src/tools/build-manifest as a host platform) - rust-lang#74398 (Clean up E0723 explanation) Failed merges: r? @ghost
2 parents 5c9e5df + 5bb9bef commit 8534be7

File tree

113 files changed

+1312
-802
lines changed

Some content is hidden

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

113 files changed

+1312
-802
lines changed

Cargo.lock

+2
Original file line numberDiff line numberDiff line change
@@ -2056,6 +2056,7 @@ dependencies = [
20562056
name = "panic_abort"
20572057
version = "0.0.0"
20582058
dependencies = [
2059+
"cfg-if",
20592060
"compiler_builtins",
20602061
"core",
20612062
"libc",
@@ -4552,6 +4553,7 @@ dependencies = [
45524553
name = "test"
45534554
version = "0.0.0"
45544555
dependencies = [
4556+
"cfg-if",
45554557
"core",
45564558
"getopts",
45574559
"libc",

src/libpanic_abort/Cargo.toml

+1
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ bench = false
1111
doc = false
1212

1313
[dependencies]
14+
cfg-if = { version = "0.1.8", features = ['rustc-dep-of-std'] }
1415
core = { path = "../libcore" }
1516
libc = { version = "0.2", default-features = false }
1617
compiler_builtins = "0.1.0"

src/libpanic_abort/lib.rs

+19-16
Original file line numberDiff line numberDiff line change
@@ -40,23 +40,26 @@ pub unsafe extern "C" fn __rust_panic_cleanup(_: *mut u8) -> *mut (dyn Any + Sen
4040
pub unsafe extern "C" fn __rust_start_panic(_payload: usize) -> u32 {
4141
abort();
4242

43-
#[cfg(any(unix, target_os = "cloudabi"))]
44-
unsafe fn abort() -> ! {
45-
libc::abort();
46-
}
47-
48-
#[cfg(any(windows, all(target_arch = "wasm32", not(target_os = "emscripten"))))]
49-
unsafe fn abort() -> ! {
50-
core::intrinsics::abort();
51-
}
52-
53-
#[cfg(any(target_os = "hermit", all(target_vendor = "fortanix", target_env = "sgx")))]
54-
unsafe fn abort() -> ! {
55-
// call std::sys::abort_internal
56-
extern "C" {
57-
pub fn __rust_abort() -> !;
43+
cfg_if::cfg_if! {
44+
if #[cfg(any(unix, target_os = "cloudabi"))] {
45+
unsafe fn abort() -> ! {
46+
libc::abort();
47+
}
48+
} else if #[cfg(any(target_os = "hermit",
49+
all(target_vendor = "fortanix", target_env = "sgx")
50+
))] {
51+
unsafe fn abort() -> ! {
52+
// call std::sys::abort_internal
53+
extern "C" {
54+
pub fn __rust_abort() -> !;
55+
}
56+
__rust_abort();
57+
}
58+
} else {
59+
unsafe fn abort() -> ! {
60+
core::intrinsics::abort();
61+
}
5862
}
59-
__rust_abort();
6063
}
6164
}
6265

src/libpanic_unwind/lib.rs

+16-4
Original file line numberDiff line numberDiff line change
@@ -41,21 +41,33 @@ cfg_if::cfg_if! {
4141
if #[cfg(target_os = "emscripten")] {
4242
#[path = "emcc.rs"]
4343
mod real_imp;
44-
} else if #[cfg(target_arch = "wasm32")] {
45-
#[path = "dummy.rs"]
46-
mod real_imp;
4744
} else if #[cfg(target_os = "hermit")] {
4845
#[path = "hermit.rs"]
4946
mod real_imp;
5047
} else if #[cfg(target_env = "msvc")] {
5148
#[path = "seh.rs"]
5249
mod real_imp;
53-
} else {
50+
} else if #[cfg(any(
51+
all(target_family = "windows", target_env = "gnu"),
52+
target_os = "cloudabi",
53+
target_family = "unix",
54+
all(target_vendor = "fortanix", target_env = "sgx"),
55+
))] {
5456
// Rust runtime's startup objects depend on these symbols, so make them public.
5557
#[cfg(all(target_os="windows", target_arch = "x86", target_env="gnu"))]
5658
pub use real_imp::eh_frame_registry::*;
5759
#[path = "gcc.rs"]
5860
mod real_imp;
61+
} else {
62+
// Targets that don't support unwinding.
63+
// - arch=wasm32
64+
// - os=none ("bare metal" targets)
65+
// - os=uefi
66+
// - nvptx64-nvidia-cuda
67+
// - avr-unknown-unknown
68+
// - mipsel-sony-psp
69+
#[path = "dummy.rs"]
70+
mod real_imp;
5971
}
6072
}
6173

src/libproc_macro/lib.rs

+1
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
#![feature(in_band_lifetimes)]
2727
#![feature(negative_impls)]
2828
#![feature(optin_builtin_traits)]
29+
#![feature(restricted_std)]
2930
#![feature(rustc_attrs)]
3031
#![feature(min_specialization)]
3132
#![recursion_limit = "256"]

src/librustc_builtin_macros/deriving/bounds.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,9 @@ pub fn expand_deriving_copy(
1616
let trait_def = TraitDef {
1717
span,
1818
attributes: Vec::new(),
19-
path: path_std!(cx, marker::Copy),
19+
path: path_std!(marker::Copy),
2020
additional_bounds: Vec::new(),
21-
generics: LifetimeBounds::empty(),
21+
generics: Bounds::empty(),
2222
is_unsafe: false,
2323
supports_unions: true,
2424
methods: Vec::new(),

src/librustc_builtin_macros/deriving/clone.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ pub fn expand_deriving_clone(
5656
}
5757
}
5858
ItemKind::Union(..) => {
59-
bounds = vec![Literal(path_std!(cx, marker::Copy))];
59+
bounds = vec![Literal(path_std!(marker::Copy))];
6060
is_shallow = true;
6161
substructure = combine_substructure(Box::new(|c, s, sub| {
6262
cs_clone_shallow("Clone", c, s, sub, true)
@@ -78,14 +78,14 @@ pub fn expand_deriving_clone(
7878
let trait_def = TraitDef {
7979
span,
8080
attributes: Vec::new(),
81-
path: path_std!(cx, clone::Clone),
81+
path: path_std!(clone::Clone),
8282
additional_bounds: bounds,
83-
generics: LifetimeBounds::empty(),
83+
generics: Bounds::empty(),
8484
is_unsafe: false,
8585
supports_unions: true,
8686
methods: vec![MethodDef {
8787
name: sym::clone,
88-
generics: LifetimeBounds::empty(),
88+
generics: Bounds::empty(),
8989
explicit_self: borrowed_explicit_self(),
9090
args: Vec::new(),
9191
ret_ty: Self_,

src/librustc_builtin_macros/deriving/cmp/eq.rs

+4-10
Original file line numberDiff line numberDiff line change
@@ -22,14 +22,14 @@ pub fn expand_deriving_eq(
2222
let trait_def = TraitDef {
2323
span,
2424
attributes: Vec::new(),
25-
path: path_std!(cx, cmp::Eq),
25+
path: path_std!(cmp::Eq),
2626
additional_bounds: Vec::new(),
27-
generics: LifetimeBounds::empty(),
27+
generics: Bounds::empty(),
2828
is_unsafe: false,
2929
supports_unions: true,
3030
methods: vec![MethodDef {
3131
name: sym::assert_receiver_is_total_eq,
32-
generics: LifetimeBounds::empty(),
32+
generics: Bounds::empty(),
3333
explicit_self: borrowed_explicit_self(),
3434
args: vec![],
3535
ret_ty: nil_ty(),
@@ -43,13 +43,7 @@ pub fn expand_deriving_eq(
4343
associated_types: Vec::new(),
4444
};
4545

46-
super::inject_impl_of_structural_trait(
47-
cx,
48-
span,
49-
item,
50-
path_std!(cx, marker::StructuralEq),
51-
push,
52-
);
46+
super::inject_impl_of_structural_trait(cx, span, item, path_std!(marker::StructuralEq), push);
5347

5448
trait_def.expand_ext(cx, mitem, item, push, true)
5549
}

src/librustc_builtin_macros/deriving/cmp/ord.rs

+5-5
Original file line numberDiff line numberDiff line change
@@ -20,17 +20,17 @@ pub fn expand_deriving_ord(
2020
let trait_def = TraitDef {
2121
span,
2222
attributes: Vec::new(),
23-
path: path_std!(cx, cmp::Ord),
23+
path: path_std!(cmp::Ord),
2424
additional_bounds: Vec::new(),
25-
generics: LifetimeBounds::empty(),
25+
generics: Bounds::empty(),
2626
is_unsafe: false,
2727
supports_unions: false,
2828
methods: vec![MethodDef {
2929
name: sym::cmp,
30-
generics: LifetimeBounds::empty(),
30+
generics: Bounds::empty(),
3131
explicit_self: borrowed_explicit_self(),
32-
args: vec![(borrowed_self(), "other")],
33-
ret_ty: Literal(path_std!(cx, cmp::Ordering)),
32+
args: vec![(borrowed_self(), sym::other)],
33+
ret_ty: Literal(path_std!(cmp::Ordering)),
3434
attributes: attrs,
3535
is_unsafe: false,
3636
unify_fieldless_variants: true,

src/librustc_builtin_macros/deriving/cmp/partial_eq.rs

+5-5
Original file line numberDiff line numberDiff line change
@@ -69,9 +69,9 @@ pub fn expand_deriving_partial_eq(
6969
let attrs = vec![cx.attribute(inline)];
7070
MethodDef {
7171
name: $name,
72-
generics: LifetimeBounds::empty(),
72+
generics: Bounds::empty(),
7373
explicit_self: borrowed_explicit_self(),
74-
args: vec![(borrowed_self(), "other")],
74+
args: vec![(borrowed_self(), sym::other)],
7575
ret_ty: Literal(path_local!(bool)),
7676
attributes: attrs,
7777
is_unsafe: false,
@@ -85,7 +85,7 @@ pub fn expand_deriving_partial_eq(
8585
cx,
8686
span,
8787
item,
88-
path_std!(cx, marker::StructuralPartialEq),
88+
path_std!(marker::StructuralPartialEq),
8989
push,
9090
);
9191

@@ -100,9 +100,9 @@ pub fn expand_deriving_partial_eq(
100100
let trait_def = TraitDef {
101101
span,
102102
attributes: Vec::new(),
103-
path: path_std!(cx, cmp::PartialEq),
103+
path: path_std!(cmp::PartialEq),
104104
additional_bounds: Vec::new(),
105-
generics: LifetimeBounds::empty(),
105+
generics: Bounds::empty(),
106106
is_unsafe: false,
107107
supports_unions: false,
108108
methods,

src/librustc_builtin_macros/deriving/cmp/partial_ord.rs

+8-8
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,9 @@ pub fn expand_deriving_partial_ord(
2323
let attrs = vec![cx.attribute(inline)];
2424
MethodDef {
2525
name: $name,
26-
generics: LifetimeBounds::empty(),
26+
generics: Bounds::empty(),
2727
explicit_self: borrowed_explicit_self(),
28-
args: vec![(borrowed_self(), "other")],
28+
args: vec![(borrowed_self(), sym::other)],
2929
ret_ty: Literal(path_local!(bool)),
3030
attributes: attrs,
3131
is_unsafe: false,
@@ -37,9 +37,9 @@ pub fn expand_deriving_partial_ord(
3737
}};
3838
}
3939

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

5151
let partial_cmp_def = MethodDef {
5252
name: sym::partial_cmp,
53-
generics: LifetimeBounds::empty(),
53+
generics: Bounds::empty(),
5454
explicit_self: borrowed_explicit_self(),
55-
args: vec![(borrowed_self(), "other")],
55+
args: vec![(borrowed_self(), sym::other)],
5656
ret_ty,
5757
attributes: attrs,
5858
is_unsafe: false,
@@ -80,9 +80,9 @@ pub fn expand_deriving_partial_ord(
8080
let trait_def = TraitDef {
8181
span,
8282
attributes: vec![],
83-
path: path_std!(cx, cmp::PartialOrd),
83+
path: path_std!(cmp::PartialOrd),
8484
additional_bounds: vec![],
85-
generics: LifetimeBounds::empty(),
85+
generics: Bounds::empty(),
8686
is_unsafe: false,
8787
supports_unions: false,
8888
methods,

src/librustc_builtin_macros/deriving/debug.rs

+11-10
Original file line numberDiff line numberDiff line change
@@ -18,22 +18,22 @@ pub fn expand_deriving_debug(
1818
) {
1919
// &mut ::std::fmt::Formatter
2020
let fmtr =
21-
Ptr(Box::new(Literal(path_std!(cx, fmt::Formatter))), Borrowed(None, ast::Mutability::Mut));
21+
Ptr(Box::new(Literal(path_std!(fmt::Formatter))), Borrowed(None, ast::Mutability::Mut));
2222

2323
let trait_def = TraitDef {
2424
span,
2525
attributes: Vec::new(),
26-
path: path_std!(cx, fmt::Debug),
26+
path: path_std!(fmt::Debug),
2727
additional_bounds: Vec::new(),
28-
generics: LifetimeBounds::empty(),
28+
generics: Bounds::empty(),
2929
is_unsafe: false,
3030
supports_unions: false,
3131
methods: vec![MethodDef {
3232
name: sym::fmt,
33-
generics: LifetimeBounds::empty(),
33+
generics: Bounds::empty(),
3434
explicit_self: borrowed_explicit_self(),
35-
args: vec![(fmtr, "f")],
36-
ret_ty: Literal(path_std!(cx, fmt::Result)),
35+
args: vec![(fmtr, sym::f)],
36+
ret_ty: Literal(path_std!(fmt::Result)),
3737
attributes: Vec::new(),
3838
is_unsafe: false,
3939
unify_fieldless_variants: false,
@@ -62,7 +62,7 @@ fn show_substructure(cx: &mut ExtCtxt<'_>, span: Span, substr: &Substructure<'_>
6262
// We want to make sure we have the ctxt set so that we can use unstable methods
6363
let span = cx.with_def_site_ctxt(span);
6464
let name = cx.expr_lit(span, ast::LitKind::Str(ident.name, ast::StrStyle::Cooked));
65-
let builder = cx.ident_of("debug_trait_builder", span);
65+
let builder = Ident::new(sym::debug_trait_builder, span);
6666
let builder_expr = cx.expr_ident(span, builder);
6767

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

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

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

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

122123
stmts.push(cx.stmt_expr(expr));
123124
let block = cx.block(span, stmts);

0 commit comments

Comments
 (0)