Rollup merge of #126552 - fee1-dead-contrib:rmfx, r=compiler-errors

Remove use of const traits (and `feature(effects)`) from stdlib

The current uses are already unsound because they are using non-const impls in const contexts. We can reintroduce them by reverting the commit in this PR, after #120639 lands.

Also, make `effects` an incomplete feature.

cc `@rust-lang/project-const-traits`
r? `@compiler-errors`
This commit is contained in:
Matthias Krüger 2024-06-22 19:33:56 +02:00 committed by GitHub
commit dc9a08f535
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
160 changed files with 1859 additions and 311 deletions

View File

@ -449,7 +449,7 @@ pub fn internal(&self, feature: Symbol) -> bool {
/// Allows `dyn* Trait` objects.
(incomplete, dyn_star, "1.65.0", Some(102425)),
/// Uses generic effect parameters for ~const bounds
(unstable, effects, "1.72.0", Some(102090)),
(incomplete, effects, "1.72.0", Some(102090)),
/// Allows exhaustive pattern matching on types that contain uninhabited types.
(unstable, exhaustive_patterns, "1.13.0", Some(51085)),
/// Allows explicit tail calls via `become` expression.

View File

@ -429,17 +429,17 @@ pub fn check_intrinsic_type(
sym::ptr_guaranteed_cmp => (
1,
1,
0,
vec![Ty::new_imm_ptr(tcx, param(0)), Ty::new_imm_ptr(tcx, param(0))],
tcx.types.u8,
),
sym::const_allocate => {
(0, 1, vec![tcx.types.usize, tcx.types.usize], Ty::new_mut_ptr(tcx, tcx.types.u8))
(0, 0, vec![tcx.types.usize, tcx.types.usize], Ty::new_mut_ptr(tcx, tcx.types.u8))
}
sym::const_deallocate => (
0,
1,
0,
vec![Ty::new_mut_ptr(tcx, tcx.types.u8), tcx.types.usize, tcx.types.usize],
tcx.types.unit,
),
@ -478,16 +478,16 @@ pub fn check_intrinsic_type(
| sym::frem_algebraic => (1, 0, vec![param(0), param(0)], param(0)),
sym::float_to_int_unchecked => (2, 0, vec![param(0)], param(1)),
sym::assume => (0, 1, vec![tcx.types.bool], tcx.types.unit),
sym::likely => (0, 1, vec![tcx.types.bool], tcx.types.bool),
sym::unlikely => (0, 1, vec![tcx.types.bool], tcx.types.bool),
sym::assume => (0, 0, vec![tcx.types.bool], tcx.types.unit),
sym::likely => (0, 0, vec![tcx.types.bool], tcx.types.bool),
sym::unlikely => (0, 0, vec![tcx.types.bool], tcx.types.bool),
sym::read_via_copy => (1, 0, vec![Ty::new_imm_ptr(tcx, param(0))], param(0)),
sym::write_via_move => {
(1, 0, vec![Ty::new_mut_ptr(tcx, param(0)), param(0)], tcx.types.unit)
}
sym::typed_swap => (1, 1, vec![Ty::new_mut_ptr(tcx, param(0)); 2], tcx.types.unit),
sym::typed_swap => (1, 0, vec![Ty::new_mut_ptr(tcx, param(0)); 2], tcx.types.unit),
sym::discriminant_value => {
let assoc_items = tcx.associated_item_def_ids(
@ -566,9 +566,9 @@ pub fn check_intrinsic_type(
sym::black_box => (1, 0, vec![param(0)], param(0)),
sym::is_val_statically_known => (1, 1, vec![param(0)], tcx.types.bool),
sym::is_val_statically_known => (1, 0, vec![param(0)], tcx.types.bool),
sym::const_eval_select => (4, 1, vec![param(0), param(1), param(2)], param(3)),
sym::const_eval_select => (4, 0, vec![param(0), param(1), param(2)], param(3)),
sym::vtable_size | sym::vtable_align => {
(0, 0, vec![Ty::new_imm_ptr(tcx, tcx.types.unit)], tcx.types.usize)
@ -576,10 +576,10 @@ pub fn check_intrinsic_type(
// This type check is not particularly useful, but the `where` bounds
// on the definition in `core` do the heavy lifting for checking it.
sym::aggregate_raw_ptr => (3, 1, vec![param(1), param(2)], param(0)),
sym::ptr_metadata => (2, 1, vec![Ty::new_imm_ptr(tcx, param(0))], param(1)),
sym::aggregate_raw_ptr => (3, 0, vec![param(1), param(2)], param(0)),
sym::ptr_metadata => (2, 0, vec![Ty::new_imm_ptr(tcx, param(0))], param(1)),
sym::ub_checks => (0, 1, Vec::new(), tcx.types.bool),
sym::ub_checks => (0, 0, Vec::new(), tcx.types.bool),
sym::simd_eq
| sym::simd_ne

View File

@ -175,7 +175,6 @@
#![feature(const_mut_refs)]
#![feature(const_precise_live_drops)]
#![feature(const_ptr_write)]
#![feature(const_trait_impl)]
#![feature(const_try)]
#![feature(decl_macro)]
#![feature(dropck_eyepatch)]

View File

@ -245,7 +245,6 @@
append_const_msg
)]
#[rustc_diagnostic_item = "PartialEq"]
#[const_trait]
pub trait PartialEq<Rhs: ?Sized = Self> {
/// This method tests for `self` and `other` values to be equal, and is used
/// by `==`.
@ -1475,8 +1474,7 @@ mod impls {
macro_rules! partial_eq_impl {
($($t:ty)*) => ($(
#[stable(feature = "rust1", since = "1.0.0")]
#[rustc_const_unstable(feature = "const_cmp", issue = "92391")]
impl const PartialEq for $t {
impl PartialEq for $t {
#[inline]
fn eq(&self, other: &$t) -> bool { (*self) == (*other) }
#[inline]

View File

@ -60,7 +60,7 @@
const fn escape_unicode<const N: usize>(c: char) -> ([ascii::Char; N], Range<u8>) {
const { assert!(N >= 10 && N < u8::MAX as usize) };
let c = u32::from(c);
let c = c as u32;
// OR-ing `1` ensures that for `c == 0` the code computes that
// one digit should be printed.

View File

@ -515,7 +515,10 @@ pub const fn as_ptr(&self) -> *const c_char {
#[inline]
#[must_use]
const fn as_non_null_ptr(&self) -> NonNull<c_char> {
NonNull::from(&self.inner).as_non_null_ptr()
// FIXME(effects) replace with `NonNull::from`
// SAFETY: a reference is never null
unsafe { NonNull::new_unchecked(&self.inner as *const [c_char] as *mut [c_char]) }
.as_non_null_ptr()
}
/// Returns the length of `self`. Like C's `strlen`, this does not include the nul terminator.

View File

@ -200,6 +200,7 @@
// Language features:
// tidy-alphabetical-start
#![cfg_attr(bootstrap, feature(c_unwind))]
#![cfg_attr(bootstrap, feature(effects))]
#![feature(abi_unadjusted)]
#![feature(adt_const_params)]
#![feature(allow_internal_unsafe)]
@ -214,13 +215,11 @@
#![feature(const_mut_refs)]
#![feature(const_precise_live_drops)]
#![feature(const_refs_to_cell)]
#![feature(const_trait_impl)]
#![feature(decl_macro)]
#![feature(deprecated_suggestion)]
#![feature(doc_cfg)]
#![feature(doc_cfg_hide)]
#![feature(doc_notable_trait)]
#![feature(effects)]
#![feature(extern_types)]
#![feature(f128)]
#![feature(f16)]

View File

@ -944,7 +944,6 @@ impl !Unpin for PhantomPinned {}
#[lang = "destruct"]
#[rustc_on_unimplemented(message = "can't drop `{Self}`", append_const_msg)]
#[rustc_deny_explicit_impl(implement_via_object = false)]
#[const_trait]
pub trait Destruct {}
/// A marker for tuple types.

View File

@ -33,7 +33,6 @@
reason = "implementation detail which may disappear or be replaced at any time",
issue = "none"
)]
#[const_trait]
pub unsafe trait ZeroablePrimitive: Sized + Copy + private::Sealed {
#[doc(hidden)]
type NonZeroInner: Sized + Copy;
@ -47,7 +46,6 @@ mod private {
reason = "implementation detail which may disappear or be replaced at any time",
issue = "none"
)]
#[const_trait]
pub trait Sealed {}
$(
@ -70,14 +68,14 @@ pub trait Sealed {}
reason = "implementation detail which may disappear or be replaced at any time",
issue = "none"
)]
impl const private::Sealed for $primitive {}
impl private::Sealed for $primitive {}
#[unstable(
feature = "nonzero_internals",
reason = "implementation detail which may disappear or be replaced at any time",
issue = "none"
)]
unsafe impl const ZeroablePrimitive for $primitive {
unsafe impl ZeroablePrimitive for $primitive {
type NonZeroInner = private::$NonZeroInner;
}
)+

View File

@ -73,7 +73,6 @@
append_const_msg
)]
#[doc(alias = "+")]
#[const_trait]
pub trait Add<Rhs = Self> {
/// The resulting type after applying the `+` operator.
#[stable(feature = "rust1", since = "1.0.0")]
@ -95,8 +94,7 @@ pub trait Add<Rhs = Self> {
macro_rules! add_impl {
($($t:ty)*) => ($(
#[stable(feature = "rust1", since = "1.0.0")]
#[rustc_const_unstable(feature = "const_ops", issue = "90080")]
impl const Add for $t {
impl Add for $t {
type Output = $t;
#[inline]

View File

@ -282,7 +282,7 @@ pub const fn local_waker(&self) -> &'a LocalWaker {
pub const fn ext(&mut self) -> &mut dyn Any {
// FIXME: this field makes Context extra-weird about unwind safety
// can we justify AssertUnwindSafe if we stabilize this? do we care?
match &mut *self.ext {
match &mut self.ext.0 {
ExtData::Some(data) => *data,
ExtData::None(unit) => unit,
}
@ -356,7 +356,7 @@ pub const fn from_waker(waker: &'a Waker) -> Self {
#[rustc_const_unstable(feature = "const_waker", issue = "102012")]
#[unstable(feature = "context_ext", issue = "123392")]
pub const fn from(cx: &'a mut Context<'_>) -> Self {
let ext = match &mut *cx.ext {
let ext = match &mut cx.ext.0 {
ExtData::Some(ext) => ExtData::Some(*ext),
ExtData::None(()) => ExtData::None(()),
};

View File

@ -284,7 +284,6 @@
#![feature(cfi_encoding)]
#![feature(concat_idents)]
#![feature(const_mut_refs)]
#![feature(const_trait_impl)]
#![feature(decl_macro)]
#![feature(deprecated_suggestion)]
#![feature(doc_cfg)]

View File

@ -18,7 +18,7 @@ All intrinsic fallback bodies are automatically made cross-crate inlineable (lik
by the codegen backend, but not the MIR inliner.
```rust
#![feature(rustc_attrs, effects)]
#![feature(rustc_attrs)]
#![allow(internal_features)]
#[rustc_intrinsic]
@ -28,7 +28,7 @@ const unsafe fn const_deallocate(_ptr: *mut u8, _size: usize, _align: usize) {}
Since these are just regular functions, it is perfectly ok to create the intrinsic twice:
```rust
#![feature(rustc_attrs, effects)]
#![feature(rustc_attrs)]
#![allow(internal_features)]
#[rustc_intrinsic]

View File

@ -1,4 +1,4 @@
#![feature(rustc_attrs, effects)]
#![feature(rustc_attrs)]
#[rustc_intrinsic]
#[rustc_nounwind]

View File

@ -1,10 +0,0 @@
//@ known-bug: #120503
#![feature(effects)]
trait MyTrait {}
impl MyTrait for i32 {
async const fn bar(&self) {
main8().await;
}
}

View File

@ -1,20 +0,0 @@
//@ known-bug: #121536
#![feature(effects)]
#[derive(Debug, Clone, Copy)]
pub struct Vec3 {
pub x: f32,
pub y: f32,
pub z: f32,
}
impl std::ops::Add<Vec3> for Vec3 {
type Output = Vec3;
const fn add(self, b: Vec3) -> Self::Output {
Vec3 {
x: self.x + b.x,
y: self.y + b.y,
z: self.z + b.z,
}
}
}

View File

@ -2,6 +2,7 @@
#![crate_name = "foo"]
#![feature(effects, const_trait_impl)]
#![allow(incomplete_features)]
#[const_trait]
pub trait Tr {

View File

@ -1,5 +1,6 @@
#![crate_name = "foo"]
#![feature(effects)]
#![allow(incomplete_features)]
// @has foo/fn.bar.html
// @has - '//pre[@class="rust item-decl"]' 'pub const fn bar() -> '

View File

@ -7,6 +7,7 @@
// not remove this test.
//
// FIXME(effects) add `const_trait` to `Fn` so we use `~const`
// FIXME(effects) restore `const_trait` to `Destruct`
#![feature(const_trait_impl)]
#![crate_name = "foo"]
@ -24,9 +25,9 @@ pub trait Tr<T> {
// @has - '//section[@id="method.a"]/h4[@class="code-header"]/a[@class="trait"]' 'Fn'
// @!has - '//section[@id="method.a"]/h4[@class="code-header"]/span[@class="where"]' '~const'
// @has - '//section[@id="method.a"]/h4[@class="code-header"]/div[@class="where"]' ': Fn'
fn a<A: /* ~const */ Fn() + ~const Destruct>()
fn a<A: /* ~const */ Fn() /* + ~const Destruct */>()
where
Option<A>: /* ~const */ Fn() + ~const Destruct,
Option<A>: /* ~const */ Fn() /* + ~const Destruct */,
{
}
}
@ -36,13 +37,13 @@ fn a<A: /* ~const */ Fn() + ~const Destruct>()
// @has - '//section[@id="impl-Tr%3CT%3E-for-T"]/h3[@class="code-header"]/a[@class="trait"]' 'Fn'
// @!has - '//section[@id="impl-Tr%3CT%3E-for-T"]/h3[@class="code-header"]/span[@class="where"]' '~const'
// @has - '//section[@id="impl-Tr%3CT%3E-for-T"]/h3[@class="code-header"]/div[@class="where"]' ': Fn'
impl<T: /* ~const */ Fn() + ~const Destruct> const Tr<T> for T
impl<T: /* ~const */ Fn() /* + ~const Destruct */> const Tr<T> for T
where
Option<T>: /* ~const */ Fn() + ~const Destruct,
Option<T>: /* ~const */ Fn() /* + ~const Destruct */,
{
fn a<A: /* ~const */ Fn() + ~const Destruct>()
fn a<A: /* ~const */ Fn() /* + ~const Destruct */>()
where
Option<A>: /* ~const */ Fn() + ~const Destruct,
Option<A>: /* ~const */ Fn() /* + ~const Destruct */,
{
}
}
@ -51,9 +52,9 @@ fn a<A: /* ~const */ Fn() + ~const Destruct>()
// @has - '//pre[@class="rust item-decl"]/code/a[@class="trait"]' 'Fn'
// @!has - '//pre[@class="rust item-decl"]/code/div[@class="where"]' '~const'
// @has - '//pre[@class="rust item-decl"]/code/div[@class="where"]' ': Fn'
pub const fn foo<F: /* ~const */ Fn() + ~const Destruct>()
pub const fn foo<F: /* ~const */ Fn() /* + ~const Destruct */>()
where
Option<F>: /* ~const */ Fn() + ~const Destruct,
Option<F>: /* ~const */ Fn() /* + ~const Destruct */,
{
F::a()
}
@ -63,9 +64,9 @@ impl<T> S<T> {
// @has - '//section[@id="method.foo"]/h4[@class="code-header"]/a[@class="trait"]' 'Fn'
// @!has - '//section[@id="method.foo"]/h4[@class="code-header"]/span[@class="where"]' '~const'
// @has - '//section[@id="method.foo"]/h4[@class="code-header"]/div[@class="where"]' ': Fn'
pub const fn foo<B, C: /* ~const */ Fn() + ~const Destruct>()
pub const fn foo<B, C: /* ~const */ Fn() /* + ~const Destruct */>()
where
B: /* ~const */ Fn() + ~const Destruct,
B: /* ~const */ Fn() /* + ~const Destruct */,
{
B::a()
}

View File

@ -1,6 +1,6 @@
//@ build-pass
#![feature(const_trait_impl, effects)]
#![feature(const_trait_impl, effects)] //~ WARN the feature `effects` is incomplete
#[const_trait]
trait Func<T> {

View File

@ -0,0 +1,11 @@
warning: the feature `effects` is incomplete and may not be safe to use and/or cause compiler crashes
--> $DIR/const_trait_fn-issue-88433.rs:3:30
|
LL | #![feature(const_trait_impl, effects)]
| ^^^^^^^
|
= note: see issue #102090 <https://github.com/rust-lang/rust/issues/102090> for more information
= note: `#[warn(incomplete_features)]` on by default
warning: 1 warning emitted

View File

@ -1,5 +1,5 @@
#![crate_type = "lib"]
#![feature(const_closures, const_trait_impl, effects)]
#![feature(const_closures, const_trait_impl, effects)] //~ WARN the feature `effects` is incomplete
pub const fn test() {
let cl = const || {};

View File

@ -1,3 +1,9 @@
error: `~const` can only be applied to `#[const_trait]` traits
--> $DIR/const-block-const-bound.rs:8:22
|
LL | const fn f<T: ~const Destruct>(x: T) {}
| ^^^^^^^^
error[E0493]: destructor of `T` cannot be evaluated at compile-time
--> $DIR/const-block-const-bound.rs:8:32
|
@ -6,6 +12,6 @@ LL | const fn f<T: ~const Destruct>(x: T) {}
| |
| the destructor for this type cannot be evaluated in constant functions
error: aborting due to 1 previous error
error: aborting due to 2 previous errors
For more information about this error, try `rustc --explain E0493`.

View File

@ -1,5 +1,6 @@
//@ compile-flags: -Zmir-opt-level=0
//@ run-pass
//@ known-bug: #110395
// FIXME(effects) run-pass
#![feature(const_float_bits_conv)]
#![feature(const_float_classify)]

View File

@ -0,0 +1,223 @@
warning: the feature `effects` is incomplete and may not be safe to use and/or cause compiler crashes
--> $DIR/const-float-classify.rs:7:30
|
LL | #![feature(const_trait_impl, effects)]
| ^^^^^^^
|
= note: see issue #102090 <https://github.com/rust-lang/rust/issues/102090> for more information
= note: `#[warn(incomplete_features)]` on by default
error: const `impl` for trait `PartialEq` which is not marked with `#[const_trait]`
--> $DIR/const-float-classify.rs:12:12
|
LL | impl const PartialEq<NonDet> for bool {
| ^^^^^^^^^^^^^^^^^
|
= note: marking a trait with `#[const_trait]` ensures all default method bodies are `const`
= note: adding a non-const method body in the future would be a breaking change
error[E0207]: the const parameter `host` is not constrained by the impl trait, self type, or predicates
--> $DIR/const-float-classify.rs:12:6
|
LL | impl const PartialEq<NonDet> for bool {
| ^^^^^ unconstrained const parameter
|
= note: expressions using a const parameter must map each value to a distinct output value
= note: proving the result of expressions other than the parameter are unique is not supported
error[E0284]: type annotations needed
--> $DIR/const-float-classify.rs:21:35
|
LL | const _: () = assert!($a == $b);
| ^^ cannot infer the value of the constant `_`
...
LL | / suite! {
LL | | [is_nan, is_infinite, is_finite, is_normal, is_sign_positive, is_sign_negative]
LL | | -0.0 / 0.0 => [ true, false, false, false, NonDet, NonDet]
LL | | 0.0 / 0.0 => [ true, false, false, false, NonDet, NonDet]
... |
LL | | -1.0 / 0.0 => [ false, true, false, false, false, true]
LL | | }
| |_- in this macro invocation
|
note: required for `bool` to implement `PartialEq<NonDet>`
--> $DIR/const-float-classify.rs:12:12
|
LL | impl const PartialEq<NonDet> for bool {
| ----- ^^^^^^^^^^^^^^^^^ ^^^^
| |
| unsatisfied trait bound introduced here
= note: this error originates in the macro `const_assert` which comes from the expansion of the macro `suite` (in Nightly builds, run with -Z macro-backtrace for more info)
error[E0284]: type annotations needed
--> $DIR/const-float-classify.rs:21:35
|
LL | const _: () = assert!($a == $b);
| ^^ cannot infer the value of the constant `_`
...
LL | / suite! {
LL | | [is_nan, is_infinite, is_finite, is_normal, is_sign_positive, is_sign_negative]
LL | | -0.0 / 0.0 => [ true, false, false, false, NonDet, NonDet]
LL | | 0.0 / 0.0 => [ true, false, false, false, NonDet, NonDet]
... |
LL | | -1.0 / 0.0 => [ false, true, false, false, false, true]
LL | | }
| |_- in this macro invocation
|
note: required for `bool` to implement `PartialEq<NonDet>`
--> $DIR/const-float-classify.rs:12:12
|
LL | impl const PartialEq<NonDet> for bool {
| ----- ^^^^^^^^^^^^^^^^^ ^^^^
| |
| unsatisfied trait bound introduced here
= note: this error originates in the macro `const_assert` which comes from the expansion of the macro `suite` (in Nightly builds, run with -Z macro-backtrace for more info)
error[E0284]: type annotations needed
--> $DIR/const-float-classify.rs:21:35
|
LL | const _: () = assert!($a == $b);
| ^^ cannot infer the value of the constant `_`
...
LL | / suite! {
LL | | [is_nan, is_infinite, is_finite, is_normal, is_sign_positive, is_sign_negative]
LL | | -0.0 / 0.0 => [ true, false, false, false, NonDet, NonDet]
LL | | 0.0 / 0.0 => [ true, false, false, false, NonDet, NonDet]
... |
LL | | -1.0 / 0.0 => [ false, true, false, false, false, true]
LL | | }
| |_- in this macro invocation
|
note: required for `bool` to implement `PartialEq<NonDet>`
--> $DIR/const-float-classify.rs:12:12
|
LL | impl const PartialEq<NonDet> for bool {
| ----- ^^^^^^^^^^^^^^^^^ ^^^^
| |
| unsatisfied trait bound introduced here
= note: this error originates in the macro `const_assert` which comes from the expansion of the macro `suite` (in Nightly builds, run with -Z macro-backtrace for more info)
error[E0284]: type annotations needed
--> $DIR/const-float-classify.rs:21:35
|
LL | const _: () = assert!($a == $b);
| ^^ cannot infer the value of the constant `_`
...
LL | / suite! {
LL | | [is_nan, is_infinite, is_finite, is_normal, is_sign_positive, is_sign_negative]
LL | | -0.0 / 0.0 => [ true, false, false, false, NonDet, NonDet]
LL | | 0.0 / 0.0 => [ true, false, false, false, NonDet, NonDet]
... |
LL | | -1.0 / 0.0 => [ false, true, false, false, false, true]
LL | | }
| |_- in this macro invocation
|
note: required for `bool` to implement `PartialEq<NonDet>`
--> $DIR/const-float-classify.rs:12:12
|
LL | impl const PartialEq<NonDet> for bool {
| ----- ^^^^^^^^^^^^^^^^^ ^^^^
| |
| unsatisfied trait bound introduced here
= note: this error originates in the macro `const_assert` which comes from the expansion of the macro `suite` (in Nightly builds, run with -Z macro-backtrace for more info)
error[E0284]: type annotations needed
--> $DIR/const-float-classify.rs:21:35
|
LL | const _: () = assert!($a == $b);
| ^^ cannot infer the value of the constant `_`
...
LL | / suite! {
LL | | [is_nan, is_infinite, is_finite, is_normal, is_sign_positive, is_sign_negative]
LL | | -0.0 / 0.0 => [ true, false, false, false, NonDet, NonDet]
LL | | 0.0 / 0.0 => [ true, false, false, false, NonDet, NonDet]
... |
LL | | -1.0 / 0.0 => [ false, true, false, false, false, true]
LL | | }
| |_- in this macro invocation
|
note: required for `bool` to implement `PartialEq<NonDet>`
--> $DIR/const-float-classify.rs:12:12
|
LL | impl const PartialEq<NonDet> for bool {
| ----- ^^^^^^^^^^^^^^^^^ ^^^^
| |
| unsatisfied trait bound introduced here
= note: this error originates in the macro `const_assert` which comes from the expansion of the macro `suite` (in Nightly builds, run with -Z macro-backtrace for more info)
error[E0284]: type annotations needed
--> $DIR/const-float-classify.rs:21:35
|
LL | const _: () = assert!($a == $b);
| ^^ cannot infer the value of the constant `_`
...
LL | / suite! {
LL | | [is_nan, is_infinite, is_finite, is_normal, is_sign_positive, is_sign_negative]
LL | | -0.0 / 0.0 => [ true, false, false, false, NonDet, NonDet]
LL | | 0.0 / 0.0 => [ true, false, false, false, NonDet, NonDet]
... |
LL | | -1.0 / 0.0 => [ false, true, false, false, false, true]
LL | | }
| |_- in this macro invocation
|
note: required for `bool` to implement `PartialEq<NonDet>`
--> $DIR/const-float-classify.rs:12:12
|
LL | impl const PartialEq<NonDet> for bool {
| ----- ^^^^^^^^^^^^^^^^^ ^^^^
| |
| unsatisfied trait bound introduced here
= note: this error originates in the macro `const_assert` which comes from the expansion of the macro `suite` (in Nightly builds, run with -Z macro-backtrace for more info)
error[E0284]: type annotations needed
--> $DIR/const-float-classify.rs:21:35
|
LL | const _: () = assert!($a == $b);
| ^^ cannot infer the value of the constant `_`
...
LL | / suite! {
LL | | [is_nan, is_infinite, is_finite, is_normal, is_sign_positive, is_sign_negative]
LL | | -0.0 / 0.0 => [ true, false, false, false, NonDet, NonDet]
LL | | 0.0 / 0.0 => [ true, false, false, false, NonDet, NonDet]
... |
LL | | -1.0 / 0.0 => [ false, true, false, false, false, true]
LL | | }
| |_- in this macro invocation
|
note: required for `bool` to implement `PartialEq<NonDet>`
--> $DIR/const-float-classify.rs:12:12
|
LL | impl const PartialEq<NonDet> for bool {
| ----- ^^^^^^^^^^^^^^^^^ ^^^^
| |
| unsatisfied trait bound introduced here
= note: this error originates in the macro `const_assert` which comes from the expansion of the macro `suite` (in Nightly builds, run with -Z macro-backtrace for more info)
error[E0284]: type annotations needed
--> $DIR/const-float-classify.rs:21:35
|
LL | const _: () = assert!($a == $b);
| ^^ cannot infer the value of the constant `_`
...
LL | / suite! {
LL | | [is_nan, is_infinite, is_finite, is_normal, is_sign_positive, is_sign_negative]
LL | | -0.0 / 0.0 => [ true, false, false, false, NonDet, NonDet]
LL | | 0.0 / 0.0 => [ true, false, false, false, NonDet, NonDet]
... |
LL | | -1.0 / 0.0 => [ false, true, false, false, false, true]
LL | | }
| |_- in this macro invocation
|
note: required for `bool` to implement `PartialEq<NonDet>`
--> $DIR/const-float-classify.rs:12:12
|
LL | impl const PartialEq<NonDet> for bool {
| ----- ^^^^^^^^^^^^^^^^^ ^^^^
| |
| unsatisfied trait bound introduced here
= note: this error originates in the macro `const_assert` which comes from the expansion of the macro `suite` (in Nightly builds, run with -Z macro-backtrace for more info)
error: aborting due to 10 previous errors; 1 warning emitted
Some errors have detailed explanations: E0207, E0284.
For more information about an error, try `rustc --explain E0207`.

View File

@ -1,3 +1,12 @@
warning: the feature `effects` is incomplete and may not be safe to use and/or cause compiler crashes
--> $DIR/const_cmp_type_id.rs:3:30
|
LL | #![feature(const_trait_impl, effects)]
| ^^^^^^^
|
= note: see issue #102090 <https://github.com/rust-lang/rust/issues/102090> for more information
= note: `#[warn(incomplete_features)]` on by default
error[E0131]: `main` function is not allowed to have generic parameters
--> $DIR/const_cmp_type_id.rs:7:14
|
@ -10,25 +19,7 @@ error[E0080]: evaluation of constant value failed
LL | const _A: bool = TypeId::of::<u8>() < TypeId::of::<u16>();
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ calling non-const function `<TypeId as PartialOrd>::lt`
error[E0308]: mismatched types
--> $DIR/const_cmp_type_id.rs:8:13
|
LL | assert!(TypeId::of::<u8>() == TypeId::of::<u8>());
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `host`, found `true`
|
= note: expected constant `host`
found constant `true`
error: aborting due to 2 previous errors; 1 warning emitted
error[E0308]: mismatched types
--> $DIR/const_cmp_type_id.rs:9:13
|
LL | assert!(TypeId::of::<()>() != TypeId::of::<u8>());
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `host`, found `true`
|
= note: expected constant `host`
found constant `true`
error: aborting due to 4 previous errors
Some errors have detailed explanations: E0080, E0131, E0308.
Some errors have detailed explanations: E0080, E0131.
For more information about an error, try `rustc --explain E0080`.

View File

@ -4,12 +4,24 @@ error[E0635]: unknown feature `const_fn_trait_ref_impls`
LL | #![feature(const_fn_trait_ref_impls)]
| ^^^^^^^^^^^^^^^^^^^^^^^^
error[E0635]: unknown feature `const_cmp`
--> $DIR/fn_trait_refs.rs:8:12
|
LL | #![feature(const_cmp)]
| ^^^^^^^^^
error: `~const` can only be applied to `#[const_trait]` traits
--> $DIR/fn_trait_refs.rs:15:15
|
LL | T: ~const Fn<()> + ~const Destruct,
| ^^^^^^
error: `~const` can only be applied to `#[const_trait]` traits
--> $DIR/fn_trait_refs.rs:15:31
|
LL | T: ~const Fn<()> + ~const Destruct,
| ^^^^^^^^
error: `~const` can only be applied to `#[const_trait]` traits
--> $DIR/fn_trait_refs.rs:15:15
|
@ -24,6 +36,12 @@ error: `~const` can only be applied to `#[const_trait]` traits
LL | T: ~const FnMut<()> + ~const Destruct,
| ^^^^^^^^^
error: `~const` can only be applied to `#[const_trait]` traits
--> $DIR/fn_trait_refs.rs:22:34
|
LL | T: ~const FnMut<()> + ~const Destruct,
| ^^^^^^^^
error: `~const` can only be applied to `#[const_trait]` traits
--> $DIR/fn_trait_refs.rs:22:15
|
@ -52,6 +70,12 @@ error: `~const` can only be applied to `#[const_trait]` traits
LL | T: ~const Fn<()> + ~const Destruct,
| ^^^^^^
error: `~const` can only be applied to `#[const_trait]` traits
--> $DIR/fn_trait_refs.rs:36:31
|
LL | T: ~const Fn<()> + ~const Destruct,
| ^^^^^^^^
error: `~const` can only be applied to `#[const_trait]` traits
--> $DIR/fn_trait_refs.rs:36:15
|
@ -66,6 +90,12 @@ error: `~const` can only be applied to `#[const_trait]` traits
LL | T: ~const FnMut<()> + ~const Destruct,
| ^^^^^^^^^
error: `~const` can only be applied to `#[const_trait]` traits
--> $DIR/fn_trait_refs.rs:50:34
|
LL | T: ~const FnMut<()> + ~const Destruct,
| ^^^^^^^^
error: `~const` can only be applied to `#[const_trait]` traits
--> $DIR/fn_trait_refs.rs:50:15
|
@ -182,7 +212,7 @@ LL | const fn test_fn_mut<T>(mut f: T) -> (T::Output, T::Output)
LL | }
| - value is dropped here
error: aborting due to 20 previous errors
error: aborting due to 25 previous errors
Some errors have detailed explanations: E0015, E0493, E0635.
For more information about an error, try `rustc --explain E0015`.

View File

@ -1,3 +1,12 @@
warning: the feature `effects` is incomplete and may not be safe to use and/or cause compiler crashes
--> $DIR/rustc-impl-const-stability.rs:5:30
|
LL | #![feature(const_trait_impl, effects)]
| ^^^^^^^
|
= note: see issue #102090 <https://github.com/rust-lang/rust/issues/102090> for more information
= note: `#[warn(incomplete_features)]` on by default
error: const `impl` for trait `Default` which is not marked with `#[const_trait]`
--> $DIR/rustc-impl-const-stability.rs:15:12
|
@ -16,6 +25,6 @@ LL | impl const Default for Data {
= note: expressions using a const parameter must map each value to a distinct output value
= note: proving the result of expressions other than the parameter are unique is not supported
error: aborting due to 2 previous errors
error: aborting due to 2 previous errors; 1 warning emitted
For more information about this error, try `rustc --explain E0207`.

View File

@ -4,6 +4,12 @@ error: `~const` can only be applied to `#[const_trait]` traits
LL | const fn with_positive<F: ~const for<'a> Fn(&'a Alias<'a>) + ~const Destruct>(fun: F) {
| ^^^^^^^^^^^^^^^^^
error: `~const` can only be applied to `#[const_trait]` traits
--> $DIR/normalize-tait-in-const.rs:27:69
|
LL | const fn with_positive<F: ~const for<'a> Fn(&'a Alias<'a>) + ~const Destruct>(fun: F) {
| ^^^^^^^^
error[E0015]: cannot call non-const closure in constant functions
--> $DIR/normalize-tait-in-const.rs:28:5
|
@ -29,7 +35,7 @@ LL | fun(filter_positive());
LL | }
| - value is dropped here
error: aborting due to 3 previous errors
error: aborting due to 4 previous errors
Some errors have detailed explanations: E0015, E0493.
For more information about an error, try `rustc --explain E0015`.

View File

@ -1,6 +1,6 @@
//! Check that intrinsics that do not get overridden, but are marked as such,
//! cause an error instead of silently invoking the body.
#![feature(rustc_attrs, effects)]
#![feature(rustc_attrs/* , effects*/)] // FIXME(effects)
//@ build-fail
//@ failure-status:101
//@ normalize-stderr-test ".*note: .*\n\n" -> ""

View File

@ -1,6 +1,6 @@
#![feature(intrinsics)]
#![feature(rustc_attrs)]
#![feature(effects)]
// FIXME(effects) do this with revisions #![feature(effects)]
extern "rust-intrinsic" {
fn size_of<T>() -> usize; //~ ERROR intrinsic safety mismatch
@ -19,7 +19,7 @@ const fn const_deallocate(_ptr: *mut u8, _size: usize, _align: usize) {}
mod foo {
#[rustc_intrinsic]
unsafe fn const_deallocate(_ptr: *mut u8, _size: usize, _align: usize) {}
//~^ ERROR wrong number of const parameters
// FIXME(effects) ~^ ERROR wrong number of const parameters
}
fn main() {}

View File

@ -42,13 +42,6 @@ LL | const fn const_deallocate(_ptr: *mut u8, _size: usize, _align: usize) {}
= note: expected signature `unsafe fn(_, _, _)`
found signature `fn(_, _, _)`
error[E0094]: intrinsic has wrong number of const parameters: found 0, expected 1
--> $DIR/safe-intrinsic-mismatch.rs:21:31
|
LL | unsafe fn const_deallocate(_ptr: *mut u8, _size: usize, _align: usize) {}
| ^ expected 1 const parameter
error: aborting due to 6 previous errors
error: aborting due to 7 previous errors
Some errors have detailed explanations: E0094, E0308.
For more information about an error, try `rustc --explain E0094`.
For more information about this error, try `rustc --explain E0308`.

View File

@ -1,7 +1,7 @@
// Regression test for part of issue #119924.
//@ check-pass
#![feature(const_trait_impl, effects)]
#![feature(const_trait_impl, effects)] //~ WARN the feature `effects` is incomplete
#[const_trait]
trait Trait {

View File

@ -0,0 +1,11 @@
warning: the feature `effects` is incomplete and may not be safe to use and/or cause compiler crashes
--> $DIR/impls-nested-within-fns-semantic-1.rs:4:30
|
LL | #![feature(const_trait_impl, effects)]
| ^^^^^^^
|
= note: see issue #102090 <https://github.com/rust-lang/rust/issues/102090> for more information
= note: `#[warn(incomplete_features)]` on by default
warning: 1 warning emitted

View File

@ -1,3 +1,12 @@
warning: the feature `effects` is incomplete and may not be safe to use and/or cause compiler crashes
--> $DIR/assoc-type-const-bound-usage-0.rs:6:30
|
LL | #![feature(const_trait_impl, effects)]
| ^^^^^^^
|
= note: see issue #102090 <https://github.com/rust-lang/rust/issues/102090> for more information
= note: `#[warn(incomplete_features)]` on by default
error[E0277]: the trait bound `T: Trait` is not satisfied
--> $DIR/assoc-type-const-bound-usage-0.rs:21:6
|
@ -9,6 +18,6 @@ help: consider further restricting this bound
LL | const fn qualified<T: ~const Trait + Trait>() -> i32 {
| +++++++
error: aborting due to 1 previous error
error: aborting due to 1 previous error; 1 warning emitted
For more information about this error, try `rustc --explain E0277`.

View File

@ -3,7 +3,7 @@
//@[unqualified] check-pass
//@[qualified] known-bug: unknown
#![feature(const_trait_impl, effects)]
#![feature(const_trait_impl, effects)] //[unqualified]~ WARN the feature `effects` is incomplete
#[const_trait]
trait Trait {

View File

@ -0,0 +1,11 @@
warning: the feature `effects` is incomplete and may not be safe to use and/or cause compiler crashes
--> $DIR/assoc-type-const-bound-usage-0.rs:6:30
|
LL | #![feature(const_trait_impl, effects)]
| ^^^^^^^
|
= note: see issue #102090 <https://github.com/rust-lang/rust/issues/102090> for more information
= note: `#[warn(incomplete_features)]` on by default
warning: 1 warning emitted

View File

@ -1,5 +1,5 @@
// FIXME(effects): Replace `Add` with `std::ops::Add` once the latter a `#[const_trait]` again.
#![feature(const_trait_impl, effects)]
#![feature(const_trait_impl, effects)] //~ WARN the feature `effects` is incomplete
#[const_trait]
trait Add<Rhs = Self> {

View File

@ -1,3 +1,12 @@
warning: the feature `effects` is incomplete and may not be safe to use and/or cause compiler crashes
--> $DIR/assoc-type.rs:2:30
|
LL | #![feature(const_trait_impl, effects)]
| ^^^^^^^
|
= note: see issue #102090 <https://github.com/rust-lang/rust/issues/102090> for more information
= note: `#[warn(incomplete_features)]` on by default
error[E0277]: the trait bound `NonConstAdd: ~const Add` is not satisfied
--> $DIR/assoc-type.rs:35:16
|
@ -11,6 +20,6 @@ note: required by a bound in `Foo::Bar`
LL | type Bar: ~const Add;
| ^^^^^^^^^^ required by this bound in `Foo::Bar`
error: aborting due to 1 previous error
error: aborting due to 1 previous error; 1 warning emitted
For more information about this error, try `rustc --explain E0277`.

View File

@ -1,4 +1,4 @@
#![feature(const_trait_impl, effects)]
#![feature(const_trait_impl, effects)] //~ WARN the feature `effects` is incomplete
#[const_trait]
pub trait MyTrait {

View File

@ -1,4 +1,4 @@
#![feature(const_trait_impl, effects)]
#![feature(const_trait_impl, effects)] //~ WARN the feature `effects` is incomplete
#![feature(staged_api)]
#![stable(feature = "rust1", since = "1.0.0")]

View File

@ -1,4 +1,4 @@
#![feature(const_trait_impl, effects)]
#![feature(const_trait_impl, effects)] //~ WARN the feature `effects` is incomplete
#[const_trait]
pub trait Plus {

View File

@ -1,3 +1,12 @@
warning: the feature `effects` is incomplete and may not be safe to use and/or cause compiler crashes
--> $DIR/call-const-trait-method-fail.rs:1:30
|
LL | #![feature(const_trait_impl, effects)]
| ^^^^^^^
|
= note: see issue #102090 <https://github.com/rust-lang/rust/issues/102090> for more information
= note: `#[warn(incomplete_features)]` on by default
error[E0277]: the trait bound `u32: ~const Plus` is not satisfied
--> $DIR/call-const-trait-method-fail.rs:25:5
|
@ -6,6 +15,6 @@ LL | a.plus(b)
|
= help: the trait `Plus` is implemented for `u32`
error: aborting due to 1 previous error
error: aborting due to 1 previous error; 1 warning emitted
For more information about this error, try `rustc --explain E0277`.

View File

@ -1,4 +1,5 @@
//@ check-pass
//@ known-bug: #110395
// FIXME(effects) check-pass
#![feature(const_trait_impl)]
#[const_trait]

View File

@ -0,0 +1,8 @@
error: `~const` can only be applied to `#[const_trait]` traits
--> $DIR/call-generic-in-impl.rs:10:16
|
LL | impl<T: ~const PartialEq> const MyPartialEq for T {
| ^^^^^^^^^
error: aborting due to 1 previous error

View File

@ -1,6 +1,7 @@
//! Basic test for calling methods on generic type parameters in `const fn`.
//@ check-pass
//@ known-bug: #110395
// FIXME(effects) check-pass
#![feature(const_trait_impl, effects)]

View File

@ -0,0 +1,71 @@
warning: the feature `effects` is incomplete and may not be safe to use and/or cause compiler crashes
--> $DIR/call-generic-method-chain.rs:6:30
|
LL | #![feature(const_trait_impl, effects)]
| ^^^^^^^
|
= note: see issue #102090 <https://github.com/rust-lang/rust/issues/102090> for more information
= note: `#[warn(incomplete_features)]` on by default
error: const `impl` for trait `PartialEq` which is not marked with `#[const_trait]`
--> $DIR/call-generic-method-chain.rs:10:12
|
LL | impl const PartialEq for S {
| ^^^^^^^^^
|
= note: marking a trait with `#[const_trait]` ensures all default method bodies are `const`
= note: adding a non-const method body in the future would be a breaking change
error[E0207]: the const parameter `host` is not constrained by the impl trait, self type, or predicates
--> $DIR/call-generic-method-chain.rs:10:6
|
LL | impl const PartialEq for S {
| ^^^^^ unconstrained const parameter
|
= note: expressions using a const parameter must map each value to a distinct output value
= note: proving the result of expressions other than the parameter are unique is not supported
error: `~const` can only be applied to `#[const_trait]` traits
--> $DIR/call-generic-method-chain.rs:19:32
|
LL | const fn equals_self<T: ~const PartialEq>(t: &T) -> bool {
| ^^^^^^^^^
error: `~const` can only be applied to `#[const_trait]` traits
--> $DIR/call-generic-method-chain.rs:23:40
|
LL | const fn equals_self_wrapper<T: ~const PartialEq>(t: &T) -> bool {
| ^^^^^^^^^
error[E0284]: type annotations needed
--> $DIR/call-generic-method-chain.rs:27:22
|
LL | pub const EQ: bool = equals_self_wrapper(&S);
| ^^^^^^^^^^^^^^^^^^^^^^^ cannot infer the value of the constant `_`
|
note: required for `S` to implement `PartialEq`
--> $DIR/call-generic-method-chain.rs:10:12
|
LL | impl const PartialEq for S {
| ----- ^^^^^^^^^ ^
| |
| unsatisfied trait bound introduced here
error[E0284]: type annotations needed
--> $DIR/call-generic-method-chain.rs:15:10
|
LL | !self.eq(other)
| ^^^^^^^^^^^^^^ cannot infer the value of the constant `_`
|
note: required for `S` to implement `PartialEq`
--> $DIR/call-generic-method-chain.rs:10:12
|
LL | impl const PartialEq for S {
| ----- ^^^^^^^^^ ^
| |
| unsatisfied trait bound introduced here
error: aborting due to 6 previous errors; 1 warning emitted
Some errors have detailed explanations: E0207, E0284.
For more information about an error, try `rustc --explain E0207`.

View File

@ -1,4 +1,5 @@
//@ check-pass
//@ known-bug: #110395
// FIXME(effects) check-pass
#![feature(const_trait_impl, effects)]

View File

@ -0,0 +1,85 @@
warning: the feature `effects` is incomplete and may not be safe to use and/or cause compiler crashes
--> $DIR/call-generic-method-dup-bound.rs:4:30
|
LL | #![feature(const_trait_impl, effects)]
| ^^^^^^^
|
= note: see issue #102090 <https://github.com/rust-lang/rust/issues/102090> for more information
= note: `#[warn(incomplete_features)]` on by default
error: const `impl` for trait `PartialEq` which is not marked with `#[const_trait]`
--> $DIR/call-generic-method-dup-bound.rs:8:12
|
LL | impl const PartialEq for S {
| ^^^^^^^^^
|
= note: marking a trait with `#[const_trait]` ensures all default method bodies are `const`
= note: adding a non-const method body in the future would be a breaking change
error[E0207]: the const parameter `host` is not constrained by the impl trait, self type, or predicates
--> $DIR/call-generic-method-dup-bound.rs:8:6
|
LL | impl const PartialEq for S {
| ^^^^^ unconstrained const parameter
|
= note: expressions using a const parameter must map each value to a distinct output value
= note: proving the result of expressions other than the parameter are unique is not supported
error: `~const` can only be applied to `#[const_trait]` traits
--> $DIR/call-generic-method-dup-bound.rs:19:44
|
LL | const fn equals_self<T: PartialEq + ~const PartialEq>(t: &T) -> bool {
| ^^^^^^^^^
error: `~const` can only be applied to `#[const_trait]` traits
--> $DIR/call-generic-method-dup-bound.rs:26:37
|
LL | const fn equals_self2<T: A + ~const PartialEq>(t: &T) -> bool {
| ^^^^^^^^^
error[E0284]: type annotations needed
--> $DIR/call-generic-method-dup-bound.rs:30:22
|
LL | pub const EQ: bool = equals_self(&S) && equals_self2(&S);
| ^^^^^^^^^^^^^^^ cannot infer the value of the constant `_`
|
note: required for `S` to implement `PartialEq`
--> $DIR/call-generic-method-dup-bound.rs:8:12
|
LL | impl const PartialEq for S {
| ----- ^^^^^^^^^ ^
| |
| unsatisfied trait bound introduced here
error[E0284]: type annotations needed
--> $DIR/call-generic-method-dup-bound.rs:30:41
|
LL | pub const EQ: bool = equals_self(&S) && equals_self2(&S);
| ^^^^^^^^^^^^^^^^ cannot infer the value of the constant `_`
|
note: required for `S` to implement `PartialEq`
--> $DIR/call-generic-method-dup-bound.rs:8:12
|
LL | impl const PartialEq for S {
| ----- ^^^^^^^^^ ^
| |
| unsatisfied trait bound introduced here
error[E0284]: type annotations needed
--> $DIR/call-generic-method-dup-bound.rs:13:10
|
LL | !self.eq(other)
| ^^^^^^^^^^^^^^ cannot infer the value of the constant `_`
|
note: required for `S` to implement `PartialEq`
--> $DIR/call-generic-method-dup-bound.rs:8:12
|
LL | impl const PartialEq for S {
| ----- ^^^^^^^^^ ^
| |
| unsatisfied trait bound introduced here
error: aborting due to 7 previous errors; 1 warning emitted
Some errors have detailed explanations: E0207, E0284.
For more information about an error, try `rustc --explain E0207`.

View File

@ -1,8 +1,10 @@
#![feature(const_trait_impl, effects)]
//@ check-pass
#![feature(const_trait_impl, effects)] //~ WARN the feature `effects` is incomplete
pub const fn equals_self<T: PartialEq>(t: &T) -> bool {
*t == *t
//~^ ERROR mismatched types
// FIXME(effects) ~^ ERROR mismatched types
// FIXME(effects): diagnostic
}

View File

@ -1,12 +1,11 @@
error[E0308]: mismatched types
--> $DIR/call-generic-method-fail.rs:4:5
warning: the feature `effects` is incomplete and may not be safe to use and/or cause compiler crashes
--> $DIR/call-generic-method-fail.rs:3:30
|
LL | *t == *t
| ^^^^^^^^ expected `host`, found `true`
LL | #![feature(const_trait_impl, effects)]
| ^^^^^^^
|
= note: expected constant `host`
found constant `true`
= note: see issue #102090 <https://github.com/rust-lang/rust/issues/102090> for more information
= note: `#[warn(incomplete_features)]` on by default
error: aborting due to 1 previous error
warning: 1 warning emitted
For more information about this error, try `rustc --explain E0308`.

View File

@ -1,4 +1,4 @@
#![feature(const_trait_impl, effects)]
#![feature(const_trait_impl, effects)] //~ WARN the feature `effects` is incomplete
struct S;

View File

@ -1,3 +1,12 @@
warning: the feature `effects` is incomplete and may not be safe to use and/or cause compiler crashes
--> $DIR/call-generic-method-nonconst.rs:1:30
|
LL | #![feature(const_trait_impl, effects)]
| ^^^^^^^
|
= note: see issue #102090 <https://github.com/rust-lang/rust/issues/102090> for more information
= note: `#[warn(incomplete_features)]` on by default
error[E0277]: the trait bound `S: const Foo` is not satisfied
--> $DIR/call-generic-method-nonconst.rs:23:34
|
@ -13,6 +22,6 @@ note: required by a bound in `equals_self`
LL | const fn equals_self<T: ~const Foo>(t: &T) -> bool {
| ^^^^^^^^^^ required by this bound in `equals_self`
error: aborting due to 1 previous error
error: aborting due to 1 previous error; 1 warning emitted
For more information about this error, try `rustc --explain E0277`.

View File

@ -1,6 +1,7 @@
//! Basic test for calling methods on generic type parameters in `const fn`.
//@ check-pass
//@ known-bug: #110395
// FIXME(effects) check-pass
#![feature(const_trait_impl, effects)]

View File

@ -0,0 +1,65 @@
warning: the feature `effects` is incomplete and may not be safe to use and/or cause compiler crashes
--> $DIR/call-generic-method-pass.rs:6:30
|
LL | #![feature(const_trait_impl, effects)]
| ^^^^^^^
|
= note: see issue #102090 <https://github.com/rust-lang/rust/issues/102090> for more information
= note: `#[warn(incomplete_features)]` on by default
error: const `impl` for trait `PartialEq` which is not marked with `#[const_trait]`
--> $DIR/call-generic-method-pass.rs:10:12
|
LL | impl const PartialEq for S {
| ^^^^^^^^^
|
= note: marking a trait with `#[const_trait]` ensures all default method bodies are `const`
= note: adding a non-const method body in the future would be a breaking change
error[E0207]: the const parameter `host` is not constrained by the impl trait, self type, or predicates
--> $DIR/call-generic-method-pass.rs:10:6
|
LL | impl const PartialEq for S {
| ^^^^^ unconstrained const parameter
|
= note: expressions using a const parameter must map each value to a distinct output value
= note: proving the result of expressions other than the parameter are unique is not supported
error: `~const` can only be applied to `#[const_trait]` traits
--> $DIR/call-generic-method-pass.rs:19:32
|
LL | const fn equals_self<T: ~const PartialEq>(t: &T) -> bool {
| ^^^^^^^^^
error[E0284]: type annotations needed
--> $DIR/call-generic-method-pass.rs:23:22
|
LL | pub const EQ: bool = equals_self(&S);
| ^^^^^^^^^^^^^^^ cannot infer the value of the constant `_`
|
note: required for `S` to implement `PartialEq`
--> $DIR/call-generic-method-pass.rs:10:12
|
LL | impl const PartialEq for S {
| ----- ^^^^^^^^^ ^
| |
| unsatisfied trait bound introduced here
error[E0284]: type annotations needed
--> $DIR/call-generic-method-pass.rs:15:10
|
LL | !self.eq(other)
| ^^^^^^^^^^^^^^ cannot infer the value of the constant `_`
|
note: required for `S` to implement `PartialEq`
--> $DIR/call-generic-method-pass.rs:10:12
|
LL | impl const PartialEq for S {
| ----- ^^^^^^^^^ ^
| |
| unsatisfied trait bound introduced here
error: aborting due to 5 previous errors; 1 warning emitted
Some errors have detailed explanations: E0207, E0284.
For more information about an error, try `rustc --explain E0207`.

View File

@ -1,3 +1,12 @@
error[E0119]: conflicting implementations of trait `Add` for type `Int`
--> $DIR/const-and-non-const-impl.rs:23:1
|
LL | impl std::ops::Add for Int {
| -------------------------- first implementation here
...
LL | impl const std::ops::Add for Int {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `Int`
error[E0117]: only traits defined in the current crate can be implemented for primitive types
--> $DIR/const-and-non-const-impl.rs:7:1
|
@ -10,15 +19,6 @@ LL | impl const std::ops::Add for i32 {
|
= note: define and implement a trait or new type instead
error[E0119]: conflicting implementations of trait `Add` for type `Int`
--> $DIR/const-and-non-const-impl.rs:23:1
|
LL | impl std::ops::Add for Int {
| -------------------------- first implementation here
...
LL | impl const std::ops::Add for Int {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `Int`
error: aborting due to 2 previous errors
Some errors have detailed explanations: E0117, E0119.

View File

@ -1,5 +1,5 @@
// Regression test for issue #117244.
#![feature(const_trait_impl, effects)]
#![feature(const_trait_impl, effects)] //~ WARN the feature `effects` is incomplete
trait NonConst {}

View File

@ -1,3 +1,12 @@
warning: the feature `effects` is incomplete and may not be safe to use and/or cause compiler crashes
--> $DIR/const-bounds-non-const-trait.rs:2:30
|
LL | #![feature(const_trait_impl, effects)]
| ^^^^^^^
|
= note: see issue #102090 <https://github.com/rust-lang/rust/issues/102090> for more information
= note: `#[warn(incomplete_features)]` on by default
error: `~const` can only be applied to `#[const_trait]` traits
--> $DIR/const-bounds-non-const-trait.rs:6:28
|
@ -10,5 +19,5 @@ error: `const` can only be applied to `#[const_trait]` traits
LL | fn operate<T: const NonConst>() {}
| ^^^^^^^^
error: aborting due to 2 previous errors
error: aborting due to 2 previous errors; 1 warning emitted

View File

@ -1,4 +1,4 @@
#![feature(const_trait_impl, effects)]
#![feature(const_trait_impl, effects)] //~ WARN the feature `effects` is incomplete
struct S;
#[const_trait]

View File

@ -1,3 +1,12 @@
warning: the feature `effects` is incomplete and may not be safe to use and/or cause compiler crashes
--> $DIR/const-check-fns-in-const-impl.rs:1:30
|
LL | #![feature(const_trait_impl, effects)]
| ^^^^^^^
|
= note: see issue #102090 <https://github.com/rust-lang/rust/issues/102090> for more information
= note: `#[warn(incomplete_features)]` on by default
error[E0015]: cannot call non-const fn `non_const` in constant functions
--> $DIR/const-check-fns-in-const-impl.rs:12:16
|
@ -6,6 +15,6 @@ LL | fn foo() { non_const() }
|
= note: calls in constant functions are limited to constant functions, tuple structs and tuple variants
error: aborting due to 1 previous error
error: aborting due to 1 previous error; 1 warning emitted
For more information about this error, try `rustc --explain E0015`.

View File

@ -1,4 +1,4 @@
#![feature(const_trait_impl, effects)]
#![feature(const_trait_impl, effects)] //~ WARN the feature `effects` is incomplete
#[const_trait]
trait ConstDefaultFn: Sized {

View File

@ -1,3 +1,12 @@
warning: the feature `effects` is incomplete and may not be safe to use and/or cause compiler crashes
--> $DIR/const-default-method-bodies.rs:1:30
|
LL | #![feature(const_trait_impl, effects)]
| ^^^^^^^
|
= note: see issue #102090 <https://github.com/rust-lang/rust/issues/102090> for more information
= note: `#[warn(incomplete_features)]` on by default
error[E0277]: the trait bound `NonConstImpl: ~const ConstDefaultFn` is not satisfied
--> $DIR/const-default-method-bodies.rs:24:18
|
@ -6,6 +15,6 @@ LL | NonConstImpl.a();
|
= help: the trait `ConstDefaultFn` is implemented for `NonConstImpl`
error: aborting due to 1 previous error
error: aborting due to 1 previous error; 1 warning emitted
For more information about this error, try `rustc --explain E0277`.

View File

@ -1,9 +1,27 @@
error: `~const` can only be applied to `#[const_trait]` traits
--> $DIR/const-drop-bound.rs:9:68
|
LL | const fn foo<T, E>(res: Result<T, E>) -> Option<T> where E: ~const Destruct {
| ^^^^^^^^
error: `~const` can only be applied to `#[const_trait]` traits
--> $DIR/const-drop-bound.rs:20:15
|
LL | T: ~const Destruct,
| ^^^^^^^^
error: `~const` can only be applied to `#[const_trait]` traits
--> $DIR/const-drop-bound.rs:21:15
|
LL | E: ~const Destruct,
| ^^^^^^^^
error[E0493]: destructor of `E` cannot be evaluated at compile-time
--> $DIR/const-drop-bound.rs:12:13
|
LL | Err(_e) => None,
| ^^ the destructor for this type cannot be evaluated in constant functions
error: aborting due to 1 previous error
error: aborting due to 4 previous errors
For more information about this error, try `rustc --explain E0493`.

View File

@ -1,3 +1,9 @@
error: `~const` can only be applied to `#[const_trait]` traits
--> $DIR/const-drop-fail-2.rs:21:26
|
LL | const fn check<T: ~const Destruct>(_: T) {}
| ^^^^^^^^
error[E0493]: destructor of `T` cannot be evaluated at compile-time
--> $DIR/const-drop-fail-2.rs:21:36
|
@ -6,6 +12,6 @@ LL | const fn check<T: ~const Destruct>(_: T) {}
| |
| the destructor for this type cannot be evaluated in constant functions
error: aborting due to 1 previous error
error: aborting due to 2 previous errors
For more information about this error, try `rustc --explain E0493`.

View File

@ -1,3 +1,9 @@
error: `~const` can only be applied to `#[const_trait]` traits
--> $DIR/const-drop-fail.rs:24:26
|
LL | const fn check<T: ~const Destruct>(_: T) {}
| ^^^^^^^^
error[E0493]: destructor of `T` cannot be evaluated at compile-time
--> $DIR/const-drop-fail.rs:24:36
|
@ -54,7 +60,7 @@ LL | | }
| |_- in this macro invocation
= note: this error originates in the macro `check_all` (in Nightly builds, run with -Z macro-backtrace for more info)
error: aborting due to 3 previous errors
error: aborting due to 4 previous errors
Some errors have detailed explanations: E0080, E0493.
For more information about an error, try `rustc --explain E0080`.

View File

@ -1,3 +1,9 @@
error: `~const` can only be applied to `#[const_trait]` traits
--> $DIR/const-drop-fail.rs:24:26
|
LL | const fn check<T: ~const Destruct>(_: T) {}
| ^^^^^^^^
error[E0493]: destructor of `T` cannot be evaluated at compile-time
--> $DIR/const-drop-fail.rs:24:36
|
@ -6,6 +12,6 @@ LL | const fn check<T: ~const Destruct>(_: T) {}
| |
| the destructor for this type cannot be evaluated in constant functions
error: aborting due to 1 previous error
error: aborting due to 2 previous errors
For more information about this error, try `rustc --explain E0493`.

View File

@ -1,3 +1,9 @@
error: `~const` can only be applied to `#[const_trait]` traits
--> $DIR/const-drop.rs:19:22
|
LL | const fn a<T: ~const Destruct>(_: T) {}
| ^^^^^^^^
error[E0493]: destructor of `S<'_>` cannot be evaluated at compile-time
--> $DIR/const-drop.rs:24:13
|
@ -86,7 +92,7 @@ LL | | }
| |_- in this macro invocation
= note: this error originates in the macro `implements_const_drop` (in Nightly builds, run with -Z macro-backtrace for more info)
error: aborting due to 5 previous errors
error: aborting due to 6 previous errors
Some errors have detailed explanations: E0080, E0493.
For more information about an error, try `rustc --explain E0080`.

View File

@ -1,3 +1,9 @@
error: `~const` can only be applied to `#[const_trait]` traits
--> $DIR/const-drop.rs:19:22
|
LL | const fn a<T: ~const Destruct>(_: T) {}
| ^^^^^^^^
error[E0493]: destructor of `S<'_>` cannot be evaluated at compile-time
--> $DIR/const-drop.rs:24:13
|
@ -14,6 +20,6 @@ LL | const fn a<T: ~const Destruct>(_: T) {}
| |
| the destructor for this type cannot be evaluated in constant functions
error: aborting due to 2 previous errors
error: aborting due to 3 previous errors
For more information about this error, try `rustc --explain E0493`.

View File

@ -7,7 +7,7 @@
#![feature(
auto_traits,
const_trait_impl,
effects,
effects, //~ WARN the feature `effects` is incomplete
lang_items,
no_core,
staged_api,

View File

@ -0,0 +1,11 @@
warning: the feature `effects` is incomplete and may not be safe to use and/or cause compiler crashes
--> $DIR/const-fns-are-early-bound.rs:10:5
|
LL | effects,
| ^^^^^^^
|
= note: see issue #102090 <https://github.com/rust-lang/rust/issues/102090> for more information
= note: `#[warn(incomplete_features)]` on by default
warning: 1 warning emitted

View File

@ -1,3 +1,12 @@
warning: the feature `effects` is incomplete and may not be safe to use and/or cause compiler crashes
--> $DIR/const-impl-requires-const-trait.rs:3:30
|
LL | #![feature(const_trait_impl, effects)]
| ^^^^^^^
|
= note: see issue #102090 <https://github.com/rust-lang/rust/issues/102090> for more information
= note: `#[warn(incomplete_features)]` on by default
error: const `impl` for trait `A` which is not marked with `#[const_trait]`
--> $DIR/const-impl-requires-const-trait.rs:8:12
|
@ -19,6 +28,6 @@ LL | impl const A for () {}
= note: expressions using a const parameter must map each value to a distinct output value
= note: proving the result of expressions other than the parameter are unique is not supported
error: aborting due to 2 previous errors
error: aborting due to 2 previous errors; 1 warning emitted
For more information about this error, try `rustc --explain E0207`.

View File

@ -1,28 +1,244 @@
error[E0277]: can't compare `()` with `()`
--> $DIR/const-impl-trait.rs:36:17
error[E0635]: unknown feature `const_cmp`
--> $DIR/const-impl-trait.rs:8:5
|
LL | assert!(cmp(&()));
| --- ^^^ no implementation for `() == ()`
| |
| required by a bound introduced by this call
|
= help: the trait `const PartialEq` is not implemented for `()`
= help: the trait `PartialEq` is implemented for `()`
note: required by a bound in `cmp`
--> $DIR/const-impl-trait.rs:13:23
LL | const_cmp,
| ^^^^^^^^^
error: `~const` can only be applied to `#[const_trait]` traits
--> $DIR/const-impl-trait.rs:13:30
|
LL | const fn cmp(a: &impl ~const PartialEq) -> bool {
| ^^^^^^^^^^^^^^^^ required by this bound in `cmp`
| ^^^^^^^^^
error[E0369]: binary operation `==` cannot be applied to type `&impl ~const PartialEq`
--> $DIR/const-impl-trait.rs:14:7
error: `~const` can only be applied to `#[const_trait]` traits
--> $DIR/const-impl-trait.rs:17:30
|
LL | a == a
| - ^^ - &impl ~const PartialEq
| |
| &impl ~const PartialEq
LL | const fn wrap(x: impl ~const PartialEq + ~const Destruct)
| ^^^^^^^^^
error: aborting due to 2 previous errors
error: `~const` can only be applied to `#[const_trait]` traits
--> $DIR/const-impl-trait.rs:17:49
|
LL | const fn wrap(x: impl ~const PartialEq + ~const Destruct)
| ^^^^^^^^
Some errors have detailed explanations: E0277, E0369.
For more information about an error, try `rustc --explain E0277`.
error: `~const` can only be applied to `#[const_trait]` traits
--> $DIR/const-impl-trait.rs:18:20
|
LL | -> impl ~const PartialEq + ~const Destruct
| ^^^^^^^^^
error: `~const` can only be applied to `#[const_trait]` traits
--> $DIR/const-impl-trait.rs:18:39
|
LL | -> impl ~const PartialEq + ~const Destruct
| ^^^^^^^^
error: `~const` can only be applied to `#[const_trait]` traits
--> $DIR/const-impl-trait.rs:18:20
|
LL | -> impl ~const PartialEq + ~const Destruct
| ^^^^^^^^^
|
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error: `~const` can only be applied to `#[const_trait]` traits
--> $DIR/const-impl-trait.rs:18:39
|
LL | -> impl ~const PartialEq + ~const Destruct
| ^^^^^^^^
|
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error: `~const` can only be applied to `#[const_trait]` traits
--> $DIR/const-impl-trait.rs:25:29
|
LL | fn huh() -> impl ~const PartialEq + ~const Destruct + Copy;
| ^^^^^^^^^
error: `~const` can only be applied to `#[const_trait]` traits
--> $DIR/const-impl-trait.rs:25:48
|
LL | fn huh() -> impl ~const PartialEq + ~const Destruct + Copy;
| ^^^^^^^^
error: `~const` can only be applied to `#[const_trait]` traits
--> $DIR/const-impl-trait.rs:25:29
|
LL | fn huh() -> impl ~const PartialEq + ~const Destruct + Copy;
| ^^^^^^^^^
|
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error: `~const` can only be applied to `#[const_trait]` traits
--> $DIR/const-impl-trait.rs:25:48
|
LL | fn huh() -> impl ~const PartialEq + ~const Destruct + Copy;
| ^^^^^^^^
|
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error: `~const` can only be applied to `#[const_trait]` traits
--> $DIR/const-impl-trait.rs:25:29
|
LL | fn huh() -> impl ~const PartialEq + ~const Destruct + Copy;
| ^^^^^^^^^
|
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error: `~const` can only be applied to `#[const_trait]` traits
--> $DIR/const-impl-trait.rs:25:48
|
LL | fn huh() -> impl ~const PartialEq + ~const Destruct + Copy;
| ^^^^^^^^
|
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error: `~const` can only be applied to `#[const_trait]` traits
--> $DIR/const-impl-trait.rs:29:29
|
LL | fn huh() -> impl ~const PartialEq + ~const Destruct + Copy {
| ^^^^^^^^^
error: `~const` can only be applied to `#[const_trait]` traits
--> $DIR/const-impl-trait.rs:29:48
|
LL | fn huh() -> impl ~const PartialEq + ~const Destruct + Copy {
| ^^^^^^^^
error: `~const` can only be applied to `#[const_trait]` traits
--> $DIR/const-impl-trait.rs:29:29
|
LL | fn huh() -> impl ~const PartialEq + ~const Destruct + Copy {
| ^^^^^^^^^
|
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error: `~const` can only be applied to `#[const_trait]` traits
--> $DIR/const-impl-trait.rs:29:48
|
LL | fn huh() -> impl ~const PartialEq + ~const Destruct + Copy {
| ^^^^^^^^
|
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error: `~const` can only be applied to `#[const_trait]` traits
--> $DIR/const-impl-trait.rs:50:41
|
LL | const fn apit(_: impl ~const T + ~const Destruct) {}
| ^^^^^^^^
error: `~const` can only be applied to `#[const_trait]` traits
--> $DIR/const-impl-trait.rs:54:73
|
LL | const fn apit_assoc_bound(_: impl IntoIterator<Item: ~const T> + ~const Destruct) {}
| ^^^^^^^^
error: `~const` can only be applied to `#[const_trait]` traits
--> $DIR/const-impl-trait.rs:25:29
|
LL | fn huh() -> impl ~const PartialEq + ~const Destruct + Copy;
| ^^^^^^^^^
|
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error: `~const` can only be applied to `#[const_trait]` traits
--> $DIR/const-impl-trait.rs:25:48
|
LL | fn huh() -> impl ~const PartialEq + ~const Destruct + Copy;
| ^^^^^^^^
|
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error[E0493]: destructor of `impl PartialEq + Destruct` cannot be evaluated at compile-time
--> $DIR/const-impl-trait.rs:37:26
|
LL | assert!(wrap(123) == wrap(123));
| ^^^^^^^^^- value is dropped here
| |
| the destructor for this type cannot be evaluated in constants
error[E0493]: destructor of `impl PartialEq + Destruct` cannot be evaluated at compile-time
--> $DIR/const-impl-trait.rs:37:26
|
LL | assert!(wrap(123) == wrap(123));
| ^^^^^^^^^- value is dropped here
| |
| the destructor for this type cannot be evaluated in constants
|
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error[E0493]: destructor of `impl PartialEq + Destruct` cannot be evaluated at compile-time
--> $DIR/const-impl-trait.rs:37:13
|
LL | assert!(wrap(123) == wrap(123));
| ^^^^^^^^^ - value is dropped here
| |
| the destructor for this type cannot be evaluated in constants
error[E0493]: destructor of `impl PartialEq + Destruct` cannot be evaluated at compile-time
--> $DIR/const-impl-trait.rs:37:13
|
LL | assert!(wrap(123) == wrap(123));
| ^^^^^^^^^ - value is dropped here
| |
| the destructor for this type cannot be evaluated in constants
|
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error[E0493]: destructor of `impl PartialEq + Destruct` cannot be evaluated at compile-time
--> $DIR/const-impl-trait.rs:38:26
|
LL | assert!(wrap(123) != wrap(456));
| ^^^^^^^^^- value is dropped here
| |
| the destructor for this type cannot be evaluated in constants
error[E0493]: destructor of `impl PartialEq + Destruct` cannot be evaluated at compile-time
--> $DIR/const-impl-trait.rs:38:26
|
LL | assert!(wrap(123) != wrap(456));
| ^^^^^^^^^- value is dropped here
| |
| the destructor for this type cannot be evaluated in constants
|
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error[E0493]: destructor of `impl PartialEq + Destruct` cannot be evaluated at compile-time
--> $DIR/const-impl-trait.rs:38:13
|
LL | assert!(wrap(123) != wrap(456));
| ^^^^^^^^^ - value is dropped here
| |
| the destructor for this type cannot be evaluated in constants
error[E0493]: destructor of `impl PartialEq + Destruct` cannot be evaluated at compile-time
--> $DIR/const-impl-trait.rs:38:13
|
LL | assert!(wrap(123) != wrap(456));
| ^^^^^^^^^ - value is dropped here
| |
| the destructor for this type cannot be evaluated in constants
|
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error[E0493]: destructor of `impl ~const T + ~const Destruct` cannot be evaluated at compile-time
--> $DIR/const-impl-trait.rs:50:15
|
LL | const fn apit(_: impl ~const T + ~const Destruct) {}
| ^ - value is dropped here
| |
| the destructor for this type cannot be evaluated in constant functions
error[E0493]: destructor of `impl IntoIterator<Item : ~const T> + ~const Destruct` cannot be evaluated at compile-time
--> $DIR/const-impl-trait.rs:54:27
|
LL | const fn apit_assoc_bound(_: impl IntoIterator<Item: ~const T> + ~const Destruct) {}
| ^ - value is dropped here
| |
| the destructor for this type cannot be evaluated in constant functions
error: aborting due to 32 previous errors
Some errors have detailed explanations: E0493, E0635.
For more information about an error, try `rustc --explain E0493`.

View File

@ -1,4 +1,4 @@
#![feature(const_trait_impl, effects)]
#![feature(const_trait_impl, effects)] //~ WARN the feature `effects` is incomplete
//@ edition: 2021
#[const_trait]

View File

@ -26,5 +26,14 @@ LL | const fn take(_: &dyn ~const NonConst) {}
|
= note: trait objects cannot have `~const` trait bounds
error: aborting due to 4 previous errors
warning: the feature `effects` is incomplete and may not be safe to use and/or cause compiler crashes
--> $DIR/const-trait-bounds-trait-objects.rs:1:30
|
LL | #![feature(const_trait_impl, effects)]
| ^^^^^^^
|
= note: see issue #102090 <https://github.com/rust-lang/rust/issues/102090> for more information
= note: `#[warn(incomplete_features)]` on by default
error: aborting due to 4 previous errors; 1 warning emitted

View File

@ -1,3 +1,12 @@
warning: the feature `effects` is incomplete and may not be safe to use and/or cause compiler crashes
--> $DIR/derive-const-non-const-type.rs:2:26
|
LL | #![feature(derive_const, effects)]
| ^^^^^^^
|
= note: see issue #102090 <https://github.com/rust-lang/rust/issues/102090> for more information
= note: `#[warn(incomplete_features)]` on by default
error: const `impl` for trait `Default` which is not marked with `#[const_trait]`
--> $DIR/derive-const-non-const-type.rs:10:16
|
@ -13,6 +22,6 @@ error[E0207]: the const parameter `host` is not constrained by the impl trait, s
= note: expressions using a const parameter must map each value to a distinct output value
= note: proving the result of expressions other than the parameter are unique is not supported
error: aborting due to 2 previous errors
error: aborting due to 2 previous errors; 1 warning emitted
For more information about this error, try `rustc --explain E0207`.

View File

@ -1,3 +1,18 @@
warning: the feature `effects` is incomplete and may not be safe to use and/or cause compiler crashes
--> $DIR/derive-const-use.rs:3:76
|
LL | #![feature(const_trait_impl, const_cmp, const_default_impls, derive_const, effects)]
| ^^^^^^^
|
= note: see issue #102090 <https://github.com/rust-lang/rust/issues/102090> for more information
= note: `#[warn(incomplete_features)]` on by default
error[E0635]: unknown feature `const_cmp`
--> $DIR/derive-const-use.rs:3:30
|
LL | #![feature(const_trait_impl, const_cmp, const_default_impls, derive_const, effects)]
| ^^^^^^^^^
error[E0635]: unknown feature `const_default_impls`
--> $DIR/derive-const-use.rs:3:41
|
@ -22,6 +37,24 @@ LL | impl const Default for A {
= note: expressions using a const parameter must map each value to a distinct output value
= note: proving the result of expressions other than the parameter are unique is not supported
error: const `impl` for trait `PartialEq` which is not marked with `#[const_trait]`
--> $DIR/derive-const-use.rs:11:12
|
LL | impl const PartialEq for A {
| ^^^^^^^^^
|
= note: marking a trait with `#[const_trait]` ensures all default method bodies are `const`
= note: adding a non-const method body in the future would be a breaking change
error[E0207]: the const parameter `host` is not constrained by the impl trait, self type, or predicates
--> $DIR/derive-const-use.rs:11:6
|
LL | impl const PartialEq for A {
| ^^^^^ unconstrained const parameter
|
= note: expressions using a const parameter must map each value to a distinct output value
= note: proving the result of expressions other than the parameter are unique is not supported
error: const `impl` for trait `Default` which is not marked with `#[const_trait]`
--> $DIR/derive-const-use.rs:15:16
|
@ -37,6 +70,22 @@ error[E0207]: the const parameter `host` is not constrained by the impl trait, s
= note: expressions using a const parameter must map each value to a distinct output value
= note: proving the result of expressions other than the parameter are unique is not supported
error: const `impl` for trait `PartialEq` which is not marked with `#[const_trait]`
--> $DIR/derive-const-use.rs:15:25
|
LL | #[derive_const(Default, PartialEq)]
| ^^^^^^^^^
|
= note: marking a trait with `#[const_trait]` ensures all default method bodies are `const`
= note: adding a non-const method body in the future would be a breaking change
= note: this error originates in the derive macro `PartialEq` (in Nightly builds, run with -Z macro-backtrace for more info)
error[E0207]: the const parameter `host` is not constrained by the impl trait, self type, or predicates
|
= note: expressions using a const parameter must map each value to a distinct output value
= note: proving the result of expressions other than the parameter are unique is not supported
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error[E0284]: type annotations needed
--> $DIR/derive-const-use.rs:18:35
|
@ -50,16 +99,17 @@ LL | #[derive_const(Default, PartialEq)]
| ^^^^^^^ unsatisfied trait bound introduced in this `derive` macro
= note: this error originates in the derive macro `Default` (in Nightly builds, run with -Z macro-backtrace for more info)
error[E0308]: mismatched types
--> $DIR/derive-const-use.rs:16:14
error[E0284]: type annotations needed
--> $DIR/derive-const-use.rs:18:23
|
LL | const _: () = assert!(S((), A) == S::default());
| ^^^^^^^^^^^^^^^^^^^^^^^^ cannot infer the value of the constant `_`
|
note: required for `S` to implement `PartialEq`
--> $DIR/derive-const-use.rs:15:25
|
LL | #[derive_const(Default, PartialEq)]
| --------- in this derive macro expansion
LL | pub struct S((), A);
| ^^ expected `host`, found `true`
|
= note: expected constant `host`
found constant `true`
| ^^^^^^^^^ unsatisfied trait bound introduced in this `derive` macro
= note: this error originates in the derive macro `PartialEq` (in Nightly builds, run with -Z macro-backtrace for more info)
error[E0284]: type annotations needed
@ -79,7 +129,24 @@ LL | impl const Default for A {
| unsatisfied trait bound introduced here
= note: this error originates in the derive macro `Default` (in Nightly builds, run with -Z macro-backtrace for more info)
error: aborting due to 8 previous errors
error[E0284]: type annotations needed
--> $DIR/derive-const-use.rs:16:18
|
LL | #[derive_const(Default, PartialEq)]
| --------- in this derive macro expansion
LL | pub struct S((), A);
| ^ cannot infer the value of the constant `_`
|
note: required for `A` to implement `PartialEq`
--> $DIR/derive-const-use.rs:11:12
|
LL | impl const PartialEq for A {
| ----- ^^^^^^^^^ ^
| |
| unsatisfied trait bound introduced here
= note: this error originates in the derive macro `PartialEq` (in Nightly builds, run with -Z macro-backtrace for more info)
Some errors have detailed explanations: E0207, E0284, E0308, E0635.
error: aborting due to 14 previous errors; 1 warning emitted
Some errors have detailed explanations: E0207, E0284, E0635.
For more information about an error, try `rustc --explain E0207`.

View File

@ -1,4 +1,5 @@
//@ check-pass
//@ known-bug: #110395
// FIXME(effects) check-pass
#![feature(derive_const)]
#![feature(const_trait_impl, effects)]

View File

@ -0,0 +1,49 @@
warning: the feature `effects` is incomplete and may not be safe to use and/or cause compiler crashes
--> $DIR/derive-const-with-params.rs:5:30
|
LL | #![feature(const_trait_impl, effects)]
| ^^^^^^^
|
= note: see issue #102090 <https://github.com/rust-lang/rust/issues/102090> for more information
= note: `#[warn(incomplete_features)]` on by default
error: const `impl` for trait `PartialEq` which is not marked with `#[const_trait]`
--> $DIR/derive-const-with-params.rs:7:16
|
LL | #[derive_const(PartialEq)]
| ^^^^^^^^^
|
= note: marking a trait with `#[const_trait]` ensures all default method bodies are `const`
= note: adding a non-const method body in the future would be a breaking change
= note: this error originates in the derive macro `PartialEq` (in Nightly builds, run with -Z macro-backtrace for more info)
error: `~const` can only be applied to `#[const_trait]` traits
--> $DIR/derive-const-with-params.rs:7:16
|
LL | #[derive_const(PartialEq)]
| ^^^^^^^^^
|
= note: this error originates in the derive macro `PartialEq` (in Nightly builds, run with -Z macro-backtrace for more info)
error[E0207]: the const parameter `host` is not constrained by the impl trait, self type, or predicates
|
= note: expressions using a const parameter must map each value to a distinct output value
= note: proving the result of expressions other than the parameter are unique is not supported
error[E0284]: type annotations needed
--> $DIR/derive-const-with-params.rs:11:5
|
LL | a == b
| ^^^^^^ cannot infer the value of the constant `_`
|
note: required for `Reverse<i32>` to implement `PartialEq`
--> $DIR/derive-const-with-params.rs:7:16
|
LL | #[derive_const(PartialEq)]
| ^^^^^^^^^ unsatisfied trait bound introduced in this `derive` macro
= note: this error originates in the derive macro `PartialEq` (in Nightly builds, run with -Z macro-backtrace for more info)
error: aborting due to 4 previous errors; 1 warning emitted
Some errors have detailed explanations: E0207, E0284.
For more information about an error, try `rustc --explain E0207`.

View File

@ -3,7 +3,7 @@
//
//@ check-pass
#![feature(const_trait_impl, effects)]
#![feature(const_trait_impl, effects)] //~ WARN the feature `effects` is incomplete
//@ aux-build: cross-crate.rs
extern crate cross_crate;

View File

@ -0,0 +1,11 @@
warning: the feature `effects` is incomplete and may not be safe to use and/or cause compiler crashes
--> $DIR/cross-crate-default-method-body-is-const.rs:6:30
|
LL | #![feature(const_trait_impl, effects)]
| ^^^^^^^
|
= note: see issue #102090 <https://github.com/rust-lang/rust/issues/102090> for more information
= note: `#[warn(incomplete_features)]` on by default
warning: 1 warning emitted

View File

@ -0,0 +1,11 @@
warning: the feature `effects` is incomplete and may not be safe to use and/or cause compiler crashes
--> $DIR/cross-crate.rs:3:60
|
LL | #![cfg_attr(any(gated, gatednc), feature(const_trait_impl, effects))]
| ^^^^^^^
|
= note: see issue #102090 <https://github.com/rust-lang/rust/issues/102090> for more information
= note: `#[warn(incomplete_features)]` on by default
warning: 1 warning emitted

View File

@ -1,11 +1,20 @@
warning: the feature `effects` is incomplete and may not be safe to use and/or cause compiler crashes
--> $DIR/cross-crate.rs:3:60
|
LL | #![cfg_attr(any(gated, gatednc), feature(const_trait_impl, effects))]
| ^^^^^^^
|
= note: see issue #102090 <https://github.com/rust-lang/rust/issues/102090> for more information
= note: `#[warn(incomplete_features)]` on by default
error[E0277]: the trait bound `cross_crate::NonConst: ~const cross_crate::MyTrait` is not satisfied
--> $DIR/cross-crate.rs:17:14
--> $DIR/cross-crate.rs:18:14
|
LL | NonConst.func();
| ^^^^ the trait `~const cross_crate::MyTrait` is not implemented for `cross_crate::NonConst`
|
= help: the trait `cross_crate::MyTrait` is implemented for `cross_crate::NonConst`
error: aborting due to 1 previous error
error: aborting due to 1 previous error; 1 warning emitted
For more information about this error, try `rustc --explain E0277`.

View File

@ -1,6 +1,7 @@
//@ revisions: stock gated stocknc gatednc
//@ [gated] check-pass
#![cfg_attr(any(gated, gatednc), feature(const_trait_impl, effects))]
//[gated,gatednc]~^ WARN the feature `effects` is incomplete
//@ aux-build: cross-crate.rs
extern crate cross_crate;

View File

@ -1,5 +1,5 @@
error[E0015]: cannot call non-const fn `<cross_crate::Const as cross_crate::MyTrait>::func` in constant functions
--> $DIR/cross-crate.rs:20:11
--> $DIR/cross-crate.rs:21:11
|
LL | Const.func();
| ^^^^^^

View File

@ -1,5 +1,5 @@
error[E0015]: cannot call non-const fn `<cross_crate::NonConst as cross_crate::MyTrait>::func` in constant functions
--> $DIR/cross-crate.rs:17:14
--> $DIR/cross-crate.rs:18:14
|
LL | NonConst.func();
| ^^^^^^
@ -11,7 +11,7 @@ LL + #![feature(const_trait_impl)]
|
error[E0015]: cannot call non-const fn `<cross_crate::Const as cross_crate::MyTrait>::func` in constant functions
--> $DIR/cross-crate.rs:20:11
--> $DIR/cross-crate.rs:21:11
|
LL | Const.func();
| ^^^^^^

View File

@ -1,4 +1,4 @@
#![feature(const_trait_impl, effects)]
#![feature(const_trait_impl, effects)] //~ WARN the feature `effects` is incomplete
#[const_trait]
pub trait Tr {

View File

@ -1,3 +1,12 @@
warning: the feature `effects` is incomplete and may not be safe to use and/or cause compiler crashes
--> $DIR/default-method-body-is-const-same-trait-ck.rs:1:30
|
LL | #![feature(const_trait_impl, effects)]
| ^^^^^^^
|
= note: see issue #102090 <https://github.com/rust-lang/rust/issues/102090> for more information
= note: `#[warn(incomplete_features)]` on by default
error[E0277]: the trait bound `(): ~const Tr` is not satisfied
--> $DIR/default-method-body-is-const-same-trait-ck.rs:8:12
|
@ -6,6 +15,6 @@ LL | ().a()
|
= help: the trait `Tr` is implemented for `()`
error: aborting due to 1 previous error
error: aborting due to 1 previous error; 1 warning emitted
For more information about this error, try `rustc --explain E0277`.

View File

@ -1,5 +1,5 @@
//@ check-pass
#![feature(const_trait_impl, rustc_attrs, effects)]
#![feature(const_trait_impl, rustc_attrs, effects)] //~ WARN the feature `effects` is incomplete
#[const_trait]
trait Foo {

View File

@ -0,0 +1,11 @@
warning: the feature `effects` is incomplete and may not be safe to use and/or cause compiler crashes
--> $DIR/do-not-const-check-override.rs:2:43
|
LL | #![feature(const_trait_impl, rustc_attrs, effects)]
| ^^^^^^^
|
= note: see issue #102090 <https://github.com/rust-lang/rust/issues/102090> for more information
= note: `#[warn(incomplete_features)]` on by default
warning: 1 warning emitted

View File

@ -1,4 +1,4 @@
#![feature(const_trait_impl, effects)]
#![feature(const_trait_impl, effects)] //~ WARN the feature `effects` is incomplete
pub const fn foo() {}

View File

@ -3,7 +3,7 @@
//
//@ check-pass
#![feature(const_trait_impl, effects)]
#![feature(const_trait_impl, effects)] //~ WARN the feature `effects` is incomplete
#[const_trait]
pub trait Foo<Rhs: ?Sized = Self> {

View File

@ -0,0 +1,11 @@
warning: the feature `effects` is incomplete and may not be safe to use and/or cause compiler crashes
--> $DIR/effect-param-infer.rs:6:30
|
LL | #![feature(const_trait_impl, effects)]
| ^^^^^^^
|
= note: see issue #102090 <https://github.com/rust-lang/rust/issues/102090> for more information
= note: `#[warn(incomplete_features)]` on by default
warning: 1 warning emitted

View File

@ -1,6 +1,6 @@
//@ check-pass
#![feature(effects)]
#![feature(effects)] //~ WARN the feature `effects` is incomplete
pub const fn owo() {}

View File

@ -0,0 +1,11 @@
warning: the feature `effects` is incomplete and may not be safe to use and/or cause compiler crashes
--> $DIR/fallback.rs:3:12
|
LL | #![feature(effects)]
| ^^^^^^^
|
= note: see issue #102090 <https://github.com/rust-lang/rust/issues/102090> for more information
= note: `#[warn(incomplete_features)]` on by default
warning: 1 warning emitted

View File

@ -3,7 +3,12 @@
// gate-test-effects
// ^ effects doesn't have a gate so we will trick tidy into thinking this is a gate test
#![feature(const_trait_impl, effects, core_intrinsics, const_eval_select)]
#![feature(
const_trait_impl,
effects, //~ WARN the feature `effects` is incomplete
core_intrinsics,
const_eval_select
)]
// ensure we are passing in the correct host effect in always const contexts.

View File

@ -0,0 +1,11 @@
warning: the feature `effects` is incomplete and may not be safe to use and/or cause compiler crashes
--> $DIR/helloworld.rs:8:5
|
LL | effects,
| ^^^^^^^
|
= note: see issue #102090 <https://github.com/rust-lang/rust/issues/102090> for more information
= note: `#[warn(incomplete_features)]` on by default
warning: 1 warning emitted

View File

@ -1,16 +1,15 @@
#![feature(const_trait_impl, effects)]
#![feature(const_trait_impl, effects)] //~ WARN the feature `effects` is incomplete
const fn test() -> impl ~const Fn() {
//~^ ERROR `~const` can only be applied to `#[const_trait]` traits
//~| ERROR `~const` can only be applied to `#[const_trait]` traits
//~| ERROR cycle detected
const move || { //~ ERROR const closures are experimental
let sl: &[u8] = b"foo";
match sl {
[first, remainder @ ..] => {
assert_eq!(first, &b'f');
//~^ ERROR can't compare `&u8` with `&u8`
//~^ ERROR cannot call non-const fn
}
[] => panic!(),
}

View File

@ -1,5 +1,5 @@
error[E0658]: const closures are experimental
--> $DIR/ice-112822-expected-type-for-param.rs:7:5
--> $DIR/ice-112822-expected-type-for-param.rs:6:5
|
LL | const move || {
| ^^^^^
@ -8,6 +8,15 @@ LL | const move || {
= help: add `#![feature(const_closures)]` to the crate attributes to enable
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
warning: the feature `effects` is incomplete and may not be safe to use and/or cause compiler crashes
--> $DIR/ice-112822-expected-type-for-param.rs:1:30
|
LL | #![feature(const_trait_impl, effects)]
| ^^^^^^^
|
= note: see issue #102090 <https://github.com/rust-lang/rust/issues/102090> for more information
= note: `#[warn(incomplete_features)]` on by default
error: `~const` can only be applied to `#[const_trait]` traits
--> $DIR/ice-112822-expected-type-for-param.rs:3:32
|
@ -22,47 +31,16 @@ LL | const fn test() -> impl ~const Fn() {
|
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error[E0277]: can't compare `&u8` with `&u8`
--> $DIR/ice-112822-expected-type-for-param.rs:12:17
error[E0015]: cannot call non-const fn `core::panicking::assert_failed::<&u8, &u8>` in constant functions
--> $DIR/ice-112822-expected-type-for-param.rs:11:17
|
LL | assert_eq!(first, &b'f');
| ^^^^^^^^^^^^^^^^^^^^^^^^ no implementation for `&u8 == &u8`
| ^^^^^^^^^^^^^^^^^^^^^^^^
|
= help: the trait `~const PartialEq<&u8>` is not implemented for `&u8`
= note: calls in constant functions are limited to constant functions, tuple structs and tuple variants
= note: this error originates in the macro `assert_eq` (in Nightly builds, run with -Z macro-backtrace for more info)
error[E0391]: cycle detected when computing type of opaque `test::{opaque#0}`
--> $DIR/ice-112822-expected-type-for-param.rs:3:20
|
LL | const fn test() -> impl ~const Fn() {
| ^^^^^^^^^^^^^^^^
|
note: ...which requires borrow-checking `test`...
--> $DIR/ice-112822-expected-type-for-param.rs:3:1
|
LL | const fn test() -> impl ~const Fn() {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
note: ...which requires promoting constants in MIR for `test`...
--> $DIR/ice-112822-expected-type-for-param.rs:3:1
|
LL | const fn test() -> impl ~const Fn() {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
note: ...which requires const checking `test`...
--> $DIR/ice-112822-expected-type-for-param.rs:3:1
|
LL | const fn test() -> impl ~const Fn() {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
= note: ...which requires computing whether `test::{opaque#0}` is freeze...
= note: ...which requires evaluating trait selection obligation `test::{opaque#0}: core::marker::Freeze`...
= note: ...which again requires computing type of opaque `test::{opaque#0}`, completing the cycle
note: cycle used when computing type of `test::{opaque#0}`
--> $DIR/ice-112822-expected-type-for-param.rs:3:20
|
LL | const fn test() -> impl ~const Fn() {
| ^^^^^^^^^^^^^^^^
= note: see https://rustc-dev-guide.rust-lang.org/overview.html#queries and https://rustc-dev-guide.rust-lang.org/query.html for more information
error: aborting due to 4 previous errors; 1 warning emitted
error: aborting due to 5 previous errors
Some errors have detailed explanations: E0277, E0391, E0658.
For more information about an error, try `rustc --explain E0277`.
Some errors have detailed explanations: E0015, E0658.
For more information about an error, try `rustc --explain E0015`.

View File

@ -1,5 +1,5 @@
//@ check-pass
#![feature(const_trait_impl, effects)]
#![feature(const_trait_impl, effects)] //~ WARN the feature `effects` is incomplete
const fn a() {}

View File

@ -0,0 +1,11 @@
warning: the feature `effects` is incomplete and may not be safe to use and/or cause compiler crashes
--> $DIR/infer-fallback.rs:2:30
|
LL | #![feature(const_trait_impl, effects)]
| ^^^^^^^
|
= note: see issue #102090 <https://github.com/rust-lang/rust/issues/102090> for more information
= note: `#[warn(incomplete_features)]` on by default
warning: 1 warning emitted

Some files were not shown because too many files have changed in this diff Show More