Stabilize generic NonZero.

This commit is contained in:
Markus Reiter 2024-04-21 18:41:45 +02:00
parent f22a0c2d9f
commit 33e68aadc9
No known key found for this signature in database
GPG Key ID: 245293B51702655B
67 changed files with 69 additions and 111 deletions

View File

@ -7,7 +7,6 @@
#![allow(internal_features)]
#![feature(rustdoc_internals)]
#![doc(rust_logo)]
#![feature(generic_nonzero)]
#![feature(let_chains)]
#[macro_use]

View File

@ -11,7 +11,6 @@
#![feature(assert_matches)]
#![feature(box_patterns)]
#![feature(decl_macro)]
#![feature(generic_nonzero)]
#![feature(let_chains)]
#![feature(slice_ptr_get)]
#![feature(strict_provenance)]

View File

@ -20,7 +20,6 @@
#![feature(cfg_match)]
#![feature(core_intrinsics)]
#![feature(extend_one)]
#![feature(generic_nonzero)]
#![feature(hash_raw_entry)]
#![feature(hasher_prefixfree_extras)]
#![feature(lazy_cell)]

View File

@ -15,7 +15,6 @@
#![feature(box_patterns)]
#![feature(error_reporter)]
#![feature(extract_if)]
#![feature(generic_nonzero)]
#![feature(let_chains)]
#![feature(negative_impls)]
#![feature(never_type)]

View File

@ -12,7 +12,6 @@
//! symbol to the `accepted` or `removed` modules respectively.
#![allow(internal_features)]
#![feature(generic_nonzero)]
#![feature(rustdoc_internals)]
#![doc(rust_logo)]
#![feature(lazy_cell)]

View File

@ -63,7 +63,6 @@
#![feature(rustdoc_internals)]
#![allow(internal_features)]
#![feature(control_flow_enum)]
#![feature(generic_nonzero)]
#![feature(if_let_guard)]
#![feature(is_sorted)]
#![feature(iter_intersperse)]

View File

@ -1,5 +1,4 @@
#![feature(decl_macro)]
#![feature(generic_nonzero)]
#![feature(lazy_cell)]
#![feature(let_chains)]
#![feature(thread_spawn_unchecked)]

View File

@ -32,7 +32,6 @@
#![feature(box_patterns)]
#![feature(control_flow_enum)]
#![feature(extract_if)]
#![feature(generic_nonzero)]
#![feature(if_let_guard)]
#![feature(iter_order_by)]
#![feature(let_chains)]

View File

@ -6,7 +6,6 @@
#![feature(error_iter)]
#![feature(extract_if)]
#![feature(coroutines)]
#![feature(generic_nonzero)]
#![feature(iter_from_coroutine)]
#![feature(let_chains)]
#![feature(if_let_guard)]

View File

@ -35,7 +35,6 @@
#![feature(const_type_name)]
#![feature(discriminant_kind)]
#![feature(coroutines)]
#![feature(generic_nonzero)]
#![feature(if_let_guard)]
#![feature(inline_const)]
#![feature(iter_from_coroutine)]

View File

@ -8,7 +8,6 @@
#![doc(rust_logo)]
#![feature(rustdoc_internals)]
#![allow(internal_features)]
#![feature(generic_nonzero)]
#![feature(let_chains)]
#![feature(map_try_insert)]
#![feature(try_blocks)]

View File

@ -3,7 +3,6 @@
#![doc(html_root_url = "https://doc.rust-lang.org/nightly/nightly-rustc/")]
#![doc(rust_logo)]
#![feature(rustdoc_internals)]
#![feature(generic_nonzero)]
#![feature(min_specialization)]
#![feature(rustc_attrs)]
#![allow(rustc::potential_query_instability, unused_parens)]

View File

@ -1,6 +1,5 @@
#![feature(assert_matches)]
#![feature(core_intrinsics)]
#![feature(generic_nonzero)]
#![feature(hash_raw_entry)]
#![feature(min_specialization)]
#![feature(let_chains)]

View File

@ -11,7 +11,6 @@
#![cfg_attr(bootstrap, feature(associated_type_bounds))]
#![feature(const_option)]
#![feature(core_intrinsics)]
#![feature(generic_nonzero)]
#![feature(inline_const)]
#![feature(min_specialization)]
#![feature(never_type)]

View File

@ -1,4 +1,3 @@
#![feature(generic_nonzero)]
#![feature(let_chains)]
#![feature(lazy_cell)]
#![feature(option_get_or_insert_default)]

View File

@ -126,7 +126,6 @@
#![feature(extend_one)]
#![feature(fmt_internals)]
#![feature(fn_traits)]
#![feature(generic_nonzero)]
#![feature(hasher_prefixfree_extras)]
#![feature(hint_assert_unchecked)]
#![feature(inline_const)]

View File

@ -14,7 +14,6 @@
#![feature(core_intrinsics)]
#![feature(extract_if)]
#![feature(exact_size_is_empty)]
#![feature(generic_nonzero)]
#![feature(linked_list_cursors)]
#![feature(map_try_insert)]
#![feature(new_uninit)]

View File

@ -512,7 +512,8 @@ macro_rules! array_impl_default {
/// # Examples
///
/// ```
/// #![feature(array_try_map, generic_nonzero)]
/// #![feature(array_try_map)]
///
/// let a = ["1", "2", "3"];
/// let b = a.try_map(|v| v.parse::<u32>()).unwrap().map(|v| v + 1);
/// assert_eq!(b, [2, 3, 4]);
@ -522,8 +523,10 @@ macro_rules! array_impl_default {
/// assert!(b.is_err());
///
/// use std::num::NonZero;
///
/// let z = [1, 2, 0, 3, 4];
/// assert_eq!(z.try_map(NonZero::new), None);
///
/// let a = [1, 2, 3];
/// let b = a.try_map(NonZero::new);
/// let c = b.map(|x| x.map(NonZero::get));

View File

@ -118,7 +118,8 @@ pub trait DoubleEndedIterator: Iterator {
/// Basic usage:
///
/// ```
/// #![feature(generic_nonzero, iter_advance_by)]
/// #![feature(iter_advance_by)]
///
/// use std::num::NonZero;
///
/// let a = [3, 4, 5, 6];

View File

@ -288,7 +288,8 @@ fn some<T>(_: Option<T>, x: T) -> Option<T> {
/// # Examples
///
/// ```
/// #![feature(generic_nonzero, iter_advance_by)]
/// #![feature(iter_advance_by)]
///
/// use std::num::NonZero;
///
/// let a = [1, 2, 3, 4];
@ -2939,7 +2940,8 @@ fn check<T, B>(mut f: impl FnMut(T) -> Option<B>) -> impl FnMut((), T) -> Contro
/// This also supports other types which implement [`Try`], not just [`Result`].
///
/// ```
/// #![feature(generic_nonzero, try_find)]
/// #![feature(try_find)]
///
/// use std::num::NonZero;
///
/// let a = [3, 5, 7, 4, 9, 0, 11u32];

View File

@ -67,15 +67,15 @@ macro_rules! unlikely {
)]
pub use nonzero::ZeroablePrimitive;
#[unstable(feature = "generic_nonzero", issue = "120257")]
#[stable(feature = "generic_nonzero", since = "CURRENT_RUSTC_VERSION")]
pub use nonzero::NonZero;
#[stable(feature = "nonzero", since = "1.28.0")]
pub use nonzero::{NonZeroU128, NonZeroU16, NonZeroU32, NonZeroU64, NonZeroU8, NonZeroUsize};
#[stable(feature = "signed_nonzero", since = "1.34.0")]
pub use nonzero::{NonZeroI128, NonZeroI16, NonZeroI32, NonZeroI64, NonZeroI8, NonZeroIsize};
#[stable(feature = "nonzero", since = "1.28.0")]
pub use nonzero::{NonZeroU128, NonZeroU16, NonZeroU32, NonZeroU64, NonZeroU8, NonZeroUsize};
#[stable(feature = "try_from", since = "1.34.0")]
pub use error::TryFromIntError;

View File

@ -105,12 +105,11 @@ unsafe impl const ZeroablePrimitive for $primitive {
/// For example, `Option<NonZero<u32>>` is the same size as `u32`:
///
/// ```
/// #![feature(generic_nonzero)]
/// use core::mem::size_of;
/// use core::{mem::size_of, num::NonZero};
///
/// assert_eq!(size_of::<Option<core::num::NonZero<u32>>>(), size_of::<u32>());
/// assert_eq!(size_of::<Option<NonZero<u32>>>(), size_of::<u32>());
/// ```
#[unstable(feature = "generic_nonzero", issue = "120257")]
#[stable(feature = "generic_nonzero", since = "CURRENT_RUSTC_VERSION")]
#[repr(transparent)]
#[rustc_nonnull_optimization_guaranteed]
#[rustc_diagnostic_item = "NonZero"]
@ -562,7 +561,8 @@ pub const fn trailing_zeros(self) -> u32 {
/// Basic usage:
///
/// ```
/// #![feature(generic_nonzero, non_zero_count_ones)]
/// #![feature(non_zero_count_ones)]
///
/// # fn main() { test().unwrap(); }
/// # fn test() -> Option<()> {
/// # use std::num::*;

View File

@ -42,7 +42,6 @@
#![feature(float_minimum_maximum)]
#![feature(future_join)]
#![feature(generic_assert_internals)]
#![feature(generic_nonzero)]
#![feature(array_try_from_fn)]
#![feature(hasher_prefixfree_extras)]
#![feature(hashmap_internals)]

View File

@ -26,7 +26,6 @@
#![feature(staged_api)]
#![feature(allow_internal_unstable)]
#![feature(decl_macro)]
#![feature(generic_nonzero)]
#![feature(maybe_uninit_write_slice)]
#![feature(negative_impls)]
#![feature(new_uninit)]

View File

@ -335,7 +335,6 @@
#![feature(float_minimum_maximum)]
#![feature(float_next_up_down)]
#![feature(fmt_internals)]
#![feature(generic_nonzero)]
#![feature(hasher_prefixfree_extras)]
#![feature(hashmap_internals)]
#![feature(hint_assert_unchecked)]

View File

@ -23,11 +23,12 @@
)]
pub use core::num::ZeroablePrimitive;
#[unstable(feature = "generic_nonzero", issue = "120257")]
#[stable(feature = "generic_nonzero", since = "CURRENT_RUSTC_VERSION")]
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")]
pub use core::num::{NonZeroU128, NonZeroU16, NonZeroU32, NonZeroU64, NonZeroU8, NonZeroUsize};

View File

@ -1865,7 +1865,8 @@ pub fn code(&self) -> Option<i32> {
/// # Examples
///
/// ```
/// #![feature(exit_status_error, generic_nonzero)]
/// #![feature(exit_status_error)]
///
/// # if cfg!(unix) {
/// use std::num::NonZero;
/// use std::process::Command;

View File

@ -17,7 +17,6 @@
#![unstable(feature = "test", issue = "50297")]
#![doc(test(attr(deny(warnings))))]
#![doc(rust_logo)]
#![feature(generic_nonzero)]
#![feature(rustdoc_internals)]
#![feature(internal_output_capture)]
#![feature(staged_api)]

View File

@ -1,4 +1,3 @@
#![feature(generic_nonzero)]
#![feature(rustc_private, stmt_expr_attributes)]
#![allow(
clippy::manual_range_contains,

View File

@ -2,7 +2,6 @@
#![feature(cell_update)]
#![feature(const_option)]
#![feature(float_gamma)]
#![feature(generic_nonzero)]
#![feature(map_try_insert)]
#![feature(never_type)]
#![feature(try_blocks)]

View File

@ -1,7 +1,6 @@
//@ compile-flags: -O -Z merge-functions=disabled
//@ only-x86_64
#![crate_type = "lib"]
#![feature(generic_nonzero)]
// CHECK-LABEL: @array_eq_value
#[no_mangle]

View File

@ -7,7 +7,7 @@
// CHECK: {{.*}}DICompositeType{{.*}}tag: DW_TAG_variant_part,{{.*}}size: 32,{{.*}}
// CHECK: {{.*}}DIDerivedType{{.*}}tag: DW_TAG_member,{{.*}}name: "Placeholder",{{.*}}extraData: i128 4294967295{{[,)].*}}
// CHECK: {{.*}}DIDerivedType{{.*}}tag: DW_TAG_member,{{.*}}name: "Error",{{.*}}extraData: i128 0{{[,)].*}}
#![feature(generic_nonzero, never_type)]
#![feature(never_type)]
#[derive(Copy, Clone)]
pub struct Entity {

View File

@ -1,7 +1,6 @@
//@ compile-flags: -O -C no-prepopulate-passes
#![crate_type = "lib"]
#![feature(dyn_star)]
#![feature(generic_nonzero)]
#![feature(allocator_api)]
use std::mem::MaybeUninit;

View File

@ -3,7 +3,6 @@
//@ [DBG] compile-flags: -C opt-level=0 -C no-prepopulate-passes
//@ only-64bit (so I don't need to worry about usize)
#![crate_type = "lib"]
#![feature(generic_nonzero)]
use std::mem::transmute;
use std::num::NonZero;

View File

@ -4,7 +4,6 @@
//@ compile-flags: -O --edition=2021 -Zmerge-functions=disabled
//@ only-64bit (because the LLVM type of i64 for usize shows up)
#![crate_type = "lib"]
#![feature(generic_nonzero)]
use core::ptr::NonNull;
use core::num::NonZero;

View File

@ -1,7 +1,6 @@
//@ compile-flags: -C no-prepopulate-passes -Zmir-opt-level=0 -O
#![crate_type = "lib"]
#![feature(generic_nonzero)]
use std::mem::MaybeUninit;
use std::num::NonZero;

View File

@ -1,7 +1,6 @@
//@ compile-flags: -O -Z randomize-layout=no
//@ only-x86_64
#![crate_type = "lib"]
#![feature(generic_nonzero)]
extern crate core;

View File

@ -1,7 +1,6 @@
//@ compile-flags: -O -Zmerge-functions=disabled
//@ min-llvm-version: 18
#![crate_type = "lib"]
#![feature(generic_nonzero)]
extern crate core;
use core::cmp::Ordering;

View File

@ -1,6 +1,5 @@
//@ compile-flags: -O -Zmerge-functions=disabled
#![crate_type = "lib"]
#![feature(generic_nonzero)]
use std::num::NonZero;

View File

@ -1,6 +1,5 @@
//@ compile-flags: -O -Z merge-functions=disabled
#![crate_type = "lib"]
#![feature(generic_nonzero)]
// This tests that LLVM can optimize based on the niches in the source or
// destination types for transmutes.

View File

@ -132,7 +132,6 @@
// cdb-command: dx -r2 arbitrary_discr2,d
// cdb-check: arbitrary_discr2,d : Def [Type: enum2$<msvc_pretty_enums::ArbitraryDiscr>]
// cdb-check: [+0x[...]] __0 : 5678 [Type: unsigned int]
#![feature(generic_nonzero)]
#![feature(rustc_attrs)]
#![feature(repr128)]
#![feature(arbitrary_enum_discriminant)]

View File

@ -237,7 +237,6 @@
// lldb-command:v nz_usize
// lldb-check:[...] 122 { __0 = { 0 = 122 } }
#![feature(generic_nonzero)]
use std::num::*;
use std::sync::atomic::*;

View File

@ -3,7 +3,6 @@
#![crate_type = "lib"]
#![feature(core_intrinsics)]
#![feature(custom_mir)]
#![feature(generic_nonzero)]
use std::intrinsics::mir::*;
use std::mem::{MaybeUninit, ManuallyDrop, transmute};

View File

@ -64,7 +64,6 @@
[csky] needs-llvm-components: csky
*/
#![feature(rustc_attrs, unsized_fn_params, transparent_unions)]
#![cfg_attr(host, feature(generic_nonzero))]
#![cfg_attr(not(host), feature(no_core, lang_items), no_std, no_core)]
#![allow(unused, improper_ctypes_definitions, internal_features)]

View File

@ -3,7 +3,7 @@
// ignore-tidy-linelength
//@ normalize-stderr-test "╾─*ALLOC[0-9]+(\+[a-z0-9]+)?(<imm>)?─*╼" -> "╾ALLOC_ID$1╼"
#![allow(invalid_value)]
#![feature(generic_nonzero, never_type, rustc_attrs, ptr_metadata, slice_from_ptr_range, const_slice_from_ptr_range)]
#![feature(never_type, rustc_attrs, ptr_metadata, slice_from_ptr_range, const_slice_from_ptr_range)]
use std::mem;
use std::alloc::Layout;

View File

@ -2,7 +2,7 @@
//@ normalize-stderr-test "(the raw bytes of the constant) \(size: [0-9]*, align: [0-9]*\)" -> "$1 (size: $$SIZE, align: $$ALIGN)"
//@ normalize-stderr-test "([0-9a-f][0-9a-f] |╾─*ALLOC[0-9]+(\+[a-z0-9]+)?─*╼ )+ *│.*" -> "HEX_DUMP"
#![allow(invalid_value)] // make sure we cannot allow away the errors tested here
#![feature(generic_nonzero, rustc_attrs, ptr_metadata)]
#![feature(rustc_attrs, ptr_metadata)]
use std::mem;
use std::ptr::NonNull;

View File

@ -1,7 +1,6 @@
//@ check-pass
//
// Some constants that *are* valid
#![feature(generic_nonzero)]
use std::mem;
use std::ptr::NonNull;

View File

@ -1,7 +1,6 @@
//@ run-pass
//
// https://github.com/rust-lang/rust/issues/41898
#![feature(generic_nonzero)]
use std::num::NonZero;

View File

@ -7,7 +7,6 @@
//
// This test checks panic emitted from `mem::{uninitialized,zeroed}`.
#![allow(deprecated, invalid_value)]
#![feature(generic_nonzero)]
#![feature(never_type)]
use std::{

View File

@ -1,6 +1,5 @@
//@ check-pass
#![deny(improper_ctypes)]
#![feature(generic_nonzero)]
pub struct Error(std::num::NonZero<u32>);

View File

@ -6,7 +6,6 @@
//@ check-pass
//@ compile-flags: --crate-type=lib
//@ only-x86
#![feature(generic_nonzero)]
#![feature(repr_simd)]
use std::cell::{UnsafeCell, RefCell, Cell};

View File

@ -1,6 +1,5 @@
//@ normalize-stderr-test "pref: Align\([1-8] bytes\)" -> "pref: $$PREF_ALIGN"
#![crate_type = "lib"]
#![feature(generic_nonzero)]
#![feature(rustc_attrs)]
// Various tests around the behavior of zero-sized arrays and

View File

@ -98,7 +98,7 @@ error: layout_of(Result<[u32; 0], bool>) = Layout {
max_repr_align: None,
unadjusted_abi_align: Align(4 bytes),
}
--> $DIR/zero-sized-array-enum-niche.rs:14:1
--> $DIR/zero-sized-array-enum-niche.rs:13:1
|
LL | type AlignedResult = Result<[u32; 0], bool>;
| ^^^^^^^^^^^^^^^^^^
@ -227,7 +227,7 @@ error: layout_of(MultipleAlignments) = Layout {
max_repr_align: None,
unadjusted_abi_align: Align(4 bytes),
}
--> $DIR/zero-sized-array-enum-niche.rs:22:1
--> $DIR/zero-sized-array-enum-niche.rs:21:1
|
LL | enum MultipleAlignments {
| ^^^^^^^^^^^^^^^^^^^^^^^
@ -332,7 +332,7 @@ error: layout_of(Result<[u32; 0], Packed<NonZero<u16>>>) = Layout {
max_repr_align: None,
unadjusted_abi_align: Align(4 bytes),
}
--> $DIR/zero-sized-array-enum-niche.rs:38:1
--> $DIR/zero-sized-array-enum-niche.rs:37:1
|
LL | type NicheLosesToTagged = Result<[u32; 0], Packed<std::num::NonZero<u16>>>;
| ^^^^^^^^^^^^^^^^^^^^^^^
@ -441,7 +441,7 @@ error: layout_of(Result<[u32; 0], Packed<U16IsZero>>) = Layout {
max_repr_align: None,
unadjusted_abi_align: Align(4 bytes),
}
--> $DIR/zero-sized-array-enum-niche.rs:45:1
--> $DIR/zero-sized-array-enum-niche.rs:44:1
|
LL | type NicheWinsOverTagged = Result<[u32; 0], Packed<U16IsZero>>;
| ^^^^^^^^^^^^^^^^^^^^^^^^

View File

@ -2,7 +2,6 @@
//@ aux-build:external_extern_fn.rs
#![crate_type = "lib"]
#![warn(clashing_extern_declarations)]
#![feature(generic_nonzero)]
mod redeclared_different_signature {
mod a {

View File

@ -1,5 +1,5 @@
warning: `extern` block uses type `Option<TransparentNoNiche>`, which is not FFI-safe
--> $DIR/clashing-extern-fn.rs:430:55
--> $DIR/clashing-extern-fn.rs:429:55
|
LL | fn hidden_niche_transparent_no_niche() -> Option<TransparentNoNiche>;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ not FFI-safe
@ -9,7 +9,7 @@ LL | fn hidden_niche_transparent_no_niche() -> Option<TransparentNoN
= note: `#[warn(improper_ctypes)]` on by default
warning: `extern` block uses type `Option<UnsafeCell<NonZero<usize>>>`, which is not FFI-safe
--> $DIR/clashing-extern-fn.rs:434:46
--> $DIR/clashing-extern-fn.rs:433:46
|
LL | fn hidden_niche_unsafe_cell() -> Option<UnsafeCell<NonZero<usize>>>;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ not FFI-safe
@ -18,7 +18,7 @@ LL | fn hidden_niche_unsafe_cell() -> Option<UnsafeCell<NonZero<usiz
= note: enum has no representation hint
warning: `clash` redeclared with a different signature
--> $DIR/clashing-extern-fn.rs:15:13
--> $DIR/clashing-extern-fn.rs:14:13
|
LL | fn clash(x: u8);
| --------------- `clash` previously declared here
@ -35,7 +35,7 @@ LL | #![warn(clashing_extern_declarations)]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
warning: `extern_link_name` redeclared with a different signature
--> $DIR/clashing-extern-fn.rs:53:9
--> $DIR/clashing-extern-fn.rs:52:9
|
LL | #[link_name = "extern_link_name"]
| --------------------------------- `extern_link_name` previously declared here
@ -47,7 +47,7 @@ LL | fn extern_link_name(x: u32);
found `unsafe extern "C" fn(u32)`
warning: `some_other_extern_link_name` redeclares `some_other_new_name` with a different signature
--> $DIR/clashing-extern-fn.rs:56:9
--> $DIR/clashing-extern-fn.rs:55:9
|
LL | fn some_other_new_name(x: i16);
| ------------------------------ `some_other_new_name` previously declared here
@ -59,7 +59,7 @@ LL | #[link_name = "some_other_new_name"]
found `unsafe extern "C" fn(u32)`
warning: `other_both_names_different` redeclares `link_name_same` with a different signature
--> $DIR/clashing-extern-fn.rs:60:9
--> $DIR/clashing-extern-fn.rs:59:9
|
LL | #[link_name = "link_name_same"]
| ------------------------------- `link_name_same` previously declared here
@ -71,7 +71,7 @@ LL | #[link_name = "link_name_same"]
found `unsafe extern "C" fn(u32)`
warning: `different_mod` redeclared with a different signature
--> $DIR/clashing-extern-fn.rs:73:9
--> $DIR/clashing-extern-fn.rs:72:9
|
LL | fn different_mod(x: u8);
| ----------------------- `different_mod` previously declared here
@ -83,7 +83,7 @@ LL | fn different_mod(x: u64);
found `unsafe extern "C" fn(u64)`
warning: `variadic_decl` redeclared with a different signature
--> $DIR/clashing-extern-fn.rs:83:9
--> $DIR/clashing-extern-fn.rs:82:9
|
LL | fn variadic_decl(x: u8, ...);
| ---------------------------- `variadic_decl` previously declared here
@ -95,7 +95,7 @@ LL | fn variadic_decl(x: u8);
found `unsafe extern "C" fn(u8)`
warning: `weigh_banana` redeclared with a different signature
--> $DIR/clashing-extern-fn.rs:143:13
--> $DIR/clashing-extern-fn.rs:142:13
|
LL | fn weigh_banana(count: *const Banana) -> u64;
| -------------------------------------------- `weigh_banana` previously declared here
@ -107,7 +107,7 @@ LL | fn weigh_banana(count: *const Banana) -> u64;
found `unsafe extern "C" fn(*const three::Banana) -> u64`
warning: `draw_point` redeclared with a different signature
--> $DIR/clashing-extern-fn.rs:172:13
--> $DIR/clashing-extern-fn.rs:171:13
|
LL | fn draw_point(p: Point);
| ----------------------- `draw_point` previously declared here
@ -119,7 +119,7 @@ LL | fn draw_point(p: Point);
found `unsafe extern "C" fn(sameish_members::b::Point)`
warning: `origin` redeclared with a different signature
--> $DIR/clashing-extern-fn.rs:198:13
--> $DIR/clashing-extern-fn.rs:197:13
|
LL | fn origin() -> Point3;
| --------------------- `origin` previously declared here
@ -131,7 +131,7 @@ LL | fn origin() -> Point3;
found `unsafe extern "C" fn() -> same_sized_members_clash::b::Point3`
warning: `transparent_incorrect` redeclared with a different signature
--> $DIR/clashing-extern-fn.rs:221:13
--> $DIR/clashing-extern-fn.rs:220:13
|
LL | fn transparent_incorrect() -> T;
| ------------------------------- `transparent_incorrect` previously declared here
@ -143,7 +143,7 @@ LL | fn transparent_incorrect() -> isize;
found `unsafe extern "C" fn() -> isize`
warning: `missing_return_type` redeclared with a different signature
--> $DIR/clashing-extern-fn.rs:260:13
--> $DIR/clashing-extern-fn.rs:259:13
|
LL | fn missing_return_type() -> usize;
| --------------------------------- `missing_return_type` previously declared here
@ -155,7 +155,7 @@ LL | fn missing_return_type();
found `unsafe extern "C" fn()`
warning: `non_zero_usize` redeclared with a different signature
--> $DIR/clashing-extern-fn.rs:278:13
--> $DIR/clashing-extern-fn.rs:277:13
|
LL | fn non_zero_usize() -> core::num::NonZero<usize>;
| ------------------------------------------------ `non_zero_usize` previously declared here
@ -167,7 +167,7 @@ LL | fn non_zero_usize() -> usize;
found `unsafe extern "C" fn() -> usize`
warning: `non_null_ptr` redeclared with a different signature
--> $DIR/clashing-extern-fn.rs:280:13
--> $DIR/clashing-extern-fn.rs:279:13
|
LL | fn non_null_ptr() -> core::ptr::NonNull<usize>;
| ---------------------------------------------- `non_null_ptr` previously declared here
@ -179,7 +179,7 @@ LL | fn non_null_ptr() -> *const usize;
found `unsafe extern "C" fn() -> *const usize`
warning: `option_non_zero_usize_incorrect` redeclared with a different signature
--> $DIR/clashing-extern-fn.rs:374:13
--> $DIR/clashing-extern-fn.rs:373:13
|
LL | fn option_non_zero_usize_incorrect() -> usize;
| --------------------------------------------- `option_non_zero_usize_incorrect` previously declared here
@ -191,7 +191,7 @@ LL | fn option_non_zero_usize_incorrect() -> isize;
found `unsafe extern "C" fn() -> isize`
warning: `option_non_null_ptr_incorrect` redeclared with a different signature
--> $DIR/clashing-extern-fn.rs:376:13
--> $DIR/clashing-extern-fn.rs:375:13
|
LL | fn option_non_null_ptr_incorrect() -> *const usize;
| -------------------------------------------------- `option_non_null_ptr_incorrect` previously declared here
@ -203,7 +203,7 @@ LL | fn option_non_null_ptr_incorrect() -> *const isize;
found `unsafe extern "C" fn() -> *const isize`
warning: `hidden_niche_transparent_no_niche` redeclared with a different signature
--> $DIR/clashing-extern-fn.rs:430:13
--> $DIR/clashing-extern-fn.rs:429:13
|
LL | fn hidden_niche_transparent_no_niche() -> usize;
| ----------------------------------------------- `hidden_niche_transparent_no_niche` previously declared here
@ -215,7 +215,7 @@ LL | fn hidden_niche_transparent_no_niche() -> Option<TransparentNoN
found `unsafe extern "C" fn() -> Option<TransparentNoNiche>`
warning: `hidden_niche_unsafe_cell` redeclared with a different signature
--> $DIR/clashing-extern-fn.rs:434:13
--> $DIR/clashing-extern-fn.rs:433:13
|
LL | fn hidden_niche_unsafe_cell() -> usize;
| -------------------------------------- `hidden_niche_unsafe_cell` previously declared here

View File

@ -2,7 +2,7 @@
// in a lint.
#![allow(deprecated)]
#![deny(invalid_value)]
#![feature(generic_nonzero, never_type, rustc_attrs)]
#![feature(never_type, rustc_attrs)]
use std::mem::{self, MaybeUninit};
use std::ptr::NonNull;

View File

@ -1,6 +1,5 @@
#![allow(dead_code)]
#![deny(improper_ctypes)]
#![feature(generic_nonzero)]
#![feature(ptr_internals)]
#![feature(transparent_unions)]

View File

@ -1,5 +1,5 @@
error: `extern` block uses type `U`, which is not FFI-safe
--> $DIR/lint-ctypes-enum.rs:61:13
--> $DIR/lint-ctypes-enum.rs:60:13
|
LL | fn uf(x: U);
| ^ not FFI-safe
@ -7,7 +7,7 @@ LL | fn uf(x: U);
= help: consider adding a `#[repr(C)]`, `#[repr(transparent)]`, or integer `#[repr(...)]` attribute to this enum
= note: enum has no representation hint
note: the type is defined here
--> $DIR/lint-ctypes-enum.rs:10:1
--> $DIR/lint-ctypes-enum.rs:9:1
|
LL | enum U {
| ^^^^^^
@ -18,7 +18,7 @@ LL | #![deny(improper_ctypes)]
| ^^^^^^^^^^^^^^^
error: `extern` block uses type `B`, which is not FFI-safe
--> $DIR/lint-ctypes-enum.rs:62:13
--> $DIR/lint-ctypes-enum.rs:61:13
|
LL | fn bf(x: B);
| ^ not FFI-safe
@ -26,13 +26,13 @@ LL | fn bf(x: B);
= help: consider adding a `#[repr(C)]`, `#[repr(transparent)]`, or integer `#[repr(...)]` attribute to this enum
= note: enum has no representation hint
note: the type is defined here
--> $DIR/lint-ctypes-enum.rs:13:1
--> $DIR/lint-ctypes-enum.rs:12:1
|
LL | enum B {
| ^^^^^^
error: `extern` block uses type `T`, which is not FFI-safe
--> $DIR/lint-ctypes-enum.rs:63:13
--> $DIR/lint-ctypes-enum.rs:62:13
|
LL | fn tf(x: T);
| ^ not FFI-safe
@ -40,13 +40,13 @@ LL | fn tf(x: T);
= help: consider adding a `#[repr(C)]`, `#[repr(transparent)]`, or integer `#[repr(...)]` attribute to this enum
= note: enum has no representation hint
note: the type is defined here
--> $DIR/lint-ctypes-enum.rs:17:1
--> $DIR/lint-ctypes-enum.rs:16:1
|
LL | enum T {
| ^^^^^^
error: `extern` block uses type `u128`, which is not FFI-safe
--> $DIR/lint-ctypes-enum.rs:75:23
--> $DIR/lint-ctypes-enum.rs:74:23
|
LL | fn nonzero_u128(x: Option<num::NonZero<u128>>);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ not FFI-safe
@ -54,7 +54,7 @@ LL | fn nonzero_u128(x: Option<num::NonZero<u128>>);
= note: 128-bit integers don't currently have a known stable ABI
error: `extern` block uses type `i128`, which is not FFI-safe
--> $DIR/lint-ctypes-enum.rs:82:23
--> $DIR/lint-ctypes-enum.rs:81:23
|
LL | fn nonzero_i128(x: Option<num::NonZero<i128>>);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ not FFI-safe
@ -62,7 +62,7 @@ LL | fn nonzero_i128(x: Option<num::NonZero<i128>>);
= note: 128-bit integers don't currently have a known stable ABI
error: `extern` block uses type `Option<TransparentUnion<NonZero<u8>>>`, which is not FFI-safe
--> $DIR/lint-ctypes-enum.rs:87:28
--> $DIR/lint-ctypes-enum.rs:86:28
|
LL | fn transparent_union(x: Option<TransparentUnion<num::NonZero<u8>>>);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ not FFI-safe
@ -71,7 +71,7 @@ LL | fn transparent_union(x: Option<TransparentUnion<num::NonZero<u8>>>);
= note: enum has no representation hint
error: `extern` block uses type `Option<Rust<NonZero<u8>>>`, which is not FFI-safe
--> $DIR/lint-ctypes-enum.rs:89:20
--> $DIR/lint-ctypes-enum.rs:88:20
|
LL | fn repr_rust(x: Option<Rust<num::NonZero<u8>>>);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ not FFI-safe
@ -80,7 +80,7 @@ LL | fn repr_rust(x: Option<Rust<num::NonZero<u8>>>);
= note: enum has no representation hint
error: `extern` block uses type `Result<(), NonZero<i32>>`, which is not FFI-safe
--> $DIR/lint-ctypes-enum.rs:90:20
--> $DIR/lint-ctypes-enum.rs:89:20
|
LL | fn no_result(x: Result<(), num::NonZero<i32>>);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ not FFI-safe

View File

@ -3,7 +3,6 @@
//@ ignore-emscripten no processes
//@ compile-flags: -C debug-assertions
#![allow(arithmetic_overflow)]
#![feature(generic_nonzero)]
use std::num::NonZero;

View File

@ -15,7 +15,6 @@
// ^-- needed because `--pass check` does not emit the output needed.
// FIXME: consider using an attribute instead of side-effects.
#![allow(dead_code)]
#![feature(generic_nonzero)]
#![feature(rustc_attrs)]
use std::num::NonZero;

View File

@ -1,5 +1,4 @@
//@ run-pass
#![feature(generic_nonzero)]
#![feature(transparent_unions)]
use std::mem::size_of;

View File

@ -1,5 +1,5 @@
warning: method `dummy` is never used
--> $DIR/enum-null-pointer-opt.rs:11:18
--> $DIR/enum-null-pointer-opt.rs:10:18
|
LL | trait Trait { fn dummy(&self) { } }
| ----- ^^^^^

View File

@ -2,7 +2,6 @@
#![allow(non_camel_case_types)]
#![allow(dead_code)]
#![feature(generic_nonzero)]
#![feature(never_type)]
#![feature(pointer_is_aligned_to)]
#![feature(strict_provenance)]

View File

@ -2,7 +2,6 @@
//
// This is a regression test for #83564.
// For some reason, Rust 2018 or higher is required to reproduce the bug.
#![feature(generic_nonzero)]
fn main() {
//~^ HELP consider importing one of these items

View File

@ -1,5 +1,5 @@
error[E0433]: failed to resolve: use of undeclared type `NonZero`
--> $DIR/core-std-import-order-issue-83564.rs:9:14
--> $DIR/core-std-import-order-issue-83564.rs:8:14
|
LL | let _x = NonZero::new(5u32).unwrap();
| ^^^^^^^ use of undeclared type `NonZero`

View File

@ -1,6 +1,5 @@
//@ compile-flags: -Znext-solver
//~^ ERROR cannot normalize `<T as Default>::Id: '_`
#![feature(generic_nonzero)]
#![feature(specialization)]
//~^ WARN the feature `specialization` is incomplete

View File

@ -1,5 +1,5 @@
warning: the feature `specialization` is incomplete and may not be safe to use and/or cause compiler crashes
--> $DIR/specialization-transmute.rs:4:12
--> $DIR/specialization-transmute.rs:3:12
|
LL | #![feature(specialization)]
| ^^^^^^^^^^^^^^
@ -11,31 +11,31 @@ LL | #![feature(specialization)]
error: cannot normalize `<T as Default>::Id: '_`
error[E0284]: type annotations needed: cannot satisfy `<T as Default>::Id == _`
--> $DIR/specialization-transmute.rs:16:23
--> $DIR/specialization-transmute.rs:15:23
|
LL | fn intu(&self) -> &Self::Id {
| ^^^^^^^^^ cannot satisfy `<T as Default>::Id == _`
error[E0284]: type annotations needed: cannot satisfy `T <: <T as Default>::Id`
--> $DIR/specialization-transmute.rs:18:9
--> $DIR/specialization-transmute.rs:17:9
|
LL | self
| ^^^^ cannot satisfy `T <: <T as Default>::Id`
error[E0284]: type annotations needed: cannot satisfy `<u8 as Default>::Id == Option<NonZero<u8>>`
--> $DIR/specialization-transmute.rs:29:13
--> $DIR/specialization-transmute.rs:28:13
|
LL | let s = transmute::<u8, Option<NonZero<u8>>>(0);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot satisfy `<u8 as Default>::Id == Option<NonZero<u8>>`
|
note: required by a bound in `transmute`
--> $DIR/specialization-transmute.rs:22:25
--> $DIR/specialization-transmute.rs:21:25
|
LL | fn transmute<T: Default<Id = U>, U: Copy>(t: T) -> U {
| ^^^^^^ required by this bound in `transmute`
error[E0282]: type annotations needed
--> $DIR/specialization-transmute.rs:14:23
--> $DIR/specialization-transmute.rs:13:23
|
LL | default type Id = T;
| ^ cannot infer type for associated type `<T as Default>::Id`