Skip to content

Commit

Permalink
Make effects an incomplete feature
Browse files Browse the repository at this point in the history
  • Loading branch information
fee1-dead committed Jun 22, 2024
1 parent a6a83d3 commit 81da6a6
Show file tree
Hide file tree
Showing 123 changed files with 774 additions and 111 deletions.
2 changes: 1 addition & 1 deletion compiler/rustc_feature/src/unstable.rs
Original file line number Diff line number Diff line change
Expand Up @@ -449,7 +449,7 @@ declare_features! (
/// 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.
Expand Down
4 changes: 2 additions & 2 deletions src/doc/unstable-book/src/language-features/intrinsics.md
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand All @@ -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]
Expand Down
2 changes: 1 addition & 1 deletion src/tools/miri/tests/fail/intrinsic_fallback_is_spec.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#![feature(rustc_attrs, effects)]
#![feature(rustc_attrs)]

#[rustc_intrinsic]
#[rustc_nounwind]
Expand Down
1 change: 1 addition & 0 deletions tests/rustdoc/const-effect-param.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

#![crate_name = "foo"]
#![feature(effects, const_trait_impl)]
#![allow(incomplete_features)]

#[const_trait]
pub trait Tr {
Expand Down
1 change: 1 addition & 0 deletions tests/rustdoc/const-fn-effects.rs
Original file line number Diff line number Diff line change
@@ -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() -> '
Expand Down
21 changes: 11 additions & 10 deletions tests/rustdoc/rfc-2632-const-trait-impl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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"]

Expand All @@ -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 */,
{
}
}
Expand All @@ -36,13 +37,13 @@ pub trait Tr<T> {
// @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 */,
{
}
}
Expand All @@ -51,9 +52,9 @@ where
// @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()
}
Expand All @@ -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()
}
Expand Down
2 changes: 1 addition & 1 deletion tests/ui/const-generics/const_trait_fn-issue-88433.rs
Original file line number Diff line number Diff line change
@@ -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> {
Expand Down
11 changes: 11 additions & 0 deletions tests/ui/const-generics/const_trait_fn-issue-88433.stderr
Original file line number Diff line number Diff line change
@@ -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

2 changes: 1 addition & 1 deletion tests/ui/consts/auxiliary/closure-in-foreign-crate.rs
Original file line number Diff line number Diff line change
@@ -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 || {};
Expand Down
11 changes: 10 additions & 1 deletion tests/ui/consts/const-float-classify.stderr
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
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
|
Expand Down Expand Up @@ -208,7 +217,7 @@ 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
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`.
11 changes: 10 additions & 1 deletion tests/ui/consts/const_cmp_type_id.stderr
Original file line number Diff line number Diff line change
@@ -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
|
Expand All @@ -10,7 +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: aborting due to 2 previous errors
error: aborting due to 2 previous errors; 1 warning emitted

Some errors have detailed explanations: E0080, E0131.
For more information about an error, try `rustc --explain E0080`.
11 changes: 10 additions & 1 deletion tests/ui/consts/rustc-impl-const-stability.stderr
Original file line number Diff line number Diff line change
@@ -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
|
Expand All @@ -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`.
2 changes: 1 addition & 1 deletion tests/ui/parser/impls-nested-within-fns-semantic-1.rs
Original file line number Diff line number Diff line change
@@ -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 {
Expand Down
11 changes: 11 additions & 0 deletions tests/ui/parser/impls-nested-within-fns-semantic-1.stderr
Original file line number Diff line number Diff line change
@@ -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

Original file line number Diff line number Diff line change
@@ -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
|
Expand All @@ -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`.
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
Original file line number Diff line number Diff line change
@@ -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

2 changes: 1 addition & 1 deletion tests/ui/rfcs/rfc-2632-const-trait-impl/assoc-type.rs
Original file line number Diff line number Diff line change
@@ -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> {
Expand Down
11 changes: 10 additions & 1 deletion tests/ui/rfcs/rfc-2632-const-trait-impl/assoc-type.stderr
Original file line number Diff line number Diff line change
@@ -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
|
Expand All @@ -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`.
Original file line number Diff line number Diff line change
@@ -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 {
Expand Down
Original file line number Diff line number Diff line change
@@ -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")]

Expand Down
Original file line number Diff line number Diff line change
@@ -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 {
Expand Down
Original file line number Diff line number Diff line change
@@ -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
|
Expand All @@ -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`.
Original file line number Diff line number Diff line change
@@ -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-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
|
Expand Down Expand Up @@ -56,7 +65,7 @@ LL | impl const PartialEq for S {
| |
| unsatisfied trait bound introduced here

error: aborting due to 6 previous errors
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`.
Original file line number Diff line number Diff line change
@@ -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-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
|
Expand Down Expand Up @@ -70,7 +79,7 @@ LL | impl const PartialEq for S {
| |
| unsatisfied trait bound introduced here

error: aborting due to 7 previous errors
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`.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
//@ check-pass

#![feature(const_trait_impl, effects)]
#![feature(const_trait_impl, effects)] //~ WARN the feature `effects` is incomplete

pub const fn equals_self<T: PartialEq>(t: &T) -> bool {
*t == *t
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
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 | #![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

Loading

0 comments on commit 81da6a6

Please sign in to comment.