Skip to content

Commit 4b3b043

Browse files
committed
---
yaml --- r: 136571 b: refs/heads/dist-snap c: b11c572 h: refs/heads/master i: 136569: 9ee3d80 136567: 622ab3c v: v3
1 parent fc678b7 commit 4b3b043

26 files changed

+88
-175
lines changed

[refs]

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

branches/dist-snap/src/etc/make-win-dist.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -58,15 +58,15 @@ def make_win_dist(dist_root, target_triple):
5858
for src in rustc_dlls:
5959
shutil.copy(src, dist_bin_dir)
6060

61-
# Copy platform tools to platform-specific bin directory
62-
target_bin_dir = os.path.join(dist_root, "bin", "rustlib", target_triple, "gcc", "bin")
61+
# Copy platform tools (and another copy of runtime dlls) to platform-spcific bin directory
62+
target_bin_dir = os.path.join(dist_root, "bin", "rustlib", target_triple, "bin")
6363
if not os.path.exists(target_bin_dir):
6464
os.makedirs(target_bin_dir)
6565
for src in target_tools:
6666
shutil.copy(src, target_bin_dir)
6767

6868
# Copy platform libs to platform-spcific lib directory
69-
target_lib_dir = os.path.join(dist_root, "bin", "rustlib", target_triple, "gcc", "lib")
69+
target_lib_dir = os.path.join(dist_root, "bin", "rustlib", target_triple, "lib")
7070
if not os.path.exists(target_lib_dir):
7171
os.makedirs(target_lib_dir)
7272
for src in target_libs:

branches/dist-snap/src/librustc/driver/config.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -180,6 +180,7 @@ debugging_opts!(
180180
GC,
181181
PRINT_LINK_ARGS,
182182
PRINT_LLVM_PASSES,
183+
LTO,
183184
AST_JSON,
184185
AST_JSON_NOEXPAND,
185186
LS,
@@ -218,6 +219,7 @@ pub fn debugging_opts_map() -> Vec<(&'static str, &'static str, u64)> {
218219
("print-llvm-passes",
219220
"Prints the llvm optimization passes being run",
220221
PRINT_LLVM_PASSES),
222+
("lto", "Perform LLVM link-time optimizations", LTO),
221223
("ast-json", "Print the AST as JSON and halt", AST_JSON),
222224
("ast-json-noexpand", "Print the pre-expansion AST as JSON and halt", AST_JSON_NOEXPAND),
223225
("ls", "List the symbols defined by a library crate", LS),
@@ -351,8 +353,6 @@ cgoptions!(
351353
"system linker to link outputs with"),
352354
link_args: Vec<String> = (Vec::new(), parse_list,
353355
"extra arguments to pass to the linker (space separated)"),
354-
lto: bool = (false, parse_bool,
355-
"perform LLVM link-time optimizations"),
356356
target_cpu: String = ("generic".to_string(), parse_string,
357357
"select target processor (llc -mcpu=help for details)"),
358358
target_feature: String = ("".to_string(), parse_string,

branches/dist-snap/src/librustc/driver/driver.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -560,8 +560,8 @@ pub fn phase_6_link_output(sess: &Session,
560560
trans: &CrateTranslation,
561561
outputs: &OutputFilenames) {
562562
let old_path = os::getenv("PATH").unwrap_or_else(||String::new());
563-
let mut new_path = sess.host_filesearch().get_tools_search_paths();
564-
new_path.push_all_move(os::split_paths(old_path.as_slice()));
563+
let mut new_path = os::split_paths(old_path.as_slice());
564+
new_path.push_all_move(sess.host_filesearch().get_tools_search_paths());
565565
os::setenv("PATH", os::join_paths(new_path.as_slice()).unwrap());
566566

567567
time(sess.time_passes(), "linking", (), |_|

branches/dist-snap/src/librustc/driver/session.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ impl Session {
168168
self.debugging_opt(config::PRINT_LLVM_PASSES)
169169
}
170170
pub fn lto(&self) -> bool {
171-
self.opts.cg.lto
171+
self.debugging_opt(config::LTO)
172172
}
173173
pub fn no_landing_pads(&self) -> bool {
174174
self.debugging_opt(config::NO_LANDING_PADS)

branches/dist-snap/src/librustc/metadata/filesearch.rs

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -150,12 +150,8 @@ impl<'a> FileSearch<'a> {
150150
p.push(find_libdir(self.sysroot));
151151
p.push(rustlibdir());
152152
p.push(self.triple);
153-
let mut p1 = p.clone();
154-
p1.push("bin");
155-
let mut p2 = p.clone();
156-
p2.push("gcc");
157-
p2.push("bin");
158-
vec![p1, p2]
153+
p.push("bin");
154+
vec![p]
159155
}
160156
}
161157

branches/dist-snap/src/librustc/middle/resolve.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2928,7 +2928,7 @@ impl<'a> Resolver<'a> {
29282928
Some(span) => {
29292929
self.session
29302930
.span_note(span,
2931-
"conflicting value here");
2931+
"note conflicting value here");
29322932
}
29332933
}
29342934
}
@@ -2951,7 +2951,7 @@ impl<'a> Resolver<'a> {
29512951
Some(span) => {
29522952
self.session
29532953
.span_note(span,
2954-
"conflicting type here")
2954+
"note conflicting type here")
29552955
}
29562956
}
29572957
}

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

Lines changed: 16 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -3480,32 +3480,22 @@ impl<'a> Parser<'a> {
34803480
})
34813481
}
34823482

3483-
/// Get an expected item after attributes error message.
3484-
fn expected_item_err(attrs: &[Attribute]) -> &'static str {
3485-
match attrs.last() {
3486-
Some(&Attribute { node: ast::Attribute_ { is_sugared_doc: true, .. }, .. }) => {
3487-
"expected item after doc comment"
3488-
}
3489-
_ => "expected item after attributes",
3490-
}
3491-
}
3492-
34933483
/// Parse a statement. may include decl.
34943484
/// Precondition: any attributes are parsed already
34953485
pub fn parse_stmt(&mut self, item_attrs: Vec<Attribute>) -> P<Stmt> {
34963486
maybe_whole!(self, NtStmt);
34973487

3498-
fn check_expected_item(p: &mut Parser, attrs: &[Attribute]) {
3488+
fn check_expected_item(p: &mut Parser, found_attrs: bool) {
34993489
// If we have attributes then we should have an item
3500-
if !attrs.is_empty() {
3490+
if found_attrs {
35013491
let last_span = p.last_span;
3502-
p.span_err(last_span, Parser::expected_item_err(attrs));
3492+
p.span_err(last_span, "expected item after attributes");
35033493
}
35043494
}
35053495

35063496
let lo = self.span.lo;
35073497
if self.is_keyword(keywords::Let) {
3508-
check_expected_item(self, item_attrs.as_slice());
3498+
check_expected_item(self, !item_attrs.is_empty());
35093499
self.expect_keyword(keywords::Let);
35103500
let decl = self.parse_let();
35113501
P(spanned(lo, decl.span.hi, StmtDecl(decl, ast::DUMMY_NODE_ID)))
@@ -3514,7 +3504,7 @@ impl<'a> Parser<'a> {
35143504
&& self.look_ahead(1, |t| *t == token::NOT) {
35153505
// it's a macro invocation:
35163506

3517-
check_expected_item(self, item_attrs.as_slice());
3507+
check_expected_item(self, !item_attrs.is_empty());
35183508

35193509
// Potential trouble: if we allow macros with paths instead of
35203510
// idents, we'd need to look ahead past the whole path here...
@@ -3571,7 +3561,6 @@ impl<'a> Parser<'a> {
35713561

35723562
} else {
35733563
let found_attrs = !item_attrs.is_empty();
3574-
let item_err = Parser::expected_item_err(item_attrs.as_slice());
35753564
match self.parse_item_or_view_item(item_attrs, false) {
35763565
IoviItem(i) => {
35773566
let hi = i.span.hi;
@@ -3586,10 +3575,7 @@ impl<'a> Parser<'a> {
35863575
self.fatal("foreign items are not allowed here");
35873576
}
35883577
IoviNone(_) => {
3589-
if found_attrs {
3590-
let last_span = self.last_span;
3591-
self.span_err(last_span, item_err);
3592-
}
3578+
check_expected_item(self, found_attrs);
35933579

35943580
// Remainder are line-expr stmts.
35953581
let e = self.parse_expr_res(RestrictionStmtExpr);
@@ -3667,8 +3653,7 @@ impl<'a> Parser<'a> {
36673653
token::SEMI => {
36683654
if !attributes_box.is_empty() {
36693655
let last_span = self.last_span;
3670-
self.span_err(last_span,
3671-
Parser::expected_item_err(attributes_box.as_slice()));
3656+
self.span_err(last_span, "expected item after attributes");
36723657
attributes_box = Vec::new();
36733658
}
36743659
self.bump(); // empty
@@ -3754,8 +3739,7 @@ impl<'a> Parser<'a> {
37543739

37553740
if !attributes_box.is_empty() {
37563741
let last_span = self.last_span;
3757-
self.span_err(last_span,
3758-
Parser::expected_item_err(attributes_box.as_slice()));
3742+
self.span_err(last_span, "expected item after attributes");
37593743
}
37603744

37613745
let hi = self.span.hi;
@@ -4701,8 +4685,7 @@ impl<'a> Parser<'a> {
47014685
if first && attrs_remaining_len > 0u {
47024686
// We parsed attributes for the first item but didn't find it
47034687
let last_span = self.last_span;
4704-
self.span_err(last_span,
4705-
Parser::expected_item_err(attrs_remaining.as_slice()));
4688+
self.span_err(last_span, "expected item after attributes");
47064689
}
47074690

47084691
ast::Mod {
@@ -4936,10 +4919,10 @@ impl<'a> Parser<'a> {
49364919
items: _,
49374920
foreign_items: foreign_items
49384921
} = self.parse_foreign_items(first_item_attrs, true);
4939-
if !attrs_remaining.is_empty() {
4922+
if ! attrs_remaining.is_empty() {
49404923
let last_span = self.last_span;
49414924
self.span_err(last_span,
4942-
Parser::expected_item_err(attrs_remaining.as_slice()));
4925+
"expected item after attributes");
49434926
}
49444927
assert!(self.token == token::RBRACE);
49454928
ast::ForeignMod {
@@ -5069,7 +5052,7 @@ impl<'a> Parser<'a> {
50695052
fn parse_enum_def(&mut self, _generics: &ast::Generics) -> EnumDef {
50705053
let mut variants = Vec::new();
50715054
let mut all_nullary = true;
5072-
let mut any_disr = None;
5055+
let mut have_disr = false;
50735056
while self.token != token::RBRACE {
50745057
let variant_attrs = self.parse_outer_attributes();
50755058
let vlo = self.span.lo;
@@ -5101,8 +5084,8 @@ impl<'a> Parser<'a> {
51015084
}
51025085
kind = TupleVariantKind(args);
51035086
} else if self.eat(&token::EQ) {
5087+
have_disr = true;
51045088
disr_expr = Some(self.parse_expr());
5105-
any_disr = disr_expr.as_ref().map(|expr| expr.span);
51065089
kind = TupleVariantKind(args);
51075090
} else {
51085091
kind = TupleVariantKind(Vec::new());
@@ -5121,11 +5104,9 @@ impl<'a> Parser<'a> {
51215104
if !self.eat(&token::COMMA) { break; }
51225105
}
51235106
self.expect(&token::RBRACE);
5124-
match any_disr {
5125-
Some(disr_span) if !all_nullary =>
5126-
self.span_err(disr_span,
5127-
"discriminator values can only be used with a c-like enum"),
5128-
_ => ()
5107+
if have_disr && !all_nullary {
5108+
self.fatal("discriminator values can only be used with a c-like \
5109+
enum");
51295110
}
51305111

51315112
ast::EnumDef { variants: variants }

branches/dist-snap/src/libterm/win.rs

Lines changed: 51 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,15 +23,29 @@ use Terminal;
2323
/// A Terminal implementation which uses the Win32 Console API.
2424
pub struct WinConsole<T> {
2525
buf: T,
26+
def_foreground: color::Color,
27+
def_background: color::Color,
2628
foreground: color::Color,
2729
background: color::Color,
2830
}
2931

32+
#[allow(non_snake_case)]
33+
#[repr(C)]
34+
struct CONSOLE_SCREEN_BUFFER_INFO {
35+
dwSize: [libc::c_short, ..2],
36+
dwCursorPosition: [libc::c_short, ..2],
37+
wAttributes: libc::WORD,
38+
srWindow: [libc::c_short, ..4],
39+
dwMaximumWindowSize: [libc::c_short, ..2],
40+
}
41+
3042
#[allow(non_snake_case)]
3143
#[link(name = "kernel32")]
3244
extern "system" {
3345
fn SetConsoleTextAttribute(handle: libc::HANDLE, attr: libc::WORD) -> libc::BOOL;
3446
fn GetStdHandle(which: libc::DWORD) -> libc::HANDLE;
47+
fn GetConsoleScreenBufferInfo(handle: libc::HANDLE,
48+
info: *mut CONSOLE_SCREEN_BUFFER_INFO) -> libc::BOOL;
3549
}
3650

3751
fn color_to_bits(color: color::Color) -> u16 {
@@ -56,6 +70,26 @@ fn color_to_bits(color: color::Color) -> u16 {
5670
}
5771
}
5872

73+
fn bits_to_color(bits: u16) -> color::Color {
74+
let color = match bits & 0x7 {
75+
0 => color::BLACK,
76+
0x1 => color::BLUE,
77+
0x2 => color::GREEN,
78+
0x4 => color::RED,
79+
0x6 => color::YELLOW,
80+
0x5 => color::MAGENTA,
81+
0x3 => color::CYAN,
82+
0x7 => color::WHITE,
83+
_ => unreachable!()
84+
};
85+
86+
if bits >= 8 {
87+
color | 0x8
88+
} else {
89+
color
90+
}
91+
}
92+
5993
impl<T: Writer> WinConsole<T> {
6094
fn apply(&mut self) {
6195
let _unused = self.buf.flush();
@@ -91,7 +125,21 @@ impl<T: Writer> Writer for WinConsole<T> {
91125

92126
impl<T: Writer> Terminal<T> for WinConsole<T> {
93127
fn new(out: T) -> Option<WinConsole<T>> {
94-
Some(WinConsole { buf: out, foreground: color::WHITE, background: color::BLACK })
128+
let fg;
129+
let bg;
130+
unsafe {
131+
let mut buffer_info = ::std::mem::uninitialized();
132+
if GetConsoleScreenBufferInfo(GetStdHandle(-11), &mut buffer_info) != 0 {
133+
fg = bits_to_color(buffer_info.wAttributes);
134+
bg = bits_to_color(buffer_info.wAttributes >> 4);
135+
} else {
136+
fg = color::WHITE;
137+
bg = color::BLACK;
138+
}
139+
}
140+
Some(WinConsole { buf: out,
141+
def_foreground: fg, def_background: bg,
142+
foreground: fg, background: bg } )
95143
}
96144

97145
fn fg(&mut self, color: color::Color) -> IoResult<bool> {
@@ -134,8 +182,8 @@ impl<T: Writer> Terminal<T> for WinConsole<T> {
134182
}
135183

136184
fn reset(&mut self) -> IoResult<()> {
137-
self.foreground = color::WHITE;
138-
self.background = color::BLACK;
185+
self.foreground = self.def_foreground;
186+
self.background = self.def_background;
139187
self.apply();
140188

141189
Ok(())

branches/dist-snap/src/test/compile-fail/attr-before-eof.rs

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

branches/dist-snap/src/test/compile-fail/doc-before-attr.rs

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

branches/dist-snap/src/test/compile-fail/doc-before-eof.rs

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

branches/dist-snap/src/test/compile-fail/doc-before-extern-rbrace.rs

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

0 commit comments

Comments
 (0)