auto merge of #13868 : FlaPer87/rust/opt-in-phase1, r=alexcrichton
This is a first patch towards an opt-in built-in trait world. This patch removes the restriction on built-in traits and allows such traits to be derived. [RFC#3] cc #13231 @nikomatsakis r?
This commit is contained in:
commit
757f106bcc
6 changed files with 85 additions and 27 deletions
|
|
@ -1,19 +0,0 @@
|
|||
// Copyright 2013 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.
|
||||
|
||||
// See issue #8517 for why this should be illegal.
|
||||
|
||||
struct X<T>(T);
|
||||
|
||||
impl <T> Send for X<T> { } //~ ERROR cannot provide an explicit implementation for a builtin kind
|
||||
impl <T> Sized for X<T> { } //~ ERROR cannot provide an explicit implementation for a builtin kind
|
||||
impl <T> Share for X<T> { } //~ ERROR cannot provide an explicit implementation for a builtin kind
|
||||
|
||||
fn main() { }
|
||||
17
src/test/compile-fail/deriving-bounds.rs
Normal file
17
src/test/compile-fail/deriving-bounds.rs
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
// Copyright 2014 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.
|
||||
|
||||
//NOTE: Remove in the next snapshot
|
||||
#[cfg(not(stage0))]
|
||||
#[deriving(Share(Bad),Send,Copy)]
|
||||
//~^ ERROR unexpected value in deriving, expected a trait
|
||||
struct Test;
|
||||
|
||||
pub fn main() {}
|
||||
16
src/test/run-pass/deriving-bounds.rs
Normal file
16
src/test/run-pass/deriving-bounds.rs
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
// Copyright 2014 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.
|
||||
|
||||
//NOTE: Remove in the next snapshot
|
||||
#[cfg(not(stage0))]
|
||||
#[deriving(Share,Send,Copy)]
|
||||
struct Test;
|
||||
|
||||
pub fn main() {}
|
||||
Loading…
Add table
Add a link
Reference in a new issue