Skip to content

Commit 0ecbdd7

Browse files
committed
---
yaml --- r: 134082 b: refs/heads/master c: 4e5b626 h: refs/heads/master v: v3
1 parent ea15fbe commit 0ecbdd7

File tree

16 files changed

+77
-25
lines changed

16 files changed

+77
-25
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: b2b0737fbe1b4be62cb3656dabf69c0eb7c5a89e
2+
refs/heads/master: 4e5b62618cb5341139177c1ef62e2467affd041f
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: 437179ed8bf7f7672f84b19265df1ce569e70490
55
refs/heads/try: 777654cfccbfa39bc7f671d8e9629018ed8ca12d

trunk/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 (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")
61+
# Copy platform tools to platform-specific bin directory
62+
target_bin_dir = os.path.join(dist_root, "bin", "rustlib", target_triple, "gcc", "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, "lib")
69+
target_lib_dir = os.path.join(dist_root, "bin", "rustlib", target_triple, "gcc", "lib")
7070
if not os.path.exists(target_lib_dir):
7171
os.makedirs(target_lib_dir)
7272
for src in target_libs:

trunk/src/librustc/driver/config.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,6 @@ debugging_opts!(
179179
GC,
180180
PRINT_LINK_ARGS,
181181
PRINT_LLVM_PASSES,
182-
LTO,
183182
AST_JSON,
184183
AST_JSON_NOEXPAND,
185184
LS,
@@ -217,7 +216,6 @@ pub fn debugging_opts_map() -> Vec<(&'static str, &'static str, u64)> {
217216
("print-llvm-passes",
218217
"Prints the llvm optimization passes being run",
219218
PRINT_LLVM_PASSES),
220-
("lto", "Perform LLVM link-time optimizations", LTO),
221219
("ast-json", "Print the AST as JSON and halt", AST_JSON),
222220
("ast-json-noexpand", "Print the pre-expansion AST as JSON and halt", AST_JSON_NOEXPAND),
223221
("ls", "List the symbols defined by a library crate", LS),
@@ -351,6 +349,8 @@ cgoptions!(
351349
"system linker to link outputs with"),
352350
link_args: Vec<String> = (Vec::new(), parse_list,
353351
"extra arguments to pass to the linker (space separated)"),
352+
lto: bool = (false, parse_bool,
353+
"perform LLVM link-time optimizations"),
354354
target_cpu: String = ("generic".to_string(), parse_string,
355355
"select target processor (llc -mcpu=help for details)"),
356356
target_feature: String = ("".to_string(), parse_string,

trunk/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 = os::split_paths(old_path.as_slice());
564-
new_path.push_all_move(sess.host_filesearch().get_tools_search_paths());
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()));
565565
os::setenv("PATH", os::join_paths(new_path.as_slice()).unwrap());
566566

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

trunk/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.debugging_opt(config::LTO)
171+
self.opts.cg.lto
172172
}
173173
pub fn no_landing_pads(&self) -> bool {
174174
self.debugging_opt(config::NO_LANDING_PADS)

trunk/src/librustc/metadata/filesearch.rs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -150,8 +150,12 @@ impl<'a> FileSearch<'a> {
150150
p.push(find_libdir(self.sysroot));
151151
p.push(rustlibdir());
152152
p.push(self.triple);
153-
p.push("bin");
154-
vec![p]
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]
155159
}
156160
}
157161

trunk/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-
"note conflicting value here");
2931+
"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-
"note conflicting type here")
2954+
"conflicting type here")
29552955
}
29562956
}
29572957
}

trunk/src/libstd/dynamic_lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -260,7 +260,7 @@ pub mod dl {
260260
dlclose(handle as *mut libc::c_void); ()
261261
}
262262

263-
pub enum RTLD {
263+
pub enum Rtld {
264264
Lazy = 1,
265265
Now = 2,
266266
Global = 256,

trunk/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(())

trunk/src/test/compile-fail/issue-11154.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11-
// compile-flags: -Z lto -C prefer-dynamic
11+
// compile-flags: -C lto -C prefer-dynamic
1212

1313
// error-pattern: cannot prefer dynamic linking
1414

trunk/src/test/debuginfo/cross-crate-type-uniquing.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
extern crate cross_crate_debuginfo_type_uniquing;
1515

1616
// no-prefer-dynamic
17-
// compile-flags:-g -Zlto
17+
// compile-flags:-g -C lto
1818

1919
pub struct C;
2020
pub fn p() -> C {

trunk/src/test/run-make/issue-14500/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
all:
1010
$(RUSTC) foo.rs --crate-type=rlib
11-
$(RUSTC) bar.rs --crate-type=staticlib -Zlto -L. -o $(TMPDIR)/libbar.a
11+
$(RUSTC) bar.rs --crate-type=staticlib -C lto -L. -o $(TMPDIR)/libbar.a
1212
$(CC) foo.c -lbar -o $(call RUN_BINFILE,foo) $(EXTRACFLAGS)
1313
$(call RUN,foo)
1414

trunk/src/test/run-make/lto-smoke-c/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,6 @@
44
CC := $(CC:-g=)
55

66
all:
7-
$(RUSTC) foo.rs -Z lto
7+
$(RUSTC) foo.rs -C lto
88
$(CC) bar.c -lfoo -o $(call RUN_BINFILE,bar) $(EXTRACFLAGS) -lstdc++
99
$(call RUN,bar)

trunk/src/test/run-make/lto-smoke/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@
22

33
all:
44
$(RUSTC) lib.rs
5-
$(RUSTC) main.rs -Z lto
5+
$(RUSTC) main.rs -C lto
66
$(call RUN,main)

trunk/src/test/run-make/lto-syntax-extension/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,5 +14,5 @@ all: $(DOTEST)
1414
dotest:
1515
env
1616
$(RUSTC) lib.rs
17-
$(RUSTC) main.rs -Z lto
17+
$(RUSTC) main.rs -C lto
1818
$(call RUN,main)

trunk/src/test/run-pass/sepcomp-lib-lto.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,11 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11-
// Check that we can use `-Z lto` when linking against libraries that were
11+
// Check that we can use `-C lto` when linking against libraries that were
1212
// separately compiled.
1313

1414
// aux-build:sepcomp_lib.rs
15-
// compile-flags: -Z lto
15+
// compile-flags: -C lto
1616
// no-prefer-dynamic
1717

1818
extern crate sepcomp_lib;

0 commit comments

Comments
 (0)