Skip to content

Commit e305982

Browse files
committed
---
yaml --- r: 59059 b: refs/heads/incoming c: 7652f3d h: refs/heads/master i: 59057: 30410e8 59055: a30d64d v: v3
1 parent 6e2f300 commit e305982

File tree

10 files changed

+54
-67
lines changed

10 files changed

+54
-67
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ refs/heads/try: c50a9d5b664478e533ba1d1d353213d70c8ad589
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
88
refs/heads/try2: 147ecfdd8221e4a4d4e090486829a06da1e0ca3c
9-
refs/heads/incoming: fd5a3520d5fbb009b2a5de8cf5ed164f28418cb1
9+
refs/heads/incoming: 7652f3ddb8f3c4fd281e6ec0bd8fc0d9b8ed857b
1010
refs/heads/dist-snap: 00dbbd01c2aee72982b3e0f9511ae1d4428c3ba9
1111
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
1212
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503

branches/incoming/src/libcore/core.rc

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -228,7 +228,6 @@ pub mod rand;
228228
pub mod run;
229229
pub mod sys;
230230
pub mod cast;
231-
pub mod flate;
232231
pub mod repr;
233232
pub mod cleanup;
234233
pub mod reflect;

branches/incoming/src/libcore/to_str.rs

Lines changed: 1 addition & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,6 @@ The `ToStr` trait for converting to strings
1515
*/
1616

1717
use str;
18-
use hashmap::HashMap;
19-
use container::Map;
20-
use hash::Hash;
21-
use cmp::Eq;
2218

2319
pub trait ToStr {
2420
fn to_str(&self) -> ~str;
@@ -50,26 +46,6 @@ impl<A:ToStr> ToStr for (A,) {
5046
}
5147
}
5248

53-
impl<A:ToStr+Hash+Eq, B:ToStr+Hash+Eq> ToStr for HashMap<A, B> {
54-
#[inline(always)]
55-
fn to_str(&self) -> ~str {
56-
let mut acc = ~"{", first = true;
57-
for self.each |key, value| {
58-
if first {
59-
first = false;
60-
}
61-
else {
62-
str::push_str(&mut acc, ~", ");
63-
}
64-
str::push_str(&mut acc, key.to_str());
65-
str::push_str(&mut acc, ~" : ");
66-
str::push_str(&mut acc, value.to_str());
67-
}
68-
str::push_char(&mut acc, '}');
69-
acc
70-
}
71-
}
72-
7349
impl<A:ToStr,B:ToStr> ToStr for (A, B) {
7450
#[inline(always)]
7551
fn to_str(&self) -> ~str {
@@ -144,7 +120,6 @@ impl<A:ToStr> ToStr for @[A] {
144120
#[cfg(test)]
145121
#[allow(non_implicitly_copyable_typarams)]
146122
mod tests {
147-
use hashmap::HashMap;
148123
#[test]
149124
fn test_simple_types() {
150125
assert!(1i.to_str() == ~"1");
@@ -174,16 +149,4 @@ mod tests {
174149
assert!((~[~[], ~[1], ~[1, 1]]).to_str() ==
175150
~"[[], [1], [1, 1]]");
176151
}
177-
178-
// #[test]
179-
// fn test_hashmap() {
180-
// let mut table: HashMap<int, int> = HashMap::new();
181-
// let mut empty: HashMap<int, int> = HashMap::new();
182-
183-
// table.insert(3, 4);
184-
// table.insert(1, 2);
185-
186-
// assert!(table.to_str() == ~"{1 : 2, 3 : 4}");
187-
// assert!(empty.to_str() == ~"{}");
188-
//}
189-
}
152+
}

branches/incoming/src/libcore/unstable/intrinsics.rs

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

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

45-
pub fn init<T>() -> T;
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;
4649

4750
#[cfg(not(stage0))]
4851
pub unsafe fn uninit<T>() -> T;
4952

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

5257
pub fn needs_drop<T>() -> bool;
5358

branches/incoming/src/librustc/metadata/encoder.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ use middle::ty;
2020
use middle;
2121
use util::ppaux::ty_to_str;
2222

23-
use core::flate;
23+
use std::flate;
2424
use core::hash::HashUtil;
2525
use core::hashmap::HashMap;
2626
use std::serialize::Encodable;

branches/incoming/src/librustc/metadata/loader.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ use syntax::parse::token::ident_interner;
2222
use syntax::print::pprust;
2323
use syntax::{ast, attr};
2424

25-
use core::flate;
25+
use std::flate;
2626
use core::os::consts::{macos, freebsd, linux, android, win32};
2727

2828
pub enum os {

branches/incoming/src/librustc/middle/trans/expr.rs

Lines changed: 21 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -968,7 +968,10 @@ 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 {
971+
-> ValueRef {
972+
// For external constants, we don't inline.
973+
let extern_const_values =
974+
&mut *bcx.ccx().extern_const_values;
972975
if did.crate == ast::local_crate {
973976
// The LLVM global has the type of its initializer,
974977
// which may not be equal to the enum's type for
@@ -977,25 +980,24 @@ fn trans_lvalue_unadjusted(bcx: block, expr: @ast::expr) -> DatumBlock {
977980
base::get_item_val(bcx.ccx(), did.node),
978981
T_ptr(type_of(bcx.ccx(), const_ty)))
979982
} else {
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-
}
983+
match extern_const_values.find(&did) {
984+
None => {} // Continue.
985+
Some(llval) => {
986+
return *llval;
997987
}
998-
Some(llval) => *llval
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
9991001
}
10001002
}
10011003
}

branches/incoming/src/libcore/flate.rs renamed to branches/incoming/src/libstd/flate.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,14 @@ Simple compression
1515
*/
1616

1717
use libc;
18-
use libc::{c_void, size_t, c_int};
18+
use core::libc::{c_void, size_t, c_int};
1919
use vec;
2020

21-
#[cfg(test)] use rand;
22-
#[cfg(test)] use rand::RngUtil;
21+
#[cfg(test)] use core::rand;
22+
#[cfg(test)] use core::rand::RngUtil;
2323

2424
pub mod rustrt {
25-
use libc::{c_int, c_void, size_t};
25+
use core::libc::{c_int, c_void, size_t};
2626

2727
#[link_name = "rustrt"]
2828
pub extern {

branches/incoming/src/libstd/std.rc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,7 @@ pub mod complex;
107107
pub mod stats;
108108
pub mod semver;
109109
pub mod fileinput;
110+
pub mod flate;
110111

111112
#[cfg(unicode)]
112113
mod unicode;
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
// Copyright 2013 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+
use core::unstable::intrinsics::{init, forget};
12+
13+
// Test that the `forget` and `init` intrinsics are really unsafe
14+
pub fn main() {
15+
let stuff = init::<int>(); //~ ERROR access to unsafe function requires unsafe
16+
forget(stuff); //~ ERROR access to unsafe function requires unsafe
17+
}

0 commit comments

Comments
 (0)