Skip to content

Commit b698609

Browse files
authored
Rollup merge of #60770 - Pulkit07:issue60764, r=Centril
add impl_trait_in_bindings to INCOMPLETE_FEATURES impl_trait_in_bindings is not yet complete and can lead to compiler crashes. Fixes #60764.
2 parents 25b5d30 + ea956e3 commit b698609

File tree

7 files changed

+29
-7
lines changed

7 files changed

+29
-7
lines changed

src/libsyntax/feature_gate.rs

+1
Original file line numberDiff line numberDiff line change
@@ -563,6 +563,7 @@ declare_features! (
563563
// unanticipated results, such as compiler crashes. We warn the user about these
564564
// to alert them.
565565
const INCOMPLETE_FEATURES: &[Symbol] = &[
566+
sym::impl_trait_in_bindings,
566567
sym::generic_associated_types,
567568
sym::const_generics
568569
];

src/test/run-pass/impl-trait-in-bindings.rs

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
#![feature(impl_trait_in_bindings)]
2+
//~^ WARN the feature `impl_trait_in_bindings` is incomplete and may cause the compiler to crash
23

34
use std::fmt::Debug;
45

Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
warning: the feature `impl_trait_in_bindings` is incomplete and may cause the compiler to crash
2+
--> $DIR/impl-trait-in-bindings.rs:1:12
3+
|
4+
LL | #![feature(impl_trait_in_bindings)]
5+
| ^^^^^^^^^^^^^^^^^^^^^^
6+

src/test/ui/impl-trait/bindings-opaque.rs

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
#![feature(impl_trait_in_bindings)]
2+
//~^ WARN the feature `impl_trait_in_bindings` is incomplete and may cause the compiler to crash
23

34
const FOO: impl Copy = 42;
45

src/test/ui/impl-trait/bindings-opaque.stderr

+9-3
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,23 @@
1+
warning: the feature `impl_trait_in_bindings` is incomplete and may cause the compiler to crash
2+
--> $DIR/bindings-opaque.rs:1:12
3+
|
4+
LL | #![feature(impl_trait_in_bindings)]
5+
| ^^^^^^^^^^^^^^^^^^^^^^
6+
17
error[E0599]: no method named `count_ones` found for type `impl std::marker::Copy` in the current scope
2-
--> $DIR/bindings-opaque.rs:10:17
8+
--> $DIR/bindings-opaque.rs:11:17
39
|
410
LL | let _ = FOO.count_ones();
511
| ^^^^^^^^^^
612

713
error[E0599]: no method named `count_ones` found for type `impl std::marker::Copy` in the current scope
8-
--> $DIR/bindings-opaque.rs:12:17
14+
--> $DIR/bindings-opaque.rs:13:17
915
|
1016
LL | let _ = BAR.count_ones();
1117
| ^^^^^^^^^^
1218

1319
error[E0599]: no method named `count_ones` found for type `impl std::marker::Copy` in the current scope
14-
--> $DIR/bindings-opaque.rs:14:17
20+
--> $DIR/bindings-opaque.rs:15:17
1521
|
1622
LL | let _ = foo.count_ones();
1723
| ^^^^^^^^^^

src/test/ui/impl-trait/bindings.rs

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
#![feature(impl_trait_in_bindings)]
2+
//~^ WARN the feature `impl_trait_in_bindings` is incomplete and may cause the compiler to crash
23

34
fn a<T: Clone>(x: T) {
45
const foo: impl Clone = x;

src/test/ui/impl-trait/bindings.stderr

+10-4
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,29 @@
1+
warning: the feature `impl_trait_in_bindings` is incomplete and may cause the compiler to crash
2+
--> $DIR/bindings.rs:1:12
3+
|
4+
LL | #![feature(impl_trait_in_bindings)]
5+
| ^^^^^^^^^^^^^^^^^^^^^^
6+
17
error[E0435]: attempt to use a non-constant value in a constant
2-
--> $DIR/bindings.rs:4:29
8+
--> $DIR/bindings.rs:5:29
39
|
410
LL | const foo: impl Clone = x;
511
| ^ non-constant value
612

713
error[E0435]: attempt to use a non-constant value in a constant
8-
--> $DIR/bindings.rs:10:33
14+
--> $DIR/bindings.rs:11:33
915
|
1016
LL | const foo: impl Clone = x;
1117
| ^ non-constant value
1218

1319
error[E0435]: attempt to use a non-constant value in a constant
14-
--> $DIR/bindings.rs:17:33
20+
--> $DIR/bindings.rs:18:33
1521
|
1622
LL | const foo: impl Clone = x;
1723
| ^ non-constant value
1824

1925
error[E0435]: attempt to use a non-constant value in a constant
20-
--> $DIR/bindings.rs:24:33
26+
--> $DIR/bindings.rs:25:33
2127
|
2228
LL | const foo: impl Clone = x;
2329
| ^ non-constant value

0 commit comments

Comments
 (0)