Skip to content

Commit 5d4cce6

Browse files
committed
Rebasing
1 parent db1b14a commit 5d4cce6

File tree

19 files changed

+118
-109
lines changed

19 files changed

+118
-109
lines changed

src/liballoc/rc.rs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -460,7 +460,6 @@ impl<T: ?Sized> Deref for Rc<T> {
460460
}
461461

462462
#[cfg(stage0)] // SNAP c64d671
463-
#[unsafe_destructor]
464463
#[stable(feature = "rust1", since = "1.0.0")]
465464
impl<T> Drop for Rc<T> {
466465
/// Drops the `Rc<T>`.
@@ -512,7 +511,6 @@ impl<T> Drop for Rc<T> {
512511
}
513512

514513
#[cfg(not(stage0))] // SNAP c64d671
515-
#[unsafe_destructor]
516514
#[stable(feature = "rust1", since = "1.0.0")]
517515
impl<T: ?Sized> Drop for Rc<T> {
518516
/// Drops the `Rc<T>`.
@@ -933,7 +931,6 @@ impl<T: ?Sized> Weak<T> {
933931
}
934932

935933
#[cfg(stage0)] // SNAP c64d671
936-
#[unsafe_destructor]
937934
#[stable(feature = "rust1", since = "1.0.0")]
938935
impl<T> Drop for Weak<T> {
939936
/// Drops the `Weak<T>`.
@@ -979,7 +976,6 @@ impl<T> Drop for Weak<T> {
979976
}
980977

981978
#[cfg(not(stage0))] // SNAP c64d671
982-
#[unsafe_destructor]
983979
#[stable(feature = "rust1", since = "1.0.0")]
984980
impl<T: ?Sized> Drop for Weak<T> {
985981
/// Drops the `Weak<T>`.

src/libcore/cell.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -707,5 +707,4 @@ impl<T: ?Sized> UnsafeCell<T> {
707707
#![allow(trivial_casts)]
708708
&self.value as *const T as *mut T
709709
}
710-
711710
}

src/libcore/ops.rs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1220,24 +1220,33 @@ pub trait CoerceUnsized<T> {
12201220
// Empty.
12211221
}
12221222

1223+
// &mut T -> &mut U
12231224
#[cfg(not(stage0))] // SNAP c64d671
12241225
impl<'a, T: ?Sized+Unsize<U>, U: ?Sized> CoerceUnsized<&'a mut U> for &'a mut T {}
1226+
// &mut T -> &U
12251227
#[cfg(not(stage0))] // SNAP c64d671
12261228
impl<'a, 'b: 'a, T: ?Sized+Unsize<U>, U: ?Sized> CoerceUnsized<&'a U> for &'b mut T {}
1229+
// &mut T -> *mut U
12271230
#[cfg(not(stage0))] // SNAP c64d671
12281231
impl<'a, T: ?Sized+Unsize<U>, U: ?Sized> CoerceUnsized<*mut U> for &'a mut T {}
1232+
// &mut T -> *const U
12291233
#[cfg(not(stage0))] // SNAP c64d671
12301234
impl<'a, T: ?Sized+Unsize<U>, U: ?Sized> CoerceUnsized<*const U> for &'a mut T {}
12311235

1236+
// &T -> &U
12321237
#[cfg(not(stage0))] // SNAP c64d671
12331238
impl<'a, 'b: 'a, T: ?Sized+Unsize<U>, U: ?Sized> CoerceUnsized<&'a U> for &'b T {}
1239+
// &T -> *const U
12341240
#[cfg(not(stage0))] // SNAP c64d671
12351241
impl<'a, T: ?Sized+Unsize<U>, U: ?Sized> CoerceUnsized<*const U> for &'a T {}
12361242

1243+
// *mut T -> *mut U
12371244
#[cfg(not(stage0))] // SNAP c64d671
12381245
impl<T: ?Sized+Unsize<U>, U: ?Sized> CoerceUnsized<*mut U> for *mut T {}
1246+
// *mut T -> *const U
12391247
#[cfg(not(stage0))] // SNAP c64d671
12401248
impl<T: ?Sized+Unsize<U>, U: ?Sized> CoerceUnsized<*const U> for *mut T {}
12411249

1250+
// *const T -> *const U
12421251
#[cfg(not(stage0))] // SNAP c64d671
12431252
impl<T: ?Sized+Unsize<U>, U: ?Sized> CoerceUnsized<*const U> for *const T {}

src/libcoretest/cell.rs

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -172,14 +172,15 @@ fn unsafe_cell_unsized() {
172172
assert_eq!(unsafe { &mut *cell.get() }, comp);
173173
}
174174

175-
#[test]
176-
fn refcell_unsized() {
177-
let cell: &RefCell<[i32]> = &RefCell::new([1, 2, 3]);
178-
{
179-
let b = &mut *cell.borrow_mut();
180-
b[0] = 4;
181-
b[2] = 5;
182-
}
183-
let comp: &mut [i32] = &mut [4, 2, 5];
184-
assert_eq!(&*cell.borrow(), comp);
185-
}
175+
// FIXME(#25351) needs deeply nested coercions of DST structs.
176+
// #[test]
177+
// fn refcell_unsized() {
178+
// let cell: &RefCell<[i32]> = &RefCell::new([1, 2, 3]);
179+
// {
180+
// let b = &mut *cell.borrow_mut();
181+
// b[0] = 4;
182+
// b[2] = 5;
183+
// }
184+
// let comp: &mut [i32] = &mut [4, 2, 5];
185+
// assert_eq!(&*cell.borrow(), comp);
186+
// }

src/librustc/diagnostics.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -808,8 +808,6 @@ register_diagnostics! {
808808
E0019,
809809
E0022,
810810
E0038,
811-
E0079, // enum variant: expected signed integer constant
812-
E0080, // enum variant: constant evaluation error
813811
E0109,
814812
E0110,
815813
E0134,

src/librustc/middle/traits/select.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1369,7 +1369,8 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
13691369
fn assemble_candidates_for_unsizing(&mut self,
13701370
obligation: &TraitObligation<'tcx>,
13711371
candidates: &mut SelectionCandidateSet<'tcx>) {
1372-
// TODO is it Ok to skip the binder here?
1372+
// It is ok to skip past the higher-ranked binders here because the `match`
1373+
// below does not consider regions at all.
13731374
let source = self.infcx.shallow_resolve(*obligation.self_ty().skip_binder());
13741375
let target = self.infcx.shallow_resolve(obligation.predicate.0.input_types()[0]);
13751376

@@ -1494,7 +1495,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
14941495
&ClosureCandidate(..) |
14951496
&FnPointerCandidate(..) |
14961497
&BuiltinObjectCandidate(..) |
1497-
&&BuiltinUnsizeCandidate(..) |
1498+
&BuiltinUnsizeCandidate(..) |
14981499
&DefaultImplObjectCandidate(..) |
14991500
&BuiltinCandidate(..) => {
15001501
// We have a where-clause so don't go around looking
@@ -2498,7 +2499,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
24982499
ty::lookup_field_type_unsubstituted(tcx, def_id, f.id)
24992500
}).collect::<Vec<_>>();
25002501

2501-
// The last field of the structure has to exist and be a
2502+
// FIXME(#25351) The last field of the structure has to exist and be a
25022503
// type parameter (for now, to avoid tracking edge cases).
25032504
let i = if let Some(&ty::ty_param(p)) = fields.last().map(|ty| &ty.sty) {
25042505
assert!(p.space == TypeSpace);

src/librustc/middle/traits/util.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -377,7 +377,7 @@ pub fn predicate_for_trait_def<'tcx>(
377377
let trait_ref = ty::TraitRef {
378378
def_id: trait_def_id,
379379
substs: tcx.mk_substs(Substs::new_trait(ty_params, vec![], param_ty))
380-
});
380+
};
381381
predicate_for_trait_ref(cause, trait_ref, recursion_depth)
382382
}
383383

src/librustc/middle/ty.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4420,7 +4420,7 @@ pub fn deref<'tcx>(ty: Ty<'tcx>, explicit: bool) -> Option<mt<'tcx>> {
44204420
pub fn type_content<'tcx>(ty: Ty<'tcx>) -> Ty<'tcx> {
44214421
match ty.sty {
44224422
ty_uniq(ty) => ty,
4423-
ty_rptr(_, mt) |ty_ptr(mt) => mt.ty,
4423+
ty_rptr(_, mt) | ty_ptr(mt) => mt.ty,
44244424
_ => ty
44254425
}
44264426
}

src/librustc_trans/trans/debuginfo/metadata.rs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1058,6 +1058,7 @@ impl MetadataCreationResult {
10581058
}
10591059
}
10601060

1061+
#[derive(Debug)]
10611062
enum MemberOffset {
10621063
FixedMemberOffset { bytes: usize },
10631064
// For ComputedMemberOffset, the offset is read from the llvm type definition.
@@ -1066,6 +1067,7 @@ enum MemberOffset {
10661067

10671068
// Description of a type member, which can either be a regular field (as in
10681069
// structs or tuples) or an enum variant.
1070+
#[derive(Debug)]
10691071
struct MemberDescription {
10701072
name: String,
10711073
llvm_type: Type,
@@ -1163,13 +1165,13 @@ fn prepare_struct_metadata<'a, 'tcx>(cx: &CrateContext<'a, 'tcx>,
11631165
span: Span)
11641166
-> RecursiveTypeDescription<'tcx> {
11651167
let struct_name = compute_debuginfo_type_name(cx, struct_type, false);
1166-
let struct_llvm_type = type_of::type_of(cx, struct_type);
1168+
let struct_llvm_type = type_of::in_memory_type_of(cx, struct_type);
11671169

11681170
let (containing_scope, _) = get_namespace_and_span_for_item(cx, def_id);
11691171

11701172
let struct_metadata_stub = create_struct_stub(cx,
11711173
struct_llvm_type,
1172-
&struct_name[..],
1174+
&struct_name,
11731175
unique_type_id,
11741176
containing_scope);
11751177

@@ -1299,7 +1301,7 @@ impl<'tcx> EnumMemberDescriptionFactory<'tcx> {
12991301
set_members_of_composite_type(cx,
13001302
variant_type_metadata,
13011303
variant_llvm_type,
1302-
&member_descriptions[..]);
1304+
&member_descriptions);
13031305
MemberDescription {
13041306
name: "".to_string(),
13051307
llvm_type: variant_llvm_type,

src/librustc_trans/trans/expr.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -487,11 +487,11 @@ fn coerce_unsized<'blk, 'tcx>(bcx: Block<'blk, 'tcx>,
487487
let trait_substs = Substs::erased(VecPerParamSpace::new(vec![target.ty],
488488
vec![source.ty],
489489
Vec::new()));
490-
let trait_ref = ty::Binder(Rc::new(ty::TraitRef {
490+
let trait_ref = ty::Binder(ty::TraitRef {
491491
def_id: langcall(bcx, Some(span), "coercion",
492492
CoerceUnsizedTraitLangItem),
493493
substs: bcx.tcx().mk_substs(trait_substs)
494-
}));
494+
});
495495

496496
let kind = match fulfill_obligation(bcx.ccx(), span, trait_ref) {
497497
traits::VtableImpl(traits::VtableImplData { impl_def_id, .. }) => {

0 commit comments

Comments
 (0)