Skip to content

Commit 7272437

Browse files
committed
---
yaml --- r: 81087 b: refs/heads/snap-stage3 c: 893ba18 h: refs/heads/master i: 81085: eef65a2 81083: f142a95 81079: a7a4f10 81071: 905e9c5 81055: c7312a0 81023: 3aca594 v: v3
1 parent 8501079 commit 7272437

28 files changed

+82
-73
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
refs/heads/master: 4c6bf4872012c010f84dc7fa2cdfe87522533f89
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
4-
refs/heads/snap-stage3: 90e009f9b6aae3b3a9f500f07bca07b531e54507
4+
refs/heads/snap-stage3: 893ba18cd16ca5922f827e38291de809915fca57
55
refs/heads/try: 70152ff55722878cde684ee6462c14c65f2c4729
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b

branches/snap-stage3/src/librust/rust.rs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ extern mod rustc;
2828
use std::io;
2929
use std::os;
3030
use std::run;
31-
use std::libc::exit;
3231

3332
enum ValidUsage {
3433
Valid(int), Invalid
@@ -235,7 +234,7 @@ pub fn main() {
235234

236235
if (os_args.len() > 1 && (os_args[1] == ~"-v" || os_args[1] == ~"--version")) {
237236
rustc::version(os_args[0]);
238-
unsafe { exit(0); }
237+
return;
239238
}
240239

241240
let args = os_args.tail();
@@ -245,8 +244,11 @@ pub fn main() {
245244
for command in r.iter() {
246245
let result = do_command(command, args.tail());
247246
match result {
248-
Valid(exit_code) => unsafe { exit(exit_code.to_i32()) },
249-
_ => loop
247+
Valid(exit_code) => {
248+
os::set_exit_status(exit_code);
249+
return;
250+
}
251+
_ => loop
250252
}
251253
}
252254
}

branches/snap-stage3/src/librustc/middle/trans/base.rs

Lines changed: 22 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -2321,6 +2321,23 @@ pub fn trans_mod(ccx: @mut CrateContext, m: &ast::_mod) {
23212321
}
23222322
}
23232323

2324+
fn finish_register_fn(ccx: @mut CrateContext, sp: Span, sym: ~str, node_id: ast::NodeId,
2325+
llfn: ValueRef) {
2326+
ccx.item_symbols.insert(node_id, sym);
2327+
2328+
if !*ccx.sess.building_library {
2329+
lib::llvm::SetLinkage(llfn, lib::llvm::InternalLinkage);
2330+
}
2331+
2332+
// FIXME #4404 android JNI hacks
2333+
let is_entry = is_entry_fn(&ccx.sess, node_id) && (!*ccx.sess.building_library ||
2334+
(*ccx.sess.building_library &&
2335+
ccx.sess.targ_cfg.os == session::OsAndroid));
2336+
if is_entry {
2337+
create_entry_wrapper(ccx, sp, llfn);
2338+
}
2339+
}
2340+
23242341
pub fn register_fn(ccx: @mut CrateContext,
23252342
sp: Span,
23262343
sym: ~str,
@@ -2336,15 +2353,7 @@ pub fn register_fn(ccx: @mut CrateContext,
23362353
};
23372354

23382355
let llfn = decl_rust_fn(ccx, f.sig.inputs, f.sig.output, sym);
2339-
ccx.item_symbols.insert(node_id, sym);
2340-
2341-
// FIXME #4404 android JNI hacks
2342-
let is_entry = is_entry_fn(&ccx.sess, node_id) && (!*ccx.sess.building_library ||
2343-
(*ccx.sess.building_library &&
2344-
ccx.sess.targ_cfg.os == session::OsAndroid));
2345-
if is_entry {
2346-
create_entry_wrapper(ccx, sp, llfn);
2347-
}
2356+
finish_register_fn(ccx, sp, sym, node_id, llfn);
23482357
llfn
23492358
}
23502359

@@ -2361,15 +2370,7 @@ pub fn register_fn_llvmty(ccx: @mut CrateContext,
23612370
ast_map::path_to_str(item_path(ccx, &node_id), token::get_ident_interner()));
23622371

23632372
let llfn = decl_fn(ccx.llmod, sym, cc, fn_ty);
2364-
ccx.item_symbols.insert(node_id, sym);
2365-
2366-
// FIXME #4404 android JNI hacks
2367-
let is_entry = is_entry_fn(&ccx.sess, node_id) && (!*ccx.sess.building_library ||
2368-
(*ccx.sess.building_library &&
2369-
ccx.sess.targ_cfg.os == session::OsAndroid));
2370-
if is_entry {
2371-
create_entry_wrapper(ccx, sp, llfn);
2372-
}
2373+
finish_register_fn(ccx, sp, sym, node_id, llfn);
23732374
llfn
23742375
}
23752376

@@ -2949,7 +2950,7 @@ pub fn decl_crate_map(sess: session::Session, mapmeta: LinkMeta,
29492950
};
29502951
let sym_name = ~"_rust_crate_map_" + mapname;
29512952
let arrtype = Type::array(&int_type, n_subcrates as u64);
2952-
let maptype = Type::struct_([Type::i32(), int_type, arrtype], false);
2953+
let maptype = Type::struct_([Type::i32(), Type::i8p(), int_type, arrtype], false);
29532954
let map = do sym_name.with_c_str |buf| {
29542955
unsafe {
29552956
llvm::LLVMAddGlobal(llmod, maptype.to_ref(), buf)
@@ -2990,6 +2991,8 @@ pub fn fill_crate_map(ccx: @mut CrateContext, map: ValueRef) {
29902991
let mod_map = create_module_map(ccx);
29912992
llvm::LLVMSetInitializer(map, C_struct(
29922993
[C_i32(1),
2994+
// FIXME #8431 This used to be the annihilate function, now it's nothing
2995+
C_null(Type::i8p()),
29932996
p2i(ccx, mod_map),
29942997
C_array(ccx.int_type, subcrates)]));
29952998
}

branches/snap-stage3/src/libstd/rt/crate_map.rs

Lines changed: 17 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,7 @@
99
// except according to those terms.
1010

1111

12-
use libc::c_char;
13-
#[cfg(stage0)] use libc::c_void;
12+
use libc::{c_void, c_char};
1413
use ptr;
1514
use ptr::RawPtr;
1615
use vec;
@@ -40,7 +39,6 @@ struct CrateMapV0 {
4039
children: [*CrateMap, ..1]
4140
}
4241

43-
#[cfg(stage0)]
4442
struct CrateMap {
4543
version: i32,
4644
annihilate_fn: *c_void,
@@ -50,15 +48,6 @@ struct CrateMap {
5048
children: [*CrateMap, ..1]
5149
}
5250

53-
#[cfg(not(stage0))]
54-
struct CrateMap {
55-
version: i32,
56-
entries: *ModEntry,
57-
/// a dynamically sized struct, where all pointers to children are listed adjacent
58-
/// to the struct, terminated with NULL
59-
children: [*CrateMap, ..1]
60-
}
61-
6251
#[cfg(not(windows))]
6352
pub fn get_crate_map() -> *CrateMap {
6453
&'static CRATE_MAP as *CrateMap
@@ -90,6 +79,15 @@ unsafe fn version(crate_map: *CrateMap) -> i32 {
9079
}
9180
}
9281

82+
/// Returns a pointer to the annihilate function of the CrateMap
83+
pub unsafe fn annihilate_fn(crate_map: *CrateMap) -> *c_void {
84+
match version(crate_map) {
85+
0 => return ptr::null(),
86+
1 => return (*crate_map).annihilate_fn,
87+
_ => fail!("Unknown crate map version!")
88+
}
89+
}
90+
9391
unsafe fn entries(crate_map: *CrateMap) -> *ModEntry {
9492
match version(crate_map) {
9593
0 => {
@@ -147,6 +145,7 @@ fn iter_crate_map_duplicates() {
147145

148146
struct CrateMapT3 {
149147
version: i32,
148+
annihilate_fn: *c_void,
150149
entries: *ModEntry,
151150
children: [*CrateMap, ..3]
152151
}
@@ -161,12 +160,13 @@ fn iter_crate_map_duplicates() {
161160
];
162161
let child_crate = CrateMap {
163162
version: 1,
163+
annihilate_fn: ptr::null(),
164164
entries: vec::raw::to_ptr(entries),
165165
children: [ptr::null()]
166166
};
167167

168168
let root_crate = CrateMapT3 {
169-
version: 1,
169+
version: 1, annihilate_fn: ptr::null(),
170170
entries: vec::raw::to_ptr([ModEntry { name: ptr::null(), log_level: ptr::mut_null()}]),
171171
children: [&child_crate as *CrateMap, &child_crate as *CrateMap, ptr::null()]
172172
};
@@ -187,6 +187,7 @@ fn iter_crate_map_follow_children() {
187187

188188
struct CrateMapT2 {
189189
version: i32,
190+
annihilate_fn: *c_void,
190191
entries: *ModEntry,
191192
children: [*CrateMap, ..2]
192193
}
@@ -198,6 +199,7 @@ fn iter_crate_map_follow_children() {
198199
let mut level3: u32 = 3;
199200
let child_crate2 = CrateMap {
200201
version: 1,
202+
annihilate_fn: ptr::null(),
201203
entries: vec::raw::to_ptr([
202204
ModEntry { name: mod_name1.with_ref(|buf| buf), log_level: &mut level2},
203205
ModEntry { name: mod_name2.with_ref(|buf| buf), log_level: &mut level3},
@@ -208,6 +210,7 @@ fn iter_crate_map_follow_children() {
208210

209211
let child_crate1 = CrateMapT2 {
210212
version: 1,
213+
annihilate_fn: ptr::null(),
211214
entries: vec::raw::to_ptr([
212215
ModEntry { name: "t::f1".to_c_str().with_ref(|buf| buf), log_level: &mut 1},
213216
ModEntry { name: ptr::null(), log_level: ptr::mut_null()}
@@ -217,7 +220,7 @@ fn iter_crate_map_follow_children() {
217220

218221
let child_crate1_ptr: *CrateMap = transmute(&child_crate1);
219222
let root_crate = CrateMapT2 {
220-
version: 1,
223+
version: 1, annihilate_fn: ptr::null(),
221224
entries: vec::raw::to_ptr([
222225
ModEntry { name: "t::f1".to_c_str().with_ref(|buf| buf), log_level: &mut 0},
223226
ModEntry { name: ptr::null(), log_level: ptr::mut_null()}

branches/snap-stage3/src/libstd/rt/io/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -472,7 +472,7 @@ pub trait Writer {
472472

473473
pub trait Stream: Reader + Writer { }
474474

475-
impl<T: Reader + Writer> Stream for T;
475+
impl<T: Reader + Writer> Stream for T {}
476476

477477
pub enum SeekStyle {
478478
/// Seek from the beginning of the stream

branches/snap-stage3/src/libstd/rt/uv/file.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ use libc::{c_int};
2222
use option::{None, Some, Option};
2323

2424
pub struct FsRequest(*uvll::uv_fs_t);
25-
impl Request for FsRequest;
25+
impl Request for FsRequest {}
2626

2727
pub struct RequestData {
2828
complete_cb: Option<FsCallback>

branches/snap-stage3/src/libsyntax/parse/obsolete.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ pub enum ObsoleteSyntax {
6565
ObsoletePrivVisibility,
6666
ObsoleteTraitFuncVisibility,
6767
ObsoleteConstPointer,
68+
ObsoleteEmptyImpl,
6869
}
6970

7071
impl to_bytes::IterBytes for ObsoleteSyntax {
@@ -256,6 +257,10 @@ impl ParserObsoleteMethods for Parser {
256257
"instead of `&const Foo` or `@const Foo`, write `&Foo` or \
257258
`@Foo`"
258259
),
260+
ObsoleteEmptyImpl => (
261+
"empty implementation",
262+
"instead of `impl A;`, write `impl A {}`"
263+
),
259264
};
260265

261266
self.report(sp, kind, kind_str, desc);

branches/snap-stage3/src/libsyntax/parse/parser.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3852,7 +3852,9 @@ impl Parser {
38523852
}
38533853

38543854
let mut meths = ~[];
3855-
if !self.eat(&token::SEMI) {
3855+
if self.eat(&token::SEMI) {
3856+
self.obsolete(*self.span, ObsoleteEmptyImpl);
3857+
} else {
38563858
self.expect(&token::LBRACE);
38573859
while !self.eat(&token::RBRACE) {
38583860
meths.push(self.parse_method());

branches/snap-stage3/src/libsyntax/print/pprust.rs

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -598,18 +598,12 @@ pub fn print_item(s: @ps, item: &ast::item) {
598598

599599
print_type(s, ty);
600600

601-
if methods.len() == 0 {
602-
word(s.s, ";");
603-
end(s); // end the head-ibox
604-
end(s); // end the outer cbox
605-
} else {
606-
space(s.s);
607-
bopen(s);
608-
for meth in methods.iter() {
609-
print_method(s, *meth);
610-
}
611-
bclose(s, item.span);
601+
space(s.s);
602+
bopen(s);
603+
for meth in methods.iter() {
604+
print_method(s, *meth);
612605
}
606+
bclose(s, item.span);
613607
}
614608
ast::item_trait(ref generics, ref traits, ref methods) => {
615609
head(s, visibility_qualified(item.vis, "trait"));

branches/snap-stage3/src/test/auxiliary/trait_inheritance_overloading_xc.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,6 @@ impl Eq for MyInt {
3535
fn ne(&self, other: &MyInt) -> bool { !self.eq(other) }
3636
}
3737

38-
impl MyNum for MyInt;
38+
impl MyNum for MyInt {}
3939

4040
fn mi(v: int) -> MyInt { MyInt { val: v } }

branches/snap-stage3/src/test/compile-fail/missing-derivable-attr.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ impl MyEq for int {
2020
fn eq(&self, other: &int) -> bool { *self == *other }
2121
}
2222

23-
impl MyEq for A; //~ ERROR missing method
23+
impl MyEq for A {} //~ ERROR missing method
2424

2525
fn main() {
2626
}

branches/snap-stage3/src/test/debug-info/generic-trait-generic-static-default-method.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ trait Trait<T1> {
4040
}
4141
}
4242

43-
impl<T> Trait<T> for Struct;
43+
impl<T> Trait<T> for Struct {}
4444

4545
fn main() {
4646

branches/snap-stage3/src/test/debug-info/self-in-default-method.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ trait Trait {
118118
}
119119
}
120120

121-
impl Trait for Struct;
121+
impl Trait for Struct {}
122122

123123
fn main() {
124124
let stack = Struct { x: 100 };

branches/snap-stage3/src/test/debug-info/self-in-generic-default-method.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ trait Trait {
119119
}
120120
}
121121

122-
impl Trait for Struct;
122+
impl Trait for Struct {}
123123

124124
fn main() {
125125
let stack = Struct { x: 987 };

branches/snap-stage3/src/test/debug-info/trait-generic-static-default-method.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ trait Trait {
4040
}
4141
}
4242

43-
impl Trait for Struct;
43+
impl Trait for Struct {}
4444

4545
fn main() {
4646

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
trait X { }
2-
impl X for uint;
2+
impl X for uint { }
33

44
trait Y { }
5-
impl Y for uint;
5+
impl Y for uint { }
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
trait X { }
2-
impl X for uint;
2+
impl X for uint { }
33

44
trait Y { }
5-
impl Y for uint;
5+
impl Y for uint { }

branches/snap-stage3/src/test/pretty/path-type-bounds.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// pp-exact
22

33
trait Tr { }
4-
impl Tr for int;
4+
impl Tr for int { }
55

66
fn foo(x: ~Tr: Freeze) -> ~Tr: Freeze { x }
77

branches/snap-stage3/src/test/run-pass/default-method-supertrait-vtable.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ impl Y for int {
2929
fn y(self) -> int { self }
3030
}
3131

32-
impl Z for int;
32+
impl Z for int {}
3333

3434
fn main() {
3535
assert_eq!(12.x(), 12);

branches/snap-stage3/src/test/run-pass/issue-3979-generics.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ impl Positioned<int> for Point {
3131
}
3232
}
3333

34-
impl Movable<int> for Point;
34+
impl Movable<int> for Point {}
3535

3636
pub fn main() {
3737
let mut p = Point{ x: 1, y: 2};

branches/snap-stage3/src/test/run-pass/issue-3979-xcrate.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ impl Positioned for Point {
2424
}
2525
}
2626

27-
impl Movable for Point;
27+
impl Movable for Point {}
2828

2929
pub fn main() {
3030
let mut p = Point{ x: 1, y: 2};

0 commit comments

Comments
 (0)