Skip to content

Commit c0ad071

Browse files
committed
---
yaml --- r: 60200 b: refs/heads/master c: 7d4bb90 h: refs/heads/master v: v3
1 parent 8680d0c commit c0ad071

File tree

5 files changed

+22
-47
lines changed

5 files changed

+22
-47
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: d546493096f35e68cbcd9b5d3d7654e7a9345744
2+
refs/heads/master: 7d4bb90e76207f3715126562fd50193fda97ff49
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: 2d28d645422c1617be58c8ca7ad9a457264ca850
55
refs/heads/try: c50a9d5b664478e533ba1d1d353213d70c8ad589

trunk/src/libcore/unstable/intrinsics.rs

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -42,17 +42,12 @@ pub extern "rust-intrinsic" {
4242

4343
pub fn get_tydesc<T>() -> *();
4444

45-
/// init is unsafe because it returns a zeroed-out datum,
46-
/// which is unsafe unless T is POD. We don't have a POD
47-
/// kind yet. (See #4074)
48-
pub unsafe fn init<T>() -> T;
45+
pub fn init<T>() -> T;
4946

5047
#[cfg(not(stage0))]
5148
pub unsafe fn uninit<T>() -> T;
5249

53-
/// forget is unsafe because the caller is responsible for
54-
/// ensuring the argument is deallocated already
55-
pub unsafe fn forget<T>(_: T) -> ();
50+
pub fn forget<T>(_: T) -> ();
5651

5752
pub fn needs_drop<T>() -> bool;
5853

trunk/src/librustc/middle/resolve.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1909,7 +1909,6 @@ pub impl Resolver {
19091909
}
19101910

19111911
if self.unresolved_imports == prev_unresolved_imports {
1912-
self.session.err(~"failed to resolve imports");
19131912
self.report_unresolved_imports(module_root);
19141913
break;
19151914
}

trunk/src/librustc/middle/trans/expr.rs

Lines changed: 19 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -968,10 +968,7 @@ fn trans_lvalue_unadjusted(bcx: block, expr: @ast::expr) -> DatumBlock {
968968
}
969969

970970
fn get_val(bcx: block, did: ast::def_id, const_ty: ty::t)
971-
-> ValueRef {
972-
// For external constants, we don't inline.
973-
let extern_const_values =
974-
&mut *bcx.ccx().extern_const_values;
971+
-> ValueRef {
975972
if did.crate == ast::local_crate {
976973
// The LLVM global has the type of its initializer,
977974
// which may not be equal to the enum's type for
@@ -980,24 +977,25 @@ fn trans_lvalue_unadjusted(bcx: block, expr: @ast::expr) -> DatumBlock {
980977
base::get_item_val(bcx.ccx(), did.node),
981978
T_ptr(type_of(bcx.ccx(), const_ty)))
982979
} else {
983-
match extern_const_values.find(&did) {
984-
None => {} // Continue.
985-
Some(llval) => {
986-
return *llval;
980+
// For external constants, we don't inline.
981+
match bcx.ccx().extern_const_values.find(&did) {
982+
None => {
983+
unsafe {
984+
let llty = type_of(bcx.ccx(), const_ty);
985+
let symbol = csearch::get_symbol(
986+
bcx.ccx().sess.cstore,
987+
did);
988+
let llval = llvm::LLVMAddGlobal(
989+
bcx.ccx().llmod,
990+
llty,
991+
transmute::<&u8,*i8>(&symbol[0]));
992+
bcx.ccx().extern_const_values.insert(
993+
did,
994+
llval);
995+
llval
996+
}
987997
}
988-
}
989-
990-
unsafe {
991-
let llty = type_of(bcx.ccx(), const_ty);
992-
let symbol = csearch::get_symbol(
993-
bcx.ccx().sess.cstore,
994-
did);
995-
let llval = llvm::LLVMAddGlobal(
996-
bcx.ccx().llmod,
997-
llty,
998-
transmute::<&u8,*i8>(&symbol[0]));
999-
extern_const_values.insert(did, llval);
1000-
llval
998+
Some(llval) => *llval
1001999
}
10021000
}
10031001
}

trunk/src/test/compile-fail/forget-init-unsafe.rs

Lines changed: 0 additions & 17 deletions
This file was deleted.

0 commit comments

Comments
 (0)