Skip to content

Commit

Permalink
Make feature flag incomplete
Browse files Browse the repository at this point in the history
  • Loading branch information
spastorino committed Mar 6, 2025
1 parent 5a6d00c commit d7104dc
Show file tree
Hide file tree
Showing 29 changed files with 43 additions and 25 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 @@ -474,7 +474,7 @@ declare_features! (
/// Allows `dyn* Trait` objects.
(incomplete, dyn_star, "1.65.0", Some(102425)),
/// Allows the .use postfix syntax `x.use` and use closures `use |x| { ... }`
(unstable, ergonomic_clones, "CURRENT_RUSTC_VERSION", Some(132290)),
(incomplete, ergonomic_clones, "CURRENT_RUSTC_VERSION", Some(132290)),
/// 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
1 change: 1 addition & 0 deletions tests/ui/ergonomic-clones/async/basic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
//@ edition:2018

#![feature(ergonomic_clones)]
#![allow(incomplete_features)]

use std::future::Future;

Expand Down
1 change: 1 addition & 0 deletions tests/ui/ergonomic-clones/async/edition-2015.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#![feature(ergonomic_clones)]
#![allow(incomplete_features)]

fn main() {
async use {};
Expand Down
2 changes: 1 addition & 1 deletion tests/ui/ergonomic-clones/async/edition-2015.stderr
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
error: `async use` blocks are only allowed in Rust 2018 or later
--> $DIR/edition-2015.rs:4:5
--> $DIR/edition-2015.rs:5:5
|
LL | async use {};
| ^^^^^^^^^
Expand Down
1 change: 1 addition & 0 deletions tests/ui/ergonomic-clones/async/local-type.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
//@ edition:2018

#![feature(ergonomic_clones)]
#![allow(incomplete_features)]

fn main() {
let _ = async use |x: x| x; //~ ERROR expected type
Expand Down
4 changes: 2 additions & 2 deletions tests/ui/ergonomic-clones/async/local-type.stderr
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
error[E0573]: expected type, found local variable `x`
--> $DIR/local-type.rs:7:27
--> $DIR/local-type.rs:8:27
|
LL | let _ = async use |x: x| x;
| ^ not a type

error[E0573]: expected type, found local variable `x`
--> $DIR/local-type.rs:8:36
--> $DIR/local-type.rs:9:36
|
LL | let _ = async use |x: bool| -> x { x };
| ^ not a type
Expand Down
1 change: 1 addition & 0 deletions tests/ui/ergonomic-clones/closure/basic.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
//@ check-pass

#![feature(ergonomic_clones)]
#![allow(incomplete_features)]

use std::clone::UseCloned;
use std::future::Future;
Expand Down
1 change: 1 addition & 0 deletions tests/ui/ergonomic-clones/closure/fn-once.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#![feature(ergonomic_clones)]
#![allow(incomplete_features)]

fn get_closure() -> Box<dyn Fn() -> Vec<u8>> {
let vec = vec![1u8, 2u8];
Expand Down
4 changes: 2 additions & 2 deletions tests/ui/ergonomic-clones/closure/fn-once.stderr
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
error[E0525]: expected a closure that implements the `Fn` trait, but this closure only implements `FnOnce`
--> $DIR/fn-once.rs:6:19
--> $DIR/fn-once.rs:7:19
|
LL | let closure = use || {
| ^^^^^^ this closure implements `FnOnce`, not `Fn`
Expand All @@ -9,7 +9,7 @@ LL | vec
LL | Box::new(closure)
| ----------------- the requirement to implement `Fn` derives from here
|
= note: required for the cast from `Box<{closure@$DIR/fn-once.rs:6:19: 6:25}>` to `Box<(dyn Fn() -> Vec<u8> + 'static)>`
= note: required for the cast from `Box<{closure@$DIR/fn-once.rs:7:19: 7:25}>` to `Box<(dyn Fn() -> Vec<u8> + 'static)>`

error: aborting due to 1 previous error

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
// Point at the captured immutable outer variable

#![feature(ergonomic_clones)]
#![allow(incomplete_features)]

fn foo(mut f: Box<dyn FnMut()>) {
f();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
// Point at the captured immutable outer variable

#![feature(ergonomic_clones)]
#![allow(incomplete_features)]

fn foo(mut f: Box<dyn FnMut()>) {
f();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
error[E0594]: cannot assign to `y`, as it is not declared as mutable
--> $DIR/immutable-outer-variable.rs:13:25
--> $DIR/immutable-outer-variable.rs:14:25
|
LL | foo(Box::new(use || y = !y) as Box<_>);
| ^^^^^^ cannot assign
Expand Down
1 change: 1 addition & 0 deletions tests/ui/ergonomic-clones/closure/local-type.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// Check that using the parameter name in its type does not ICE.

#![feature(ergonomic_clones)]
#![allow(incomplete_features)]

fn main() {
let _ = use |x: x| x; //~ ERROR expected type
Expand Down
4 changes: 2 additions & 2 deletions tests/ui/ergonomic-clones/closure/local-type.stderr
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
error[E0573]: expected type, found local variable `x`
--> $DIR/local-type.rs:6:21
--> $DIR/local-type.rs:7:21
|
LL | let _ = use |x: x| x;
| ^ not a type

error[E0573]: expected type, found local variable `x`
--> $DIR/local-type.rs:7:30
--> $DIR/local-type.rs:8:30
|
LL | let _ = use |x: bool| -> x { x };
| ^ not a type
Expand Down
1 change: 1 addition & 0 deletions tests/ui/ergonomic-clones/closure/mutation.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
//@ check-pass

#![feature(ergonomic_clones)]
#![allow(incomplete_features)]

fn main() {
let mut my_var = false;
Expand Down
1 change: 1 addition & 0 deletions tests/ui/ergonomic-clones/closure/mutation2.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#![feature(ergonomic_clones)]
#![allow(incomplete_features)]

fn main() {
let mut my_var = false;
Expand Down
2 changes: 1 addition & 1 deletion tests/ui/ergonomic-clones/closure/mutation2.stderr
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
error[E0596]: cannot borrow `callback` as mutable, as it is not declared as mutable
--> $DIR/mutation2.rs:8:5
--> $DIR/mutation2.rs:9:5
|
LL | my_var = true;
| ------ calling `callback` requires mutable binding due to possible mutation of `my_var`
Expand Down
1 change: 1 addition & 0 deletions tests/ui/ergonomic-clones/closure/nested.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
//@ run-pass

#![feature(ergonomic_clones)]
#![allow(incomplete_features)]

use std::clone::UseCloned;

Expand Down
1 change: 1 addition & 0 deletions tests/ui/ergonomic-clones/closure/once-move-out-on-heap.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
// Testing guarantees provided by once functions.

#![feature(ergonomic_clones)]
#![allow(incomplete_features)]

use std::sync::Arc;

Expand Down
1 change: 1 addition & 0 deletions tests/ui/ergonomic-clones/closure/parse.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#![feature(ergonomic_clones)]
#![allow(incomplete_features)]

fn parse1() {
|| use {
Expand Down
6 changes: 3 additions & 3 deletions tests/ui/ergonomic-clones/closure/parse.stderr
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
error: expected one of `async`, `|`, or `||`, found `{`
--> $DIR/parse.rs:4:12
--> $DIR/parse.rs:5:12
|
LL | || use {
| -- ^ expected one of `async`, `|`, or `||`
Expand All @@ -13,13 +13,13 @@ LL ~ || { use {
|

error: expected one of `async`, `|`, or `||`, found keyword `use`
--> $DIR/parse.rs:10:10
--> $DIR/parse.rs:11:10
|
LL | move use || {
| ^^^ expected one of `async`, `|`, or `||`

error: expected one of `async`, `|`, or `||`, found keyword `move`
--> $DIR/parse.rs:16:9
--> $DIR/parse.rs:17:9
|
LL | use move || {
| ^^^^ expected one of `async`, `|`, or `||`
Expand Down
1 change: 1 addition & 0 deletions tests/ui/ergonomic-clones/closure/print-verbose.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
//@ compile-flags: -Zverbose-internals

#![feature(ergonomic_clones)]
#![allow(incomplete_features)]

fn to_fn_once<F: FnOnce()>(f: F) -> F {
f
Expand Down
4 changes: 2 additions & 2 deletions tests/ui/ergonomic-clones/closure/print-verbose.stderr
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
error[E0382]: use of moved value: `c`
--> $DIR/print-verbose.rs:21:5
--> $DIR/print-verbose.rs:22:5
|
LL | let c = to_fn_once(use || {
| - move occurs because `c` has type `{f<T>::{closure#0} closure_kind_ty=i32 closure_sig_as_fn_ptr_ty=extern "rust-call" fn(()) upvar_tys=(Foo<&'?9 str>, T)}`, which does not implement the `Copy` trait
Expand All @@ -10,7 +10,7 @@ LL | c();
| ^ value used here after move
|
note: this value implements `FnOnce`, which causes it to be moved when called
--> $DIR/print-verbose.rs:20:5
--> $DIR/print-verbose.rs:21:5
|
LL | c();
| ^
Expand Down
1 change: 1 addition & 0 deletions tests/ui/ergonomic-clones/closure/print.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#![feature(ergonomic_clones)]
#![allow(incomplete_features)]

fn to_fn_once<F: FnOnce()>(f: F) -> F {
f
Expand Down
6 changes: 3 additions & 3 deletions tests/ui/ergonomic-clones/closure/print.stderr
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
error[E0382]: use of moved value: `c`
--> $DIR/print.rs:19:5
--> $DIR/print.rs:20:5
|
LL | let c = to_fn_once(use || {
| - move occurs because `c` has type `{closure@$DIR/print.rs:14:24: 14:30}`, which does not implement the `Copy` trait
| - move occurs because `c` has type `{closure@$DIR/print.rs:15:24: 15:30}`, which does not implement the `Copy` trait
...
LL | c();
| --- `c` moved due to this call
LL | c();
| ^ value used here after move
|
note: this value implements `FnOnce`, which causes it to be moved when called
--> $DIR/print.rs:18:5
--> $DIR/print.rs:19:5
|
LL | c();
| ^
Expand Down
1 change: 1 addition & 0 deletions tests/ui/ergonomic-clones/closure/with-binders.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

#![feature(closure_lifetime_binder)]
#![feature(ergonomic_clones)]
#![allow(incomplete_features)]

fn main() {
for<'a> use || -> () {};
Expand Down
1 change: 1 addition & 0 deletions tests/ui/ergonomic-clones/dotuse/basic.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
//@ check-pass

#![feature(ergonomic_clones)]
#![allow(incomplete_features)]

use std::clone::UseCloned;

Expand Down
1 change: 1 addition & 0 deletions tests/ui/ergonomic-clones/dotuse/parse.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#![feature(ergonomic_clones)]
#![allow(incomplete_features)]

fn parse1() {
1.use!;
Expand Down
14 changes: 7 additions & 7 deletions tests/ui/ergonomic-clones/dotuse/parse.stderr
Original file line number Diff line number Diff line change
@@ -1,29 +1,29 @@
error: expected one of `.`, `;`, `?`, `}`, or an operator, found `!`
--> $DIR/parse.rs:4:10
--> $DIR/parse.rs:5:10
|
LL | 1.use!;
| ^ expected one of `.`, `;`, `?`, `}`, or an operator

error: expected one of `.`, `;`, `?`, `}`, or an operator, found `!`
--> $DIR/parse.rs:9:10
--> $DIR/parse.rs:10:10
|
LL | 1.use!(2);
| ^ expected one of `.`, `;`, `?`, `}`, or an operator

error: expected one of `.`, `;`, `?`, `}`, or an operator, found `2`
--> $DIR/parse.rs:14:11
--> $DIR/parse.rs:15:11
|
LL | 1.use 2;
| ^ expected one of `.`, `;`, `?`, `}`, or an operator

error: expected one of `.`, `;`, `?`, `}`, or an operator, found `2`
--> $DIR/parse.rs:19:12
--> $DIR/parse.rs:20:12
|
LL | 1.use? 2;
| ^ expected one of `.`, `;`, `?`, `}`, or an operator

error: incorrect use of `use`
--> $DIR/parse.rs:24:10
--> $DIR/parse.rs:25:10
|
LL | 1.use();
| ^^
Expand All @@ -35,13 +35,13 @@ LL + 1.use;
|

error: expected one of `.`, `;`, `?`, `}`, or an operator, found `{`
--> $DIR/parse.rs:34:11
--> $DIR/parse.rs:35:11
|
LL | 1.use { 2 };
| ^ expected one of `.`, `;`, `?`, `}`, or an operator

error[E0618]: expected function, found `{integer}`
--> $DIR/parse.rs:29:5
--> $DIR/parse.rs:30:5
|
LL | 1.use(2);
| ^^^^^---
Expand Down

0 comments on commit d7104dc

Please sign in to comment.