Skip to content

Rollup of 7 pull requests #120290

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 21 commits into from
Closed
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
b152de2
coverage: Discard code regions that might cause fatal errors in `llvm…
Zalathar Jan 5, 2024
46652dd
llvm: simplify data layout check
davidtwco Jan 17, 2024
c7a77b2
Split assembly tests for ELF and MachO
nikic Jan 19, 2024
c852e3d
Switch `NonZero` alias direction.
reitermarkus Jan 20, 2024
3b9022a
Add `NonZero` symbol.
reitermarkus Jan 20, 2024
87b1d27
Fix `NonZero` clippy lints.
reitermarkus May 12, 2023
4700207
Fix `NonZero` suggestions.
reitermarkus Jan 20, 2024
bd1b265
Update tests.
reitermarkus Jan 20, 2024
41dcba8
coverage: Don't instrument `#[automatically_derived]` functions
Zalathar Jan 21, 2024
21e5bea
Use debug_assert instead of expanded equivalent
wesleywiser Jan 22, 2024
823e8b0
Allow disjoint flag in codegen test
nikic Jan 22, 2024
31f5f03
Remove uses of no-system-llvm
nikic Jan 23, 2024
f4f589a
Remove support for no-system-llvm
nikic Jan 23, 2024
9676e18
Remove extra # from url
est31 Jan 23, 2024
00736d2
Rollup merge of #119460 - Zalathar:improper-region, r=wesleywiser
fmease Jan 24, 2024
6d95bdf
Rollup merge of #120062 - davidtwco:llvm-data-layout-check, r=wesleyw…
fmease Jan 24, 2024
7f80c2a
Rollup merge of #120124 - nikic:fix-assembly-test, r=davidtwco
fmease Jan 24, 2024
f164fc5
Rollup merge of #120165 - reitermarkus:nonzero-switch-alias-direction…
fmease Jan 24, 2024
1443be0
Rollup merge of #120185 - Zalathar:auto-derived, r=wesleywiser
fmease Jan 24, 2024
0fcd5a1
Rollup merge of #120265 - nikic:no-no-system-llvm, r=nagisa
fmease Jan 24, 2024
1c10029
Rollup merge of #120285 - est31:remove_extra_pound, r=fmease
fmease Jan 24, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions compiler/rustc_codegen_llvm/messages.ftl
Original file line number Diff line number Diff line change
@@ -39,6 +39,9 @@ codegen_llvm_lto_dylib = lto cannot be used for `dylib` crate type without `-Zdy
codegen_llvm_lto_proc_macro = lto cannot be used for `proc-macro` crate type without `-Zdylib-lto`
codegen_llvm_mismatch_data_layout =
data-layout for target `{$rustc_target}`, `{$rustc_layout}`, differs from LLVM target's `{$llvm_target}` default layout, `{$llvm_layout}`
codegen_llvm_missing_features =
add the missing features in a `target_feature` attribute
38 changes: 9 additions & 29 deletions compiler/rustc_codegen_llvm/src/context.rs
Original file line number Diff line number Diff line change
@@ -34,6 +34,7 @@ use rustc_target::spec::{HasTargetSpec, RelocModel, Target, TlsModel};
use smallvec::SmallVec;

use libc::c_uint;
use std::borrow::Borrow;
use std::cell::{Cell, RefCell};
use std::ffi::CStr;
use std::str;
@@ -155,42 +156,21 @@ pub unsafe fn create_module<'ll>(
}

// Ensure the data-layout values hardcoded remain the defaults.
if sess.target.is_builtin {
// tm is disposed by its drop impl
{
let tm = crate::back::write::create_informational_target_machine(tcx.sess);
llvm::LLVMRustSetDataLayoutFromTargetMachine(llmod, &tm);

let llvm_data_layout = llvm::LLVMGetDataLayoutStr(llmod);
let llvm_data_layout = str::from_utf8(CStr::from_ptr(llvm_data_layout).to_bytes())
.expect("got a non-UTF8 data-layout from LLVM");

// Unfortunately LLVM target specs change over time, and right now we
// don't have proper support to work with any more than one
// `data_layout` than the one that is in the rust-lang/rust repo. If
// this compiler is configured against a custom LLVM, we may have a
// differing data layout, even though we should update our own to use
// that one.
//
// As an interim hack, if CFG_LLVM_ROOT is not an empty string then we
// disable this check entirely as we may be configured with something
// that has a different target layout.
//
// Unsure if this will actually cause breakage when rustc is configured
// as such.
//
// FIXME(#34960)
let cfg_llvm_root = option_env!("CFG_LLVM_ROOT").unwrap_or("");
let custom_llvm_used = !cfg_llvm_root.trim().is_empty();

if !custom_llvm_used && target_data_layout != llvm_data_layout {
bug!(
"data-layout for target `{rustc_target}`, `{rustc_layout}`, \
differs from LLVM target's `{llvm_target}` default layout, `{llvm_layout}`",
rustc_target = sess.opts.target_triple,
rustc_layout = target_data_layout,
llvm_target = sess.target.llvm_target,
llvm_layout = llvm_data_layout
);
if target_data_layout != llvm_data_layout {
tcx.dcx().emit_err(crate::errors::MismatchedDataLayout {
rustc_target: sess.opts.target_triple.to_string().as_str(),
rustc_layout: target_data_layout.as_str(),
llvm_target: sess.target.llvm_target.borrow(),
llvm_layout: llvm_data_layout,
});
}
}

9 changes: 9 additions & 0 deletions compiler/rustc_codegen_llvm/src/errors.rs
Original file line number Diff line number Diff line change
@@ -244,3 +244,12 @@ pub(crate) struct CopyBitcode {
pub struct UnknownCompression {
pub algorithm: &'static str,
}

#[derive(Diagnostic)]
#[diag(codegen_llvm_mismatch_data_layout)]
pub struct MismatchedDataLayout<'a> {
pub rustc_target: &'a str,
pub rustc_layout: &'a str,
pub llvm_target: &'a str,
pub llvm_layout: &'a str,
}
54 changes: 29 additions & 25 deletions compiler/rustc_hir_typeck/src/fn_ctxt/suggestions.rs
Original file line number Diff line number Diff line change
@@ -2140,46 +2140,50 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
expr_ty: Ty<'tcx>,
) -> bool {
let tcx = self.tcx;
let (adt, unwrap) = match expected.kind() {
let (adt, substs, unwrap) = match expected.kind() {
// In case Option<NonZero*> is wanted, but * is provided, suggest calling new
ty::Adt(adt, args) if tcx.is_diagnostic_item(sym::Option, adt.did()) => {
// Unwrap option
let ty::Adt(adt, _) = args.type_at(0).kind() else {
ty::Adt(adt, substs) if tcx.is_diagnostic_item(sym::Option, adt.did()) => {
let nonzero_type = substs.type_at(0); // Unwrap option type.
let ty::Adt(adt, substs) = nonzero_type.kind() else {
return false;
};

(adt, "")
(adt, substs, "")
}
// In case NonZero* is wanted, but * is provided also add `.unwrap()` to satisfy types
ty::Adt(adt, _) => (adt, ".unwrap()"),
// In case `NonZero<*>` is wanted but `*` is provided, also add `.unwrap()` to satisfy types.
ty::Adt(adt, substs) => (adt, substs, ".unwrap()"),
_ => return false,
};

let map = [
(sym::NonZeroU8, tcx.types.u8),
(sym::NonZeroU16, tcx.types.u16),
(sym::NonZeroU32, tcx.types.u32),
(sym::NonZeroU64, tcx.types.u64),
(sym::NonZeroU128, tcx.types.u128),
(sym::NonZeroI8, tcx.types.i8),
(sym::NonZeroI16, tcx.types.i16),
(sym::NonZeroI32, tcx.types.i32),
(sym::NonZeroI64, tcx.types.i64),
(sym::NonZeroI128, tcx.types.i128),
if !self.tcx.is_diagnostic_item(sym::NonZero, adt.did()) {
return false;
}

// FIXME: This can be simplified once `NonZero<T>` is stable.
let coercable_types = [
("NonZeroU8", tcx.types.u8),
("NonZeroU16", tcx.types.u16),
("NonZeroU32", tcx.types.u32),
("NonZeroU64", tcx.types.u64),
("NonZeroU128", tcx.types.u128),
("NonZeroI8", tcx.types.i8),
("NonZeroI16", tcx.types.i16),
("NonZeroI32", tcx.types.i32),
("NonZeroI64", tcx.types.i64),
("NonZeroI128", tcx.types.i128),
];

let Some((s, _)) = map.iter().find(|&&(s, t)| {
self.tcx.is_diagnostic_item(s, adt.did()) && self.can_coerce(expr_ty, t)
let int_type = substs.type_at(0);

let Some(nonzero_alias) = coercable_types.iter().find_map(|(nonzero_alias, t)| {
if *t == int_type && self.can_coerce(expr_ty, *t) { Some(nonzero_alias) } else { None }
}) else {
return false;
};

let path = self.tcx.def_path_str(adt.non_enum_variant().def_id);

err.multipart_suggestion(
format!("consider calling `{s}::new`"),
format!("consider calling `{nonzero_alias}::new`"),
vec![
(expr.span.shrink_to_lo(), format!("{path}::new(")),
(expr.span.shrink_to_lo(), format!("{nonzero_alias}::new(")),
(expr.span.shrink_to_hi(), format!("){unwrap}")),
],
Applicability::MaybeIncorrect,
46 changes: 45 additions & 1 deletion compiler/rustc_mir_transform/src/coverage/mod.rs
Original file line number Diff line number Diff line change
@@ -329,7 +329,7 @@ fn make_code_region(
start_line = source_map.doctest_offset_line(&file.name, start_line);
end_line = source_map.doctest_offset_line(&file.name, end_line);

Some(CodeRegion {
check_code_region(CodeRegion {
file_name,
start_line: start_line as u32,
start_col: start_col as u32,
@@ -338,6 +338,39 @@ fn make_code_region(
})
}

/// If `llvm-cov` sees a code region that is improperly ordered (end < start),
/// it will immediately exit with a fatal error. To prevent that from happening,
/// discard regions that are improperly ordered, or might be interpreted in a
/// way that makes them improperly ordered.
fn check_code_region(code_region: CodeRegion) -> Option<CodeRegion> {
let CodeRegion { file_name: _, start_line, start_col, end_line, end_col } = code_region;

// Line/column coordinates are supposed to be 1-based. If we ever emit
// coordinates of 0, `llvm-cov` might misinterpret them.
let all_nonzero = [start_line, start_col, end_line, end_col].into_iter().all(|x| x != 0);
// Coverage mappings use the high bit of `end_col` to indicate that a
// region is actually a "gap" region, so make sure it's unset.
let end_col_has_high_bit_unset = (end_col & (1 << 31)) == 0;
// If a region is improperly ordered (end < start), `llvm-cov` will exit
// with a fatal error, which is inconvenient for users and hard to debug.
let is_ordered = (start_line, start_col) <= (end_line, end_col);

if all_nonzero && end_col_has_high_bit_unset && is_ordered {
Some(code_region)
} else {
debug!(
?code_region,
?all_nonzero,
?end_col_has_high_bit_unset,
?is_ordered,
"Skipping code region that would be misinterpreted or rejected by LLVM"
);
// If this happens in a debug build, ICE to make it easier to notice.
debug_assert!(false, "Improper code region: {code_region:?}");
None
}
}

fn is_eligible_for_coverage(tcx: TyCtxt<'_>, def_id: LocalDefId) -> bool {
// Only instrument functions, methods, and closures (not constants since they are evaluated
// at compile time by Miri).
@@ -351,7 +384,18 @@ fn is_eligible_for_coverage(tcx: TyCtxt<'_>, def_id: LocalDefId) -> bool {
return false;
}

// Don't instrument functions with `#[automatically_derived]` on their
// enclosing impl block, on the assumption that most users won't care about
// coverage for derived impls.
if let Some(impl_of) = tcx.impl_of_method(def_id.to_def_id())
&& tcx.is_automatically_derived(impl_of)
{
trace!("InstrumentCoverage skipped for {def_id:?} (automatically derived)");
return false;
}

if tcx.codegen_fn_attrs(def_id).flags.contains(CodegenFnAttrFlags::NO_COVERAGE) {
trace!("InstrumentCoverage skipped for {def_id:?} (`#[coverage(off)]`)");
return false;
}

12 changes: 1 addition & 11 deletions compiler/rustc_span/src/symbol.rs
Original file line number Diff line number Diff line change
@@ -246,17 +246,7 @@ symbols! {
MutexGuard,
N,
NonNull,
NonZeroI128,
NonZeroI16,
NonZeroI32,
NonZeroI64,
NonZeroI8,
NonZeroU128,
NonZeroU16,
NonZeroU32,
NonZeroU64,
NonZeroU8,
NonZeroUsize,
NonZero,
None,
Normal,
Ok,
Original file line number Diff line number Diff line change
@@ -3155,7 +3155,7 @@ impl<'tcx> TypeErrCtxtExt<'tcx> for TypeErrCtxt<'_, 'tcx> {
} else {
// FIXME: we may suggest array::repeat instead
err.help("consider using `core::array::from_fn` to initialize the array");
err.help("see https://doc.rust-lang.org/stable/std/array/fn.from_fn.html# for more information");
err.help("see https://doc.rust-lang.org/stable/std/array/fn.from_fn.html for more information");
}

if self.tcx.sess.is_nightly_build()
10 changes: 9 additions & 1 deletion library/core/src/num/mod.rs
Original file line number Diff line number Diff line change
@@ -61,7 +61,15 @@ pub use dec2flt::ParseFloatError;
#[stable(feature = "rust1", since = "1.0.0")]
pub use error::ParseIntError;

pub(crate) use nonzero::NonZero;
#[unstable(
feature = "nonzero_internals",
reason = "implementation detail which may disappear or be replaced at any time",
issue = "none"
)]
pub use nonzero::ZeroablePrimitive;

#[unstable(feature = "generic_nonzero", issue = "82363")]
pub use nonzero::NonZero;

#[stable(feature = "nonzero", since = "1.28.0")]
pub use nonzero::{NonZeroU128, NonZeroU16, NonZeroU32, NonZeroU64, NonZeroU8, NonZeroUsize};
49 changes: 30 additions & 19 deletions library/core/src/num/nonzero.rs
Original file line number Diff line number Diff line change
@@ -3,7 +3,7 @@
use crate::cmp::Ordering;
use crate::fmt;
use crate::hash::{Hash, Hasher};
use crate::marker::StructuralPartialEq;
use crate::marker::{StructuralEq, StructuralPartialEq};
use crate::ops::{BitOr, BitOrAssign, Div, Neg, Rem};
use crate::str::FromStr;

@@ -30,9 +30,7 @@ mod private {
issue = "none"
)]
#[const_trait]
pub trait ZeroablePrimitive: Sized + Copy + private::Sealed {
type NonZero;
}
pub trait ZeroablePrimitive: Sized + Copy + private::Sealed {}

macro_rules! impl_zeroable_primitive {
($NonZero:ident ( $primitive:ty )) => {
@@ -48,9 +46,7 @@ macro_rules! impl_zeroable_primitive {
reason = "implementation detail which may disappear or be replaced at any time",
issue = "none"
)]
impl const ZeroablePrimitive for $primitive {
type NonZero = $NonZero;
}
impl const ZeroablePrimitive for $primitive {}
};
}

@@ -67,12 +63,23 @@ impl_zeroable_primitive!(NonZeroI64(i64));
impl_zeroable_primitive!(NonZeroI128(i128));
impl_zeroable_primitive!(NonZeroIsize(isize));

#[unstable(
feature = "nonzero_internals",
reason = "implementation detail which may disappear or be replaced at any time",
issue = "none"
)]
pub(crate) type NonZero<T> = <T as ZeroablePrimitive>::NonZero;
/// A value that is known not to equal zero.
///
/// This enables some memory layout optimization.
/// For example, `Option<NonZero<u32>>` is the same size as `u32`:
///
/// ```
/// #![feature(generic_nonzero)]
/// use core::mem::size_of;
///
/// assert_eq!(size_of::<Option<core::num::NonZero<u32>>>(), size_of::<u32>());
/// ```
#[unstable(feature = "generic_nonzero", issue = "82363")]
#[repr(transparent)]
#[rustc_layout_scalar_valid_range_start(1)]
#[rustc_nonnull_optimization_guaranteed]
#[rustc_diagnostic_item = "NonZero"]
pub struct NonZero<T: ZeroablePrimitive>(T);

macro_rules! impl_nonzero_fmt {
( #[$stability: meta] ( $( $Trait: ident ),+ ) for $Ty: ident ) => {
@@ -131,12 +138,7 @@ macro_rules! nonzero_integer {
///
/// [null pointer optimization]: crate::option#representation
#[$stability]
#[derive(Copy, Eq)]
#[repr(transparent)]
#[rustc_layout_scalar_valid_range_start(1)]
#[rustc_nonnull_optimization_guaranteed]
#[rustc_diagnostic_item = stringify!($Ty)]
pub struct $Ty($Int);
pub type $Ty = NonZero<$Int>;

impl $Ty {
/// Creates a non-zero without checking whether the value is non-zero.
@@ -506,6 +508,9 @@ macro_rules! nonzero_integer {
}
}

#[$stability]
impl Copy for $Ty {}

#[$stability]
impl PartialEq for $Ty {
#[inline]
@@ -522,6 +527,12 @@ macro_rules! nonzero_integer {
#[unstable(feature = "structural_match", issue = "31434")]
impl StructuralPartialEq for $Ty {}

#[$stability]
impl Eq for $Ty {}

#[unstable(feature = "structural_match", issue = "31434")]
impl StructuralEq for $Ty {}

#[$stability]
impl PartialOrd for $Ty {
#[inline]
10 changes: 10 additions & 0 deletions library/std/src/num.rs
Original file line number Diff line number Diff line change
@@ -16,6 +16,16 @@ pub use core::num::Wrapping;
#[stable(feature = "rust1", since = "1.0.0")]
pub use core::num::{FpCategory, ParseFloatError, ParseIntError, TryFromIntError};

#[unstable(
feature = "nonzero_internals",
reason = "implementation detail which may disappear or be replaced at any time",
issue = "none"
)]
pub use core::num::ZeroablePrimitive;

#[unstable(feature = "generic_nonzero", issue = "82363")]
pub use core::num::NonZero;

#[stable(feature = "signed_nonzero", since = "1.34.0")]
pub use core::num::{NonZeroI128, NonZeroI16, NonZeroI32, NonZeroI64, NonZeroI8, NonZeroIsize};
#[stable(feature = "nonzero", since = "1.28.0")]
5 changes: 0 additions & 5 deletions src/bootstrap/src/core/build_steps/compile.rs
Original file line number Diff line number Diff line change
@@ -1113,16 +1113,11 @@ pub fn rustc_cargo_env(
/// Pass down configuration from the LLVM build into the build of
/// rustc_llvm and rustc_codegen_llvm.
fn rustc_llvm_env(builder: &Builder<'_>, cargo: &mut Cargo, target: TargetSelection) {
let target_config = builder.config.target_config.get(&target);

if builder.is_rust_llvm(target) {
cargo.env("LLVM_RUSTLLVM", "1");
}
let llvm::LlvmResult { llvm_config, .. } = builder.ensure(llvm::Llvm { target });
cargo.env("LLVM_CONFIG", &llvm_config);
if let Some(s) = target_config.and_then(|c| c.llvm_config.as_ref()) {
cargo.env("CFG_LLVM_ROOT", s);
}

// Some LLVM linker flags (-L and -l) may be needed to link `rustc_llvm`. Its build script
// expects these to be passed via the `LLVM_LINKER_FLAGS` env variable, separated by
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
use super::ARITHMETIC_SIDE_EFFECTS;
use clippy_utils::consts::{constant, constant_simple, Constant};
use clippy_utils::diagnostics::span_lint;
use clippy_utils::ty::type_diagnostic_name;
use clippy_utils::ty::is_type_diagnostic_item;
use clippy_utils::{expr_or_init, is_from_proc_macro, is_lint_allowed, peel_hir_expr_refs, peel_hir_expr_unary};
use rustc_data_structures::fx::{FxHashMap, FxHashSet};
use rustc_lint::{LateContext, LateLintPass};
use rustc_middle::ty::Ty;
use rustc_middle::ty::{self, Ty};
use rustc_session::impl_lint_pass;
use rustc_span::source_map::Spanned;
use rustc_span::symbol::sym;
@@ -88,37 +88,44 @@ impl ArithmeticSideEffects {
}

/// Verifies built-in types that have specific allowed operations
fn has_specific_allowed_type_and_operation(
cx: &LateContext<'_>,
lhs_ty: Ty<'_>,
fn has_specific_allowed_type_and_operation<'tcx>(
cx: &LateContext<'tcx>,
lhs_ty: Ty<'tcx>,
op: &Spanned<hir::BinOpKind>,
rhs_ty: Ty<'_>,
rhs_ty: Ty<'tcx>,
) -> bool {
let is_div_or_rem = matches!(op.node, hir::BinOpKind::Div | hir::BinOpKind::Rem);
let is_non_zero_u = |symbol: Option<Symbol>| {
matches!(
symbol,
Some(
sym::NonZeroU128
| sym::NonZeroU16
| sym::NonZeroU32
| sym::NonZeroU64
| sym::NonZeroU8
| sym::NonZeroUsize
)
)
let is_non_zero_u = |cx: &LateContext<'tcx>, ty: Ty<'tcx>| {
let tcx = cx.tcx;

let ty::Adt(adt, substs) = ty.kind() else { return false };

if !tcx.is_diagnostic_item(sym::NonZero, adt.did()) {
return false;
};

let int_type = substs.type_at(0);
let unsigned_int_types = [
tcx.types.u8,
tcx.types.u16,
tcx.types.u32,
tcx.types.u64,
tcx.types.u128,
tcx.types.usize,
];

unsigned_int_types.contains(&int_type)
};
let is_sat_or_wrap = |ty: Ty<'_>| {
let is_sat = type_diagnostic_name(cx, ty) == Some(sym::Saturating);
let is_wrap = type_diagnostic_name(cx, ty) == Some(sym::Wrapping);
is_sat || is_wrap
is_type_diagnostic_item(cx, ty, sym::Saturating) || is_type_diagnostic_item(cx, ty, sym::Wrapping)
};

// If the RHS is NonZeroU*, then division or module by zero will never occur
if is_non_zero_u(type_diagnostic_name(cx, rhs_ty)) && is_div_or_rem {
// If the RHS is `NonZero<u*>`, then division or module by zero will never occur.
if is_non_zero_u(cx, rhs_ty) && is_div_or_rem {
return true;
}
// `Saturation` and `Wrapping` can overflow if the RHS is zero in a division or module

// `Saturation` and `Wrapping` can overflow if the RHS is zero in a division or module.
if is_sat_or_wrap(lhs_ty) {
return !is_div_or_rem;
}
Original file line number Diff line number Diff line change
@@ -16,40 +16,55 @@ pub(super) fn check<'tcx>(
to_ty: Ty<'tcx>,
arg: &'tcx Expr<'_>,
) -> bool {
let (ty::Int(_) | ty::Uint(_), Some(to_ty_adt)) = (&from_ty.kind(), to_ty.ty_adt_def()) else {
let tcx = cx.tcx;

let (ty::Int(_) | ty::Uint(_), ty::Adt(adt, substs)) = (&from_ty.kind(), to_ty.kind()) else {
return false;
};
let Some(to_type_sym) = cx.tcx.get_diagnostic_name(to_ty_adt.did()) else {

if !tcx.is_diagnostic_item(sym::NonZero, adt.did()) {
return false;
};

if !matches!(
to_type_sym,
sym::NonZeroU8
| sym::NonZeroU16
| sym::NonZeroU32
| sym::NonZeroU64
| sym::NonZeroU128
| sym::NonZeroI8
| sym::NonZeroI16
| sym::NonZeroI32
| sym::NonZeroI64
| sym::NonZeroI128
) {
// FIXME: This can be simplified once `NonZero<T>` is stable.
let coercable_types = [
("NonZeroU8", tcx.types.u8),
("NonZeroU16", tcx.types.u16),
("NonZeroU32", tcx.types.u32),
("NonZeroU64", tcx.types.u64),
("NonZeroU128", tcx.types.u128),
("NonZeroUsize", tcx.types.usize),
("NonZeroI8", tcx.types.i8),
("NonZeroI16", tcx.types.i16),
("NonZeroI32", tcx.types.i32),
("NonZeroI64", tcx.types.i64),
("NonZeroI128", tcx.types.i128),
("NonZeroIsize", tcx.types.isize),
];

let int_type = substs.type_at(0);

let Some(nonzero_alias) = coercable_types.iter().find_map(|(nonzero_alias, t)| {
if *t == int_type && *t == from_ty {
Some(nonzero_alias)
} else {
None
}
}) else {
return false;
}
};

span_lint_and_then(
cx,
TRANSMUTE_INT_TO_NON_ZERO,
e.span,
&format!("transmute from a `{from_ty}` to a `{to_type_sym}`"),
&format!("transmute from a `{from_ty}` to a `{nonzero_alias}`"),
|diag| {
let arg = sugg::Sugg::hir(cx, arg, "..");
diag.span_suggestion(
e.span,
"consider using",
format!("{to_type_sym}::{}({arg})", sym::new_unchecked),
format!("{nonzero_alias}::{}({arg})", sym::new_unchecked),
Applicability::Unspecified,
);
},
3 changes: 0 additions & 3 deletions src/tools/compiletest/src/header.rs
Original file line number Diff line number Diff line change
@@ -1109,9 +1109,6 @@ fn ignore_lldb(config: &Config, line: &str) -> IgnoreDecision {
}

fn ignore_llvm(config: &Config, line: &str) -> IgnoreDecision {
if config.system_llvm && line.starts_with("no-system-llvm") {
return IgnoreDecision::Ignore { reason: "ignored when the system LLVM is used".into() };
}
if let Some(needed_components) =
config.parse_name_value_directive(line, "needs-llvm-components")
{
21 changes: 12 additions & 9 deletions src/tools/compiletest/src/header/tests.rs
Original file line number Diff line number Diff line change
@@ -242,15 +242,6 @@ fn aux_build() {
);
}

#[test]
fn no_system_llvm() {
let config: Config = cfg().system_llvm(false).build();
assert!(!check_ignore(&config, "// no-system-llvm"));

let config: Config = cfg().system_llvm(true).build();
assert!(check_ignore(&config, "// no-system-llvm"));
}

#[test]
fn llvm_version() {
let config: Config = cfg().llvm_version("8.1.2").build();
@@ -266,6 +257,18 @@ fn llvm_version() {
assert!(!check_ignore(&config, "// min-llvm-version: 9.0"));
}

#[test]
fn system_llvm_version() {
let config: Config = cfg().system_llvm(true).llvm_version("17.0.0").build();
assert!(check_ignore(&config, "// min-system-llvm-version: 18.0"));

let config: Config = cfg().system_llvm(true).llvm_version("18.0.0").build();
assert!(!check_ignore(&config, "// min-system-llvm-version: 18.0"));

let config: Config = cfg().llvm_version("17.0.0").build();
assert!(!check_ignore(&config, "// min-system-llvm-version: 18.0"));
}

#[test]
fn ignore_target() {
let config: Config = cfg().target("x86_64-unknown-linux-gnu").build();
7 changes: 4 additions & 3 deletions src/tools/tidy/src/ui_tests.rs
Original file line number Diff line number Diff line change
@@ -24,9 +24,10 @@ const EXPECTED_TEST_FILE_EXTENSIONS: &[&str] = &[

const EXTENSION_EXCEPTION_PATHS: &[&str] = &[
"tests/ui/asm/named-asm-labels.s", // loading an external asm file to test named labels lint
"tests/ui/check-cfg/my-awesome-platform.json", // testing custom targets with cfgs
"tests/ui/commandline-argfile-badutf8.args", // passing args via a file
"tests/ui/commandline-argfile.args", // passing args via a file
"tests/ui/codegen/mismatched-data-layout.json", // testing mismatched data layout w/ custom targets
"tests/ui/check-cfg/my-awesome-platform.json", // testing custom targets with cfgs
"tests/ui/commandline-argfile-badutf8.args", // passing args via a file
"tests/ui/commandline-argfile.args", // passing args via a file
"tests/ui/crate-loading/auxiliary/libfoo.rlib", // testing loading a manually created rlib
"tests/ui/include-macros/data.bin", // testing including data with the include macros
"tests/ui/include-macros/file.txt", // testing including data with the include macros
65 changes: 1 addition & 64 deletions tests/assembly/targets/targets-elf.rs
Original file line number Diff line number Diff line change
@@ -1,29 +1,5 @@
// assembly-output: emit-asm
// ignore-tidy-linelength
// revisions: aarch64_apple_darwin
// [aarch64_apple_darwin] compile-flags: --target aarch64-apple-darwin
// [aarch64_apple_darwin] needs-llvm-components: aarch64
// revisions: aarch64_apple_ios
// [aarch64_apple_ios] compile-flags: --target aarch64-apple-ios
// [aarch64_apple_ios] needs-llvm-components: aarch64
// revisions: aarch64_apple_ios_macabi
// [aarch64_apple_ios_macabi] compile-flags: --target aarch64-apple-ios-macabi
// [aarch64_apple_ios_macabi] needs-llvm-components: aarch64
// revisions: aarch64_apple_ios_sim
// [aarch64_apple_ios_sim] compile-flags: --target aarch64-apple-ios-sim
// [aarch64_apple_ios_sim] needs-llvm-components: aarch64
// revisions: aarch64_apple_tvos
// [aarch64_apple_tvos] compile-flags: --target aarch64-apple-tvos
// [aarch64_apple_tvos] needs-llvm-components: aarch64
// revisions: aarch64_apple_tvos_sim
// [aarch64_apple_tvos_sim] compile-flags: --target aarch64-apple-tvos-sim
// [aarch64_apple_tvos_sim] needs-llvm-components: aarch64
// revisions: aarch64_apple_watchos
// [aarch64_apple_watchos] compile-flags: --target aarch64-apple-watchos
// [aarch64_apple_watchos] needs-llvm-components: aarch64
// revisions: aarch64_apple_watchos_sim
// [aarch64_apple_watchos_sim] compile-flags: --target aarch64-apple-watchos-sim
// [aarch64_apple_watchos_sim] needs-llvm-components: aarch64
// revisions: aarch64_be_unknown_linux_gnu
// [aarch64_be_unknown_linux_gnu] compile-flags: --target aarch64_be-unknown-linux-gnu
// [aarch64_be_unknown_linux_gnu] needs-llvm-components: aarch64
@@ -93,15 +69,6 @@
// revisions: aarch64_wrs_vxworks
// [aarch64_wrs_vxworks] compile-flags: --target aarch64-wrs-vxworks
// [aarch64_wrs_vxworks] needs-llvm-components: aarch64
// revisions: arm64_32_apple_watchos
// [arm64_32_apple_watchos] compile-flags: --target arm64_32-apple-watchos
// [arm64_32_apple_watchos] needs-llvm-components: aarch64
// revisions: arm64e_apple_darwin
// [arm64e_apple_darwin] compile-flags: --target arm64e-apple-darwin
// [arm64e_apple_darwin] needs-llvm-components: aarch64
// revisions: arm64e_apple_ios
// [arm64e_apple_ios] compile-flags: --target arm64e-apple-ios
// [arm64e_apple_ios] needs-llvm-components: aarch64
// revisions: arm_linux_androideabi
// [arm_linux_androideabi] compile-flags: --target arm-linux-androideabi
// [arm_linux_androideabi] needs-llvm-components: arm
@@ -201,18 +168,12 @@
// revisions: armv7a_none_eabihf
// [armv7a_none_eabihf] compile-flags: --target armv7a-none-eabihf
// [armv7a_none_eabihf] needs-llvm-components: arm
// revisions: armv7k_apple_watchos
// [armv7k_apple_watchos] compile-flags: --target armv7k-apple-watchos
// [armv7k_apple_watchos] needs-llvm-components: arm
// revisions: armv7r_none_eabi
// [armv7r_none_eabi] compile-flags: --target armv7r-none-eabi
// [armv7r_none_eabi] needs-llvm-components: arm
// revisions: armv7r_none_eabihf
// [armv7r_none_eabihf] compile-flags: --target armv7r-none-eabihf
// [armv7r_none_eabihf] needs-llvm-components: arm
// revisions: armv7s_apple_ios
// [armv7s_apple_ios] compile-flags: --target armv7s-apple-ios
// [armv7s_apple_ios] needs-llvm-components: arm
// FIXME: disabled since it fails on CI saying the csky component is missing
/*
revisions: csky_unknown_linux_gnuabiv2
@@ -228,9 +189,6 @@
// revisions: hexagon_unknown_none_elf
// [hexagon_unknown_none_elf] compile-flags: --target hexagon-unknown-none-elf
// [hexagon_unknown_none_elf] needs-llvm-components: hexagon
// revisions: i386_apple_ios
// [i386_apple_ios] compile-flags: --target i386-apple-ios
// [i386_apple_ios] needs-llvm-components: x86
// revisions: i586_pc_nto_qnx700
// [i586_pc_nto_qnx700] compile-flags: --target i586-pc-nto-qnx700
// [i586_pc_nto_qnx700] needs-llvm-components: x86
@@ -243,9 +201,6 @@
// revisions: i586_unknown_netbsd
// [i586_unknown_netbsd] compile-flags: --target i586-unknown-netbsd
// [i586_unknown_netbsd] needs-llvm-components: x86
// revisions: i686_apple_darwin
// [i686_apple_darwin] compile-flags: --target i686-apple-darwin
// [i686_apple_darwin] needs-llvm-components: x86
// revisions: i686_linux_android
// [i686_linux_android] compile-flags: --target i686-linux-android
// [i686_linux_android] needs-llvm-components: x86
@@ -534,21 +489,6 @@
// revisions: wasm64_unknown_unknown
// [wasm64_unknown_unknown] compile-flags: --target wasm64-unknown-unknown
// [wasm64_unknown_unknown] needs-llvm-components: webassembly
// revisions: x86_64_apple_darwin
// [x86_64_apple_darwin] compile-flags: --target x86_64-apple-darwin
// [x86_64_apple_darwin] needs-llvm-components: x86
// revisions: x86_64_apple_ios
// [x86_64_apple_ios] compile-flags: --target x86_64-apple-ios
// [x86_64_apple_ios] needs-llvm-components: x86
// revisions: x86_64_apple_ios_macabi
// [x86_64_apple_ios_macabi] compile-flags: --target x86_64-apple-ios-macabi
// [x86_64_apple_ios_macabi] needs-llvm-components: x86
// revisions: x86_64_apple_tvos
// [x86_64_apple_tvos] compile-flags: --target x86_64-apple-tvos
// [x86_64_apple_tvos] needs-llvm-components: x86
// revisions: x86_64_apple_watchos_sim
// [x86_64_apple_watchos_sim] compile-flags: --target x86_64-apple-watchos-sim
// [x86_64_apple_watchos_sim] needs-llvm-components: x86
// revisions: x86_64_fortanix_unknown_sgx
// [x86_64_fortanix_unknown_sgx] compile-flags: --target x86_64-fortanix-unknown-sgx
// [x86_64_fortanix_unknown_sgx] needs-llvm-components: x86
@@ -615,9 +555,6 @@
// revisions: x86_64_wrs_vxworks
// [x86_64_wrs_vxworks] compile-flags: --target x86_64-wrs-vxworks
// [x86_64_wrs_vxworks] needs-llvm-components: x86
// revisions: x86_64h_apple_darwin
// [x86_64h_apple_darwin] compile-flags: --target x86_64h-apple-darwin
// [x86_64h_apple_darwin] needs-llvm-components: x86

// Sanity-check that each target can produce assembly code.

@@ -633,4 +570,4 @@ pub fn test() -> u8 {
42
}

// CHECK: .section
// CHECK: .text
81 changes: 81 additions & 0 deletions tests/assembly/targets/targets-macho.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
// assembly-output: emit-asm
// ignore-tidy-linelength
// revisions: aarch64_apple_darwin
// [aarch64_apple_darwin] compile-flags: --target aarch64-apple-darwin
// [aarch64_apple_darwin] needs-llvm-components: aarch64
// revisions: aarch64_apple_ios
// [aarch64_apple_ios] compile-flags: --target aarch64-apple-ios
// [aarch64_apple_ios] needs-llvm-components: aarch64
// revisions: aarch64_apple_ios_macabi
// [aarch64_apple_ios_macabi] compile-flags: --target aarch64-apple-ios-macabi
// [aarch64_apple_ios_macabi] needs-llvm-components: aarch64
// revisions: aarch64_apple_ios_sim
// [aarch64_apple_ios_sim] compile-flags: --target aarch64-apple-ios-sim
// [aarch64_apple_ios_sim] needs-llvm-components: aarch64
// revisions: aarch64_apple_tvos
// [aarch64_apple_tvos] compile-flags: --target aarch64-apple-tvos
// [aarch64_apple_tvos] needs-llvm-components: aarch64
// revisions: aarch64_apple_tvos_sim
// [aarch64_apple_tvos_sim] compile-flags: --target aarch64-apple-tvos-sim
// [aarch64_apple_tvos_sim] needs-llvm-components: aarch64
// revisions: aarch64_apple_watchos
// [aarch64_apple_watchos] compile-flags: --target aarch64-apple-watchos
// [aarch64_apple_watchos] needs-llvm-components: aarch64
// revisions: aarch64_apple_watchos_sim
// [aarch64_apple_watchos_sim] compile-flags: --target aarch64-apple-watchos-sim
// [aarch64_apple_watchos_sim] needs-llvm-components: aarch64
// revisions: arm64_32_apple_watchos
// [arm64_32_apple_watchos] compile-flags: --target arm64_32-apple-watchos
// [arm64_32_apple_watchos] needs-llvm-components: aarch64
// revisions: arm64e_apple_darwin
// [arm64e_apple_darwin] compile-flags: --target arm64e-apple-darwin
// [arm64e_apple_darwin] needs-llvm-components: aarch64
// revisions: arm64e_apple_ios
// [arm64e_apple_ios] compile-flags: --target arm64e-apple-ios
// [arm64e_apple_ios] needs-llvm-components: aarch64
// revisions: armv7k_apple_watchos
// [armv7k_apple_watchos] compile-flags: --target armv7k-apple-watchos
// [armv7k_apple_watchos] needs-llvm-components: arm
// revisions: armv7s_apple_ios
// [armv7s_apple_ios] compile-flags: --target armv7s-apple-ios
// [armv7s_apple_ios] needs-llvm-components: arm
// revisions: i386_apple_ios
// [i386_apple_ios] compile-flags: --target i386-apple-ios
// [i386_apple_ios] needs-llvm-components: x86
// revisions: i686_apple_darwin
// [i686_apple_darwin] compile-flags: --target i686-apple-darwin
// [i686_apple_darwin] needs-llvm-components: x86
// revisions: x86_64_apple_darwin
// [x86_64_apple_darwin] compile-flags: --target x86_64-apple-darwin
// [x86_64_apple_darwin] needs-llvm-components: x86
// revisions: x86_64_apple_ios
// [x86_64_apple_ios] compile-flags: --target x86_64-apple-ios
// [x86_64_apple_ios] needs-llvm-components: x86
// revisions: x86_64_apple_ios_macabi
// [x86_64_apple_ios_macabi] compile-flags: --target x86_64-apple-ios-macabi
// [x86_64_apple_ios_macabi] needs-llvm-components: x86
// revisions: x86_64_apple_tvos
// [x86_64_apple_tvos] compile-flags: --target x86_64-apple-tvos
// [x86_64_apple_tvos] needs-llvm-components: x86
// revisions: x86_64_apple_watchos_sim
// [x86_64_apple_watchos_sim] compile-flags: --target x86_64-apple-watchos-sim
// [x86_64_apple_watchos_sim] needs-llvm-components: x86
// revisions: x86_64h_apple_darwin
// [x86_64h_apple_darwin] compile-flags: --target x86_64h-apple-darwin
// [x86_64h_apple_darwin] needs-llvm-components: x86

// Sanity-check that each target can produce assembly code.

#![feature(no_core, lang_items)]
#![no_std]
#![no_core]
#![crate_type = "lib"]

#[lang = "sized"]
trait Sized {}

pub fn test() -> u8 {
42
}

// CHECK: .section __TEXT,__text
2 changes: 0 additions & 2 deletions tests/codegen/alloc-optimisation.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
//
// no-system-llvm
// compile-flags: -O
#![crate_type = "lib"]

3 changes: 1 addition & 2 deletions tests/codegen/array-map.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
// compile-flags: -C opt-level=3 -C target-cpu=x86-64-v3
// no-system-llvm
// only-x86_64
// ignore-debug (the extra assertions get in the way)

@@ -10,7 +9,7 @@
pub fn short_integer_map(x: [u32; 8]) -> [u32; 8] {
// CHECK: load <8 x i32>
// CHECK: shl <8 x i32>
// CHECK: or <8 x i32>
// CHECK: or{{( disjoint)?}} <8 x i32>
// CHECK: store <8 x i32>
x.map(|x| 2 * x + 1)
}
1 change: 0 additions & 1 deletion tests/codegen/dealloc-no-unwind.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
// no-system-llvm
// compile-flags: -O

#![crate_type="lib"]
1 change: 0 additions & 1 deletion tests/codegen/fewer-names.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
// no-system-llvm
// compile-flags: -Coverflow-checks=no -O
// revisions: YES NO
// [YES]compile-flags: -Zfewer-names=yes
1 change: 0 additions & 1 deletion tests/codegen/integer-overflow.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
// no-system-llvm
// compile-flags: -O -C overflow-checks=on

#![crate_type = "lib"]
1 change: 0 additions & 1 deletion tests/codegen/issues/issue-116878.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
// no-system-llvm
// compile-flags: -O
// ignore-debug: the debug assertions get in the way
#![crate_type = "lib"]
1 change: 0 additions & 1 deletion tests/codegen/issues/issue-44056-macos-tls-align.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
//
// only-macos
// no-system-llvm
// compile-flags: -O

#![crate_type = "rlib"]
1 change: 0 additions & 1 deletion tests/codegen/issues/issue-69101-bounds-check.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
// no-system-llvm
// compile-flags: -O
// ignore-debug: the debug assertions get in the way
#![crate_type = "lib"]
1 change: 0 additions & 1 deletion tests/codegen/match-optimizes-away.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
//
// no-system-llvm
// compile-flags: -O
#![crate_type="lib"]

1 change: 0 additions & 1 deletion tests/codegen/ptr-read-metadata.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
// compile-flags: -O -Z merge-functions=disabled
// no-system-llvm
// ignore-debug (the extra assertions get in the way)

#![crate_type = "lib"]
1 change: 0 additions & 1 deletion tests/codegen/slice-as_chunks.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
// no-system-llvm
// compile-flags: -O
// only-64bit (because the LLVM type of i64 for usize shows up)
// ignore-debug: the debug assertions get in the way
1 change: 0 additions & 1 deletion tests/codegen/slice-iter-len-eq-zero.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
// no-system-llvm
// compile-flags: -O
// ignore-debug: the debug assertions add extra comparisons
#![crate_type = "lib"]
1 change: 0 additions & 1 deletion tests/codegen/slice-iter-nonnull.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
// no-system-llvm
// compile-flags: -O
// ignore-debug (these add extra checks that make it hard to verify)
#![crate_type = "lib"]
1 change: 0 additions & 1 deletion tests/codegen/slice-position-bounds-check.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
// no-system-llvm
// compile-flags: -O -C panic=abort
#![crate_type = "lib"]

1 change: 0 additions & 1 deletion tests/codegen/vec-iter-collect-len.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
// ignore-debug: the debug assertions get in the way
// no-system-llvm
// compile-flags: -O
#![crate_type="lib"]

1 change: 0 additions & 1 deletion tests/codegen/vec-optimizes-away.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
// ignore-debug: the debug assertions get in the way
// no-system-llvm
// compile-flags: -O
#![crate_type = "lib"]

5 changes: 2 additions & 3 deletions tests/coverage-run-rustdoc/doctest.coverage
Original file line number Diff line number Diff line change
@@ -34,8 +34,7 @@ $DIR/doctest.rs:
LL| |//!
LL| |//! doctest returning a result:
LL| 1|//! ```
LL| 2|//! #[derive(Debug, PartialEq)]
^1
LL| 1|//! #[derive(Debug, PartialEq)]
LL| 1|//! struct SomeError {
LL| 1|//! msg: String,
LL| 1|//! }
@@ -63,7 +62,7 @@ $DIR/doctest.rs:
LL| 1|//! println!("called some_func()");
LL| 1|//! }
LL| |//!
LL| 0|//! #[derive(Debug)]
LL| |//! #[derive(Debug)]
LL| |//! struct SomeError;
LL| |//!
LL| |//! extern crate doctest_crate;
16 changes: 0 additions & 16 deletions tests/coverage/bad_counter_ids.cov-map
Original file line number Diff line number Diff line change
@@ -1,19 +1,3 @@
Function name: <bad_counter_ids::Foo as core::cmp::PartialEq>::eq
Raw bytes (9): 0x[01, 01, 00, 01, 01, 0c, 11, 00, 1a]
Number of files: 1
- file 0 => global file 1
Number of expressions: 0
Number of file 0 mappings: 1
- Code(Counter(0)) at (prev + 12, 17) to (start + 0, 26)

Function name: <bad_counter_ids::Foo as core::fmt::Debug>::fmt
Raw bytes (9): 0x[01, 01, 00, 01, 01, 0c, 0a, 00, 0f]
Number of files: 1
- file 0 => global file 1
Number of expressions: 0
Number of file 0 mappings: 1
- Code(Counter(0)) at (prev + 12, 10) to (start + 0, 15)

Function name: bad_counter_ids::eq_bad
Raw bytes (14): 0x[01, 01, 00, 02, 01, 23, 01, 02, 1f, 00, 03, 01, 00, 02]
Number of files: 1
2 changes: 1 addition & 1 deletion tests/coverage/bad_counter_ids.coverage
Original file line number Diff line number Diff line change
@@ -9,7 +9,7 @@
LL| |// a too-large counter ID and silently discard the entire function from its
LL| |// coverage reports.
LL| |
LL| 8|#[derive(Debug, PartialEq, Eq)]
LL| |#[derive(Debug, PartialEq, Eq)]
LL| |struct Foo(u32);
LL| |
LL| 1|fn eq_good() {
16 changes: 0 additions & 16 deletions tests/coverage/issue-83601.cov-map
Original file line number Diff line number Diff line change
@@ -1,19 +1,3 @@
Function name: <issue_83601::Foo as core::cmp::PartialEq>::eq
Raw bytes (9): 0x[01, 01, 00, 01, 01, 03, 11, 00, 1a]
Number of files: 1
- file 0 => global file 1
Number of expressions: 0
Number of file 0 mappings: 1
- Code(Counter(0)) at (prev + 3, 17) to (start + 0, 26)

Function name: <issue_83601::Foo as core::fmt::Debug>::fmt
Raw bytes (9): 0x[01, 01, 00, 01, 01, 03, 0a, 00, 0f]
Number of files: 1
- file 0 => global file 1
Number of expressions: 0
Number of file 0 mappings: 1
- Code(Counter(0)) at (prev + 3, 10) to (start + 0, 15)

Function name: issue_83601::main
Raw bytes (21): 0x[01, 01, 01, 05, 09, 03, 01, 06, 01, 02, 1c, 05, 03, 09, 01, 1c, 02, 02, 05, 03, 02]
Number of files: 1
3 changes: 1 addition & 2 deletions tests/coverage/issue-83601.coverage
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
LL| |// Shows that rust-lang/rust/83601 is resolved
LL| |
LL| 3|#[derive(Debug, PartialEq, Eq)]
^2
LL| |#[derive(Debug, PartialEq, Eq)]
LL| |struct Foo(u32);
LL| |
LL| 1|fn main() {
8 changes: 0 additions & 8 deletions tests/coverage/issue-84561.cov-map
Original file line number Diff line number Diff line change
@@ -1,11 +1,3 @@
Function name: <issue_84561::Foo as core::cmp::PartialEq>::eq
Raw bytes (9): 0x[01, 01, 00, 01, 01, 04, 0a, 00, 13]
Number of files: 1
- file 0 => global file 1
Number of expressions: 0
Number of file 0 mappings: 1
- Code(Counter(0)) at (prev + 4, 10) to (start + 0, 19)

Function name: <issue_84561::Foo as core::fmt::Debug>::fmt
Raw bytes (29): 0x[01, 01, 02, 01, 05, 05, 02, 04, 01, 8a, 01, 05, 01, 25, 05, 01, 25, 00, 26, 02, 01, 09, 00, 0f, 07, 01, 05, 00, 06]
Number of files: 1
2 changes: 1 addition & 1 deletion tests/coverage/issue-84561.coverage
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
LL| |// This demonstrated Issue #84561: function-like macros produce unintuitive coverage results.
LL| |
LL| |// failure-status: 101
LL| 21|#[derive(PartialEq, Eq)]
LL| |#[derive(PartialEq, Eq)]
LL| |struct Foo(u32);
LL| |
LL| |#[rustfmt::skip]
48 changes: 0 additions & 48 deletions tests/coverage/partial_eq.cov-map
Original file line number Diff line number Diff line change
@@ -1,51 +1,3 @@
Function name: <partial_eq::Version as core::clone::Clone>::clone (unused)
Raw bytes (9): 0x[01, 01, 00, 01, 00, 04, 0a, 00, 0f]
Number of files: 1
- file 0 => global file 1
Number of expressions: 0
Number of file 0 mappings: 1
- Code(Zero) at (prev + 4, 10) to (start + 0, 15)

Function name: <partial_eq::Version as core::cmp::Ord>::cmp (unused)
Raw bytes (14): 0x[01, 01, 00, 02, 00, 04, 33, 00, 34, 00, 00, 35, 00, 36]
Number of files: 1
- file 0 => global file 1
Number of expressions: 0
Number of file 0 mappings: 2
- Code(Zero) at (prev + 4, 51) to (start + 0, 52)
- Code(Zero) at (prev + 0, 53) to (start + 0, 54)

Function name: <partial_eq::Version as core::cmp::PartialEq>::eq (unused)
Raw bytes (14): 0x[01, 01, 00, 02, 00, 04, 18, 00, 19, 00, 00, 20, 00, 21]
Number of files: 1
- file 0 => global file 1
Number of expressions: 0
Number of file 0 mappings: 2
- Code(Zero) at (prev + 4, 24) to (start + 0, 25)
- Code(Zero) at (prev + 0, 32) to (start + 0, 33)

Function name: <partial_eq::Version as core::cmp::PartialOrd>::partial_cmp
Raw bytes (22): 0x[01, 01, 04, 07, 0b, 00, 09, 0f, 15, 00, 11, 02, 01, 04, 27, 00, 28, 03, 00, 30, 00, 31]
Number of files: 1
- file 0 => global file 1
Number of expressions: 4
- expression 0 operands: lhs = Expression(1, Add), rhs = Expression(2, Add)
- expression 1 operands: lhs = Zero, rhs = Counter(2)
- expression 2 operands: lhs = Expression(3, Add), rhs = Counter(5)
- expression 3 operands: lhs = Zero, rhs = Counter(4)
Number of file 0 mappings: 2
- Code(Counter(0)) at (prev + 4, 39) to (start + 0, 40)
- Code(Expression(0, Add)) at (prev + 0, 48) to (start + 0, 49)
= ((Zero + c2) + ((Zero + c4) + c5))

Function name: <partial_eq::Version as core::fmt::Debug>::fmt
Raw bytes (9): 0x[01, 01, 00, 01, 01, 04, 11, 00, 16]
Number of files: 1
- file 0 => global file 1
Number of expressions: 0
Number of file 0 mappings: 1
- Code(Counter(0)) at (prev + 4, 17) to (start + 0, 22)

Function name: <partial_eq::Version>::new
Raw bytes (9): 0x[01, 01, 00, 01, 01, 0c, 05, 06, 06]
Number of files: 1
3 changes: 1 addition & 2 deletions tests/coverage/partial_eq.coverage
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
LL| |// This test confirms an earlier problem was resolved, supporting the MIR graph generated by the
LL| |// structure of this test.
LL| |
LL| 2|#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord)]
^0 ^0 ^0 ^1 ^1 ^0^0
LL| |#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord)]
LL| |pub struct Version {
LL| | major: usize,
LL| | minor: usize,
Original file line number Diff line number Diff line change
@@ -4,7 +4,7 @@
fn adt_transmutes() -> () {
let mut _0: ();
let _1: u8;
let mut _2: std::option::Option<std::num::NonZeroU8>;
let mut _2: std::option::Option<std::num::NonZero<u8>>;
let mut _4: std::num::Wrapping<i16>;
let mut _6: std::num::Wrapping<i16>;
let mut _8: Union32;
@@ -37,7 +37,7 @@
bb0: {
StorageLive(_1);
StorageLive(_2);
_2 = Option::<NonZeroU8>::Some(const _);
_2 = Option::<NonZero<u8>>::Some(const _);
_1 = move _2 as u8 (Transmute);
StorageDead(_2);
StorageLive(_3);
2 changes: 1 addition & 1 deletion tests/run-make/target-specs/Makefile
Original file line number Diff line number Diff line change
@@ -9,4 +9,4 @@ all:
$(RUSTC) -Z unstable-options --target=my-awesome-platform.json --print target-spec-json > $(TMPDIR)/test-platform.json && $(RUSTC) -Z unstable-options --target=$(TMPDIR)/test-platform.json --print target-spec-json | diff -q $(TMPDIR)/test-platform.json -
$(RUSTC) foo.rs --target=definitely-not-builtin-target 2>&1 | $(CGREP) 'may not set is_builtin'
$(RUSTC) foo.rs --target=endianness-mismatch 2>&1 | $(CGREP) '"data-layout" claims architecture is little-endian'
$(RUSTC) foo.rs --target=mismatching-data-layout --crate-type=lib
$(RUSTC) foo.rs --target=mismatching-data-layout --crate-type=lib 2>&1 | $(CGREP) 'data-layout for target'
1 change: 0 additions & 1 deletion tests/rustdoc/doc-cfg-target-feature.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
// only-x86_64
// compile-flags:--test
// should-fail
// no-system-llvm

// #49723: rustdoc didn't add target features when extracting or running doctests

4 changes: 2 additions & 2 deletions tests/ui/array-slice-vec/repeat_empty_ok.stderr
Original file line number Diff line number Diff line change
@@ -6,7 +6,7 @@ LL | let headers = [Header{value: &[]}; 128];
|
= note: the `Copy` trait is required because this value will be copied for each element of the array
= help: consider using `core::array::from_fn` to initialize the array
= help: see https://doc.rust-lang.org/stable/std/array/fn.from_fn.html# for more information
= help: see https://doc.rust-lang.org/stable/std/array/fn.from_fn.html for more information
help: consider annotating `Header<'_>` with `#[derive(Copy)]`
|
LL + #[derive(Copy)]
@@ -21,7 +21,7 @@ LL | let headers = [Header{value: &[0]}; 128];
|
= note: the `Copy` trait is required because this value will be copied for each element of the array
= help: consider using `core::array::from_fn` to initialize the array
= help: see https://doc.rust-lang.org/stable/std/array/fn.from_fn.html# for more information
= help: see https://doc.rust-lang.org/stable/std/array/fn.from_fn.html for more information
help: consider annotating `Header<'_>` with `#[derive(Copy)]`
|
LL + #[derive(Copy)]
13 changes: 13 additions & 0 deletions tests/ui/codegen/mismatched-data-layout.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"llvm-target": "x86_64-unknown-none-gnu",
"data-layout": "e-m:e-i64:64-f80:128-n8:16:32:64-S128",
"arch": "x86_64",
"target-endian": "little",
"target-pointer-width": "64",
"target-c-int-width": "32",
"os": "unknown",
"linker-flavor": "ld.lld",
"linker": "rust-lld",
"executables": true
}

14 changes: 14 additions & 0 deletions tests/ui/codegen/mismatched-data-layouts.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
// This test checks that data layout mismatches emit an error.
//
// build-fail
// needs-llvm-components: x86
// compile-flags: --crate-type=lib --target={{src-base}}/codegen/mismatched-data-layout.json -Z unstable-options
// error-pattern: differs from LLVM target's
// normalize-stderr-test: "`, `[A-Za-z0-9-:]*`" -> "`, `normalized data layout`"
// normalize-stderr-test: "layout, `[A-Za-z0-9-:]*`" -> "layout, `normalized data layout`"

#![feature(lang_items, no_core, auto_traits)]
#![no_core]

#[lang = "sized"]
trait Sized {}
4 changes: 4 additions & 0 deletions tests/ui/codegen/mismatched-data-layouts.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
error: data-layout for target `mismatched-data-layout-7814813422914914169`, `normalized data layout`, differs from LLVM target's `x86_64-unknown-none-gnu` default layout, `normalized data layout`

error: aborting due to 1 previous error

2 changes: 1 addition & 1 deletion tests/ui/const-generics/issues/issue-61336-2.stderr
Original file line number Diff line number Diff line change
@@ -6,7 +6,7 @@ LL | [x; { N }]
|
= note: the `Copy` trait is required because this value will be copied for each element of the array
= help: consider using `core::array::from_fn` to initialize the array
= help: see https://doc.rust-lang.org/stable/std/array/fn.from_fn.html# for more information
= help: see https://doc.rust-lang.org/stable/std/array/fn.from_fn.html for more information
help: consider restricting type parameter `T`
|
LL | fn g<T: std::marker::Copy, const N: usize>(x: T) -> [T; N] {
2 changes: 1 addition & 1 deletion tests/ui/const-generics/issues/issue-61336.stderr
Original file line number Diff line number Diff line change
@@ -6,7 +6,7 @@ LL | [x; N]
|
= note: the `Copy` trait is required because this value will be copied for each element of the array
= help: consider using `core::array::from_fn` to initialize the array
= help: see https://doc.rust-lang.org/stable/std/array/fn.from_fn.html# for more information
= help: see https://doc.rust-lang.org/stable/std/array/fn.from_fn.html for more information
help: consider restricting type parameter `T`
|
LL | fn g<T: std::marker::Copy, const N: usize>(x: T) -> [T; N] {
4 changes: 2 additions & 2 deletions tests/ui/consts/const-blocks/migrate-fail.stderr
Original file line number Diff line number Diff line change
@@ -7,7 +7,7 @@ LL | let arr: [Option<Bar>; 2] = [x; 2];
= note: required for `Option<Bar>` to implement `Copy`
= note: the `Copy` trait is required because this value will be copied for each element of the array
= help: consider using `core::array::from_fn` to initialize the array
= help: see https://doc.rust-lang.org/stable/std/array/fn.from_fn.html# for more information
= help: see https://doc.rust-lang.org/stable/std/array/fn.from_fn.html for more information
help: consider annotating `Bar` with `#[derive(Copy)]`
|
LL + #[derive(Copy)]
@@ -23,7 +23,7 @@ LL | let arr: [Option<Bar>; 2] = [x; 2];
= note: required for `Option<Bar>` to implement `Copy`
= note: the `Copy` trait is required because this value will be copied for each element of the array
= help: consider using `core::array::from_fn` to initialize the array
= help: see https://doc.rust-lang.org/stable/std/array/fn.from_fn.html# for more information
= help: see https://doc.rust-lang.org/stable/std/array/fn.from_fn.html for more information
help: consider annotating `Bar` with `#[derive(Copy)]`
|
LL + #[derive(Copy)]
4 changes: 2 additions & 2 deletions tests/ui/consts/const-blocks/nll-fail.stderr
Original file line number Diff line number Diff line change
@@ -7,7 +7,7 @@ LL | let arr: [Option<Bar>; 2] = [x; 2];
= note: required for `Option<Bar>` to implement `Copy`
= note: the `Copy` trait is required because this value will be copied for each element of the array
= help: consider using `core::array::from_fn` to initialize the array
= help: see https://doc.rust-lang.org/stable/std/array/fn.from_fn.html# for more information
= help: see https://doc.rust-lang.org/stable/std/array/fn.from_fn.html for more information
help: consider annotating `Bar` with `#[derive(Copy)]`
|
LL + #[derive(Copy)]
@@ -23,7 +23,7 @@ LL | let arr: [Option<Bar>; 2] = [x; 2];
= note: required for `Option<Bar>` to implement `Copy`
= note: the `Copy` trait is required because this value will be copied for each element of the array
= help: consider using `core::array::from_fn` to initialize the array
= help: see https://doc.rust-lang.org/stable/std/array/fn.from_fn.html# for more information
= help: see https://doc.rust-lang.org/stable/std/array/fn.from_fn.html for more information
help: consider annotating `Bar` with `#[derive(Copy)]`
|
LL + #[derive(Copy)]
1 change: 0 additions & 1 deletion tests/ui/for-loop-while/issue-69841.rs
Original file line number Diff line number Diff line change
@@ -2,7 +2,6 @@
// LLVM bug which needed a fix to be backported.

// run-pass
// no-system-llvm

fn main() {
let buffer = [49u8, 10];
1 change: 0 additions & 1 deletion tests/ui/issue-76387-llvm-miscompile.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
// no-system-llvm
// compile-flags: -C opt-level=3
// aux-build: issue-76387.rs
// run-pass
2 changes: 1 addition & 1 deletion tests/ui/layout/zero-sized-array-enum-niche.stderr
Original file line number Diff line number Diff line change
@@ -232,7 +232,7 @@ error: layout_of(MultipleAlignments) = Layout {
LL | enum MultipleAlignments {
| ^^^^^^^^^^^^^^^^^^^^^^^

error: layout_of(Result<[u32; 0], Packed<NonZeroU16>>) = Layout {
error: layout_of(Result<[u32; 0], Packed<NonZero<u16>>>) = Layout {
size: Size(4 bytes),
align: AbiAndPrefAlign {
abi: Align(4 bytes),
2 changes: 1 addition & 1 deletion tests/ui/lint/clashing-extern-fn.rs
Original file line number Diff line number Diff line change
@@ -436,7 +436,7 @@ mod hidden_niche {

fn hidden_niche_unsafe_cell() -> Option<UnsafeCell<NonZeroUsize>>;
//~^ WARN redeclared with a different signature
//~| WARN block uses type `Option<UnsafeCell<NonZeroUsize>>`, which is not FFI-safe
//~| WARN block uses type `Option<UnsafeCell<NonZero<usize>>>`, which is not FFI-safe
}
}
}
6 changes: 3 additions & 3 deletions tests/ui/lint/clashing-extern-fn.stderr
Original file line number Diff line number Diff line change
@@ -8,7 +8,7 @@ LL | fn hidden_niche_transparent_no_niche() -> Option<TransparentNoN
= note: enum has no representation hint
= note: `#[warn(improper_ctypes)]` on by default

warning: `extern` block uses type `Option<UnsafeCell<NonZeroUsize>>`, which is not FFI-safe
warning: `extern` block uses type `Option<UnsafeCell<NonZero<usize>>>`, which is not FFI-safe
--> $DIR/clashing-extern-fn.rs:437:46
|
LL | fn hidden_niche_unsafe_cell() -> Option<UnsafeCell<NonZeroUsize>>;
@@ -163,7 +163,7 @@ LL | fn non_zero_usize() -> core::num::NonZeroUsize;
LL | fn non_zero_usize() -> usize;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ this signature doesn't match the previous declaration
|
= note: expected `unsafe extern "C" fn() -> NonZeroUsize`
= note: expected `unsafe extern "C" fn() -> NonZero<usize>`
found `unsafe extern "C" fn() -> usize`

warning: `non_null_ptr` redeclared with a different signature
@@ -224,7 +224,7 @@ LL | fn hidden_niche_unsafe_cell() -> Option<UnsafeCell<NonZeroUsize
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ this signature doesn't match the previous declaration
|
= note: expected `unsafe extern "C" fn() -> usize`
found `unsafe extern "C" fn() -> Option<UnsafeCell<NonZeroUsize>>`
found `unsafe extern "C" fn() -> Option<UnsafeCell<NonZero<usize>>>`

warning: 19 warnings emitted

16 changes: 8 additions & 8 deletions tests/ui/lint/invalid_value.stderr
Original file line number Diff line number Diff line change
@@ -316,7 +316,7 @@ LL | let _val: NonNull<i32> = mem::uninitialized();
= note: `std::ptr::NonNull<i32>` must be non-null
= note: raw pointers must be initialized

error: the type `(NonZeroU32, i32)` does not permit zero-initialization
error: the type `(NonZero<u32>, i32)` does not permit zero-initialization
--> $DIR/invalid_value.rs:95:39
|
LL | let _val: (NonZeroU32, i32) = mem::zeroed();
@@ -325,9 +325,9 @@ LL | let _val: (NonZeroU32, i32) = mem::zeroed();
| this code causes undefined behavior when executed
| help: use `MaybeUninit<T>` instead, and only call `assume_init` after initialization is done
|
= note: `std::num::NonZeroU32` must be non-null
= note: `std::num::NonZero<u32>` must be non-null

error: the type `(NonZeroU32, i32)` does not permit being left uninitialized
error: the type `(NonZero<u32>, i32)` does not permit being left uninitialized
--> $DIR/invalid_value.rs:96:39
|
LL | let _val: (NonZeroU32, i32) = mem::uninitialized();
@@ -336,7 +336,7 @@ LL | let _val: (NonZeroU32, i32) = mem::uninitialized();
| this code causes undefined behavior when executed
| help: use `MaybeUninit<T>` instead, and only call `assume_init` after initialization is done
|
= note: `std::num::NonZeroU32` must be non-null
= note: `std::num::NonZero<u32>` must be non-null
= note: integers must be initialized

error: the type `*const dyn Send` does not permit zero-initialization
@@ -417,7 +417,7 @@ LL | let _val: OneFruitNonZero = mem::zeroed();
| help: use `MaybeUninit<T>` instead, and only call `assume_init` after initialization is done
|
= note: `OneFruitNonZero` must be non-null
note: because `std::num::NonZeroU32` must be non-null (in this field of the only potentially inhabited enum variant)
note: because `std::num::NonZero<u32>` must be non-null (in this field of the only potentially inhabited enum variant)
--> $DIR/invalid_value.rs:39:12
|
LL | Banana(NonZeroU32),
@@ -433,7 +433,7 @@ LL | let _val: OneFruitNonZero = mem::uninitialized();
| help: use `MaybeUninit<T>` instead, and only call `assume_init` after initialization is done
|
= note: `OneFruitNonZero` must be non-null
note: because `std::num::NonZeroU32` must be non-null (in this field of the only potentially inhabited enum variant)
note: because `std::num::NonZero<u32>` must be non-null (in this field of the only potentially inhabited enum variant)
--> $DIR/invalid_value.rs:39:12
|
LL | Banana(NonZeroU32),
@@ -603,7 +603,7 @@ LL | let _val: &'static [i32] = mem::transmute((0usize, 0usize));
|
= note: references must be non-null

error: the type `NonZeroU32` does not permit zero-initialization
error: the type `NonZero<u32>` does not permit zero-initialization
--> $DIR/invalid_value.rs:154:32
|
LL | let _val: NonZeroU32 = mem::transmute(0);
@@ -612,7 +612,7 @@ LL | let _val: NonZeroU32 = mem::transmute(0);
| this code causes undefined behavior when executed
| help: use `MaybeUninit<T>` instead, and only call `assume_init` after initialization is done
|
= note: `std::num::NonZeroU32` must be non-null
= note: `std::num::NonZero<u32>` must be non-null

error: the type `NonNull<i32>` does not permit zero-initialization
--> $DIR/invalid_value.rs:157:34
6 changes: 3 additions & 3 deletions tests/ui/lint/lint-ctypes-enum.stderr
Original file line number Diff line number Diff line change
@@ -61,7 +61,7 @@ LL | fn nonzero_i128(x: Option<num::NonZeroI128>);
|
= note: 128-bit integers don't currently have a known stable ABI

error: `extern` block uses type `Option<TransparentUnion<NonZeroU8>>`, which is not FFI-safe
error: `extern` block uses type `Option<TransparentUnion<NonZero<u8>>>`, which is not FFI-safe
--> $DIR/lint-ctypes-enum.rs:86:28
|
LL | fn transparent_union(x: Option<TransparentUnion<num::NonZeroU8>>);
@@ -70,7 +70,7 @@ LL | fn transparent_union(x: Option<TransparentUnion<num::NonZeroU8>>);
= help: consider adding a `#[repr(C)]`, `#[repr(transparent)]`, or integer `#[repr(...)]` attribute to this enum
= note: enum has no representation hint

error: `extern` block uses type `Option<Rust<NonZeroU8>>`, which is not FFI-safe
error: `extern` block uses type `Option<Rust<NonZero<u8>>>`, which is not FFI-safe
--> $DIR/lint-ctypes-enum.rs:88:20
|
LL | fn repr_rust(x: Option<Rust<num::NonZeroU8>>);
@@ -79,7 +79,7 @@ LL | fn repr_rust(x: Option<Rust<num::NonZeroU8>>);
= help: consider adding a `#[repr(C)]`, `#[repr(transparent)]`, or integer `#[repr(...)]` attribute to this enum
= note: enum has no representation hint

error: `extern` block uses type `Result<(), NonZeroI32>`, which is not FFI-safe
error: `extern` block uses type `Result<(), NonZero<i32>>`, which is not FFI-safe
--> $DIR/lint-ctypes-enum.rs:89:20
|
LL | fn no_result(x: Result<(), num::NonZeroI32>);
8 changes: 5 additions & 3 deletions tests/ui/mismatched_types/non_zero_assigned_something.stderr
Original file line number Diff line number Diff line change
@@ -2,10 +2,12 @@ error[E0308]: mismatched types
--> $DIR/non_zero_assigned_something.rs:2:35
|
LL | let _: std::num::NonZeroU64 = 1;
| -------------------- ^ expected `NonZeroU64`, found integer
| -------------------- ^ expected `NonZero<u64>`, found integer
| |
| expected due to this
|
= note: expected struct `NonZero<u64>`
found type `{integer}`
help: consider calling `NonZeroU64::new`
|
LL | let _: std::num::NonZeroU64 = NonZeroU64::new(1).unwrap();
@@ -15,11 +17,11 @@ error[E0308]: mismatched types
--> $DIR/non_zero_assigned_something.rs:6:43
|
LL | let _: Option<std::num::NonZeroU64> = 1;
| ---------------------------- ^ expected `Option<NonZeroU64>`, found integer
| ---------------------------- ^ expected `Option<NonZero<u64>>`, found integer
| |
| expected due to this
|
= note: expected enum `Option<NonZeroU64>`
= note: expected enum `Option<NonZero<u64>>`
found type `{integer}`
help: consider calling `NonZeroU64::new`
|
Original file line number Diff line number Diff line change
@@ -124,7 +124,7 @@ LL | x / 100.0
= help: the trait `Div<{float}>` is not implemented for `u8`
= help: the following other types implement trait `Div<Rhs>`:
<u8 as Div>
<u8 as Div<NonZeroU8>>
<u8 as Div<NonZero<u8>>>
<u8 as Div<&u8>>
<&'a u8 as Div<u8>>
<&u8 as Div<&u8>>
16 changes: 8 additions & 8 deletions tests/ui/print_type_sizes/niche-filling.stdout
Original file line number Diff line number Diff line change
@@ -14,17 +14,17 @@ print-type-size field `.pre`: 1 bytes
print-type-size field `.post`: 2 bytes
print-type-size field `.val`: 4 bytes
print-type-size variant `None`: 0 bytes
print-type-size type: `MyOption<Union1<std::num::NonZeroU32>>`: 8 bytes, alignment: 4 bytes
print-type-size type: `MyOption<Union1<std::num::NonZero<u32>>>`: 8 bytes, alignment: 4 bytes
print-type-size discriminant: 4 bytes
print-type-size variant `Some`: 4 bytes
print-type-size field `.0`: 4 bytes
print-type-size variant `None`: 0 bytes
print-type-size type: `MyOption<Union2<std::num::NonZeroU32, std::num::NonZeroU32>>`: 8 bytes, alignment: 4 bytes
print-type-size type: `MyOption<Union2<std::num::NonZero<u32>, std::num::NonZero<u32>>>`: 8 bytes, alignment: 4 bytes
print-type-size discriminant: 4 bytes
print-type-size variant `Some`: 4 bytes
print-type-size field `.0`: 4 bytes
print-type-size variant `None`: 0 bytes
print-type-size type: `MyOption<Union2<std::num::NonZeroU32, u32>>`: 8 bytes, alignment: 4 bytes
print-type-size type: `MyOption<Union2<std::num::NonZero<u32>, u32>>`: 8 bytes, alignment: 4 bytes
print-type-size discriminant: 4 bytes
print-type-size variant `Some`: 4 bytes
print-type-size field `.0`: 4 bytes
@@ -53,22 +53,22 @@ print-type-size type: `MyOption<char>`: 4 bytes, alignment: 4 bytes
print-type-size variant `Some`: 4 bytes
print-type-size field `.0`: 4 bytes
print-type-size variant `None`: 0 bytes
print-type-size type: `MyOption<std::num::NonZeroU32>`: 4 bytes, alignment: 4 bytes
print-type-size type: `MyOption<std::num::NonZero<u32>>`: 4 bytes, alignment: 4 bytes
print-type-size variant `Some`: 4 bytes
print-type-size field `.0`: 4 bytes
print-type-size variant `None`: 0 bytes
print-type-size type: `Union1<std::num::NonZeroU32>`: 4 bytes, alignment: 4 bytes
print-type-size type: `Union1<std::num::NonZero<u32>>`: 4 bytes, alignment: 4 bytes
print-type-size variant `Union1`: 4 bytes
print-type-size field `.a`: 4 bytes
print-type-size type: `Union2<std::num::NonZeroU32, std::num::NonZeroU32>`: 4 bytes, alignment: 4 bytes
print-type-size type: `Union2<std::num::NonZero<u32>, std::num::NonZero<u32>>`: 4 bytes, alignment: 4 bytes
print-type-size variant `Union2`: 4 bytes
print-type-size field `.a`: 4 bytes
print-type-size field `.b`: 4 bytes, offset: 0 bytes, alignment: 4 bytes
print-type-size type: `Union2<std::num::NonZeroU32, u32>`: 4 bytes, alignment: 4 bytes
print-type-size type: `Union2<std::num::NonZero<u32>, u32>`: 4 bytes, alignment: 4 bytes
print-type-size variant `Union2`: 4 bytes
print-type-size field `.a`: 4 bytes
print-type-size field `.b`: 4 bytes, offset: 0 bytes, alignment: 4 bytes
print-type-size type: `std::num::NonZeroU32`: 4 bytes, alignment: 4 bytes
print-type-size type: `std::num::NonZero<u32>`: 4 bytes, alignment: 4 bytes
print-type-size field `.0`: 4 bytes
print-type-size type: `Enum4<(), (), (), MyOption<u8>>`: 2 bytes, alignment: 1 bytes
print-type-size variant `Four`: 2 bytes
2 changes: 1 addition & 1 deletion tests/ui/repeat-expr/repeat-to-run-dtor-twice.stderr
Original file line number Diff line number Diff line change
@@ -6,7 +6,7 @@ LL | let _ = [ a; 5 ];
|
= note: the `Copy` trait is required because this value will be copied for each element of the array
= help: consider using `core::array::from_fn` to initialize the array
= help: see https://doc.rust-lang.org/stable/std/array/fn.from_fn.html# for more information
= help: see https://doc.rust-lang.org/stable/std/array/fn.from_fn.html for more information
help: consider annotating `Foo` with `#[derive(Copy)]`
|
LL + #[derive(Copy)]
2 changes: 1 addition & 1 deletion tests/ui/trait-bounds/issue-119530-sugg-from-fn.stderr
Original file line number Diff line number Diff line change
@@ -6,7 +6,7 @@ LL | let string_arr = [foo(); 64];
|
= note: the `Copy` trait is required because this value will be copied for each element of the array
= help: consider using `core::array::from_fn` to initialize the array
= help: see https://doc.rust-lang.org/stable/std/array/fn.from_fn.html# for more information
= help: see https://doc.rust-lang.org/stable/std/array/fn.from_fn.html for more information

error: aborting due to 1 previous error

2 changes: 1 addition & 1 deletion tests/ui/traits/issue-77982.stderr
Original file line number Diff line number Diff line change
@@ -45,7 +45,7 @@ LL | let ips: Vec<_> = (0..100_000).map(|_| u32::from(0u32.into())).collect(
|
= note: multiple `impl`s satisfying `u32: From<_>` found in the `core` crate:
- impl From<Ipv4Addr> for u32;
- impl From<NonZeroU32> for u32;
- impl From<NonZero<u32>> for u32;
- impl From<bool> for u32;
- impl From<char> for u32;
- impl From<u16> for u32;
2 changes: 1 addition & 1 deletion tests/ui/try-trait/bad-interconversion.stderr
Original file line number Diff line number Diff line change
@@ -11,7 +11,7 @@ LL | Ok(Err(123_i32)?)
= note: the question mark operation (`?`) implicitly performs a conversion on the error value using the `From` trait
= help: the following other types implement trait `From<T>`:
<u8 as From<bool>>
<u8 as From<NonZeroU8>>
<u8 as From<NonZero<u8>>>
= note: required for `Result<u64, u8>` to implement `FromResidual<Result<Infallible, i32>>`

error[E0277]: the `?` operator can only be used on `Result`s, not `Option`s, in a function that returns `Result`