| author | bors <bors@rust-lang.org> 2025-09-22 11:15:49 UTC |
| committer | bors <bors@rust-lang.org> 2025-09-22 11:15:49 UTC |
| log | 29005cb128e6d447e6bd9c110c9a684665f95985 |
| tree | a25020539ef1a6939c6298a4f77126720d2168d9 |
| parent | 9f32ccf35fb877270bc44a86a126440f04d676d0 |
| parent | 8f80707bc5fa74992bdc2dc201a6461860769f28 |
Rollup of 9 pull requests
Successful merges:
- rust-lang/rust#145411 (regression test for Cow<[u8]> layout)
- rust-lang/rust#146397 (std_detect on Darwin AArch64: update features)
- rust-lang/rust#146791 (emit attribute for readonly non-pure inline assembly)
- rust-lang/rust#146831 (Support ctr and lr as clobber-only registers in PowerPC inline assembly)
- rust-lang/rust#146838 (Introduce "wrapper" helpers to rustdoc)
- rust-lang/rust#146845 (Add self-profile events for target-machine creation)
- rust-lang/rust#146846 (btree InternalNode::new safety comments)
- rust-lang/rust#146858 (Make mips64el-unknown-linux-muslabi64 link dynamically)
- rust-lang/rust#146878 (assert_unsafe_precondition: fix some incorrect check_language_ub)
r? `@ghost`
`@rustbot` modify labels: rollup30 files changed, 948 insertions(+), 462 deletions(-)
compiler/rustc_codegen_gcc/src/asm.rs+12-4| ... | ... | @@ -698,8 +698,12 @@ fn reg_class_to_gcc(reg_class: InlineAsmRegClass) -> &'static str { |
| 698 | 698 | InlineAsmRegClass::PowerPC(PowerPCInlineAsmRegClass::reg_nonzero) => "b", |
| 699 | 699 | InlineAsmRegClass::PowerPC(PowerPCInlineAsmRegClass::freg) => "f", |
| 700 | 700 | InlineAsmRegClass::PowerPC(PowerPCInlineAsmRegClass::vreg) => "v", |
| 701 | InlineAsmRegClass::PowerPC(PowerPCInlineAsmRegClass::cr) | |
| 702 | | InlineAsmRegClass::PowerPC(PowerPCInlineAsmRegClass::xer) => { | |
| 701 | InlineAsmRegClass::PowerPC( | |
| 702 | PowerPCInlineAsmRegClass::cr | |
| 703 | | PowerPCInlineAsmRegClass::ctr | |
| 704 | | PowerPCInlineAsmRegClass::lr | |
| 705 | | PowerPCInlineAsmRegClass::xer, | |
| 706 | ) => { | |
| 703 | 707 | unreachable!("clobber-only") |
| 704 | 708 | } |
| 705 | 709 | InlineAsmRegClass::RiscV(RiscVInlineAsmRegClass::reg) => "r", |
| ... | ... | @@ -777,8 +781,12 @@ fn dummy_output_type<'gcc, 'tcx>(cx: &CodegenCx<'gcc, 'tcx>, reg: InlineAsmRegCl |
| 777 | 781 | InlineAsmRegClass::PowerPC(PowerPCInlineAsmRegClass::vreg) => { |
| 778 | 782 | cx.type_vector(cx.type_i32(), 4) |
| 779 | 783 | } |
| 780 | InlineAsmRegClass::PowerPC(PowerPCInlineAsmRegClass::cr) | |
| 781 | | InlineAsmRegClass::PowerPC(PowerPCInlineAsmRegClass::xer) => { | |
| 784 | InlineAsmRegClass::PowerPC( | |
| 785 | PowerPCInlineAsmRegClass::cr | |
| 786 | | PowerPCInlineAsmRegClass::ctr | |
| 787 | | PowerPCInlineAsmRegClass::lr | |
| 788 | | PowerPCInlineAsmRegClass::xer, | |
| 789 | ) => { | |
| 782 | 790 | unreachable!("clobber-only") |
| 783 | 791 | } |
| 784 | 792 | InlineAsmRegClass::RiscV(RiscVInlineAsmRegClass::reg) => cx.type_i32(), |
compiler/rustc_codegen_llvm/src/asm.rs+14-4| ... | ... | @@ -340,8 +340,8 @@ impl<'ll, 'tcx> AsmBuilderMethods<'tcx> for Builder<'_, 'll, 'tcx> { |
| 340 | 340 | attrs.push(llvm::AttributeKind::WillReturn.create_attr(self.cx.llcx)); |
| 341 | 341 | } else if options.contains(InlineAsmOptions::NOMEM) { |
| 342 | 342 | attrs.push(llvm::MemoryEffects::InaccessibleMemOnly.create_attr(self.cx.llcx)); |
| 343 | } else { | |
| 344 | // LLVM doesn't have an attribute to represent ReadOnly + SideEffect | |
| 343 | } else if options.contains(InlineAsmOptions::READONLY) { | |
| 344 | attrs.push(llvm::MemoryEffects::ReadOnlyNotPure.create_attr(self.cx.llcx)); | |
| 345 | 345 | } |
| 346 | 346 | attributes::apply_to_callsite(result, llvm::AttributePlace::Function, &{ attrs }); |
| 347 | 347 | |
| ... | ... | @@ -662,7 +662,12 @@ fn reg_to_llvm(reg: InlineAsmRegOrRegClass, layout: Option<&TyAndLayout<'_>>) -> |
| 662 | 662 | PowerPC(PowerPCInlineAsmRegClass::reg_nonzero) => "b", |
| 663 | 663 | PowerPC(PowerPCInlineAsmRegClass::freg) => "f", |
| 664 | 664 | PowerPC(PowerPCInlineAsmRegClass::vreg) => "v", |
| 665 | PowerPC(PowerPCInlineAsmRegClass::cr) | PowerPC(PowerPCInlineAsmRegClass::xer) => { | |
| 665 | PowerPC( | |
| 666 | PowerPCInlineAsmRegClass::cr | |
| 667 | | PowerPCInlineAsmRegClass::ctr | |
| 668 | | PowerPCInlineAsmRegClass::lr | |
| 669 | | PowerPCInlineAsmRegClass::xer, | |
| 670 | ) => { | |
| 666 | 671 | unreachable!("clobber-only") |
| 667 | 672 | } |
| 668 | 673 | RiscV(RiscVInlineAsmRegClass::reg) => "r", |
| ... | ... | @@ -830,7 +835,12 @@ fn dummy_output_type<'ll>(cx: &CodegenCx<'ll, '_>, reg: InlineAsmRegClass) -> &' |
| 830 | 835 | PowerPC(PowerPCInlineAsmRegClass::reg_nonzero) => cx.type_i32(), |
| 831 | 836 | PowerPC(PowerPCInlineAsmRegClass::freg) => cx.type_f64(), |
| 832 | 837 | PowerPC(PowerPCInlineAsmRegClass::vreg) => cx.type_vector(cx.type_i32(), 4), |
| 833 | PowerPC(PowerPCInlineAsmRegClass::cr) | PowerPC(PowerPCInlineAsmRegClass::xer) => { | |
| 838 | PowerPC( | |
| 839 | PowerPCInlineAsmRegClass::cr | |
| 840 | | PowerPCInlineAsmRegClass::ctr | |
| 841 | | PowerPCInlineAsmRegClass::lr | |
| 842 | | PowerPCInlineAsmRegClass::xer, | |
| 843 | ) => { | |
| 834 | 844 | unreachable!("clobber-only") |
| 835 | 845 | } |
| 836 | 846 | RiscV(RiscVInlineAsmRegClass::reg) => cx.type_i32(), |
compiler/rustc_codegen_llvm/src/back/write.rs+10| ... | ... | @@ -204,6 +204,9 @@ pub(crate) fn target_machine_factory( |
| 204 | 204 | optlvl: config::OptLevel, |
| 205 | 205 | target_features: &[String], |
| 206 | 206 | ) -> TargetMachineFactoryFn<LlvmCodegenBackend> { |
| 207 | // Self-profile timer for creating a _factory_. | |
| 208 | let _prof_timer = sess.prof.generic_activity("target_machine_factory"); | |
| 209 | ||
| 207 | 210 | let reloc_model = to_llvm_relocation_model(sess.relocation_model()); |
| 208 | 211 | |
| 209 | 212 | let (opt_level, _) = to_llvm_opt_settings(optlvl); |
| ... | ... | @@ -259,6 +262,9 @@ pub(crate) fn target_machine_factory( |
| 259 | 262 | .into_string() |
| 260 | 263 | .unwrap_or_default(); |
| 261 | 264 | let command_line_args = quote_command_line_args(&sess.expanded_args); |
| 265 | // Self-profile counter for the number of bytes produced by command-line quoting. | |
| 266 | // Values are summed, so the summary result is cumulative across all TM factories. | |
| 267 | sess.prof.artifact_size("quoted_command_line_args", "-", command_line_args.len() as u64); | |
| 262 | 268 | |
| 263 | 269 | let debuginfo_compression = sess.opts.debuginfo_compression.to_string(); |
| 264 | 270 | match sess.opts.debuginfo_compression { |
| ... | ... | @@ -281,7 +287,11 @@ pub(crate) fn target_machine_factory( |
| 281 | 287 | |
| 282 | 288 | let use_wasm_eh = wants_wasm_eh(sess); |
| 283 | 289 | |
| 290 | let prof = SelfProfilerRef::clone(&sess.prof); | |
| 284 | 291 | Arc::new(move |config: TargetMachineFactoryConfig| { |
| 292 | // Self-profile timer for invoking a factory to create a target machine. | |
| 293 | let _prof_timer = prof.generic_activity("target_machine_factory_inner"); | |
| 294 | ||
| 285 | 295 | let path_to_cstring_helper = |path: Option<PathBuf>| -> CString { |
| 286 | 296 | let path = path.unwrap_or_default(); |
| 287 | 297 | let path = path_mapping |
compiler/rustc_codegen_llvm/src/llvm/ffi.rs+1| ... | ... | @@ -710,6 +710,7 @@ pub(crate) enum MemoryEffects { |
| 710 | 710 | None, |
| 711 | 711 | ReadOnly, |
| 712 | 712 | InaccessibleMemOnly, |
| 713 | ReadOnlyNotPure, | |
| 713 | 714 | } |
| 714 | 715 | |
| 715 | 716 | /// LLVMOpcode |
compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp+5| ... | ... | @@ -553,6 +553,7 @@ enum class LLVMRustMemoryEffects { |
| 553 | 553 | None, |
| 554 | 554 | ReadOnly, |
| 555 | 555 | InaccessibleMemOnly, |
| 556 | ReadOnlyNotPure, | |
| 556 | 557 | }; |
| 557 | 558 | |
| 558 | 559 | extern "C" LLVMAttributeRef |
| ... | ... | @@ -568,6 +569,10 @@ LLVMRustCreateMemoryEffectsAttr(LLVMContextRef C, |
| 568 | 569 | case LLVMRustMemoryEffects::InaccessibleMemOnly: |
| 569 | 570 | return wrap(Attribute::getWithMemoryEffects( |
| 570 | 571 | *unwrap(C), MemoryEffects::inaccessibleMemOnly())); |
| 572 | case LLVMRustMemoryEffects::ReadOnlyNotPure: | |
| 573 | return wrap(Attribute::getWithMemoryEffects( | |
| 574 | *unwrap(C), | |
| 575 | MemoryEffects::readOnly() | MemoryEffects::inaccessibleMemOnly())); | |
| 571 | 576 | default: |
| 572 | 577 | report_fatal_error("bad MemoryEffects."); |
| 573 | 578 | } |
compiler/rustc_span/src/symbol.rs+2| ... | ... | @@ -794,6 +794,7 @@ symbols! { |
| 794 | 794 | ctlz, |
| 795 | 795 | ctlz_nonzero, |
| 796 | 796 | ctpop, |
| 797 | ctr, | |
| 797 | 798 | cttz, |
| 798 | 799 | cttz_nonzero, |
| 799 | 800 | custom_attribute, |
| ... | ... | @@ -1333,6 +1334,7 @@ symbols! { |
| 1333 | 1334 | loongarch_target_feature, |
| 1334 | 1335 | loop_break_value, |
| 1335 | 1336 | loop_match, |
| 1337 | lr, | |
| 1336 | 1338 | lt, |
| 1337 | 1339 | m68k_target_feature, |
| 1338 | 1340 | macro_at_most_once_rep, |
compiler/rustc_target/src/asm/mod.rs+3-2| ... | ... | @@ -1260,11 +1260,12 @@ impl InlineAsmClobberAbi { |
| 1260 | 1260 | v8, v9, v10, v11, v12, v13, v14, |
| 1261 | 1261 | v15, v16, v17, v18, v19, |
| 1262 | 1262 | |
| 1263 | // cr0-cr1, cr5-cr7, xer | |
| 1263 | // cr0-cr1, cr5-cr7, ctr, lr, xer | |
| 1264 | 1264 | cr0, cr1, |
| 1265 | 1265 | cr5, cr6, cr7, |
| 1266 | ctr, | |
| 1267 | lr, | |
| 1266 | 1268 | xer, |
| 1267 | // lr and ctr are reserved | |
| 1268 | 1269 | } |
| 1269 | 1270 | }, |
| 1270 | 1271 | InlineAsmClobberAbi::S390x => clobbered_regs! { |
compiler/rustc_target/src/asm/powerpc.rs+7-5| ... | ... | @@ -13,6 +13,8 @@ def_reg_class! { |
| 13 | 13 | freg, |
| 14 | 14 | vreg, |
| 15 | 15 | cr, |
| 16 | ctr, | |
| 17 | lr, | |
| 16 | 18 | xer, |
| 17 | 19 | } |
| 18 | 20 | } |
| ... | ... | @@ -56,7 +58,7 @@ impl PowerPCInlineAsmRegClass { |
| 56 | 58 | altivec: VecI8(16), VecI16(8), VecI32(4), VecF32(4); |
| 57 | 59 | vsx: F32, F64, VecI64(2), VecF64(2); |
| 58 | 60 | }, |
| 59 | Self::cr | Self::xer => &[], | |
| 61 | Self::cr | Self::ctr | Self::lr | Self::xer => &[], | |
| 60 | 62 | } |
| 61 | 63 | } |
| 62 | 64 | } |
| ... | ... | @@ -195,6 +197,8 @@ def_regs! { |
| 195 | 197 | cr5: cr = ["cr5"], |
| 196 | 198 | cr6: cr = ["cr6"], |
| 197 | 199 | cr7: cr = ["cr7"], |
| 200 | ctr: ctr = ["ctr"], | |
| 201 | lr: lr = ["lr"], | |
| 198 | 202 | xer: xer = ["xer"], |
| 199 | 203 | #error = ["r1", "1", "sp"] => |
| 200 | 204 | "the stack pointer cannot be used as an operand for inline asm", |
| ... | ... | @@ -206,10 +210,6 @@ def_regs! { |
| 206 | 210 | "r30 is used internally by LLVM and cannot be used as an operand for inline asm", |
| 207 | 211 | #error = ["r31", "31", "fp"] => |
| 208 | 212 | "the frame pointer cannot be used as an operand for inline asm", |
| 209 | #error = ["lr"] => | |
| 210 | "the link register cannot be used as an operand for inline asm", | |
| 211 | #error = ["ctr"] => | |
| 212 | "the counter register cannot be used as an operand for inline asm", | |
| 213 | 213 | #error = ["vrsave"] => |
| 214 | 214 | "the vrsave register cannot be used as an operand for inline asm", |
| 215 | 215 | } |
| ... | ... | @@ -247,6 +247,8 @@ impl PowerPCInlineAsmReg { |
| 247 | 247 | (v24, "24"), (v25, "25"), (v26, "26"), (v27, "27"), (v28, "28"), (v29, "29"), (v30, "30"), (v31, "31"); |
| 248 | 248 | (cr, "cr"); |
| 249 | 249 | (cr0, "0"), (cr1, "1"), (cr2, "2"), (cr3, "3"), (cr4, "4"), (cr5, "5"), (cr6, "6"), (cr7, "7"); |
| 250 | (ctr, "ctr"); | |
| 251 | (lr, "lr"); | |
| 250 | 252 | (xer, "xer"); |
| 251 | 253 | } |
| 252 | 254 | } |
compiler/rustc_target/src/spec/targets/mips64el_unknown_linux_muslabi64.rs-2| ... | ... | @@ -5,8 +5,6 @@ pub(crate) fn target() -> Target { |
| 5 | 5 | base.cpu = "mips64r2".into(); |
| 6 | 6 | base.features = "+mips64r2,+xgot".into(); |
| 7 | 7 | base.max_atomic_width = Some(64); |
| 8 | // FIXME(compiler-team#422): musl targets should be dynamically linked by default. | |
| 9 | base.crt_static_default = true; | |
| 10 | 8 | Target { |
| 11 | 9 | // LLVM doesn't recognize "muslabi64" yet. |
| 12 | 10 | llvm_target: "mips64el-unknown-linux-musl".into(), |
library/alloc/src/collections/btree/node.rs+3-2| ... | ... | @@ -117,10 +117,11 @@ impl<K, V> InternalNode<K, V> { |
| 117 | 117 | /// initialized and valid edge. This function does not set up |
| 118 | 118 | /// such an edge. |
| 119 | 119 | unsafe fn new<A: Allocator + Clone>(alloc: A) -> Box<Self, A> { |
| 120 | let mut node = Box::<Self, _>::new_uninit_in(alloc); | |
| 120 | 121 | unsafe { |
| 121 | let mut node = Box::<Self, _>::new_uninit_in(alloc); | |
| 122 | // We only need to initialize the data; the edges are MaybeUninit. | |
| 122 | // SAFETY: argument points to the `node.data` `LeafNode` | |
| 123 | 123 | LeafNode::init(&raw mut (*node.as_mut_ptr()).data); |
| 124 | // SAFETY: `node.data` was just initialized and `node.edges` is MaybeUninit. | |
| 124 | 125 | node.assume_init() |
| 125 | 126 | } |
| 126 | 127 | } |
library/core/src/ascii/ascii_char.rs+1-1| ... | ... | @@ -515,7 +515,7 @@ impl AsciiChar { |
| 515 | 515 | #[track_caller] |
| 516 | 516 | pub const unsafe fn digit_unchecked(d: u8) -> Self { |
| 517 | 517 | assert_unsafe_precondition!( |
| 518 | check_language_ub, | |
| 518 | check_library_ub, | |
| 519 | 519 | "`ascii::Char::digit_unchecked` input cannot exceed 9.", |
| 520 | 520 | (d: u8 = d) => d < 10 |
| 521 | 521 | ); |
library/core/src/num/int_macros.rs+3-3| ... | ... | @@ -1460,8 +1460,8 @@ macro_rules! int_impl { |
| 1460 | 1460 | #[inline] |
| 1461 | 1461 | pub const unsafe fn unchecked_exact_shl(self, rhs: u32) -> $SelfT { |
| 1462 | 1462 | assert_unsafe_precondition!( |
| 1463 | check_language_ub, | |
| 1464 | concat!(stringify!($SelfT), "::unchecked_exact_shl cannot shift out non-zero bits"), | |
| 1463 | check_library_ub, | |
| 1464 | concat!(stringify!($SelfT), "::unchecked_exact_shl cannot shift out bits that would change the value of the first bit"), | |
| 1465 | 1465 | ( |
| 1466 | 1466 | zeros: u32 = self.leading_zeros(), |
| 1467 | 1467 | ones: u32 = self.leading_ones(), |
| ... | ... | @@ -1638,7 +1638,7 @@ macro_rules! int_impl { |
| 1638 | 1638 | #[inline] |
| 1639 | 1639 | pub const unsafe fn unchecked_exact_shr(self, rhs: u32) -> $SelfT { |
| 1640 | 1640 | assert_unsafe_precondition!( |
| 1641 | check_language_ub, | |
| 1641 | check_library_ub, | |
| 1642 | 1642 | concat!(stringify!($SelfT), "::unchecked_exact_shr cannot shift out non-zero bits"), |
| 1643 | 1643 | ( |
| 1644 | 1644 | zeros: u32 = self.trailing_zeros(), |
library/core/src/num/uint_macros.rs+2-2| ... | ... | @@ -1865,7 +1865,7 @@ macro_rules! uint_impl { |
| 1865 | 1865 | #[inline] |
| 1866 | 1866 | pub const unsafe fn unchecked_exact_shl(self, rhs: u32) -> $SelfT { |
| 1867 | 1867 | assert_unsafe_precondition!( |
| 1868 | check_language_ub, | |
| 1868 | check_library_ub, | |
| 1869 | 1869 | concat!(stringify!($SelfT), "::exact_shl_unchecked cannot shift out non-zero bits"), |
| 1870 | 1870 | ( |
| 1871 | 1871 | zeros: u32 = self.leading_zeros(), |
| ... | ... | @@ -2037,7 +2037,7 @@ macro_rules! uint_impl { |
| 2037 | 2037 | #[inline] |
| 2038 | 2038 | pub const unsafe fn unchecked_exact_shr(self, rhs: u32) -> $SelfT { |
| 2039 | 2039 | assert_unsafe_precondition!( |
| 2040 | check_language_ub, | |
| 2040 | check_library_ub, | |
| 2041 | 2041 | concat!(stringify!($SelfT), "::exact_shr_unchecked cannot shift out non-zero bits"), |
| 2042 | 2042 | ( |
| 2043 | 2043 | zeros: u32 = self.trailing_zeros(), |
library/core/src/slice/index.rs+1-1| ... | ... | @@ -233,7 +233,7 @@ unsafe impl<T> const SliceIndex<[T]> for usize { |
| 233 | 233 | #[track_caller] |
| 234 | 234 | unsafe fn get_unchecked(self, slice: *const [T]) -> *const T { |
| 235 | 235 | assert_unsafe_precondition!( |
| 236 | check_language_ub, | |
| 236 | check_language_ub, // okay because of the `assume` below | |
| 237 | 237 | "slice::get_unchecked requires that the index is within the slice", |
| 238 | 238 | (this: usize = self, len: usize = slice.len()) => this < len |
| 239 | 239 | ); |
library/core/src/ub_checks.rs+3-2| ... | ... | @@ -21,8 +21,9 @@ use crate::intrinsics::{self, const_eval_select}; |
| 21 | 21 | /// slow down const-eval/Miri and we'll get the panic message instead of the interpreter's nice |
| 22 | 22 | /// diagnostic, but our ability to detect UB is unchanged. |
| 23 | 23 | /// But if `check_language_ub` is used when the check is actually for library UB, the check is |
| 24 | /// omitted in const-eval/Miri and thus if we eventually execute language UB which relies on the | |
| 25 | /// library UB, the backtrace Miri reports may be far removed from original cause. | |
| 24 | /// omitted in const-eval/Miri and thus UB might occur undetected. Even if we eventually execute | |
| 25 | /// language UB which relies on the library UB, the backtrace Miri reports may be far removed from | |
| 26 | /// original cause. | |
| 26 | 27 | /// |
| 27 | 28 | /// These checks are behind a condition which is evaluated at codegen time, not expansion time like |
| 28 | 29 | /// [`debug_assert`]. This means that a standard library built with optimizations and debug |
library/std_detect/src/detect/os/darwin/aarch64.rs+17-5| ... | ... | @@ -37,24 +37,25 @@ pub(crate) fn detect_features() -> cache::Initializer { |
| 37 | 37 | // Armv8.0 features not using the standard identifiers |
| 38 | 38 | let fp = _sysctlbyname(c"hw.optional.floatingpoint"); |
| 39 | 39 | let asimd = _sysctlbyname(c"hw.optional.AdvSIMD"); |
| 40 | let crc = _sysctlbyname(c"hw.optional.armv8_crc32"); | |
| 40 | let crc_old = _sysctlbyname(c"hw.optional.armv8_crc32"); | |
| 41 | 41 | |
| 42 | 42 | // Armv8 and Armv9 features using the standard identifiers |
| 43 | 43 | let aes = _sysctlbyname(c"hw.optional.arm.FEAT_AES"); |
| 44 | 44 | let bf16 = _sysctlbyname(c"hw.optional.arm.FEAT_BF16"); |
| 45 | 45 | let bti = _sysctlbyname(c"hw.optional.arm.FEAT_BTI"); |
| 46 | let crc = _sysctlbyname(c"hw.optional.arm.FEAT_CRC32"); | |
| 46 | 47 | let cssc = _sysctlbyname(c"hw.optional.arm.FEAT_CSSC"); |
| 47 | 48 | let dit = _sysctlbyname(c"hw.optional.arm.FEAT_DIT"); |
| 49 | let dotprod = _sysctlbyname(c"hw.optional.arm.FEAT_DotProd"); | |
| 48 | 50 | let dpb = _sysctlbyname(c"hw.optional.arm.FEAT_DPB"); |
| 49 | 51 | let dpb2 = _sysctlbyname(c"hw.optional.arm.FEAT_DPB2"); |
| 50 | let dotprod = _sysctlbyname(c"hw.optional.arm.FEAT_DotProd"); | |
| 51 | 52 | let ecv = _sysctlbyname(c"hw.optional.arm.FEAT_ECV"); |
| 52 | 53 | let fcma = _sysctlbyname(c"hw.optional.arm.FEAT_FCMA"); |
| 53 | 54 | let fhm = _sysctlbyname(c"hw.optional.arm.FEAT_FHM"); |
| 54 | let fp16 = _sysctlbyname(c"hw.optional.arm.FEAT_FP16"); | |
| 55 | let frintts = _sysctlbyname(c"hw.optional.arm.FEAT_FRINTTS"); | |
| 56 | 55 | let flagm = _sysctlbyname(c"hw.optional.arm.FEAT_FlagM"); |
| 57 | 56 | let flagm2 = _sysctlbyname(c"hw.optional.arm.FEAT_FlagM2"); |
| 57 | let fp16 = _sysctlbyname(c"hw.optional.arm.FEAT_FP16"); | |
| 58 | let frintts = _sysctlbyname(c"hw.optional.arm.FEAT_FRINTTS"); | |
| 58 | 59 | let hbc = _sysctlbyname(c"hw.optional.arm.FEAT_HBC"); |
| 59 | 60 | let i8mm = _sysctlbyname(c"hw.optional.arm.FEAT_I8MM"); |
| 60 | 61 | let jsconv = _sysctlbyname(c"hw.optional.arm.FEAT_JSCVT"); |
| ... | ... | @@ -62,6 +63,8 @@ pub(crate) fn detect_features() -> cache::Initializer { |
| 62 | 63 | let rcpc2 = _sysctlbyname(c"hw.optional.arm.FEAT_LRCPC2"); |
| 63 | 64 | let lse = _sysctlbyname(c"hw.optional.arm.FEAT_LSE"); |
| 64 | 65 | let lse2 = _sysctlbyname(c"hw.optional.arm.FEAT_LSE2"); |
| 66 | let mte = _sysctlbyname(c"hw.optional.arm.FEAT_MTE"); | |
| 67 | let mte2 = _sysctlbyname(c"hw.optional.arm.FEAT_MTE2"); | |
| 65 | 68 | let pauth = _sysctlbyname(c"hw.optional.arm.FEAT_PAuth"); |
| 66 | 69 | let pmull = _sysctlbyname(c"hw.optional.arm.FEAT_PMULL"); |
| 67 | 70 | let rdm = _sysctlbyname(c"hw.optional.arm.FEAT_RDM"); |
| ... | ... | @@ -72,6 +75,7 @@ pub(crate) fn detect_features() -> cache::Initializer { |
| 72 | 75 | let sha512 = _sysctlbyname(c"hw.optional.arm.FEAT_SHA512"); |
| 73 | 76 | let sme = _sysctlbyname(c"hw.optional.arm.FEAT_SME"); |
| 74 | 77 | let sme2 = _sysctlbyname(c"hw.optional.arm.FEAT_SME2"); |
| 78 | let sme2p1 = _sysctlbyname(c"hw.optional.arm.FEAT_SME2p1"); | |
| 75 | 79 | let sme_f64f64 = _sysctlbyname(c"hw.optional.arm.FEAT_SME_F64F64"); |
| 76 | 80 | let sme_i16i64 = _sysctlbyname(c"hw.optional.arm.FEAT_SME_I16I64"); |
| 77 | 81 | let ssbs = _sysctlbyname(c"hw.optional.arm.FEAT_SSBS"); |
| ... | ... | @@ -87,6 +91,12 @@ pub(crate) fn detect_features() -> cache::Initializer { |
| 87 | 91 | let ebf16 = _sysctlbyname(c"hw.optional.arm.FEAT_EBF16"); |
| 88 | 92 | let fpac = _sysctlbyname(c"hw.optional.arm.FEAT_FPAC"); |
| 89 | 93 | let fpaccombine = _sysctlbyname(c"hw.optional.arm.FEAT_FPACCOMBINE"); |
| 94 | let mte_async = _sysctlbyname(c"hw.optional.arm.FEAT_MTE_ASYNC"); | |
| 95 | let mte_canonical_tags = _sysctlbyname(c"hw.optional.arm.FEAT_MTE_CANONICAL_TAGS"); | |
| 96 | let mte_no_address_tags = _sysctlbyname(c"hw.optional.arm.FEAT_MTE_NO_ADDRESS_TAGS"); | |
| 97 | let mte_store_only = _sysctlbyname(c"hw.optional.arm.FEAT_MTE_STORE_ONLY"); | |
| 98 | let mte3 = _sysctlbyname(c"hw.optional.arm.FEAT_MTE3"); | |
| 99 | let mte4 = _sysctlbyname(c"hw.optional.arm.FEAT_MTE4"); | |
| 90 | 100 | let pacimp = _sysctlbyname(c"hw.optional.arm.FEAT_PACIMP"); |
| 91 | 101 | let pauth2 = _sysctlbyname(c"hw.optional.arm.FEAT_PAuth2"); |
| 92 | 102 | let rpres = _sysctlbyname(c"hw.optional.arm.FEAT_RPRES"); |
| ... | ... | @@ -111,7 +121,7 @@ pub(crate) fn detect_features() -> cache::Initializer { |
| 111 | 121 | enable_feature(Feature::asimd, asimd); |
| 112 | 122 | enable_feature(Feature::bf16, bf16); |
| 113 | 123 | enable_feature(Feature::bti, bti); |
| 114 | enable_feature(Feature::crc, crc); | |
| 124 | enable_feature(Feature::crc, crc_old || crc); | |
| 115 | 125 | enable_feature(Feature::cssc, cssc); |
| 116 | 126 | enable_feature(Feature::dit, dit); |
| 117 | 127 | enable_feature(Feature::dotprod, dotprod); |
| ... | ... | @@ -130,6 +140,7 @@ pub(crate) fn detect_features() -> cache::Initializer { |
| 130 | 140 | enable_feature(Feature::jsconv, jsconv); |
| 131 | 141 | enable_feature(Feature::lse, lse); |
| 132 | 142 | enable_feature(Feature::lse2, lse2); |
| 143 | enable_feature(Feature::mte, mte && mte2); | |
| 133 | 144 | enable_feature(Feature::paca, pauth); |
| 134 | 145 | enable_feature(Feature::pacg, pauth); |
| 135 | 146 | enable_feature(Feature::pmull, aes && pmull); |
| ... | ... | @@ -141,6 +152,7 @@ pub(crate) fn detect_features() -> cache::Initializer { |
| 141 | 152 | enable_feature(Feature::sha3, sha512 && sha3 && asimd); |
| 142 | 153 | enable_feature(Feature::sme, sme); |
| 143 | 154 | enable_feature(Feature::sme2, sme2); |
| 155 | enable_feature(Feature::sme2p1, sme2p1); | |
| 144 | 156 | enable_feature(Feature::sme_f64f64, sme_f64f64); |
| 145 | 157 | enable_feature(Feature::sme_i16i64, sme_i16i64); |
| 146 | 158 | enable_feature(Feature::ssbs, ssbs); |
src/doc/unstable-book/src/language-features/asm-experimental-arch.md+4-2| ... | ... | @@ -36,6 +36,8 @@ This feature tracks `asm!` and `global_asm!` support for the following architect |
| 36 | 36 | | PowerPC | `freg` | `f[0-31]` | `f` | |
| 37 | 37 | | PowerPC | `vreg` | `v[0-31]` | `v` | |
| 38 | 38 | | PowerPC | `cr` | `cr[0-7]`, `cr` | Only clobbers | |
| 39 | | PowerPC | `ctr` | `ctr` | Only clobbers | | |
| 40 | | PowerPC | `lr` | `lr` | Only clobbers | | |
| 39 | 41 | | PowerPC | `xer` | `xer` | Only clobbers | |
| 40 | 42 | | wasm32 | `local` | None\* | `r` | |
| 41 | 43 | | BPF | `reg` | `r[0-10]` | `r` | |
| ... | ... | @@ -78,6 +80,8 @@ This feature tracks `asm!` and `global_asm!` support for the following architect |
| 78 | 80 | | PowerPC | `vreg` | `altivec` | `i8x16`, `i16x8`, `i32x4`, `f32x4` | |
| 79 | 81 | | PowerPC | `vreg` | `vsx` | `f32`, `f64`, `i64x2`, `f64x2` | |
| 80 | 82 | | PowerPC | `cr` | N/A | Only clobbers | |
| 83 | | PowerPC | `ctr` | N/A | Only clobbers | | |
| 84 | | PowerPC | `lr` | N/A | Only clobbers | | |
| 81 | 85 | | PowerPC | `xer` | N/A | Only clobbers | |
| 82 | 86 | | wasm32 | `local` | None | `i8` `i16` `i32` `i64` `f32` `f64` | |
| 83 | 87 | | BPF | `reg` | None | `i8` `i16` `i32` `i64` | |
| ... | ... | @@ -150,8 +154,6 @@ This feature tracks `asm!` and `global_asm!` support for the following architect |
| 150 | 154 | | MIPS | `$ra` | Return address cannot be used as inputs or outputs. | |
| 151 | 155 | | Hexagon | `lr` | This is the link register which cannot be used as an input or output. | |
| 152 | 156 | | PowerPC | `r2`, `r13` | These are system reserved registers. | |
| 153 | | PowerPC | `lr` | The link register cannot be used as an input or output. | | |
| 154 | | PowerPC | `ctr` | The counter register cannot be used as an input or output. | | |
| 155 | 157 | | PowerPC | `vrsave` | The vrsave register cannot be used as an input or output. | |
| 156 | 158 | | AVR | `r0`, `r1`, `r1r0` | Due to an issue in LLVM, the `r0` and `r1` registers cannot be used as inputs or outputs. If modified, they must be restored to their original values before the end of the block. | |
| 157 | 159 | |MSP430 | `r0`, `r2`, `r3` | These are the program counter, status register, and constant generator respectively. Neither the status register nor constant generator can be written to. | |
src/librustdoc/clean/cfg.rs+30-48| ... | ... | @@ -3,16 +3,16 @@ |
| 3 | 3 | // FIXME: Once the portability lint RFC is implemented (see tracking issue #41619), |
| 4 | 4 | // switch to use those structures instead. |
| 5 | 5 | |
| 6 | use std::fmt::{self, Write}; | |
| 7 | use std::{mem, ops}; | |
| 6 | use std::{fmt, mem, ops}; | |
| 8 | 7 | |
| 8 | use itertools::Either; | |
| 9 | 9 | use rustc_ast::{LitKind, MetaItem, MetaItemInner, MetaItemKind, MetaItemLit}; |
| 10 | 10 | use rustc_data_structures::fx::FxHashSet; |
| 11 | 11 | use rustc_session::parse::ParseSess; |
| 12 | 12 | use rustc_span::Span; |
| 13 | 13 | use rustc_span::symbol::{Symbol, sym}; |
| 14 | 14 | |
| 15 | use crate::display::Joined as _; | |
| 15 | use crate::display::{Joined as _, MaybeDisplay, Wrapped}; | |
| 16 | 16 | use crate::html::escape::Escape; |
| 17 | 17 | |
| 18 | 18 | #[cfg(test)] |
| ... | ... | @@ -376,27 +376,20 @@ impl Format { |
| 376 | 376 | Format::LongPlain => false, |
| 377 | 377 | } |
| 378 | 378 | } |
| 379 | ||
| 380 | fn escape(self, s: &str) -> impl fmt::Display { | |
| 381 | if self.is_html() { Either::Left(Escape(s)) } else { Either::Right(s) } | |
| 382 | } | |
| 379 | 383 | } |
| 380 | 384 | |
| 381 | 385 | /// Pretty-print wrapper for a `Cfg`. Also indicates what form of rendering should be used. |
| 382 | 386 | struct Display<'a>(&'a Cfg, Format); |
| 383 | 387 | |
| 384 | fn write_with_opt_paren<T: fmt::Display>( | |
| 385 | fmt: &mut fmt::Formatter<'_>, | |
| 386 | has_paren: bool, | |
| 387 | obj: T, | |
| 388 | ) -> fmt::Result { | |
| 389 | if has_paren { | |
| 390 | fmt.write_char('(')?; | |
| 391 | } | |
| 392 | obj.fmt(fmt)?; | |
| 393 | if has_paren { | |
| 394 | fmt.write_char(')')?; | |
| 388 | impl Display<'_> { | |
| 389 | fn code_wrappers(&self) -> Wrapped<&'static str> { | |
| 390 | if self.1.is_html() { Wrapped::with("<code>", "</code>") } else { Wrapped::with("`", "`") } | |
| 395 | 391 | } |
| 396 | Ok(()) | |
| 397 | } | |
| 398 | 392 | |
| 399 | impl Display<'_> { | |
| 400 | 393 | fn display_sub_cfgs( |
| 401 | 394 | &self, |
| 402 | 395 | fmt: &mut fmt::Formatter<'_>, |
| ... | ... | @@ -427,20 +420,17 @@ impl Display<'_> { |
| 427 | 420 | sub_cfgs |
| 428 | 421 | .iter() |
| 429 | 422 | .map(|sub_cfg| { |
| 430 | fmt::from_fn(move |fmt| { | |
| 431 | if let Cfg::Cfg(_, Some(feat)) = sub_cfg | |
| 432 | && short_longhand | |
| 433 | { | |
| 434 | if self.1.is_html() { | |
| 435 | write!(fmt, "<code>{feat}</code>")?; | |
| 436 | } else { | |
| 437 | write!(fmt, "`{feat}`")?; | |
| 438 | } | |
| 439 | } else { | |
| 440 | write_with_opt_paren(fmt, !sub_cfg.is_all(), Display(sub_cfg, self.1))?; | |
| 441 | } | |
| 442 | Ok(()) | |
| 443 | }) | |
| 423 | if let Cfg::Cfg(_, Some(feat)) = sub_cfg | |
| 424 | && short_longhand | |
| 425 | { | |
| 426 | Either::Left(self.code_wrappers().wrap(feat)) | |
| 427 | } else { | |
| 428 | Either::Right( | |
| 429 | Wrapped::with_parens() | |
| 430 | .when(!sub_cfg.is_all()) | |
| 431 | .wrap(Display(sub_cfg, self.1)), | |
| 432 | ) | |
| 433 | } | |
| 444 | 434 | }) |
| 445 | 435 | .joined(separator, f) |
| 446 | 436 | }) |
| ... | ... | @@ -461,9 +451,9 @@ impl fmt::Display for Display<'_> { |
| 461 | 451 | sub_cfgs |
| 462 | 452 | .iter() |
| 463 | 453 | .map(|sub_cfg| { |
| 464 | fmt::from_fn(|fmt| { | |
| 465 | write_with_opt_paren(fmt, !sub_cfg.is_all(), Display(sub_cfg, self.1)) | |
| 466 | }) | |
| 454 | Wrapped::with_parens() | |
| 455 | .when(!sub_cfg.is_all()) | |
| 456 | .wrap(Display(sub_cfg, self.1)) | |
| 467 | 457 | }) |
| 468 | 458 | .joined(separator, fmt) |
| 469 | 459 | } |
| ... | ... | @@ -568,21 +558,13 @@ impl fmt::Display for Display<'_> { |
| 568 | 558 | }; |
| 569 | 559 | if !human_readable.is_empty() { |
| 570 | 560 | fmt.write_str(human_readable) |
| 571 | } else if let Some(v) = value { | |
| 572 | if self.1.is_html() { | |
| 573 | write!( | |
| 574 | fmt, | |
| 575 | r#"<code>{}="{}"</code>"#, | |
| 576 | Escape(name.as_str()), | |
| 577 | Escape(v.as_str()) | |
| 578 | ) | |
| 579 | } else { | |
| 580 | write!(fmt, r#"`{name}="{v}"`"#) | |
| 581 | } | |
| 582 | } else if self.1.is_html() { | |
| 583 | write!(fmt, "<code>{}</code>", Escape(name.as_str())) | |
| 584 | 561 | } else { |
| 585 | write!(fmt, "`{name}`") | |
| 562 | let value = value | |
| 563 | .map(|v| fmt::from_fn(move |f| write!(f, "={}", self.1.escape(v.as_str())))) | |
| 564 | .maybe_display(); | |
| 565 | self.code_wrappers() | |
| 566 | .wrap(format_args!("{}{value}", self.1.escape(name.as_str()))) | |
| 567 | .fmt(fmt) | |
| 586 | 568 | } |
| 587 | 569 | } |
| 588 | 570 | } |
src/librustdoc/display.rs+85-1| ... | ... | @@ -1,6 +1,6 @@ |
| 1 | 1 | //! Various utilities for working with [`fmt::Display`] implementations. |
| 2 | 2 | |
| 3 | use std::fmt::{self, Display, Formatter}; | |
| 3 | use std::fmt::{self, Display, Formatter, FormattingOptions}; | |
| 4 | 4 | |
| 5 | 5 | pub(crate) trait Joined: IntoIterator { |
| 6 | 6 | /// Takes an iterator over elements that implement [`Display`], and format them into `f`, separated by `sep`. |
| ... | ... | @@ -45,3 +45,87 @@ impl<T: Display> MaybeDisplay for Option<T> { |
| 45 | 45 | }) |
| 46 | 46 | } |
| 47 | 47 | } |
| 48 | ||
| 49 | #[derive(Clone, Copy)] | |
| 50 | pub(crate) struct Wrapped<T> { | |
| 51 | prefix: T, | |
| 52 | suffix: T, | |
| 53 | } | |
| 54 | ||
| 55 | pub(crate) enum AngleBracket { | |
| 56 | Open, | |
| 57 | Close, | |
| 58 | } | |
| 59 | ||
| 60 | impl Display for AngleBracket { | |
| 61 | fn fmt(&self, f: &mut Formatter<'_>) -> fmt::Result { | |
| 62 | f.write_str(match (self, f.alternate()) { | |
| 63 | (Self::Open, true) => "<", | |
| 64 | (Self::Open, false) => "&lt;", | |
| 65 | (Self::Close, true) => ">", | |
| 66 | (Self::Close, false) => "&gt;", | |
| 67 | }) | |
| 68 | } | |
| 69 | } | |
| 70 | ||
| 71 | impl Wrapped<AngleBracket> { | |
| 72 | pub(crate) fn with_angle_brackets() -> Self { | |
| 73 | Self { prefix: AngleBracket::Open, suffix: AngleBracket::Close } | |
| 74 | } | |
| 75 | } | |
| 76 | ||
| 77 | impl Wrapped<char> { | |
| 78 | pub(crate) fn with_parens() -> Self { | |
| 79 | Self { prefix: '(', suffix: ')' } | |
| 80 | } | |
| 81 | ||
| 82 | pub(crate) fn with_square_brackets() -> Self { | |
| 83 | Self { prefix: '[', suffix: ']' } | |
| 84 | } | |
| 85 | } | |
| 86 | ||
| 87 | impl<T: Display> Wrapped<T> { | |
| 88 | pub(crate) fn with(prefix: T, suffix: T) -> Self { | |
| 89 | Self { prefix, suffix } | |
| 90 | } | |
| 91 | ||
| 92 | pub(crate) fn when(self, if_: bool) -> Wrapped<impl Display> { | |
| 93 | Wrapped { | |
| 94 | prefix: if_.then_some(self.prefix).maybe_display(), | |
| 95 | suffix: if_.then_some(self.suffix).maybe_display(), | |
| 96 | } | |
| 97 | } | |
| 98 | ||
| 99 | pub(crate) fn wrap_fn( | |
| 100 | self, | |
| 101 | content: impl Fn(&mut Formatter<'_>) -> fmt::Result, | |
| 102 | ) -> impl Display { | |
| 103 | fmt::from_fn(move |f| { | |
| 104 | self.prefix.fmt(f)?; | |
| 105 | content(f)?; | |
| 106 | self.suffix.fmt(f) | |
| 107 | }) | |
| 108 | } | |
| 109 | ||
| 110 | pub(crate) fn wrap<C: Display>(self, content: C) -> impl Display { | |
| 111 | self.wrap_fn(move |f| content.fmt(f)) | |
| 112 | } | |
| 113 | } | |
| 114 | ||
| 115 | #[derive(Clone, Copy)] | |
| 116 | pub(crate) struct WithOpts { | |
| 117 | opts: FormattingOptions, | |
| 118 | } | |
| 119 | ||
| 120 | impl WithOpts { | |
| 121 | pub(crate) fn from(f: &Formatter<'_>) -> Self { | |
| 122 | Self { opts: f.options() } | |
| 123 | } | |
| 124 | ||
| 125 | pub(crate) fn display(self, t: impl Display) -> impl Display { | |
| 126 | fmt::from_fn(move |f| { | |
| 127 | let mut f = f.with_options(self.opts); | |
| 128 | t.fmt(&mut f) | |
| 129 | }) | |
| 130 | } | |
| 131 | } |
src/librustdoc/html/format.rs+146-202| ... | ... | @@ -30,7 +30,7 @@ use super::url_parts_builder::UrlPartsBuilder; |
| 30 | 30 | use crate::clean::types::ExternalLocation; |
| 31 | 31 | use crate::clean::utils::find_nearest_parent_module; |
| 32 | 32 | use crate::clean::{self, ExternalCrate, PrimitiveType}; |
| 33 | use crate::display::{Joined as _, MaybeDisplay as _}; | |
| 33 | use crate::display::{Joined as _, MaybeDisplay as _, WithOpts, Wrapped}; | |
| 34 | 34 | use crate::formats::cache::Cache; |
| 35 | 35 | use crate::formats::item_type::ItemType; |
| 36 | 36 | use crate::html::escape::{Escape, EscapeBodyText}; |
| ... | ... | @@ -105,20 +105,16 @@ impl clean::GenericParamDef { |
| 105 | 105 | |
| 106 | 106 | impl clean::Generics { |
| 107 | 107 | pub(crate) fn print(&self, cx: &Context<'_>) -> impl Display { |
| 108 | fmt::from_fn(move |f| { | |
| 109 | let mut real_params = self.params.iter().filter(|p| !p.is_synthetic_param()).peekable(); | |
| 110 | if real_params.peek().is_none() { | |
| 111 | return Ok(()); | |
| 112 | } | |
| 113 | ||
| 114 | let real_params = | |
| 115 | fmt::from_fn(|f| real_params.clone().map(|g| g.print(cx)).joined(", ", f)); | |
| 116 | if f.alternate() { | |
| 117 | write!(f, "<{real_params:#}>") | |
| 118 | } else { | |
| 119 | write!(f, "&lt;{real_params}&gt;") | |
| 120 | } | |
| 121 | }) | |
| 108 | let mut real_params = self.params.iter().filter(|p| !p.is_synthetic_param()).peekable(); | |
| 109 | if real_params.peek().is_none() { | |
| 110 | None | |
| 111 | } else { | |
| 112 | Some( | |
| 113 | Wrapped::with_angle_brackets() | |
| 114 | .wrap_fn(move |f| real_params.clone().map(|g| g.print(cx)).joined(", ", f)), | |
| 115 | ) | |
| 116 | } | |
| 117 | .maybe_display() | |
| 122 | 118 | } |
| 123 | 119 | } |
| 124 | 120 | |
| ... | ... | @@ -151,11 +147,8 @@ fn print_where_predicate(predicate: &clean::WherePredicate, cx: &Context<'_>) -> |
| 151 | 147 | Ok(()) |
| 152 | 148 | } |
| 153 | 149 | clean::WherePredicate::EqPredicate { lhs, rhs } => { |
| 154 | if f.alternate() { | |
| 155 | write!(f, "{:#} == {:#}", lhs.print(cx), rhs.print(cx)) | |
| 156 | } else { | |
| 157 | write!(f, "{} == {}", lhs.print(cx), rhs.print(cx)) | |
| 158 | } | |
| 150 | let opts = WithOpts::from(f); | |
| 151 | write!(f, "{} == {}", opts.display(lhs.print(cx)), opts.display(rhs.print(cx))) | |
| 159 | 152 | } |
| 160 | 153 | } |
| 161 | 154 | }) |
| ... | ... | @@ -279,13 +272,10 @@ impl clean::GenericBound { |
| 279 | 272 | ty.print(cx).fmt(f) |
| 280 | 273 | } |
| 281 | 274 | clean::GenericBound::Use(args) => { |
| 282 | if f.alternate() { | |
| 283 | f.write_str("use<")?; | |
| 284 | } else { | |
| 285 | f.write_str("use&lt;")?; | |
| 286 | } | |
| 287 | args.iter().map(|arg| arg.name()).joined(", ", f)?; | |
| 288 | if f.alternate() { f.write_str(">") } else { f.write_str("&gt;") } | |
| 275 | f.write_str("use")?; | |
| 276 | Wrapped::with_angle_brackets() | |
| 277 | .wrap_fn(|f| args.iter().map(|arg| arg.name()).joined(", ", f)) | |
| 278 | .fmt(f) | |
| 289 | 279 | } |
| 290 | 280 | }) |
| 291 | 281 | } |
| ... | ... | @@ -297,40 +287,29 @@ impl clean::GenericArgs { |
| 297 | 287 | match self { |
| 298 | 288 | clean::GenericArgs::AngleBracketed { args, constraints } => { |
| 299 | 289 | if !args.is_empty() || !constraints.is_empty() { |
| 300 | if f.alternate() { | |
| 301 | f.write_str("<")?; | |
| 302 | } else { | |
| 303 | f.write_str("&lt;")?; | |
| 304 | } | |
| 305 | ||
| 306 | [Either::Left(args), Either::Right(constraints)] | |
| 307 | .into_iter() | |
| 308 | .flat_map(Either::factor_into_iter) | |
| 309 | .map(|either| { | |
| 310 | either.map_either( | |
| 311 | |arg| arg.print(cx), | |
| 312 | |constraint| constraint.print(cx), | |
| 313 | ) | |
| 290 | Wrapped::with_angle_brackets() | |
| 291 | .wrap_fn(|f| { | |
| 292 | [Either::Left(args), Either::Right(constraints)] | |
| 293 | .into_iter() | |
| 294 | .flat_map(Either::factor_into_iter) | |
| 295 | .map(|either| { | |
| 296 | either.map_either( | |
| 297 | |arg| arg.print(cx), | |
| 298 | |constraint| constraint.print(cx), | |
| 299 | ) | |
| 300 | }) | |
| 301 | .joined(", ", f) | |
| 314 | 302 | }) |
| 315 | .joined(", ", f)?; | |
| 316 | ||
| 317 | if f.alternate() { | |
| 318 | f.write_str(">")?; | |
| 319 | } else { | |
| 320 | f.write_str("&gt;")?; | |
| 321 | } | |
| 303 | .fmt(f)?; | |
| 322 | 304 | } |
| 323 | 305 | } |
| 324 | 306 | clean::GenericArgs::Parenthesized { inputs, output } => { |
| 325 | f.write_str("(")?; | |
| 326 | inputs.iter().map(|ty| ty.print(cx)).joined(", ", f)?; | |
| 327 | f.write_str(")")?; | |
| 307 | Wrapped::with_parens() | |
| 308 | .wrap_fn(|f| inputs.iter().map(|ty| ty.print(cx)).joined(", ", f)) | |
| 309 | .fmt(f)?; | |
| 328 | 310 | if let Some(ref ty) = *output { |
| 329 | if f.alternate() { | |
| 330 | write!(f, " -> {:#}", ty.print(cx))?; | |
| 331 | } else { | |
| 332 | write!(f, " -&gt; {}", ty.print(cx))?; | |
| 333 | } | |
| 311 | f.write_str(if f.alternate() { " -> " } else { " -&gt; " })?; | |
| 312 | ty.print(cx).fmt(f)?; | |
| 334 | 313 | } |
| 335 | 314 | } |
| 336 | 315 | clean::GenericArgs::ReturnTypeNotation => { |
| ... | ... | @@ -834,9 +813,10 @@ fn print_higher_ranked_params_with_space( |
| 834 | 813 | fmt::from_fn(move |f| { |
| 835 | 814 | if !params.is_empty() { |
| 836 | 815 | f.write_str(keyword)?; |
| 837 | f.write_str(if f.alternate() { "<" } else { "&lt;" })?; | |
| 838 | params.iter().map(|lt| lt.print(cx)).joined(", ", f)?; | |
| 839 | f.write_str(if f.alternate() { "> " } else { "&gt; " })?; | |
| 816 | Wrapped::with_angle_brackets() | |
| 817 | .wrap_fn(|f| params.iter().map(|lt| lt.print(cx)).joined(", ", f)) | |
| 818 | .fmt(f)?; | |
| 819 | f.write_char(' ')?; | |
| 840 | 820 | } |
| 841 | 821 | Ok(()) |
| 842 | 822 | }) |
| ... | ... | @@ -923,26 +903,23 @@ fn fmt_type( |
| 923 | 903 | f, |
| 924 | 904 | PrimitiveType::Tuple, |
| 925 | 905 | format_args!( |
| 926 | "({})", | |
| 927 | fmt::from_fn(|f| generic_names.iter().joined(", ", f)) | |
| 906 | "{}", | |
| 907 | Wrapped::with_parens() | |
| 908 | .wrap_fn(|f| generic_names.iter().joined(", ", f)) | |
| 928 | 909 | ), |
| 929 | 910 | cx, |
| 930 | 911 | ) |
| 931 | 912 | } else { |
| 932 | f.write_str("(")?; | |
| 933 | many.iter().map(|item| item.print(cx)).joined(", ", f)?; | |
| 934 | f.write_str(")") | |
| 913 | Wrapped::with_parens() | |
| 914 | .wrap_fn(|f| many.iter().map(|item| item.print(cx)).joined(", ", f)) | |
| 915 | .fmt(f) | |
| 935 | 916 | } |
| 936 | 917 | } |
| 937 | 918 | }, |
| 938 | 919 | clean::Slice(box clean::Generic(name)) => { |
| 939 | 920 | primitive_link(f, PrimitiveType::Slice, format_args!("[{name}]"), cx) |
| 940 | 921 | } |
| 941 | clean::Slice(t) => { | |
| 942 | write!(f, "[")?; | |
| 943 | t.print(cx).fmt(f)?; | |
| 944 | write!(f, "]") | |
| 945 | } | |
| 922 | clean::Slice(t) => Wrapped::with_square_brackets().wrap(t.print(cx)).fmt(f), | |
| 946 | 923 | clean::Type::Pat(t, pat) => { |
| 947 | 924 | fmt::Display::fmt(&t.print(cx), f)?; |
| 948 | 925 | write!(f, " is {pat}") |
| ... | ... | @@ -953,40 +930,27 @@ fn fmt_type( |
| 953 | 930 | format_args!("[{name}; {n}]", n = Escape(n)), |
| 954 | 931 | cx, |
| 955 | 932 | ), |
| 956 | clean::Array(t, n) => { | |
| 957 | write!(f, "[")?; | |
| 958 | t.print(cx).fmt(f)?; | |
| 959 | if f.alternate() { | |
| 960 | write!(f, "; {n}")?; | |
| 961 | } else { | |
| 962 | write!(f, "; ")?; | |
| 963 | primitive_link(f, PrimitiveType::Array, format_args!("{n}", n = Escape(n)), cx)?; | |
| 964 | } | |
| 965 | write!(f, "]") | |
| 966 | } | |
| 967 | clean::RawPointer(m, t) => { | |
| 968 | let m = match m { | |
| 969 | hir::Mutability::Mut => "mut", | |
| 970 | hir::Mutability::Not => "const", | |
| 971 | }; | |
| 972 | ||
| 973 | if matches!(**t, clean::Generic(_)) || t.is_assoc_ty() { | |
| 974 | let ty = t.print(cx); | |
| 933 | clean::Array(t, n) => Wrapped::with_square_brackets() | |
| 934 | .wrap(fmt::from_fn(|f| { | |
| 935 | t.print(cx).fmt(f)?; | |
| 936 | f.write_str("; ")?; | |
| 975 | 937 | if f.alternate() { |
| 976 | primitive_link( | |
| 977 | f, | |
| 978 | clean::PrimitiveType::RawPointer, | |
| 979 | format_args!("*{m} {ty:#}"), | |
| 980 | cx, | |
| 981 | ) | |
| 938 | f.write_str(n) | |
| 982 | 939 | } else { |
| 983 | primitive_link( | |
| 984 | f, | |
| 985 | clean::PrimitiveType::RawPointer, | |
| 986 | format_args!("*{m} {ty}"), | |
| 987 | cx, | |
| 988 | ) | |
| 940 | primitive_link(f, PrimitiveType::Array, format_args!("{n}", n = Escape(n)), cx) | |
| 989 | 941 | } |
| 942 | })) | |
| 943 | .fmt(f), | |
| 944 | clean::RawPointer(m, t) => { | |
| 945 | let m = m.ptr_str(); | |
| 946 | ||
| 947 | if matches!(**t, clean::Generic(_)) || t.is_assoc_ty() { | |
| 948 | primitive_link( | |
| 949 | f, | |
| 950 | clean::PrimitiveType::RawPointer, | |
| 951 | format_args!("*{m} {ty}", ty = WithOpts::from(f).display(t.print(cx))), | |
| 952 | cx, | |
| 953 | ) | |
| 990 | 954 | } else { |
| 991 | 955 | primitive_link(f, clean::PrimitiveType::RawPointer, format_args!("*{m} "), cx)?; |
| 992 | 956 | t.print(cx).fmt(f) |
| ... | ... | @@ -1020,14 +984,10 @@ fn fmt_type( |
| 1020 | 984 | clean::ImplTrait(ref bounds) if bounds.len() > 1 => true, |
| 1021 | 985 | _ => false, |
| 1022 | 986 | }; |
| 1023 | if needs_parens { | |
| 1024 | f.write_str("(")?; | |
| 1025 | } | |
| 1026 | fmt_type(ty, f, use_absolute, cx)?; | |
| 1027 | if needs_parens { | |
| 1028 | f.write_str(")")?; | |
| 1029 | } | |
| 1030 | Ok(()) | |
| 987 | Wrapped::with_parens() | |
| 988 | .when(needs_parens) | |
| 989 | .wrap_fn(|f| fmt_type(ty, f, use_absolute, cx)) | |
| 990 | .fmt(f) | |
| 1031 | 991 | } |
| 1032 | 992 | clean::ImplTrait(bounds) => { |
| 1033 | 993 | f.write_str("impl ")?; |
| ... | ... | @@ -1057,23 +1017,21 @@ impl clean::QPathData { |
| 1057 | 1017 | // FIXME(inherent_associated_types): Once we support non-ADT self-types (#106719), |
| 1058 | 1018 | // we need to surround them with angle brackets in some cases (e.g. `<dyn …>::P`). |
| 1059 | 1019 | |
| 1060 | if f.alternate() { | |
| 1061 | if let Some(trait_) = trait_ | |
| 1062 | && should_fully_qualify | |
| 1063 | { | |
| 1064 | write!(f, "<{:#} as {:#}>::", self_type.print(cx), trait_.print(cx))? | |
| 1065 | } else { | |
| 1066 | write!(f, "{:#}::", self_type.print(cx))? | |
| 1067 | } | |
| 1020 | if let Some(trait_) = trait_ | |
| 1021 | && should_fully_qualify | |
| 1022 | { | |
| 1023 | let opts = WithOpts::from(f); | |
| 1024 | Wrapped::with_angle_brackets() | |
| 1025 | .wrap(format_args!( | |
| 1026 | "{} as {}", | |
| 1027 | opts.display(self_type.print(cx)), | |
| 1028 | opts.display(trait_.print(cx)) | |
| 1029 | )) | |
| 1030 | .fmt(f)? | |
| 1068 | 1031 | } else { |
| 1069 | if let Some(trait_) = trait_ | |
| 1070 | && should_fully_qualify | |
| 1071 | { | |
| 1072 | write!(f, "&lt;{} as {}&gt;::", self_type.print(cx), trait_.print(cx))? | |
| 1073 | } else { | |
| 1074 | write!(f, "{}::", self_type.print(cx))? | |
| 1075 | } | |
| 1076 | }; | |
| 1032 | self_type.print(cx).fmt(f)?; | |
| 1033 | } | |
| 1034 | f.write_str("::")?; | |
| 1077 | 1035 | // It's pretty unsightly to look at `<A as B>::C` in output, and |
| 1078 | 1036 | // we've got hyperlinking on our side, so try to avoid longer |
| 1079 | 1037 | // notation as much as possible by making `C` a hyperlink to trait |
| ... | ... | @@ -1132,7 +1090,7 @@ impl clean::Impl { |
| 1132 | 1090 | |
| 1133 | 1091 | if let Some(ref ty) = self.trait_ { |
| 1134 | 1092 | if self.is_negative_trait_impl() { |
| 1135 | write!(f, "!")?; | |
| 1093 | f.write_char('!')?; | |
| 1136 | 1094 | } |
| 1137 | 1095 | if self.kind.is_fake_variadic() |
| 1138 | 1096 | && let Some(generics) = ty.generics() |
| ... | ... | @@ -1140,18 +1098,17 @@ impl clean::Impl { |
| 1140 | 1098 | { |
| 1141 | 1099 | let last = ty.last(); |
| 1142 | 1100 | if f.alternate() { |
| 1143 | write!(f, "{last}<")?; | |
| 1144 | self.print_type(inner_type, f, use_absolute, cx)?; | |
| 1145 | write!(f, ">")?; | |
| 1101 | write!(f, "{last}")?; | |
| 1146 | 1102 | } else { |
| 1147 | write!(f, "{}&lt;", print_anchor(ty.def_id(), last, cx))?; | |
| 1148 | self.print_type(inner_type, f, use_absolute, cx)?; | |
| 1149 | write!(f, "&gt;")?; | |
| 1150 | } | |
| 1103 | write!(f, "{}", print_anchor(ty.def_id(), last, cx))?; | |
| 1104 | }; | |
| 1105 | Wrapped::with_angle_brackets() | |
| 1106 | .wrap_fn(|f| self.print_type(inner_type, f, use_absolute, cx)) | |
| 1107 | .fmt(f)?; | |
| 1151 | 1108 | } else { |
| 1152 | 1109 | ty.print(cx).fmt(f)?; |
| 1153 | 1110 | } |
| 1154 | write!(f, " for ")?; | |
| 1111 | f.write_str(" for ")?; | |
| 1155 | 1112 | } |
| 1156 | 1113 | |
| 1157 | 1114 | if let Some(ty) = self.kind.as_blanket_ty() { |
| ... | ... | @@ -1218,18 +1175,10 @@ impl clean::Impl { |
| 1218 | 1175 | && let Ok(ty) = generics.exactly_one() |
| 1219 | 1176 | && self.kind.is_fake_variadic() |
| 1220 | 1177 | { |
| 1221 | let wrapper = print_anchor(path.def_id(), path.last(), cx); | |
| 1222 | if f.alternate() { | |
| 1223 | write!(f, "{wrapper:#}&lt;")?; | |
| 1224 | } else { | |
| 1225 | write!(f, "{wrapper}<")?; | |
| 1226 | } | |
| 1227 | self.print_type(ty, f, use_absolute, cx)?; | |
| 1228 | if f.alternate() { | |
| 1229 | write!(f, "&gt;")?; | |
| 1230 | } else { | |
| 1231 | write!(f, ">")?; | |
| 1232 | } | |
| 1178 | print_anchor(path.def_id(), path.last(), cx).fmt(f)?; | |
| 1179 | Wrapped::with_angle_brackets() | |
| 1180 | .wrap_fn(|f| self.print_type(ty, f, use_absolute, cx)) | |
| 1181 | .fmt(f)?; | |
| 1233 | 1182 | } else { |
| 1234 | 1183 | fmt_type(type_, f, use_absolute, cx)?; |
| 1235 | 1184 | } |
| ... | ... | @@ -1311,23 +1260,13 @@ impl clean::FnDecl { |
| 1311 | 1260 | pub(crate) fn print(&self, cx: &Context<'_>) -> impl Display { |
| 1312 | 1261 | fmt::from_fn(move |f| { |
| 1313 | 1262 | let ellipsis = if self.c_variadic { ", ..." } else { "" }; |
| 1314 | if f.alternate() { | |
| 1315 | write!( | |
| 1316 | f, | |
| 1317 | "({params:#}{ellipsis}){arrow:#}", | |
| 1318 | params = print_params(&self.inputs, cx), | |
| 1319 | ellipsis = ellipsis, | |
| 1320 | arrow = self.print_output(cx) | |
| 1321 | ) | |
| 1322 | } else { | |
| 1323 | write!( | |
| 1324 | f, | |
| 1325 | "({params}{ellipsis}){arrow}", | |
| 1326 | params = print_params(&self.inputs, cx), | |
| 1327 | ellipsis = ellipsis, | |
| 1328 | arrow = self.print_output(cx) | |
| 1329 | ) | |
| 1330 | } | |
| 1263 | Wrapped::with_parens() | |
| 1264 | .wrap_fn(|f| { | |
| 1265 | print_params(&self.inputs, cx).fmt(f)?; | |
| 1266 | f.write_str(ellipsis) | |
| 1267 | }) | |
| 1268 | .fmt(f)?; | |
| 1269 | self.print_output(cx).fmt(f) | |
| 1331 | 1270 | }) |
| 1332 | 1271 | } |
| 1333 | 1272 | |
| ... | ... | @@ -1346,8 +1285,7 @@ impl clean::FnDecl { |
| 1346 | 1285 | fmt::from_fn(move |f| { |
| 1347 | 1286 | // First, generate the text form of the declaration, with no line wrapping, and count the bytes. |
| 1348 | 1287 | let mut counter = WriteCounter(0); |
| 1349 | write!(&mut counter, "{:#}", fmt::from_fn(|f| { self.inner_full_print(None, f, cx) })) | |
| 1350 | .unwrap(); | |
| 1288 | write!(&mut counter, "{:#}", fmt::from_fn(|f| { self.inner_full_print(None, f, cx) }))?; | |
| 1351 | 1289 | // If the text form was over 80 characters wide, we will line-wrap our output. |
| 1352 | 1290 | let line_wrapping_indent = |
| 1353 | 1291 | if header_len + counter.0 > 80 { Some(indent) } else { None }; |
| ... | ... | @@ -1365,53 +1303,56 @@ impl clean::FnDecl { |
| 1365 | 1303 | f: &mut fmt::Formatter<'_>, |
| 1366 | 1304 | cx: &Context<'_>, |
| 1367 | 1305 | ) -> fmt::Result { |
| 1368 | f.write_char('(')?; | |
| 1306 | Wrapped::with_parens() | |
| 1307 | .wrap_fn(|f| { | |
| 1308 | if !self.inputs.is_empty() { | |
| 1309 | let line_wrapping_indent = line_wrapping_indent.map(|n| Indent(n + 4)); | |
| 1369 | 1310 | |
| 1370 | if !self.inputs.is_empty() { | |
| 1371 | let line_wrapping_indent = line_wrapping_indent.map(|n| Indent(n + 4)); | |
| 1372 | ||
| 1373 | if let Some(indent) = line_wrapping_indent { | |
| 1374 | write!(f, "\n{indent}")?; | |
| 1375 | } | |
| 1311 | if let Some(indent) = line_wrapping_indent { | |
| 1312 | write!(f, "\n{indent}")?; | |
| 1313 | } | |
| 1376 | 1314 | |
| 1377 | let sep = fmt::from_fn(|f| { | |
| 1378 | if let Some(indent) = line_wrapping_indent { | |
| 1379 | write!(f, ",\n{indent}") | |
| 1380 | } else { | |
| 1381 | f.write_str(", ") | |
| 1382 | } | |
| 1383 | }); | |
| 1315 | let sep = fmt::from_fn(|f| { | |
| 1316 | if let Some(indent) = line_wrapping_indent { | |
| 1317 | write!(f, ",\n{indent}") | |
| 1318 | } else { | |
| 1319 | f.write_str(", ") | |
| 1320 | } | |
| 1321 | }); | |
| 1384 | 1322 | |
| 1385 | self.inputs.iter().map(|param| param.print(cx)).joined(sep, f)?; | |
| 1323 | self.inputs.iter().map(|param| param.print(cx)).joined(sep, f)?; | |
| 1386 | 1324 | |
| 1387 | if line_wrapping_indent.is_some() { | |
| 1388 | writeln!(f, ",")? | |
| 1389 | } | |
| 1325 | if line_wrapping_indent.is_some() { | |
| 1326 | writeln!(f, ",")? | |
| 1327 | } | |
| 1390 | 1328 | |
| 1391 | if self.c_variadic { | |
| 1392 | match line_wrapping_indent { | |
| 1393 | None => write!(f, ", ...")?, | |
| 1394 | Some(indent) => writeln!(f, "{indent}...")?, | |
| 1395 | }; | |
| 1396 | } | |
| 1397 | } | |
| 1329 | if self.c_variadic { | |
| 1330 | match line_wrapping_indent { | |
| 1331 | None => write!(f, ", ...")?, | |
| 1332 | Some(indent) => writeln!(f, "{indent}...")?, | |
| 1333 | }; | |
| 1334 | } | |
| 1335 | } | |
| 1398 | 1336 | |
| 1399 | if let Some(n) = line_wrapping_indent { | |
| 1400 | write!(f, "{}", Indent(n))? | |
| 1401 | } | |
| 1337 | if let Some(n) = line_wrapping_indent { | |
| 1338 | write!(f, "{}", Indent(n))? | |
| 1339 | } | |
| 1402 | 1340 | |
| 1403 | f.write_char(')')?; | |
| 1341 | Ok(()) | |
| 1342 | }) | |
| 1343 | .fmt(f)?; | |
| 1404 | 1344 | |
| 1405 | 1345 | self.print_output(cx).fmt(f) |
| 1406 | 1346 | } |
| 1407 | 1347 | |
| 1408 | 1348 | fn print_output(&self, cx: &Context<'_>) -> impl Display { |
| 1409 | fmt::from_fn(move |f| match &self.output { | |
| 1410 | clean::Tuple(tys) if tys.is_empty() => Ok(()), | |
| 1411 | ty if f.alternate() => { | |
| 1412 | write!(f, " -> {:#}", ty.print(cx)) | |
| 1349 | fmt::from_fn(move |f| { | |
| 1350 | if self.output.is_unit() { | |
| 1351 | return Ok(()); | |
| 1413 | 1352 | } |
| 1414 | ty => write!(f, " -&gt; {}", ty.print(cx)), | |
| 1353 | ||
| 1354 | f.write_str(if f.alternate() { " -> " } else { " -&gt; " })?; | |
| 1355 | self.output.print(cx).fmt(f) | |
| 1415 | 1356 | }) |
| 1416 | 1357 | } |
| 1417 | 1358 | } |
| ... | ... | @@ -1422,10 +1363,13 @@ pub(crate) fn visibility_print_with_space(item: &clean::Item, cx: &Context<'_>) |
| 1422 | 1363 | f.write_str("#[doc(hidden)] ")?; |
| 1423 | 1364 | } |
| 1424 | 1365 | |
| 1425 | match item.visibility(cx.tcx()) { | |
| 1426 | None => {} | |
| 1427 | Some(ty::Visibility::Public) => f.write_str("pub ")?, | |
| 1428 | Some(ty::Visibility::Restricted(vis_did)) => { | |
| 1366 | let Some(vis) = item.visibility(cx.tcx()) else { | |
| 1367 | return Ok(()); | |
| 1368 | }; | |
| 1369 | ||
| 1370 | match vis { | |
| 1371 | ty::Visibility::Public => f.write_str("pub ")?, | |
| 1372 | ty::Visibility::Restricted(vis_did) => { | |
| 1429 | 1373 | // FIXME(camelid): This may not work correctly if `item_did` is a module. |
| 1430 | 1374 | // However, rustdoc currently never displays a module's |
| 1431 | 1375 | // visibility, so it shouldn't matter. |
src/librustdoc/lib.rs+1| ... | ... | @@ -10,6 +10,7 @@ |
| 10 | 10 | #![feature(box_patterns)] |
| 11 | 11 | #![feature(debug_closure_helpers)] |
| 12 | 12 | #![feature(file_buffered)] |
| 13 | #![feature(formatting_options)] | |
| 13 | 14 | #![feature(if_let_guard)] |
| 14 | 15 | #![feature(iter_advance_by)] |
| 15 | 16 | #![feature(iter_intersperse)] |
tests/codegen-llvm/asm/powerpc-clobbers.rs+4-4| ... | ... | @@ -58,10 +58,10 @@ pub unsafe fn v0_clobber() { |
| 58 | 58 | |
| 59 | 59 | // Output format depends on the availability of altivec. |
| 60 | 60 | // CHECK-LABEL: @clobber_abi |
| 61 | // powerpc: asm sideeffect "", "={r0},={r3},={r4},={r5},={r6},={r7},={r8},={r9},={r10},={r11},={r12},={f0},={f1},={f2},={f3},={f4},={f5},={f6},={f7},={f8},={f9},={f10},={f11},={f12},={f13},~{v0},~{v1},~{v2},~{v3},~{v4},~{v5},~{v6},~{v7},~{v8},~{v9},~{v10},~{v11},~{v12},~{v13},~{v14},~{v15},~{v16},~{v17},~{v18},~{v19},~{cr0},~{cr1},~{cr5},~{cr6},~{cr7},~{xer}"() | |
| 62 | // powerpc64: asm sideeffect "", "={r0},={r3},={r4},={r5},={r6},={r7},={r8},={r9},={r10},={r11},={r12},={f0},={f1},={f2},={f3},={f4},={f5},={f6},={f7},={f8},={f9},={f10},={f11},={f12},={f13},={v0},={v1},={v2},={v3},={v4},={v5},={v6},={v7},={v8},={v9},={v10},={v11},={v12},={v13},={v14},={v15},={v16},={v17},={v18},={v19},~{cr0},~{cr1},~{cr5},~{cr6},~{cr7},~{xer}"() | |
| 63 | // powerpc64le: asm sideeffect "", "={r0},={r3},={r4},={r5},={r6},={r7},={r8},={r9},={r10},={r11},={r12},={f0},={f1},={f2},={f3},={f4},={f5},={f6},={f7},={f8},={f9},={f10},={f11},={f12},={f13},={v0},={v1},={v2},={v3},={v4},={v5},={v6},={v7},={v8},={v9},={v10},={v11},={v12},={v13},={v14},={v15},={v16},={v17},={v18},={v19},~{cr0},~{cr1},~{cr5},~{cr6},~{cr7},~{xer}"() | |
| 64 | // aix64: asm sideeffect "", "={r0},={r3},={r4},={r5},={r6},={r7},={r8},={r9},={r10},={r11},={r12},={f0},={f1},={f2},={f3},={f4},={f5},={f6},={f7},={f8},={f9},={f10},={f11},={f12},={f13},={v0},={v1},={v2},={v3},={v4},={v5},={v6},={v7},={v8},={v9},={v10},={v11},={v12},={v13},={v14},={v15},={v16},={v17},={v18},={v19},~{cr0},~{cr1},~{cr5},~{cr6},~{cr7},~{xer}"() | |
| 61 | // powerpc: asm sideeffect "", "={r0},={r3},={r4},={r5},={r6},={r7},={r8},={r9},={r10},={r11},={r12},={f0},={f1},={f2},={f3},={f4},={f5},={f6},={f7},={f8},={f9},={f10},={f11},={f12},={f13},~{v0},~{v1},~{v2},~{v3},~{v4},~{v5},~{v6},~{v7},~{v8},~{v9},~{v10},~{v11},~{v12},~{v13},~{v14},~{v15},~{v16},~{v17},~{v18},~{v19},~{cr0},~{cr1},~{cr5},~{cr6},~{cr7},~{ctr},~{lr},~{xer}"() | |
| 62 | // powerpc64: asm sideeffect "", "={r0},={r3},={r4},={r5},={r6},={r7},={r8},={r9},={r10},={r11},={r12},={f0},={f1},={f2},={f3},={f4},={f5},={f6},={f7},={f8},={f9},={f10},={f11},={f12},={f13},={v0},={v1},={v2},={v3},={v4},={v5},={v6},={v7},={v8},={v9},={v10},={v11},={v12},={v13},={v14},={v15},={v16},={v17},={v18},={v19},~{cr0},~{cr1},~{cr5},~{cr6},~{cr7},~{ctr},~{lr},~{xer}"() | |
| 63 | // powerpc64le: asm sideeffect "", "={r0},={r3},={r4},={r5},={r6},={r7},={r8},={r9},={r10},={r11},={r12},={f0},={f1},={f2},={f3},={f4},={f5},={f6},={f7},={f8},={f9},={f10},={f11},={f12},={f13},={v0},={v1},={v2},={v3},={v4},={v5},={v6},={v7},={v8},={v9},={v10},={v11},={v12},={v13},={v14},={v15},={v16},={v17},={v18},={v19},~{cr0},~{cr1},~{cr5},~{cr6},~{cr7},~{ctr},~{lr},~{xer}"() | |
| 64 | // aix64: asm sideeffect "", "={r0},={r3},={r4},={r5},={r6},={r7},={r8},={r9},={r10},={r11},={r12},={f0},={f1},={f2},={f3},={f4},={f5},={f6},={f7},={f8},={f9},={f10},={f11},={f12},={f13},={v0},={v1},={v2},={v3},={v4},={v5},={v6},={v7},={v8},={v9},={v10},={v11},={v12},={v13},={v14},={v15},={v16},={v17},={v18},={v19},~{cr0},~{cr1},~{cr5},~{cr6},~{cr7},~{ctr},~{lr},~{xer}"() | |
| 65 | 65 | #[no_mangle] |
| 66 | 66 | pub unsafe fn clobber_abi() { |
| 67 | 67 | asm!("", clobber_abi("C"), options(nostack, nomem, preserves_flags)); |
tests/codegen-llvm/asm/readonly-not-pure.rs created+48| ... | ... | @@ -0,0 +1,48 @@ |
| 1 | //@ add-core-stubs | |
| 2 | //@ compile-flags: -Copt-level=3 --target x86_64-unknown-linux-gnu | |
| 3 | //@ needs-llvm-components: x86 | |
| 4 | ||
| 5 | #![crate_type = "rlib"] | |
| 6 | #![feature(no_core)] | |
| 7 | #![no_core] | |
| 8 | ||
| 9 | // Test that when an inline assembly block specifies `readonly` but not `pure`, a detailed | |
| 10 | // `MemoryEffects` is provided to LLVM: this assembly block is not allowed to perform writes, | |
| 11 | // but it may have side-effects. | |
| 12 | ||
| 13 | extern crate minicore; | |
| 14 | use minicore::*; | |
| 15 | ||
| 16 | pub static mut VAR: i32 = 0; | |
| 17 | ||
| 18 | // CHECK-LABEL: @no_options | |
| 19 | // CHECK: call i32 asm | |
| 20 | #[no_mangle] | |
| 21 | pub unsafe fn no_options() -> i32 { | |
| 22 | VAR = 1; | |
| 23 | let _ignored: i32; | |
| 24 | asm!("mov {0}, 1", out(reg) _ignored); | |
| 25 | VAR | |
| 26 | } | |
| 27 | ||
| 28 | // CHECK-LABEL: @readonly_pure | |
| 29 | // CHECK-NOT: call i32 asm | |
| 30 | #[no_mangle] | |
| 31 | pub unsafe fn readonly_pure() -> i32 { | |
| 32 | VAR = 1; | |
| 33 | let _ignored: i32; | |
| 34 | asm!("mov {0}, 1", out(reg) _ignored, options(pure, readonly)); | |
| 35 | VAR | |
| 36 | } | |
| 37 | ||
| 38 | // CHECK-LABEL: @readonly_not_pure | |
| 39 | // CHECK: call i32 asm {{.*}} #[[ATTR:[0-9]+]] | |
| 40 | #[no_mangle] | |
| 41 | pub unsafe fn readonly_not_pure() -> i32 { | |
| 42 | VAR = 1; | |
| 43 | let _ignored: i32; | |
| 44 | asm!("mov {0}, 1", out(reg) _ignored, options(readonly)); | |
| 45 | VAR | |
| 46 | } | |
| 47 | ||
| 48 | // CHECK: attributes #[[ATTR]] = { nounwind memory(read, inaccessiblemem: readwrite) } |
tests/codegen-llvm/issues/cows-dont-have-branches-117763.rs created+17| ... | ... | @@ -0,0 +1,17 @@ |
| 1 | //@ compile-flags: -Copt-level=3 | |
| 2 | //@ needs-deterministic-layouts | |
| 3 | ||
| 4 | // Currently Vec<T> and &[T] have layouts that start with (pointer, len) | |
| 5 | // which makes the conversion branchless. | |
| 6 | // A nice-to-have property, not guaranteed. | |
| 7 | #![crate_type = "cdylib"] | |
| 8 | ||
| 9 | // CHECK-LABEL: @branchless_cow_slices | |
| 10 | #[no_mangle] | |
| 11 | pub fn branchless_cow_slices<'a>(cow: &'a std::borrow::Cow<'a, [u8]>) -> &'a [u8] { | |
| 12 | // CHECK-NOT: br | |
| 13 | // CHECK-NOT: select | |
| 14 | // CHECK-NOT: icmp | |
| 15 | // CHECK: ret { ptr, {{i32|i64}} } | |
| 16 | &*cow | |
| 17 | } |
tests/run-make/musl-default-linking/rmake.rs+1-2| ... | ... | @@ -4,7 +4,7 @@ use run_make_support::{rustc, serde_json}; |
| 4 | 4 | // Per https://github.com/rust-lang/compiler-team/issues/422, |
| 5 | 5 | // we should be trying to move these targets to dynamically link |
| 6 | 6 | // musl libc by default. |
| 7 | //@ needs-llvm-components: aarch64 arm mips powerpc x86 | |
| 7 | //@ needs-llvm-components: aarch64 arm powerpc x86 | |
| 8 | 8 | static LEGACY_STATIC_LINKING_TARGETS: &[&'static str] = &[ |
| 9 | 9 | "aarch64-unknown-linux-musl", |
| 10 | 10 | "arm-unknown-linux-musleabi", |
| ... | ... | @@ -14,7 +14,6 @@ static LEGACY_STATIC_LINKING_TARGETS: &[&'static str] = &[ |
| 14 | 14 | "armv7-unknown-linux-musleabihf", |
| 15 | 15 | "i586-unknown-linux-musl", |
| 16 | 16 | "i686-unknown-linux-musl", |
| 17 | "mips64el-unknown-linux-muslabi64", | |
| 18 | 17 | "powerpc64le-unknown-linux-musl", |
| 19 | 18 | "x86_64-unknown-linux-musl", |
| 20 | 19 | ]; |
tests/ui/asm/powerpc/bad-reg.aix64.stderr+123-39| ... | ... | @@ -28,74 +28,110 @@ error: invalid register `fp`: the frame pointer cannot be used as an operand for |
| 28 | 28 | LL | asm!("", out("fp") _); |
| 29 | 29 | | ^^^^^^^^^^^ |
| 30 | 30 | |
| 31 | error: invalid register `lr`: the link register cannot be used as an operand for inline asm | |
| 32 | --> $DIR/bad-reg.rs:48:18 | |
| 33 | | | |
| 34 | LL | asm!("", out("lr") _); | |
| 35 | | ^^^^^^^^^^^ | |
| 36 | ||
| 37 | error: invalid register `ctr`: the counter register cannot be used as an operand for inline asm | |
| 38 | --> $DIR/bad-reg.rs:50:18 | |
| 39 | | | |
| 40 | LL | asm!("", out("ctr") _); | |
| 41 | | ^^^^^^^^^^^^ | |
| 42 | ||
| 43 | 31 | error: invalid register `vrsave`: the vrsave register cannot be used as an operand for inline asm |
| 44 | --> $DIR/bad-reg.rs:52:18 | |
| 32 | --> $DIR/bad-reg.rs:48:18 | |
| 45 | 33 | | |
| 46 | 34 | LL | asm!("", out("vrsave") _); |
| 47 | 35 | | ^^^^^^^^^^^^^^^ |
| 48 | 36 | |
| 49 | 37 | error: register class `cr` can only be used as a clobber, not as an input or output |
| 50 | --> $DIR/bad-reg.rs:100:18 | |
| 38 | --> $DIR/bad-reg.rs:96:18 | |
| 51 | 39 | | |
| 52 | 40 | LL | asm!("", in("cr") x); |
| 53 | 41 | | ^^^^^^^^^^ |
| 54 | 42 | |
| 55 | 43 | error: register class `cr` can only be used as a clobber, not as an input or output |
| 56 | --> $DIR/bad-reg.rs:103:18 | |
| 44 | --> $DIR/bad-reg.rs:99:18 | |
| 57 | 45 | | |
| 58 | 46 | LL | asm!("", out("cr") x); |
| 59 | 47 | | ^^^^^^^^^^^ |
| 60 | 48 | |
| 61 | 49 | error: register class `cr` can only be used as a clobber, not as an input or output |
| 62 | --> $DIR/bad-reg.rs:106:26 | |
| 50 | --> $DIR/bad-reg.rs:102:26 | |
| 63 | 51 | | |
| 64 | 52 | LL | asm!("/* {} */", in(cr) x); |
| 65 | 53 | | ^^^^^^^^ |
| 66 | 54 | |
| 67 | 55 | error: register class `cr` can only be used as a clobber, not as an input or output |
| 68 | --> $DIR/bad-reg.rs:109:26 | |
| 56 | --> $DIR/bad-reg.rs:105:26 | |
| 69 | 57 | | |
| 70 | 58 | LL | asm!("/* {} */", out(cr) _); |
| 71 | 59 | | ^^^^^^^^^ |
| 72 | 60 | |
| 61 | error: register class `ctr` can only be used as a clobber, not as an input or output | |
| 62 | --> $DIR/bad-reg.rs:109:18 | |
| 63 | | | |
| 64 | LL | asm!("", in("ctr") x); | |
| 65 | | ^^^^^^^^^^^ | |
| 66 | ||
| 67 | error: register class `ctr` can only be used as a clobber, not as an input or output | |
| 68 | --> $DIR/bad-reg.rs:112:18 | |
| 69 | | | |
| 70 | LL | asm!("", out("ctr") x); | |
| 71 | | ^^^^^^^^^^^^ | |
| 72 | ||
| 73 | error: register class `ctr` can only be used as a clobber, not as an input or output | |
| 74 | --> $DIR/bad-reg.rs:115:26 | |
| 75 | | | |
| 76 | LL | asm!("/* {} */", in(ctr) x); | |
| 77 | | ^^^^^^^^^ | |
| 78 | ||
| 79 | error: register class `ctr` can only be used as a clobber, not as an input or output | |
| 80 | --> $DIR/bad-reg.rs:118:26 | |
| 81 | | | |
| 82 | LL | asm!("/* {} */", out(ctr) _); | |
| 83 | | ^^^^^^^^^^ | |
| 84 | ||
| 85 | error: register class `lr` can only be used as a clobber, not as an input or output | |
| 86 | --> $DIR/bad-reg.rs:122:18 | |
| 87 | | | |
| 88 | LL | asm!("", in("lr") x); | |
| 89 | | ^^^^^^^^^^ | |
| 90 | ||
| 91 | error: register class `lr` can only be used as a clobber, not as an input or output | |
| 92 | --> $DIR/bad-reg.rs:125:18 | |
| 93 | | | |
| 94 | LL | asm!("", out("lr") x); | |
| 95 | | ^^^^^^^^^^^ | |
| 96 | ||
| 97 | error: register class `lr` can only be used as a clobber, not as an input or output | |
| 98 | --> $DIR/bad-reg.rs:128:26 | |
| 99 | | | |
| 100 | LL | asm!("/* {} */", in(lr) x); | |
| 101 | | ^^^^^^^^ | |
| 102 | ||
| 103 | error: register class `lr` can only be used as a clobber, not as an input or output | |
| 104 | --> $DIR/bad-reg.rs:131:26 | |
| 105 | | | |
| 106 | LL | asm!("/* {} */", out(lr) _); | |
| 107 | | ^^^^^^^^^ | |
| 108 | ||
| 73 | 109 | error: register class `xer` can only be used as a clobber, not as an input or output |
| 74 | --> $DIR/bad-reg.rs:113:18 | |
| 110 | --> $DIR/bad-reg.rs:135:18 | |
| 75 | 111 | | |
| 76 | 112 | LL | asm!("", in("xer") x); |
| 77 | 113 | | ^^^^^^^^^^^ |
| 78 | 114 | |
| 79 | 115 | error: register class `xer` can only be used as a clobber, not as an input or output |
| 80 | --> $DIR/bad-reg.rs:116:18 | |
| 116 | --> $DIR/bad-reg.rs:138:18 | |
| 81 | 117 | | |
| 82 | 118 | LL | asm!("", out("xer") x); |
| 83 | 119 | | ^^^^^^^^^^^^ |
| 84 | 120 | |
| 85 | 121 | error: register class `xer` can only be used as a clobber, not as an input or output |
| 86 | --> $DIR/bad-reg.rs:119:26 | |
| 122 | --> $DIR/bad-reg.rs:141:26 | |
| 87 | 123 | | |
| 88 | 124 | LL | asm!("/* {} */", in(xer) x); |
| 89 | 125 | | ^^^^^^^^^ |
| 90 | 126 | |
| 91 | 127 | error: register class `xer` can only be used as a clobber, not as an input or output |
| 92 | --> $DIR/bad-reg.rs:122:26 | |
| 128 | --> $DIR/bad-reg.rs:144:26 | |
| 93 | 129 | | |
| 94 | 130 | LL | asm!("/* {} */", out(xer) _); |
| 95 | 131 | | ^^^^^^^^^^ |
| 96 | 132 | |
| 97 | 133 | error: register `cr0` conflicts with register `cr` |
| 98 | --> $DIR/bad-reg.rs:126:31 | |
| 134 | --> $DIR/bad-reg.rs:148:31 | |
| 99 | 135 | | |
| 100 | 136 | LL | asm!("", out("cr") _, out("cr0") _); |
| 101 | 137 | | ----------- ^^^^^^^^^^^^ register `cr0` |
| ... | ... | @@ -103,7 +139,7 @@ LL | asm!("", out("cr") _, out("cr0") _); |
| 103 | 139 | | register `cr` |
| 104 | 140 | |
| 105 | 141 | error: register `cr1` conflicts with register `cr` |
| 106 | --> $DIR/bad-reg.rs:128:31 | |
| 142 | --> $DIR/bad-reg.rs:150:31 | |
| 107 | 143 | | |
| 108 | 144 | LL | asm!("", out("cr") _, out("cr1") _); |
| 109 | 145 | | ----------- ^^^^^^^^^^^^ register `cr1` |
| ... | ... | @@ -111,7 +147,7 @@ LL | asm!("", out("cr") _, out("cr1") _); |
| 111 | 147 | | register `cr` |
| 112 | 148 | |
| 113 | 149 | error: register `cr2` conflicts with register `cr` |
| 114 | --> $DIR/bad-reg.rs:130:31 | |
| 150 | --> $DIR/bad-reg.rs:152:31 | |
| 115 | 151 | | |
| 116 | 152 | LL | asm!("", out("cr") _, out("cr2") _); |
| 117 | 153 | | ----------- ^^^^^^^^^^^^ register `cr2` |
| ... | ... | @@ -119,7 +155,7 @@ LL | asm!("", out("cr") _, out("cr2") _); |
| 119 | 155 | | register `cr` |
| 120 | 156 | |
| 121 | 157 | error: register `cr3` conflicts with register `cr` |
| 122 | --> $DIR/bad-reg.rs:132:31 | |
| 158 | --> $DIR/bad-reg.rs:154:31 | |
| 123 | 159 | | |
| 124 | 160 | LL | asm!("", out("cr") _, out("cr3") _); |
| 125 | 161 | | ----------- ^^^^^^^^^^^^ register `cr3` |
| ... | ... | @@ -127,7 +163,7 @@ LL | asm!("", out("cr") _, out("cr3") _); |
| 127 | 163 | | register `cr` |
| 128 | 164 | |
| 129 | 165 | error: register `cr4` conflicts with register `cr` |
| 130 | --> $DIR/bad-reg.rs:134:31 | |
| 166 | --> $DIR/bad-reg.rs:156:31 | |
| 131 | 167 | | |
| 132 | 168 | LL | asm!("", out("cr") _, out("cr4") _); |
| 133 | 169 | | ----------- ^^^^^^^^^^^^ register `cr4` |
| ... | ... | @@ -135,7 +171,7 @@ LL | asm!("", out("cr") _, out("cr4") _); |
| 135 | 171 | | register `cr` |
| 136 | 172 | |
| 137 | 173 | error: register `cr5` conflicts with register `cr` |
| 138 | --> $DIR/bad-reg.rs:136:31 | |
| 174 | --> $DIR/bad-reg.rs:158:31 | |
| 139 | 175 | | |
| 140 | 176 | LL | asm!("", out("cr") _, out("cr5") _); |
| 141 | 177 | | ----------- ^^^^^^^^^^^^ register `cr5` |
| ... | ... | @@ -143,7 +179,7 @@ LL | asm!("", out("cr") _, out("cr5") _); |
| 143 | 179 | | register `cr` |
| 144 | 180 | |
| 145 | 181 | error: register `cr6` conflicts with register `cr` |
| 146 | --> $DIR/bad-reg.rs:138:31 | |
| 182 | --> $DIR/bad-reg.rs:160:31 | |
| 147 | 183 | | |
| 148 | 184 | LL | asm!("", out("cr") _, out("cr6") _); |
| 149 | 185 | | ----------- ^^^^^^^^^^^^ register `cr6` |
| ... | ... | @@ -151,7 +187,7 @@ LL | asm!("", out("cr") _, out("cr6") _); |
| 151 | 187 | | register `cr` |
| 152 | 188 | |
| 153 | 189 | error: register `cr7` conflicts with register `cr` |
| 154 | --> $DIR/bad-reg.rs:140:31 | |
| 190 | --> $DIR/bad-reg.rs:162:31 | |
| 155 | 191 | | |
| 156 | 192 | LL | asm!("", out("cr") _, out("cr7") _); |
| 157 | 193 | | ----------- ^^^^^^^^^^^^ register `cr7` |
| ... | ... | @@ -165,7 +201,7 @@ LL | asm!("", out("r13") _); |
| 165 | 201 | | ^^^^^^^^^^^^ |
| 166 | 202 | |
| 167 | 203 | error: type `i32` cannot be used with this register class |
| 168 | --> $DIR/bad-reg.rs:67:27 | |
| 204 | --> $DIR/bad-reg.rs:63:27 | |
| 169 | 205 | | |
| 170 | 206 | LL | asm!("", in("v0") x); // FIXME: should be ok if vsx is available |
| 171 | 207 | | ^ |
| ... | ... | @@ -173,7 +209,7 @@ LL | asm!("", in("v0") x); // FIXME: should be ok if vsx is available |
| 173 | 209 | = note: register class `vreg` supports these types: i8x16, i16x8, i32x4, f32x4, f32, f64, i64x2, f64x2 |
| 174 | 210 | |
| 175 | 211 | error: type `i32` cannot be used with this register class |
| 176 | --> $DIR/bad-reg.rs:70:28 | |
| 212 | --> $DIR/bad-reg.rs:66:28 | |
| 177 | 213 | | |
| 178 | 214 | LL | asm!("", out("v0") x); // FIXME: should be ok if vsx is available |
| 179 | 215 | | ^ |
| ... | ... | @@ -181,7 +217,7 @@ LL | asm!("", out("v0") x); // FIXME: should be ok if vsx is available |
| 181 | 217 | = note: register class `vreg` supports these types: i8x16, i16x8, i32x4, f32x4, f32, f64, i64x2, f64x2 |
| 182 | 218 | |
| 183 | 219 | error: type `i32` cannot be used with this register class |
| 184 | --> $DIR/bad-reg.rs:78:35 | |
| 220 | --> $DIR/bad-reg.rs:74:35 | |
| 185 | 221 | | |
| 186 | 222 | LL | asm!("/* {} */", in(vreg) x); // FIXME: should be ok if vsx is available |
| 187 | 223 | | ^ |
| ... | ... | @@ -189,7 +225,7 @@ LL | asm!("/* {} */", in(vreg) x); // FIXME: should be ok if vsx is avai |
| 189 | 225 | = note: register class `vreg` supports these types: i8x16, i16x8, i32x4, f32x4, f32, f64, i64x2, f64x2 |
| 190 | 226 | |
| 191 | 227 | error: type `i32` cannot be used with this register class |
| 192 | --> $DIR/bad-reg.rs:100:27 | |
| 228 | --> $DIR/bad-reg.rs:96:27 | |
| 193 | 229 | | |
| 194 | 230 | LL | asm!("", in("cr") x); |
| 195 | 231 | | ^ |
| ... | ... | @@ -197,7 +233,7 @@ LL | asm!("", in("cr") x); |
| 197 | 233 | = note: register class `cr` supports these types: |
| 198 | 234 | |
| 199 | 235 | error: type `i32` cannot be used with this register class |
| 200 | --> $DIR/bad-reg.rs:103:28 | |
| 236 | --> $DIR/bad-reg.rs:99:28 | |
| 201 | 237 | | |
| 202 | 238 | LL | asm!("", out("cr") x); |
| 203 | 239 | | ^ |
| ... | ... | @@ -205,7 +241,7 @@ LL | asm!("", out("cr") x); |
| 205 | 241 | = note: register class `cr` supports these types: |
| 206 | 242 | |
| 207 | 243 | error: type `i32` cannot be used with this register class |
| 208 | --> $DIR/bad-reg.rs:106:33 | |
| 244 | --> $DIR/bad-reg.rs:102:33 | |
| 209 | 245 | | |
| 210 | 246 | LL | asm!("/* {} */", in(cr) x); |
| 211 | 247 | | ^ |
| ... | ... | @@ -213,7 +249,55 @@ LL | asm!("/* {} */", in(cr) x); |
| 213 | 249 | = note: register class `cr` supports these types: |
| 214 | 250 | |
| 215 | 251 | error: type `i32` cannot be used with this register class |
| 216 | --> $DIR/bad-reg.rs:113:28 | |
| 252 | --> $DIR/bad-reg.rs:109:28 | |
| 253 | | | |
| 254 | LL | asm!("", in("ctr") x); | |
| 255 | | ^ | |
| 256 | | | |
| 257 | = note: register class `ctr` supports these types: | |
| 258 | ||
| 259 | error: type `i32` cannot be used with this register class | |
| 260 | --> $DIR/bad-reg.rs:112:29 | |
| 261 | | | |
| 262 | LL | asm!("", out("ctr") x); | |
| 263 | | ^ | |
| 264 | | | |
| 265 | = note: register class `ctr` supports these types: | |
| 266 | ||
| 267 | error: type `i32` cannot be used with this register class | |
| 268 | --> $DIR/bad-reg.rs:115:34 | |
| 269 | | | |
| 270 | LL | asm!("/* {} */", in(ctr) x); | |
| 271 | | ^ | |
| 272 | | | |
| 273 | = note: register class `ctr` supports these types: | |
| 274 | ||
| 275 | error: type `i32` cannot be used with this register class | |
| 276 | --> $DIR/bad-reg.rs:122:27 | |
| 277 | | | |
| 278 | LL | asm!("", in("lr") x); | |
| 279 | | ^ | |
| 280 | | | |
| 281 | = note: register class `lr` supports these types: | |
| 282 | ||
| 283 | error: type `i32` cannot be used with this register class | |
| 284 | --> $DIR/bad-reg.rs:125:28 | |
| 285 | | | |
| 286 | LL | asm!("", out("lr") x); | |
| 287 | | ^ | |
| 288 | | | |
| 289 | = note: register class `lr` supports these types: | |
| 290 | ||
| 291 | error: type `i32` cannot be used with this register class | |
| 292 | --> $DIR/bad-reg.rs:128:33 | |
| 293 | | | |
| 294 | LL | asm!("/* {} */", in(lr) x); | |
| 295 | | ^ | |
| 296 | | | |
| 297 | = note: register class `lr` supports these types: | |
| 298 | ||
| 299 | error: type `i32` cannot be used with this register class | |
| 300 | --> $DIR/bad-reg.rs:135:28 | |
| 217 | 301 | | |
| 218 | 302 | LL | asm!("", in("xer") x); |
| 219 | 303 | | ^ |
| ... | ... | @@ -221,7 +305,7 @@ LL | asm!("", in("xer") x); |
| 221 | 305 | = note: register class `xer` supports these types: |
| 222 | 306 | |
| 223 | 307 | error: type `i32` cannot be used with this register class |
| 224 | --> $DIR/bad-reg.rs:116:29 | |
| 308 | --> $DIR/bad-reg.rs:138:29 | |
| 225 | 309 | | |
| 226 | 310 | LL | asm!("", out("xer") x); |
| 227 | 311 | | ^ |
| ... | ... | @@ -229,12 +313,12 @@ LL | asm!("", out("xer") x); |
| 229 | 313 | = note: register class `xer` supports these types: |
| 230 | 314 | |
| 231 | 315 | error: type `i32` cannot be used with this register class |
| 232 | --> $DIR/bad-reg.rs:119:34 | |
| 316 | --> $DIR/bad-reg.rs:141:34 | |
| 233 | 317 | | |
| 234 | 318 | LL | asm!("/* {} */", in(xer) x); |
| 235 | 319 | | ^ |
| 236 | 320 | | |
| 237 | 321 | = note: register class `xer` supports these types: |
| 238 | 322 | |
| 239 | error: aborting due to 34 previous errors | |
| 323 | error: aborting due to 46 previous errors | |
| 240 | 324 |
tests/ui/asm/powerpc/bad-reg.powerpc.stderr+130-46| ... | ... | @@ -28,74 +28,110 @@ error: invalid register `fp`: the frame pointer cannot be used as an operand for |
| 28 | 28 | LL | asm!("", out("fp") _); |
| 29 | 29 | | ^^^^^^^^^^^ |
| 30 | 30 | |
| 31 | error: invalid register `lr`: the link register cannot be used as an operand for inline asm | |
| 32 | --> $DIR/bad-reg.rs:48:18 | |
| 33 | | | |
| 34 | LL | asm!("", out("lr") _); | |
| 35 | | ^^^^^^^^^^^ | |
| 36 | ||
| 37 | error: invalid register `ctr`: the counter register cannot be used as an operand for inline asm | |
| 38 | --> $DIR/bad-reg.rs:50:18 | |
| 39 | | | |
| 40 | LL | asm!("", out("ctr") _); | |
| 41 | | ^^^^^^^^^^^^ | |
| 42 | ||
| 43 | 31 | error: invalid register `vrsave`: the vrsave register cannot be used as an operand for inline asm |
| 44 | --> $DIR/bad-reg.rs:52:18 | |
| 32 | --> $DIR/bad-reg.rs:48:18 | |
| 45 | 33 | | |
| 46 | 34 | LL | asm!("", out("vrsave") _); |
| 47 | 35 | | ^^^^^^^^^^^^^^^ |
| 48 | 36 | |
| 49 | 37 | error: register class `cr` can only be used as a clobber, not as an input or output |
| 50 | --> $DIR/bad-reg.rs:100:18 | |
| 38 | --> $DIR/bad-reg.rs:96:18 | |
| 51 | 39 | | |
| 52 | 40 | LL | asm!("", in("cr") x); |
| 53 | 41 | | ^^^^^^^^^^ |
| 54 | 42 | |
| 55 | 43 | error: register class `cr` can only be used as a clobber, not as an input or output |
| 56 | --> $DIR/bad-reg.rs:103:18 | |
| 44 | --> $DIR/bad-reg.rs:99:18 | |
| 57 | 45 | | |
| 58 | 46 | LL | asm!("", out("cr") x); |
| 59 | 47 | | ^^^^^^^^^^^ |
| 60 | 48 | |
| 61 | 49 | error: register class `cr` can only be used as a clobber, not as an input or output |
| 62 | --> $DIR/bad-reg.rs:106:26 | |
| 50 | --> $DIR/bad-reg.rs:102:26 | |
| 63 | 51 | | |
| 64 | 52 | LL | asm!("/* {} */", in(cr) x); |
| 65 | 53 | | ^^^^^^^^ |
| 66 | 54 | |
| 67 | 55 | error: register class `cr` can only be used as a clobber, not as an input or output |
| 68 | --> $DIR/bad-reg.rs:109:26 | |
| 56 | --> $DIR/bad-reg.rs:105:26 | |
| 69 | 57 | | |
| 70 | 58 | LL | asm!("/* {} */", out(cr) _); |
| 71 | 59 | | ^^^^^^^^^ |
| 72 | 60 | |
| 61 | error: register class `ctr` can only be used as a clobber, not as an input or output | |
| 62 | --> $DIR/bad-reg.rs:109:18 | |
| 63 | | | |
| 64 | LL | asm!("", in("ctr") x); | |
| 65 | | ^^^^^^^^^^^ | |
| 66 | ||
| 67 | error: register class `ctr` can only be used as a clobber, not as an input or output | |
| 68 | --> $DIR/bad-reg.rs:112:18 | |
| 69 | | | |
| 70 | LL | asm!("", out("ctr") x); | |
| 71 | | ^^^^^^^^^^^^ | |
| 72 | ||
| 73 | error: register class `ctr` can only be used as a clobber, not as an input or output | |
| 74 | --> $DIR/bad-reg.rs:115:26 | |
| 75 | | | |
| 76 | LL | asm!("/* {} */", in(ctr) x); | |
| 77 | | ^^^^^^^^^ | |
| 78 | ||
| 79 | error: register class `ctr` can only be used as a clobber, not as an input or output | |
| 80 | --> $DIR/bad-reg.rs:118:26 | |
| 81 | | | |
| 82 | LL | asm!("/* {} */", out(ctr) _); | |
| 83 | | ^^^^^^^^^^ | |
| 84 | ||
| 85 | error: register class `lr` can only be used as a clobber, not as an input or output | |
| 86 | --> $DIR/bad-reg.rs:122:18 | |
| 87 | | | |
| 88 | LL | asm!("", in("lr") x); | |
| 89 | | ^^^^^^^^^^ | |
| 90 | ||
| 91 | error: register class `lr` can only be used as a clobber, not as an input or output | |
| 92 | --> $DIR/bad-reg.rs:125:18 | |
| 93 | | | |
| 94 | LL | asm!("", out("lr") x); | |
| 95 | | ^^^^^^^^^^^ | |
| 96 | ||
| 97 | error: register class `lr` can only be used as a clobber, not as an input or output | |
| 98 | --> $DIR/bad-reg.rs:128:26 | |
| 99 | | | |
| 100 | LL | asm!("/* {} */", in(lr) x); | |
| 101 | | ^^^^^^^^ | |
| 102 | ||
| 103 | error: register class `lr` can only be used as a clobber, not as an input or output | |
| 104 | --> $DIR/bad-reg.rs:131:26 | |
| 105 | | | |
| 106 | LL | asm!("/* {} */", out(lr) _); | |
| 107 | | ^^^^^^^^^ | |
| 108 | ||
| 73 | 109 | error: register class `xer` can only be used as a clobber, not as an input or output |
| 74 | --> $DIR/bad-reg.rs:113:18 | |
| 110 | --> $DIR/bad-reg.rs:135:18 | |
| 75 | 111 | | |
| 76 | 112 | LL | asm!("", in("xer") x); |
| 77 | 113 | | ^^^^^^^^^^^ |
| 78 | 114 | |
| 79 | 115 | error: register class `xer` can only be used as a clobber, not as an input or output |
| 80 | --> $DIR/bad-reg.rs:116:18 | |
| 116 | --> $DIR/bad-reg.rs:138:18 | |
| 81 | 117 | | |
| 82 | 118 | LL | asm!("", out("xer") x); |
| 83 | 119 | | ^^^^^^^^^^^^ |
| 84 | 120 | |
| 85 | 121 | error: register class `xer` can only be used as a clobber, not as an input or output |
| 86 | --> $DIR/bad-reg.rs:119:26 | |
| 122 | --> $DIR/bad-reg.rs:141:26 | |
| 87 | 123 | | |
| 88 | 124 | LL | asm!("/* {} */", in(xer) x); |
| 89 | 125 | | ^^^^^^^^^ |
| 90 | 126 | |
| 91 | 127 | error: register class `xer` can only be used as a clobber, not as an input or output |
| 92 | --> $DIR/bad-reg.rs:122:26 | |
| 128 | --> $DIR/bad-reg.rs:144:26 | |
| 93 | 129 | | |
| 94 | 130 | LL | asm!("/* {} */", out(xer) _); |
| 95 | 131 | | ^^^^^^^^^^ |
| 96 | 132 | |
| 97 | 133 | error: register `cr0` conflicts with register `cr` |
| 98 | --> $DIR/bad-reg.rs:126:31 | |
| 134 | --> $DIR/bad-reg.rs:148:31 | |
| 99 | 135 | | |
| 100 | 136 | LL | asm!("", out("cr") _, out("cr0") _); |
| 101 | 137 | | ----------- ^^^^^^^^^^^^ register `cr0` |
| ... | ... | @@ -103,7 +139,7 @@ LL | asm!("", out("cr") _, out("cr0") _); |
| 103 | 139 | | register `cr` |
| 104 | 140 | |
| 105 | 141 | error: register `cr1` conflicts with register `cr` |
| 106 | --> $DIR/bad-reg.rs:128:31 | |
| 142 | --> $DIR/bad-reg.rs:150:31 | |
| 107 | 143 | | |
| 108 | 144 | LL | asm!("", out("cr") _, out("cr1") _); |
| 109 | 145 | | ----------- ^^^^^^^^^^^^ register `cr1` |
| ... | ... | @@ -111,7 +147,7 @@ LL | asm!("", out("cr") _, out("cr1") _); |
| 111 | 147 | | register `cr` |
| 112 | 148 | |
| 113 | 149 | error: register `cr2` conflicts with register `cr` |
| 114 | --> $DIR/bad-reg.rs:130:31 | |
| 150 | --> $DIR/bad-reg.rs:152:31 | |
| 115 | 151 | | |
| 116 | 152 | LL | asm!("", out("cr") _, out("cr2") _); |
| 117 | 153 | | ----------- ^^^^^^^^^^^^ register `cr2` |
| ... | ... | @@ -119,7 +155,7 @@ LL | asm!("", out("cr") _, out("cr2") _); |
| 119 | 155 | | register `cr` |
| 120 | 156 | |
| 121 | 157 | error: register `cr3` conflicts with register `cr` |
| 122 | --> $DIR/bad-reg.rs:132:31 | |
| 158 | --> $DIR/bad-reg.rs:154:31 | |
| 123 | 159 | | |
| 124 | 160 | LL | asm!("", out("cr") _, out("cr3") _); |
| 125 | 161 | | ----------- ^^^^^^^^^^^^ register `cr3` |
| ... | ... | @@ -127,7 +163,7 @@ LL | asm!("", out("cr") _, out("cr3") _); |
| 127 | 163 | | register `cr` |
| 128 | 164 | |
| 129 | 165 | error: register `cr4` conflicts with register `cr` |
| 130 | --> $DIR/bad-reg.rs:134:31 | |
| 166 | --> $DIR/bad-reg.rs:156:31 | |
| 131 | 167 | | |
| 132 | 168 | LL | asm!("", out("cr") _, out("cr4") _); |
| 133 | 169 | | ----------- ^^^^^^^^^^^^ register `cr4` |
| ... | ... | @@ -135,7 +171,7 @@ LL | asm!("", out("cr") _, out("cr4") _); |
| 135 | 171 | | register `cr` |
| 136 | 172 | |
| 137 | 173 | error: register `cr5` conflicts with register `cr` |
| 138 | --> $DIR/bad-reg.rs:136:31 | |
| 174 | --> $DIR/bad-reg.rs:158:31 | |
| 139 | 175 | | |
| 140 | 176 | LL | asm!("", out("cr") _, out("cr5") _); |
| 141 | 177 | | ----------- ^^^^^^^^^^^^ register `cr5` |
| ... | ... | @@ -143,7 +179,7 @@ LL | asm!("", out("cr") _, out("cr5") _); |
| 143 | 179 | | register `cr` |
| 144 | 180 | |
| 145 | 181 | error: register `cr6` conflicts with register `cr` |
| 146 | --> $DIR/bad-reg.rs:138:31 | |
| 182 | --> $DIR/bad-reg.rs:160:31 | |
| 147 | 183 | | |
| 148 | 184 | LL | asm!("", out("cr") _, out("cr6") _); |
| 149 | 185 | | ----------- ^^^^^^^^^^^^ register `cr6` |
| ... | ... | @@ -151,7 +187,7 @@ LL | asm!("", out("cr") _, out("cr6") _); |
| 151 | 187 | | register `cr` |
| 152 | 188 | |
| 153 | 189 | error: register `cr7` conflicts with register `cr` |
| 154 | --> $DIR/bad-reg.rs:140:31 | |
| 190 | --> $DIR/bad-reg.rs:162:31 | |
| 155 | 191 | | |
| 156 | 192 | LL | asm!("", out("cr") _, out("cr7") _); |
| 157 | 193 | | ----------- ^^^^^^^^^^^^ register `cr7` |
| ... | ... | @@ -165,67 +201,67 @@ LL | asm!("", out("r13") _); |
| 165 | 201 | | ^^^^^^^^^^^^ |
| 166 | 202 | |
| 167 | 203 | error: register class `vreg` requires at least one of the following target features: altivec, vsx |
| 168 | --> $DIR/bad-reg.rs:57:18 | |
| 204 | --> $DIR/bad-reg.rs:53:18 | |
| 169 | 205 | | |
| 170 | 206 | LL | asm!("", in("v0") v32x4); // requires altivec |
| 171 | 207 | | ^^^^^^^^^^^^^^ |
| 172 | 208 | |
| 173 | 209 | error: register class `vreg` requires at least one of the following target features: altivec, vsx |
| 174 | --> $DIR/bad-reg.rs:59:18 | |
| 210 | --> $DIR/bad-reg.rs:55:18 | |
| 175 | 211 | | |
| 176 | 212 | LL | asm!("", out("v0") v32x4); // requires altivec |
| 177 | 213 | | ^^^^^^^^^^^^^^^ |
| 178 | 214 | |
| 179 | 215 | error: register class `vreg` requires at least one of the following target features: altivec, vsx |
| 180 | --> $DIR/bad-reg.rs:61:18 | |
| 216 | --> $DIR/bad-reg.rs:57:18 | |
| 181 | 217 | | |
| 182 | 218 | LL | asm!("", in("v0") v64x2); // requires vsx |
| 183 | 219 | | ^^^^^^^^^^^^^^ |
| 184 | 220 | |
| 185 | 221 | error: register class `vreg` requires at least one of the following target features: altivec, vsx |
| 186 | --> $DIR/bad-reg.rs:64:18 | |
| 222 | --> $DIR/bad-reg.rs:60:18 | |
| 187 | 223 | | |
| 188 | 224 | LL | asm!("", out("v0") v64x2); // requires vsx |
| 189 | 225 | | ^^^^^^^^^^^^^^^ |
| 190 | 226 | |
| 191 | 227 | error: register class `vreg` requires at least one of the following target features: altivec, vsx |
| 192 | --> $DIR/bad-reg.rs:67:18 | |
| 228 | --> $DIR/bad-reg.rs:63:18 | |
| 193 | 229 | | |
| 194 | 230 | LL | asm!("", in("v0") x); // FIXME: should be ok if vsx is available |
| 195 | 231 | | ^^^^^^^^^^ |
| 196 | 232 | |
| 197 | 233 | error: register class `vreg` requires at least one of the following target features: altivec, vsx |
| 198 | --> $DIR/bad-reg.rs:70:18 | |
| 234 | --> $DIR/bad-reg.rs:66:18 | |
| 199 | 235 | | |
| 200 | 236 | LL | asm!("", out("v0") x); // FIXME: should be ok if vsx is available |
| 201 | 237 | | ^^^^^^^^^^^ |
| 202 | 238 | |
| 203 | 239 | error: register class `vreg` requires at least one of the following target features: altivec, vsx |
| 204 | --> $DIR/bad-reg.rs:73:26 | |
| 240 | --> $DIR/bad-reg.rs:69:26 | |
| 205 | 241 | | |
| 206 | 242 | LL | asm!("/* {} */", in(vreg) v32x4); // requires altivec |
| 207 | 243 | | ^^^^^^^^^^^^^^ |
| 208 | 244 | |
| 209 | 245 | error: register class `vreg` requires at least one of the following target features: altivec, vsx |
| 210 | --> $DIR/bad-reg.rs:75:26 | |
| 246 | --> $DIR/bad-reg.rs:71:26 | |
| 211 | 247 | | |
| 212 | 248 | LL | asm!("/* {} */", in(vreg) v64x2); // requires vsx |
| 213 | 249 | | ^^^^^^^^^^^^^^ |
| 214 | 250 | |
| 215 | 251 | error: register class `vreg` requires at least one of the following target features: altivec, vsx |
| 216 | --> $DIR/bad-reg.rs:78:26 | |
| 252 | --> $DIR/bad-reg.rs:74:26 | |
| 217 | 253 | | |
| 218 | 254 | LL | asm!("/* {} */", in(vreg) x); // FIXME: should be ok if vsx is available |
| 219 | 255 | | ^^^^^^^^^^ |
| 220 | 256 | |
| 221 | 257 | error: register class `vreg` requires at least one of the following target features: altivec, vsx |
| 222 | --> $DIR/bad-reg.rs:81:26 | |
| 258 | --> $DIR/bad-reg.rs:77:26 | |
| 223 | 259 | | |
| 224 | 260 | LL | asm!("/* {} */", out(vreg) _); // requires altivec |
| 225 | 261 | | ^^^^^^^^^^^ |
| 226 | 262 | |
| 227 | 263 | error: type `i32` cannot be used with this register class |
| 228 | --> $DIR/bad-reg.rs:100:27 | |
| 264 | --> $DIR/bad-reg.rs:96:27 | |
| 229 | 265 | | |
| 230 | 266 | LL | asm!("", in("cr") x); |
| 231 | 267 | | ^ |
| ... | ... | @@ -233,7 +269,7 @@ LL | asm!("", in("cr") x); |
| 233 | 269 | = note: register class `cr` supports these types: |
| 234 | 270 | |
| 235 | 271 | error: type `i32` cannot be used with this register class |
| 236 | --> $DIR/bad-reg.rs:103:28 | |
| 272 | --> $DIR/bad-reg.rs:99:28 | |
| 237 | 273 | | |
| 238 | 274 | LL | asm!("", out("cr") x); |
| 239 | 275 | | ^ |
| ... | ... | @@ -241,7 +277,7 @@ LL | asm!("", out("cr") x); |
| 241 | 277 | = note: register class `cr` supports these types: |
| 242 | 278 | |
| 243 | 279 | error: type `i32` cannot be used with this register class |
| 244 | --> $DIR/bad-reg.rs:106:33 | |
| 280 | --> $DIR/bad-reg.rs:102:33 | |
| 245 | 281 | | |
| 246 | 282 | LL | asm!("/* {} */", in(cr) x); |
| 247 | 283 | | ^ |
| ... | ... | @@ -249,7 +285,55 @@ LL | asm!("/* {} */", in(cr) x); |
| 249 | 285 | = note: register class `cr` supports these types: |
| 250 | 286 | |
| 251 | 287 | error: type `i32` cannot be used with this register class |
| 252 | --> $DIR/bad-reg.rs:113:28 | |
| 288 | --> $DIR/bad-reg.rs:109:28 | |
| 289 | | | |
| 290 | LL | asm!("", in("ctr") x); | |
| 291 | | ^ | |
| 292 | | | |
| 293 | = note: register class `ctr` supports these types: | |
| 294 | ||
| 295 | error: type `i32` cannot be used with this register class | |
| 296 | --> $DIR/bad-reg.rs:112:29 | |
| 297 | | | |
| 298 | LL | asm!("", out("ctr") x); | |
| 299 | | ^ | |
| 300 | | | |
| 301 | = note: register class `ctr` supports these types: | |
| 302 | ||
| 303 | error: type `i32` cannot be used with this register class | |
| 304 | --> $DIR/bad-reg.rs:115:34 | |
| 305 | | | |
| 306 | LL | asm!("/* {} */", in(ctr) x); | |
| 307 | | ^ | |
| 308 | | | |
| 309 | = note: register class `ctr` supports these types: | |
| 310 | ||
| 311 | error: type `i32` cannot be used with this register class | |
| 312 | --> $DIR/bad-reg.rs:122:27 | |
| 313 | | | |
| 314 | LL | asm!("", in("lr") x); | |
| 315 | | ^ | |
| 316 | | | |
| 317 | = note: register class `lr` supports these types: | |
| 318 | ||
| 319 | error: type `i32` cannot be used with this register class | |
| 320 | --> $DIR/bad-reg.rs:125:28 | |
| 321 | | | |
| 322 | LL | asm!("", out("lr") x); | |
| 323 | | ^ | |
| 324 | | | |
| 325 | = note: register class `lr` supports these types: | |
| 326 | ||
| 327 | error: type `i32` cannot be used with this register class | |
| 328 | --> $DIR/bad-reg.rs:128:33 | |
| 329 | | | |
| 330 | LL | asm!("/* {} */", in(lr) x); | |
| 331 | | ^ | |
| 332 | | | |
| 333 | = note: register class `lr` supports these types: | |
| 334 | ||
| 335 | error: type `i32` cannot be used with this register class | |
| 336 | --> $DIR/bad-reg.rs:135:28 | |
| 253 | 337 | | |
| 254 | 338 | LL | asm!("", in("xer") x); |
| 255 | 339 | | ^ |
| ... | ... | @@ -257,7 +341,7 @@ LL | asm!("", in("xer") x); |
| 257 | 341 | = note: register class `xer` supports these types: |
| 258 | 342 | |
| 259 | 343 | error: type `i32` cannot be used with this register class |
| 260 | --> $DIR/bad-reg.rs:116:29 | |
| 344 | --> $DIR/bad-reg.rs:138:29 | |
| 261 | 345 | | |
| 262 | 346 | LL | asm!("", out("xer") x); |
| 263 | 347 | | ^ |
| ... | ... | @@ -265,12 +349,12 @@ LL | asm!("", out("xer") x); |
| 265 | 349 | = note: register class `xer` supports these types: |
| 266 | 350 | |
| 267 | 351 | error: type `i32` cannot be used with this register class |
| 268 | --> $DIR/bad-reg.rs:119:34 | |
| 352 | --> $DIR/bad-reg.rs:141:34 | |
| 269 | 353 | | |
| 270 | 354 | LL | asm!("/* {} */", in(xer) x); |
| 271 | 355 | | ^ |
| 272 | 356 | | |
| 273 | 357 | = note: register class `xer` supports these types: |
| 274 | 358 | |
| 275 | error: aborting due to 41 previous errors | |
| 359 | error: aborting due to 53 previous errors | |
| 276 | 360 |
tests/ui/asm/powerpc/bad-reg.powerpc64.stderr+126-42| ... | ... | @@ -28,74 +28,110 @@ error: invalid register `fp`: the frame pointer cannot be used as an operand for |
| 28 | 28 | LL | asm!("", out("fp") _); |
| 29 | 29 | | ^^^^^^^^^^^ |
| 30 | 30 | |
| 31 | error: invalid register `lr`: the link register cannot be used as an operand for inline asm | |
| 32 | --> $DIR/bad-reg.rs:48:18 | |
| 33 | | | |
| 34 | LL | asm!("", out("lr") _); | |
| 35 | | ^^^^^^^^^^^ | |
| 36 | ||
| 37 | error: invalid register `ctr`: the counter register cannot be used as an operand for inline asm | |
| 38 | --> $DIR/bad-reg.rs:50:18 | |
| 39 | | | |
| 40 | LL | asm!("", out("ctr") _); | |
| 41 | | ^^^^^^^^^^^^ | |
| 42 | ||
| 43 | 31 | error: invalid register `vrsave`: the vrsave register cannot be used as an operand for inline asm |
| 44 | --> $DIR/bad-reg.rs:52:18 | |
| 32 | --> $DIR/bad-reg.rs:48:18 | |
| 45 | 33 | | |
| 46 | 34 | LL | asm!("", out("vrsave") _); |
| 47 | 35 | | ^^^^^^^^^^^^^^^ |
| 48 | 36 | |
| 49 | 37 | error: register class `cr` can only be used as a clobber, not as an input or output |
| 50 | --> $DIR/bad-reg.rs:100:18 | |
| 38 | --> $DIR/bad-reg.rs:96:18 | |
| 51 | 39 | | |
| 52 | 40 | LL | asm!("", in("cr") x); |
| 53 | 41 | | ^^^^^^^^^^ |
| 54 | 42 | |
| 55 | 43 | error: register class `cr` can only be used as a clobber, not as an input or output |
| 56 | --> $DIR/bad-reg.rs:103:18 | |
| 44 | --> $DIR/bad-reg.rs:99:18 | |
| 57 | 45 | | |
| 58 | 46 | LL | asm!("", out("cr") x); |
| 59 | 47 | | ^^^^^^^^^^^ |
| 60 | 48 | |
| 61 | 49 | error: register class `cr` can only be used as a clobber, not as an input or output |
| 62 | --> $DIR/bad-reg.rs:106:26 | |
| 50 | --> $DIR/bad-reg.rs:102:26 | |
| 63 | 51 | | |
| 64 | 52 | LL | asm!("/* {} */", in(cr) x); |
| 65 | 53 | | ^^^^^^^^ |
| 66 | 54 | |
| 67 | 55 | error: register class `cr` can only be used as a clobber, not as an input or output |
| 68 | --> $DIR/bad-reg.rs:109:26 | |
| 56 | --> $DIR/bad-reg.rs:105:26 | |
| 69 | 57 | | |
| 70 | 58 | LL | asm!("/* {} */", out(cr) _); |
| 71 | 59 | | ^^^^^^^^^ |
| 72 | 60 | |
| 61 | error: register class `ctr` can only be used as a clobber, not as an input or output | |
| 62 | --> $DIR/bad-reg.rs:109:18 | |
| 63 | | | |
| 64 | LL | asm!("", in("ctr") x); | |
| 65 | | ^^^^^^^^^^^ | |
| 66 | ||
| 67 | error: register class `ctr` can only be used as a clobber, not as an input or output | |
| 68 | --> $DIR/bad-reg.rs:112:18 | |
| 69 | | | |
| 70 | LL | asm!("", out("ctr") x); | |
| 71 | | ^^^^^^^^^^^^ | |
| 72 | ||
| 73 | error: register class `ctr` can only be used as a clobber, not as an input or output | |
| 74 | --> $DIR/bad-reg.rs:115:26 | |
| 75 | | | |
| 76 | LL | asm!("/* {} */", in(ctr) x); | |
| 77 | | ^^^^^^^^^ | |
| 78 | ||
| 79 | error: register class `ctr` can only be used as a clobber, not as an input or output | |
| 80 | --> $DIR/bad-reg.rs:118:26 | |
| 81 | | | |
| 82 | LL | asm!("/* {} */", out(ctr) _); | |
| 83 | | ^^^^^^^^^^ | |
| 84 | ||
| 85 | error: register class `lr` can only be used as a clobber, not as an input or output | |
| 86 | --> $DIR/bad-reg.rs:122:18 | |
| 87 | | | |
| 88 | LL | asm!("", in("lr") x); | |
| 89 | | ^^^^^^^^^^ | |
| 90 | ||
| 91 | error: register class `lr` can only be used as a clobber, not as an input or output | |
| 92 | --> $DIR/bad-reg.rs:125:18 | |
| 93 | | | |
| 94 | LL | asm!("", out("lr") x); | |
| 95 | | ^^^^^^^^^^^ | |
| 96 | ||
| 97 | error: register class `lr` can only be used as a clobber, not as an input or output | |
| 98 | --> $DIR/bad-reg.rs:128:26 | |
| 99 | | | |
| 100 | LL | asm!("/* {} */", in(lr) x); | |
| 101 | | ^^^^^^^^ | |
| 102 | ||
| 103 | error: register class `lr` can only be used as a clobber, not as an input or output | |
| 104 | --> $DIR/bad-reg.rs:131:26 | |
| 105 | | | |
| 106 | LL | asm!("/* {} */", out(lr) _); | |
| 107 | | ^^^^^^^^^ | |
| 108 | ||
| 73 | 109 | error: register class `xer` can only be used as a clobber, not as an input or output |
| 74 | --> $DIR/bad-reg.rs:113:18 | |
| 110 | --> $DIR/bad-reg.rs:135:18 | |
| 75 | 111 | | |
| 76 | 112 | LL | asm!("", in("xer") x); |
| 77 | 113 | | ^^^^^^^^^^^ |
| 78 | 114 | |
| 79 | 115 | error: register class `xer` can only be used as a clobber, not as an input or output |
| 80 | --> $DIR/bad-reg.rs:116:18 | |
| 116 | --> $DIR/bad-reg.rs:138:18 | |
| 81 | 117 | | |
| 82 | 118 | LL | asm!("", out("xer") x); |
| 83 | 119 | | ^^^^^^^^^^^^ |
| 84 | 120 | |
| 85 | 121 | error: register class `xer` can only be used as a clobber, not as an input or output |
| 86 | --> $DIR/bad-reg.rs:119:26 | |
| 122 | --> $DIR/bad-reg.rs:141:26 | |
| 87 | 123 | | |
| 88 | 124 | LL | asm!("/* {} */", in(xer) x); |
| 89 | 125 | | ^^^^^^^^^ |
| 90 | 126 | |
| 91 | 127 | error: register class `xer` can only be used as a clobber, not as an input or output |
| 92 | --> $DIR/bad-reg.rs:122:26 | |
| 128 | --> $DIR/bad-reg.rs:144:26 | |
| 93 | 129 | | |
| 94 | 130 | LL | asm!("/* {} */", out(xer) _); |
| 95 | 131 | | ^^^^^^^^^^ |
| 96 | 132 | |
| 97 | 133 | error: register `cr0` conflicts with register `cr` |
| 98 | --> $DIR/bad-reg.rs:126:31 | |
| 134 | --> $DIR/bad-reg.rs:148:31 | |
| 99 | 135 | | |
| 100 | 136 | LL | asm!("", out("cr") _, out("cr0") _); |
| 101 | 137 | | ----------- ^^^^^^^^^^^^ register `cr0` |
| ... | ... | @@ -103,7 +139,7 @@ LL | asm!("", out("cr") _, out("cr0") _); |
| 103 | 139 | | register `cr` |
| 104 | 140 | |
| 105 | 141 | error: register `cr1` conflicts with register `cr` |
| 106 | --> $DIR/bad-reg.rs:128:31 | |
| 142 | --> $DIR/bad-reg.rs:150:31 | |
| 107 | 143 | | |
| 108 | 144 | LL | asm!("", out("cr") _, out("cr1") _); |
| 109 | 145 | | ----------- ^^^^^^^^^^^^ register `cr1` |
| ... | ... | @@ -111,7 +147,7 @@ LL | asm!("", out("cr") _, out("cr1") _); |
| 111 | 147 | | register `cr` |
| 112 | 148 | |
| 113 | 149 | error: register `cr2` conflicts with register `cr` |
| 114 | --> $DIR/bad-reg.rs:130:31 | |
| 150 | --> $DIR/bad-reg.rs:152:31 | |
| 115 | 151 | | |
| 116 | 152 | LL | asm!("", out("cr") _, out("cr2") _); |
| 117 | 153 | | ----------- ^^^^^^^^^^^^ register `cr2` |
| ... | ... | @@ -119,7 +155,7 @@ LL | asm!("", out("cr") _, out("cr2") _); |
| 119 | 155 | | register `cr` |
| 120 | 156 | |
| 121 | 157 | error: register `cr3` conflicts with register `cr` |
| 122 | --> $DIR/bad-reg.rs:132:31 | |
| 158 | --> $DIR/bad-reg.rs:154:31 | |
| 123 | 159 | | |
| 124 | 160 | LL | asm!("", out("cr") _, out("cr3") _); |
| 125 | 161 | | ----------- ^^^^^^^^^^^^ register `cr3` |
| ... | ... | @@ -127,7 +163,7 @@ LL | asm!("", out("cr") _, out("cr3") _); |
| 127 | 163 | | register `cr` |
| 128 | 164 | |
| 129 | 165 | error: register `cr4` conflicts with register `cr` |
| 130 | --> $DIR/bad-reg.rs:134:31 | |
| 166 | --> $DIR/bad-reg.rs:156:31 | |
| 131 | 167 | | |
| 132 | 168 | LL | asm!("", out("cr") _, out("cr4") _); |
| 133 | 169 | | ----------- ^^^^^^^^^^^^ register `cr4` |
| ... | ... | @@ -135,7 +171,7 @@ LL | asm!("", out("cr") _, out("cr4") _); |
| 135 | 171 | | register `cr` |
| 136 | 172 | |
| 137 | 173 | error: register `cr5` conflicts with register `cr` |
| 138 | --> $DIR/bad-reg.rs:136:31 | |
| 174 | --> $DIR/bad-reg.rs:158:31 | |
| 139 | 175 | | |
| 140 | 176 | LL | asm!("", out("cr") _, out("cr5") _); |
| 141 | 177 | | ----------- ^^^^^^^^^^^^ register `cr5` |
| ... | ... | @@ -143,7 +179,7 @@ LL | asm!("", out("cr") _, out("cr5") _); |
| 143 | 179 | | register `cr` |
| 144 | 180 | |
| 145 | 181 | error: register `cr6` conflicts with register `cr` |
| 146 | --> $DIR/bad-reg.rs:138:31 | |
| 182 | --> $DIR/bad-reg.rs:160:31 | |
| 147 | 183 | | |
| 148 | 184 | LL | asm!("", out("cr") _, out("cr6") _); |
| 149 | 185 | | ----------- ^^^^^^^^^^^^ register `cr6` |
| ... | ... | @@ -151,7 +187,7 @@ LL | asm!("", out("cr") _, out("cr6") _); |
| 151 | 187 | | register `cr` |
| 152 | 188 | |
| 153 | 189 | error: register `cr7` conflicts with register `cr` |
| 154 | --> $DIR/bad-reg.rs:140:31 | |
| 190 | --> $DIR/bad-reg.rs:162:31 | |
| 155 | 191 | | |
| 156 | 192 | LL | asm!("", out("cr") _, out("cr7") _); |
| 157 | 193 | | ----------- ^^^^^^^^^^^^ register `cr7` |
| ... | ... | @@ -165,7 +201,7 @@ LL | asm!("", out("r13") _); |
| 165 | 201 | | ^^^^^^^^^^^^ |
| 166 | 202 | |
| 167 | 203 | error: `vsx` target feature is not enabled |
| 168 | --> $DIR/bad-reg.rs:61:27 | |
| 204 | --> $DIR/bad-reg.rs:57:27 | |
| 169 | 205 | | |
| 170 | 206 | LL | asm!("", in("v0") v64x2); // requires vsx |
| 171 | 207 | | ^^^^^ |
| ... | ... | @@ -173,7 +209,7 @@ LL | asm!("", in("v0") v64x2); // requires vsx |
| 173 | 209 | = note: this is required to use type `i64x2` with register class `vreg` |
| 174 | 210 | |
| 175 | 211 | error: `vsx` target feature is not enabled |
| 176 | --> $DIR/bad-reg.rs:64:28 | |
| 212 | --> $DIR/bad-reg.rs:60:28 | |
| 177 | 213 | | |
| 178 | 214 | LL | asm!("", out("v0") v64x2); // requires vsx |
| 179 | 215 | | ^^^^^ |
| ... | ... | @@ -181,7 +217,7 @@ LL | asm!("", out("v0") v64x2); // requires vsx |
| 181 | 217 | = note: this is required to use type `i64x2` with register class `vreg` |
| 182 | 218 | |
| 183 | 219 | error: type `i32` cannot be used with this register class |
| 184 | --> $DIR/bad-reg.rs:67:27 | |
| 220 | --> $DIR/bad-reg.rs:63:27 | |
| 185 | 221 | | |
| 186 | 222 | LL | asm!("", in("v0") x); // FIXME: should be ok if vsx is available |
| 187 | 223 | | ^ |
| ... | ... | @@ -189,7 +225,7 @@ LL | asm!("", in("v0") x); // FIXME: should be ok if vsx is available |
| 189 | 225 | = note: register class `vreg` supports these types: i8x16, i16x8, i32x4, f32x4, f32, f64, i64x2, f64x2 |
| 190 | 226 | |
| 191 | 227 | error: type `i32` cannot be used with this register class |
| 192 | --> $DIR/bad-reg.rs:70:28 | |
| 228 | --> $DIR/bad-reg.rs:66:28 | |
| 193 | 229 | | |
| 194 | 230 | LL | asm!("", out("v0") x); // FIXME: should be ok if vsx is available |
| 195 | 231 | | ^ |
| ... | ... | @@ -197,7 +233,7 @@ LL | asm!("", out("v0") x); // FIXME: should be ok if vsx is available |
| 197 | 233 | = note: register class `vreg` supports these types: i8x16, i16x8, i32x4, f32x4, f32, f64, i64x2, f64x2 |
| 198 | 234 | |
| 199 | 235 | error: `vsx` target feature is not enabled |
| 200 | --> $DIR/bad-reg.rs:75:35 | |
| 236 | --> $DIR/bad-reg.rs:71:35 | |
| 201 | 237 | | |
| 202 | 238 | LL | asm!("/* {} */", in(vreg) v64x2); // requires vsx |
| 203 | 239 | | ^^^^^ |
| ... | ... | @@ -205,7 +241,7 @@ LL | asm!("/* {} */", in(vreg) v64x2); // requires vsx |
| 205 | 241 | = note: this is required to use type `i64x2` with register class `vreg` |
| 206 | 242 | |
| 207 | 243 | error: type `i32` cannot be used with this register class |
| 208 | --> $DIR/bad-reg.rs:78:35 | |
| 244 | --> $DIR/bad-reg.rs:74:35 | |
| 209 | 245 | | |
| 210 | 246 | LL | asm!("/* {} */", in(vreg) x); // FIXME: should be ok if vsx is available |
| 211 | 247 | | ^ |
| ... | ... | @@ -213,7 +249,7 @@ LL | asm!("/* {} */", in(vreg) x); // FIXME: should be ok if vsx is avai |
| 213 | 249 | = note: register class `vreg` supports these types: i8x16, i16x8, i32x4, f32x4, f32, f64, i64x2, f64x2 |
| 214 | 250 | |
| 215 | 251 | error: type `i32` cannot be used with this register class |
| 216 | --> $DIR/bad-reg.rs:100:27 | |
| 252 | --> $DIR/bad-reg.rs:96:27 | |
| 217 | 253 | | |
| 218 | 254 | LL | asm!("", in("cr") x); |
| 219 | 255 | | ^ |
| ... | ... | @@ -221,7 +257,7 @@ LL | asm!("", in("cr") x); |
| 221 | 257 | = note: register class `cr` supports these types: |
| 222 | 258 | |
| 223 | 259 | error: type `i32` cannot be used with this register class |
| 224 | --> $DIR/bad-reg.rs:103:28 | |
| 260 | --> $DIR/bad-reg.rs:99:28 | |
| 225 | 261 | | |
| 226 | 262 | LL | asm!("", out("cr") x); |
| 227 | 263 | | ^ |
| ... | ... | @@ -229,7 +265,7 @@ LL | asm!("", out("cr") x); |
| 229 | 265 | = note: register class `cr` supports these types: |
| 230 | 266 | |
| 231 | 267 | error: type `i32` cannot be used with this register class |
| 232 | --> $DIR/bad-reg.rs:106:33 | |
| 268 | --> $DIR/bad-reg.rs:102:33 | |
| 233 | 269 | | |
| 234 | 270 | LL | asm!("/* {} */", in(cr) x); |
| 235 | 271 | | ^ |
| ... | ... | @@ -237,7 +273,55 @@ LL | asm!("/* {} */", in(cr) x); |
| 237 | 273 | = note: register class `cr` supports these types: |
| 238 | 274 | |
| 239 | 275 | error: type `i32` cannot be used with this register class |
| 240 | --> $DIR/bad-reg.rs:113:28 | |
| 276 | --> $DIR/bad-reg.rs:109:28 | |
| 277 | | | |
| 278 | LL | asm!("", in("ctr") x); | |
| 279 | | ^ | |
| 280 | | | |
| 281 | = note: register class `ctr` supports these types: | |
| 282 | ||
| 283 | error: type `i32` cannot be used with this register class | |
| 284 | --> $DIR/bad-reg.rs:112:29 | |
| 285 | | | |
| 286 | LL | asm!("", out("ctr") x); | |
| 287 | | ^ | |
| 288 | | | |
| 289 | = note: register class `ctr` supports these types: | |
| 290 | ||
| 291 | error: type `i32` cannot be used with this register class | |
| 292 | --> $DIR/bad-reg.rs:115:34 | |
| 293 | | | |
| 294 | LL | asm!("/* {} */", in(ctr) x); | |
| 295 | | ^ | |
| 296 | | | |
| 297 | = note: register class `ctr` supports these types: | |
| 298 | ||
| 299 | error: type `i32` cannot be used with this register class | |
| 300 | --> $DIR/bad-reg.rs:122:27 | |
| 301 | | | |
| 302 | LL | asm!("", in("lr") x); | |
| 303 | | ^ | |
| 304 | | | |
| 305 | = note: register class `lr` supports these types: | |
| 306 | ||
| 307 | error: type `i32` cannot be used with this register class | |
| 308 | --> $DIR/bad-reg.rs:125:28 | |
| 309 | | | |
| 310 | LL | asm!("", out("lr") x); | |
| 311 | | ^ | |
| 312 | | | |
| 313 | = note: register class `lr` supports these types: | |
| 314 | ||
| 315 | error: type `i32` cannot be used with this register class | |
| 316 | --> $DIR/bad-reg.rs:128:33 | |
| 317 | | | |
| 318 | LL | asm!("/* {} */", in(lr) x); | |
| 319 | | ^ | |
| 320 | | | |
| 321 | = note: register class `lr` supports these types: | |
| 322 | ||
| 323 | error: type `i32` cannot be used with this register class | |
| 324 | --> $DIR/bad-reg.rs:135:28 | |
| 241 | 325 | | |
| 242 | 326 | LL | asm!("", in("xer") x); |
| 243 | 327 | | ^ |
| ... | ... | @@ -245,7 +329,7 @@ LL | asm!("", in("xer") x); |
| 245 | 329 | = note: register class `xer` supports these types: |
| 246 | 330 | |
| 247 | 331 | error: type `i32` cannot be used with this register class |
| 248 | --> $DIR/bad-reg.rs:116:29 | |
| 332 | --> $DIR/bad-reg.rs:138:29 | |
| 249 | 333 | | |
| 250 | 334 | LL | asm!("", out("xer") x); |
| 251 | 335 | | ^ |
| ... | ... | @@ -253,12 +337,12 @@ LL | asm!("", out("xer") x); |
| 253 | 337 | = note: register class `xer` supports these types: |
| 254 | 338 | |
| 255 | 339 | error: type `i32` cannot be used with this register class |
| 256 | --> $DIR/bad-reg.rs:119:34 | |
| 340 | --> $DIR/bad-reg.rs:141:34 | |
| 257 | 341 | | |
| 258 | 342 | LL | asm!("/* {} */", in(xer) x); |
| 259 | 343 | | ^ |
| 260 | 344 | | |
| 261 | 345 | = note: register class `xer` supports these types: |
| 262 | 346 | |
| 263 | error: aborting due to 37 previous errors | |
| 347 | error: aborting due to 49 previous errors | |
| 264 | 348 |
tests/ui/asm/powerpc/bad-reg.powerpc64le.stderr+123-39| ... | ... | @@ -28,74 +28,110 @@ error: invalid register `fp`: the frame pointer cannot be used as an operand for |
| 28 | 28 | LL | asm!("", out("fp") _); |
| 29 | 29 | | ^^^^^^^^^^^ |
| 30 | 30 | |
| 31 | error: invalid register `lr`: the link register cannot be used as an operand for inline asm | |
| 32 | --> $DIR/bad-reg.rs:48:18 | |
| 33 | | | |
| 34 | LL | asm!("", out("lr") _); | |
| 35 | | ^^^^^^^^^^^ | |
| 36 | ||
| 37 | error: invalid register `ctr`: the counter register cannot be used as an operand for inline asm | |
| 38 | --> $DIR/bad-reg.rs:50:18 | |
| 39 | | | |
| 40 | LL | asm!("", out("ctr") _); | |
| 41 | | ^^^^^^^^^^^^ | |
| 42 | ||
| 43 | 31 | error: invalid register `vrsave`: the vrsave register cannot be used as an operand for inline asm |
| 44 | --> $DIR/bad-reg.rs:52:18 | |
| 32 | --> $DIR/bad-reg.rs:48:18 | |
| 45 | 33 | | |
| 46 | 34 | LL | asm!("", out("vrsave") _); |
| 47 | 35 | | ^^^^^^^^^^^^^^^ |
| 48 | 36 | |
| 49 | 37 | error: register class `cr` can only be used as a clobber, not as an input or output |
| 50 | --> $DIR/bad-reg.rs:100:18 | |
| 38 | --> $DIR/bad-reg.rs:96:18 | |
| 51 | 39 | | |
| 52 | 40 | LL | asm!("", in("cr") x); |
| 53 | 41 | | ^^^^^^^^^^ |
| 54 | 42 | |
| 55 | 43 | error: register class `cr` can only be used as a clobber, not as an input or output |
| 56 | --> $DIR/bad-reg.rs:103:18 | |
| 44 | --> $DIR/bad-reg.rs:99:18 | |
| 57 | 45 | | |
| 58 | 46 | LL | asm!("", out("cr") x); |
| 59 | 47 | | ^^^^^^^^^^^ |
| 60 | 48 | |
| 61 | 49 | error: register class `cr` can only be used as a clobber, not as an input or output |
| 62 | --> $DIR/bad-reg.rs:106:26 | |
| 50 | --> $DIR/bad-reg.rs:102:26 | |
| 63 | 51 | | |
| 64 | 52 | LL | asm!("/* {} */", in(cr) x); |
| 65 | 53 | | ^^^^^^^^ |
| 66 | 54 | |
| 67 | 55 | error: register class `cr` can only be used as a clobber, not as an input or output |
| 68 | --> $DIR/bad-reg.rs:109:26 | |
| 56 | --> $DIR/bad-reg.rs:105:26 | |
| 69 | 57 | | |
| 70 | 58 | LL | asm!("/* {} */", out(cr) _); |
| 71 | 59 | | ^^^^^^^^^ |
| 72 | 60 | |
| 61 | error: register class `ctr` can only be used as a clobber, not as an input or output | |
| 62 | --> $DIR/bad-reg.rs:109:18 | |
| 63 | | | |
| 64 | LL | asm!("", in("ctr") x); | |
| 65 | | ^^^^^^^^^^^ | |
| 66 | ||
| 67 | error: register class `ctr` can only be used as a clobber, not as an input or output | |
| 68 | --> $DIR/bad-reg.rs:112:18 | |
| 69 | | | |
| 70 | LL | asm!("", out("ctr") x); | |
| 71 | | ^^^^^^^^^^^^ | |
| 72 | ||
| 73 | error: register class `ctr` can only be used as a clobber, not as an input or output | |
| 74 | --> $DIR/bad-reg.rs:115:26 | |
| 75 | | | |
| 76 | LL | asm!("/* {} */", in(ctr) x); | |
| 77 | | ^^^^^^^^^ | |
| 78 | ||
| 79 | error: register class `ctr` can only be used as a clobber, not as an input or output | |
| 80 | --> $DIR/bad-reg.rs:118:26 | |
| 81 | | | |
| 82 | LL | asm!("/* {} */", out(ctr) _); | |
| 83 | | ^^^^^^^^^^ | |
| 84 | ||
| 85 | error: register class `lr` can only be used as a clobber, not as an input or output | |
| 86 | --> $DIR/bad-reg.rs:122:18 | |
| 87 | | | |
| 88 | LL | asm!("", in("lr") x); | |
| 89 | | ^^^^^^^^^^ | |
| 90 | ||
| 91 | error: register class `lr` can only be used as a clobber, not as an input or output | |
| 92 | --> $DIR/bad-reg.rs:125:18 | |
| 93 | | | |
| 94 | LL | asm!("", out("lr") x); | |
| 95 | | ^^^^^^^^^^^ | |
| 96 | ||
| 97 | error: register class `lr` can only be used as a clobber, not as an input or output | |
| 98 | --> $DIR/bad-reg.rs:128:26 | |
| 99 | | | |
| 100 | LL | asm!("/* {} */", in(lr) x); | |
| 101 | | ^^^^^^^^ | |
| 102 | ||
| 103 | error: register class `lr` can only be used as a clobber, not as an input or output | |
| 104 | --> $DIR/bad-reg.rs:131:26 | |
| 105 | | | |
| 106 | LL | asm!("/* {} */", out(lr) _); | |
| 107 | | ^^^^^^^^^ | |
| 108 | ||
| 73 | 109 | error: register class `xer` can only be used as a clobber, not as an input or output |
| 74 | --> $DIR/bad-reg.rs:113:18 | |
| 110 | --> $DIR/bad-reg.rs:135:18 | |
| 75 | 111 | | |
| 76 | 112 | LL | asm!("", in("xer") x); |
| 77 | 113 | | ^^^^^^^^^^^ |
| 78 | 114 | |
| 79 | 115 | error: register class `xer` can only be used as a clobber, not as an input or output |
| 80 | --> $DIR/bad-reg.rs:116:18 | |
| 116 | --> $DIR/bad-reg.rs:138:18 | |
| 81 | 117 | | |
| 82 | 118 | LL | asm!("", out("xer") x); |
| 83 | 119 | | ^^^^^^^^^^^^ |
| 84 | 120 | |
| 85 | 121 | error: register class `xer` can only be used as a clobber, not as an input or output |
| 86 | --> $DIR/bad-reg.rs:119:26 | |
| 122 | --> $DIR/bad-reg.rs:141:26 | |
| 87 | 123 | | |
| 88 | 124 | LL | asm!("/* {} */", in(xer) x); |
| 89 | 125 | | ^^^^^^^^^ |
| 90 | 126 | |
| 91 | 127 | error: register class `xer` can only be used as a clobber, not as an input or output |
| 92 | --> $DIR/bad-reg.rs:122:26 | |
| 128 | --> $DIR/bad-reg.rs:144:26 | |
| 93 | 129 | | |
| 94 | 130 | LL | asm!("/* {} */", out(xer) _); |
| 95 | 131 | | ^^^^^^^^^^ |
| 96 | 132 | |
| 97 | 133 | error: register `cr0` conflicts with register `cr` |
| 98 | --> $DIR/bad-reg.rs:126:31 | |
| 134 | --> $DIR/bad-reg.rs:148:31 | |
| 99 | 135 | | |
| 100 | 136 | LL | asm!("", out("cr") _, out("cr0") _); |
| 101 | 137 | | ----------- ^^^^^^^^^^^^ register `cr0` |
| ... | ... | @@ -103,7 +139,7 @@ LL | asm!("", out("cr") _, out("cr0") _); |
| 103 | 139 | | register `cr` |
| 104 | 140 | |
| 105 | 141 | error: register `cr1` conflicts with register `cr` |
| 106 | --> $DIR/bad-reg.rs:128:31 | |
| 142 | --> $DIR/bad-reg.rs:150:31 | |
| 107 | 143 | | |
| 108 | 144 | LL | asm!("", out("cr") _, out("cr1") _); |
| 109 | 145 | | ----------- ^^^^^^^^^^^^ register `cr1` |
| ... | ... | @@ -111,7 +147,7 @@ LL | asm!("", out("cr") _, out("cr1") _); |
| 111 | 147 | | register `cr` |
| 112 | 148 | |
| 113 | 149 | error: register `cr2` conflicts with register `cr` |
| 114 | --> $DIR/bad-reg.rs:130:31 | |
| 150 | --> $DIR/bad-reg.rs:152:31 | |
| 115 | 151 | | |
| 116 | 152 | LL | asm!("", out("cr") _, out("cr2") _); |
| 117 | 153 | | ----------- ^^^^^^^^^^^^ register `cr2` |
| ... | ... | @@ -119,7 +155,7 @@ LL | asm!("", out("cr") _, out("cr2") _); |
| 119 | 155 | | register `cr` |
| 120 | 156 | |
| 121 | 157 | error: register `cr3` conflicts with register `cr` |
| 122 | --> $DIR/bad-reg.rs:132:31 | |
| 158 | --> $DIR/bad-reg.rs:154:31 | |
| 123 | 159 | | |
| 124 | 160 | LL | asm!("", out("cr") _, out("cr3") _); |
| 125 | 161 | | ----------- ^^^^^^^^^^^^ register `cr3` |
| ... | ... | @@ -127,7 +163,7 @@ LL | asm!("", out("cr") _, out("cr3") _); |
| 127 | 163 | | register `cr` |
| 128 | 164 | |
| 129 | 165 | error: register `cr4` conflicts with register `cr` |
| 130 | --> $DIR/bad-reg.rs:134:31 | |
| 166 | --> $DIR/bad-reg.rs:156:31 | |
| 131 | 167 | | |
| 132 | 168 | LL | asm!("", out("cr") _, out("cr4") _); |
| 133 | 169 | | ----------- ^^^^^^^^^^^^ register `cr4` |
| ... | ... | @@ -135,7 +171,7 @@ LL | asm!("", out("cr") _, out("cr4") _); |
| 135 | 171 | | register `cr` |
| 136 | 172 | |
| 137 | 173 | error: register `cr5` conflicts with register `cr` |
| 138 | --> $DIR/bad-reg.rs:136:31 | |
| 174 | --> $DIR/bad-reg.rs:158:31 | |
| 139 | 175 | | |
| 140 | 176 | LL | asm!("", out("cr") _, out("cr5") _); |
| 141 | 177 | | ----------- ^^^^^^^^^^^^ register `cr5` |
| ... | ... | @@ -143,7 +179,7 @@ LL | asm!("", out("cr") _, out("cr5") _); |
| 143 | 179 | | register `cr` |
| 144 | 180 | |
| 145 | 181 | error: register `cr6` conflicts with register `cr` |
| 146 | --> $DIR/bad-reg.rs:138:31 | |
| 182 | --> $DIR/bad-reg.rs:160:31 | |
| 147 | 183 | | |
| 148 | 184 | LL | asm!("", out("cr") _, out("cr6") _); |
| 149 | 185 | | ----------- ^^^^^^^^^^^^ register `cr6` |
| ... | ... | @@ -151,7 +187,7 @@ LL | asm!("", out("cr") _, out("cr6") _); |
| 151 | 187 | | register `cr` |
| 152 | 188 | |
| 153 | 189 | error: register `cr7` conflicts with register `cr` |
| 154 | --> $DIR/bad-reg.rs:140:31 | |
| 190 | --> $DIR/bad-reg.rs:162:31 | |
| 155 | 191 | | |
| 156 | 192 | LL | asm!("", out("cr") _, out("cr7") _); |
| 157 | 193 | | ----------- ^^^^^^^^^^^^ register `cr7` |
| ... | ... | @@ -165,7 +201,7 @@ LL | asm!("", out("r13") _); |
| 165 | 201 | | ^^^^^^^^^^^^ |
| 166 | 202 | |
| 167 | 203 | error: type `i32` cannot be used with this register class |
| 168 | --> $DIR/bad-reg.rs:67:27 | |
| 204 | --> $DIR/bad-reg.rs:63:27 | |
| 169 | 205 | | |
| 170 | 206 | LL | asm!("", in("v0") x); // FIXME: should be ok if vsx is available |
| 171 | 207 | | ^ |
| ... | ... | @@ -173,7 +209,7 @@ LL | asm!("", in("v0") x); // FIXME: should be ok if vsx is available |
| 173 | 209 | = note: register class `vreg` supports these types: i8x16, i16x8, i32x4, f32x4, f32, f64, i64x2, f64x2 |
| 174 | 210 | |
| 175 | 211 | error: type `i32` cannot be used with this register class |
| 176 | --> $DIR/bad-reg.rs:70:28 | |
| 212 | --> $DIR/bad-reg.rs:66:28 | |
| 177 | 213 | | |
| 178 | 214 | LL | asm!("", out("v0") x); // FIXME: should be ok if vsx is available |
| 179 | 215 | | ^ |
| ... | ... | @@ -181,7 +217,7 @@ LL | asm!("", out("v0") x); // FIXME: should be ok if vsx is available |
| 181 | 217 | = note: register class `vreg` supports these types: i8x16, i16x8, i32x4, f32x4, f32, f64, i64x2, f64x2 |
| 182 | 218 | |
| 183 | 219 | error: type `i32` cannot be used with this register class |
| 184 | --> $DIR/bad-reg.rs:78:35 | |
| 220 | --> $DIR/bad-reg.rs:74:35 | |
| 185 | 221 | | |
| 186 | 222 | LL | asm!("/* {} */", in(vreg) x); // FIXME: should be ok if vsx is available |
| 187 | 223 | | ^ |
| ... | ... | @@ -189,7 +225,7 @@ LL | asm!("/* {} */", in(vreg) x); // FIXME: should be ok if vsx is avai |
| 189 | 225 | = note: register class `vreg` supports these types: i8x16, i16x8, i32x4, f32x4, f32, f64, i64x2, f64x2 |
| 190 | 226 | |
| 191 | 227 | error: type `i32` cannot be used with this register class |
| 192 | --> $DIR/bad-reg.rs:100:27 | |
| 228 | --> $DIR/bad-reg.rs:96:27 | |
| 193 | 229 | | |
| 194 | 230 | LL | asm!("", in("cr") x); |
| 195 | 231 | | ^ |
| ... | ... | @@ -197,7 +233,7 @@ LL | asm!("", in("cr") x); |
| 197 | 233 | = note: register class `cr` supports these types: |
| 198 | 234 | |
| 199 | 235 | error: type `i32` cannot be used with this register class |
| 200 | --> $DIR/bad-reg.rs:103:28 | |
| 236 | --> $DIR/bad-reg.rs:99:28 | |
| 201 | 237 | | |
| 202 | 238 | LL | asm!("", out("cr") x); |
| 203 | 239 | | ^ |
| ... | ... | @@ -205,7 +241,7 @@ LL | asm!("", out("cr") x); |
| 205 | 241 | = note: register class `cr` supports these types: |
| 206 | 242 | |
| 207 | 243 | error: type `i32` cannot be used with this register class |
| 208 | --> $DIR/bad-reg.rs:106:33 | |
| 244 | --> $DIR/bad-reg.rs:102:33 | |
| 209 | 245 | | |
| 210 | 246 | LL | asm!("/* {} */", in(cr) x); |
| 211 | 247 | | ^ |
| ... | ... | @@ -213,7 +249,55 @@ LL | asm!("/* {} */", in(cr) x); |
| 213 | 249 | = note: register class `cr` supports these types: |
| 214 | 250 | |
| 215 | 251 | error: type `i32` cannot be used with this register class |
| 216 | --> $DIR/bad-reg.rs:113:28 | |
| 252 | --> $DIR/bad-reg.rs:109:28 | |
| 253 | | | |
| 254 | LL | asm!("", in("ctr") x); | |
| 255 | | ^ | |
| 256 | | | |
| 257 | = note: register class `ctr` supports these types: | |
| 258 | ||
| 259 | error: type `i32` cannot be used with this register class | |
| 260 | --> $DIR/bad-reg.rs:112:29 | |
| 261 | | | |
| 262 | LL | asm!("", out("ctr") x); | |
| 263 | | ^ | |
| 264 | | | |
| 265 | = note: register class `ctr` supports these types: | |
| 266 | ||
| 267 | error: type `i32` cannot be used with this register class | |
| 268 | --> $DIR/bad-reg.rs:115:34 | |
| 269 | | | |
| 270 | LL | asm!("/* {} */", in(ctr) x); | |
| 271 | | ^ | |
| 272 | | | |
| 273 | = note: register class `ctr` supports these types: | |
| 274 | ||
| 275 | error: type `i32` cannot be used with this register class | |
| 276 | --> $DIR/bad-reg.rs:122:27 | |
| 277 | | | |
| 278 | LL | asm!("", in("lr") x); | |
| 279 | | ^ | |
| 280 | | | |
| 281 | = note: register class `lr` supports these types: | |
| 282 | ||
| 283 | error: type `i32` cannot be used with this register class | |
| 284 | --> $DIR/bad-reg.rs:125:28 | |
| 285 | | | |
| 286 | LL | asm!("", out("lr") x); | |
| 287 | | ^ | |
| 288 | | | |
| 289 | = note: register class `lr` supports these types: | |
| 290 | ||
| 291 | error: type `i32` cannot be used with this register class | |
| 292 | --> $DIR/bad-reg.rs:128:33 | |
| 293 | | | |
| 294 | LL | asm!("/* {} */", in(lr) x); | |
| 295 | | ^ | |
| 296 | | | |
| 297 | = note: register class `lr` supports these types: | |
| 298 | ||
| 299 | error: type `i32` cannot be used with this register class | |
| 300 | --> $DIR/bad-reg.rs:135:28 | |
| 217 | 301 | | |
| 218 | 302 | LL | asm!("", in("xer") x); |
| 219 | 303 | | ^ |
| ... | ... | @@ -221,7 +305,7 @@ LL | asm!("", in("xer") x); |
| 221 | 305 | = note: register class `xer` supports these types: |
| 222 | 306 | |
| 223 | 307 | error: type `i32` cannot be used with this register class |
| 224 | --> $DIR/bad-reg.rs:116:29 | |
| 308 | --> $DIR/bad-reg.rs:138:29 | |
| 225 | 309 | | |
| 226 | 310 | LL | asm!("", out("xer") x); |
| 227 | 311 | | ^ |
| ... | ... | @@ -229,12 +313,12 @@ LL | asm!("", out("xer") x); |
| 229 | 313 | = note: register class `xer` supports these types: |
| 230 | 314 | |
| 231 | 315 | error: type `i32` cannot be used with this register class |
| 232 | --> $DIR/bad-reg.rs:119:34 | |
| 316 | --> $DIR/bad-reg.rs:141:34 | |
| 233 | 317 | | |
| 234 | 318 | LL | asm!("/* {} */", in(xer) x); |
| 235 | 319 | | ^ |
| 236 | 320 | | |
| 237 | 321 | = note: register class `xer` supports these types: |
| 238 | 322 | |
| 239 | error: aborting due to 34 previous errors | |
| 323 | error: aborting due to 46 previous errors | |
| 240 | 324 |
tests/ui/asm/powerpc/bad-reg.rs+26-4| ... | ... | @@ -45,10 +45,6 @@ fn f() { |
| 45 | 45 | //~^ ERROR invalid register `r30`: r30 is used internally by LLVM and cannot be used as an operand for inline asm |
| 46 | 46 | asm!("", out("fp") _); |
| 47 | 47 | //~^ ERROR invalid register `fp`: the frame pointer cannot be used as an operand for inline asm |
| 48 | asm!("", out("lr") _); | |
| 49 | //~^ ERROR invalid register `lr`: the link register cannot be used as an operand for inline asm | |
| 50 | asm!("", out("ctr") _); | |
| 51 | //~^ ERROR invalid register `ctr`: the counter register cannot be used as an operand for inline asm | |
| 52 | 48 | asm!("", out("vrsave") _); |
| 53 | 49 | //~^ ERROR invalid register `vrsave`: the vrsave register cannot be used as an operand for inline asm |
| 54 | 50 | |
| ... | ... | @@ -108,6 +104,32 @@ fn f() { |
| 108 | 104 | //~| ERROR type `i32` cannot be used with this register class |
| 109 | 105 | asm!("/* {} */", out(cr) _); |
| 110 | 106 | //~^ ERROR can only be used as a clobber |
| 107 | // ctr | |
| 108 | asm!("", out("ctr") _); // ok | |
| 109 | asm!("", in("ctr") x); | |
| 110 | //~^ ERROR can only be used as a clobber | |
| 111 | //~| ERROR type `i32` cannot be used with this register class | |
| 112 | asm!("", out("ctr") x); | |
| 113 | //~^ ERROR can only be used as a clobber | |
| 114 | //~| ERROR type `i32` cannot be used with this register class | |
| 115 | asm!("/* {} */", in(ctr) x); | |
| 116 | //~^ ERROR can only be used as a clobber | |
| 117 | //~| ERROR type `i32` cannot be used with this register class | |
| 118 | asm!("/* {} */", out(ctr) _); | |
| 119 | //~^ ERROR can only be used as a clobber | |
| 120 | // lr | |
| 121 | asm!("", out("lr") _); // ok | |
| 122 | asm!("", in("lr") x); | |
| 123 | //~^ ERROR can only be used as a clobber | |
| 124 | //~| ERROR type `i32` cannot be used with this register class | |
| 125 | asm!("", out("lr") x); | |
| 126 | //~^ ERROR can only be used as a clobber | |
| 127 | //~| ERROR type `i32` cannot be used with this register class | |
| 128 | asm!("/* {} */", in(lr) x); | |
| 129 | //~^ ERROR can only be used as a clobber | |
| 130 | //~| ERROR type `i32` cannot be used with this register class | |
| 131 | asm!("/* {} */", out(lr) _); | |
| 132 | //~^ ERROR can only be used as a clobber | |
| 111 | 133 | // xer |
| 112 | 134 | asm!("", out("xer") _); // ok |
| 113 | 135 | asm!("", in("xer") x); |