diff --git a/RELEASES.md b/RELEASES.md index 940fa7c6072a9..f2d74f2e7f1f0 100644 --- a/RELEASES.md +++ b/RELEASES.md @@ -67,6 +67,8 @@ Stabilized APIs - [`Atomic::get_mut_slice`](https://doc.rust-lang.org/stable/core/sync/atomic/struct.Atomic.html#method.get_mut_slice) - [`Atomic::from_mut_slice`](https://doc.rust-lang.org/stable/core/sync/atomic/struct.Atomic.html#method.from_mut_slice) - [`std::range::legacy`](https://doc.rust-lang.org/stable/std/range/legacy/index.html) +- [`bool::ok_or`](https://doc.rust-lang.org/stable/std/primitive.bool.html#method.ok_or) +- [`bool::ok_or_else`](https://doc.rust-lang.org/stable/std/primitive.bool.html#method.ok_or_else) diff --git a/compiler/rustc_arena/src/lib.rs b/compiler/rustc_arena/src/lib.rs index c33765f03d77d..dfc48b0bd1cd6 100644 --- a/compiler/rustc_arena/src/lib.rs +++ b/compiler/rustc_arena/src/lib.rs @@ -13,7 +13,7 @@ #![cfg_attr(bootstrap, feature(never_type))] #![cfg_attr(test, feature(test))] #![deny(unsafe_op_in_unsafe_fn)] -#![doc(test(no_crate_inject, attr(deny(warnings), allow(internal_features))))] +#![doc(test(no_crate_inject, attr(deny(warnings))))] #![feature(decl_macro)] #![feature(dropck_eyepatch)] #![feature(rustc_attrs)] diff --git a/compiler/rustc_ast/src/lib.rs b/compiler/rustc_ast/src/lib.rs index 3b01eb6eefa7d..46d8e11cc0931 100644 --- a/compiler/rustc_ast/src/lib.rs +++ b/compiler/rustc_ast/src/lib.rs @@ -5,7 +5,7 @@ //! This API is completely unstable and subject to change. // tidy-alphabetical-start -#![doc(test(attr(deny(warnings), allow(internal_features))))] +#![doc(test(attr(deny(warnings))))] #![feature(associated_type_defaults)] #![feature(deref_patterns)] #![feature(iter_order_by)] diff --git a/compiler/rustc_builtin_macros/src/contracts.rs b/compiler/rustc_builtin_macros/src/contracts.rs index e47c1b1363df0..20001400857a6 100644 --- a/compiler/rustc_builtin_macros/src/contracts.rs +++ b/compiler/rustc_builtin_macros/src/contracts.rs @@ -137,6 +137,21 @@ fn expand_contract_clause_tts( annotated: TokenStream, clause_keyword: rustc_span::Symbol, ) -> Result { + if annotation.is_empty() { + let (name, example) = if clause_keyword == kw::ContractRequires { + ("requires", "condition") + } else { + ("ensures", "|result: &T| condition") + }; + ecx.sess.dcx().span_err( + attr_span, + format!("`{name}` attribute requires an argument, e.g., `#[{name}({example})]`"), + ); + // Returning `Err` would replace it with a dummy fragment and cause cascading name-resolution errors. + // Instead, we return the original token stream so that there is no later noises. + return Ok(annotated); + } + let feature_span = ecx.with_def_site_ctxt(attr_span); expand_contract_clause(ecx, attr_span, annotated, |new_tts| { new_tts.push(TokenTree::Token( diff --git a/compiler/rustc_graphviz/src/lib.rs b/compiler/rustc_graphviz/src/lib.rs index cd1e573ea28df..2aaf9cea97e44 100644 --- a/compiler/rustc_graphviz/src/lib.rs +++ b/compiler/rustc_graphviz/src/lib.rs @@ -270,7 +270,7 @@ //! * [DOT language](https://www.graphviz.org/doc/info/lang.html) // tidy-alphabetical-start -#![doc(test(attr(allow(unused_variables), deny(warnings), allow(internal_features))))] +#![doc(test(attr(allow(unused_variables), deny(warnings))))] // tidy-alphabetical-end use std::borrow::Cow; diff --git a/compiler/rustc_lint_defs/src/builtin.rs b/compiler/rustc_lint_defs/src/builtin.rs index 98269a5fd4e44..dbc503f5c7ec4 100644 --- a/compiler/rustc_lint_defs/src/builtin.rs +++ b/compiler/rustc_lint_defs/src/builtin.rs @@ -823,7 +823,7 @@ declare_lint! { /// /// ### Example /// - /// ```rust + /// ```rust,compile_fail /// #![deny(dead_code_pub_in_binary)] /// /// pub fn unused_pub_fn() {} @@ -1132,9 +1132,9 @@ declare_lint! { /// /// ### Example /// - /// ```rust + /// ```rust,compile_fail /// #![deny(warnings)] - /// fn foo() {} + /// struct non_standard_name; /// ``` /// /// {{produces}} diff --git a/compiler/rustc_parse_format/src/lib.rs b/compiler/rustc_parse_format/src/lib.rs index 256bc8c3fe30e..90e04fe388ad6 100644 --- a/compiler/rustc_parse_format/src/lib.rs +++ b/compiler/rustc_parse_format/src/lib.rs @@ -8,7 +8,7 @@ // We want to be able to build this crate with a stable compiler, // so no `#![feature]` attributes should be added. #![deny(unstable_features)] -#![doc(test(attr(deny(warnings), allow(internal_features))))] +#![doc(test(attr(deny(warnings))))] // tidy-alphabetical-end use std::ops::Range; diff --git a/compiler/rustc_public/src/lib.rs b/compiler/rustc_public/src/lib.rs index 4adc0e139a68e..ac2d1eb7a7a42 100644 --- a/compiler/rustc_public/src/lib.rs +++ b/compiler/rustc_public/src/lib.rs @@ -43,7 +43,7 @@ //! For more information, see . #![allow(rustc::usage_of_ty_tykind)] -#![doc(test(attr(allow(unused_variables), deny(warnings), allow(internal_features))))] +#![doc(test(attr(allow(unused_variables), deny(warnings))))] #![feature(sized_hierarchy)] use std::fmt::Debug; diff --git a/compiler/rustc_public_bridge/src/lib.rs b/compiler/rustc_public_bridge/src/lib.rs index d598f88a00d27..c8859b0e349ea 100644 --- a/compiler/rustc_public_bridge/src/lib.rs +++ b/compiler/rustc_public_bridge/src/lib.rs @@ -13,7 +13,7 @@ // tidy-alphabetical-start #![allow(rustc::usage_of_ty_tykind)] -#![doc(test(attr(allow(unused_variables), deny(warnings), allow(internal_features))))] +#![doc(test(attr(allow(unused_variables), deny(warnings))))] #![feature(trait_alias)] // tidy-alphabetical-end diff --git a/compiler/rustc_serialize/src/lib.rs b/compiler/rustc_serialize/src/lib.rs index 39333ab00b57f..ae7c3854d00b4 100644 --- a/compiler/rustc_serialize/src/lib.rs +++ b/compiler/rustc_serialize/src/lib.rs @@ -4,7 +4,7 @@ #![allow(internal_features)] #![allow(rustc::internal)] #![cfg_attr(bootstrap, feature(never_type))] -#![doc(test(attr(allow(unused_variables), deny(warnings), allow(internal_features))))] +#![doc(test(attr(allow(unused_variables), deny(warnings))))] #![feature(core_intrinsics)] #![feature(min_specialization)] #![feature(nonzero_internals)] diff --git a/compiler/rustc_session/src/config.rs b/compiler/rustc_session/src/config.rs index a5053c408b155..95f6348cfbdbb 100644 --- a/compiler/rustc_session/src/config.rs +++ b/compiler/rustc_session/src/config.rs @@ -3647,11 +3647,14 @@ pub enum Polonius { impl Default for Polonius { fn default() -> Self { - if option_env!("CFG_DEFAULT_POLONIUS_NEXT").is_some() { Self::Next } else { Self::Off } + Self::DEFAULT } } impl Polonius { + pub(crate) const DEFAULT: Self = + if option_env!("CFG_DEFAULT_POLONIUS_NEXT").is_some() { Self::Next } else { Self::Off }; + /// Returns whether the legacy version of polonius is enabled pub fn is_legacy_enabled(&self) -> bool { matches!(self, Polonius::Legacy) diff --git a/compiler/rustc_session/src/options.rs b/compiler/rustc_session/src/options.rs index 90459090ced87..bab087249593a 100644 --- a/compiler/rustc_session/src/options.rs +++ b/compiler/rustc_session/src/options.rs @@ -510,7 +510,7 @@ macro_rules! options { $( { TARGET_MODIFIER: $tmod_variant:ident } )? $( { MITIGATION: $mitigation_variant:ident } )? , - $desc:literal + $desc:expr $(, removed: $removed:ident )? ), )* @@ -2350,6 +2350,12 @@ options! { // - src/doc/rustc/src/codegen-options/index.md } +const POLONIUS_HELP: &str = match Polonius::DEFAULT { + Polonius::Off => "enable polonius-based borrow-checker (default: no)", + Polonius::Next => "enable polonius-based borrow-checker (default: next)", + Polonius::Legacy => panic!("Polonius::Legacy is not a valid default value"), +}; + options! { UnstableOptions, UnstableOptionsTargetModifiers, Z_OPTIONS, dbopts, "Z", "unstable", @@ -2750,7 +2756,7 @@ options! { `vt-ptr-type-discrimination - incorporate type discrimination in authenticated vtable pointers Example: `-Zpointer-authentication=+calls,-init-fini`."), polonius: Polonius = (Polonius::default(), parse_polonius, [TRACKED], - "enable polonius-based borrow-checker (default: no)"), + POLONIUS_HELP), pre_link_arg: (/* redirected to pre_link_args */) = ((), parse_string_push, [UNTRACKED], "a single extra argument to prepend the linker invocation (can be used several times)"), pre_link_args: Vec = (Vec::new(), parse_list, [UNTRACKED], diff --git a/compiler/rustc_target/src/asm/loongarch.rs b/compiler/rustc_target/src/asm/loongarch.rs index 4aa69dac2d7db..3603d54400536 100644 --- a/compiler/rustc_target/src/asm/loongarch.rs +++ b/compiler/rustc_target/src/asm/loongarch.rs @@ -53,7 +53,7 @@ impl LoongArchInlineAsmRegClass { (Self::vreg, _) => { if allow_experimental_reg { types! { - lsx: F16, F32, F64, + lsx: I128, F16, F32, F64, VecI8(16), VecI16(8), VecI32(4), VecI64(2), VecF32(4), VecF64(2); } } else { @@ -63,7 +63,7 @@ impl LoongArchInlineAsmRegClass { (Self::xreg, _) => { if allow_experimental_reg { types! { - lasx: F16, F32, F64, + lasx: I128, F16, F32, F64, VecI8(16), VecI16(8), VecI32(4), VecI64(2), VecF32(4), VecF64(2), VecI8(32), VecI16(16), VecI32(8), VecI64(4), VecF32(8), VecF64(4); } diff --git a/compiler/rustc_traits/src/normalize_projection_ty.rs b/compiler/rustc_traits/src/normalize_projection_ty.rs index 3710d41dba0d9..03dff745210d6 100644 --- a/compiler/rustc_traits/src/normalize_projection_ty.rs +++ b/compiler/rustc_traits/src/normalize_projection_ty.rs @@ -59,12 +59,6 @@ fn normalize_canonicalized_projection<'tcx>( 0, &mut obligations, ); - obligations.extend(const_arg_has_type_obligation( - tcx, - param_env, - normalized_term, - goal, - )); ocx.register_obligations(obligations); // #112047: With projections and opaques, we are able to create opaques that // are recursive (given some generic parameters of the opaque's type variables). @@ -147,12 +141,6 @@ fn normalize_canonicalized_inherent_projection<'tcx>( 0, &mut obligations, ); - obligations.extend(const_arg_has_type_obligation( - tcx, - param_env, - normalized_term, - goal, - )); ocx.register_obligations(obligations); Ok(NormalizationResult { normalized_term }) diff --git a/library/std/src/sys/fs/uefi.rs b/library/std/src/sys/fs/uefi.rs index 1a0da329ce1a3..08473e245cc8e 100644 --- a/library/std/src/sys/fs/uefi.rs +++ b/library/std/src/sys/fs/uefi.rs @@ -360,12 +360,7 @@ impl File { let off = match pos { SeekFrom::Start(p) => p, SeekFrom::End(p) => { - // Seeking to position 0xFFFFFFFFFFFFFFFF causes the current position to be set to the end of the file. - if p == 0 { - 0xFFFFFFFFFFFFFFFF - } else { - self.file_attr()?.size().checked_add_signed(p).ok_or(NEG_OFF_ERR)? - } + self.file_attr()?.size().checked_add_signed(p).ok_or(NEG_OFF_ERR)? } SeekFrom::Current(p) => self.tell()?.checked_add_signed(p).ok_or(NEG_OFF_ERR)?, }; diff --git a/src/bootstrap/src/bin/rustdoc.rs b/src/bootstrap/src/bin/rustdoc.rs index eba1e9ef1c5cf..da80d7cd8c599 100644 --- a/src/bootstrap/src/bin/rustdoc.rs +++ b/src/bootstrap/src/bin/rustdoc.rs @@ -65,7 +65,10 @@ fn main() { if let Some(crate_name) = parse_value_from_args(&args, "--crate-name") { // Add rust logo and set html root for all rustc crates. if crate_name.starts_with("rustc_") { - cmd.arg("-Ainternal_features") + // We use `-Zcrate-attr=allow` instead of `-A` to force rustdoc to forward this flag to + // the actual doctests. Otherwise those tests all receive the + // `feature(rustdoc_internals)` without receiving the `-A` which leads to errors. + cmd.arg("-Zcrate-attr=allow(internal_features)") .arg("-Zcrate-attr=doc(rust_logo)") .arg("-Zcrate-attr=doc(html_root_url = \"https://doc.rust-lang.org/nightly/nightly-rustc/\")"); diff --git a/src/bootstrap/src/utils/helpers.rs b/src/bootstrap/src/utils/helpers.rs index d41ce974c5009..7fecfe14cc578 100644 --- a/src/bootstrap/src/utils/helpers.rs +++ b/src/bootstrap/src/utils/helpers.rs @@ -141,11 +141,8 @@ pub fn libdir(target: TargetSelection) -> &'static str { /// Adds a list of lookup paths to `cmd`'s dynamic library lookup path. /// If the dylib_path_var is already set for this cmd, the old value will be overwritten! pub fn add_dylib_path(path: Vec, cmd: &mut BootstrapCommand) { - let mut list = dylib_path(); - for path in path { - list.insert(0, path); - } - cmd.env(dylib_path_var(), t!(env::join_paths(list))); + let paths = path.into_iter().chain(dylib_path()); + cmd.env(dylib_path_var(), t!(env::join_paths(paths))); } pub struct TimeIt(bool, Instant); diff --git a/src/doc/unstable-book/src/language-features/asm-experimental-reg.md b/src/doc/unstable-book/src/language-features/asm-experimental-reg.md index db72c44a2dc92..854d66f96756c 100644 --- a/src/doc/unstable-book/src/language-features/asm-experimental-reg.md +++ b/src/doc/unstable-book/src/language-features/asm-experimental-reg.md @@ -19,8 +19,8 @@ This tracks support for additional registers in architectures where inline assem | Architecture | Register class | Target feature | Allowed types | | ------------ | -------------- | -------------- | ------------- | -| LoongArch | `vreg` | `lsx` | `f32`, `f64`,
`i8x16`, `i16x8`, `i32x4`, `i64x2`, `f32x4`, `f64x2` | -| LoongArch | `xreg` | `lasx` | `f32`, `f64`,
`i8x16`, `i16x8`, `i32x4`, `i64x2`, `f32x4`, `f64x2`,
`i8x32`, `i16x16`, `i32x8`, `i64x4`, `f32x8`, `f64x4` | +| LoongArch | `vreg` | `lsx` | `i128`, `f32`, `f64`,
`i8x16`, `i16x8`, `i32x4`, `i64x2`, `f32x4`, `f64x2` | +| LoongArch | `xreg` | `lasx` | `i128`, `f32`, `f64`,
`i8x16`, `i16x8`, `i32x4`, `i64x2`, `f32x4`, `f64x2`,
`i8x32`, `i16x16`, `i32x8`, `i64x4`, `f32x8`, `f64x4` | ## Register aliases diff --git a/src/librustdoc/clean/inline.rs b/src/librustdoc/clean/inline.rs index cb7ddd0ec58e7..d7fbe64c30771 100644 --- a/src/librustdoc/clean/inline.rs +++ b/src/librustdoc/clean/inline.rs @@ -250,17 +250,21 @@ pub(crate) fn get_item_path(tcx: TyCtxt<'_>, def_id: DefId, kind: ItemType) -> V if let ItemType::Macro = kind { // Check to see if it is a macro 2.0 or built-in macro // More information in . - if matches!( - CStore::from_tcx(tcx).load_macro_untracked(tcx, def_id), - LoadedMacro::MacroDef { def, .. } if !def.macro_rules - ) { - once(crate_name).chain(relative).collect() + let is_macro_2_0_or_builtin = if let Some(local_def_id) = def_id.as_local() { + let (_, macro_def, _) = tcx.hir_expect_item(local_def_id).expect_macro(); + !macro_def.macro_rules } else { - vec![crate_name, *relative.last().expect("relative was empty")] + matches!( + CStore::from_tcx(tcx).load_macro_untracked(tcx, def_id), + LoadedMacro::MacroDef { def, .. } if !def.macro_rules + ) + }; + if !is_macro_2_0_or_builtin { + return vec![crate_name, *relative.last().expect("relative was empty")]; } - } else { - once(crate_name).chain(relative).collect() } + + once(crate_name).chain(relative).collect() } /// Record an external fully qualified name in the external_paths cache. diff --git a/tests/run-make/rustc-help/polonius-help.stdout b/tests/run-make/rustc-help/polonius-help.stdout new file mode 100644 index 0000000000000..b1dfd15c09958 --- /dev/null +++ b/tests/run-make/rustc-help/polonius-help.stdout @@ -0,0 +1 @@ + -Z polonius=val -- enable polonius-based borrow-checker (default: next) diff --git a/tests/run-make/rustc-help/rmake.rs b/tests/run-make/rustc-help/rmake.rs index 17811ef18449f..a5e733fb8d9fc 100644 --- a/tests/run-make/rustc-help/rmake.rs +++ b/tests/run-make/rustc-help/rmake.rs @@ -22,6 +22,12 @@ fn main() { // Check that all help options can be invoked at once let codegen_help = bare_rustc().arg("-Chelp").run().stdout_utf8(); let unstable_help = bare_rustc().arg("-Zhelp").run().stdout_utf8(); + let polonius_help = + format!("{}\n", unstable_help.lines().find(|line| line.contains("polonius=val")).unwrap()); + diff() + .expected_file("polonius-help.stdout") + .actual_text("rustc -Zhelp (polonius)", &polonius_help) + .run(); let lints_help = bare_rustc().arg("-Whelp").run().stdout_utf8(); let expected_all = format!("{help}{codegen_help}{unstable_help}{lints_help}"); let all_help = bare_rustc().args(["--help", "-Chelp", "-Zhelp", "-Whelp"]).run().stdout_utf8(); diff --git a/tests/rustdoc-html/auxiliary/generated_macro.rs b/tests/rustdoc-html/auxiliary/generated_macro.rs new file mode 100644 index 0000000000000..47a2eae5b3c2c --- /dev/null +++ b/tests/rustdoc-html/auxiliary/generated_macro.rs @@ -0,0 +1,17 @@ +//@ no-prefer-dynamic + +#![crate_type = "proc-macro"] + +use std::str::FromStr; + +extern crate proc_macro; + +#[proc_macro_derive(MyDeriveMacro)] +pub fn derive_my_derive_macro(item: proc_macro::TokenStream) -> proc_macro::TokenStream { + proc_macro::TokenStream::from_str(" + #[macro_export] + macro_rules! my_generated_macro { + ($my_macro_parameter: expr) => {}; + } + ").unwrap() +} diff --git a/tests/rustdoc-html/generated_macro.rs b/tests/rustdoc-html/generated_macro.rs new file mode 100644 index 0000000000000..3986930f8e631 --- /dev/null +++ b/tests/rustdoc-html/generated_macro.rs @@ -0,0 +1,16 @@ +// This test ensures that the macro generated by the proc macro has the correct +// "item-decl" code block. +// Regression test for . + +//@ aux-build:generated_macro.rs + +#![crate_name = "foo"] + +extern crate generated_macro; + +//@ has 'foo/macro.my_generated_macro.html' +//@ matches - '//*[@class="rust item-decl"]/code' \ +// 'macro_rules! my_generated_macro \{\s+\(\$my_macro_parameter:expr\) => \{ ... \};\s+\}' + +#[derive(generated_macro::MyDeriveMacro)] +struct MyStruct {} diff --git a/tests/rustdoc-ui/lints/redundant-explicit-links-ice.fixed b/tests/rustdoc-ui/lints/redundant-explicit-links-ice.fixed new file mode 100644 index 0000000000000..bfd09e970db06 --- /dev/null +++ b/tests/rustdoc-ui/lints/redundant-explicit-links-ice.fixed @@ -0,0 +1,13 @@ +// Regression test for . + +//@ run-rustfix + +#![deny(rustdoc::redundant_explicit_links)] + +//! [queue] +//~^ ERROR redundant explicit link target + +#[macro_export] +macro_rules! queue { + () => {}; +} diff --git a/tests/rustdoc-ui/lints/redundant-explicit-links-ice.rs b/tests/rustdoc-ui/lints/redundant-explicit-links-ice.rs new file mode 100644 index 0000000000000..a129baecdb79f --- /dev/null +++ b/tests/rustdoc-ui/lints/redundant-explicit-links-ice.rs @@ -0,0 +1,13 @@ +// Regression test for . + +//@ run-rustfix + +#![deny(rustdoc::redundant_explicit_links)] + +//! [queue](macro.queue.html) +//~^ ERROR redundant explicit link target + +#[macro_export] +macro_rules! queue { + () => {}; +} diff --git a/tests/rustdoc-ui/lints/redundant-explicit-links-ice.stderr b/tests/rustdoc-ui/lints/redundant-explicit-links-ice.stderr new file mode 100644 index 0000000000000..2caf08e26936f --- /dev/null +++ b/tests/rustdoc-ui/lints/redundant-explicit-links-ice.stderr @@ -0,0 +1,23 @@ +error: redundant explicit link target + --> $DIR/redundant-explicit-links-ice.rs:7:13 + | +LL | //! [queue](macro.queue.html) + | ----- ^^^^^^^^^^^^^^^^ explicit target is redundant + | | + | because label contains path that resolves to same destination + | + = note: when a link's destination is not specified, + the label is used to resolve intra-doc links +note: the lint level is defined here + --> $DIR/redundant-explicit-links-ice.rs:5:9 + | +LL | #![deny(rustdoc::redundant_explicit_links)] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +help: remove explicit link target + | +LL - //! [queue](macro.queue.html) +LL + //! [queue] + | + +error: aborting due to 1 previous error + diff --git a/tests/ui/asm/loongarch/bad-reg.loongarch32_ilp32d.stderr b/tests/ui/asm/loongarch/bad-reg.loongarch32_ilp32d.stderr index 28ac455c06441..dca21ad47ea10 100644 --- a/tests/ui/asm/loongarch/bad-reg.loongarch32_ilp32d.stderr +++ b/tests/ui/asm/loongarch/bad-reg.loongarch32_ilp32d.stderr @@ -1,41 +1,51 @@ error: invalid register `$r0`: constant zero cannot be used as an operand for inline asm - --> $DIR/bad-reg.rs:28:18 + --> $DIR/bad-reg.rs:29:18 | LL | asm!("", out("$r0") _); | ^^^^^^^^^^^^ error: invalid register `$tp`: reserved for TLS - --> $DIR/bad-reg.rs:30:18 + --> $DIR/bad-reg.rs:31:18 | LL | asm!("", out("$tp") _); | ^^^^^^^^^^^^ error: invalid register `$sp`: the stack pointer cannot be used as an operand for inline asm - --> $DIR/bad-reg.rs:32:18 + --> $DIR/bad-reg.rs:33:18 | LL | asm!("", out("$sp") _); | ^^^^^^^^^^^^ error: invalid register `$r21`: reserved by the ABI - --> $DIR/bad-reg.rs:34:18 + --> $DIR/bad-reg.rs:35:18 | LL | asm!("", out("$r21") _); | ^^^^^^^^^^^^^ error: invalid register `$fp`: the frame pointer cannot be used as an operand for inline asm - --> $DIR/bad-reg.rs:36:18 + --> $DIR/bad-reg.rs:37:18 | LL | asm!("", out("$fp") _); | ^^^^^^^^^^^^ error: invalid register `$r31`: $r31 is used internally by LLVM and cannot be used as an operand for inline asm - --> $DIR/bad-reg.rs:38:18 + --> $DIR/bad-reg.rs:39:18 | LL | asm!("", out("$r31") _); | ^^^^^^^^^^^^^ error[E0658]: register class `vreg` can only be used as a clobber in stable - --> $DIR/bad-reg.rs:52:26 + --> $DIR/bad-reg.rs:53:26 + | +LL | asm!("/* {} */", in(vreg) q); + | ^^^^^^^^^^ + | + = note: see issue #133416 for more information + = help: add `#![feature(asm_experimental_reg)]` to the crate attributes to enable + = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date + +error[E0658]: register class `vreg` can only be used as a clobber in stable + --> $DIR/bad-reg.rs:56:26 | LL | asm!("/* {} */", in(vreg) f); | ^^^^^^^^^^ @@ -45,7 +55,7 @@ LL | asm!("/* {} */", in(vreg) f); = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date error[E0658]: register class `vreg` can only be used as a clobber in stable - --> $DIR/bad-reg.rs:55:26 + --> $DIR/bad-reg.rs:59:26 | LL | asm!("/* {} */", out(vreg) _); | ^^^^^^^^^^^ @@ -55,7 +65,7 @@ LL | asm!("/* {} */", out(vreg) _); = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date error[E0658]: register class `vreg` can only be used as a clobber in stable - --> $DIR/bad-reg.rs:57:26 + --> $DIR/bad-reg.rs:61:26 | LL | asm!("/* {} */", in(vreg) d); | ^^^^^^^^^^ @@ -65,7 +75,7 @@ LL | asm!("/* {} */", in(vreg) d); = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date error[E0658]: register class `vreg` can only be used as a clobber in stable - --> $DIR/bad-reg.rs:60:26 + --> $DIR/bad-reg.rs:64:26 | LL | asm!("/* {} */", out(vreg) d); | ^^^^^^^^^^^ @@ -75,7 +85,17 @@ LL | asm!("/* {} */", out(vreg) d); = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date error[E0658]: register class `xreg` can only be used as a clobber in stable - --> $DIR/bad-reg.rs:65:26 + --> $DIR/bad-reg.rs:69:26 + | +LL | asm!("/* {} */", in(xreg) q); + | ^^^^^^^^^^ + | + = note: see issue #133416 for more information + = help: add `#![feature(asm_experimental_reg)]` to the crate attributes to enable + = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date + +error[E0658]: register class `xreg` can only be used as a clobber in stable + --> $DIR/bad-reg.rs:72:26 | LL | asm!("/* {} */", in(xreg) f); | ^^^^^^^^^^ @@ -85,7 +105,7 @@ LL | asm!("/* {} */", in(xreg) f); = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date error[E0658]: register class `xreg` can only be used as a clobber in stable - --> $DIR/bad-reg.rs:68:26 + --> $DIR/bad-reg.rs:75:26 | LL | asm!("/* {} */", out(xreg) _); | ^^^^^^^^^^^ @@ -95,7 +115,7 @@ LL | asm!("/* {} */", out(xreg) _); = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date error[E0658]: register class `xreg` can only be used as a clobber in stable - --> $DIR/bad-reg.rs:70:26 + --> $DIR/bad-reg.rs:77:26 | LL | asm!("/* {} */", in(xreg) d); | ^^^^^^^^^^ @@ -105,7 +125,7 @@ LL | asm!("/* {} */", in(xreg) d); = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date error[E0658]: register class `xreg` can only be used as a clobber in stable - --> $DIR/bad-reg.rs:73:26 + --> $DIR/bad-reg.rs:80:26 | LL | asm!("/* {} */", out(xreg) d); | ^^^^^^^^^^^ @@ -115,7 +135,7 @@ LL | asm!("/* {} */", out(xreg) d); = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date error[E0658]: register class `vreg` can only be used as a clobber in stable - --> $DIR/bad-reg.rs:77:31 + --> $DIR/bad-reg.rs:84:31 | LL | asm!("", in("$f0") f, in("$vr0") d); | ^^^^^^^^^^^^ @@ -125,7 +145,7 @@ LL | asm!("", in("$f0") f, in("$vr0") d); = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date error[E0658]: register class `xreg` can only be used as a clobber in stable - --> $DIR/bad-reg.rs:82:31 + --> $DIR/bad-reg.rs:89:31 | LL | asm!("", in("$f0") f, in("$xr0") d); | ^^^^^^^^^^^^ @@ -135,7 +155,7 @@ LL | asm!("", in("$f0") f, in("$xr0") d); = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date error[E0658]: register class `vreg` can only be used as a clobber in stable - --> $DIR/bad-reg.rs:87:18 + --> $DIR/bad-reg.rs:94:18 | LL | asm!("", in("$vr0") f, in("$xr0") d); | ^^^^^^^^^^^^ @@ -145,7 +165,7 @@ LL | asm!("", in("$vr0") f, in("$xr0") d); = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date error[E0658]: register class `xreg` can only be used as a clobber in stable - --> $DIR/bad-reg.rs:87:32 + --> $DIR/bad-reg.rs:94:32 | LL | asm!("", in("$vr0") f, in("$xr0") d); | ^^^^^^^^^^^^ @@ -154,8 +174,18 @@ LL | asm!("", in("$vr0") f, in("$xr0") d); = help: add `#![feature(asm_experimental_reg)]` to the crate attributes to enable = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date +error[E0658]: type `u128` cannot be used with this register class in stable + --> $DIR/bad-reg.rs:53:35 + | +LL | asm!("/* {} */", in(vreg) q); + | ^ + | + = note: see issue #133416 for more information + = help: add `#![feature(asm_experimental_reg)]` to the crate attributes to enable + = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date + error[E0658]: type `f32` cannot be used with this register class in stable - --> $DIR/bad-reg.rs:52:35 + --> $DIR/bad-reg.rs:56:35 | LL | asm!("/* {} */", in(vreg) f); | ^ @@ -165,7 +195,7 @@ LL | asm!("/* {} */", in(vreg) f); = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date error[E0658]: type `f64` cannot be used with this register class in stable - --> $DIR/bad-reg.rs:57:35 + --> $DIR/bad-reg.rs:61:35 | LL | asm!("/* {} */", in(vreg) d); | ^ @@ -175,7 +205,7 @@ LL | asm!("/* {} */", in(vreg) d); = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date error[E0658]: type `f64` cannot be used with this register class in stable - --> $DIR/bad-reg.rs:60:36 + --> $DIR/bad-reg.rs:64:36 | LL | asm!("/* {} */", out(vreg) d); | ^ @@ -184,8 +214,18 @@ LL | asm!("/* {} */", out(vreg) d); = help: add `#![feature(asm_experimental_reg)]` to the crate attributes to enable = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date +error[E0658]: type `u128` cannot be used with this register class in stable + --> $DIR/bad-reg.rs:69:35 + | +LL | asm!("/* {} */", in(xreg) q); + | ^ + | + = note: see issue #133416 for more information + = help: add `#![feature(asm_experimental_reg)]` to the crate attributes to enable + = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date + error[E0658]: type `f32` cannot be used with this register class in stable - --> $DIR/bad-reg.rs:65:35 + --> $DIR/bad-reg.rs:72:35 | LL | asm!("/* {} */", in(xreg) f); | ^ @@ -195,7 +235,7 @@ LL | asm!("/* {} */", in(xreg) f); = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date error[E0658]: type `f64` cannot be used with this register class in stable - --> $DIR/bad-reg.rs:70:35 + --> $DIR/bad-reg.rs:77:35 | LL | asm!("/* {} */", in(xreg) d); | ^ @@ -205,7 +245,7 @@ LL | asm!("/* {} */", in(xreg) d); = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date error[E0658]: type `f64` cannot be used with this register class in stable - --> $DIR/bad-reg.rs:73:36 + --> $DIR/bad-reg.rs:80:36 | LL | asm!("/* {} */", out(xreg) d); | ^ @@ -215,7 +255,7 @@ LL | asm!("/* {} */", out(xreg) d); = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date error[E0658]: type `f64` cannot be used with this register class in stable - --> $DIR/bad-reg.rs:77:42 + --> $DIR/bad-reg.rs:84:42 | LL | asm!("", in("$f0") f, in("$vr0") d); | ^ @@ -225,7 +265,7 @@ LL | asm!("", in("$f0") f, in("$vr0") d); = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date error[E0658]: type `f64` cannot be used with this register class in stable - --> $DIR/bad-reg.rs:82:42 + --> $DIR/bad-reg.rs:89:42 | LL | asm!("", in("$f0") f, in("$xr0") d); | ^ @@ -235,7 +275,7 @@ LL | asm!("", in("$f0") f, in("$xr0") d); = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date error[E0658]: type `f32` cannot be used with this register class in stable - --> $DIR/bad-reg.rs:87:29 + --> $DIR/bad-reg.rs:94:29 | LL | asm!("", in("$vr0") f, in("$xr0") d); | ^ @@ -245,7 +285,7 @@ LL | asm!("", in("$vr0") f, in("$xr0") d); = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date error[E0658]: type `f64` cannot be used with this register class in stable - --> $DIR/bad-reg.rs:87:43 + --> $DIR/bad-reg.rs:94:43 | LL | asm!("", in("$vr0") f, in("$xr0") d); | ^ @@ -254,6 +294,6 @@ LL | asm!("", in("$vr0") f, in("$xr0") d); = help: add `#![feature(asm_experimental_reg)]` to the crate attributes to enable = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date -error: aborting due to 28 previous errors +error: aborting due to 32 previous errors For more information about this error, try `rustc --explain E0658`. diff --git a/tests/ui/asm/loongarch/bad-reg.loongarch32_ilp32s.stderr b/tests/ui/asm/loongarch/bad-reg.loongarch32_ilp32s.stderr index 1ee1b86989c4d..9ffab83db95cb 100644 --- a/tests/ui/asm/loongarch/bad-reg.loongarch32_ilp32s.stderr +++ b/tests/ui/asm/loongarch/bad-reg.loongarch32_ilp32s.stderr @@ -1,41 +1,51 @@ error: invalid register `$r0`: constant zero cannot be used as an operand for inline asm - --> $DIR/bad-reg.rs:28:18 + --> $DIR/bad-reg.rs:29:18 | LL | asm!("", out("$r0") _); | ^^^^^^^^^^^^ error: invalid register `$tp`: reserved for TLS - --> $DIR/bad-reg.rs:30:18 + --> $DIR/bad-reg.rs:31:18 | LL | asm!("", out("$tp") _); | ^^^^^^^^^^^^ error: invalid register `$sp`: the stack pointer cannot be used as an operand for inline asm - --> $DIR/bad-reg.rs:32:18 + --> $DIR/bad-reg.rs:33:18 | LL | asm!("", out("$sp") _); | ^^^^^^^^^^^^ error: invalid register `$r21`: reserved by the ABI - --> $DIR/bad-reg.rs:34:18 + --> $DIR/bad-reg.rs:35:18 | LL | asm!("", out("$r21") _); | ^^^^^^^^^^^^^ error: invalid register `$fp`: the frame pointer cannot be used as an operand for inline asm - --> $DIR/bad-reg.rs:36:18 + --> $DIR/bad-reg.rs:37:18 | LL | asm!("", out("$fp") _); | ^^^^^^^^^^^^ error: invalid register `$r31`: $r31 is used internally by LLVM and cannot be used as an operand for inline asm - --> $DIR/bad-reg.rs:38:18 + --> $DIR/bad-reg.rs:39:18 | LL | asm!("", out("$r31") _); | ^^^^^^^^^^^^^ error[E0658]: register class `vreg` can only be used as a clobber in stable - --> $DIR/bad-reg.rs:52:26 + --> $DIR/bad-reg.rs:53:26 + | +LL | asm!("/* {} */", in(vreg) q); + | ^^^^^^^^^^ + | + = note: see issue #133416 for more information + = help: add `#![feature(asm_experimental_reg)]` to the crate attributes to enable + = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date + +error[E0658]: register class `vreg` can only be used as a clobber in stable + --> $DIR/bad-reg.rs:56:26 | LL | asm!("/* {} */", in(vreg) f); | ^^^^^^^^^^ @@ -45,7 +55,7 @@ LL | asm!("/* {} */", in(vreg) f); = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date error[E0658]: register class `vreg` can only be used as a clobber in stable - --> $DIR/bad-reg.rs:55:26 + --> $DIR/bad-reg.rs:59:26 | LL | asm!("/* {} */", out(vreg) _); | ^^^^^^^^^^^ @@ -55,7 +65,7 @@ LL | asm!("/* {} */", out(vreg) _); = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date error[E0658]: register class `vreg` can only be used as a clobber in stable - --> $DIR/bad-reg.rs:57:26 + --> $DIR/bad-reg.rs:61:26 | LL | asm!("/* {} */", in(vreg) d); | ^^^^^^^^^^ @@ -65,7 +75,7 @@ LL | asm!("/* {} */", in(vreg) d); = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date error[E0658]: register class `vreg` can only be used as a clobber in stable - --> $DIR/bad-reg.rs:60:26 + --> $DIR/bad-reg.rs:64:26 | LL | asm!("/* {} */", out(vreg) d); | ^^^^^^^^^^^ @@ -75,7 +85,17 @@ LL | asm!("/* {} */", out(vreg) d); = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date error[E0658]: register class `xreg` can only be used as a clobber in stable - --> $DIR/bad-reg.rs:65:26 + --> $DIR/bad-reg.rs:69:26 + | +LL | asm!("/* {} */", in(xreg) q); + | ^^^^^^^^^^ + | + = note: see issue #133416 for more information + = help: add `#![feature(asm_experimental_reg)]` to the crate attributes to enable + = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date + +error[E0658]: register class `xreg` can only be used as a clobber in stable + --> $DIR/bad-reg.rs:72:26 | LL | asm!("/* {} */", in(xreg) f); | ^^^^^^^^^^ @@ -85,7 +105,7 @@ LL | asm!("/* {} */", in(xreg) f); = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date error[E0658]: register class `xreg` can only be used as a clobber in stable - --> $DIR/bad-reg.rs:68:26 + --> $DIR/bad-reg.rs:75:26 | LL | asm!("/* {} */", out(xreg) _); | ^^^^^^^^^^^ @@ -95,7 +115,7 @@ LL | asm!("/* {} */", out(xreg) _); = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date error[E0658]: register class `xreg` can only be used as a clobber in stable - --> $DIR/bad-reg.rs:70:26 + --> $DIR/bad-reg.rs:77:26 | LL | asm!("/* {} */", in(xreg) d); | ^^^^^^^^^^ @@ -105,7 +125,7 @@ LL | asm!("/* {} */", in(xreg) d); = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date error[E0658]: register class `xreg` can only be used as a clobber in stable - --> $DIR/bad-reg.rs:73:26 + --> $DIR/bad-reg.rs:80:26 | LL | asm!("/* {} */", out(xreg) d); | ^^^^^^^^^^^ @@ -115,7 +135,7 @@ LL | asm!("/* {} */", out(xreg) d); = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date error[E0658]: register class `vreg` can only be used as a clobber in stable - --> $DIR/bad-reg.rs:77:31 + --> $DIR/bad-reg.rs:84:31 | LL | asm!("", in("$f0") f, in("$vr0") d); | ^^^^^^^^^^^^ @@ -125,7 +145,7 @@ LL | asm!("", in("$f0") f, in("$vr0") d); = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date error[E0658]: register class `xreg` can only be used as a clobber in stable - --> $DIR/bad-reg.rs:82:31 + --> $DIR/bad-reg.rs:89:31 | LL | asm!("", in("$f0") f, in("$xr0") d); | ^^^^^^^^^^^^ @@ -135,7 +155,7 @@ LL | asm!("", in("$f0") f, in("$xr0") d); = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date error[E0658]: register class `vreg` can only be used as a clobber in stable - --> $DIR/bad-reg.rs:87:18 + --> $DIR/bad-reg.rs:94:18 | LL | asm!("", in("$vr0") f, in("$xr0") d); | ^^^^^^^^^^^^ @@ -145,7 +165,7 @@ LL | asm!("", in("$vr0") f, in("$xr0") d); = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date error[E0658]: register class `xreg` can only be used as a clobber in stable - --> $DIR/bad-reg.rs:87:32 + --> $DIR/bad-reg.rs:94:32 | LL | asm!("", in("$vr0") f, in("$xr0") d); | ^^^^^^^^^^^^ @@ -155,31 +175,41 @@ LL | asm!("", in("$vr0") f, in("$xr0") d); = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date error: register class `freg` requires at least one of the following target features: d, f - --> $DIR/bad-reg.rs:42:26 + --> $DIR/bad-reg.rs:43:26 | LL | asm!("/* {} */", in(freg) f); | ^^^^^^^^^^ error: register class `freg` requires at least one of the following target features: d, f - --> $DIR/bad-reg.rs:44:26 + --> $DIR/bad-reg.rs:45:26 | LL | asm!("/* {} */", out(freg) _); | ^^^^^^^^^^^ error: register class `freg` requires at least one of the following target features: d, f - --> $DIR/bad-reg.rs:46:26 + --> $DIR/bad-reg.rs:47:26 | LL | asm!("/* {} */", in(freg) d); | ^^^^^^^^^^ error: register class `freg` requires at least one of the following target features: d, f - --> $DIR/bad-reg.rs:48:26 + --> $DIR/bad-reg.rs:49:26 | LL | asm!("/* {} */", out(freg) d); | ^^^^^^^^^^^ +error[E0658]: type `u128` cannot be used with this register class in stable + --> $DIR/bad-reg.rs:53:35 + | +LL | asm!("/* {} */", in(vreg) q); + | ^ + | + = note: see issue #133416 for more information + = help: add `#![feature(asm_experimental_reg)]` to the crate attributes to enable + = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date + error[E0658]: type `f32` cannot be used with this register class in stable - --> $DIR/bad-reg.rs:52:35 + --> $DIR/bad-reg.rs:56:35 | LL | asm!("/* {} */", in(vreg) f); | ^ @@ -189,7 +219,7 @@ LL | asm!("/* {} */", in(vreg) f); = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date error[E0658]: type `f64` cannot be used with this register class in stable - --> $DIR/bad-reg.rs:57:35 + --> $DIR/bad-reg.rs:61:35 | LL | asm!("/* {} */", in(vreg) d); | ^ @@ -199,7 +229,7 @@ LL | asm!("/* {} */", in(vreg) d); = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date error[E0658]: type `f64` cannot be used with this register class in stable - --> $DIR/bad-reg.rs:60:36 + --> $DIR/bad-reg.rs:64:36 | LL | asm!("/* {} */", out(vreg) d); | ^ @@ -208,8 +238,18 @@ LL | asm!("/* {} */", out(vreg) d); = help: add `#![feature(asm_experimental_reg)]` to the crate attributes to enable = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date +error[E0658]: type `u128` cannot be used with this register class in stable + --> $DIR/bad-reg.rs:69:35 + | +LL | asm!("/* {} */", in(xreg) q); + | ^ + | + = note: see issue #133416 for more information + = help: add `#![feature(asm_experimental_reg)]` to the crate attributes to enable + = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date + error[E0658]: type `f32` cannot be used with this register class in stable - --> $DIR/bad-reg.rs:65:35 + --> $DIR/bad-reg.rs:72:35 | LL | asm!("/* {} */", in(xreg) f); | ^ @@ -219,7 +259,7 @@ LL | asm!("/* {} */", in(xreg) f); = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date error[E0658]: type `f64` cannot be used with this register class in stable - --> $DIR/bad-reg.rs:70:35 + --> $DIR/bad-reg.rs:77:35 | LL | asm!("/* {} */", in(xreg) d); | ^ @@ -229,7 +269,7 @@ LL | asm!("/* {} */", in(xreg) d); = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date error[E0658]: type `f64` cannot be used with this register class in stable - --> $DIR/bad-reg.rs:73:36 + --> $DIR/bad-reg.rs:80:36 | LL | asm!("/* {} */", out(xreg) d); | ^ @@ -239,13 +279,13 @@ LL | asm!("/* {} */", out(xreg) d); = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date error: register class `freg` requires at least one of the following target features: d, f - --> $DIR/bad-reg.rs:77:18 + --> $DIR/bad-reg.rs:84:18 | LL | asm!("", in("$f0") f, in("$vr0") d); | ^^^^^^^^^^^ error[E0658]: type `f64` cannot be used with this register class in stable - --> $DIR/bad-reg.rs:77:42 + --> $DIR/bad-reg.rs:84:42 | LL | asm!("", in("$f0") f, in("$vr0") d); | ^ @@ -255,13 +295,13 @@ LL | asm!("", in("$f0") f, in("$vr0") d); = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date error: register class `freg` requires at least one of the following target features: d, f - --> $DIR/bad-reg.rs:82:18 + --> $DIR/bad-reg.rs:89:18 | LL | asm!("", in("$f0") f, in("$xr0") d); | ^^^^^^^^^^^ error[E0658]: type `f64` cannot be used with this register class in stable - --> $DIR/bad-reg.rs:82:42 + --> $DIR/bad-reg.rs:89:42 | LL | asm!("", in("$f0") f, in("$xr0") d); | ^ @@ -271,7 +311,7 @@ LL | asm!("", in("$f0") f, in("$xr0") d); = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date error[E0658]: type `f32` cannot be used with this register class in stable - --> $DIR/bad-reg.rs:87:29 + --> $DIR/bad-reg.rs:94:29 | LL | asm!("", in("$vr0") f, in("$xr0") d); | ^ @@ -281,7 +321,7 @@ LL | asm!("", in("$vr0") f, in("$xr0") d); = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date error[E0658]: type `f64` cannot be used with this register class in stable - --> $DIR/bad-reg.rs:87:43 + --> $DIR/bad-reg.rs:94:43 | LL | asm!("", in("$vr0") f, in("$xr0") d); | ^ @@ -290,6 +330,6 @@ LL | asm!("", in("$vr0") f, in("$xr0") d); = help: add `#![feature(asm_experimental_reg)]` to the crate attributes to enable = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date -error: aborting due to 34 previous errors +error: aborting due to 38 previous errors For more information about this error, try `rustc --explain E0658`. diff --git a/tests/ui/asm/loongarch/bad-reg.loongarch64_lp64d.stderr b/tests/ui/asm/loongarch/bad-reg.loongarch64_lp64d.stderr index 97462d6dc5f0b..067dd354f3093 100644 --- a/tests/ui/asm/loongarch/bad-reg.loongarch64_lp64d.stderr +++ b/tests/ui/asm/loongarch/bad-reg.loongarch64_lp64d.stderr @@ -1,41 +1,41 @@ error: invalid register `$r0`: constant zero cannot be used as an operand for inline asm - --> $DIR/bad-reg.rs:28:18 + --> $DIR/bad-reg.rs:29:18 | LL | asm!("", out("$r0") _); | ^^^^^^^^^^^^ error: invalid register `$tp`: reserved for TLS - --> $DIR/bad-reg.rs:30:18 + --> $DIR/bad-reg.rs:31:18 | LL | asm!("", out("$tp") _); | ^^^^^^^^^^^^ error: invalid register `$sp`: the stack pointer cannot be used as an operand for inline asm - --> $DIR/bad-reg.rs:32:18 + --> $DIR/bad-reg.rs:33:18 | LL | asm!("", out("$sp") _); | ^^^^^^^^^^^^ error: invalid register `$r21`: reserved by the ABI - --> $DIR/bad-reg.rs:34:18 + --> $DIR/bad-reg.rs:35:18 | LL | asm!("", out("$r21") _); | ^^^^^^^^^^^^^ error: invalid register `$fp`: the frame pointer cannot be used as an operand for inline asm - --> $DIR/bad-reg.rs:36:18 + --> $DIR/bad-reg.rs:37:18 | LL | asm!("", out("$fp") _); | ^^^^^^^^^^^^ error: invalid register `$r31`: $r31 is used internally by LLVM and cannot be used as an operand for inline asm - --> $DIR/bad-reg.rs:38:18 + --> $DIR/bad-reg.rs:39:18 | LL | asm!("", out("$r31") _); | ^^^^^^^^^^^^^ error: register `$vr0` conflicts with register `$f0` - --> $DIR/bad-reg.rs:77:31 + --> $DIR/bad-reg.rs:84:31 | LL | asm!("", in("$f0") f, in("$vr0") d); | ----------- ^^^^^^^^^^^^ register `$vr0` @@ -43,7 +43,7 @@ LL | asm!("", in("$f0") f, in("$vr0") d); | register `$f0` error: register `$xr0` conflicts with register `$f0` - --> $DIR/bad-reg.rs:82:31 + --> $DIR/bad-reg.rs:89:31 | LL | asm!("", in("$f0") f, in("$xr0") d); | ----------- ^^^^^^^^^^^^ register `$xr0` @@ -51,7 +51,7 @@ LL | asm!("", in("$f0") f, in("$xr0") d); | register `$f0` error: register `$xr0` conflicts with register `$vr0` - --> $DIR/bad-reg.rs:87:32 + --> $DIR/bad-reg.rs:94:32 | LL | asm!("", in("$vr0") f, in("$xr0") d); | ------------ ^^^^^^^^^^^^ register `$xr0` diff --git a/tests/ui/asm/loongarch/bad-reg.loongarch64_lp64s.stderr b/tests/ui/asm/loongarch/bad-reg.loongarch64_lp64s.stderr index 1ee1b86989c4d..9ffab83db95cb 100644 --- a/tests/ui/asm/loongarch/bad-reg.loongarch64_lp64s.stderr +++ b/tests/ui/asm/loongarch/bad-reg.loongarch64_lp64s.stderr @@ -1,41 +1,51 @@ error: invalid register `$r0`: constant zero cannot be used as an operand for inline asm - --> $DIR/bad-reg.rs:28:18 + --> $DIR/bad-reg.rs:29:18 | LL | asm!("", out("$r0") _); | ^^^^^^^^^^^^ error: invalid register `$tp`: reserved for TLS - --> $DIR/bad-reg.rs:30:18 + --> $DIR/bad-reg.rs:31:18 | LL | asm!("", out("$tp") _); | ^^^^^^^^^^^^ error: invalid register `$sp`: the stack pointer cannot be used as an operand for inline asm - --> $DIR/bad-reg.rs:32:18 + --> $DIR/bad-reg.rs:33:18 | LL | asm!("", out("$sp") _); | ^^^^^^^^^^^^ error: invalid register `$r21`: reserved by the ABI - --> $DIR/bad-reg.rs:34:18 + --> $DIR/bad-reg.rs:35:18 | LL | asm!("", out("$r21") _); | ^^^^^^^^^^^^^ error: invalid register `$fp`: the frame pointer cannot be used as an operand for inline asm - --> $DIR/bad-reg.rs:36:18 + --> $DIR/bad-reg.rs:37:18 | LL | asm!("", out("$fp") _); | ^^^^^^^^^^^^ error: invalid register `$r31`: $r31 is used internally by LLVM and cannot be used as an operand for inline asm - --> $DIR/bad-reg.rs:38:18 + --> $DIR/bad-reg.rs:39:18 | LL | asm!("", out("$r31") _); | ^^^^^^^^^^^^^ error[E0658]: register class `vreg` can only be used as a clobber in stable - --> $DIR/bad-reg.rs:52:26 + --> $DIR/bad-reg.rs:53:26 + | +LL | asm!("/* {} */", in(vreg) q); + | ^^^^^^^^^^ + | + = note: see issue #133416 for more information + = help: add `#![feature(asm_experimental_reg)]` to the crate attributes to enable + = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date + +error[E0658]: register class `vreg` can only be used as a clobber in stable + --> $DIR/bad-reg.rs:56:26 | LL | asm!("/* {} */", in(vreg) f); | ^^^^^^^^^^ @@ -45,7 +55,7 @@ LL | asm!("/* {} */", in(vreg) f); = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date error[E0658]: register class `vreg` can only be used as a clobber in stable - --> $DIR/bad-reg.rs:55:26 + --> $DIR/bad-reg.rs:59:26 | LL | asm!("/* {} */", out(vreg) _); | ^^^^^^^^^^^ @@ -55,7 +65,7 @@ LL | asm!("/* {} */", out(vreg) _); = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date error[E0658]: register class `vreg` can only be used as a clobber in stable - --> $DIR/bad-reg.rs:57:26 + --> $DIR/bad-reg.rs:61:26 | LL | asm!("/* {} */", in(vreg) d); | ^^^^^^^^^^ @@ -65,7 +75,7 @@ LL | asm!("/* {} */", in(vreg) d); = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date error[E0658]: register class `vreg` can only be used as a clobber in stable - --> $DIR/bad-reg.rs:60:26 + --> $DIR/bad-reg.rs:64:26 | LL | asm!("/* {} */", out(vreg) d); | ^^^^^^^^^^^ @@ -75,7 +85,17 @@ LL | asm!("/* {} */", out(vreg) d); = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date error[E0658]: register class `xreg` can only be used as a clobber in stable - --> $DIR/bad-reg.rs:65:26 + --> $DIR/bad-reg.rs:69:26 + | +LL | asm!("/* {} */", in(xreg) q); + | ^^^^^^^^^^ + | + = note: see issue #133416 for more information + = help: add `#![feature(asm_experimental_reg)]` to the crate attributes to enable + = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date + +error[E0658]: register class `xreg` can only be used as a clobber in stable + --> $DIR/bad-reg.rs:72:26 | LL | asm!("/* {} */", in(xreg) f); | ^^^^^^^^^^ @@ -85,7 +105,7 @@ LL | asm!("/* {} */", in(xreg) f); = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date error[E0658]: register class `xreg` can only be used as a clobber in stable - --> $DIR/bad-reg.rs:68:26 + --> $DIR/bad-reg.rs:75:26 | LL | asm!("/* {} */", out(xreg) _); | ^^^^^^^^^^^ @@ -95,7 +115,7 @@ LL | asm!("/* {} */", out(xreg) _); = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date error[E0658]: register class `xreg` can only be used as a clobber in stable - --> $DIR/bad-reg.rs:70:26 + --> $DIR/bad-reg.rs:77:26 | LL | asm!("/* {} */", in(xreg) d); | ^^^^^^^^^^ @@ -105,7 +125,7 @@ LL | asm!("/* {} */", in(xreg) d); = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date error[E0658]: register class `xreg` can only be used as a clobber in stable - --> $DIR/bad-reg.rs:73:26 + --> $DIR/bad-reg.rs:80:26 | LL | asm!("/* {} */", out(xreg) d); | ^^^^^^^^^^^ @@ -115,7 +135,7 @@ LL | asm!("/* {} */", out(xreg) d); = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date error[E0658]: register class `vreg` can only be used as a clobber in stable - --> $DIR/bad-reg.rs:77:31 + --> $DIR/bad-reg.rs:84:31 | LL | asm!("", in("$f0") f, in("$vr0") d); | ^^^^^^^^^^^^ @@ -125,7 +145,7 @@ LL | asm!("", in("$f0") f, in("$vr0") d); = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date error[E0658]: register class `xreg` can only be used as a clobber in stable - --> $DIR/bad-reg.rs:82:31 + --> $DIR/bad-reg.rs:89:31 | LL | asm!("", in("$f0") f, in("$xr0") d); | ^^^^^^^^^^^^ @@ -135,7 +155,7 @@ LL | asm!("", in("$f0") f, in("$xr0") d); = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date error[E0658]: register class `vreg` can only be used as a clobber in stable - --> $DIR/bad-reg.rs:87:18 + --> $DIR/bad-reg.rs:94:18 | LL | asm!("", in("$vr0") f, in("$xr0") d); | ^^^^^^^^^^^^ @@ -145,7 +165,7 @@ LL | asm!("", in("$vr0") f, in("$xr0") d); = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date error[E0658]: register class `xreg` can only be used as a clobber in stable - --> $DIR/bad-reg.rs:87:32 + --> $DIR/bad-reg.rs:94:32 | LL | asm!("", in("$vr0") f, in("$xr0") d); | ^^^^^^^^^^^^ @@ -155,31 +175,41 @@ LL | asm!("", in("$vr0") f, in("$xr0") d); = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date error: register class `freg` requires at least one of the following target features: d, f - --> $DIR/bad-reg.rs:42:26 + --> $DIR/bad-reg.rs:43:26 | LL | asm!("/* {} */", in(freg) f); | ^^^^^^^^^^ error: register class `freg` requires at least one of the following target features: d, f - --> $DIR/bad-reg.rs:44:26 + --> $DIR/bad-reg.rs:45:26 | LL | asm!("/* {} */", out(freg) _); | ^^^^^^^^^^^ error: register class `freg` requires at least one of the following target features: d, f - --> $DIR/bad-reg.rs:46:26 + --> $DIR/bad-reg.rs:47:26 | LL | asm!("/* {} */", in(freg) d); | ^^^^^^^^^^ error: register class `freg` requires at least one of the following target features: d, f - --> $DIR/bad-reg.rs:48:26 + --> $DIR/bad-reg.rs:49:26 | LL | asm!("/* {} */", out(freg) d); | ^^^^^^^^^^^ +error[E0658]: type `u128` cannot be used with this register class in stable + --> $DIR/bad-reg.rs:53:35 + | +LL | asm!("/* {} */", in(vreg) q); + | ^ + | + = note: see issue #133416 for more information + = help: add `#![feature(asm_experimental_reg)]` to the crate attributes to enable + = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date + error[E0658]: type `f32` cannot be used with this register class in stable - --> $DIR/bad-reg.rs:52:35 + --> $DIR/bad-reg.rs:56:35 | LL | asm!("/* {} */", in(vreg) f); | ^ @@ -189,7 +219,7 @@ LL | asm!("/* {} */", in(vreg) f); = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date error[E0658]: type `f64` cannot be used with this register class in stable - --> $DIR/bad-reg.rs:57:35 + --> $DIR/bad-reg.rs:61:35 | LL | asm!("/* {} */", in(vreg) d); | ^ @@ -199,7 +229,7 @@ LL | asm!("/* {} */", in(vreg) d); = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date error[E0658]: type `f64` cannot be used with this register class in stable - --> $DIR/bad-reg.rs:60:36 + --> $DIR/bad-reg.rs:64:36 | LL | asm!("/* {} */", out(vreg) d); | ^ @@ -208,8 +238,18 @@ LL | asm!("/* {} */", out(vreg) d); = help: add `#![feature(asm_experimental_reg)]` to the crate attributes to enable = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date +error[E0658]: type `u128` cannot be used with this register class in stable + --> $DIR/bad-reg.rs:69:35 + | +LL | asm!("/* {} */", in(xreg) q); + | ^ + | + = note: see issue #133416 for more information + = help: add `#![feature(asm_experimental_reg)]` to the crate attributes to enable + = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date + error[E0658]: type `f32` cannot be used with this register class in stable - --> $DIR/bad-reg.rs:65:35 + --> $DIR/bad-reg.rs:72:35 | LL | asm!("/* {} */", in(xreg) f); | ^ @@ -219,7 +259,7 @@ LL | asm!("/* {} */", in(xreg) f); = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date error[E0658]: type `f64` cannot be used with this register class in stable - --> $DIR/bad-reg.rs:70:35 + --> $DIR/bad-reg.rs:77:35 | LL | asm!("/* {} */", in(xreg) d); | ^ @@ -229,7 +269,7 @@ LL | asm!("/* {} */", in(xreg) d); = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date error[E0658]: type `f64` cannot be used with this register class in stable - --> $DIR/bad-reg.rs:73:36 + --> $DIR/bad-reg.rs:80:36 | LL | asm!("/* {} */", out(xreg) d); | ^ @@ -239,13 +279,13 @@ LL | asm!("/* {} */", out(xreg) d); = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date error: register class `freg` requires at least one of the following target features: d, f - --> $DIR/bad-reg.rs:77:18 + --> $DIR/bad-reg.rs:84:18 | LL | asm!("", in("$f0") f, in("$vr0") d); | ^^^^^^^^^^^ error[E0658]: type `f64` cannot be used with this register class in stable - --> $DIR/bad-reg.rs:77:42 + --> $DIR/bad-reg.rs:84:42 | LL | asm!("", in("$f0") f, in("$vr0") d); | ^ @@ -255,13 +295,13 @@ LL | asm!("", in("$f0") f, in("$vr0") d); = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date error: register class `freg` requires at least one of the following target features: d, f - --> $DIR/bad-reg.rs:82:18 + --> $DIR/bad-reg.rs:89:18 | LL | asm!("", in("$f0") f, in("$xr0") d); | ^^^^^^^^^^^ error[E0658]: type `f64` cannot be used with this register class in stable - --> $DIR/bad-reg.rs:82:42 + --> $DIR/bad-reg.rs:89:42 | LL | asm!("", in("$f0") f, in("$xr0") d); | ^ @@ -271,7 +311,7 @@ LL | asm!("", in("$f0") f, in("$xr0") d); = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date error[E0658]: type `f32` cannot be used with this register class in stable - --> $DIR/bad-reg.rs:87:29 + --> $DIR/bad-reg.rs:94:29 | LL | asm!("", in("$vr0") f, in("$xr0") d); | ^ @@ -281,7 +321,7 @@ LL | asm!("", in("$vr0") f, in("$xr0") d); = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date error[E0658]: type `f64` cannot be used with this register class in stable - --> $DIR/bad-reg.rs:87:43 + --> $DIR/bad-reg.rs:94:43 | LL | asm!("", in("$vr0") f, in("$xr0") d); | ^ @@ -290,6 +330,6 @@ LL | asm!("", in("$vr0") f, in("$xr0") d); = help: add `#![feature(asm_experimental_reg)]` to the crate attributes to enable = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date -error: aborting due to 34 previous errors +error: aborting due to 38 previous errors For more information about this error, try `rustc --explain E0658`. diff --git a/tests/ui/asm/loongarch/bad-reg.rs b/tests/ui/asm/loongarch/bad-reg.rs index 6bda28eb10fde..ac2eeb7d78a70 100644 --- a/tests/ui/asm/loongarch/bad-reg.rs +++ b/tests/ui/asm/loongarch/bad-reg.rs @@ -8,6 +8,7 @@ //@[loongarch64_lp64d] needs-llvm-components: loongarch //@[loongarch64_lp64s] compile-flags: --target loongarch64-unknown-none-softfloat //@[loongarch64_lp64s] needs-llvm-components: loongarch +//@ min-llvm-version: 23 //@ ignore-backends: gcc #![cfg_attr(loongarch64_lp64d, feature(asm_experimental_reg))] @@ -20,7 +21,7 @@ extern crate minicore; use minicore::*; fn f() { - let mut x = 0; + let mut q = 0_u128; let mut f = 0.0_f32; let mut d = 0.0_f64; unsafe { @@ -49,6 +50,9 @@ fn f() { //[loongarch32_ilp32s,loongarch64_lp64s]~^ ERROR register class `freg` requires at least one of the following target features: d, f asm!("", out("$vr0") _); // ok + asm!("/* {} */", in(vreg) q); + //[loongarch32_ilp32s,loongarch32_ilp32d,loongarch64_lp64s]~^ ERROR register class `vreg` can only be used as a clobber in stable + //[loongarch32_ilp32s,loongarch32_ilp32d,loongarch64_lp64s]~| ERROR type `u128` cannot be used with this register class in stable asm!("/* {} */", in(vreg) f); //[loongarch32_ilp32s,loongarch32_ilp32d,loongarch64_lp64s]~^ ERROR register class `vreg` can only be used as a clobber in stable //[loongarch32_ilp32s,loongarch32_ilp32d,loongarch64_lp64s]~| ERROR type `f32` cannot be used with this register class in stable @@ -62,6 +66,9 @@ fn f() { //[loongarch32_ilp32s,loongarch32_ilp32d,loongarch64_lp64s]~| ERROR type `f64` cannot be used with this register class in stable asm!("", out("$xr0") _); // ok + asm!("/* {} */", in(xreg) q); + //[loongarch32_ilp32s,loongarch32_ilp32d,loongarch64_lp64s]~^ ERROR register class `xreg` can only be used as a clobber in stable + //[loongarch32_ilp32s,loongarch32_ilp32d,loongarch64_lp64s]~| ERROR type `u128` cannot be used with this register class in stable asm!("/* {} */", in(xreg) f); //[loongarch32_ilp32s,loongarch32_ilp32d,loongarch64_lp64s]~^ ERROR register class `xreg` can only be used as a clobber in stable //[loongarch32_ilp32s,loongarch32_ilp32d,loongarch64_lp64s]~| ERROR type `f32` cannot be used with this register class in stable diff --git a/tests/ui/const-generics/generic_const_parameter_types/inherent-type-const.rs b/tests/ui/const-generics/generic_const_parameter_types/inherent-type-const.rs new file mode 100644 index 0000000000000..86eab5ec70eb2 --- /dev/null +++ b/tests/ui/const-generics/generic_const_parameter_types/inherent-type-const.rs @@ -0,0 +1,22 @@ +//@ check-pass +#![feature( + min_generic_const_args, + generic_const_parameter_types, + inherent_associated_types, + min_adt_const_params, + const_param_ty_trait +)] + +struct ThreeTypes(T1, T2, T3); + +impl ThreeTypes { + type const INHERENT: [T3; 0] = []; +} + +struct Struct; + +fn f() -> Struct<{ core::direct_const_arg!(ThreeTypes::::INHERENT) }> { + Struct +} + +fn main() {} diff --git a/tests/ui/contracts/empty-ensures.rs b/tests/ui/contracts/empty-ensures.rs index 79e57df6eb984..242e903b7cc96 100644 --- a/tests/ui/contracts/empty-ensures.rs +++ b/tests/ui/contracts/empty-ensures.rs @@ -6,7 +6,7 @@ extern crate core; use core::contracts::ensures; #[ensures()] -//~^ ERROR expected an `Fn(&_)` closure, found `()` [E0277] +//~^ ERROR `ensures` attribute requires an argument fn foo(x: u32) -> u32 { x * 2 } diff --git a/tests/ui/contracts/empty-ensures.stderr b/tests/ui/contracts/empty-ensures.stderr index b87f709eeb7a4..369ba431b62ce 100644 --- a/tests/ui/contracts/empty-ensures.stderr +++ b/tests/ui/contracts/empty-ensures.stderr @@ -1,16 +1,8 @@ -error[E0277]: expected an `Fn(&_)` closure, found `()` +error: `ensures` attribute requires an argument, e.g., `#[ensures(|result: &T| condition)]` --> $DIR/empty-ensures.rs:8:1 | LL | #[ensures()] | ^^^^^^^^^^^^ - | | - | expected an `Fn(&_)` closure, found `()` - | required by a bound introduced by this call - | - = help: the trait `for<'a> Fn(&'a _)` is not implemented for `()` -note: required by a bound in `build_check_ensures` - --> $SRC_DIR/core/src/contracts.rs:LL:COL error: aborting due to 1 previous error -For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/contracts/empty-requires.rs b/tests/ui/contracts/empty-requires.rs index dedcc10d52cb0..eae86607acf31 100644 --- a/tests/ui/contracts/empty-requires.rs +++ b/tests/ui/contracts/empty-requires.rs @@ -1,4 +1,3 @@ -//@ dont-require-annotations: NOTE //@ compile-flags: -Zcontract-checks=yes #![expect(incomplete_features)] #![feature(contracts)] @@ -7,8 +6,7 @@ extern crate core; use core::contracts::requires; #[requires()] -//~^ ERROR mismatched types [E0308] -//~| NOTE expected `bool`, found `()` +//~^ ERROR `requires` attribute requires an argument fn foo(x: u32) -> u32 { x * 2 } diff --git a/tests/ui/contracts/empty-requires.stderr b/tests/ui/contracts/empty-requires.stderr index 702b8a23c55e3..c8fa644702259 100644 --- a/tests/ui/contracts/empty-requires.stderr +++ b/tests/ui/contracts/empty-requires.stderr @@ -1,9 +1,8 @@ -error[E0308]: mismatched types - --> $DIR/empty-requires.rs:9:1 +error: `requires` attribute requires an argument, e.g., `#[requires(condition)]` + --> $DIR/empty-requires.rs:8:1 | LL | #[requires()] - | ^^^^^^^^^^^^^ expected `bool`, found `()` + | ^^^^^^^^^^^^^ error: aborting due to 1 previous error -For more information about this error, try `rustc --explain E0308`. diff --git a/tests/ui/lint/single-use-lifetimes-issue-146834.rs b/tests/ui/lint/single-use-lifetimes-issue-146834.rs new file mode 100644 index 0000000000000..8c03e40fa8070 --- /dev/null +++ b/tests/ui/lint/single-use-lifetimes-issue-146834.rs @@ -0,0 +1,18 @@ +//! Regression test for https://github.com/rust-lang/rust/issues/146834. + +//@ compile-flags: -Wsingle-use-lifetimes +//@ edition: 2024 + +#![expect(incomplete_features)] +#![feature(contracts)] + +#[core::contracts::ensures] +//~^ ERROR `ensures` attribute requires an argument +fn f<'a, 'b>(a: &'a i32, b: &'b i32) -> (&i32, &i32) { + //~^ ERROR missing lifetime specifiers + //~| WARN lifetime parameter `'a` only used once + //~| WARN lifetime parameter `'b` only used once + loop {} +} + +fn main() {} diff --git a/tests/ui/lint/single-use-lifetimes-issue-146834.stderr b/tests/ui/lint/single-use-lifetimes-issue-146834.stderr new file mode 100644 index 0000000000000..d7b84680fd081 --- /dev/null +++ b/tests/ui/lint/single-use-lifetimes-issue-146834.stderr @@ -0,0 +1,55 @@ +error: `ensures` attribute requires an argument, e.g., `#[ensures(|result: &T| condition)]` + --> $DIR/single-use-lifetimes-issue-146834.rs:9:1 + | +LL | #[core::contracts::ensures] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +error[E0106]: missing lifetime specifiers + --> $DIR/single-use-lifetimes-issue-146834.rs:11:42 + | +LL | fn f<'a, 'b>(a: &'a i32, b: &'b i32) -> (&i32, &i32) { + | ------- ------- ^ ^ expected named lifetime parameter + | | + | expected named lifetime parameter + | + = help: this function's return type contains a borrowed value with an elided lifetime, but the lifetime cannot be derived from the arguments +note: these named lifetimes are available to use + --> $DIR/single-use-lifetimes-issue-146834.rs:11:6 + | +LL | fn f<'a, 'b>(a: &'a i32, b: &'b i32) -> (&i32, &i32) { + | ^^ ^^ +help: consider using one of the available lifetimes here + | +LL | fn f<'a, 'b>(a: &'a i32, b: &'b i32) -> (&'lifetime i32, &'lifetime i32) { + | +++++++++ +++++++++ + +warning: lifetime parameter `'a` only used once + --> $DIR/single-use-lifetimes-issue-146834.rs:11:6 + | +LL | fn f<'a, 'b>(a: &'a i32, b: &'b i32) -> (&i32, &i32) { + | ^^ -- ...is used only here + | | + | this lifetime... + | + = note: requested on the command line with `-W single-use-lifetimes` +help: elide the single-use lifetime + | +LL - fn f<'a, 'b>(a: &'a i32, b: &'b i32) -> (&i32, &i32) { +LL + fn f<'b>(a: &i32, b: &'b i32) -> (&i32, &i32) { + | + +warning: lifetime parameter `'b` only used once + --> $DIR/single-use-lifetimes-issue-146834.rs:11:10 + | +LL | fn f<'a, 'b>(a: &'a i32, b: &'b i32) -> (&i32, &i32) { + | ^^ this lifetime... -- ...is used only here + | +help: elide the single-use lifetime + | +LL - fn f<'a, 'b>(a: &'a i32, b: &'b i32) -> (&i32, &i32) { +LL + fn f<'a>(a: &'a i32, b: &i32) -> (&i32, &i32) { + | + +error: aborting due to 2 previous errors; 2 warnings emitted + +For more information about this error, try `rustc --explain E0106`. diff --git a/tests/ui/macros/ice-in-tokenstream-for-contracts-issue-140683.rs b/tests/ui/macros/ice-in-tokenstream-for-contracts-issue-140683.rs index 2b1bacf7e0c31..db85d496991f7 100644 --- a/tests/ui/macros/ice-in-tokenstream-for-contracts-issue-140683.rs +++ b/tests/ui/macros/ice-in-tokenstream-for-contracts-issue-140683.rs @@ -4,7 +4,7 @@ struct T; impl T { - #[core::contracts::ensures] //~ ERROR expected an `Fn(&_)` closure, found `()` + #[core::contracts::ensures] //~ ERROR `ensures` attribute requires an argument fn b() {(loop)} //~^ ERROR expected `{`, found `)` //~| ERROR expected `{`, found `)` diff --git a/tests/ui/macros/ice-in-tokenstream-for-contracts-issue-140683.stderr b/tests/ui/macros/ice-in-tokenstream-for-contracts-issue-140683.stderr index 56dbdae14189b..ab6459bdc919a 100644 --- a/tests/ui/macros/ice-in-tokenstream-for-contracts-issue-140683.stderr +++ b/tests/ui/macros/ice-in-tokenstream-for-contracts-issue-140683.stderr @@ -6,6 +6,12 @@ LL | fn b() {(loop)} | | | while parsing this `loop` expression +error: `ensures` attribute requires an argument, e.g., `#[ensures(|result: &T| condition)]` + --> $DIR/ice-in-tokenstream-for-contracts-issue-140683.rs:7:5 + | +LL | #[core::contracts::ensures] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ + error: expected `{`, found `)` --> $DIR/ice-in-tokenstream-for-contracts-issue-140683.rs:8:18 | @@ -16,19 +22,5 @@ LL | fn b() {(loop)} | = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` -error[E0277]: expected an `Fn(&_)` closure, found `()` - --> $DIR/ice-in-tokenstream-for-contracts-issue-140683.rs:7:5 - | -LL | #[core::contracts::ensures] - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ - | | - | expected an `Fn(&_)` closure, found `()` - | required by a bound introduced by this call - | - = help: the trait `for<'a> Fn(&'a _)` is not implemented for `()` -note: required by a bound in `build_check_ensures` - --> $SRC_DIR/core/src/contracts.rs:LL:COL - error: aborting due to 3 previous errors -For more information about this error, try `rustc --explain E0277`.