Skip to content

Commit 2b21f4f

Browse files
committed
Auto merge of rust-lang#129946 - GuillaumeGomez:rollup-bovh08y, r=GuillaumeGomez
Rollup of 7 pull requests Successful merges: - rust-lang#127021 (Add target support for RTEMS Arm) - rust-lang#128871 (bypass linker configuration and cross target check for specific commands) - rust-lang#129471 ([rustdoc] Sort impl associated items by kinds and then by appearance) - rust-lang#129529 (Add test to build crates used by r-a on stable) - rust-lang#129706 (Rename dump of coroutine by-move-body to be more consistent, fix ICE in dump_mir) - rust-lang#129796 (Unify scraped examples with other code examples) - rust-lang#129939 (explain why Rvalue::Len still exists) r? `@ghost` `@rustbot` modify labels: rollup
2 parents d6c8169 + d4b349e commit 2b21f4f

File tree

68 files changed

+1272
-252
lines changed

Some content is hidden

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

68 files changed

+1272
-252
lines changed

compiler/rustc_middle/src/mir/pretty.rs

+3-1
Original file line numberDiff line numberDiff line change
@@ -612,7 +612,9 @@ fn write_mir_sig(tcx: TyCtxt<'_>, body: &Body<'_>, w: &mut dyn io::Write) -> io:
612612
let def_id = body.source.def_id();
613613
let kind = tcx.def_kind(def_id);
614614
let is_function = match kind {
615-
DefKind::Fn | DefKind::AssocFn | DefKind::Ctor(..) => true,
615+
DefKind::Fn | DefKind::AssocFn | DefKind::Ctor(..) | DefKind::SyntheticCoroutineBody => {
616+
true
617+
}
616618
_ => tcx.is_closure_like(def_id),
617619
};
618620
match (kind, body.source.promoted) {

compiler/rustc_middle/src/mir/syntax.rs

+3
Original file line numberDiff line numberDiff line change
@@ -1307,6 +1307,9 @@ pub enum Rvalue<'tcx> {
13071307
/// If the type of the place is an array, this is the array length. For slices (`[T]`, not
13081308
/// `&[T]`) this accesses the place's metadata to determine the length. This rvalue is
13091309
/// ill-formed for places of other types.
1310+
///
1311+
/// This cannot be a `UnOp(PtrMetadata, _)` because that expects a value, and we only
1312+
/// have a place, and `UnOp(PtrMetadata, RawPtr(place))` is not a thing.
13101313
Len(Place<'tcx>),
13111314

13121315
/// Performs essentially all of the casts that can be performed via `as`.

compiler/rustc_mir_transform/src/coroutine/by_move_body.rs

+3-2
Original file line numberDiff line numberDiff line change
@@ -207,11 +207,12 @@ pub fn coroutine_by_move_body_def_id<'tcx>(
207207

208208
let mut by_move_body = body.clone();
209209
MakeByMoveBody { tcx, field_remapping, by_move_coroutine_ty }.visit_body(&mut by_move_body);
210-
dump_mir(tcx, false, "coroutine_by_move", &0, &by_move_body, |_, _| Ok(()));
211210

212-
let body_def = tcx.create_def(coroutine_def_id, kw::Empty, DefKind::SyntheticCoroutineBody);
211+
// This will always be `{closure#1}`, since the original coroutine is `{closure#0}`.
212+
let body_def = tcx.create_def(parent_def_id, kw::Empty, DefKind::SyntheticCoroutineBody);
213213
by_move_body.source =
214214
mir::MirSource::from_instance(InstanceKind::Item(body_def.def_id().to_def_id()));
215+
dump_mir(tcx, false, "built", &"after", &by_move_body, |_, _| Ok(()));
215216

216217
// Inherited from the by-ref coroutine.
217218
body_def.codegen_fn_attrs(tcx.codegen_fn_attrs(coroutine_def_id).clone());

compiler/rustc_target/src/spec/mod.rs

+2
Original file line numberDiff line numberDiff line change
@@ -1695,6 +1695,8 @@ supported_targets! {
16951695
("armv7r-none-eabihf", armv7r_none_eabihf),
16961696
("armv8r-none-eabihf", armv8r_none_eabihf),
16971697

1698+
("armv7-rtems-eabihf", armv7_rtems_eabihf),
1699+
16981700
("x86_64-pc-solaris", x86_64_pc_solaris),
16991701
("sparcv9-sun-solaris", sparcv9_sun_solaris),
17001702

Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
use crate::spec::{cvs, Cc, LinkerFlavor, Lld, PanicStrategy, RelocModel, Target, TargetOptions};
2+
3+
pub(crate) fn target() -> Target {
4+
Target {
5+
llvm_target: "armv7-unknown-none-eabihf".into(),
6+
metadata: crate::spec::TargetMetadata {
7+
description: Some("Armv7 RTEMS (Requires RTEMS toolchain and kernel".into()),
8+
tier: Some(3),
9+
host_tools: Some(false),
10+
std: Some(true),
11+
},
12+
pointer_width: 32,
13+
data_layout: "e-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64".into(),
14+
arch: "arm".into(),
15+
16+
options: TargetOptions {
17+
os: "rtems".into(),
18+
families: cvs!["unix"],
19+
abi: "eabihf".into(),
20+
linker_flavor: LinkerFlavor::Gnu(Cc::Yes, Lld::No),
21+
linker: None,
22+
relocation_model: RelocModel::Static,
23+
panic_strategy: PanicStrategy::Abort,
24+
features: "+thumb2,+neon,+vfp3".into(),
25+
max_atomic_width: Some(64),
26+
emit_debug_gdb_scripts: false,
27+
// GCC defaults to 8 for arm-none here.
28+
c_enum_min_bits: Some(8),
29+
eh_frame_header: false,
30+
no_default_libraries: false,
31+
env: "newlib".into(),
32+
..Default::default()
33+
},
34+
}
35+
}

compiler/rustc_type_ir/src/elaborate.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -237,7 +237,7 @@ pub fn supertrait_def_ids<I: Interner>(
237237
cx: I,
238238
trait_def_id: I::DefId,
239239
) -> impl Iterator<Item = I::DefId> {
240-
let mut set: HashSet<I::DefId> = HashSet::default();
240+
let mut set = HashSet::default();
241241
let mut stack = vec![trait_def_id];
242242

243243
set.insert(trait_def_id);

library/core/Cargo.toml

+2
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,8 @@ check-cfg = [
4343
'cfg(bootstrap)',
4444
'cfg(no_fp_fmt_parse)',
4545
'cfg(stdarch_intel_sde)',
46+
# #[cfg(bootstrap)] rtems
47+
'cfg(target_os, values("rtems"))',
4648
# core use #[path] imports to portable-simd `core_simd` crate
4749
# and to stdarch `core_arch` crate which messes-up with Cargo list
4850
# of declared features, we therefor expect any feature cfg

library/core/src/ffi/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ mod c_char_definition {
110110
all(target_os = "android", any(target_arch = "aarch64", target_arch = "arm")),
111111
all(target_os = "l4re", target_arch = "x86_64"),
112112
all(
113-
any(target_os = "freebsd", target_os = "openbsd"),
113+
any(target_os = "freebsd", target_os = "openbsd", target_os = "rtems"),
114114
any(
115115
target_arch = "aarch64",
116116
target_arch = "arm",

library/panic_unwind/Cargo.toml

+7
Original file line numberDiff line numberDiff line change
@@ -20,3 +20,10 @@ cfg-if = { version = "1.0", features = ['rustc-dep-of-std'] }
2020

2121
[target.'cfg(not(all(windows, target_env = "msvc")))'.dependencies]
2222
libc = { version = "0.2", default-features = false }
23+
24+
[lints.rust.unexpected_cfgs]
25+
level = "warn"
26+
check-cfg = [
27+
# #[cfg(bootstrap)] rtems
28+
'cfg(target_os, values("rtems"))',
29+
]

library/panic_unwind/src/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ cfg_if::cfg_if! {
4848
target_os = "psp",
4949
target_os = "xous",
5050
target_os = "solid_asp3",
51-
all(target_family = "unix", not(target_os = "espidf")),
51+
all(target_family = "unix", not(any(target_os = "espidf", target_os = "rtems"))),
5252
all(target_vendor = "fortanix", target_env = "sgx"),
5353
target_family = "wasm",
5454
))] {

library/std/Cargo.toml

+2
Original file line numberDiff line numberDiff line change
@@ -146,4 +146,6 @@ check-cfg = [
146146
# and to the `backtrace` crate which messes-up with Cargo list
147147
# of declared features, we therefor expect any feature cfg
148148
'cfg(feature, values(any()))',
149+
# #[cfg(bootstrap)] rtems
150+
'cfg(target_os, values("rtems"))',
149151
]

library/std/build.rs

+1
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ fn main() {
5353
|| target_os == "uefi"
5454
|| target_os == "teeos"
5555
|| target_os == "zkvm"
56+
|| target_os == "rtems"
5657

5758
// See src/bootstrap/src/core/build_steps/synthetic_targets.rs
5859
|| env::var("RUSTC_BOOTSTRAP_SYNTHETIC_TARGET").is_ok()

library/std/src/os/mod.rs

+2
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,8 @@ pub mod nto;
143143
pub mod openbsd;
144144
#[cfg(target_os = "redox")]
145145
pub mod redox;
146+
#[cfg(target_os = "rtems")]
147+
pub mod rtems;
146148
#[cfg(target_os = "solaris")]
147149
pub mod solaris;
148150
#[cfg(target_os = "solid_asp3")]

0 commit comments

Comments
 (0)