Auto merge of #126817 - workingjubilee:rollup-0rg0k55, r=workingjubilee

Rollup of 7 pull requests

Successful merges:

 - #126530 (Add `f16` inline ASM support for RISC-V)
 - #126712 (Migrate `relocation-model`, `error-writing-dependencies` and `crate-name-priority` `run-make` tests to rmake)
 - #126722 (Add method to get `FnAbi` of function pointer)
 - #126787 (Add direct accessors for memory addresses in `Machine` (for Miri))
 - #126798 ([fuchsia-test-runner] Remove usage of kw_only)
 - #126809 (Remove stray `.` from error message)
 - #126811 (Add a tidy rule to check that fluent messages and attrs don't end in `.`)

r? `@ghost`
`@rustbot` modify labels: rollup
This commit is contained in:
bors 2024-06-22 05:51:57 +00:00
commit f0aceed540
51 changed files with 412 additions and 128 deletions

View File

@ -5700,6 +5700,7 @@ name = "tidy"
version = "0.1.0"
dependencies = [
"cargo_metadata 0.15.4",
"fluent-syntax",
"ignore",
"miropt-test-tools",
"regex",

View File

@ -78,7 +78,7 @@ ast_lowering_inline_asm_unsupported_target =
ast_lowering_invalid_abi =
invalid ABI: found `{$abi}`
.label = invalid ABI
.note = invoke `{$command}` for a full list of supported calling conventions.
.note = invoke `{$command}` for a full list of supported calling conventions
ast_lowering_invalid_abi_clobber_abi =
invalid ABI for `clobber_abi`

View File

@ -13,7 +13,7 @@ use rustc_codegen_ssa::traits::*;
use rustc_data_structures::fx::FxHashMap;
use rustc_middle::ty::layout::TyAndLayout;
use rustc_middle::{bug, span_bug, ty::Instance};
use rustc_span::{Pos, Span};
use rustc_span::{sym, Pos, Span, Symbol};
use rustc_target::abi::*;
use rustc_target::asm::*;
use tracing::debug;
@ -64,7 +64,7 @@ impl<'ll, 'tcx> AsmBuilderMethods<'tcx> for Builder<'_, 'll, 'tcx> {
let mut layout = None;
let ty = if let Some(ref place) = place {
layout = Some(&place.layout);
llvm_fixup_output_type(self.cx, reg.reg_class(), &place.layout)
llvm_fixup_output_type(self.cx, reg.reg_class(), &place.layout, instance)
} else if matches!(
reg.reg_class(),
InlineAsmRegClass::X86(
@ -112,7 +112,7 @@ impl<'ll, 'tcx> AsmBuilderMethods<'tcx> for Builder<'_, 'll, 'tcx> {
// so we just use the type of the input.
&in_value.layout
};
let ty = llvm_fixup_output_type(self.cx, reg.reg_class(), layout);
let ty = llvm_fixup_output_type(self.cx, reg.reg_class(), layout, instance);
output_types.push(ty);
op_idx.insert(idx, constraints.len());
let prefix = if late { "=" } else { "=&" };
@ -127,8 +127,13 @@ impl<'ll, 'tcx> AsmBuilderMethods<'tcx> for Builder<'_, 'll, 'tcx> {
for (idx, op) in operands.iter().enumerate() {
match *op {
InlineAsmOperandRef::In { reg, value } => {
let llval =
llvm_fixup_input(self, value.immediate(), reg.reg_class(), &value.layout);
let llval = llvm_fixup_input(
self,
value.immediate(),
reg.reg_class(),
&value.layout,
instance,
);
inputs.push(llval);
op_idx.insert(idx, constraints.len());
constraints.push(reg_to_llvm(reg, Some(&value.layout)));
@ -139,6 +144,7 @@ impl<'ll, 'tcx> AsmBuilderMethods<'tcx> for Builder<'_, 'll, 'tcx> {
in_value.immediate(),
reg.reg_class(),
&in_value.layout,
instance,
);
inputs.push(value);
@ -341,7 +347,8 @@ impl<'ll, 'tcx> AsmBuilderMethods<'tcx> for Builder<'_, 'll, 'tcx> {
} else {
self.extract_value(result, op_idx[&idx] as u64)
};
let value = llvm_fixup_output(self, value, reg.reg_class(), &place.layout);
let value =
llvm_fixup_output(self, value, reg.reg_class(), &place.layout, instance);
OperandValue::Immediate(value).store(self, place);
}
}
@ -913,12 +920,22 @@ fn llvm_asm_scalar_type<'ll>(cx: &CodegenCx<'ll, '_>, scalar: Scalar) -> &'ll Ty
}
}
fn any_target_feature_enabled(
cx: &CodegenCx<'_, '_>,
instance: Instance<'_>,
features: &[Symbol],
) -> bool {
let enabled = cx.tcx.asm_target_features(instance.def_id());
features.iter().any(|feat| enabled.contains(feat))
}
/// Fix up an input value to work around LLVM bugs.
fn llvm_fixup_input<'ll, 'tcx>(
bx: &mut Builder<'_, 'll, 'tcx>,
mut value: &'ll Value,
reg: InlineAsmRegClass,
layout: &TyAndLayout<'tcx>,
instance: Instance<'_>,
) -> &'ll Value {
let dl = &bx.tcx.data_layout;
match (reg, layout.abi) {
@ -1029,6 +1046,16 @@ fn llvm_fixup_input<'ll, 'tcx>(
_ => value,
}
}
(InlineAsmRegClass::RiscV(RiscVInlineAsmRegClass::freg), Abi::Scalar(s))
if s.primitive() == Primitive::Float(Float::F16)
&& !any_target_feature_enabled(bx, instance, &[sym::zfhmin, sym::zfh]) =>
{
// Smaller floats are always "NaN-boxed" inside larger floats on RISC-V.
let value = bx.bitcast(value, bx.type_i16());
let value = bx.zext(value, bx.type_i32());
let value = bx.or(value, bx.const_u32(0xFFFF_0000));
bx.bitcast(value, bx.type_f32())
}
_ => value,
}
}
@ -1039,6 +1066,7 @@ fn llvm_fixup_output<'ll, 'tcx>(
mut value: &'ll Value,
reg: InlineAsmRegClass,
layout: &TyAndLayout<'tcx>,
instance: Instance<'_>,
) -> &'ll Value {
match (reg, layout.abi) {
(InlineAsmRegClass::AArch64(AArch64InlineAsmRegClass::vreg), Abi::Scalar(s)) => {
@ -1140,6 +1168,14 @@ fn llvm_fixup_output<'ll, 'tcx>(
_ => value,
}
}
(InlineAsmRegClass::RiscV(RiscVInlineAsmRegClass::freg), Abi::Scalar(s))
if s.primitive() == Primitive::Float(Float::F16)
&& !any_target_feature_enabled(bx, instance, &[sym::zfhmin, sym::zfh]) =>
{
let value = bx.bitcast(value, bx.type_i32());
let value = bx.trunc(value, bx.type_i16());
bx.bitcast(value, bx.type_f16())
}
_ => value,
}
}
@ -1149,6 +1185,7 @@ fn llvm_fixup_output_type<'ll, 'tcx>(
cx: &CodegenCx<'ll, 'tcx>,
reg: InlineAsmRegClass,
layout: &TyAndLayout<'tcx>,
instance: Instance<'_>,
) -> &'ll Type {
match (reg, layout.abi) {
(InlineAsmRegClass::AArch64(AArch64InlineAsmRegClass::vreg), Abi::Scalar(s)) => {
@ -1242,6 +1279,12 @@ fn llvm_fixup_output_type<'ll, 'tcx>(
_ => layout.llvm_type(cx),
}
}
(InlineAsmRegClass::RiscV(RiscVInlineAsmRegClass::freg), Abi::Scalar(s))
if s.primitive() == Primitive::Float(Float::F16)
&& !any_target_feature_enabled(cx, instance, &[sym::zfhmin, sym::zfh]) =>
{
cx.type_f32()
}
_ => layout.llvm_type(cx),
}
}

View File

@ -341,8 +341,7 @@ const_eval_unallowed_fn_pointer_call = function pointer calls are not allowed in
const_eval_unallowed_heap_allocations =
allocations are not allowed in {const_eval_const_context}s
.label = allocation not allowed in {const_eval_const_context}s
.teach_note =
The value of statics and constants must be known at compile time, and they live for the entire lifetime of a program. Creating a boxed value allocates memory on the heap at runtime, and therefore cannot be done at compile time.
.teach_note = The value of statics and constants must be known at compile time, and they live for the entire lifetime of a program. Creating a boxed value allocates memory on the heap at runtime, and therefore cannot be done at compile time.
const_eval_unallowed_inline_asm =
inline assembly is not allowed in {const_eval_const_context}s

View File

@ -630,6 +630,13 @@ impl<'tcx, M: Machine<'tcx>> InterpCx<'tcx, M> {
}
}
/// Gives raw, immutable access to the `Allocation` address, without bounds or alignment checks.
/// The caller is responsible for calling the access hooks!
pub fn get_alloc_bytes_unchecked_raw(&self, id: AllocId) -> InterpResult<'tcx, *const u8> {
let alloc = self.get_alloc_raw(id)?;
Ok(alloc.get_bytes_unchecked_raw())
}
/// Bounds-checked *but not align-checked* allocation access.
pub fn get_ptr_alloc<'a>(
&'a self,
@ -713,6 +720,16 @@ impl<'tcx, M: Machine<'tcx>> InterpCx<'tcx, M> {
Ok((alloc, &mut self.machine))
}
/// Gives raw, mutable access to the `Allocation` address, without bounds or alignment checks.
/// The caller is responsible for calling the access hooks!
pub fn get_alloc_bytes_unchecked_raw_mut(
&mut self,
id: AllocId,
) -> InterpResult<'tcx, *mut u8> {
let alloc = self.get_alloc_raw_mut(id)?.0;
Ok(alloc.get_bytes_unchecked_raw_mut())
}
/// Bounds-checked *but not align-checked* allocation access.
pub fn get_ptr_alloc_mut<'a>(
&'a mut self,

View File

@ -194,7 +194,7 @@ hir_analysis_inherent_ty_outside = cannot define inherent `impl` for a type outs
.span_help = alternatively add `#[rustc_has_incoherent_inherent_impls]` to the type and `#[rustc_allow_incoherent_impl]` to the relevant impl items
hir_analysis_inherent_ty_outside_new = cannot define inherent `impl` for a type outside of the crate where the type is defined
.label = impl for type defined outside of crate.
.label = impl for type defined outside of crate
.note = define and implement a trait or new type instead
hir_analysis_inherent_ty_outside_primitive = cannot define inherent `impl` for primitive types outside of `core`
@ -544,7 +544,7 @@ hir_analysis_unrecognized_intrinsic_function =
hir_analysis_unused_associated_type_bounds =
unnecessary associated type bound for not object safe associated type
.note = this associated type has a `where Self: Sized` bound. Thus, while the associated type can be specified, it cannot be used in any way, because trait objects are not `Sized`.
.note = this associated type has a `where Self: Sized` bound, and while the associated type can be specified, it cannot be used because trait objects are never `Sized`
.suggestion = remove this bound
hir_analysis_unused_generic_parameter =

View File

@ -75,7 +75,7 @@ lint_builtin_deprecated_attr_default_suggestion = remove this attribute
lint_builtin_deprecated_attr_link = use of deprecated attribute `{$name}`: {$reason}. See {$link}
.msg_suggestion = {$msg}
.default_suggestion = remove this attribute
lint_builtin_deprecated_attr_used = use of deprecated attribute `{$name}`: no longer used.
lint_builtin_deprecated_attr_used = use of deprecated attribute `{$name}`: no longer used
lint_builtin_deref_nullptr = dereferencing a null pointer
.label = this code causes undefined behavior when executed
@ -213,7 +213,7 @@ lint_default_hash_types = prefer `{$preferred}` over `{$used}`, it has better pe
lint_default_source = `forbid` lint level is the default for {$id}
lint_deprecated_lint_name =
lint name `{$name}` is deprecated and may not have an effect in the future.
lint name `{$name}` is deprecated and may not have an effect in the future
.suggestion = change it to
.help = change it to {$replace}
@ -244,11 +244,11 @@ lint_duplicate_matcher_binding = duplicate matcher binding
lint_enum_intrinsics_mem_discriminant =
the return value of `mem::discriminant` is unspecified when called with a non-enum type
.note = the argument to `discriminant` should be a reference to an enum, but it was passed a reference to a `{$ty_param}`, which is not an enum.
.note = the argument to `discriminant` should be a reference to an enum, but it was passed a reference to a `{$ty_param}`, which is not an enum
lint_enum_intrinsics_mem_variant =
the return value of `mem::variant_count` is unspecified when called with a non-enum type
.note = the type parameter of `variant_count` should be an enum, but it was instantiated with the type `{$ty_param}`, which is not an enum.
.note = the type parameter of `variant_count` should be an enum, but it was instantiated with the type `{$ty_param}`, which is not an enum
lint_expectation = this lint expectation is unfulfilled
.note = the `unfulfilled_lint_expectations` lint can't be expected and will always produce this message

View File

@ -248,13 +248,13 @@ metadata_rustc_lib_required =
.help = try adding `extern crate rustc_driver;` at the top level of this crate
metadata_stable_crate_id_collision =
found crates (`{$crate_name0}` and `{$crate_name1}`) with colliding StableCrateId values.
found crates (`{$crate_name0}` and `{$crate_name1}`) with colliding StableCrateId values
metadata_std_required =
`std` is required by `{$current_crate}` because it does not declare `#![no_std]`
metadata_symbol_conflicts_current =
the current crate is indistinguishable from one of its dependencies: it has the same crate-name `{$crate_name}` and was compiled with the same `-C metadata` arguments. This will result in symbol conflicts between the two.
the current crate is indistinguishable from one of its dependencies: it has the same crate-name `{$crate_name}` and was compiled with the same `-C metadata` arguments, so this will result in symbol conflicts between the two
metadata_target_no_std_support =
the `{$locator_triple}` target may not support the standard library

View File

@ -40,9 +40,16 @@ pub trait AllocBytes: Clone + fmt::Debug + Deref<Target = [u8]> + DerefMut<Targe
/// Gives direct access to the raw underlying storage.
///
/// Crucially this pointer is compatible with:
/// - other pointers retunred by this method, and
/// - other pointers returned by this method, and
/// - references returned from `deref()`, as long as there was no write.
fn as_mut_ptr(&mut self) -> *mut u8;
/// Gives direct access to the raw underlying storage.
///
/// Crucially this pointer is compatible with:
/// - other pointers returned by this method, and
/// - references returned from `deref()`, as long as there was no write.
fn as_ptr(&self) -> *const u8;
}
/// Default `bytes` for `Allocation` is a `Box<u8>`.
@ -62,6 +69,11 @@ impl AllocBytes for Box<[u8]> {
// Carefully avoiding any intermediate references.
ptr::addr_of_mut!(**self).cast()
}
fn as_ptr(&self) -> *const u8 {
// Carefully avoiding any intermediate references.
ptr::addr_of!(**self).cast()
}
}
/// This type represents an Allocation in the Miri/CTFE core engine.
@ -490,19 +502,27 @@ impl<Prov: Provenance, Extra, Bytes: AllocBytes> Allocation<Prov, Extra, Bytes>
self.provenance.clear(range, cx)?;
assert!(range.end().bytes_usize() <= self.bytes.len()); // need to do our own bounds-check
// Cruciall, we go via `AllocBytes::as_mut_ptr`, not `AllocBytes::deref_mut`.
// Crucially, we go via `AllocBytes::as_mut_ptr`, not `AllocBytes::deref_mut`.
let begin_ptr = self.bytes.as_mut_ptr().wrapping_add(range.start.bytes_usize());
let len = range.end().bytes_usize() - range.start.bytes_usize();
Ok(ptr::slice_from_raw_parts_mut(begin_ptr, len))
}
/// This gives direct mutable access to the entire buffer, just exposing their internal state
/// without reseting anything. Directly exposes `AllocBytes::as_mut_ptr`. Only works if
/// without resetting anything. Directly exposes `AllocBytes::as_mut_ptr`. Only works if
/// `OFFSET_IS_ADDR` is true.
pub fn get_bytes_unchecked_raw_mut(&mut self) -> *mut u8 {
assert!(Prov::OFFSET_IS_ADDR);
self.bytes.as_mut_ptr()
}
/// This gives direct immutable access to the entire buffer, just exposing their internal state
/// without resetting anything. Directly exposes `AllocBytes::as_ptr`. Only works if
/// `OFFSET_IS_ADDR` is true.
pub fn get_bytes_unchecked_raw(&self) -> *const u8 {
assert!(Prov::OFFSET_IS_ADDR);
self.bytes.as_ptr()
}
}
/// Reading and writing.

View File

@ -103,7 +103,7 @@ mir_build_deref_raw_pointer_requires_unsafe_unsafe_op_in_unsafe_fn_allowed =
.note = raw pointers may be null, dangling or unaligned; they can violate aliasing rules and cause data races: all of these are undefined behavior
.label = dereference of raw pointer
mir_build_exceeds_mcdc_condition_limit = Number of conditions in decision ({$num_conditions}) exceeds limit ({$max_conditions}). MC/DC analysis will not count this expression.
mir_build_exceeds_mcdc_condition_limit = number of conditions in decision ({$num_conditions}) exceeds limit ({$max_conditions}), so MC/DC analysis will not count this expression
mir_build_extern_static_requires_unsafe =
use of extern static is unsafe and requires unsafe block

View File

@ -14,7 +14,7 @@ passes_abi_of =
fn_abi_of({$fn_name}) = {$fn_abi}
passes_allow_incoherent_impl =
`rustc_allow_incoherent_impl` attribute should be applied to impl items.
`rustc_allow_incoherent_impl` attribute should be applied to impl items
.label = the only currently supported targets are inherent methods
passes_allow_internal_unstable =
@ -253,8 +253,8 @@ passes_doc_test_unknown_spotlight =
.no_op_note = `doc(spotlight)` is now a no-op
passes_duplicate_diagnostic_item_in_crate =
duplicate diagnostic item in crate `{$crate_name}`: `{$name}`.
.note = the diagnostic item is first defined in crate `{$orig_crate_name}`.
duplicate diagnostic item in crate `{$crate_name}`: `{$name}`
.note = the diagnostic item is first defined in crate `{$orig_crate_name}`
passes_duplicate_feature_err =
the feature `{$feature}` has already been declared
@ -263,27 +263,27 @@ passes_duplicate_lang_item =
found duplicate lang item `{$lang_item_name}`
.first_defined_span = the lang item is first defined here
.first_defined_crate_depends = the lang item is first defined in crate `{$orig_crate_name}` (which `{$orig_dependency_of}` depends on)
.first_defined_crate = the lang item is first defined in crate `{$orig_crate_name}`.
.first_defined_crate = the lang item is first defined in crate `{$orig_crate_name}`
.first_definition_local = first definition in the local crate (`{$orig_crate_name}`)
.second_definition_local = second definition in the local crate (`{$crate_name}`)
.first_definition_path = first definition in `{$orig_crate_name}` loaded from {$orig_path}
.second_definition_path = second definition in `{$crate_name}` loaded from {$path}
passes_duplicate_lang_item_crate =
duplicate lang item in crate `{$crate_name}`: `{$lang_item_name}`.
duplicate lang item in crate `{$crate_name}`: `{$lang_item_name}`
.first_defined_span = the lang item is first defined here
.first_defined_crate_depends = the lang item is first defined in crate `{$orig_crate_name}` (which `{$orig_dependency_of}` depends on)
.first_defined_crate = the lang item is first defined in crate `{$orig_crate_name}`.
.first_defined_crate = the lang item is first defined in crate `{$orig_crate_name}`
.first_definition_local = first definition in the local crate (`{$orig_crate_name}`)
.second_definition_local = second definition in the local crate (`{$crate_name}`)
.first_definition_path = first definition in `{$orig_crate_name}` loaded from {$orig_path}
.second_definition_path = second definition in `{$crate_name}` loaded from {$path}
passes_duplicate_lang_item_crate_depends =
duplicate lang item in crate `{$crate_name}` (which `{$dependency_of}` depends on): `{$lang_item_name}`.
duplicate lang item in crate `{$crate_name}` (which `{$dependency_of}` depends on): `{$lang_item_name}`
.first_defined_span = the lang item is first defined here
.first_defined_crate_depends = the lang item is first defined in crate `{$orig_crate_name}` (which `{$orig_dependency_of}` depends on)
.first_defined_crate = the lang item is first defined in crate `{$orig_crate_name}`.
.first_defined_crate = the lang item is first defined in crate `{$orig_crate_name}`
.first_definition_local = first definition in the local crate (`{$orig_crate_name}`)
.second_definition_local = second definition in the local crate (`{$crate_name}`)
.first_definition_path = first definition in `{$orig_crate_name}` loaded from {$orig_path}
@ -315,7 +315,7 @@ passes_ffi_pure_invalid_target =
`#[ffi_pure]` may only be used on foreign functions
passes_has_incoherent_inherent_impl =
`rustc_has_incoherent_inherent_impls` attribute should be applied to types or traits.
`rustc_has_incoherent_inherent_impls` attribute should be applied to types or traits
.label = only adts, extern types and traits are supported
passes_ignored_attr =

View File

@ -240,7 +240,7 @@ resolve_label_with_similar_name_reachable =
resolve_lending_iterator_report_error =
associated type `Iterator::Item` is declared without lifetime parameters, so using a borrowed type for them requires that lifetime to come from the implemented type
.note = you can't create an `Iterator` that borrows each `Item` from itself, but you can instead create a new type that borrows your existing type and implement `Iterator` for that new type.
.note = you can't create an `Iterator` that borrows each `Item` from itself, but you can instead create a new type that borrows your existing type and implement `Iterator` for that new type
resolve_lifetime_param_in_enum_discriminant =
lifetime parameters may not be used in enum discriminant values

View File

@ -82,9 +82,9 @@ session_octal_float_literal_not_supported = octal float literal is not supported
session_optimization_fuel_exhausted = optimization-fuel-exhausted: {$msg}
session_profile_sample_use_file_does_not_exist = file `{$path}` passed to `-C profile-sample-use` does not exist.
session_profile_sample_use_file_does_not_exist = file `{$path}` passed to `-C profile-sample-use` does not exist
session_profile_use_file_does_not_exist = file `{$path}` passed to `-C profile-use` does not exist.
session_profile_use_file_does_not_exist = file `{$path}` passed to `-C profile-use` does not exist
session_sanitizer_cfi_canonical_jump_tables_requires_cfi = `-Zsanitizer-cfi-canonical-jump-tables` requires `-Zsanitizer=cfi`

View File

@ -533,6 +533,13 @@ impl<'tcx> Context for TablesWrapper<'tcx> {
Ok(tables.fn_abi_of_instance(instance, List::empty())?.stable(&mut *tables))
}
fn fn_ptr_abi(&self, fn_ptr: PolyFnSig) -> Result<FnAbi, Error> {
let mut tables = self.0.borrow_mut();
let tcx = tables.tcx;
let sig = fn_ptr.internal(&mut *tables, tcx);
Ok(tables.fn_abi_of_fn_ptr(sig, List::empty())?.stable(&mut *tables))
}
fn instance_def_id(&self, def: InstanceDef) -> stable_mir::DefId {
let mut tables = self.0.borrow_mut();
let def_id = tables.instances[def].def_id();

View File

@ -2054,6 +2054,8 @@ symbols! {
yes,
yield_expr,
ymm_reg,
zfh,
zfhmin,
zmm_reg,
}
}

View File

@ -40,12 +40,13 @@ impl RiscVInlineAsmRegClass {
match self {
Self::reg => {
if arch == InlineAsmArch::RiscV64 {
types! { _: I8, I16, I32, I64, F32, F64; }
types! { _: I8, I16, I32, I64, F16, F32, F64; }
} else {
types! { _: I8, I16, I32, F32; }
types! { _: I8, I16, I32, F16, F32; }
}
}
Self::freg => types! { f: F32; d: F64; },
// FIXME(f16_f128): Add `q: F128;` once LLVM support the `Q` extension.
Self::freg => types! { f: F16, F32; d: F64; },
Self::vreg => &[],
}
}

View File

@ -215,6 +215,9 @@ pub trait Context {
/// Get an instance ABI.
fn instance_abi(&self, def: InstanceDef) -> Result<FnAbi, Error>;
/// Get the ABI of a function pointer.
fn fn_ptr_abi(&self, fn_ptr: PolyFnSig) -> Result<FnAbi, Error>;
/// Get the layout of a type.
fn ty_layout(&self, ty: Ty) -> Result<Layout, Error>;

View File

@ -2,7 +2,7 @@ use super::{
mir::{Body, Mutability, Safety},
with, DefId, Error, Symbol,
};
use crate::abi::Layout;
use crate::abi::{FnAbi, Layout};
use crate::crate_def::{CrateDef, CrateDefType};
use crate::mir::alloc::{read_target_int, read_target_uint, AllocId};
use crate::mir::mono::StaticDef;
@ -996,6 +996,16 @@ pub struct AliasTerm {
pub type PolyFnSig = Binder<FnSig>;
impl PolyFnSig {
/// Compute a `FnAbi` suitable for indirect calls, i.e. to `fn` pointers.
///
/// NB: this doesn't handle virtual calls - those should use `Instance::fn_abi`
/// instead, where the instance is an `InstanceKind::Virtual`.
pub fn fn_ptr_abi(self) -> Result<FnAbi, Error> {
with(|cx| cx.fn_ptr_abi(self))
}
}
#[derive(Clone, Debug, Eq, PartialEq)]
pub struct FnSig {
pub inputs_and_output: Vec<Ty>,

View File

@ -112,7 +112,7 @@ def atomic_link(link: Path, target: Path):
os.remove(tmp_file)
@dataclass(kw_only=True)
@dataclass
class TestEnvironment:
rust_build_dir: Path
sdk_dir: Path

View File

@ -108,4 +108,8 @@ impl AllocBytes for MiriAllocBytes {
fn as_mut_ptr(&mut self) -> *mut u8 {
self.ptr
}
fn as_ptr(&self) -> *const u8 {
self.ptr
}
}

View File

@ -13,6 +13,7 @@ ignore = "0.4.18"
semver = "1.0"
termcolor = "1.1.3"
rustc-hash = "1.1.0"
fluent-syntax = "0.11.1"
[[bin]]
name = "rust-tidy"

View File

@ -14,7 +14,6 @@ run-make/compiler-lookup-paths-2/Makefile
run-make/compiler-lookup-paths/Makefile
run-make/compiler-rt-works-on-mingw/Makefile
run-make/crate-hash-rustc-version/Makefile
run-make/crate-name-priority/Makefile
run-make/cross-lang-lto-clang/Makefile
run-make/cross-lang-lto-pgo-smoketest/Makefile
run-make/cross-lang-lto-upstream-rlibs/Makefile
@ -31,7 +30,6 @@ run-make/emit-shared-files/Makefile
run-make/emit-stack-sizes/Makefile
run-make/emit-to-stdout/Makefile
run-make/env-dep-info/Makefile
run-make/error-writing-dependencies/Makefile
run-make/export-executable-symbols/Makefile
run-make/extern-diff-internal-name/Makefile
run-make/extern-flag-disambiguates/Makefile
@ -154,7 +152,6 @@ run-make/raw-dylib-inline-cross-dylib/Makefile
run-make/raw-dylib-link-ordinal/Makefile
run-make/raw-dylib-stdcall-ordinal/Makefile
run-make/redundant-libs/Makefile
run-make/relocation-model/Makefile
run-make/relro-levels/Makefile
run-make/remap-path-prefix-dwarf/Makefile
run-make/remap-path-prefix/Makefile

View File

@ -0,0 +1,84 @@
//! Checks that no Fluent messages or attributes end in periods (except ellipses)
use fluent_syntax::ast::{Entry, PatternElement};
use crate::walk::{filter_dirs, walk};
use std::path::Path;
fn filter_fluent(path: &Path) -> bool {
if let Some(ext) = path.extension() { ext.to_str() != Some("ftl") } else { true }
}
/// Messages allowed to have `.` at their end.
///
/// These should probably be reworked eventually.
const ALLOWLIST: &[&str] = &[
"const_eval_long_running",
"const_eval_validation_failure_note",
"driver_impl_ice",
"incremental_corrupt_file",
"mir_build_pointer_pattern",
];
fn check_period(filename: &str, contents: &str, bad: &mut bool) {
if filename.contains("codegen") {
// FIXME: Too many codegen messages have periods right now...
return;
}
let (Ok(parse) | Err((parse, _))) = fluent_syntax::parser::parse(contents);
for entry in &parse.body {
if let Entry::Message(m) = entry {
if ALLOWLIST.contains(&m.id.name) {
continue;
}
if let Some(pat) = &m.value {
if let Some(PatternElement::TextElement { value }) = pat.elements.last() {
// We don't care about ellipses.
if value.ends_with(".") && !value.ends_with("...") {
let ll = find_line(contents, *value);
let name = m.id.name;
tidy_error!(bad, "{filename}:{ll}: message `{name}` ends in a period");
}
}
}
for attr in &m.attributes {
// Teach notes usually have long messages.
if attr.id.name == "teach_note" {
continue;
}
if let Some(PatternElement::TextElement { value }) = attr.value.elements.last() {
if value.ends_with(".") && !value.ends_with("...") {
let ll = find_line(contents, *value);
let name = attr.id.name;
tidy_error!(bad, "{filename}:{ll}: attr `{name}` ends in a period");
}
}
}
}
}
}
/// Evil cursed bad hack. Requires that `value` be a substr (in memory) of `contents`.
fn find_line(haystack: &str, needle: &str) -> usize {
for (ll, line) in haystack.lines().enumerate() {
if line.as_ptr() > needle.as_ptr() {
return ll;
}
}
1
}
pub fn check(path: &Path, bad: &mut bool) {
walk(
path,
|path, is_dir| filter_dirs(path) || (!is_dir && filter_fluent(path)),
&mut |ent, contents| {
check_period(ent.path().to_str().unwrap(), contents, bad);
},
);
}

View File

@ -72,6 +72,7 @@ pub mod ext_tool_checks;
pub mod extdeps;
pub mod features;
pub mod fluent_alphabetical;
pub mod fluent_period;
mod fluent_used;
pub(crate) mod iter_header;
pub mod known_bug;

View File

@ -115,6 +115,7 @@ fn main() {
// Checks that only make sense for the compiler.
check!(error_codes, &root_path, &[&compiler_path, &librustdoc_path], verbose);
check!(fluent_alphabetical, &compiler_path, bless);
check!(fluent_period, &compiler_path);
check!(target_policy, &root_path);
// Checks that only make sense for the std libs.

View File

@ -1,12 +1,34 @@
//@ revisions: riscv64 riscv32
//@ revisions: riscv64 riscv32 riscv64-zfhmin riscv32-zfhmin riscv64-zfh riscv32-zfh
//@ assembly-output: emit-asm
//@[riscv64] compile-flags: --target riscv64imac-unknown-none-elf
//@[riscv64] needs-llvm-components: riscv
//@[riscv32] compile-flags: --target riscv32imac-unknown-none-elf
//@[riscv32] needs-llvm-components: riscv
//@[riscv64-zfhmin] compile-flags: --target riscv64imac-unknown-none-elf --cfg riscv64
//@[riscv64-zfhmin] needs-llvm-components: riscv
//@[riscv64-zfhmin] compile-flags: -C target-feature=+zfhmin
//@[riscv64-zfhmin] filecheck-flags: --check-prefix riscv64
//@[riscv32-zfhmin] compile-flags: --target riscv32imac-unknown-none-elf
//@[riscv32-zfhmin] needs-llvm-components: riscv
//@[riscv32-zfhmin] compile-flags: -C target-feature=+zfhmin
//@[riscv64-zfh] compile-flags: --target riscv64imac-unknown-none-elf --cfg riscv64
//@[riscv64-zfh] needs-llvm-components: riscv
//@[riscv64-zfh] compile-flags: -C target-feature=+zfh
//@[riscv64-zfh] filecheck-flags: --check-prefix riscv64 --check-prefix zfhmin
//@[riscv32-zfh] compile-flags: --target riscv32imac-unknown-none-elf
//@[riscv32-zfh] needs-llvm-components: riscv
//@[riscv32-zfh] compile-flags: -C target-feature=+zfh
//@[riscv32-zfh] filecheck-flags: --check-prefix zfhmin
//@ compile-flags: -C target-feature=+d
#![feature(no_core, lang_items, rustc_attrs)]
#![feature(no_core, lang_items, rustc_attrs, f16)]
#![crate_type = "rlib"]
#![no_core]
#![allow(asm_sub_register)]
@ -33,6 +55,7 @@ type ptr = *mut u8;
impl Copy for i8 {}
impl Copy for i16 {}
impl Copy for f16 {}
impl Copy for i32 {}
impl Copy for f32 {}
impl Copy for i64 {}
@ -103,6 +126,12 @@ macro_rules! check_reg {
// CHECK: #NO_APP
check!(reg_i8 i8 reg "mv");
// CHECK-LABEL: reg_f16:
// CHECK: #APP
// CHECK: mv {{[a-z0-9]+}}, {{[a-z0-9]+}}
// CHECK: #NO_APP
check!(reg_f16 f16 reg "mv");
// CHECK-LABEL: reg_i16:
// CHECK: #APP
// CHECK: mv {{[a-z0-9]+}}, {{[a-z0-9]+}}
@ -141,6 +170,14 @@ check!(reg_f64 f64 reg "mv");
// CHECK: #NO_APP
check!(reg_ptr ptr reg "mv");
// CHECK-LABEL: freg_f16:
// zfhmin-NOT: or
// CHECK: #APP
// CHECK: fmv.s f{{[a-z0-9]+}}, f{{[a-z0-9]+}}
// CHECK: #NO_APP
// zfhmin-NOT: or
check!(freg_f16 f16 freg "fmv.s");
// CHECK-LABEL: freg_f32:
// CHECK: #APP
// CHECK: fmv.s f{{[a-z0-9]+}}, f{{[a-z0-9]+}}
@ -165,6 +202,12 @@ check_reg!(a0_i8 i8 "a0" "mv");
// CHECK: #NO_APP
check_reg!(a0_i16 i16 "a0" "mv");
// CHECK-LABEL: a0_f16:
// CHECK: #APP
// CHECK: mv a0, a0
// CHECK: #NO_APP
check_reg!(a0_f16 f16 "a0" "mv");
// CHECK-LABEL: a0_i32:
// CHECK: #APP
// CHECK: mv a0, a0
@ -197,6 +240,14 @@ check_reg!(a0_f64 f64 "a0" "mv");
// CHECK: #NO_APP
check_reg!(a0_ptr ptr "a0" "mv");
// CHECK-LABEL: fa0_f16:
// zfhmin-NOT: or
// CHECK: #APP
// CHECK: fmv.s fa0, fa0
// CHECK: #NO_APP
// zfhmin-NOT: or
check_reg!(fa0_f16 f16 "fa0" "fmv.s");
// CHECK-LABEL: fa0_f32:
// CHECK: #APP
// CHECK: fmv.s fa0, fa0

View File

@ -1,12 +0,0 @@
# ignore-cross-compile
include ../tools.mk
all:
$(RUSTC) foo.rs
rm $(TMPDIR)/$(call BIN,foo)
$(RUSTC) foo.rs --crate-name bar
rm $(TMPDIR)/$(call BIN,bar)
$(RUSTC) foo1.rs
rm $(TMPDIR)/$(call BIN,foo)
$(RUSTC) foo1.rs -o $(TMPDIR)/$(call BIN,bar1)
rm $(TMPDIR)/$(call BIN,bar1)

View File

@ -0,0 +1,18 @@
// The `crate_name` rustc flag should have higher priority
// over `#![crate_name = "foo"]` defined inside the source code.
// This test has a conflict between crate_names defined in the .rs files
// and the compiler flags, and checks that the flag is favoured each time.
// See https://github.com/rust-lang/rust/pull/15518
use run_make_support::{bin_name, fs_wrapper, rustc};
fn main() {
rustc().input("foo.rs").run();
fs_wrapper::remove_file(bin_name("foo"));
rustc().input("foo.rs").crate_name("bar").run();
fs_wrapper::remove_file(bin_name("bar"));
rustc().input("foo1.rs").run();
fs_wrapper::remove_file(bin_name("foo"));
rustc().input("foo1.rs").output(bin_name("bar1")).run();
fs_wrapper::remove_file(bin_name("bar1"));
}

View File

@ -1,8 +0,0 @@
include ../tools.mk
all:
# Let's get a nice error message
$(BARE_RUSTC) foo.rs --emit dep-info --out-dir foo/bar/baz 2>&1 | \
$(CGREP) "error writing dependencies"
# Make sure the filename shows up
$(BARE_RUSTC) foo.rs --emit dep-info --out-dir foo/bar/baz 2>&1 | $(CGREP) "baz"

View File

@ -0,0 +1,17 @@
// Invalid paths passed to rustc used to cause internal compilation errors
// alongside an obscure error message. This was turned into a standard error,
// and this test checks that the cleaner error message is printed instead.
// See https://github.com/rust-lang/rust/issues/13517
use run_make_support::rustc;
// NOTE: This cannot be a UI test due to the --out-dir flag, which is
// already present by default in UI testing.
fn main() {
let out = rustc().input("foo.rs").emit("dep-info").out_dir("foo/bar/baz").run_fail();
// The error message should be informative.
out.assert_stderr_contains("error writing dependencies");
// The filename should appear.
out.assert_stderr_contains("baz");
}

View File

@ -1,20 +0,0 @@
# ignore-cross-compile
include ../tools.mk
all: others
$(RUSTC) -C relocation-model=dynamic-no-pic foo.rs
$(call RUN,foo)
$(RUSTC) -C relocation-model=default foo.rs
$(call RUN,foo)
$(RUSTC) -C relocation-model=dynamic-no-pic --crate-type=dylib foo.rs --emit=link,obj
ifdef IS_MSVC
# FIXME(#28026)
others:
else
others:
$(RUSTC) -C relocation-model=static foo.rs
$(call RUN,foo)
endif

View File

@ -0,0 +1,24 @@
// Generation of position-independent code (PIC) can be altered
// through use of the -C relocation-model rustc flag. This test
// uses varied values with this flag and checks that compilation
// succeeds.
// See https://github.com/rust-lang/rust/pull/13340
//@ ignore-cross-compile
use run_make_support::{run, rustc};
fn main() {
rustc().arg("-Crelocation-model=static").input("foo.rs").run();
run("foo");
rustc().arg("-Crelocation-model=dynamic-no-pic").input("foo.rs").run();
run("foo");
rustc().arg("-Crelocation-model=default").input("foo.rs").run();
run("foo");
rustc()
.arg("-Crelocation-model=dynamic-no-pic")
.crate_type("dylib")
.emit("link,obj")
.input("foo.rs")
.run();
}

View File

@ -54,6 +54,21 @@ fn test_stable_mir() -> ControlFlow<()> {
let variadic_fn = *get_item(&items, (ItemKind::Fn, "variadic_fn")).unwrap();
check_variadic(variadic_fn);
// Extract function pointers.
let fn_ptr_holder = *get_item(&items, (ItemKind::Fn, "fn_ptr_holder")).unwrap();
let fn_ptr_holder_instance = Instance::try_from(fn_ptr_holder).unwrap();
let body = fn_ptr_holder_instance.body().unwrap();
let args = body.arg_locals();
// Test fn_abi of function pointer version.
let ptr_fn_abi = args[0].ty.kind().fn_sig().unwrap().fn_ptr_abi().unwrap();
assert_eq!(ptr_fn_abi, fn_abi);
// Test variadic_fn of function pointer version.
let ptr_variadic_fn_abi = args[1].ty.kind().fn_sig().unwrap().fn_ptr_abi().unwrap();
assert!(ptr_variadic_fn_abi.c_variadic);
assert_eq!(ptr_variadic_fn_abi.args.len(), 1);
ControlFlow::Continue(())
}
@ -164,6 +179,14 @@ fn generate_input(path: &str) -> std::io::Result<()> {
pub unsafe extern "C" fn variadic_fn(n: usize, mut args: ...) -> usize {{
0
}}
pub type ComplexFn = fn([u8; 0], char, NonZero<u8>) -> Result<usize, &'static str>;
pub type VariadicFn = unsafe extern "C" fn(usize, ...) -> usize;
pub fn fn_ptr_holder(complex_fn: ComplexFn, variadic_fn: VariadicFn) {{
// We only care about the signature.
todo!()
}}
"#
)?;
Ok(())

View File

@ -4,7 +4,7 @@ error[E0703]: invalid ABI: found `rust-intrinsec`
LL | extern "rust-intrinsec" fn rust_intrinsic() {}
| ^^^^^^^^^^^^^^^^ invalid ABI
|
= note: invoke `rustc --print=calling-conventions` for a full list of supported calling conventions.
= note: invoke `rustc --print=calling-conventions` for a full list of supported calling conventions
error: aborting due to 1 previous error

View File

@ -7,7 +7,7 @@ LL | extern "riscv-interrupt" fn isr() {}
| invalid ABI
| help: did you mean: `"riscv-interrupt-m"`
|
= note: invoke `rustc --print=calling-conventions` for a full list of supported calling conventions.
= note: invoke `rustc --print=calling-conventions` for a full list of supported calling conventions
= note: please use one of riscv-interrupt-m or riscv-interrupt-s for machine- or supervisor-level interrupts, respectively
error[E0703]: invalid ABI: found `riscv-interrupt-u`
@ -19,7 +19,7 @@ LL | extern "riscv-interrupt-u" fn isr_U() {}
| invalid ABI
| help: did you mean: `"riscv-interrupt-m"`
|
= note: invoke `rustc --print=calling-conventions` for a full list of supported calling conventions.
= note: invoke `rustc --print=calling-conventions` for a full list of supported calling conventions
= note: user-mode interrupt handlers have been removed from LLVM pending standardization, see: https://reviews.llvm.org/D149314
error: aborting due to 2 previous errors

View File

@ -7,7 +7,7 @@ LL | extern "riscv-interrupt" fn isr() {}
| invalid ABI
| help: did you mean: `"riscv-interrupt-m"`
|
= note: invoke `rustc --print=calling-conventions` for a full list of supported calling conventions.
= note: invoke `rustc --print=calling-conventions` for a full list of supported calling conventions
= note: please use one of riscv-interrupt-m or riscv-interrupt-s for machine- or supervisor-level interrupts, respectively
error[E0703]: invalid ABI: found `riscv-interrupt-u`
@ -19,7 +19,7 @@ LL | extern "riscv-interrupt-u" fn isr_U() {}
| invalid ABI
| help: did you mean: `"riscv-interrupt-m"`
|
= note: invoke `rustc --print=calling-conventions` for a full list of supported calling conventions.
= note: invoke `rustc --print=calling-conventions` for a full list of supported calling conventions
= note: user-mode interrupt handlers have been removed from LLVM pending standardization, see: https://reviews.llvm.org/D149314
error: aborting due to 2 previous errors

View File

@ -4,7 +4,7 @@ error[E0703]: invalid ABI: found `路濫狼á́́`
LL | extern "路濫狼á́́" fn foo() {}
| ^^^^^^^^^ invalid ABI
|
= note: invoke `rustc --print=calling-conventions` for a full list of supported calling conventions.
= note: invoke `rustc --print=calling-conventions` for a full list of supported calling conventions
error: aborting due to 1 previous error

View File

@ -2,7 +2,7 @@ error[E0116]: cannot define inherent `impl` for a type outside of the crate wher
--> $DIR/E0116.rs:1:1
|
LL | impl Vec<u8> {}
| ^^^^^^^^^^^^ impl for type defined outside of crate.
| ^^^^^^^^^^^^ impl for type defined outside of crate
|
= note: define and implement a trait or new type instead

View File

@ -1,4 +1,4 @@
error[E0519]: the current crate is indistinguishable from one of its dependencies: it has the same crate-name `crateresolve1` and was compiled with the same `-C metadata` arguments. This will result in symbol conflicts between the two.
error[E0519]: the current crate is indistinguishable from one of its dependencies: it has the same crate-name `crateresolve1` and was compiled with the same `-C metadata` arguments, so this will result in symbol conflicts between the two
--> $DIR/E0519.rs:8:1
|
LL | extern crate crateresolve1;

View File

@ -186,7 +186,7 @@ warning: unknown lint: `x5100`
LL | #[deny(x5100)] impl S { }
| ^^^^^
warning: use of deprecated attribute `crate_id`: no longer used.
warning: use of deprecated attribute `crate_id`: no longer used
--> $DIR/issue-43106-gating-of-builtin-attrs.rs:84:1
|
LL | #![crate_id = "10"]
@ -194,7 +194,7 @@ LL | #![crate_id = "10"]
|
= note: `#[warn(deprecated)]` on by default
warning: use of deprecated attribute `no_start`: no longer used.
warning: use of deprecated attribute `no_start`: no longer used
--> $DIR/issue-43106-gating-of-builtin-attrs.rs:94:1
|
LL | #![no_start]

View File

@ -2,7 +2,7 @@ error[E0116]: cannot define inherent `impl` for a type outside of the crate wher
--> $DIR/no-attr-empty-impl.rs:4:1
|
LL | impl extern_crate::StructWithAttr {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ impl for type defined outside of crate.
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ impl for type defined outside of crate
|
= note: define and implement a trait or new type instead
@ -10,7 +10,7 @@ error[E0116]: cannot define inherent `impl` for a type outside of the crate wher
--> $DIR/no-attr-empty-impl.rs:7:1
|
LL | impl extern_crate::StructNoAttr {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ impl for type defined outside of crate.
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ impl for type defined outside of crate
|
= note: define and implement a trait or new type instead
@ -18,7 +18,7 @@ error[E0116]: cannot define inherent `impl` for a type outside of the crate wher
--> $DIR/no-attr-empty-impl.rs:10:1
|
LL | impl extern_crate::EnumWithAttr {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ impl for type defined outside of crate.
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ impl for type defined outside of crate
|
= note: define and implement a trait or new type instead
@ -26,7 +26,7 @@ error[E0116]: cannot define inherent `impl` for a type outside of the crate wher
--> $DIR/no-attr-empty-impl.rs:13:1
|
LL | impl extern_crate::EnumNoAttr {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ impl for type defined outside of crate.
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ impl for type defined outside of crate
|
= note: define and implement a trait or new type instead

View File

@ -1,4 +1,4 @@
warning: Number of conditions in decision (7) exceeds limit (6). MC/DC analysis will not count this expression.
warning: number of conditions in decision (7) exceeds limit (6), so MC/DC analysis will not count this expression
--> $DIR/mcdc-condition-limit.rs:29:8
|
LL | if a && b && c && d && e && f && g {

View File

@ -26,7 +26,7 @@ fn main() {
fn main() {
// 7 conditions is too many, so issue a diagnostic.
let [a, b, c, d, e, f, g] = <[bool; 7]>::default();
if a && b && c && d && e && f && g { //[bad]~ WARNING Number of conditions in decision
if a && b && c && d && e && f && g { //[bad]~ WARNING number of conditions in decision
core::hint::black_box("hello");
}
}

View File

@ -4,7 +4,7 @@ error: associated type `Iterator::Item` is declared without lifetime parameters,
LL | type Item = &str;
| ^
|
note: you can't create an `Iterator` that borrows each `Item` from itself, but you can instead create a new type that borrows your existing type and implement `Iterator` for that new type.
note: you can't create an `Iterator` that borrows each `Item` from itself, but you can instead create a new type that borrows your existing type and implement `Iterator` for that new type
--> $DIR/no_lending_iterators.rs:3:19
|
LL | impl Iterator for Data {

View File

@ -154,7 +154,7 @@ error: the return value of `mem::discriminant` is unspecified when called with a
LL | fn assoc_fn() { discriminant::<i32>(&123); }
| ^^^^^^^^^^^^^^^^^^^^^^^^^
|
note: the argument to `discriminant` should be a reference to an enum, but it was passed a reference to a `i32`, which is not an enum.
note: the argument to `discriminant` should be a reference to an enum, but it was passed a reference to a `i32`, which is not an enum
--> $DIR/lint-attr-everywhere-late.rs:96:41
|
LL | fn assoc_fn() { discriminant::<i32>(&123); }
@ -208,7 +208,7 @@ error: the return value of `mem::discriminant` is unspecified when called with a
LL | let _ = discriminant::<i32>(&123);
| ^^^^^^^^^^^^^^^^^^^^^^^^^
|
note: the argument to `discriminant` should be a reference to an enum, but it was passed a reference to a `i32`, which is not an enum.
note: the argument to `discriminant` should be a reference to an enum, but it was passed a reference to a `i32`, which is not an enum
--> $DIR/lint-attr-everywhere-late.rs:139:33
|
LL | let _ = discriminant::<i32>(&123);
@ -237,7 +237,7 @@ error: the return value of `mem::discriminant` is unspecified when called with a
LL | discriminant::<i32>(&123);
| ^^^^^^^^^^^^^^^^^^^^^^^^^
|
note: the argument to `discriminant` should be a reference to an enum, but it was passed a reference to a `i32`, which is not an enum.
note: the argument to `discriminant` should be a reference to an enum, but it was passed a reference to a `i32`, which is not an enum
--> $DIR/lint-attr-everywhere-late.rs:155:33
|
LL | discriminant::<i32>(&123);
@ -254,7 +254,7 @@ error: the return value of `mem::discriminant` is unspecified when called with a
LL | discriminant::<i32>(&123);
| ^^^^^^^^^^^^^^^^^^^^^^^^^
|
note: the argument to `discriminant` should be a reference to an enum, but it was passed a reference to a `i32`, which is not an enum.
note: the argument to `discriminant` should be a reference to an enum, but it was passed a reference to a `i32`, which is not an enum
--> $DIR/lint-attr-everywhere-late.rs:161:33
|
LL | discriminant::<i32>(&123);
@ -283,7 +283,7 @@ error: the return value of `mem::discriminant` is unspecified when called with a
LL | discriminant::<i32>(&123);
| ^^^^^^^^^^^^^^^^^^^^^^^^^
|
note: the argument to `discriminant` should be a reference to an enum, but it was passed a reference to a `i32`, which is not an enum.
note: the argument to `discriminant` should be a reference to an enum, but it was passed a reference to a `i32`, which is not an enum
--> $DIR/lint-attr-everywhere-late.rs:173:29
|
LL | discriminant::<i32>(&123);
@ -300,7 +300,7 @@ error: the return value of `mem::discriminant` is unspecified when called with a
LL | discriminant::<i32>(&123);
| ^^^^^^^^^^^^^^^^^^^^^^^^^
|
note: the argument to `discriminant` should be a reference to an enum, but it was passed a reference to a `i32`, which is not an enum.
note: the argument to `discriminant` should be a reference to an enum, but it was passed a reference to a `i32`, which is not an enum
--> $DIR/lint-attr-everywhere-late.rs:177:29
|
LL | discriminant::<i32>(&123);
@ -317,7 +317,7 @@ error: the return value of `mem::discriminant` is unspecified when called with a
LL | discriminant::<i32>(&123);
| ^^^^^^^^^^^^^^^^^^^^^^^^^
|
note: the argument to `discriminant` should be a reference to an enum, but it was passed a reference to a `i32`, which is not an enum.
note: the argument to `discriminant` should be a reference to an enum, but it was passed a reference to a `i32`, which is not an enum
--> $DIR/lint-attr-everywhere-late.rs:182:25
|
LL | discriminant::<i32>(&123);
@ -334,7 +334,7 @@ error: the return value of `mem::discriminant` is unspecified when called with a
LL | [#[deny(enum_intrinsics_non_enums)] discriminant::<i32>(&123)];
| ^^^^^^^^^^^^^^^^^^^^^^^^^
|
note: the argument to `discriminant` should be a reference to an enum, but it was passed a reference to a `i32`, which is not an enum.
note: the argument to `discriminant` should be a reference to an enum, but it was passed a reference to a `i32`, which is not an enum
--> $DIR/lint-attr-everywhere-late.rs:184:61
|
LL | [#[deny(enum_intrinsics_non_enums)] discriminant::<i32>(&123)];
@ -351,7 +351,7 @@ error: the return value of `mem::discriminant` is unspecified when called with a
LL | (#[deny(enum_intrinsics_non_enums)] discriminant::<i32>(&123),);
| ^^^^^^^^^^^^^^^^^^^^^^^^^
|
note: the argument to `discriminant` should be a reference to an enum, but it was passed a reference to a `i32`, which is not an enum.
note: the argument to `discriminant` should be a reference to an enum, but it was passed a reference to a `i32`, which is not an enum
--> $DIR/lint-attr-everywhere-late.rs:185:61
|
LL | (#[deny(enum_intrinsics_non_enums)] discriminant::<i32>(&123),);
@ -368,7 +368,7 @@ error: the return value of `mem::discriminant` is unspecified when called with a
LL | call(#[deny(enum_intrinsics_non_enums)] discriminant::<i32>(&123));
| ^^^^^^^^^^^^^^^^^^^^^^^^^
|
note: the argument to `discriminant` should be a reference to an enum, but it was passed a reference to a `i32`, which is not an enum.
note: the argument to `discriminant` should be a reference to an enum, but it was passed a reference to a `i32`, which is not an enum
--> $DIR/lint-attr-everywhere-late.rs:187:65
|
LL | call(#[deny(enum_intrinsics_non_enums)] discriminant::<i32>(&123));
@ -385,7 +385,7 @@ error: the return value of `mem::discriminant` is unspecified when called with a
LL | TupleStruct(#[deny(enum_intrinsics_non_enums)] discriminant::<i32>(&123));
| ^^^^^^^^^^^^^^^^^^^^^^^^^
|
note: the argument to `discriminant` should be a reference to an enum, but it was passed a reference to a `i32`, which is not an enum.
note: the argument to `discriminant` should be a reference to an enum, but it was passed a reference to a `i32`, which is not an enum
--> $DIR/lint-attr-everywhere-late.rs:189:72
|
LL | TupleStruct(#[deny(enum_intrinsics_non_enums)] discriminant::<i32>(&123));

View File

@ -4,7 +4,7 @@ error: the return value of `mem::discriminant` is unspecified when called with a
LL | discriminant(&());
| ^^^^^^^^^^^^^^^^^
|
note: the argument to `discriminant` should be a reference to an enum, but it was passed a reference to a `()`, which is not an enum.
note: the argument to `discriminant` should be a reference to an enum, but it was passed a reference to a `()`, which is not an enum
--> $DIR/lint-enum-intrinsics-non-enums.rs:26:18
|
LL | discriminant(&());
@ -17,7 +17,7 @@ error: the return value of `mem::discriminant` is unspecified when called with a
LL | discriminant(&&SomeEnum::B);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
note: the argument to `discriminant` should be a reference to an enum, but it was passed a reference to a `&SomeEnum`, which is not an enum.
note: the argument to `discriminant` should be a reference to an enum, but it was passed a reference to a `&SomeEnum`, which is not an enum
--> $DIR/lint-enum-intrinsics-non-enums.rs:29:18
|
LL | discriminant(&&SomeEnum::B);
@ -29,7 +29,7 @@ error: the return value of `mem::discriminant` is unspecified when called with a
LL | discriminant(&SomeStruct);
| ^^^^^^^^^^^^^^^^^^^^^^^^^
|
note: the argument to `discriminant` should be a reference to an enum, but it was passed a reference to a `SomeStruct`, which is not an enum.
note: the argument to `discriminant` should be a reference to an enum, but it was passed a reference to a `SomeStruct`, which is not an enum
--> $DIR/lint-enum-intrinsics-non-enums.rs:32:18
|
LL | discriminant(&SomeStruct);
@ -41,7 +41,7 @@ error: the return value of `mem::discriminant` is unspecified when called with a
LL | discriminant(&123u32);
| ^^^^^^^^^^^^^^^^^^^^^
|
note: the argument to `discriminant` should be a reference to an enum, but it was passed a reference to a `u32`, which is not an enum.
note: the argument to `discriminant` should be a reference to an enum, but it was passed a reference to a `u32`, which is not an enum
--> $DIR/lint-enum-intrinsics-non-enums.rs:35:18
|
LL | discriminant(&123u32);
@ -53,7 +53,7 @@ error: the return value of `mem::discriminant` is unspecified when called with a
LL | discriminant(&&123i8);
| ^^^^^^^^^^^^^^^^^^^^^
|
note: the argument to `discriminant` should be a reference to an enum, but it was passed a reference to a `&i8`, which is not an enum.
note: the argument to `discriminant` should be a reference to an enum, but it was passed a reference to a `&i8`, which is not an enum
--> $DIR/lint-enum-intrinsics-non-enums.rs:38:18
|
LL | discriminant(&&123i8);
@ -65,7 +65,7 @@ error: the return value of `mem::variant_count` is unspecified when called with
LL | variant_count::<&str>();
| ^^^^^^^^^^^^^^^^^^^^^^^
|
= note: the type parameter of `variant_count` should be an enum, but it was instantiated with the type `&str`, which is not an enum.
= note: the type parameter of `variant_count` should be an enum, but it was instantiated with the type `&str`, which is not an enum
error: the return value of `mem::variant_count` is unspecified when called with a non-enum type
--> $DIR/lint-enum-intrinsics-non-enums.rs:49:5
@ -73,7 +73,7 @@ error: the return value of `mem::variant_count` is unspecified when called with
LL | variant_count::<*const u8>();
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: the type parameter of `variant_count` should be an enum, but it was instantiated with the type `*const u8`, which is not an enum.
= note: the type parameter of `variant_count` should be an enum, but it was instantiated with the type `*const u8`, which is not an enum
error: the return value of `mem::variant_count` is unspecified when called with a non-enum type
--> $DIR/lint-enum-intrinsics-non-enums.rs:52:5
@ -81,7 +81,7 @@ error: the return value of `mem::variant_count` is unspecified when called with
LL | variant_count::<()>();
| ^^^^^^^^^^^^^^^^^^^^^
|
= note: the type parameter of `variant_count` should be an enum, but it was instantiated with the type `()`, which is not an enum.
= note: the type parameter of `variant_count` should be an enum, but it was instantiated with the type `()`, which is not an enum
error: the return value of `mem::variant_count` is unspecified when called with a non-enum type
--> $DIR/lint-enum-intrinsics-non-enums.rs:55:5
@ -89,7 +89,7 @@ error: the return value of `mem::variant_count` is unspecified when called with
LL | variant_count::<&SomeEnum>();
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: the type parameter of `variant_count` should be an enum, but it was instantiated with the type `&SomeEnum`, which is not an enum.
= note: the type parameter of `variant_count` should be an enum, but it was instantiated with the type `&SomeEnum`, which is not an enum
error: aborting due to 9 previous errors

View File

@ -4,7 +4,7 @@ warning: unnecessary associated type bound for not object safe associated type
LL | fn foo(_: &dyn Foo<Bar = ()>) {}
| ^^^^^^^^ help: remove this bound
|
= note: this associated type has a `where Self: Sized` bound. Thus, while the associated type can be specified, it cannot be used in any way, because trait objects are not `Sized`.
= note: this associated type has a `where Self: Sized` bound, and while the associated type can be specified, it cannot be used because trait objects are never `Sized`
= note: `#[warn(unused_associated_type_bounds)]` on by default
warning: 1 warning emitted

View File

@ -4,7 +4,7 @@ error[E0703]: invalid ABI: found `invalid-ab_isize`
LL | "invalid-ab_isize"
| ^^^^^^^^^^^^^^^^^^ invalid ABI
|
= note: invoke `rustc --print=calling-conventions` for a full list of supported calling conventions.
= note: invoke `rustc --print=calling-conventions` for a full list of supported calling conventions
error: aborting due to 1 previous error

View File

@ -7,7 +7,7 @@ LL | extern "cdedl" fn cdedl() {}
| invalid ABI
| help: did you mean: `"cdecl"`
|
= note: invoke `rustc --print=calling-conventions` for a full list of supported calling conventions.
= note: invoke `rustc --print=calling-conventions` for a full list of supported calling conventions
error: aborting due to 1 previous error

View File

@ -1,14 +1,14 @@
error: duplicate diagnostic item in crate `p2`: `Foo`.
error: duplicate diagnostic item in crate `p2`: `Foo`
|
= note: the diagnostic item is first defined in crate `p1`.
= note: the diagnostic item is first defined in crate `p1`
error: duplicate diagnostic item in crate `duplicate_diagnostic`: `Foo`.
error: duplicate diagnostic item in crate `duplicate_diagnostic`: `Foo`
--> $DIR/duplicate-diagnostic.rs:12:1
|
LL | pub struct Foo {}
| ^^^^^^^^^^^^^^
|
= note: the diagnostic item is first defined in crate `p2`.
= note: the diagnostic item is first defined in crate `p2`
error: aborting due to 2 previous errors

View File

@ -2,7 +2,7 @@ error[E0116]: cannot define inherent `impl` for a type outside of the crate wher
--> $DIR/trait-or-new-type-instead.rs:1:1
|
LL | impl<T> Option<T> {
| ^^^^^^^^^^^^^^^^^ impl for type defined outside of crate.
| ^^^^^^^^^^^^^^^^^ impl for type defined outside of crate
|
= note: define and implement a trait or new type instead