Skip to content

Commit 54d13d3

Browse files
committed
---
yaml --- r: 235109 b: refs/heads/stable c: eaeede2 h: refs/heads/master i: 235107: 8f88cd5 v: v3
1 parent 4ce1409 commit 54d13d3

File tree

4 files changed

+35
-4
lines changed

4 files changed

+35
-4
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ refs/heads/tmp: afae2ff723393b3ab4ccffef6ac7c6d1809e2da0
2929
refs/tags/1.0.0-alpha.2: 4c705f6bc559886632d3871b04f58aab093bfa2f
3030
refs/tags/homu-tmp: f859507de8c410b648d934d8f5ec1c52daac971d
3131
refs/tags/1.0.0-beta: 8cbb92b53468ee2b0c2d3eeb8567005953d40828
32-
refs/heads/stable: f3b97a74aade8cb13a10c3669a1c18e19ff45890
32+
refs/heads/stable: eaeede21269b52e0a060d363744d10fb817adec3
3333
refs/tags/1.0.0: 55bd4f8ff2b323f317ae89e254ce87162d52a375
3434
refs/tags/1.1.0: bc3c16f09287e5545c1d3f76b7abd54f2eca868b
3535
refs/tags/1.2.0: f557861f822c34f07270347b94b5280de20a597e

branches/stable/src/liballoc/arc.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,7 @@ impl<T: ?Sized> Arc<T> {
211211
reason = "Weak pointers may not belong in this module.")]
212212
pub fn downgrade(&self) -> Weak<T> {
213213
loop {
214-
// This Relaxed is OK because we're checking the value in the CAS
214+
// This Relaaxed is OK because we're checking the value in the CAS
215215
// below.
216216
let cur = self.inner().weak.load(Relaxed);
217217

branches/stable/src/librustc_trans/trans/glue.rs

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -355,7 +355,7 @@ fn trans_struct_drop<'blk, 'tcx>(bcx: Block<'blk, 'tcx>,
355355
let ty = Type::from_ref(llvm::LLVMTypeOf(dtor_addr));
356356
ty.element_type().func_params()
357357
};
358-
assert_eq!(params.len(), 1);
358+
assert_eq!(params.len(), if type_is_sized(bcx.tcx(), t) { 1 } else { 2 });
359359

360360
// Be sure to put the contents into a scope so we can use an invoke
361361
// instruction to call the user destructor but still call the field
@@ -371,7 +371,12 @@ fn trans_struct_drop<'blk, 'tcx>(bcx: Block<'blk, 'tcx>,
371371

372372
let glue_type = get_drop_glue_type(bcx.ccx(), t);
373373
let dtor_ty = bcx.tcx().mk_ctor_fn(class_did, &[glue_type], bcx.tcx().mk_nil());
374-
let (_, bcx) = invoke(bcx, dtor_addr, &[v0], dtor_ty, DebugLoc::None);
374+
let (_, bcx) = if type_is_sized(bcx.tcx(), t) {
375+
invoke(bcx, dtor_addr, &[v0], dtor_ty, DebugLoc::None)
376+
} else {
377+
let args = [Load(bcx, expr::get_dataptr(bcx, v0)), Load(bcx, expr::get_len(bcx, v0))];
378+
invoke(bcx, dtor_addr, &args, dtor_ty, DebugLoc::None)
379+
};
375380

376381
bcx.fcx.pop_and_trans_custom_cleanup_scope(bcx, contents_scope)
377382
}
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
// Copyright 2015 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+
struct Wrapper<'a, T: ?Sized>(&'a mut i32, T);
12+
13+
impl<'a, T: ?Sized> Drop for Wrapper<'a, T> {
14+
fn drop(&mut self) {
15+
*self.0 = 432;
16+
}
17+
}
18+
19+
fn main() {
20+
let mut x = 0;
21+
{
22+
let wrapper = Box::new(Wrapper(&mut x, 123));
23+
let _: Box<Wrapper<Send>> = wrapper;
24+
}
25+
assert_eq!(432, x)
26+
}

0 commit comments

Comments
 (0)