rollup merge of #20740: FlaPer87/remove-opt-out-copy

[breaking-change] code using this feature will break.
This commit is contained in:
Alex Crichton 2015-01-08 09:22:06 -08:00
commit daee409b60
4 changed files with 3 additions and 115 deletions

View file

@ -1,44 +0,0 @@
// 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.
#![feature(opt_out_copy)]
//~^ WARNING feature is deprecated
//~| WARNING feature is deprecated
// Test that when using the `opt-out-copy` feature we still consider
// destructors to be non-movable
struct CantCopyThis;
impl Drop for CantCopyThis {
fn drop(&mut self) { }
}
struct IWantToCopyThis {
but_i_cant: CantCopyThis,
}
impl Copy for IWantToCopyThis {}
//~^ ERROR the trait `Copy` may not be implemented for this type
enum CantCopyThisEither {
A,
B(::std::marker::NoCopy),
}
enum IWantToCopyThisToo {
ButICant(CantCopyThisEither),
}
impl Copy for IWantToCopyThisToo {}
//~^ ERROR the trait `Copy` may not be implemented for this type
fn main() {}

View file

@ -1,46 +0,0 @@
// 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.
#![feature(opt_out_copy)]
// Test the opt-out-copy feature guard. This is the same as the
// "opt-in-copy.rs" test from compile-fail, except that it is using
// the feature guard, and hence the structureds in this file are
// implicitly copyable, and hence we get no errors. This test can be
// safely removed once the opt-out-copy "feature" is rejected.
struct CantCopyThis;
struct IWantToCopyThis {
but_i_cant: CantCopyThis,
}
impl Copy for IWantToCopyThis {}
enum CantCopyThisEither {
A,
B,
}
enum IWantToCopyThisToo {
ButICant(CantCopyThisEither),
}
impl Copy for IWantToCopyThisToo {}
fn is_copy<T:Copy>() { }
fn main() {
is_copy::<CantCopyThis>();
is_copy::<CantCopyThisEither>();
is_copy::<IWantToCopyThis>();
is_copy::<IWantToCopyThisToo>();
}