Skip to content

Commit 1e36d0b

Browse files
committed
Revert "Auto merge of rust-lang#43690 - scalexm:issue-28229, r=nikomatsakis"
This reverts commit 942711e, reversing changes made to 8df670b.
1 parent 7e5578d commit 1e36d0b

File tree

18 files changed

+24
-618
lines changed

18 files changed

+24
-618
lines changed

src/libcore/array.rs

-1
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,6 @@ macro_rules! array_impls {
124124
}
125125

126126
#[stable(feature = "rust1", since = "1.0.0")]
127-
#[cfg(stage0)]
128127
impl<T:Copy> Clone for [T; $N] {
129128
fn clone(&self) -> [T; $N] {
130129
*self

src/libcore/clone.rs

-3
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,6 @@
8888
/// }
8989
/// ```
9090
#[stable(feature = "rust1", since = "1.0.0")]
91-
#[cfg_attr(not(stage0), lang = "clone")]
9291
pub trait Clone : Sized {
9392
/// Returns a copy of the value.
9493
///
@@ -132,7 +131,6 @@ pub struct AssertParamIsClone<T: Clone + ?Sized> { _field: ::marker::PhantomData
132131
pub struct AssertParamIsCopy<T: Copy + ?Sized> { _field: ::marker::PhantomData<T> }
133132

134133
#[stable(feature = "rust1", since = "1.0.0")]
135-
#[cfg(stage0)]
136134
impl<'a, T: ?Sized> Clone for &'a T {
137135
/// Returns a shallow copy of the reference.
138136
#[inline]
@@ -142,7 +140,6 @@ impl<'a, T: ?Sized> Clone for &'a T {
142140
macro_rules! clone_impl {
143141
($t:ty) => {
144142
#[stable(feature = "rust1", since = "1.0.0")]
145-
#[cfg(stage0)]
146143
impl Clone for $t {
147144
/// Returns a deep copy of the value.
148145
#[inline]

src/libcore/ptr.rs

-3
Original file line numberDiff line numberDiff line change
@@ -876,7 +876,6 @@ pub fn eq<T: ?Sized>(a: *const T, b: *const T) -> bool {
876876
}
877877

878878
#[stable(feature = "rust1", since = "1.0.0")]
879-
#[cfg(stage0)]
880879
impl<T: ?Sized> Clone for *const T {
881880
#[inline]
882881
fn clone(&self) -> *const T {
@@ -885,7 +884,6 @@ impl<T: ?Sized> Clone for *const T {
885884
}
886885

887886
#[stable(feature = "rust1", since = "1.0.0")]
888-
#[cfg(stage0)]
889887
impl<T: ?Sized> Clone for *mut T {
890888
#[inline]
891889
fn clone(&self) -> *mut T {
@@ -897,7 +895,6 @@ impl<T: ?Sized> Clone for *mut T {
897895
macro_rules! fnptr_impls_safety_abi {
898896
($FnTy: ty, $($Arg: ident),*) => {
899897
#[stable(feature = "rust1", since = "1.0.0")]
900-
#[cfg(stage0)]
901898
impl<Ret, $($Arg),*> Clone for $FnTy {
902899
#[inline]
903900
fn clone(&self) -> Self {

src/libcore/tuple.rs

-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ macro_rules! tuple_impls {
2222
)+) => {
2323
$(
2424
#[stable(feature = "rust1", since = "1.0.0")]
25-
#[cfg(stage0)]
2625
impl<$($T:Clone),+> Clone for ($($T,)+) {
2726
fn clone(&self) -> ($($T,)+) {
2827
($(self.$idx.clone(),)+)

src/librustc/ich/impls_ty.rs

-4
Original file line numberDiff line numberDiff line change
@@ -663,10 +663,6 @@ impl<'a, 'gcx, 'tcx> HashStable<StableHashingContext<'a, 'gcx, 'tcx>> for ty::In
663663
def_id.hash_stable(hcx, hasher);
664664
t.hash_stable(hcx, hasher);
665665
}
666-
ty::InstanceDef::CloneShim(def_id, t) => {
667-
def_id.hash_stable(hcx, hasher);
668-
t.hash_stable(hcx, hasher);
669-
}
670666
}
671667
}
672668
}

src/librustc/middle/lang_items.rs

-1
Original file line numberDiff line numberDiff line change
@@ -274,7 +274,6 @@ language_item_table! {
274274
SizedTraitLangItem, "sized", sized_trait;
275275
UnsizeTraitLangItem, "unsize", unsize_trait;
276276
CopyTraitLangItem, "copy", copy_trait;
277-
CloneTraitLangItem, "clone", clone_trait;
278277
SyncTraitLangItem, "sync", sync_trait;
279278
FreezeTraitLangItem, "freeze", freeze_trait;
280279

src/librustc/traits/select.rs

+4-16
Original file line numberDiff line numberDiff line change
@@ -1296,14 +1296,6 @@ impl<'cx, 'gcx, 'tcx> SelectionContext<'cx, 'gcx, 'tcx> {
12961296
} else if self.tcx().lang_items.unsize_trait() == Some(def_id) {
12971297
self.assemble_candidates_for_unsizing(obligation, &mut candidates);
12981298
} else {
1299-
if self.tcx().lang_items.clone_trait() == Some(def_id) {
1300-
// Same builtin conditions as `Copy`, i.e. every type which has builtin support
1301-
// for `Copy` also has builtin support for `Clone`, + tuples and arrays of `Clone`
1302-
// types have builtin support for `Clone`.
1303-
let clone_conditions = self.copy_conditions(obligation);
1304-
self.assemble_builtin_bound_candidates(clone_conditions, &mut candidates)?;
1305-
}
1306-
13071299
self.assemble_closure_candidates(obligation, &mut candidates)?;
13081300
self.assemble_fn_pointer_candidates(obligation, &mut candidates)?;
13091301
self.assemble_candidates_from_impls(obligation, &mut candidates)?;
@@ -2172,8 +2164,8 @@ impl<'cx, 'gcx, 'tcx> SelectionContext<'cx, 'gcx, 'tcx> {
21722164

21732165
match candidate {
21742166
BuiltinCandidate { has_nested } => {
2175-
let data = self.confirm_builtin_candidate(obligation, has_nested);
2176-
Ok(VtableBuiltin(data))
2167+
Ok(VtableBuiltin(
2168+
self.confirm_builtin_candidate(obligation, has_nested)))
21772169
}
21782170

21792171
ParamCandidate(param) => {
@@ -2279,9 +2271,6 @@ impl<'cx, 'gcx, 'tcx> SelectionContext<'cx, 'gcx, 'tcx> {
22792271
_ if Some(trait_def) == self.tcx().lang_items.copy_trait() => {
22802272
self.copy_conditions(obligation)
22812273
}
2282-
_ if Some(trait_def) == self.tcx().lang_items.clone_trait() => {
2283-
self.copy_conditions(obligation)
2284-
}
22852274
_ => bug!("unexpected builtin trait {:?}", trait_def)
22862275
};
22872276
let nested = match conditions {
@@ -2302,7 +2291,6 @@ impl<'cx, 'gcx, 'tcx> SelectionContext<'cx, 'gcx, 'tcx> {
23022291

23032292
debug!("confirm_builtin_candidate: obligations={:?}",
23042293
obligations);
2305-
23062294
VtableBuiltinData { nested: obligations }
23072295
}
23082296

@@ -2610,8 +2598,8 @@ impl<'cx, 'gcx, 'tcx> SelectionContext<'cx, 'gcx, 'tcx> {
26102598

26112599
fn confirm_builtin_unsize_candidate(&mut self,
26122600
obligation: &TraitObligation<'tcx>,)
2613-
-> Result<VtableBuiltinData<PredicateObligation<'tcx>>, SelectionError<'tcx>>
2614-
{
2601+
-> Result<VtableBuiltinData<PredicateObligation<'tcx>>,
2602+
SelectionError<'tcx>> {
26152603
let tcx = self.tcx();
26162604

26172605
// assemble_candidates_for_unsizing should ensure there are no late bound

src/librustc/traits/structural_impls.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -300,7 +300,7 @@ impl<'a, 'tcx> Lift<'tcx> for traits::Vtable<'a, ()> {
300300
})
301301
}
302302
traits::VtableParam(n) => Some(traits::VtableParam(n)),
303-
traits::VtableBuiltin(n) => Some(traits::VtableBuiltin(n)),
303+
traits::VtableBuiltin(d) => Some(traits::VtableBuiltin(d)),
304304
traits::VtableObject(traits::VtableObjectData {
305305
upcast_trait_ref,
306306
vtable_base,

src/librustc/ty/instance.rs

+8-18
Original file line numberDiff line numberDiff line change
@@ -24,22 +24,15 @@ pub struct Instance<'tcx> {
2424
pub enum InstanceDef<'tcx> {
2525
Item(DefId),
2626
Intrinsic(DefId),
27-
28-
/// <fn() as FnTrait>::call_*
29-
/// def-id is FnTrait::call_*
27+
// <fn() as FnTrait>::call_*
28+
// def-id is FnTrait::call_*
3029
FnPtrShim(DefId, Ty<'tcx>),
31-
32-
/// <Trait as Trait>::fn
30+
// <Trait as Trait>::fn
3331
Virtual(DefId, usize),
34-
35-
/// <[mut closure] as FnOnce>::call_once
32+
// <[mut closure] as FnOnce>::call_once
3633
ClosureOnceShim { call_once: DefId },
37-
38-
/// drop_in_place::<T>; None for empty drop glue.
34+
// drop_in_place::<T>; None for empty drop glue.
3935
DropGlue(DefId, Option<Ty<'tcx>>),
40-
41-
/// Builtin method implementation, e.g. `Clone::clone`.
42-
CloneShim(DefId, Ty<'tcx>),
4336
}
4437

4538
impl<'tcx> InstanceDef<'tcx> {
@@ -50,9 +43,9 @@ impl<'tcx> InstanceDef<'tcx> {
5043
InstanceDef::FnPtrShim(def_id, _) |
5144
InstanceDef::Virtual(def_id, _) |
5245
InstanceDef::Intrinsic(def_id, ) |
53-
InstanceDef::ClosureOnceShim { call_once: def_id } |
54-
InstanceDef::DropGlue(def_id, _) |
55-
InstanceDef::CloneShim(def_id, _) => def_id
46+
InstanceDef::ClosureOnceShim { call_once: def_id }
47+
=> def_id,
48+
InstanceDef::DropGlue(def_id, _) => def_id
5649
}
5750
}
5851

@@ -87,9 +80,6 @@ impl<'tcx> fmt::Display for Instance<'tcx> {
8780
InstanceDef::DropGlue(_, ty) => {
8881
write!(f, " - shim({:?})", ty)
8982
}
90-
InstanceDef::CloneShim(_, ty) => {
91-
write!(f, " - shim({:?})", ty)
92-
}
9383
}
9484
}
9585
}

src/librustc/ty/mod.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -2232,8 +2232,7 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> {
22322232
ty::InstanceDef::FnPtrShim(..) |
22332233
ty::InstanceDef::Virtual(..) |
22342234
ty::InstanceDef::ClosureOnceShim { .. } |
2235-
ty::InstanceDef::DropGlue(..) |
2236-
ty::InstanceDef::CloneShim(..) => {
2235+
ty::InstanceDef::DropGlue(..) => {
22372236
self.mir_shims(instance)
22382237
}
22392238
}

0 commit comments

Comments
 (0)