Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions compiler/rustc_feature/src/unstable.rs
Original file line number Diff line number Diff line change
Expand Up @@ -723,6 +723,8 @@ declare_features! (
(internal, unsized_fn_params, "1.49.0", Some(48055)),
/// Allows using the `#[used(linker)]` (or `#[used(compiler)]`) attribute.
(unstable, used_with_arg, "1.60.0", Some(93798)),
/// Allows view types.
(unstable, view_types, "CURRENT_RUSTC_VERSION", Some(155938)),
/// Target features on wasm.
(unstable, wasm_target_feature, "1.30.0", Some(150260)),
/// Allows use of attributes in `where` clauses.
Expand Down
1 change: 1 addition & 0 deletions compiler/rustc_span/src/symbol.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2232,6 +2232,7 @@ symbols! {
verbatim,
version,
vfp2,
view_types,
vis,
visible_private_types,
volatile,
Expand Down
16 changes: 16 additions & 0 deletions tests/ui/feature-gates/feature-gate-view-types.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
//@ known-bug: #155938
Comment thread
lqd marked this conversation as resolved.
Outdated
Comment thread
scrabsha marked this conversation as resolved.
Outdated

struct Foo {
Comment thread
scrabsha marked this conversation as resolved.
a: usize,
b: usize,
}

fn bar(a: &mut Foo.{ a }, b: &mut Foo.{ b }) {
Comment thread
scrabsha marked this conversation as resolved.
a.a += 1;
b.b += 1;
}

fn main() {
let mut foo = Foo { a: 0, b: 0 };
bar(&mut foo, &mut foo);
Comment thread
scrabsha marked this conversation as resolved.
}
49 changes: 49 additions & 0 deletions tests/ui/feature-gates/feature-gate-view-types.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
error: expected parameter name, found `{`
--> $DIR/feature-gate-view-types.rs:8:20
|
LL | fn bar(a: &mut Foo.{ a }, b: &mut Foo.{ b }) {
| ^ expected parameter name

error: expected one of `!`, `(`, `)`, `,`, `::`, or `<`, found `.`
--> $DIR/feature-gate-view-types.rs:8:19
|
LL | fn bar(a: &mut Foo.{ a }, b: &mut Foo.{ b }) {
| ^
| |
| expected one of `!`, `(`, `)`, `,`, `::`, or `<`
| help: missing `,`

error: expected parameter name, found `{`
--> $DIR/feature-gate-view-types.rs:8:39
|
LL | fn bar(a: &mut Foo.{ a }, b: &mut Foo.{ b }) {
| ^ expected parameter name

error: expected one of `!`, `(`, `)`, `,`, `::`, or `<`, found `.`
--> $DIR/feature-gate-view-types.rs:8:38
|
LL | fn bar(a: &mut Foo.{ a }, b: &mut Foo.{ b }) {
| ^
| |
| expected one of `!`, `(`, `)`, `,`, `::`, or `<`
| help: missing `,`

error[E0061]: this function takes 4 arguments but 2 arguments were supplied
--> $DIR/feature-gate-view-types.rs:15:5
|
LL | bar(&mut foo, &mut foo);
| ^^^-------------------- two arguments are missing
|
note: function defined here
--> $DIR/feature-gate-view-types.rs:8:4
|
LL | fn bar(a: &mut Foo.{ a }, b: &mut Foo.{ b }) {
| ^^^ -----------------
help: provide the arguments
|
LL | bar(&mut foo, &mut foo, /* &mut Foo */, /* _ */);
| +++++++++++++++++++++++++

error: aborting due to 5 previous errors

For more information about this error, try `rustc --explain E0061`.
Loading