diff options
| author | Masaki Hara <ackie.h.gmai@gmail.com> | 2018-05-29 00:10:09 +0900 |
|---|---|---|
| committer | Masaki Hara <ackie.h.gmai@gmail.com> | 2018-08-19 08:07:33 +0900 |
| commit | 7f05304068bf6a3b84b328ad6911f6645a0dbf40 (patch) | |
| tree | ce57c85df05560464ae02a566d2a3d636b8b05d1 | |
| parent | cd0476a390bbaf754501859bc56328b0078c88f5 (diff) | |
| download | rust-7f05304068bf6a3b84b328ad6911f6645a0dbf40.tar.gz rust-7f05304068bf6a3b84b328ad6911f6645a0dbf40.zip | |
Add #![feature(unsized_locals)].
| -rw-r--r-- | src/libsyntax/feature_gate.rs | 3 | ||||
| -rw-r--r-- | src/test/ui/feature-gate-unsized_locals.rs | 15 | ||||
| -rw-r--r-- | src/test/ui/feature-gate-unsized_locals.stderr | 13 |
3 files changed, 31 insertions, 0 deletions
diff --git a/src/libsyntax/feature_gate.rs b/src/libsyntax/feature_gate.rs index 3b9e1b3c265..e8245a553eb 100644 --- a/src/libsyntax/feature_gate.rs +++ b/src/libsyntax/feature_gate.rs @@ -503,6 +503,9 @@ declare_features! ( // Allows `Self` in type definitions (active, self_in_typedefs, "1.30.0", Some(49303), None), + + // unsized rvalues at arguments and parameters + (active, unsized_locals, "1.30.0", Some(48055), None), ); declare_features! ( diff --git a/src/test/ui/feature-gate-unsized_locals.rs b/src/test/ui/feature-gate-unsized_locals.rs new file mode 100644 index 00000000000..7f1f22fa38f --- /dev/null +++ b/src/test/ui/feature-gate-unsized_locals.rs @@ -0,0 +1,15 @@ +// Copyright 2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or +// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license +// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +fn f(f: FnOnce()) {} +//~^ ERROR E0277 + +fn main() { +} diff --git a/src/test/ui/feature-gate-unsized_locals.stderr b/src/test/ui/feature-gate-unsized_locals.stderr new file mode 100644 index 00000000000..3cb0aa3b3ec --- /dev/null +++ b/src/test/ui/feature-gate-unsized_locals.stderr @@ -0,0 +1,13 @@ +error[E0277]: the size for values of type `(dyn std::ops::FnOnce() + 'static)` cannot be known at compilation time + --> $DIR/feature-gate-unsized_locals.rs:11:6 + | +LL | fn f(f: FnOnce()) {} + | ^ doesn't have a size known at compile-time + | + = help: the trait `std::marker::Sized` is not implemented for `(dyn std::ops::FnOnce() + 'static)` + = note: to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait> + = note: all local variables must have a statically known size + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0277`. |
