Skip to content

Commit 6e48b44

Browse files
committed
Auto merge of rust-lang#150559 - JonathanBrouwer:rollup-59hbbmm, r=JonathanBrouwer
Rollup of 4 pull requests Successful merges: - rust-lang#149778 (`crate::io::Result` → `io::Result` in most places) - rust-lang#150264 (split up tracking issue for target feature feature gates) - rust-lang#150548 (`region_scope_tree`: Rewrite a `loop` as tail recursion) - rust-lang#150555 (Enable thumb interworking on ARMv7A/R and ARMv8R bare-metal targets) r? `@ghost` `@rustbot` modify labels: rollup
2 parents 4c62aa4 + 767e7da commit 6e48b44

File tree

33 files changed

+315
-324
lines changed

33 files changed

+315
-324
lines changed

compiler/rustc_feature/src/unstable.rs

Lines changed: 44 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -319,47 +319,14 @@ declare_features! (
319319
// feature-group-end: internal feature gates
320320
// -------------------------------------------------------------------------
321321

322-
// -------------------------------------------------------------------------
323-
// feature-group-start: actual feature gates (target features)
324-
// -------------------------------------------------------------------------
325-
326-
// FIXME: Document these and merge with the list below.
327-
328-
// Unstable `#[target_feature]` directives.
329-
(unstable, aarch64_unstable_target_feature, "1.82.0", Some(44839)),
330-
(unstable, aarch64_ver_target_feature, "1.27.0", Some(44839)),
331-
(unstable, apx_target_feature, "1.88.0", Some(139284)),
332-
(unstable, arm_target_feature, "1.27.0", Some(44839)),
333-
(unstable, bpf_target_feature, "1.54.0", Some(44839)),
334-
(unstable, csky_target_feature, "1.73.0", Some(44839)),
335-
(unstable, ermsb_target_feature, "1.49.0", Some(44839)),
336-
(unstable, hexagon_target_feature, "1.27.0", Some(44839)),
337-
(unstable, lahfsahf_target_feature, "1.78.0", Some(44839)),
338-
(unstable, loongarch_target_feature, "1.73.0", Some(44839)),
339-
(unstable, m68k_target_feature, "1.85.0", Some(134328)),
340-
(unstable, mips_target_feature, "1.27.0", Some(44839)),
341-
(unstable, movrs_target_feature, "1.88.0", Some(137976)),
342-
(unstable, nvptx_target_feature, "1.91.0", Some(44839)),
343-
(unstable, powerpc_target_feature, "1.27.0", Some(44839)),
344-
(unstable, prfchw_target_feature, "1.78.0", Some(44839)),
345-
(unstable, riscv_target_feature, "1.45.0", Some(44839)),
346-
(unstable, rtm_target_feature, "1.35.0", Some(44839)),
347-
(unstable, s390x_target_feature, "1.82.0", Some(44839)),
348-
(unstable, sparc_target_feature, "1.84.0", Some(132783)),
349-
(unstable, wasm_target_feature, "1.30.0", Some(44839)),
350-
(unstable, x87_target_feature, "1.85.0", Some(44839)),
351-
// !!!! !!!! !!!! !!!! !!!! !!!! !!!! !!!! !!!! !!!! !!!!
352-
// Features are listed in alphabetical order. Tidy will fail if you don't keep it this way.
353-
// !!!! !!!! !!!! !!!! !!!! !!!! !!!! !!!! !!!! !!!! !!!!
354-
355-
// -------------------------------------------------------------------------
356-
// feature-group-end: actual feature gates (target features)
357-
// -------------------------------------------------------------------------
358-
359322
// -------------------------------------------------------------------------
360323
// feature-group-start: actual feature gates
361324
// -------------------------------------------------------------------------
362325

326+
/// The remaining unstable target features on aarch64.
327+
(unstable, aarch64_unstable_target_feature, "1.82.0", Some(150244)),
328+
/// Instruction set "version" target features on aarch64.
329+
(unstable, aarch64_ver_target_feature, "1.27.0", Some(150245)),
363330
/// Allows `extern "avr-interrupt" fn()` and `extern "avr-non-blocking-interrupt" fn()`.
364331
(unstable, abi_avr_interrupt, "1.45.0", Some(69664)),
365332
/// Allows `extern "cmse-nonsecure-call" fn()`.
@@ -380,10 +347,14 @@ declare_features! (
380347
(unstable, adt_const_params, "1.56.0", Some(95174)),
381348
/// Allows defining an `#[alloc_error_handler]`.
382349
(unstable, alloc_error_handler, "1.29.0", Some(51540)),
350+
/// The `apxf` target feature on x86
351+
(unstable, apx_target_feature, "1.88.0", Some(139284)),
383352
/// Allows inherent and trait methods with arbitrary self types.
384353
(unstable, arbitrary_self_types, "1.23.0", Some(44874)),
385354
/// Allows inherent and trait methods with arbitrary self types that are raw pointers.
386355
(unstable, arbitrary_self_types_pointers, "1.83.0", Some(44874)),
356+
/// Target features on arm.
357+
(unstable, arm_target_feature, "1.27.0", Some(150246)),
387358
/// Enables experimental inline assembly support for additional architectures.
388359
(unstable, asm_experimental_arch, "1.58.0", Some(93335)),
389360
/// Enables experimental register support in inline assembly.
@@ -408,6 +379,8 @@ declare_features! (
408379
(unstable, async_trait_bounds, "1.85.0", Some(62290)),
409380
/// Allows using Intel AVX10 target features and intrinsics
410381
(unstable, avx10_target_feature, "1.88.0", Some(138843)),
382+
/// Target features on bpf.
383+
(unstable, bpf_target_feature, "1.54.0", Some(150247)),
411384
/// Allows using C-variadics.
412385
(unstable, c_variadic, "1.34.0", Some(44930)),
413386
/// Allows defining c-variadic naked functions with any extern ABI that is allowed
@@ -468,6 +441,8 @@ declare_features! (
468441
/// Allows function attribute `#[coverage(on/off)]`, to control coverage
469442
/// instrumentation of that function.
470443
(unstable, coverage_attribute, "1.74.0", Some(84605)),
444+
/// Target features on csky.
445+
(unstable, csky_target_feature, "1.73.0", Some(150248)),
471446
/// Allows non-builtin attributes in inner attribute position.
472447
(unstable, custom_inner_attributes, "1.30.0", Some(54726)),
473448
/// Allows custom test frameworks with `#![test_runner]` and `#[test_case]`.
@@ -495,6 +470,8 @@ declare_features! (
495470
(incomplete, effective_target_features, "1.91.0", Some(143352)),
496471
/// Allows the .use postfix syntax `x.use` and use closures `use |x| { ... }`
497472
(incomplete, ergonomic_clones, "1.87.0", Some(132290)),
473+
/// ermsb target feature on x86.
474+
(unstable, ermsb_target_feature, "1.49.0", Some(150249)),
498475
/// Allows exhaustive pattern matching on types that contain uninhabited types.
499476
(unstable, exhaustive_patterns, "1.13.0", Some(51085)),
500477
/// Disallows `extern` without an explicit ABI.
@@ -541,6 +518,8 @@ declare_features! (
541518
(incomplete, guard_patterns, "1.85.0", Some(129967)),
542519
/// Allows using `..=X` as a patterns in slices.
543520
(unstable, half_open_range_patterns_in_slices, "1.66.0", Some(67264)),
521+
/// Target features on hexagon.
522+
(unstable, hexagon_target_feature, "1.27.0", Some(150250)),
544523
/// Allows `if let` guard in match arms.
545524
(unstable, if_let_guard, "1.47.0", Some(51114)),
546525
/// Allows `impl Trait` to be used inside associated types (RFC 2515).
@@ -555,15 +534,21 @@ declare_features! (
555534
(incomplete, inherent_associated_types, "1.52.0", Some(8995)),
556535
/// Allows using `pointer` and `reference` in intra-doc links
557536
(unstable, intra_doc_pointers, "1.51.0", Some(80896)),
537+
/// lahfsahf target feature on x86.
538+
(unstable, lahfsahf_target_feature, "1.78.0", Some(150251)),
558539
/// Allows setting the threshold for the `large_assignments` lint.
559540
(unstable, large_assignments, "1.52.0", Some(83518)),
560541
/// Allow to have type alias types for inter-crate use.
561542
(incomplete, lazy_type_alias, "1.72.0", Some(112792)),
562543
/// Allows using `#[link(kind = "link-arg", name = "...")]`
563544
/// to pass custom arguments to the linker.
564545
(unstable, link_arg_attribute, "1.76.0", Some(99427)),
546+
/// Target features on loongarch.
547+
(unstable, loongarch_target_feature, "1.73.0", Some(150252)),
565548
/// Allows fused `loop`/`match` for direct intraprocedural jumps.
566549
(incomplete, loop_match, "1.90.0", Some(132306)),
550+
/// Target features on m68k.
551+
(unstable, m68k_target_feature, "1.85.0", Some(134328)),
567552
/// Allow `macro_rules!` attribute rules
568553
(unstable, macro_attr, "1.91.0", Some(143547)),
569554
/// Allow `macro_rules!` derive rules
@@ -580,8 +565,12 @@ declare_features! (
580565
/// standard library until the soundness issues with specialization
581566
/// are fixed.
582567
(unstable, min_specialization, "1.7.0", Some(31844)),
568+
/// Target features on mips.
569+
(unstable, mips_target_feature, "1.27.0", Some(150253)),
583570
/// Allows qualified paths in struct expressions, struct patterns and tuple struct patterns.
584571
(unstable, more_qualified_paths, "1.54.0", Some(86935)),
572+
/// The `movrs` target feature on x86.
573+
(unstable, movrs_target_feature, "1.88.0", Some(137976)),
585574
/// Allows the `#[must_not_suspend]` attribute.
586575
(unstable, must_not_suspend, "1.57.0", Some(83310)),
587576
/// Allows `mut ref` and `mut ref mut` identifier patterns.
@@ -606,6 +595,8 @@ declare_features! (
606595
(unstable, non_exhaustive_omitted_patterns_lint, "1.57.0", Some(89554)),
607596
/// Allows `for<T>` binders in where-clauses
608597
(incomplete, non_lifetime_binders, "1.69.0", Some(108185)),
598+
/// Target feaures on nvptx.
599+
(unstable, nvptx_target_feature, "1.91.0", Some(150254)),
609600
/// Allows using enums in offset_of!
610601
(unstable, offset_of_enum, "1.75.0", Some(120141)),
611602
/// Allows using fields with slice type in offset_of!
@@ -618,6 +609,10 @@ declare_features! (
618609
(incomplete, pin_ergonomics, "1.83.0", Some(130494)),
619610
/// Allows postfix match `expr.match { ... }`
620611
(unstable, postfix_match, "1.79.0", Some(121618)),
612+
/// Target features on powerpc.
613+
(unstable, powerpc_target_feature, "1.27.0", Some(150255)),
614+
/// The prfchw target feature on x86.
615+
(unstable, prfchw_target_feature, "1.78.0", Some(150256)),
621616
/// Allows macro attributes on expressions, statements and non-inline modules.
622617
(unstable, proc_macro_hygiene, "1.30.0", Some(54727)),
623618
/// Allows the use of raw-dylibs on ELF platforms
@@ -633,12 +628,20 @@ declare_features! (
633628
(unstable, repr_simd, "1.4.0", Some(27731)),
634629
/// Allows bounding the return type of AFIT/RPITIT.
635630
(unstable, return_type_notation, "1.70.0", Some(109417)),
631+
/// Target features on riscv.
632+
(unstable, riscv_target_feature, "1.45.0", Some(150257)),
633+
/// The rtm target feature on x86.
634+
(unstable, rtm_target_feature, "1.35.0", Some(150258)),
636635
/// Allows `extern "rust-cold"`.
637636
(unstable, rust_cold_cc, "1.63.0", Some(97544)),
637+
/// Target features on s390x.
638+
(unstable, s390x_target_feature, "1.82.0", Some(150259)),
638639
/// Allows the use of the `sanitize` attribute.
639640
(unstable, sanitize, "1.91.0", Some(39699)),
640641
/// Allows the use of SIMD types in functions declared in `extern` blocks.
641642
(unstable, simd_ffi, "1.0.0", Some(27731)),
643+
/// Target features on sparc.
644+
(unstable, sparc_target_feature, "1.84.0", Some(132783)),
642645
/// Allows specialization of implementations (RFC 1210).
643646
(incomplete, specialization, "1.7.0", Some(31844)),
644647
/// Allows using `#[rustc_align_static(...)]` on static items.
@@ -683,10 +686,14 @@ declare_features! (
683686
(internal, unsized_fn_params, "1.49.0", Some(48055)),
684687
/// Allows using the `#[used(linker)]` (or `#[used(compiler)]`) attribute.
685688
(unstable, used_with_arg, "1.60.0", Some(93798)),
689+
/// Target features on wasm.
690+
(unstable, wasm_target_feature, "1.30.0", Some(150260)),
686691
/// Allows use of attributes in `where` clauses.
687692
(unstable, where_clause_attrs, "1.87.0", Some(115590)),
688693
/// Allows use of x86 `AMX` target-feature attributes and intrinsics
689694
(unstable, x86_amx_intrinsics, "1.81.0", Some(126622)),
695+
/// The x87 target feature on x86.
696+
(unstable, x87_target_feature, "1.85.0", Some(150261)),
690697
/// Allows use of the `xop` target-feature
691698
(unstable, xop_target_feature, "1.81.0", Some(127208)),
692699
/// Allows `do yeet` expressions

compiler/rustc_hir_analysis/src/check/region.rs

Lines changed: 14 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -701,31 +701,25 @@ fn resolve_local<'tcx>(
701701
/// Note: ET is intended to match "rvalues or places based on rvalues".
702702
fn record_subexpr_extended_temp_scopes(
703703
scope_tree: &mut ScopeTree,
704-
mut expr: &hir::Expr<'_>,
704+
expr: &hir::Expr<'_>,
705705
lifetime: Option<Scope>,
706706
) {
707-
debug!(?expr, ?lifetime);
707+
// Note: give all the expressions matching `ET` with the
708+
// extended temporary lifetime, not just the innermost rvalue,
709+
// because in MIR building if we must compile e.g., `*rvalue()`
710+
// into a temporary, we request the temporary scope of the
711+
// outer expression.
708712

709-
loop {
710-
// Note: give all the expressions matching `ET` with the
711-
// extended temporary lifetime, not just the innermost rvalue,
712-
// because in MIR building if we must compile e.g., `*rvalue()`
713-
// into a temporary, we request the temporary scope of the
714-
// outer expression.
713+
scope_tree.record_extended_temp_scope(expr.hir_id.local_id, lifetime);
715714

716-
scope_tree.record_extended_temp_scope(expr.hir_id.local_id, lifetime);
717-
718-
match expr.kind {
719-
hir::ExprKind::AddrOf(_, _, subexpr)
720-
| hir::ExprKind::Unary(hir::UnOp::Deref, subexpr)
721-
| hir::ExprKind::Field(subexpr, _)
722-
| hir::ExprKind::Index(subexpr, _, _) => {
723-
expr = subexpr;
724-
}
725-
_ => {
726-
return;
727-
}
715+
match expr.kind {
716+
hir::ExprKind::AddrOf(_, _, subexpr)
717+
| hir::ExprKind::Unary(hir::UnOp::Deref, subexpr)
718+
| hir::ExprKind::Field(subexpr, _)
719+
| hir::ExprKind::Index(subexpr, _, _) => {
720+
record_subexpr_extended_temp_scopes(scope_tree, subexpr, lifetime);
728721
}
722+
_ => {}
729723
}
730724
}
731725

compiler/rustc_target/src/spec/targets/armebv7r_none_eabi.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ pub(crate) fn target() -> Target {
3131
emit_debug_gdb_scripts: false,
3232
// GCC defaults to 8 for arm-none here.
3333
c_enum_min_bits: Some(8),
34+
has_thumb_interworking: true,
3435
..Default::default()
3536
},
3637
}

compiler/rustc_target/src/spec/targets/armebv7r_none_eabihf.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ pub(crate) fn target() -> Target {
3232
emit_debug_gdb_scripts: false,
3333
// GCC defaults to 8 for arm-none here.
3434
c_enum_min_bits: Some(8),
35+
has_thumb_interworking: true,
3536
..Default::default()
3637
},
3738
}

compiler/rustc_target/src/spec/targets/armv7a_none_eabi.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ pub(crate) fn target() -> Target {
3232
panic_strategy: PanicStrategy::Abort,
3333
emit_debug_gdb_scripts: false,
3434
c_enum_min_bits: Some(8),
35+
has_thumb_interworking: true,
3536
..Default::default()
3637
};
3738
Target {

compiler/rustc_target/src/spec/targets/armv7a_none_eabihf.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ pub(crate) fn target() -> Target {
2424
emit_debug_gdb_scripts: false,
2525
// GCC defaults to 8 for arm-none here.
2626
c_enum_min_bits: Some(8),
27+
has_thumb_interworking: true,
2728
..Default::default()
2829
};
2930
Target {

compiler/rustc_target/src/spec/targets/armv7r_none_eabi.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ pub(crate) fn target() -> Target {
2929
emit_debug_gdb_scripts: false,
3030
// GCC defaults to 8 for arm-none here.
3131
c_enum_min_bits: Some(8),
32+
has_thumb_interworking: true,
3233
..Default::default()
3334
},
3435
}

compiler/rustc_target/src/spec/targets/armv7r_none_eabihf.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ pub(crate) fn target() -> Target {
3030
emit_debug_gdb_scripts: false,
3131
// GCC defaults to 8 for arm-none here.
3232
c_enum_min_bits: Some(8),
33+
has_thumb_interworking: true,
3334
..Default::default()
3435
},
3536
}

compiler/rustc_target/src/spec/targets/armv8r_none_eabihf.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ pub(crate) fn target() -> Target {
3939
emit_debug_gdb_scripts: false,
4040
// GCC defaults to 8 for arm-none here.
4141
c_enum_min_bits: Some(8),
42+
has_thumb_interworking: true,
4243
..Default::default()
4344
},
4445
}

library/std/src/os/fd/owned.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ impl OwnedFd {
9191
/// Creates a new `OwnedFd` instance that shares the same underlying file
9292
/// description as the existing `OwnedFd` instance.
9393
#[stable(feature = "io_safety", since = "1.63.0")]
94-
pub fn try_clone(&self) -> crate::io::Result<Self> {
94+
pub fn try_clone(&self) -> io::Result<Self> {
9595
self.as_fd().try_clone_to_owned()
9696
}
9797
}
@@ -106,7 +106,7 @@ impl BorrowedFd<'_> {
106106
target_os = "motor"
107107
)))]
108108
#[stable(feature = "io_safety", since = "1.63.0")]
109-
pub fn try_clone_to_owned(&self) -> crate::io::Result<OwnedFd> {
109+
pub fn try_clone_to_owned(&self) -> io::Result<OwnedFd> {
110110
// We want to atomically duplicate this file descriptor and set the
111111
// CLOEXEC flag, and currently that's done via F_DUPFD_CLOEXEC. This
112112
// is a POSIX flag that was added to Linux in 2.6.24.
@@ -129,15 +129,15 @@ impl BorrowedFd<'_> {
129129
/// description as the existing `BorrowedFd` instance.
130130
#[cfg(any(target_arch = "wasm32", target_os = "hermit", target_os = "trusty"))]
131131
#[stable(feature = "io_safety", since = "1.63.0")]
132-
pub fn try_clone_to_owned(&self) -> crate::io::Result<OwnedFd> {
133-
Err(crate::io::Error::UNSUPPORTED_PLATFORM)
132+
pub fn try_clone_to_owned(&self) -> io::Result<OwnedFd> {
133+
Err(io::Error::UNSUPPORTED_PLATFORM)
134134
}
135135

136136
/// Creates a new `OwnedFd` instance that shares the same underlying file
137137
/// description as the existing `BorrowedFd` instance.
138138
#[cfg(target_os = "motor")]
139139
#[stable(feature = "io_safety", since = "1.63.0")]
140-
pub fn try_clone_to_owned(&self) -> crate::io::Result<OwnedFd> {
140+
pub fn try_clone_to_owned(&self) -> io::Result<OwnedFd> {
141141
let fd = moto_rt::fs::duplicate(self.as_raw_fd()).map_err(crate::sys::map_motor_error)?;
142142
Ok(unsafe { OwnedFd::from_raw_fd(fd) })
143143
}
@@ -233,7 +233,7 @@ macro_rules! impl_is_terminal {
233233
impl crate::sealed::Sealed for $t {}
234234

235235
#[stable(feature = "is_terminal", since = "1.70.0")]
236-
impl crate::io::IsTerminal for $t {
236+
impl io::IsTerminal for $t {
237237
#[inline]
238238
fn is_terminal(&self) -> bool {
239239
crate::sys::io::is_terminal(self)

0 commit comments

Comments
 (0)