Skip to content

Commit 89e5dd3

Browse files
author
blake2-ppc
committed
---
yaml --- r: 80763 b: refs/heads/try c: 830ac37 h: refs/heads/master i: 80761: 326e6ba 80759: 4a6288a v: v3
1 parent 3c95ac6 commit 89e5dd3

File tree

4 files changed

+19
-19
lines changed

4 files changed

+19
-19
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
refs/heads/master: 4c6bf4872012c010f84dc7fa2cdfe87522533f89
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: cbd1eefbd350797b783df119fed7956d7e1c74ad
5-
refs/heads/try: b4eff79f389b2c48a21345929c0542385da212df
5+
refs/heads/try: 830ac37ca2484422bb90ec3e39b8ee47d08dc1be
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
88
refs/heads/try2: 147ecfdd8221e4a4d4e090486829a06da1e0ca3c

branches/try/src/libstd/logging.rs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,8 @@
1212
1313
use option::*;
1414
use os;
15-
use either::*;
1615
use rt;
17-
use rt::logging::{Logger, StdErrLogger};
16+
use rt::logging::{Logger, StdErrLogger, OwnedString};
1817

1918
/// Turns on logging to stdout globally
2019
pub fn console_on() {
@@ -57,12 +56,12 @@ fn newsched_log_str(msg: ~str) {
5756
match optional_task {
5857
Some(local) => {
5958
// Use the available logger
60-
(*local).logger.log(Left(msg));
59+
(*local).logger.log(OwnedString(msg));
6160
}
6261
None => {
6362
// There is no logger anywhere, just write to stderr
6463
let mut logger = StdErrLogger;
65-
logger.log(Left(msg));
64+
logger.log(OwnedString(msg));
6665
}
6766
}
6867
}

branches/try/src/libstd/rt/logging.rs

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
10-
use either::*;
1110
use libc::{uintptr_t, exit, STDERR_FILENO};
1211
use option::{Some, None, Option};
1312
use rt::util::dumb_println;
@@ -168,29 +167,32 @@ fn update_log_settings(crate_map: *u8, settings: ~str) {
168167
}
169168
}
170169

170+
/// Represent a string with `Send` bound.
171+
pub enum SendableString {
172+
OwnedString(~str),
173+
StaticString(&'static str)
174+
}
175+
171176
pub trait Logger {
172-
fn log(&mut self, msg: Either<~str, &'static str>);
177+
fn log(&mut self, msg: SendableString);
173178
}
174179

175180
pub struct StdErrLogger;
176181

177182
impl Logger for StdErrLogger {
178-
fn log(&mut self, msg: Either<~str, &'static str>) {
183+
fn log(&mut self, msg: SendableString) {
179184
use io::{Writer, WriterUtil};
180185

181186
if !should_log_console() {
182187
return;
183188
}
184189

185190
let s: &str = match msg {
186-
Left(ref s) => {
187-
let s: &str = *s;
188-
s
189-
}
190-
Right(ref s) => {
191-
let s: &str = *s;
192-
s
193-
}
191+
OwnedString(ref s) => {
192+
let slc: &str = *s;
193+
slc
194+
},
195+
StaticString(s) => s,
194196
};
195197

196198
// Truncate the string

branches/try/src/libstd/sys.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -136,12 +136,11 @@ impl FailWithCause for &'static str {
136136

137137
// FIXME #4427: Temporary until rt::rt_fail_ goes away
138138
pub fn begin_unwind_(msg: *c_char, file: *c_char, line: size_t) -> ! {
139-
use either::Left;
140139
use option::{Some, None};
141140
use rt::in_green_task_context;
142141
use rt::task::Task;
143142
use rt::local::Local;
144-
use rt::logging::Logger;
143+
use rt::logging::{Logger, OwnedString};
145144
use str::Str;
146145

147146
unsafe {
@@ -164,7 +163,7 @@ pub fn begin_unwind_(msg: *c_char, file: *c_char, line: size_t) -> ! {
164163
msg, file, line as int)
165164
};
166165

167-
task.logger.log(Left(msg));
166+
task.logger.log(OwnedString(msg));
168167
}
169168
} else {
170169
rterrln!("failed in non-task context at '%s', %s:%i",

0 commit comments

Comments
 (0)