mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-25 16:24:46 +00:00
Auto merge of #131581 - tgross35:rollup-vul4kol, r=tgross35
Rollup of 7 pull requests Successful merges: - #124874 (intrinsics fmuladdf{32,64}: expose llvm.fmuladd.* semantics) - #130962 (Migrate lib's `&Option<T>` into `Option<&T>`) - #131289 (stabilize duration_consts_float) - #131310 (Support clobber_abi in MSP430 inline assembly) - #131546 (Make unused_parens's suggestion considering expr's attributes.) - #131565 (Remove deprecation note in the `non_local_definitions` lint) - #131576 (Flatten redundant test module `run_make_support::diff::tests::tests`) r? `@ghost` `@rustbot` modify labels: rollup
This commit is contained in:
commit
8f8bee4f60
@ -328,6 +328,9 @@ fn codegen_float_intrinsic_call<'tcx>(
|
||||
sym::fabsf64 => ("fabs", 1, fx.tcx.types.f64, types::F64),
|
||||
sym::fmaf32 => ("fmaf", 3, fx.tcx.types.f32, types::F32),
|
||||
sym::fmaf64 => ("fma", 3, fx.tcx.types.f64, types::F64),
|
||||
// FIXME: calling `fma` from libc without FMA target feature uses expensive sofware emulation
|
||||
sym::fmuladdf32 => ("fmaf", 3, fx.tcx.types.f32, types::F32), // TODO: use cranelift intrinsic analogous to llvm.fmuladd.f32
|
||||
sym::fmuladdf64 => ("fma", 3, fx.tcx.types.f64, types::F64), // TODO: use cranelift intrinsic analogous to llvm.fmuladd.f64
|
||||
sym::copysignf32 => ("copysignf", 2, fx.tcx.types.f32, types::F32),
|
||||
sym::copysignf64 => ("copysign", 2, fx.tcx.types.f64, types::F64),
|
||||
sym::floorf32 => ("floorf", 1, fx.tcx.types.f32, types::F32),
|
||||
@ -381,7 +384,7 @@ fn codegen_float_intrinsic_call<'tcx>(
|
||||
|
||||
let layout = fx.layout_of(ty);
|
||||
let res = match intrinsic {
|
||||
sym::fmaf32 | sym::fmaf64 => {
|
||||
sym::fmaf32 | sym::fmaf64 | sym::fmuladdf32 | sym::fmuladdf64 => {
|
||||
CValue::by_val(fx.bcx.ins().fma(args[0], args[1], args[2]), layout)
|
||||
}
|
||||
sym::copysignf32 | sym::copysignf64 => {
|
||||
|
@ -66,6 +66,9 @@ fn get_simple_intrinsic<'gcc, 'tcx>(
|
||||
sym::log2f64 => "log2",
|
||||
sym::fmaf32 => "fmaf",
|
||||
sym::fmaf64 => "fma",
|
||||
// FIXME: calling `fma` from libc without FMA target feature uses expensive sofware emulation
|
||||
sym::fmuladdf32 => "fmaf", // TODO: use gcc intrinsic analogous to llvm.fmuladd.f32
|
||||
sym::fmuladdf64 => "fma", // TODO: use gcc intrinsic analogous to llvm.fmuladd.f64
|
||||
sym::fabsf32 => "fabsf",
|
||||
sym::fabsf64 => "fabs",
|
||||
sym::minnumf32 => "fminf",
|
||||
|
@ -884,6 +884,11 @@ impl<'ll> CodegenCx<'ll, '_> {
|
||||
ifn!("llvm.fma.f64", fn(t_f64, t_f64, t_f64) -> t_f64);
|
||||
ifn!("llvm.fma.f128", fn(t_f128, t_f128, t_f128) -> t_f128);
|
||||
|
||||
ifn!("llvm.fmuladd.f16", fn(t_f16, t_f16, t_f16) -> t_f16);
|
||||
ifn!("llvm.fmuladd.f32", fn(t_f32, t_f32, t_f32) -> t_f32);
|
||||
ifn!("llvm.fmuladd.f64", fn(t_f64, t_f64, t_f64) -> t_f64);
|
||||
ifn!("llvm.fmuladd.f128", fn(t_f128, t_f128, t_f128) -> t_f128);
|
||||
|
||||
ifn!("llvm.fabs.f16", fn(t_f16) -> t_f16);
|
||||
ifn!("llvm.fabs.f32", fn(t_f32) -> t_f32);
|
||||
ifn!("llvm.fabs.f64", fn(t_f64) -> t_f64);
|
||||
|
@ -86,6 +86,11 @@ fn get_simple_intrinsic<'ll>(
|
||||
sym::fmaf64 => "llvm.fma.f64",
|
||||
sym::fmaf128 => "llvm.fma.f128",
|
||||
|
||||
sym::fmuladdf16 => "llvm.fmuladd.f16",
|
||||
sym::fmuladdf32 => "llvm.fmuladd.f32",
|
||||
sym::fmuladdf64 => "llvm.fmuladd.f64",
|
||||
sym::fmuladdf128 => "llvm.fmuladd.f128",
|
||||
|
||||
sym::fabsf16 => "llvm.fabs.f16",
|
||||
sym::fabsf32 => "llvm.fabs.f32",
|
||||
sym::fabsf64 => "llvm.fabs.f64",
|
||||
|
@ -357,6 +357,19 @@ pub fn check_intrinsic_type(
|
||||
(0, 0, vec![tcx.types.f128, tcx.types.f128, tcx.types.f128], tcx.types.f128)
|
||||
}
|
||||
|
||||
sym::fmuladdf16 => {
|
||||
(0, 0, vec![tcx.types.f16, tcx.types.f16, tcx.types.f16], tcx.types.f16)
|
||||
}
|
||||
sym::fmuladdf32 => {
|
||||
(0, 0, vec![tcx.types.f32, tcx.types.f32, tcx.types.f32], tcx.types.f32)
|
||||
}
|
||||
sym::fmuladdf64 => {
|
||||
(0, 0, vec![tcx.types.f64, tcx.types.f64, tcx.types.f64], tcx.types.f64)
|
||||
}
|
||||
sym::fmuladdf128 => {
|
||||
(0, 0, vec![tcx.types.f128, tcx.types.f128, tcx.types.f128], tcx.types.f128)
|
||||
}
|
||||
|
||||
sym::fabsf16 => (0, 0, vec![tcx.types.f16], tcx.types.f16),
|
||||
sym::fabsf32 => (0, 0, vec![tcx.types.f32], tcx.types.f32),
|
||||
sym::fabsf64 => (0, 0, vec![tcx.types.f64], tcx.types.f64),
|
||||
|
@ -581,8 +581,6 @@ lint_non_glob_import_type_ir_inherent = non-glob import of `rustc_type_ir::inher
|
||||
|
||||
lint_non_local_definitions_cargo_update = the {$macro_kind} `{$macro_name}` may come from an old version of the `{$crate_name}` crate, try updating your dependency with `cargo update -p {$crate_name}`
|
||||
|
||||
lint_non_local_definitions_deprecation = this lint may become deny-by-default in the edition 2024 and higher, see the tracking issue <https://github.com/rust-lang/rust/issues/120363>
|
||||
|
||||
lint_non_local_definitions_impl = non-local `impl` definition, `impl` blocks should be written at the same level as their item
|
||||
.non_local = an `impl` is never scoped, even when it is nested inside an item, as it may impact type checking outside of that item, which can be the case if neither the trait or the self type are at the same nesting level as the `impl`
|
||||
.doctest = make this doc-test a standalone test with its own `fn main() {"{"} ... {"}"}`
|
||||
|
@ -1430,8 +1430,6 @@ impl<'a> LintDiagnostic<'a, ()> for NonLocalDefinitionsDiag {
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
diag.note(fluent::lint_non_local_definitions_deprecation);
|
||||
}
|
||||
NonLocalDefinitionsDiag::MacroRules {
|
||||
depth,
|
||||
@ -1452,7 +1450,6 @@ impl<'a> LintDiagnostic<'a, ()> for NonLocalDefinitionsDiag {
|
||||
}
|
||||
|
||||
diag.note(fluent::lint_non_local);
|
||||
diag.note(fluent::lint_non_local_definitions_deprecation);
|
||||
|
||||
if let Some(cargo_update) = cargo_update {
|
||||
diag.subdiagnostic(cargo_update);
|
||||
|
@ -804,7 +804,15 @@ trait UnusedDelimLint {
|
||||
.find_ancestor_inside(value.span)
|
||||
.map(|span| (value.span.with_hi(span.lo()), value.span.with_lo(span.hi()))),
|
||||
ast::ExprKind::Paren(ref expr) => {
|
||||
expr.span.find_ancestor_inside(value.span).map(|expr_span| {
|
||||
// For the expr with attributes, like `let _ = (#[inline] || println!("Hello!"));`,
|
||||
// the span should contains the attributes, or the suggestion will remove them.
|
||||
let expr_span_with_attrs =
|
||||
if let Some(attr_lo) = expr.attrs.iter().map(|attr| attr.span.lo()).min() {
|
||||
expr.span.with_lo(attr_lo)
|
||||
} else {
|
||||
expr.span
|
||||
};
|
||||
expr_span_with_attrs.find_ancestor_inside(value.span).map(|expr_span| {
|
||||
(value.span.with_hi(expr_span.lo()), value.span.with_lo(expr_span.hi()))
|
||||
})
|
||||
}
|
||||
|
@ -914,6 +914,10 @@ symbols! {
|
||||
fmt_debug,
|
||||
fmul_algebraic,
|
||||
fmul_fast,
|
||||
fmuladdf128,
|
||||
fmuladdf16,
|
||||
fmuladdf32,
|
||||
fmuladdf64,
|
||||
fn_align,
|
||||
fn_delegation,
|
||||
fn_must_use,
|
||||
|
@ -893,6 +893,7 @@ pub enum InlineAsmClobberAbi {
|
||||
RiscV,
|
||||
LoongArch,
|
||||
S390x,
|
||||
Msp430,
|
||||
}
|
||||
|
||||
impl InlineAsmClobberAbi {
|
||||
@ -946,6 +947,10 @@ impl InlineAsmClobberAbi {
|
||||
"C" | "system" => Ok(InlineAsmClobberAbi::S390x),
|
||||
_ => Err(&["C", "system"]),
|
||||
},
|
||||
InlineAsmArch::Msp430 => match name {
|
||||
"C" | "system" => Ok(InlineAsmClobberAbi::Msp430),
|
||||
_ => Err(&["C", "system"]),
|
||||
},
|
||||
_ => Err(&[]),
|
||||
}
|
||||
}
|
||||
@ -1125,6 +1130,11 @@ impl InlineAsmClobberAbi {
|
||||
a8, a9, a10, a11, a12, a13, a14, a15,
|
||||
}
|
||||
},
|
||||
InlineAsmClobberAbi::Msp430 => clobbered_regs! {
|
||||
Msp430 Msp430InlineAsmReg {
|
||||
r11, r12, r13, r14, r15,
|
||||
}
|
||||
},
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1795,6 +1795,59 @@ extern "rust-intrinsic" {
|
||||
#[rustc_nounwind]
|
||||
pub fn fmaf128(a: f128, b: f128, c: f128) -> f128;
|
||||
|
||||
/// Returns `a * b + c` for `f16` values, non-deterministically executing
|
||||
/// either a fused multiply-add or two operations with rounding of the
|
||||
/// intermediate result.
|
||||
///
|
||||
/// The operation is fused if the code generator determines that target
|
||||
/// instruction set has support for a fused operation, and that the fused
|
||||
/// operation is more efficient than the equivalent, separate pair of mul
|
||||
/// and add instructions. It is unspecified whether or not a fused operation
|
||||
/// is selected, and that may depend on optimization level and context, for
|
||||
/// example.
|
||||
#[rustc_nounwind]
|
||||
#[cfg(not(bootstrap))]
|
||||
pub fn fmuladdf16(a: f16, b: f16, c: f16) -> f16;
|
||||
/// Returns `a * b + c` for `f32` values, non-deterministically executing
|
||||
/// either a fused multiply-add or two operations with rounding of the
|
||||
/// intermediate result.
|
||||
///
|
||||
/// The operation is fused if the code generator determines that target
|
||||
/// instruction set has support for a fused operation, and that the fused
|
||||
/// operation is more efficient than the equivalent, separate pair of mul
|
||||
/// and add instructions. It is unspecified whether or not a fused operation
|
||||
/// is selected, and that may depend on optimization level and context, for
|
||||
/// example.
|
||||
#[rustc_nounwind]
|
||||
#[cfg(not(bootstrap))]
|
||||
pub fn fmuladdf32(a: f32, b: f32, c: f32) -> f32;
|
||||
/// Returns `a * b + c` for `f64` values, non-deterministically executing
|
||||
/// either a fused multiply-add or two operations with rounding of the
|
||||
/// intermediate result.
|
||||
///
|
||||
/// The operation is fused if the code generator determines that target
|
||||
/// instruction set has support for a fused operation, and that the fused
|
||||
/// operation is more efficient than the equivalent, separate pair of mul
|
||||
/// and add instructions. It is unspecified whether or not a fused operation
|
||||
/// is selected, and that may depend on optimization level and context, for
|
||||
/// example.
|
||||
#[rustc_nounwind]
|
||||
#[cfg(not(bootstrap))]
|
||||
pub fn fmuladdf64(a: f64, b: f64, c: f64) -> f64;
|
||||
/// Returns `a * b + c` for `f128` values, non-deterministically executing
|
||||
/// either a fused multiply-add or two operations with rounding of the
|
||||
/// intermediate result.
|
||||
///
|
||||
/// The operation is fused if the code generator determines that target
|
||||
/// instruction set has support for a fused operation, and that the fused
|
||||
/// operation is more efficient than the equivalent, separate pair of mul
|
||||
/// and add instructions. It is unspecified whether or not a fused operation
|
||||
/// is selected, and that may depend on optimization level and context, for
|
||||
/// example.
|
||||
#[rustc_nounwind]
|
||||
#[cfg(not(bootstrap))]
|
||||
pub fn fmuladdf128(a: f128, b: f128, c: f128) -> f128;
|
||||
|
||||
/// Returns the absolute value of an `f16`.
|
||||
///
|
||||
/// The stabilized version of this intrinsic is
|
||||
|
@ -153,7 +153,6 @@
|
||||
#![feature(const_unicode_case_lookup)]
|
||||
#![feature(coverage_attribute)]
|
||||
#![feature(do_not_recommend)]
|
||||
#![feature(duration_consts_float)]
|
||||
#![feature(internal_impls_macro)]
|
||||
#![feature(ip)]
|
||||
#![feature(is_ascii_octdigit)]
|
||||
|
@ -847,7 +847,7 @@ impl Duration {
|
||||
#[stable(feature = "duration_float", since = "1.38.0")]
|
||||
#[must_use]
|
||||
#[inline]
|
||||
#[rustc_const_unstable(feature = "duration_consts_float", issue = "72440")]
|
||||
#[rustc_const_stable(feature = "duration_consts_float", since = "CURRENT_RUSTC_VERSION")]
|
||||
pub const fn as_secs_f64(&self) -> f64 {
|
||||
(self.secs as f64) + (self.nanos.0 as f64) / (NANOS_PER_SEC as f64)
|
||||
}
|
||||
@ -866,7 +866,7 @@ impl Duration {
|
||||
#[stable(feature = "duration_float", since = "1.38.0")]
|
||||
#[must_use]
|
||||
#[inline]
|
||||
#[rustc_const_unstable(feature = "duration_consts_float", issue = "72440")]
|
||||
#[rustc_const_stable(feature = "duration_consts_float", since = "CURRENT_RUSTC_VERSION")]
|
||||
pub const fn as_secs_f32(&self) -> f32 {
|
||||
(self.secs as f32) + (self.nanos.0 as f32) / (NANOS_PER_SEC as f32)
|
||||
}
|
||||
@ -886,7 +886,7 @@ impl Duration {
|
||||
#[unstable(feature = "duration_millis_float", issue = "122451")]
|
||||
#[must_use]
|
||||
#[inline]
|
||||
#[rustc_const_unstable(feature = "duration_consts_float", issue = "72440")]
|
||||
#[rustc_const_unstable(feature = "duration_millis_float", issue = "122451")]
|
||||
pub const fn as_millis_f64(&self) -> f64 {
|
||||
(self.secs as f64) * (MILLIS_PER_SEC as f64)
|
||||
+ (self.nanos.0 as f64) / (NANOS_PER_MILLI as f64)
|
||||
@ -907,7 +907,7 @@ impl Duration {
|
||||
#[unstable(feature = "duration_millis_float", issue = "122451")]
|
||||
#[must_use]
|
||||
#[inline]
|
||||
#[rustc_const_unstable(feature = "duration_consts_float", issue = "72440")]
|
||||
#[rustc_const_unstable(feature = "duration_millis_float", issue = "122451")]
|
||||
pub const fn as_millis_f32(&self) -> f32 {
|
||||
(self.secs as f32) * (MILLIS_PER_SEC as f32)
|
||||
+ (self.nanos.0 as f32) / (NANOS_PER_MILLI as f32)
|
||||
@ -1087,7 +1087,7 @@ impl Duration {
|
||||
#[must_use = "this returns the result of the operation, \
|
||||
without modifying the original"]
|
||||
#[inline]
|
||||
#[rustc_const_unstable(feature = "duration_consts_float", issue = "72440")]
|
||||
#[rustc_const_stable(feature = "duration_consts_float", since = "CURRENT_RUSTC_VERSION")]
|
||||
pub const fn div_duration_f64(self, rhs: Duration) -> f64 {
|
||||
let self_nanos = (self.secs as f64) * (NANOS_PER_SEC as f64) + (self.nanos.0 as f64);
|
||||
let rhs_nanos = (rhs.secs as f64) * (NANOS_PER_SEC as f64) + (rhs.nanos.0 as f64);
|
||||
@ -1108,7 +1108,7 @@ impl Duration {
|
||||
#[must_use = "this returns the result of the operation, \
|
||||
without modifying the original"]
|
||||
#[inline]
|
||||
#[rustc_const_unstable(feature = "duration_consts_float", issue = "72440")]
|
||||
#[rustc_const_stable(feature = "duration_consts_float", since = "CURRENT_RUSTC_VERSION")]
|
||||
pub const fn div_duration_f32(self, rhs: Duration) -> f32 {
|
||||
let self_nanos = (self.secs as f32) * (NANOS_PER_SEC as f32) + (self.nanos.0 as f32);
|
||||
let rhs_nanos = (rhs.secs as f32) * (NANOS_PER_SEC as f32) + (rhs.nanos.0 as f32);
|
||||
|
@ -38,7 +38,6 @@
|
||||
#![feature(dec2flt)]
|
||||
#![feature(duration_constants)]
|
||||
#![feature(duration_constructors)]
|
||||
#![feature(duration_consts_float)]
|
||||
#![feature(error_generic_member_access)]
|
||||
#![feature(exact_size_is_empty)]
|
||||
#![feature(extern_types)]
|
||||
|
@ -78,9 +78,8 @@ fn io_err_to_addr(result: io::Result<&SocketAddr>) -> io::Result<String> {
|
||||
}
|
||||
}
|
||||
|
||||
fn addr_to_sockaddr(addr: &Option<String>) -> io::Result<SocketAddr> {
|
||||
addr.as_ref()
|
||||
.ok_or(io::ErrorKind::AddrNotAvailable)?
|
||||
fn addr_to_sockaddr(addr: Option<&str>) -> io::Result<SocketAddr> {
|
||||
addr.ok_or(io::ErrorKind::AddrNotAvailable)?
|
||||
.to_socket_addrs()
|
||||
// unwrap OK: if an iterator is returned, we're guaranteed to get exactly one entry
|
||||
.map(|mut it| it.next().unwrap())
|
||||
@ -161,11 +160,11 @@ impl TcpStream {
|
||||
}
|
||||
|
||||
pub fn peer_addr(&self) -> io::Result<SocketAddr> {
|
||||
addr_to_sockaddr(&self.peer_addr)
|
||||
addr_to_sockaddr(self.peer_addr.as_deref())
|
||||
}
|
||||
|
||||
pub fn socket_addr(&self) -> io::Result<SocketAddr> {
|
||||
addr_to_sockaddr(&self.inner.local_addr)
|
||||
addr_to_sockaddr(self.inner.local_addr.as_deref())
|
||||
}
|
||||
|
||||
pub fn shutdown(&self, _: Shutdown) -> io::Result<()> {
|
||||
@ -255,13 +254,14 @@ impl TcpListener {
|
||||
}
|
||||
|
||||
pub fn socket_addr(&self) -> io::Result<SocketAddr> {
|
||||
addr_to_sockaddr(&self.inner.local_addr)
|
||||
addr_to_sockaddr(self.inner.local_addr.as_deref())
|
||||
}
|
||||
|
||||
pub fn accept(&self) -> io::Result<(TcpStream, SocketAddr)> {
|
||||
let (fd, local_addr, peer_addr) = usercalls::accept_stream(self.inner.inner.raw())?;
|
||||
let peer_addr = Some(peer_addr);
|
||||
let ret_peer = addr_to_sockaddr(&peer_addr).unwrap_or_else(|_| ([0; 4], 0).into());
|
||||
let ret_peer =
|
||||
addr_to_sockaddr(peer_addr.as_deref()).unwrap_or_else(|_| ([0; 4], 0).into());
|
||||
Ok((TcpStream { inner: Socket::new(fd, local_addr), peer_addr }, ret_peer))
|
||||
}
|
||||
|
||||
|
@ -312,8 +312,8 @@ impl Command {
|
||||
}
|
||||
|
||||
#[allow(dead_code)]
|
||||
pub fn get_cwd(&self) -> &Option<CString> {
|
||||
&self.cwd
|
||||
pub fn get_cwd(&self) -> Option<&CStr> {
|
||||
self.cwd.as_deref()
|
||||
}
|
||||
#[allow(dead_code)]
|
||||
pub fn get_uid(&self) -> Option<uid_t> {
|
||||
|
@ -335,7 +335,7 @@ impl Command {
|
||||
cvt(libc::setuid(u as uid_t))?;
|
||||
}
|
||||
}
|
||||
if let Some(ref cwd) = *self.get_cwd() {
|
||||
if let Some(cwd) = self.get_cwd() {
|
||||
cvt(libc::chdir(cwd.as_ptr()))?;
|
||||
}
|
||||
|
||||
|
@ -57,7 +57,7 @@ impl Command {
|
||||
t!(cvt_r(|| libc::dup2(fd, libc::STDERR_FILENO)));
|
||||
}
|
||||
|
||||
if let Some(ref cwd) = *self.get_cwd() {
|
||||
if let Some(cwd) = self.get_cwd() {
|
||||
t!(cvt(libc::chdir(cwd.as_ptr())));
|
||||
}
|
||||
|
||||
|
@ -650,8 +650,8 @@ fn run_test_in_process(
|
||||
io::set_output_capture(None);
|
||||
|
||||
let test_result = match result {
|
||||
Ok(()) => calc_result(&desc, Ok(()), &time_opts, &exec_time),
|
||||
Err(e) => calc_result(&desc, Err(e.as_ref()), &time_opts, &exec_time),
|
||||
Ok(()) => calc_result(&desc, Ok(()), time_opts.as_ref(), exec_time.as_ref()),
|
||||
Err(e) => calc_result(&desc, Err(e.as_ref()), time_opts.as_ref(), exec_time.as_ref()),
|
||||
};
|
||||
let stdout = data.lock().unwrap_or_else(|e| e.into_inner()).to_vec();
|
||||
let message = CompletedTest::new(id, desc, test_result, exec_time, stdout);
|
||||
@ -712,7 +712,8 @@ fn spawn_test_subprocess(
|
||||
formatters::write_stderr_delimiter(&mut test_output, &desc.name);
|
||||
test_output.extend_from_slice(&stderr);
|
||||
|
||||
let result = get_result_from_exit_code(&desc, status, &time_opts, &exec_time);
|
||||
let result =
|
||||
get_result_from_exit_code(&desc, status, time_opts.as_ref(), exec_time.as_ref());
|
||||
(result, test_output, exec_time)
|
||||
})();
|
||||
|
||||
@ -724,8 +725,8 @@ fn run_test_in_spawned_subprocess(desc: TestDesc, runnable_test: RunnableTest) -
|
||||
let builtin_panic_hook = panic::take_hook();
|
||||
let record_result = Arc::new(move |panic_info: Option<&'_ PanicHookInfo<'_>>| {
|
||||
let test_result = match panic_info {
|
||||
Some(info) => calc_result(&desc, Err(info.payload()), &None, &None),
|
||||
None => calc_result(&desc, Ok(()), &None, &None),
|
||||
Some(info) => calc_result(&desc, Err(info.payload()), None, None),
|
||||
None => calc_result(&desc, Ok(()), None, None),
|
||||
};
|
||||
|
||||
// We don't support serializing TrFailedMsg, so just
|
||||
|
@ -42,8 +42,8 @@ pub enum TestResult {
|
||||
pub fn calc_result<'a>(
|
||||
desc: &TestDesc,
|
||||
task_result: Result<(), &'a (dyn Any + 'static + Send)>,
|
||||
time_opts: &Option<time::TestTimeOptions>,
|
||||
exec_time: &Option<time::TestExecTime>,
|
||||
time_opts: Option<&time::TestTimeOptions>,
|
||||
exec_time: Option<&time::TestExecTime>,
|
||||
) -> TestResult {
|
||||
let result = match (&desc.should_panic, task_result) {
|
||||
(&ShouldPanic::No, Ok(())) | (&ShouldPanic::Yes, Err(_)) => TestResult::TrOk,
|
||||
@ -96,8 +96,8 @@ pub fn calc_result<'a>(
|
||||
pub fn get_result_from_exit_code(
|
||||
desc: &TestDesc,
|
||||
status: ExitStatus,
|
||||
time_opts: &Option<time::TestTimeOptions>,
|
||||
exec_time: &Option<time::TestExecTime>,
|
||||
time_opts: Option<&time::TestTimeOptions>,
|
||||
exec_time: Option<&time::TestExecTime>,
|
||||
) -> TestResult {
|
||||
let result = match status.code() {
|
||||
Some(TR_OK) => TestResult::TrOk,
|
||||
|
@ -295,6 +295,37 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
|
||||
this.write_scalar(res, dest)?;
|
||||
}
|
||||
|
||||
"fmuladdf32" => {
|
||||
let [a, b, c] = check_arg_count(args)?;
|
||||
let a = this.read_scalar(a)?.to_f32()?;
|
||||
let b = this.read_scalar(b)?.to_f32()?;
|
||||
let c = this.read_scalar(c)?.to_f32()?;
|
||||
let fuse: bool = this.machine.rng.get_mut().gen();
|
||||
let res = if fuse {
|
||||
// FIXME: Using host floats, to work around https://github.com/rust-lang/rustc_apfloat/issues/11
|
||||
a.to_host().mul_add(b.to_host(), c.to_host()).to_soft()
|
||||
} else {
|
||||
((a * b).value + c).value
|
||||
};
|
||||
let res = this.adjust_nan(res, &[a, b, c]);
|
||||
this.write_scalar(res, dest)?;
|
||||
}
|
||||
"fmuladdf64" => {
|
||||
let [a, b, c] = check_arg_count(args)?;
|
||||
let a = this.read_scalar(a)?.to_f64()?;
|
||||
let b = this.read_scalar(b)?.to_f64()?;
|
||||
let c = this.read_scalar(c)?.to_f64()?;
|
||||
let fuse: bool = this.machine.rng.get_mut().gen();
|
||||
let res = if fuse {
|
||||
// FIXME: Using host floats, to work around https://github.com/rust-lang/rustc_apfloat/issues/11
|
||||
a.to_host().mul_add(b.to_host(), c.to_host()).to_soft()
|
||||
} else {
|
||||
((a * b).value + c).value
|
||||
};
|
||||
let res = this.adjust_nan(res, &[a, b, c]);
|
||||
this.write_scalar(res, dest)?;
|
||||
}
|
||||
|
||||
"powf32" => {
|
||||
let [f1, f2] = check_arg_count(args)?;
|
||||
let f1 = this.read_scalar(f1)?.to_f32()?;
|
||||
|
@ -30,6 +30,7 @@ fn main() {
|
||||
libm();
|
||||
test_fast();
|
||||
test_algebraic();
|
||||
test_fmuladd();
|
||||
}
|
||||
|
||||
trait Float: Copy + PartialEq + Debug {
|
||||
@ -1041,3 +1042,20 @@ fn test_algebraic() {
|
||||
test_operations_f32(11., 2.);
|
||||
test_operations_f32(10., 15.);
|
||||
}
|
||||
|
||||
fn test_fmuladd() {
|
||||
use std::intrinsics::{fmuladdf32, fmuladdf64};
|
||||
|
||||
#[inline(never)]
|
||||
pub fn test_operations_f32(a: f32, b: f32, c: f32) {
|
||||
assert_approx_eq!(unsafe { fmuladdf32(a, b, c) }, a * b + c);
|
||||
}
|
||||
|
||||
#[inline(never)]
|
||||
pub fn test_operations_f64(a: f64, b: f64, c: f64) {
|
||||
assert_approx_eq!(unsafe { fmuladdf64(a, b, c) }, a * b + c);
|
||||
}
|
||||
|
||||
test_operations_f32(0.1, 0.2, 0.3);
|
||||
test_operations_f64(1.1, 1.2, 1.3);
|
||||
}
|
||||
|
@ -0,0 +1,44 @@
|
||||
#![feature(core_intrinsics)]
|
||||
use std::intrinsics::{fmuladdf32, fmuladdf64};
|
||||
|
||||
fn main() {
|
||||
let mut saw_zero = false;
|
||||
let mut saw_nonzero = false;
|
||||
for _ in 0..50 {
|
||||
let a = std::hint::black_box(0.1_f64);
|
||||
let b = std::hint::black_box(0.2);
|
||||
let c = std::hint::black_box(-a * b);
|
||||
// It is unspecified whether the following operation is fused or not. The
|
||||
// following evaluates to 0.0 if unfused, and nonzero (-1.66e-18) if fused.
|
||||
let x = unsafe { fmuladdf64(a, b, c) };
|
||||
if x == 0.0 {
|
||||
saw_zero = true;
|
||||
} else {
|
||||
saw_nonzero = true;
|
||||
}
|
||||
}
|
||||
assert!(
|
||||
saw_zero && saw_nonzero,
|
||||
"`fmuladdf64` failed to be evaluated as both fused and unfused"
|
||||
);
|
||||
|
||||
let mut saw_zero = false;
|
||||
let mut saw_nonzero = false;
|
||||
for _ in 0..50 {
|
||||
let a = std::hint::black_box(0.1_f32);
|
||||
let b = std::hint::black_box(0.2);
|
||||
let c = std::hint::black_box(-a * b);
|
||||
// It is unspecified whether the following operation is fused or not. The
|
||||
// following evaluates to 0.0 if unfused, and nonzero (-8.1956386e-10) if fused.
|
||||
let x = unsafe { fmuladdf32(a, b, c) };
|
||||
if x == 0.0 {
|
||||
saw_zero = true;
|
||||
} else {
|
||||
saw_nonzero = true;
|
||||
}
|
||||
}
|
||||
assert!(
|
||||
saw_zero && saw_nonzero,
|
||||
"`fmuladdf32` failed to be evaluated as both fused and unfused"
|
||||
);
|
||||
}
|
@ -1,28 +1,23 @@
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use crate::*;
|
||||
use crate::diff;
|
||||
|
||||
#[test]
|
||||
fn test_diff() {
|
||||
let expected = "foo\nbar\nbaz\n";
|
||||
let actual = "foo\nbar\nbaz\n";
|
||||
#[test]
|
||||
fn test_diff() {
|
||||
let expected = "foo\nbar\nbaz\n";
|
||||
let actual = "foo\nbar\nbaz\n";
|
||||
diff().expected_text("EXPECTED_TEXT", expected).actual_text("ACTUAL_TEXT", actual).run();
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_should_panic() {
|
||||
let expected = "foo\nbar\nbaz\n";
|
||||
let actual = "foo\nbaz\nbar\n";
|
||||
|
||||
let output = std::panic::catch_unwind(|| {
|
||||
diff().expected_text("EXPECTED_TEXT", expected).actual_text("ACTUAL_TEXT", actual).run();
|
||||
}
|
||||
})
|
||||
.unwrap_err();
|
||||
|
||||
#[test]
|
||||
fn test_should_panic() {
|
||||
let expected = "foo\nbar\nbaz\n";
|
||||
let actual = "foo\nbaz\nbar\n";
|
||||
|
||||
let output = std::panic::catch_unwind(|| {
|
||||
diff()
|
||||
.expected_text("EXPECTED_TEXT", expected)
|
||||
.actual_text("ACTUAL_TEXT", actual)
|
||||
.run();
|
||||
})
|
||||
.unwrap_err();
|
||||
|
||||
let expected_output = "\
|
||||
let expected_output = "\
|
||||
test failed: `EXPECTED_TEXT` is different from `ACTUAL_TEXT`
|
||||
|
||||
--- EXPECTED_TEXT
|
||||
@ -34,28 +29,27 @@ test failed: `EXPECTED_TEXT` is different from `ACTUAL_TEXT`
|
||||
-baz
|
||||
";
|
||||
|
||||
assert_eq!(output.downcast_ref::<String>().unwrap(), expected_output);
|
||||
}
|
||||
assert_eq!(output.downcast_ref::<String>().unwrap(), expected_output);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_normalize() {
|
||||
let expected = "
|
||||
#[test]
|
||||
fn test_normalize() {
|
||||
let expected = "
|
||||
running 2 tests
|
||||
..
|
||||
|
||||
test result: ok. 2 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in $TIME
|
||||
";
|
||||
let actual = "
|
||||
let actual = "
|
||||
running 2 tests
|
||||
..
|
||||
|
||||
test result: ok. 2 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.02s
|
||||
";
|
||||
|
||||
diff()
|
||||
.expected_text("EXPECTED_TEXT", expected)
|
||||
.actual_text("ACTUAL_TEXT", actual)
|
||||
.normalize(r#"finished in \d+\.\d+s"#, "finished in $$TIME")
|
||||
.run();
|
||||
}
|
||||
diff()
|
||||
.expected_text("EXPECTED_TEXT", expected)
|
||||
.actual_text("ACTUAL_TEXT", actual)
|
||||
.normalize(r#"finished in \d+\.\d+s"#, "finished in $$TIME")
|
||||
.run();
|
||||
}
|
||||
|
36
tests/codegen/asm-msp430-clobbers.rs
Normal file
36
tests/codegen/asm-msp430-clobbers.rs
Normal file
@ -0,0 +1,36 @@
|
||||
//@ assembly-output: emit-asm
|
||||
//@ compile-flags: --target msp430-none-elf
|
||||
//@ needs-llvm-components: msp430
|
||||
|
||||
#![crate_type = "rlib"]
|
||||
#![feature(no_core, rustc_attrs, lang_items, asm_experimental_arch)]
|
||||
#![no_core]
|
||||
|
||||
#[lang = "sized"]
|
||||
trait Sized {}
|
||||
|
||||
#[rustc_builtin_macro]
|
||||
macro_rules! asm {
|
||||
() => {};
|
||||
}
|
||||
|
||||
// CHECK-LABEL: @sr_clobber
|
||||
// CHECK: call void asm sideeffect "", "~{sr}"()
|
||||
#[no_mangle]
|
||||
pub unsafe fn sr_clobber() {
|
||||
asm!("", options(nostack, nomem));
|
||||
}
|
||||
|
||||
// CHECK-LABEL: @no_clobber
|
||||
// CHECK: call void asm sideeffect "", ""()
|
||||
#[no_mangle]
|
||||
pub unsafe fn no_clobber() {
|
||||
asm!("", options(nostack, nomem, preserves_flags));
|
||||
}
|
||||
|
||||
// CHECK-LABEL: @clobber_abi
|
||||
// CHECK: asm sideeffect "", "={r11},={r12},={r13},={r14},={r15}"()
|
||||
#[no_mangle]
|
||||
pub unsafe fn clobber_abi() {
|
||||
asm!("", clobber_abi("C"), options(nostack, nomem, preserves_flags));
|
||||
}
|
@ -18,7 +18,6 @@ LL | impl Trait for &Local {}
|
||||
| `Trait` is not local
|
||||
|
|
||||
= note: an `impl` is never scoped, even when it is nested inside an item, as it may impact type checking outside of that item, which can be the case if neither the trait or the self type are at the same nesting level as the `impl`
|
||||
= note: this lint may become deny-by-default in the edition 2024 and higher, see the tracking issue <https://github.com/rust-lang/rust/issues/120363>
|
||||
note: the lint level is defined here
|
||||
--> $DIR/non-local-defs-impl.rs:11:9
|
||||
|
|
||||
|
@ -6,7 +6,6 @@ LL | macro_rules! a_macro { () => {} }
|
||||
|
|
||||
= help: remove the `#[macro_export]` or make this doc-test a standalone test with its own `fn main() { ... }`
|
||||
= note: a `macro_rules!` definition is non-local if it is nested inside an item and has a `#[macro_export]` attribute
|
||||
= note: this lint may become deny-by-default in the edition 2024 and higher, see the tracking issue <https://github.com/rust-lang/rust/issues/120363>
|
||||
= note: `#[warn(non_local_definitions)]` on by default
|
||||
|
||||
warning: 1 warning emitted
|
||||
|
42
tests/ui/intrinsics/intrinsic-fmuladd.rs
Normal file
42
tests/ui/intrinsics/intrinsic-fmuladd.rs
Normal file
@ -0,0 +1,42 @@
|
||||
//@ run-pass
|
||||
#![feature(core_intrinsics)]
|
||||
|
||||
use std::intrinsics::*;
|
||||
|
||||
macro_rules! assert_approx_eq {
|
||||
($a:expr, $b:expr) => {{
|
||||
let (a, b) = (&$a, &$b);
|
||||
assert!((*a - *b).abs() < 1.0e-6, "{} is not approximately equal to {}", *a, *b);
|
||||
}};
|
||||
}
|
||||
|
||||
fn main() {
|
||||
unsafe {
|
||||
let nan: f32 = f32::NAN;
|
||||
let inf: f32 = f32::INFINITY;
|
||||
let neg_inf: f32 = f32::NEG_INFINITY;
|
||||
assert_approx_eq!(fmuladdf32(1.23, 4.5, 0.67), 6.205);
|
||||
assert_approx_eq!(fmuladdf32(-1.23, -4.5, -0.67), 4.865);
|
||||
assert_approx_eq!(fmuladdf32(0.0, 8.9, 1.2), 1.2);
|
||||
assert_approx_eq!(fmuladdf32(3.4, -0.0, 5.6), 5.6);
|
||||
assert!(fmuladdf32(nan, 7.8, 9.0).is_nan());
|
||||
assert_eq!(fmuladdf32(inf, 7.8, 9.0), inf);
|
||||
assert_eq!(fmuladdf32(neg_inf, 7.8, 9.0), neg_inf);
|
||||
assert_eq!(fmuladdf32(8.9, inf, 3.2), inf);
|
||||
assert_eq!(fmuladdf32(-3.2, 2.4, neg_inf), neg_inf);
|
||||
}
|
||||
unsafe {
|
||||
let nan: f64 = f64::NAN;
|
||||
let inf: f64 = f64::INFINITY;
|
||||
let neg_inf: f64 = f64::NEG_INFINITY;
|
||||
assert_approx_eq!(fmuladdf64(1.23, 4.5, 0.67), 6.205);
|
||||
assert_approx_eq!(fmuladdf64(-1.23, -4.5, -0.67), 4.865);
|
||||
assert_approx_eq!(fmuladdf64(0.0, 8.9, 1.2), 1.2);
|
||||
assert_approx_eq!(fmuladdf64(3.4, -0.0, 5.6), 5.6);
|
||||
assert!(fmuladdf64(nan, 7.8, 9.0).is_nan());
|
||||
assert_eq!(fmuladdf64(inf, 7.8, 9.0), inf);
|
||||
assert_eq!(fmuladdf64(neg_inf, 7.8, 9.0), neg_inf);
|
||||
assert_eq!(fmuladdf64(8.9, inf, 3.2), inf);
|
||||
assert_eq!(fmuladdf64(-3.2, 2.4, neg_inf), neg_inf);
|
||||
}
|
||||
}
|
@ -12,7 +12,6 @@ LL | non_local_macro::non_local_impl!(LocalStruct);
|
||||
= note: the macro `non_local_macro::non_local_impl` may come from an old version of the `non_local_macro` crate, try updating your dependency with `cargo update -p non_local_macro`
|
||||
= note: an `impl` is never scoped, even when it is nested inside an item, as it may impact type checking outside of that item, which can be the case if neither the trait or the self type are at the same nesting level as the `impl`
|
||||
= note: items in an anonymous const item (`const _: () = { ... }`) are treated as in the same scope as the anonymous const's declaration for the purpose of this lint
|
||||
= note: this lint may become deny-by-default in the edition 2024 and higher, see the tracking issue <https://github.com/rust-lang/rust/issues/120363>
|
||||
= note: `#[warn(non_local_definitions)]` on by default
|
||||
= note: this warning originates in the macro `non_local_macro::non_local_impl` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
|
@ -15,7 +15,6 @@ LL | impl Uto for &Test {}
|
||||
|
|
||||
= note: an `impl` is never scoped, even when it is nested inside an item, as it may impact type checking outside of that item, which can be the case if neither the trait or the self type are at the same nesting level as the `impl`
|
||||
= note: items in an anonymous const item (`const _: () = { ... }`) are treated as in the same scope as the anonymous const's declaration for the purpose of this lint
|
||||
= note: this lint may become deny-by-default in the edition 2024 and higher, see the tracking issue <https://github.com/rust-lang/rust/issues/120363>
|
||||
= note: `#[warn(non_local_definitions)]` on by default
|
||||
|
||||
warning: non-local `impl` definition, `impl` blocks should be written at the same level as their item
|
||||
@ -31,7 +30,6 @@ LL | impl Uto2 for Test {}
|
||||
|
|
||||
= note: an `impl` is never scoped, even when it is nested inside an item, as it may impact type checking outside of that item, which can be the case if neither the trait or the self type are at the same nesting level as the `impl`
|
||||
= note: items in an anonymous const item (`const _: () = { ... }`) are treated as in the same scope as the anonymous const's declaration for the purpose of this lint
|
||||
= note: this lint may become deny-by-default in the edition 2024 and higher, see the tracking issue <https://github.com/rust-lang/rust/issues/120363>
|
||||
|
||||
warning: non-local `impl` definition, `impl` blocks should be written at the same level as their item
|
||||
--> $DIR/consts.rs:32:5
|
||||
@ -46,7 +44,6 @@ LL | impl Uto3 for Test {}
|
||||
|
|
||||
= note: an `impl` is never scoped, even when it is nested inside an item, as it may impact type checking outside of that item, which can be the case if neither the trait or the self type are at the same nesting level as the `impl`
|
||||
= note: items in an anonymous const item (`const _: () = { ... }`) are treated as in the same scope as the anonymous const's declaration for the purpose of this lint
|
||||
= note: this lint may become deny-by-default in the edition 2024 and higher, see the tracking issue <https://github.com/rust-lang/rust/issues/120363>
|
||||
|
||||
warning: non-local `impl` definition, `impl` blocks should be written at the same level as their item
|
||||
--> $DIR/consts.rs:43:5
|
||||
@ -59,7 +56,6 @@ LL | impl Test {
|
||||
| `Test` is not local
|
||||
|
|
||||
= note: an `impl` is never scoped, even when it is nested inside an item, as it may impact type checking outside of that item, which can be the case if neither the trait or the self type are at the same nesting level as the `impl`
|
||||
= note: this lint may become deny-by-default in the edition 2024 and higher, see the tracking issue <https://github.com/rust-lang/rust/issues/120363>
|
||||
|
||||
warning: non-local `impl` definition, `impl` blocks should be written at the same level as their item
|
||||
--> $DIR/consts.rs:50:9
|
||||
@ -78,7 +74,6 @@ LL | | };
|
||||
| |_____- move the `impl` block outside of this inline constant `<unnameable>` and up 2 bodies
|
||||
|
|
||||
= note: an `impl` is never scoped, even when it is nested inside an item, as it may impact type checking outside of that item, which can be the case if neither the trait or the self type are at the same nesting level as the `impl`
|
||||
= note: this lint may become deny-by-default in the edition 2024 and higher, see the tracking issue <https://github.com/rust-lang/rust/issues/120363>
|
||||
|
||||
warning: non-local `impl` definition, `impl` blocks should be written at the same level as their item
|
||||
--> $DIR/consts.rs:59:9
|
||||
@ -92,7 +87,6 @@ LL | impl Test {
|
||||
|
|
||||
= note: an `impl` is never scoped, even when it is nested inside an item, as it may impact type checking outside of that item, which can be the case if neither the trait or the self type are at the same nesting level as the `impl`
|
||||
= note: items in an anonymous const item (`const _: () = { ... }`) are treated as in the same scope as the anonymous const's declaration for the purpose of this lint
|
||||
= note: this lint may become deny-by-default in the edition 2024 and higher, see the tracking issue <https://github.com/rust-lang/rust/issues/120363>
|
||||
|
||||
warning: non-local `impl` definition, `impl` blocks should be written at the same level as their item
|
||||
--> $DIR/consts.rs:69:13
|
||||
@ -106,7 +100,6 @@ LL | impl Test {}
|
||||
|
|
||||
= note: an `impl` is never scoped, even when it is nested inside an item, as it may impact type checking outside of that item, which can be the case if neither the trait or the self type are at the same nesting level as the `impl`
|
||||
= note: items in an anonymous const item (`const _: () = { ... }`) are treated as in the same scope as the anonymous const's declaration for the purpose of this lint
|
||||
= note: this lint may become deny-by-default in the edition 2024 and higher, see the tracking issue <https://github.com/rust-lang/rust/issues/120363>
|
||||
|
||||
warning: non-local `impl` definition, `impl` blocks should be written at the same level as their item
|
||||
--> $DIR/consts.rs:79:9
|
||||
@ -120,7 +113,6 @@ LL | impl Uto9 for Test {}
|
||||
| `Uto9` is not local
|
||||
|
|
||||
= note: an `impl` is never scoped, even when it is nested inside an item, as it may impact type checking outside of that item, which can be the case if neither the trait or the self type are at the same nesting level as the `impl`
|
||||
= note: this lint may become deny-by-default in the edition 2024 and higher, see the tracking issue <https://github.com/rust-lang/rust/issues/120363>
|
||||
|
||||
warning: non-local `impl` definition, `impl` blocks should be written at the same level as their item
|
||||
--> $DIR/consts.rs:86:9
|
||||
@ -138,7 +130,6 @@ LL | | }];
|
||||
| |_____- move the `impl` block outside of this constant expression `<unnameable>` and up 2 bodies
|
||||
|
|
||||
= note: an `impl` is never scoped, even when it is nested inside an item, as it may impact type checking outside of that item, which can be the case if neither the trait or the self type are at the same nesting level as the `impl`
|
||||
= note: this lint may become deny-by-default in the edition 2024 and higher, see the tracking issue <https://github.com/rust-lang/rust/issues/120363>
|
||||
|
||||
warning: 9 warnings emitted
|
||||
|
||||
|
@ -10,7 +10,6 @@ LL | impl PartialEq<()> for Dog {
|
||||
| `PartialEq` is not local
|
||||
|
|
||||
= note: an `impl` is never scoped, even when it is nested inside an item, as it may impact type checking outside of that item, which can be the case if neither the trait or the self type are at the same nesting level as the `impl`
|
||||
= note: this lint may become deny-by-default in the edition 2024 and higher, see the tracking issue <https://github.com/rust-lang/rust/issues/120363>
|
||||
= note: `#[warn(non_local_definitions)]` on by default
|
||||
|
||||
warning: non-local `impl` definition, `impl` blocks should be written at the same level as their item
|
||||
@ -26,7 +25,6 @@ LL | impl PartialEq<()> for &Dog {
|
||||
| `PartialEq` is not local
|
||||
|
|
||||
= note: an `impl` is never scoped, even when it is nested inside an item, as it may impact type checking outside of that item, which can be the case if neither the trait or the self type are at the same nesting level as the `impl`
|
||||
= note: this lint may become deny-by-default in the edition 2024 and higher, see the tracking issue <https://github.com/rust-lang/rust/issues/120363>
|
||||
|
||||
warning: non-local `impl` definition, `impl` blocks should be written at the same level as their item
|
||||
--> $DIR/exhaustive-trait.rs:21:5
|
||||
@ -41,7 +39,6 @@ LL | impl PartialEq<Dog> for () {
|
||||
| `PartialEq` is not local
|
||||
|
|
||||
= note: an `impl` is never scoped, even when it is nested inside an item, as it may impact type checking outside of that item, which can be the case if neither the trait or the self type are at the same nesting level as the `impl`
|
||||
= note: this lint may become deny-by-default in the edition 2024 and higher, see the tracking issue <https://github.com/rust-lang/rust/issues/120363>
|
||||
|
||||
warning: non-local `impl` definition, `impl` blocks should be written at the same level as their item
|
||||
--> $DIR/exhaustive-trait.rs:28:5
|
||||
@ -56,7 +53,6 @@ LL | impl PartialEq<&Dog> for () {
|
||||
| `PartialEq` is not local
|
||||
|
|
||||
= note: an `impl` is never scoped, even when it is nested inside an item, as it may impact type checking outside of that item, which can be the case if neither the trait or the self type are at the same nesting level as the `impl`
|
||||
= note: this lint may become deny-by-default in the edition 2024 and higher, see the tracking issue <https://github.com/rust-lang/rust/issues/120363>
|
||||
|
||||
warning: non-local `impl` definition, `impl` blocks should be written at the same level as their item
|
||||
--> $DIR/exhaustive-trait.rs:35:5
|
||||
@ -72,7 +68,6 @@ LL | impl PartialEq<Dog> for &Dog {
|
||||
| `PartialEq` is not local
|
||||
|
|
||||
= note: an `impl` is never scoped, even when it is nested inside an item, as it may impact type checking outside of that item, which can be the case if neither the trait or the self type are at the same nesting level as the `impl`
|
||||
= note: this lint may become deny-by-default in the edition 2024 and higher, see the tracking issue <https://github.com/rust-lang/rust/issues/120363>
|
||||
|
||||
warning: non-local `impl` definition, `impl` blocks should be written at the same level as their item
|
||||
--> $DIR/exhaustive-trait.rs:42:5
|
||||
@ -88,7 +83,6 @@ LL | impl PartialEq<&Dog> for &Dog {
|
||||
| `PartialEq` is not local
|
||||
|
|
||||
= note: an `impl` is never scoped, even when it is nested inside an item, as it may impact type checking outside of that item, which can be the case if neither the trait or the self type are at the same nesting level as the `impl`
|
||||
= note: this lint may become deny-by-default in the edition 2024 and higher, see the tracking issue <https://github.com/rust-lang/rust/issues/120363>
|
||||
|
||||
warning: 6 warnings emitted
|
||||
|
||||
|
@ -9,7 +9,6 @@ LL | impl Test {
|
||||
| `Test` is not local
|
||||
|
|
||||
= note: an `impl` is never scoped, even when it is nested inside an item, as it may impact type checking outside of that item, which can be the case if neither the trait or the self type are at the same nesting level as the `impl`
|
||||
= note: this lint may become deny-by-default in the edition 2024 and higher, see the tracking issue <https://github.com/rust-lang/rust/issues/120363>
|
||||
= note: `#[warn(non_local_definitions)]` on by default
|
||||
|
||||
warning: non-local `impl` definition, `impl` blocks should be written at the same level as their item
|
||||
@ -25,7 +24,6 @@ LL | impl Display for Test {
|
||||
| `Display` is not local
|
||||
|
|
||||
= note: an `impl` is never scoped, even when it is nested inside an item, as it may impact type checking outside of that item, which can be the case if neither the trait or the self type are at the same nesting level as the `impl`
|
||||
= note: this lint may become deny-by-default in the edition 2024 and higher, see the tracking issue <https://github.com/rust-lang/rust/issues/120363>
|
||||
|
||||
warning: non-local `impl` definition, `impl` blocks should be written at the same level as their item
|
||||
--> $DIR/exhaustive.rs:22:5
|
||||
@ -39,7 +37,6 @@ LL | impl dyn Trait {}
|
||||
| `Trait` is not local
|
||||
|
|
||||
= note: an `impl` is never scoped, even when it is nested inside an item, as it may impact type checking outside of that item, which can be the case if neither the trait or the self type are at the same nesting level as the `impl`
|
||||
= note: this lint may become deny-by-default in the edition 2024 and higher, see the tracking issue <https://github.com/rust-lang/rust/issues/120363>
|
||||
|
||||
warning: non-local `impl` definition, `impl` blocks should be written at the same level as their item
|
||||
--> $DIR/exhaustive.rs:25:5
|
||||
@ -54,7 +51,6 @@ LL | impl<T: Trait> Trait for Vec<T> { }
|
||||
| `Trait` is not local
|
||||
|
|
||||
= note: an `impl` is never scoped, even when it is nested inside an item, as it may impact type checking outside of that item, which can be the case if neither the trait or the self type are at the same nesting level as the `impl`
|
||||
= note: this lint may become deny-by-default in the edition 2024 and higher, see the tracking issue <https://github.com/rust-lang/rust/issues/120363>
|
||||
|
||||
warning: non-local `impl` definition, `impl` blocks should be written at the same level as their item
|
||||
--> $DIR/exhaustive.rs:28:5
|
||||
@ -69,7 +65,6 @@ LL | impl Trait for &dyn Trait {}
|
||||
| `Trait` is not local
|
||||
|
|
||||
= note: an `impl` is never scoped, even when it is nested inside an item, as it may impact type checking outside of that item, which can be the case if neither the trait or the self type are at the same nesting level as the `impl`
|
||||
= note: this lint may become deny-by-default in the edition 2024 and higher, see the tracking issue <https://github.com/rust-lang/rust/issues/120363>
|
||||
|
||||
warning: non-local `impl` definition, `impl` blocks should be written at the same level as their item
|
||||
--> $DIR/exhaustive.rs:31:5
|
||||
@ -84,7 +79,6 @@ LL | impl Trait for *mut Test {}
|
||||
| `Trait` is not local
|
||||
|
|
||||
= note: an `impl` is never scoped, even when it is nested inside an item, as it may impact type checking outside of that item, which can be the case if neither the trait or the self type are at the same nesting level as the `impl`
|
||||
= note: this lint may become deny-by-default in the edition 2024 and higher, see the tracking issue <https://github.com/rust-lang/rust/issues/120363>
|
||||
|
||||
warning: non-local `impl` definition, `impl` blocks should be written at the same level as their item
|
||||
--> $DIR/exhaustive.rs:34:5
|
||||
@ -99,7 +93,6 @@ LL | impl Trait for *mut [Test] {}
|
||||
| `Trait` is not local
|
||||
|
|
||||
= note: an `impl` is never scoped, even when it is nested inside an item, as it may impact type checking outside of that item, which can be the case if neither the trait or the self type are at the same nesting level as the `impl`
|
||||
= note: this lint may become deny-by-default in the edition 2024 and higher, see the tracking issue <https://github.com/rust-lang/rust/issues/120363>
|
||||
|
||||
warning: non-local `impl` definition, `impl` blocks should be written at the same level as their item
|
||||
--> $DIR/exhaustive.rs:37:5
|
||||
@ -114,7 +107,6 @@ LL | impl Trait for [Test; 8] {}
|
||||
| `Trait` is not local
|
||||
|
|
||||
= note: an `impl` is never scoped, even when it is nested inside an item, as it may impact type checking outside of that item, which can be the case if neither the trait or the self type are at the same nesting level as the `impl`
|
||||
= note: this lint may become deny-by-default in the edition 2024 and higher, see the tracking issue <https://github.com/rust-lang/rust/issues/120363>
|
||||
|
||||
warning: non-local `impl` definition, `impl` blocks should be written at the same level as their item
|
||||
--> $DIR/exhaustive.rs:40:5
|
||||
@ -129,7 +121,6 @@ LL | impl Trait for (Test,) {}
|
||||
| `Trait` is not local
|
||||
|
|
||||
= note: an `impl` is never scoped, even when it is nested inside an item, as it may impact type checking outside of that item, which can be the case if neither the trait or the self type are at the same nesting level as the `impl`
|
||||
= note: this lint may become deny-by-default in the edition 2024 and higher, see the tracking issue <https://github.com/rust-lang/rust/issues/120363>
|
||||
|
||||
warning: non-local `impl` definition, `impl` blocks should be written at the same level as their item
|
||||
--> $DIR/exhaustive.rs:43:5
|
||||
@ -144,7 +135,6 @@ LL | impl Trait for fn(Test) -> () {}
|
||||
| `Trait` is not local
|
||||
|
|
||||
= note: an `impl` is never scoped, even when it is nested inside an item, as it may impact type checking outside of that item, which can be the case if neither the trait or the self type are at the same nesting level as the `impl`
|
||||
= note: this lint may become deny-by-default in the edition 2024 and higher, see the tracking issue <https://github.com/rust-lang/rust/issues/120363>
|
||||
|
||||
warning: non-local `impl` definition, `impl` blocks should be written at the same level as their item
|
||||
--> $DIR/exhaustive.rs:46:5
|
||||
@ -159,7 +149,6 @@ LL | impl Trait for fn() -> Test {}
|
||||
| `Trait` is not local
|
||||
|
|
||||
= note: an `impl` is never scoped, even when it is nested inside an item, as it may impact type checking outside of that item, which can be the case if neither the trait or the self type are at the same nesting level as the `impl`
|
||||
= note: this lint may become deny-by-default in the edition 2024 and higher, see the tracking issue <https://github.com/rust-lang/rust/issues/120363>
|
||||
|
||||
warning: non-local `impl` definition, `impl` blocks should be written at the same level as their item
|
||||
--> $DIR/exhaustive.rs:50:9
|
||||
@ -173,7 +162,6 @@ LL | impl Trait for Test {}
|
||||
| `Trait` is not local
|
||||
|
|
||||
= note: an `impl` is never scoped, even when it is nested inside an item, as it may impact type checking outside of that item, which can be the case if neither the trait or the self type are at the same nesting level as the `impl`
|
||||
= note: this lint may become deny-by-default in the edition 2024 and higher, see the tracking issue <https://github.com/rust-lang/rust/issues/120363>
|
||||
|
||||
warning: non-local `impl` definition, `impl` blocks should be written at the same level as their item
|
||||
--> $DIR/exhaustive.rs:67:9
|
||||
@ -187,7 +175,6 @@ LL | impl Display for InsideMain {
|
||||
| `Display` is not local
|
||||
|
|
||||
= note: an `impl` is never scoped, even when it is nested inside an item, as it may impact type checking outside of that item, which can be the case if neither the trait or the self type are at the same nesting level as the `impl`
|
||||
= note: this lint may become deny-by-default in the edition 2024 and higher, see the tracking issue <https://github.com/rust-lang/rust/issues/120363>
|
||||
|
||||
warning: non-local `impl` definition, `impl` blocks should be written at the same level as their item
|
||||
--> $DIR/exhaustive.rs:74:9
|
||||
@ -201,7 +188,6 @@ LL | impl InsideMain {
|
||||
| `InsideMain` is not local
|
||||
|
|
||||
= note: an `impl` is never scoped, even when it is nested inside an item, as it may impact type checking outside of that item, which can be the case if neither the trait or the self type are at the same nesting level as the `impl`
|
||||
= note: this lint may become deny-by-default in the edition 2024 and higher, see the tracking issue <https://github.com/rust-lang/rust/issues/120363>
|
||||
|
||||
warning: 14 warnings emitted
|
||||
|
||||
|
@ -10,7 +10,6 @@ LL | impl From<Cat> for () {
|
||||
| `From` is not local
|
||||
|
|
||||
= note: an `impl` is never scoped, even when it is nested inside an item, as it may impact type checking outside of that item, which can be the case if neither the trait or the self type are at the same nesting level as the `impl`
|
||||
= note: this lint may become deny-by-default in the edition 2024 and higher, see the tracking issue <https://github.com/rust-lang/rust/issues/120363>
|
||||
= note: `#[warn(non_local_definitions)]` on by default
|
||||
|
||||
warning: 1 warning emitted
|
||||
|
@ -11,7 +11,6 @@ LL | impl<T: Local> Global for Vec<T> { }
|
||||
| `Global` is not local
|
||||
|
|
||||
= note: an `impl` is never scoped, even when it is nested inside an item, as it may impact type checking outside of that item, which can be the case if neither the trait or the self type are at the same nesting level as the `impl`
|
||||
= note: this lint may become deny-by-default in the edition 2024 and higher, see the tracking issue <https://github.com/rust-lang/rust/issues/120363>
|
||||
= note: `#[warn(non_local_definitions)]` on by default
|
||||
|
||||
warning: non-local `impl` definition, `impl` blocks should be written at the same level as their item
|
||||
@ -27,7 +26,6 @@ LL | impl Uto7 for Test where Local: std::any::Any {}
|
||||
| `Uto7` is not local
|
||||
|
|
||||
= note: an `impl` is never scoped, even when it is nested inside an item, as it may impact type checking outside of that item, which can be the case if neither the trait or the self type are at the same nesting level as the `impl`
|
||||
= note: this lint may become deny-by-default in the edition 2024 and higher, see the tracking issue <https://github.com/rust-lang/rust/issues/120363>
|
||||
|
||||
warning: non-local `impl` definition, `impl` blocks should be written at the same level as their item
|
||||
--> $DIR/generics.rs:23:5
|
||||
@ -41,7 +39,6 @@ LL | impl<T> Uto8 for T {}
|
||||
| `Uto8` is not local
|
||||
|
|
||||
= note: an `impl` is never scoped, even when it is nested inside an item, as it may impact type checking outside of that item, which can be the case if neither the trait or the self type are at the same nesting level as the `impl`
|
||||
= note: this lint may become deny-by-default in the edition 2024 and higher, see the tracking issue <https://github.com/rust-lang/rust/issues/120363>
|
||||
|
||||
warning: 3 warnings emitted
|
||||
|
||||
|
@ -14,7 +14,6 @@ LL | m!();
|
||||
|
|
||||
= note: the macro `m` defines the non-local `impl`, and may need to be changed
|
||||
= note: an `impl` is never scoped, even when it is nested inside an item, as it may impact type checking outside of that item, which can be the case if neither the trait or the self type are at the same nesting level as the `impl`
|
||||
= note: this lint may become deny-by-default in the edition 2024 and higher, see the tracking issue <https://github.com/rust-lang/rust/issues/120363>
|
||||
= note: `#[warn(non_local_definitions)]` on by default
|
||||
= note: this warning originates in the macro `m` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
|
@ -6,7 +6,6 @@ LL | macro_rules! m0 { () => { } };
|
||||
|
|
||||
= help: remove the `#[macro_export]` or move this `macro_rules!` outside the of the current constant `B`
|
||||
= note: a `macro_rules!` definition is non-local if it is nested inside an item and has a `#[macro_export]` attribute
|
||||
= note: this lint may become deny-by-default in the edition 2024 and higher, see the tracking issue <https://github.com/rust-lang/rust/issues/120363>
|
||||
= note: `#[warn(non_local_definitions)]` on by default
|
||||
|
||||
warning: non-local `macro_rules!` definition, `#[macro_export]` macro should be written at top level module
|
||||
@ -17,7 +16,6 @@ LL | non_local_macro::non_local_macro_rules!(my_macro);
|
||||
|
|
||||
= help: remove the `#[macro_export]` or move this `macro_rules!` outside the of the current constant `_MACRO_EXPORT`
|
||||
= note: a `macro_rules!` definition is non-local if it is nested inside an item and has a `#[macro_export]` attribute
|
||||
= note: this lint may become deny-by-default in the edition 2024 and higher, see the tracking issue <https://github.com/rust-lang/rust/issues/120363>
|
||||
= note: the macro `non_local_macro::non_local_macro_rules` may come from an old version of the `non_local_macro` crate, try updating your dependency with `cargo update -p non_local_macro`
|
||||
= note: this warning originates in the macro `non_local_macro::non_local_macro_rules` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
@ -29,7 +27,6 @@ LL | macro_rules! m { () => { } };
|
||||
|
|
||||
= help: remove the `#[macro_export]` or move this `macro_rules!` outside the of the current function `main`
|
||||
= note: a `macro_rules!` definition is non-local if it is nested inside an item and has a `#[macro_export]` attribute
|
||||
= note: this lint may become deny-by-default in the edition 2024 and higher, see the tracking issue <https://github.com/rust-lang/rust/issues/120363>
|
||||
|
||||
warning: non-local `macro_rules!` definition, `#[macro_export]` macro should be written at top level module
|
||||
--> $DIR/macro_rules.rs:29:13
|
||||
@ -39,7 +36,6 @@ LL | macro_rules! m2 { () => { } };
|
||||
|
|
||||
= help: remove the `#[macro_export]` or move this `macro_rules!` outside the of the current associated function `bar` and up 2 bodies
|
||||
= note: a `macro_rules!` definition is non-local if it is nested inside an item and has a `#[macro_export]` attribute
|
||||
= note: this lint may become deny-by-default in the edition 2024 and higher, see the tracking issue <https://github.com/rust-lang/rust/issues/120363>
|
||||
|
||||
warning: 4 warnings emitted
|
||||
|
||||
|
@ -14,7 +14,6 @@ LL | | }];
|
||||
| |_- move the `impl` block outside of this constant expression `<unnameable>`
|
||||
|
|
||||
= note: an `impl` is never scoped, even when it is nested inside an item, as it may impact type checking outside of that item, which can be the case if neither the trait or the self type are at the same nesting level as the `impl`
|
||||
= note: this lint may become deny-by-default in the edition 2024 and higher, see the tracking issue <https://github.com/rust-lang/rust/issues/120363>
|
||||
= note: `#[warn(non_local_definitions)]` on by default
|
||||
|
||||
warning: non-local `impl` definition, `impl` blocks should be written at the same level as their item
|
||||
@ -33,7 +32,6 @@ LL | | }
|
||||
| |_____- move the `impl` block outside of this constant expression `<unnameable>`
|
||||
|
|
||||
= note: an `impl` is never scoped, even when it is nested inside an item, as it may impact type checking outside of that item, which can be the case if neither the trait or the self type are at the same nesting level as the `impl`
|
||||
= note: this lint may become deny-by-default in the edition 2024 and higher, see the tracking issue <https://github.com/rust-lang/rust/issues/120363>
|
||||
|
||||
warning: non-local `impl` definition, `impl` blocks should be written at the same level as their item
|
||||
--> $DIR/weird-exprs.rs:25:9
|
||||
@ -52,7 +50,6 @@ LL | | }];
|
||||
| |_____- move the `impl` block outside of this constant expression `<unnameable>` and up 2 bodies
|
||||
|
|
||||
= note: an `impl` is never scoped, even when it is nested inside an item, as it may impact type checking outside of that item, which can be the case if neither the trait or the self type are at the same nesting level as the `impl`
|
||||
= note: this lint may become deny-by-default in the edition 2024 and higher, see the tracking issue <https://github.com/rust-lang/rust/issues/120363>
|
||||
|
||||
warning: non-local `impl` definition, `impl` blocks should be written at the same level as their item
|
||||
--> $DIR/weird-exprs.rs:34:9
|
||||
@ -70,7 +67,6 @@ LL | | }];
|
||||
| |_____- move the `impl` block outside of this constant expression `<unnameable>` and up 2 bodies
|
||||
|
|
||||
= note: an `impl` is never scoped, even when it is nested inside an item, as it may impact type checking outside of that item, which can be the case if neither the trait or the self type are at the same nesting level as the `impl`
|
||||
= note: this lint may become deny-by-default in the edition 2024 and higher, see the tracking issue <https://github.com/rust-lang/rust/issues/120363>
|
||||
|
||||
warning: non-local `impl` definition, `impl` blocks should be written at the same level as their item
|
||||
--> $DIR/weird-exprs.rs:41:9
|
||||
@ -88,7 +84,6 @@ LL | | }]) {}
|
||||
| |_____- move the `impl` block outside of this constant expression `<unnameable>` and up 2 bodies
|
||||
|
|
||||
= note: an `impl` is never scoped, even when it is nested inside an item, as it may impact type checking outside of that item, which can be the case if neither the trait or the self type are at the same nesting level as the `impl`
|
||||
= note: this lint may become deny-by-default in the edition 2024 and higher, see the tracking issue <https://github.com/rust-lang/rust/issues/120363>
|
||||
|
||||
warning: non-local `impl` definition, `impl` blocks should be written at the same level as their item
|
||||
--> $DIR/weird-exprs.rs:48:9
|
||||
@ -107,7 +102,6 @@ LL | | }] { todo!() }
|
||||
| |_____- move the `impl` block outside of this constant expression `<unnameable>` and up 2 bodies
|
||||
|
|
||||
= note: an `impl` is never scoped, even when it is nested inside an item, as it may impact type checking outside of that item, which can be the case if neither the trait or the self type are at the same nesting level as the `impl`
|
||||
= note: this lint may become deny-by-default in the edition 2024 and higher, see the tracking issue <https://github.com/rust-lang/rust/issues/120363>
|
||||
|
||||
warning: 6 warnings emitted
|
||||
|
||||
|
@ -0,0 +1,15 @@
|
||||
//@ run-rustfix
|
||||
// Check the `unused_parens` suggestion for paren_expr with attributes.
|
||||
// The suggestion should retain attributes in the front.
|
||||
|
||||
#![feature(stmt_expr_attributes)]
|
||||
#![deny(unused_parens)]
|
||||
|
||||
pub fn foo() -> impl Fn() {
|
||||
let _ = #[inline] #[allow(dead_code)] || println!("Hello!"); //~ERROR unnecessary parentheses
|
||||
#[inline] #[allow(dead_code)] || println!("Hello!") //~ERROR unnecessary parentheses
|
||||
}
|
||||
|
||||
fn main() {
|
||||
let _ = foo();
|
||||
}
|
@ -0,0 +1,15 @@
|
||||
//@ run-rustfix
|
||||
// Check the `unused_parens` suggestion for paren_expr with attributes.
|
||||
// The suggestion should retain attributes in the front.
|
||||
|
||||
#![feature(stmt_expr_attributes)]
|
||||
#![deny(unused_parens)]
|
||||
|
||||
pub fn foo() -> impl Fn() {
|
||||
let _ = (#[inline] #[allow(dead_code)] || println!("Hello!")); //~ERROR unnecessary parentheses
|
||||
(#[inline] #[allow(dead_code)] || println!("Hello!")) //~ERROR unnecessary parentheses
|
||||
}
|
||||
|
||||
fn main() {
|
||||
let _ = foo();
|
||||
}
|
@ -0,0 +1,31 @@
|
||||
error: unnecessary parentheses around assigned value
|
||||
--> $DIR/unused-parens-for-stmt-expr-attributes-issue-129833.rs:9:13
|
||||
|
|
||||
LL | let _ = (#[inline] #[allow(dead_code)] || println!("Hello!"));
|
||||
| ^ ^
|
||||
|
|
||||
note: the lint level is defined here
|
||||
--> $DIR/unused-parens-for-stmt-expr-attributes-issue-129833.rs:6:9
|
||||
|
|
||||
LL | #![deny(unused_parens)]
|
||||
| ^^^^^^^^^^^^^
|
||||
help: remove these parentheses
|
||||
|
|
||||
LL - let _ = (#[inline] #[allow(dead_code)] || println!("Hello!"));
|
||||
LL + let _ = #[inline] #[allow(dead_code)] || println!("Hello!");
|
||||
|
|
||||
|
||||
error: unnecessary parentheses around block return value
|
||||
--> $DIR/unused-parens-for-stmt-expr-attributes-issue-129833.rs:10:5
|
||||
|
|
||||
LL | (#[inline] #[allow(dead_code)] || println!("Hello!"))
|
||||
| ^ ^
|
||||
|
|
||||
help: remove these parentheses
|
||||
|
|
||||
LL - (#[inline] #[allow(dead_code)] || println!("Hello!"))
|
||||
LL + #[inline] #[allow(dead_code)] || println!("Hello!")
|
||||
|
|
||||
|
||||
error: aborting due to 2 previous errors
|
||||
|
@ -19,7 +19,6 @@ LL | nested_macro_rules::outer_macro!(SecondStruct, SecondAttrStruct);
|
||||
|
|
||||
= help: remove the `#[macro_export]` or move this `macro_rules!` outside the of the current function `main`
|
||||
= note: a `macro_rules!` definition is non-local if it is nested inside an item and has a `#[macro_export]` attribute
|
||||
= note: this lint may become deny-by-default in the edition 2024 and higher, see the tracking issue <https://github.com/rust-lang/rust/issues/120363>
|
||||
note: the lint level is defined here
|
||||
--> $DIR/nested-macro-rules.rs:8:9
|
||||
|
|
||||
|
Loading…
Reference in New Issue
Block a user