Move unsized_tuple_coercion behind a feature gate.
This commit is contained in:
parent
b0bf1b4682
commit
03660b6476
16 changed files with 89 additions and 1 deletions
|
|
@ -10,6 +10,8 @@
|
|||
|
||||
// Forbid assignment into a dynamically sized type.
|
||||
|
||||
#![feature(unsized_tuple_coercion)]
|
||||
|
||||
type Fat<T: ?Sized> = (isize, &'static str, T);
|
||||
//~^ WARNING trait bounds are not (yet) enforced
|
||||
|
||||
|
|
|
|||
|
|
@ -10,6 +10,8 @@
|
|||
|
||||
// Attempt to change the type as well as unsizing.
|
||||
|
||||
#![feature(unsized_tuple_coercion)]
|
||||
|
||||
struct Fat<T: ?Sized> {
|
||||
ptr: T
|
||||
}
|
||||
|
|
|
|||
|
|
@ -10,6 +10,8 @@
|
|||
|
||||
// Attempt to extend the lifetime as well as unsizing.
|
||||
|
||||
#![feature(unsized_tuple_coercion)]
|
||||
|
||||
struct Fat<T: ?Sized> {
|
||||
ptr: T
|
||||
}
|
||||
|
|
|
|||
|
|
@ -10,6 +10,8 @@
|
|||
|
||||
// Attempt to coerce from unsized to sized.
|
||||
|
||||
#![feature(unsized_tuple_coercion)]
|
||||
|
||||
struct Fat<T: ?Sized> {
|
||||
ptr: T
|
||||
}
|
||||
|
|
|
|||
|
|
@ -13,6 +13,8 @@
|
|||
// because it would require stack allocation of an unsized temporary (*g in the
|
||||
// test).
|
||||
|
||||
#![feature(unsized_tuple_coercion)]
|
||||
|
||||
pub fn main() {
|
||||
let f: ([isize; 3],) = ([5, 6, 7],);
|
||||
let g: &([isize],) = &f;
|
||||
|
|
|
|||
14
src/test/compile-fail/feature-gate-unsized_tuple_coercion.rs
Normal file
14
src/test/compile-fail/feature-gate-unsized_tuple_coercion.rs
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
// Copyright 2017 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 main() {
|
||||
let _ : &(Send,) = &((),);
|
||||
//~^ ERROR Unsized tuple coercion is not stable enough
|
||||
}
|
||||
|
|
@ -10,6 +10,8 @@
|
|||
|
||||
// no-prefer-dynamic
|
||||
|
||||
#![feature(unsized_tuple_coercion)]
|
||||
|
||||
static mut DROP_RAN: bool = false;
|
||||
|
||||
struct Foo;
|
||||
|
|
|
|||
|
|
@ -10,6 +10,8 @@
|
|||
|
||||
// no-prefer-dynamic
|
||||
|
||||
#![feature(unsized_tuple_coercion)]
|
||||
|
||||
static mut DROP_RAN: isize = 0;
|
||||
|
||||
struct Foo;
|
||||
|
|
|
|||
|
|
@ -8,6 +8,8 @@
|
|||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
#![feature(unsized_tuple_coercion)]
|
||||
|
||||
struct Test<T: ?Sized>(T);
|
||||
|
||||
fn main() {
|
||||
|
|
|
|||
|
|
@ -11,6 +11,8 @@
|
|||
// Test DST raw pointers
|
||||
|
||||
|
||||
#![feature(unsized_tuple_coercion)]
|
||||
|
||||
trait Trait {
|
||||
fn foo(&self) -> isize;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -11,6 +11,7 @@
|
|||
|
||||
#![allow(unused_features)]
|
||||
#![feature(box_syntax)]
|
||||
#![feature(unsized_tuple_coercion)]
|
||||
|
||||
type Fat<T: ?Sized> = (isize, &'static str, T);
|
||||
|
||||
|
|
|
|||
|
|
@ -11,6 +11,8 @@
|
|||
// As dst-tuple.rs, but the unsized field is the only field in the tuple.
|
||||
|
||||
|
||||
#![feature(unsized_tuple_coercion)]
|
||||
|
||||
type Fat<T: ?Sized> = (T,);
|
||||
|
||||
// x is a fat pointer
|
||||
|
|
|
|||
|
|
@ -11,6 +11,7 @@
|
|||
|
||||
#![allow(unknown_features)]
|
||||
#![feature(box_syntax)]
|
||||
#![feature(unsized_tuple_coercion)]
|
||||
|
||||
type Fat<T: ?Sized> = (isize, &'static str, T);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue