Skip to content

Commit d3992fa

Browse files
committed
Add feature gate for view_types
1 parent 03c609a commit d3992fa

4 files changed

Lines changed: 68 additions & 0 deletions

File tree

compiler/rustc_feature/src/unstable.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -723,6 +723,8 @@ declare_features! (
723723
(internal, unsized_fn_params, "1.49.0", Some(48055)),
724724
/// Allows using the `#[used(linker)]` (or `#[used(compiler)]`) attribute.
725725
(unstable, used_with_arg, "1.60.0", Some(93798)),
726+
/// Allows view types.
727+
(unstable, view_types, "CURRENT_RUSTC_VERSION", Some(155938)),
726728
/// Target features on wasm.
727729
(unstable, wasm_target_feature, "1.30.0", Some(150260)),
728730
/// Allows use of attributes in `where` clauses.

compiler/rustc_span/src/symbol.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2232,6 +2232,7 @@ symbols! {
22322232
verbatim,
22332233
version,
22342234
vfp2,
2235+
view_types,
22352236
vis,
22362237
visible_private_types,
22372238
volatile,
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
//@ known-bug: #155938
2+
3+
struct Foo {
4+
a: usize,
5+
b: usize,
6+
}
7+
8+
fn bar(a: &mut Foo.{ a }, b: &mut Foo.{ b }) {
9+
a.a += 1;
10+
b.b += 1;
11+
}
12+
13+
fn main() {
14+
let mut foo = Foo { a: 0, b: 0 };
15+
bar(&mut foo, &mut foo);
16+
}
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
error: expected parameter name, found `{`
2+
--> $DIR/feature-gate-view-types.rs:8:20
3+
|
4+
LL | fn bar(a: &mut Foo.{ a }, b: &mut Foo.{ b }) {
5+
| ^ expected parameter name
6+
7+
error: expected one of `!`, `(`, `)`, `,`, `::`, or `<`, found `.`
8+
--> $DIR/feature-gate-view-types.rs:8:19
9+
|
10+
LL | fn bar(a: &mut Foo.{ a }, b: &mut Foo.{ b }) {
11+
| ^
12+
| |
13+
| expected one of `!`, `(`, `)`, `,`, `::`, or `<`
14+
| help: missing `,`
15+
16+
error: expected parameter name, found `{`
17+
--> $DIR/feature-gate-view-types.rs:8:39
18+
|
19+
LL | fn bar(a: &mut Foo.{ a }, b: &mut Foo.{ b }) {
20+
| ^ expected parameter name
21+
22+
error: expected one of `!`, `(`, `)`, `,`, `::`, or `<`, found `.`
23+
--> $DIR/feature-gate-view-types.rs:8:38
24+
|
25+
LL | fn bar(a: &mut Foo.{ a }, b: &mut Foo.{ b }) {
26+
| ^
27+
| |
28+
| expected one of `!`, `(`, `)`, `,`, `::`, or `<`
29+
| help: missing `,`
30+
31+
error[E0061]: this function takes 4 arguments but 2 arguments were supplied
32+
--> $DIR/feature-gate-view-types.rs:15:5
33+
|
34+
LL | bar(&mut foo, &mut foo);
35+
| ^^^-------------------- two arguments are missing
36+
|
37+
note: function defined here
38+
--> $DIR/feature-gate-view-types.rs:8:4
39+
|
40+
LL | fn bar(a: &mut Foo.{ a }, b: &mut Foo.{ b }) {
41+
| ^^^ -----------------
42+
help: provide the arguments
43+
|
44+
LL | bar(&mut foo, &mut foo, /* &mut Foo */, /* _ */);
45+
| +++++++++++++++++++++++++
46+
47+
error: aborting due to 5 previous errors
48+
49+
For more information about this error, try `rustc --explain E0061`.

0 commit comments

Comments
 (0)