Skip to content

Commit

Permalink
Auto merge of #129946 - GuillaumeGomez:rollup-bovh08y, r=GuillaumeGomez
Browse files Browse the repository at this point in the history
Rollup of 7 pull requests

Successful merges:

 - #127021 (Add target support for RTEMS Arm)
 - #128871 (bypass linker configuration and cross target check for specific commands)
 - #129471 ([rustdoc] Sort impl associated items by kinds and then by appearance)
 - #129529 (Add test to build crates used by r-a on stable)
 - #129706 (Rename dump of coroutine by-move-body to be more consistent, fix ICE in dump_mir)
 - #129796 (Unify scraped examples with other code examples)
 - #129939 (explain why Rvalue::Len still exists)

r? `@ghost`
`@rustbot` modify labels: rollup
  • Loading branch information
bors committed Sep 3, 2024
2 parents d6c8169 + d4b349e commit 2b21f4f
Show file tree
Hide file tree
Showing 68 changed files with 1,272 additions and 252 deletions.
4 changes: 3 additions & 1 deletion compiler/rustc_middle/src/mir/pretty.rs
Original file line number Diff line number Diff line change
Expand Up @@ -612,7 +612,9 @@ fn write_mir_sig(tcx: TyCtxt<'_>, body: &Body<'_>, w: &mut dyn io::Write) -> io:
let def_id = body.source.def_id();
let kind = tcx.def_kind(def_id);
let is_function = match kind {
DefKind::Fn | DefKind::AssocFn | DefKind::Ctor(..) => true,
DefKind::Fn | DefKind::AssocFn | DefKind::Ctor(..) | DefKind::SyntheticCoroutineBody => {
true
}
_ => tcx.is_closure_like(def_id),
};
match (kind, body.source.promoted) {
Expand Down
3 changes: 3 additions & 0 deletions compiler/rustc_middle/src/mir/syntax.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1307,6 +1307,9 @@ pub enum Rvalue<'tcx> {
/// If the type of the place is an array, this is the array length. For slices (`[T]`, not
/// `&[T]`) this accesses the place's metadata to determine the length. This rvalue is
/// ill-formed for places of other types.
///
/// This cannot be a `UnOp(PtrMetadata, _)` because that expects a value, and we only
/// have a place, and `UnOp(PtrMetadata, RawPtr(place))` is not a thing.
Len(Place<'tcx>),

/// Performs essentially all of the casts that can be performed via `as`.
Expand Down
5 changes: 3 additions & 2 deletions compiler/rustc_mir_transform/src/coroutine/by_move_body.rs
Original file line number Diff line number Diff line change
Expand Up @@ -207,11 +207,12 @@ pub fn coroutine_by_move_body_def_id<'tcx>(

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

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

// Inherited from the by-ref coroutine.
body_def.codegen_fn_attrs(tcx.codegen_fn_attrs(coroutine_def_id).clone());
Expand Down
2 changes: 2 additions & 0 deletions compiler/rustc_target/src/spec/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1695,6 +1695,8 @@ supported_targets! {
("armv7r-none-eabihf", armv7r_none_eabihf),
("armv8r-none-eabihf", armv8r_none_eabihf),

("armv7-rtems-eabihf", armv7_rtems_eabihf),

("x86_64-pc-solaris", x86_64_pc_solaris),
("sparcv9-sun-solaris", sparcv9_sun_solaris),

Expand Down
35 changes: 35 additions & 0 deletions compiler/rustc_target/src/spec/targets/armv7_rtems_eabihf.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
use crate::spec::{cvs, Cc, LinkerFlavor, Lld, PanicStrategy, RelocModel, Target, TargetOptions};

pub(crate) fn target() -> Target {
Target {
llvm_target: "armv7-unknown-none-eabihf".into(),
metadata: crate::spec::TargetMetadata {
description: Some("Armv7 RTEMS (Requires RTEMS toolchain and kernel".into()),
tier: Some(3),
host_tools: Some(false),
std: Some(true),
},
pointer_width: 32,
data_layout: "e-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64".into(),
arch: "arm".into(),

options: TargetOptions {
os: "rtems".into(),
families: cvs!["unix"],
abi: "eabihf".into(),
linker_flavor: LinkerFlavor::Gnu(Cc::Yes, Lld::No),
linker: None,
relocation_model: RelocModel::Static,
panic_strategy: PanicStrategy::Abort,
features: "+thumb2,+neon,+vfp3".into(),
max_atomic_width: Some(64),
emit_debug_gdb_scripts: false,
// GCC defaults to 8 for arm-none here.
c_enum_min_bits: Some(8),
eh_frame_header: false,
no_default_libraries: false,
env: "newlib".into(),
..Default::default()
},
}
}
2 changes: 1 addition & 1 deletion compiler/rustc_type_ir/src/elaborate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@ pub fn supertrait_def_ids<I: Interner>(
cx: I,
trait_def_id: I::DefId,
) -> impl Iterator<Item = I::DefId> {
let mut set: HashSet<I::DefId> = HashSet::default();
let mut set = HashSet::default();
let mut stack = vec![trait_def_id];

set.insert(trait_def_id);
Expand Down
2 changes: 2 additions & 0 deletions library/core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@ check-cfg = [
'cfg(bootstrap)',
'cfg(no_fp_fmt_parse)',
'cfg(stdarch_intel_sde)',
# #[cfg(bootstrap)] rtems
'cfg(target_os, values("rtems"))',
# core use #[path] imports to portable-simd `core_simd` crate
# and to stdarch `core_arch` crate which messes-up with Cargo list
# of declared features, we therefor expect any feature cfg
Expand Down
2 changes: 1 addition & 1 deletion library/core/src/ffi/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ mod c_char_definition {
all(target_os = "android", any(target_arch = "aarch64", target_arch = "arm")),
all(target_os = "l4re", target_arch = "x86_64"),
all(
any(target_os = "freebsd", target_os = "openbsd"),
any(target_os = "freebsd", target_os = "openbsd", target_os = "rtems"),
any(
target_arch = "aarch64",
target_arch = "arm",
Expand Down
7 changes: 7 additions & 0 deletions library/panic_unwind/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,10 @@ cfg-if = { version = "1.0", features = ['rustc-dep-of-std'] }

[target.'cfg(not(all(windows, target_env = "msvc")))'.dependencies]
libc = { version = "0.2", default-features = false }

[lints.rust.unexpected_cfgs]
level = "warn"
check-cfg = [
# #[cfg(bootstrap)] rtems
'cfg(target_os, values("rtems"))',
]
2 changes: 1 addition & 1 deletion library/panic_unwind/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ cfg_if::cfg_if! {
target_os = "psp",
target_os = "xous",
target_os = "solid_asp3",
all(target_family = "unix", not(target_os = "espidf")),
all(target_family = "unix", not(any(target_os = "espidf", target_os = "rtems"))),
all(target_vendor = "fortanix", target_env = "sgx"),
target_family = "wasm",
))] {
Expand Down
2 changes: 2 additions & 0 deletions library/std/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -146,4 +146,6 @@ check-cfg = [
# and to the `backtrace` crate which messes-up with Cargo list
# of declared features, we therefor expect any feature cfg
'cfg(feature, values(any()))',
# #[cfg(bootstrap)] rtems
'cfg(target_os, values("rtems"))',
]
1 change: 1 addition & 0 deletions library/std/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ fn main() {
|| target_os == "uefi"
|| target_os == "teeos"
|| target_os == "zkvm"
|| target_os == "rtems"

// See src/bootstrap/src/core/build_steps/synthetic_targets.rs
|| env::var("RUSTC_BOOTSTRAP_SYNTHETIC_TARGET").is_ok()
Expand Down
2 changes: 2 additions & 0 deletions library/std/src/os/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,8 @@ pub mod nto;
pub mod openbsd;
#[cfg(target_os = "redox")]
pub mod redox;
#[cfg(target_os = "rtems")]
pub mod rtems;
#[cfg(target_os = "solaris")]
pub mod solaris;
#[cfg(target_os = "solid_asp3")]
Expand Down
Loading

0 comments on commit 2b21f4f

Please sign in to comment.