mirror of
https://github.com/rust-lang/rust.git
synced 2024-12-01 11:13:43 +00:00
rollup merge of #20740: FlaPer87/remove-opt-out-copy
[breaking-change] code using this feature will break.
This commit is contained in:
commit
daee409b60
@ -713,12 +713,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
|
|||||||
debug!("obligation self ty is {}",
|
debug!("obligation self ty is {}",
|
||||||
obligation.predicate.0.self_ty().repr(self.tcx()));
|
obligation.predicate.0.self_ty().repr(self.tcx()));
|
||||||
|
|
||||||
// If the user has asked for the older, compatibility
|
try!(self.assemble_candidates_from_impls(obligation, &mut candidates.vec));
|
||||||
// behavior, ignore user-defined impls here. This will
|
|
||||||
// go away by the time 1.0 is released.
|
|
||||||
if !self.tcx().sess.features.borrow().opt_out_copy {
|
|
||||||
try!(self.assemble_candidates_from_impls(obligation, &mut candidates.vec));
|
|
||||||
}
|
|
||||||
|
|
||||||
try!(self.assemble_builtin_bound_candidates(ty::BoundCopy,
|
try!(self.assemble_builtin_bound_candidates(ty::BoundCopy,
|
||||||
stack,
|
stack,
|
||||||
@ -1505,21 +1500,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
ty::BoundCopy => {
|
ty::BoundCopy => {
|
||||||
// This is an Opt-In Built-In Trait. So, unless
|
return Ok(ParameterBuiltin)
|
||||||
// the user is asking for the old behavior, we
|
|
||||||
// don't supply any form of builtin impl.
|
|
||||||
if !this.tcx().sess.features.borrow().opt_out_copy {
|
|
||||||
return Ok(ParameterBuiltin)
|
|
||||||
} else {
|
|
||||||
// Older, backwards compatibility behavior:
|
|
||||||
if
|
|
||||||
Some(def_id) == tcx.lang_items.no_copy_bound() ||
|
|
||||||
Some(def_id) == tcx.lang_items.managed_bound() ||
|
|
||||||
ty::has_dtor(tcx, def_id)
|
|
||||||
{
|
|
||||||
return Err(Unimplemented);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ty::BoundSync => {
|
ty::BoundSync => {
|
||||||
|
@ -82,7 +82,7 @@ static KNOWN_FEATURES: &'static [(&'static str, Status)] = &[
|
|||||||
("issue_5723_bootstrap", Accepted),
|
("issue_5723_bootstrap", Accepted),
|
||||||
|
|
||||||
// A way to temporarily opt out of opt in copy. This will *never* be accepted.
|
// A way to temporarily opt out of opt in copy. This will *never* be accepted.
|
||||||
("opt_out_copy", Deprecated),
|
("opt_out_copy", Removed),
|
||||||
|
|
||||||
// A way to temporarily opt out of the new orphan rules. This will *never* be accepted.
|
// A way to temporarily opt out of the new orphan rules. This will *never* be accepted.
|
||||||
("old_orphan_check", Deprecated),
|
("old_orphan_check", Deprecated),
|
||||||
@ -123,7 +123,6 @@ pub struct Features {
|
|||||||
pub import_shadowing: bool,
|
pub import_shadowing: bool,
|
||||||
pub visible_private_types: bool,
|
pub visible_private_types: bool,
|
||||||
pub quote: bool,
|
pub quote: bool,
|
||||||
pub opt_out_copy: bool,
|
|
||||||
pub old_orphan_check: bool,
|
pub old_orphan_check: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -135,7 +134,6 @@ impl Features {
|
|||||||
import_shadowing: false,
|
import_shadowing: false,
|
||||||
visible_private_types: false,
|
visible_private_types: false,
|
||||||
quote: false,
|
quote: false,
|
||||||
opt_out_copy: false,
|
|
||||||
old_orphan_check: false,
|
old_orphan_check: false,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -465,7 +463,6 @@ fn check_crate_inner<F>(cm: &CodeMap, span_handler: &SpanHandler, krate: &ast::C
|
|||||||
import_shadowing: cx.has_feature("import_shadowing"),
|
import_shadowing: cx.has_feature("import_shadowing"),
|
||||||
visible_private_types: cx.has_feature("visible_private_types"),
|
visible_private_types: cx.has_feature("visible_private_types"),
|
||||||
quote: cx.has_feature("quote"),
|
quote: cx.has_feature("quote"),
|
||||||
opt_out_copy: cx.has_feature("opt_out_copy"),
|
|
||||||
old_orphan_check: cx.has_feature("old_orphan_check"),
|
old_orphan_check: cx.has_feature("old_orphan_check"),
|
||||||
},
|
},
|
||||||
unknown_features)
|
unknown_features)
|
||||||
|
@ -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() {}
|
|
||||||
|
|
@ -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>();
|
|
||||||
}
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user