Add #![feature(unsized_locals)].

This commit is contained in:
Masaki Hara 2018-05-29 00:10:09 +09:00
parent cd0476a390
commit 7f05304068
3 changed files with 31 additions and 0 deletions

View file

@ -503,6 +503,9 @@ pub fn walk_feature_fields<F>(&self, mut f: F)
// 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! (

View file

@ -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() {
}

View file

@ -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`.