Skip to content

Commit 09ab5d5

Browse files
committed
---
yaml --- r: 132475 b: refs/heads/dist-snap c: 3e6edee h: refs/heads/master i: 132473: 6b04aaf 132471: 9755de5 v: v3
1 parent 0f9d00c commit 09ab5d5

File tree

8 files changed

+47
-180
lines changed

8 files changed

+47
-180
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ refs/heads/try: 457a3c991d79b971be07fce75f9d0c12848fb37c
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
88
refs/heads/try2: 147ecfdd8221e4a4d4e090486829a06da1e0ca3c
9-
refs/heads/dist-snap: d3ac386ea995a9119b86410476722cd657e7af16
9+
refs/heads/dist-snap: 3e6edee002ea3edd3e367161fabe25b075e5e3be
1010
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
1111
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503
1212
refs/heads/try3: 9387340aab40a73e8424c48fd42f0c521a4875c0

branches/dist-snap/.gitignore

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -64,12 +64,6 @@
6464
/nd/
6565
/rt/
6666
/rustllvm/
67-
/src/libunicode/DerivedCoreProperties.txt
68-
/src/libunicode/EastAsianWidth.txt
69-
/src/libunicode/HangulSyllableType.txt
70-
/src/libunicode/PropList.txt
71-
/src/libunicode/Scripts.txt
72-
/src/libunicode/UnicodeData.txt
7367
/stage0/
7468
/stage1/
7569
/stage2/

branches/dist-snap/src/doc/guide.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1626,6 +1626,10 @@ Check out the generated `Cargo.toml`:
16261626
name = "guessing_game"
16271627
version = "0.1.0"
16281628
authors = ["Your Name <[email protected]>"]
1629+
1630+
[[bin]]
1631+
1632+
name = "guessing_game"
16291633
```
16301634

16311635
Cargo gets this information from your environment. If it's not correct, go ahead

branches/dist-snap/src/libcore/num/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -279,8 +279,8 @@ pub fn abs<T: Signed>(value: T) -> T {
279279

280280
/// The positive difference of two numbers.
281281
///
282-
/// Returns `zero` if the number is less than or equal to `other`,
283-
/// otherwise the difference between `self` and `other` is returned.
282+
/// Returns zero if `x` is less than or equal to `y`, otherwise the difference
283+
/// between `x` and `y` is returned.
284284
#[inline(always)]
285285
pub fn abs_sub<T: Signed>(x: T, y: T) -> T {
286286
x.abs_sub(&y)

branches/dist-snap/src/librustc/back/link.rs

Lines changed: 15 additions & 88 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@ use std::char;
3232
use std::collections::HashSet;
3333
use std::io::{fs, TempDir, Command};
3434
use std::io;
35-
use std::mem;
3635
use std::ptr;
3736
use std::str;
3837
use std::string::String;
@@ -46,36 +45,6 @@ use syntax::attr::AttrMetaMethods;
4645
use syntax::codemap::Span;
4746
use syntax::parse::token;
4847

49-
// RLIB LLVM-BYTECODE OBJECT LAYOUT
50-
// Version 1
51-
// Bytes Data
52-
// 0..10 "RUST_OBJECT" encoded in ASCII
53-
// 11..14 format version as little-endian u32
54-
// 15..22 size in bytes of deflate compressed LLVM bitcode as
55-
// little-endian u64
56-
// 23.. compressed LLVM bitcode
57-
58-
// This is the "magic number" expected at the beginning of a LLVM bytecode
59-
// object in an rlib.
60-
pub static RLIB_BYTECODE_OBJECT_MAGIC: &'static [u8] = b"RUST_OBJECT";
61-
62-
// The version number this compiler will write to bytecode objects in rlibs
63-
pub static RLIB_BYTECODE_OBJECT_VERSION: u32 = 1;
64-
65-
// The offset in bytes the bytecode object format version number can be found at
66-
pub static RLIB_BYTECODE_OBJECT_VERSION_OFFSET: uint = 11;
67-
68-
// The offset in bytes the size of the compressed bytecode can be found at in
69-
// format version 1
70-
pub static RLIB_BYTECODE_OBJECT_V1_DATASIZE_OFFSET: uint =
71-
RLIB_BYTECODE_OBJECT_VERSION_OFFSET + 4;
72-
73-
// The offset in bytes the compressed LLVM bytecode can be found at in format
74-
// version 1
75-
pub static RLIB_BYTECODE_OBJECT_V1_DATA_OFFSET: uint =
76-
RLIB_BYTECODE_OBJECT_V1_DATASIZE_OFFSET + 8;
77-
78-
7948
#[deriving(Clone, PartialEq, PartialOrd, Ord, Eq)]
8049
pub enum OutputType {
8150
OutputTypeBitcode,
@@ -1134,44 +1103,28 @@ fn link_rlib<'a>(sess: &'a Session,
11341103
// is never exactly 16 bytes long by adding a 16 byte extension to
11351104
// it. This is to work around a bug in LLDB that would cause it to
11361105
// crash if the name of a file in an archive was exactly 16 bytes.
1137-
let bc_filename = obj_filename.with_extension("bc");
1138-
let bc_deflated_filename = obj_filename.with_extension("bytecode.deflate");
1139-
1140-
let bc_data = match fs::File::open(&bc_filename).read_to_end() {
1141-
Ok(buffer) => buffer,
1142-
Err(e) => sess.fatal(format!("failed to read bytecode: {}",
1143-
e).as_slice())
1144-
};
1145-
1146-
let bc_data_deflated = match flate::deflate_bytes(bc_data.as_slice()) {
1147-
Some(compressed) => compressed,
1148-
None => sess.fatal(format!("failed to compress bytecode from {}",
1149-
bc_filename.display()).as_slice())
1150-
};
1151-
1152-
let mut bc_file_deflated = match fs::File::create(&bc_deflated_filename) {
1153-
Ok(file) => file,
1154-
Err(e) => {
1155-
sess.fatal(format!("failed to create compressed bytecode \
1156-
file: {}", e).as_slice())
1157-
}
1158-
};
1159-
1160-
match write_rlib_bytecode_object_v1(&mut bc_file_deflated,
1161-
bc_data_deflated.as_slice()) {
1106+
let bc = obj_filename.with_extension("bc");
1107+
let bc_deflated = obj_filename.with_extension("bytecode.deflate");
1108+
match fs::File::open(&bc).read_to_end().and_then(|data| {
1109+
fs::File::create(&bc_deflated)
1110+
.write(match flate::deflate_bytes(data.as_slice()) {
1111+
Some(compressed) => compressed,
1112+
None => sess.fatal("failed to compress bytecode")
1113+
}.as_slice())
1114+
}) {
11621115
Ok(()) => {}
11631116
Err(e) => {
11641117
sess.err(format!("failed to write compressed bytecode: \
1165-
{}", e).as_slice());
1118+
{}",
1119+
e).as_slice());
11661120
sess.abort_if_errors()
11671121
}
1168-
};
1169-
1170-
ab.add_file(&bc_deflated_filename).unwrap();
1171-
remove(sess, &bc_deflated_filename);
1122+
}
1123+
ab.add_file(&bc_deflated).unwrap();
1124+
remove(sess, &bc_deflated);
11721125
if !sess.opts.cg.save_temps &&
11731126
!sess.opts.output_types.contains(&OutputTypeBitcode) {
1174-
remove(sess, &bc_filename);
1127+
remove(sess, &bc);
11751128
}
11761129
}
11771130

@@ -1181,32 +1134,6 @@ fn link_rlib<'a>(sess: &'a Session,
11811134
ab
11821135
}
11831136

1184-
fn write_rlib_bytecode_object_v1<T: Writer>(writer: &mut T,
1185-
bc_data_deflated: &[u8])
1186-
-> ::std::io::IoResult<()> {
1187-
let bc_data_deflated_size: u64 = bc_data_deflated.as_slice().len() as u64;
1188-
1189-
try! { writer.write(RLIB_BYTECODE_OBJECT_MAGIC) };
1190-
try! { writer.write_le_u32(1) };
1191-
try! { writer.write_le_u64(bc_data_deflated_size) };
1192-
try! { writer.write(bc_data_deflated.as_slice()) };
1193-
1194-
let number_of_bytes_written_so_far =
1195-
RLIB_BYTECODE_OBJECT_MAGIC.len() + // magic id
1196-
mem::size_of_val(&RLIB_BYTECODE_OBJECT_VERSION) + // version
1197-
mem::size_of_val(&bc_data_deflated_size) + // data size field
1198-
bc_data_deflated_size as uint; // actual data
1199-
1200-
// If the number of bytes written to the object so far is odd, add a
1201-
// padding byte to make it even. This works around a crash bug in LLDB
1202-
// (see issue #15950)
1203-
if number_of_bytes_written_so_far % 2 == 1 {
1204-
try! { writer.write_u8(0) };
1205-
}
1206-
1207-
return Ok(());
1208-
}
1209-
12101137
// Create a static archive
12111138
//
12121139
// This is essentially the same thing as an rlib, but it also involves adding

branches/dist-snap/src/librustc/back/lto.rs

Lines changed: 23 additions & 80 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,6 @@ use util::common::time;
2020
use libc;
2121
use flate;
2222

23-
use std::mem;
24-
2523
pub fn run(sess: &session::Session, llmod: ModuleRef,
2624
tm: TargetMachineRef, reachable: &[String]) {
2725
if sess.opts.cg.prefer_dynamic {
@@ -59,66 +57,36 @@ pub fn run(sess: &session::Session, llmod: ModuleRef,
5957
let file = path.filename_str().unwrap();
6058
let file = file.slice(3, file.len() - 5); // chop off lib/.rlib
6159
debug!("reading {}", file);
62-
let bc_encoded = time(sess.time_passes(),
63-
format!("read {}.bytecode.deflate", name).as_slice(),
64-
(),
65-
|_| {
66-
archive.read(format!("{}.bytecode.deflate",
67-
file).as_slice())
68-
});
69-
let bc_encoded = bc_encoded.expect("missing compressed bytecode in archive!");
70-
let bc_extractor = if is_versioned_bytecode_format(bc_encoded) {
71-
|_| {
72-
// Read the version
73-
let version = extract_bytecode_format_version(bc_encoded);
74-
75-
if version == 1 {
76-
// The only version existing so far
77-
let data_size = extract_compressed_bytecode_size_v1(bc_encoded);
78-
let compressed_data = bc_encoded.slice(
79-
link::RLIB_BYTECODE_OBJECT_V1_DATA_OFFSET,
80-
link::RLIB_BYTECODE_OBJECT_V1_DATA_OFFSET + data_size as uint);
81-
82-
match flate::inflate_bytes(compressed_data) {
83-
Some(inflated) => inflated,
84-
None => {
85-
sess.fatal(format!("failed to decompress bc of `{}`",
86-
name).as_slice())
87-
}
88-
}
89-
} else {
90-
sess.fatal(format!("Unsupported bytecode format version {}",
91-
version).as_slice())
92-
}
93-
}
94-
} else {
95-
// the object must be in the old, pre-versioning format, so simply
96-
// inflate everything and let LLVM decide if it can make sense of it
97-
|_| {
98-
match flate::inflate_bytes(bc_encoded) {
99-
Some(bc) => bc,
100-
None => {
101-
sess.fatal(format!("failed to decompress bc of `{}`",
102-
name).as_slice())
103-
}
104-
}
105-
}
106-
};
107-
108-
let bc_decoded = time(sess.time_passes(),
109-
format!("decode {}.bc", file).as_slice(),
110-
(),
111-
bc_extractor);
112-
113-
let ptr = bc_decoded.as_slice().as_ptr();
60+
let bc = time(sess.time_passes(),
61+
format!("read {}.bytecode.deflate", name).as_slice(),
62+
(),
63+
|_| {
64+
archive.read(format!("{}.bytecode.deflate",
65+
file).as_slice())
66+
});
67+
let bc = bc.expect("missing compressed bytecode in archive!");
68+
let bc = time(sess.time_passes(),
69+
format!("inflate {}.bc", file).as_slice(),
70+
(),
71+
|_| {
72+
match flate::inflate_bytes(bc) {
73+
Some(bc) => bc,
74+
None => {
75+
sess.fatal(format!("failed to decompress \
76+
bc of `{}`",
77+
name).as_slice())
78+
}
79+
}
80+
});
81+
let ptr = bc.as_slice().as_ptr();
11482
debug!("linking {}", name);
11583
time(sess.time_passes(),
11684
format!("ll link {}", name).as_slice(),
11785
(),
11886
|()| unsafe {
11987
if !llvm::LLVMRustLinkInExternalBitcode(llmod,
12088
ptr as *const libc::c_char,
121-
bc_decoded.len() as libc::size_t) {
89+
bc.len() as libc::size_t) {
12290
link::llvm_err(sess,
12391
format!("failed to load bc of `{}`",
12492
name.as_slice()));
@@ -169,28 +137,3 @@ pub fn run(sess: &session::Session, llmod: ModuleRef,
169137
}
170138
debug!("lto done");
171139
}
172-
173-
fn is_versioned_bytecode_format(bc: &[u8]) -> bool {
174-
let magic_id_byte_count = link::RLIB_BYTECODE_OBJECT_MAGIC.len();
175-
return bc.len() > magic_id_byte_count &&
176-
bc.slice(0, magic_id_byte_count) == link::RLIB_BYTECODE_OBJECT_MAGIC;
177-
}
178-
179-
fn extract_bytecode_format_version(bc: &[u8]) -> u32 {
180-
return read_from_le_bytes::<u32>(bc, link::RLIB_BYTECODE_OBJECT_VERSION_OFFSET);
181-
}
182-
183-
fn extract_compressed_bytecode_size_v1(bc: &[u8]) -> u64 {
184-
return read_from_le_bytes::<u64>(bc, link::RLIB_BYTECODE_OBJECT_V1_DATASIZE_OFFSET);
185-
}
186-
187-
fn read_from_le_bytes<T: Int>(bytes: &[u8], position_in_bytes: uint) -> T {
188-
let byte_data = bytes.slice(position_in_bytes,
189-
position_in_bytes + mem::size_of::<T>());
190-
let data = unsafe {
191-
*(byte_data.as_ptr() as *const T)
192-
};
193-
194-
Int::from_le(data)
195-
}
196-

branches/dist-snap/src/librustdoc/html/layout.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@ r##"<!DOCTYPE html>
3939
<meta charset="utf-8">
4040
<meta name="viewport" content="width=device-width, initial-scale=1.0">
4141
<meta name="description" content="The {krate} library documentation.">
42-
<meta name="generator" content="rustdoc">
4342
4443
<title>{title}</title>
4544
@@ -48,7 +47,7 @@ r##"<!DOCTYPE html>
4847
{favicon}
4948
{in_header}
5049
</head>
51-
<body class="rustdoc">
50+
<body>
5251
<!--[if lte IE 8]>
5352
<div class="warning">
5453
This old browser is unsupported and will most likely display funky

branches/dist-snap/src/librustdoc/markdown.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ pub fn render(input: &str, mut output: Path, matches: &getopts::Matches,
9898
{css}
9999
{in_header}
100100
</head>
101-
<body class="rustdoc">
101+
<body>
102102
<!--[if lte IE 8]>
103103
<div class="warning">
104104
This old browser is unsupported and will most likely display funky

0 commit comments

Comments
 (0)