Skip to content

Commit d64a162

Browse files
committed
---
yaml --- r: 163710 b: refs/heads/master c: 97cf91a h: refs/heads/master v: v3
1 parent 132a6fc commit d64a162

File tree

4 files changed

+52
-2
lines changed

4 files changed

+52
-2
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
refs/heads/master: 07eebf69107b50082386fa8c74d31aebcba8e6f1
2+
refs/heads/master: 97cf91aa30c84b14c72d88f51f9f22a50a8e3b54
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: 8443b09e361b96d1f9b7f45a65ed0d31c0e86e70
55
refs/heads/try: 20cbbffeefc1f35e2ea63afce7b42fbd79611d42

trunk/src/librustc/middle/traits/select.rs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1289,6 +1289,15 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
12891289
// don't supply any form of builtin impl.
12901290
if !this.tcx().sess.features.borrow().opt_out_copy {
12911291
return Ok(ParameterBuiltin)
1292+
} else {
1293+
// Older, backwards compatibility behavior:
1294+
if
1295+
Some(def_id) == tcx.lang_items.no_copy_bound() ||
1296+
Some(def_id) == tcx.lang_items.managed_bound() ||
1297+
ty::has_dtor(tcx, def_id)
1298+
{
1299+
return Err(Unimplemented);
1300+
}
12921301
}
12931302
}
12941303

trunk/src/librustc_typeck/check/mod.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,6 @@ use {CrateCtxt, lookup_def_ccx, no_params, require_same_types};
104104
use TypeAndSubsts;
105105
use middle::lang_items::TypeIdLangItem;
106106
use lint;
107-
use util::common::ErrorReported;
108107
use util::common::{block_query, indenter, loop_query};
109108
use util::ppaux::{mod, UserString, Repr};
110109
use util::nodemap::{DefIdMap, FnvHashMap, NodeMap};
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
2+
// file at the top-level directory of this distribution and at
3+
// http://rust-lang.org/COPYRIGHT.
4+
//
5+
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6+
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7+
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8+
// option. This file may not be copied, modified, or distributed
9+
// except according to those terms.
10+
11+
#![feature(opt_out_copy)]
12+
13+
// Test that when using the `opt-out-copy` feature we still consider
14+
// destructors to be non-movable
15+
16+
struct CantCopyThis;
17+
18+
impl Drop for CantCopyThis {
19+
fn drop(&mut self) { }
20+
}
21+
22+
struct IWantToCopyThis {
23+
but_i_cant: CantCopyThis,
24+
}
25+
26+
impl Copy for IWantToCopyThis {}
27+
//~^ ERROR the trait `Copy` may not be implemented for this type
28+
29+
enum CantCopyThisEither {
30+
A,
31+
B(::std::kinds::marker::NoCopy),
32+
}
33+
34+
enum IWantToCopyThisToo {
35+
ButICant(CantCopyThisEither),
36+
}
37+
38+
impl Copy for IWantToCopyThisToo {}
39+
//~^ ERROR the trait `Copy` may not be implemented for this type
40+
41+
fn main() {}
42+

0 commit comments

Comments
 (0)