Skip to content

Commit a0d64d8

Browse files
committed
---
yaml --- r: 15695 b: refs/heads/try c: 2db4259 h: refs/heads/master i: 15693: 0fbd0a6 15691: 9d4b9c5 15687: 2bcbc45 15679: d7021b0 v: v3
1 parent 4f32740 commit a0d64d8

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

51 files changed

+696
-819
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@
22
refs/heads/master: 61b1875c16de39c166b0f4d54bba19f9c6777d1a
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: 4a81779abd786ff22d71434c6d9a5917ea4cdfff
5-
refs/heads/try: 22254c3b480df40d4d3ca48a36a0f7672b8e19a5
5+
refs/heads/try: 2db4259b3531e0cfa1f6df2ff95e30a4c871a105
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105

branches/try/configure

Lines changed: 21 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -259,9 +259,9 @@ esac
259259

260260
DEFAULT_HOST_TRIPLE="${CFG_CPUTYPE}-${CFG_OSTYPE}"
261261

262-
CFG_SELF=$(echo $0 | tr '\\' '/')
263-
CFG_SRC_DIR="$(dirname $CFG_SELF)/"
264-
CFG_BUILD_DIR="$(echo $PWD | tr '\\' '/')/"
262+
CFG_SRC_DIR="$(cd $(dirname $0) && pwd)/"
263+
CFG_BUILD_DIR="$(pwd)/"
264+
CFG_SELF=${CFG_SRC_DIR}$(basename $0)
265265
CFG_CONFIGURE_ARGS="$@"
266266

267267
OPTIONS=""
@@ -509,32 +509,25 @@ step_msg "configuring submodules"
509509
if [ -z $CFG_DISABLE_MANAGE_SUBMODULES ]
510510
then
511511
cd ${CFG_SRC_DIR}
512+
512513
msg "git: submodule sync"
513-
"${CFG_GIT}" submodule sync --quiet
514-
SUBMODULES=$("${CFG_GIT}" submodule status | awk '{print $2}')
515-
for s in $SUBMODULES
516-
do
517-
msg "git: submodule status ${s}"
518-
status=$("${CFG_GIT}" submodule status ${s} | awk '{print $1}')
519-
case ${status} in
520-
-*)
521-
msg "${s} is not initialized, initializing"
522-
"${CFG_GIT}" submodule init --quiet ${s}
523-
need_ok "git failed"
524-
msg "${s} updating"
525-
"${CFG_GIT}" submodule update --quiet ${s}
526-
need_ok "git failed"
527-
;;
528-
+*)
529-
msg "${s} is not up to date, updating"
530-
"${CFG_GIT}" submodule update --quiet ${s}
531-
need_ok "git failed"
532-
;;
533-
*)
534-
msg "${s} is clean"
535-
;;
536-
esac
537-
done
514+
"${CFG_GIT}" submodule --quiet sync
515+
516+
# NB: this is just for the sake of getting the submodule SHA1 values
517+
# and status written into the build log.
518+
msg "git: submodule status"
519+
"${CFG_GIT}" submodule status --recursive
520+
521+
msg "git: submodule update"
522+
"${CFG_GIT}" submodule --quiet update --init --recursive
523+
need_ok "git failed"
524+
525+
msg "git: submodule clobber"
526+
"${CFG_GIT}" submodule --quiet foreach --recursive git clean -dxf
527+
need_ok "git failed"
528+
"${CFG_GIT}" submodule --quiet foreach --recursive git checkout .
529+
need_ok "git failed"
530+
538531
cd ${CFG_BUILD_DIR}
539532
fi
540533

branches/try/mk/tests.mk

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,7 @@ ALL_HS := $(filter-out $(S)src/rt/vg/valgrind.h \
120120
tidy:
121121
@$(call E, check: formatting)
122122
$(Q)find $(S)src -name '*.r[sc]' \
123+
| grep '^$(S)src/test' -v \
123124
| xargs -n 10 python $(S)src/etc/tidy.py
124125
$(Q)find $(S)src/etc -name '*.py' \
125126
| xargs -n 10 python $(S)src/etc/tidy.py

branches/try/src/etc/tidy.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,7 @@ def report_err(s):
3232
report_err("trailing whitespace")
3333
line_len = len(line)-2 if autocrlf else len(line)-1
3434

35-
# Along long lines if they are part of an expected error message
36-
# in a test, which is denoted with "//!":
37-
if line_len > cols and "//!" not in line:
35+
if line_len > cols:
3836
report_err("line longer than %d chars" % cols)
3937
except UnicodeDecodeError, e:
4038
report_err("UTF-8 decoding error " + str(e))

branches/try/src/libcore/os.rs

Lines changed: 120 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -121,61 +121,141 @@ mod win32 {
121121
}
122122
}
123123

124+
fn getenv(n: str) -> option<str> {
125+
global_env::getenv(n)
126+
}
124127

125-
#[cfg(target_os = "linux")]
126-
#[cfg(target_os = "macos")]
127-
#[cfg(target_os = "freebsd")]
128-
fn getenv(n: str) -> option<str> unsafe {
129-
let s = as_c_charp(n, libc::getenv);
130-
ret if unsafe::reinterpret_cast(s) == 0 {
131-
option::none::<str>
132-
} else {
133-
let s = unsafe::reinterpret_cast(s);
134-
option::some::<str>(str::unsafe::from_buf(s))
135-
};
128+
fn setenv(n: str, v: str) {
129+
global_env::setenv(n, v)
136130
}
137131

138-
#[cfg(target_os = "win32")]
139-
fn getenv(n: str) -> option<str> unsafe {
140-
import libc::types::os::arch::extra::*;
141-
import libc::funcs::extra::kernel32::*;
142-
import win32::*;
143-
as_utf16_p(n) {|u|
144-
fill_utf16_buf_and_decode() {|buf, sz|
145-
GetEnvironmentVariableW(u, buf, sz)
146-
}
132+
mod global_env {
133+
#[doc = "Internal module for serializing access to getenv/setenv"];
134+
135+
export getenv;
136+
export setenv;
137+
138+
native mod rustrt {
139+
fn rust_global_env_chan_ptr() -> *libc::uintptr_t;
147140
}
148-
}
149141

142+
enum msg {
143+
msg_getenv(str, comm::chan<option<str>>),
144+
msg_setenv(str, str, comm::chan<()>)
145+
}
150146

151-
#[cfg(target_os = "linux")]
152-
#[cfg(target_os = "macos")]
153-
#[cfg(target_os = "freebsd")]
154-
fn setenv(n: str, v: str) {
147+
fn getenv(n: str) -> option<str> {
148+
let env_ch = get_global_env_chan();
149+
let po = comm::port();
150+
comm::send(env_ch, msg_getenv(n, comm::chan(po)));
151+
comm::recv(po)
152+
}
155153

156-
// FIXME: remove this when export globs work properly.
157-
import libc::funcs::posix01::unistd::setenv;
158-
as_c_charp(n) {|nbuf|
159-
as_c_charp(v) {|vbuf|
160-
setenv(nbuf, vbuf, 1i32);
154+
fn setenv(n: str, v: str) {
155+
let env_ch = get_global_env_chan();
156+
let po = comm::port();
157+
comm::send(env_ch, msg_setenv(n, v, comm::chan(po)));
158+
comm::recv(po)
159+
}
160+
161+
fn get_global_env_chan() -> comm::chan<msg> {
162+
let global_ptr = rustrt::rust_global_env_chan_ptr();
163+
let builder_fn = {||
164+
let builder = task::builder();
165+
task::unsupervise(builder);
166+
task::set_opts(builder, {
167+
sched: some({
168+
mode: task::single_threaded,
169+
// FIXME: This would be a good place to use
170+
// a very small native stack
171+
native_stack_size: none
172+
})
173+
with task::get_opts(builder)
174+
});
175+
builder
176+
};
177+
unsafe {
178+
priv::chan_from_global_ptr(
179+
global_ptr, builder_fn, global_env_task)
161180
}
162181
}
163-
}
164182

183+
fn global_env_task(msg_po: comm::port<msg>) unsafe {
184+
priv::weaken_task {|weak_po|
185+
loop {
186+
alt comm::select2(msg_po, weak_po) {
187+
either::left(msg_getenv(n, resp_ch)) {
188+
comm::send(resp_ch, impl::getenv(n))
189+
}
190+
either::left(msg_setenv(n, v, resp_ch)) {
191+
comm::send(resp_ch, impl::setenv(n, v))
192+
}
193+
either::right(_) {
194+
break;
195+
}
196+
}
197+
}
198+
}
199+
}
165200

166-
#[cfg(target_os = "win32")]
167-
fn setenv(n: str, v: str) {
168-
// FIXME: remove imports when export globs work properly.
169-
import libc::funcs::extra::kernel32::*;
170-
import win32::*;
171-
as_utf16_p(n) {|nbuf|
172-
as_utf16_p(v) {|vbuf|
173-
SetEnvironmentVariableW(nbuf, vbuf);
201+
mod impl {
202+
203+
#[cfg(target_os = "linux")]
204+
#[cfg(target_os = "macos")]
205+
#[cfg(target_os = "freebsd")]
206+
fn getenv(n: str) -> option<str> unsafe {
207+
let s = str::as_c_str(n, libc::getenv);
208+
ret if unsafe::reinterpret_cast(s) == 0 {
209+
option::none::<str>
210+
} else {
211+
let s = unsafe::reinterpret_cast(s);
212+
option::some::<str>(str::unsafe::from_buf(s))
213+
};
214+
}
215+
216+
#[cfg(target_os = "win32")]
217+
fn getenv(n: str) -> option<str> unsafe {
218+
import libc::types::os::arch::extra::*;
219+
import libc::funcs::extra::kernel32::*;
220+
import win32::*;
221+
as_utf16_p(n) {|u|
222+
fill_utf16_buf_and_decode() {|buf, sz|
223+
GetEnvironmentVariableW(u, buf, sz)
224+
}
225+
}
226+
}
227+
228+
229+
#[cfg(target_os = "linux")]
230+
#[cfg(target_os = "macos")]
231+
#[cfg(target_os = "freebsd")]
232+
fn setenv(n: str, v: str) {
233+
234+
// FIXME: remove this when export globs work properly.
235+
import libc::funcs::posix01::unistd::setenv;
236+
str::as_c_str(n) {|nbuf|
237+
str::as_c_str(v) {|vbuf|
238+
setenv(nbuf, vbuf, 1i32);
239+
}
240+
}
241+
}
242+
243+
244+
#[cfg(target_os = "win32")]
245+
fn setenv(n: str, v: str) {
246+
// FIXME: remove imports when export globs work properly.
247+
import libc::funcs::extra::kernel32::*;
248+
import win32::*;
249+
as_utf16_p(n) {|nbuf|
250+
as_utf16_p(v) {|vbuf|
251+
SetEnvironmentVariableW(nbuf, vbuf);
252+
}
253+
}
174254
}
255+
175256
}
176257
}
177258

178-
179259
fn fdopen(fd: c_int) -> *FILE {
180260
ret as_c_charp("r") {|modebuf|
181261
libc::fdopen(fd, modebuf)
@@ -726,15 +806,13 @@ mod tests {
726806
}
727807

728808
#[test]
729-
#[ignore(reason = "fails periodically on mac")]
730809
fn test_setenv() {
731810
let n = make_rand_name();
732811
setenv(n, "VALUE");
733812
assert getenv(n) == option::some("VALUE");
734813
}
735814

736815
#[test]
737-
#[ignore(reason = "fails periodically on mac")]
738816
fn test_setenv_overwrite() {
739817
let n = make_rand_name();
740818
setenv(n, "1");
@@ -747,7 +825,6 @@ mod tests {
747825
// Windows GetEnvironmentVariable requires some extra work to make sure
748826
// the buffer the variable is copied into is the right size
749827
#[test]
750-
#[ignore(reason = "fails periodically on mac")]
751828
fn test_getenv_big() {
752829
let mut s = "";
753830
let mut i = 0;

branches/try/src/libcore/priv.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,15 +14,15 @@ native mod rustrt {
1414
fn rust_task_unweaken(ch: rust_port_id);
1515
}
1616

17-
type global_ptr<T: send> = *libc::uintptr_t;
17+
type global_ptr = *libc::uintptr_t;
1818

1919
#[doc = "
2020
Atomically gets a channel from a pointer to a pointer-sized memory location
2121
or, if no channel exists creates and installs a new channel and sets up a new
2222
task to receive from it.
2323
"]
2424
unsafe fn chan_from_global_ptr<T: send>(
25-
global: global_ptr<T>,
25+
global: global_ptr,
2626
builder: fn() -> task::builder,
2727
f: fn~(comm::port<T>)
2828
) -> comm::chan<T> {

branches/try/src/libcore/vec.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1168,7 +1168,9 @@ mod unsafe {
11681168
#[inline(always)]
11691169
unsafe fn form_slice<T,U>(p: *T, len: uint, f: fn([T]/&) -> U) -> U {
11701170
let pair = (p, len * sys::size_of::<T>());
1171-
let v : *([T]/&) = ::unsafe::reinterpret_cast(ptr::addr_of(pair));
1171+
// FIXME: should use &blk not &static here, but a snapshot is req'd
1172+
let v : *([T]/&static) =
1173+
::unsafe::reinterpret_cast(ptr::addr_of(pair));
11721174
f(*v)
11731175
}
11741176
}

branches/try/src/librustsyntax/ast.rs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -452,11 +452,7 @@ enum prim_ty {
452452
type region = {id: node_id, node: region_};
453453

454454
#[auto_serialize]
455-
enum region_ {
456-
re_anon,
457-
re_named(ident),
458-
re_static
459-
}
455+
enum region_ { re_anon, re_named(ident) }
460456

461457
#[auto_serialize]
462458
enum ty_ {

branches/try/src/librustsyntax/diagnostic.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ impl codemap_handler of handler for handler_t {
105105
}
106106

107107
fn ice_msg(msg: str) -> str {
108-
#fmt["internal compiler error %s", msg]
108+
#fmt["internal compiler error: %s", msg]
109109
}
110110

111111
fn mk_span_handler(handler: handler, cm: codemap::codemap) -> span_handler {

branches/try/src/librustsyntax/parse.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ fn new_parser_from_file(sess: parse_sess, cfg: ast::crate_cfg, path: str,
152152
parser {
153153
let src = alt io::read_whole_file_str(path) {
154154
result::ok(src) {
155-
// FIXME: This copy is unfortunate
155+
// FIXME: This copy is unfortunate (#2319)
156156
@src
157157
}
158158
result::err(e) {

branches/try/src/librustsyntax/parse/parser.rs

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -250,16 +250,7 @@ fn parse_ret_ty(p: parser) -> (ast::ret_style, @ast::ty) {
250250

251251
fn region_from_name(p: parser, s: option<str>) -> @ast::region {
252252
let r = alt s {
253-
some (string) {
254-
// FIXME: To be consistent with our type resolution, the
255-
// static region should probably be resolved during type
256-
// checking, not in the parser. (Issue #2256)
257-
if string == "static" {
258-
ast::re_static
259-
} else {
260-
ast::re_named(string)
261-
}
262-
}
253+
some (string) { ast::re_named(string) }
263254
none { ast::re_anon }
264255
};
265256

branches/try/src/librustsyntax/print/pprust.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -329,7 +329,6 @@ fn print_native_mod(s: ps, nmod: ast::native_mod, attrs: [ast::attribute]) {
329329
fn print_region(s: ps, region: @ast::region) {
330330
alt region.node {
331331
ast::re_anon { word_space(s, "&"); }
332-
ast::re_static { word_space(s, "&static"); }
333332
ast::re_named(name) {
334333
word(s.s, "&");
335334
word_space(s, name);

branches/try/src/libstd/getopts.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,12 @@ Simple getopt alternative.
44
Construct a vector of options, either by using reqopt, optopt, and optflag or
55
by building them from components yourself, and pass them to getopts, along
66
with a vector of actual arguments (not including argv[0]). You'll either get a
7-
failure code back, or a match. You'll have to verify whether the amount of
7+
failure code back, or a match. You'll have to verify whether the amount of
88
'free' arguments in the match is what you expect. Use opt_* accessors to get
99
argument values out of the match object.
1010
1111
Single-character options are expected to appear on the command line with a
12-
single preceding dash; multiple-character options are expected to be
12+
single preceeding dash; multiple-character options are expected to be
1313
proceeded by two dashes. Options that expect an argument accept their argument
1414
following either a space or an equals sign.
1515

0 commit comments

Comments
 (0)