Skip to content

Commit 5be9cff

Browse files
committed
---
yaml --- r: 50943 b: refs/heads/try c: e7f42f1 h: refs/heads/master i: 50941: 84038ac 50939: dbcb710 50935: cf3b13a 50927: 59b56e8 50911: cc2a375 50879: 99035ad 50815: 1cd6952 50687: 102ab07 v: v3
1 parent 6cb485f commit 5be9cff

Some content is hidden

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

42 files changed

+1287
-2116
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: 5f13e9ccc2e3328d4cd8ca49f84e6840dd998346
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: f7a2371c176663d59062ec5158f39faecba45768
5-
refs/heads/try: df171e4b6898db92610bcccb22d996d361e16902
5+
refs/heads/try: e7f42f140b8d2271888f97ba62c5e0570032b6e5
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
88
refs/heads/try2: 147ecfdd8221e4a4d4e090486829a06da1e0ca3c

branches/try/Makefile.in

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -238,7 +238,7 @@ $(foreach target,$(CFG_TARGET_TRIPLES),\
238238

239239
CORELIB_CRATE := $(S)src/libcore/core.rc
240240
CORELIB_INPUTS := $(wildcard $(addprefix $(S)src/libcore/, \
241-
core.rc *.rs */*.rs */*/*rs))
241+
core.rc *.rs */*.rs))
242242

243243
######################################################################
244244
# Standard library variables

branches/try/configure

Lines changed: 2 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -136,17 +136,9 @@ validate_opt () {
136136
isArgValid=1
137137
fi
138138
done
139-
if [ "$arg" = "--help" ]
139+
if test $isArgValid -eq 0
140140
then
141-
echo ""
142-
echo "No more help available for Configure options,"
143-
echo "check the Uncyclo or join our IRC channel"
144-
break
145-
else
146-
if test $isArgValid -eq 0
147-
then
148-
err "Option '$arg' is not recognized"
149-
fi
141+
err "Option '$arg' is not recognized"
150142
fi
151143
done
152144
}
@@ -274,42 +266,13 @@ case $CFG_OSTYPE in
274266
MINGW32*)
275267
CFG_OSTYPE=pc-mingw32
276268
;;
277-
# Thad's Cygwin identifers below
278-
279-
# Vista 32 bit
280-
CYGWIN_NT-6.0)
281-
CFG_OSTYPE=pc-mingw32
282-
CFG_CPUTYPE=i686
283-
;;
284-
285-
# Vista 64 bit
286-
CYGWIN_NT-6.0-WOW64)
287-
CFG_OSTYPE=w64-mingw32
288-
CFG_CPUTYPE=x86_64
289-
;;
290-
291-
# Win 7 32 bit
292-
CYGWIN_NT-6.1)
293-
CFG_OSTYPE=pc-mingw32
294-
CFG_CPUTYPE=i686
295-
;;
296269

297-
# Win 7 64 bit
298-
CYGWIN_NT-6.1-WOW64)
299-
CFG_OSTYPE=w64-mingw32
300-
CFG_CPUTYPE=x86_64
301-
;;
302-
303-
# We do not detect other OS such as XP/2003 using 64 bit using uname.
304-
# If we want to in the future, we will need to use Cygwin - Chuck's csih helper in /usr/lib/csih/winProductName.exe or alternative.
305270
*)
306271
err "unknown OS type: $CFG_OSTYPE"
307272
;;
308273
esac
309274

310275

311-
if [ -z "$CFG_CPUTYPE" ]
312-
then
313276
case $CFG_CPUTYPE in
314277

315278
i386 | i486 | i686 | i786 | x86)
@@ -327,7 +290,6 @@ case $CFG_CPUTYPE in
327290
*)
328291
err "unknown CPU type: $CFG_CPUTYPE"
329292
esac
330-
fi
331293

332294
# Detect 64 bit linux systems with 32 bit userland and force 32 bit compilation
333295
if [ $CFG_OSTYPE = unknown-linux-gnu -a $CFG_CPUTYPE = x86_64 ]

branches/try/doc/tutorial-macros.md

Lines changed: 23 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,10 @@
33
# Introduction
44

55
Functions are the primary tool that programmers can use to build abstractions.
6-
Sometimes, however, programmers want to abstract over compile-time syntax
7-
rather than run-time values.
8-
Macros provide syntactic abstraction.
9-
For an example of how this can be useful, consider the following two code fragments,
10-
which both pattern-match on their input and both return early in one case,
11-
doing nothing otherwise:
6+
Sometimes, however, programmers want to perform abstractions over things that are not
7+
runtime values. Macros provide a syntactic abstraction. For an example of how this
8+
can be useful, consider the following two code fragments, which both pattern-match
9+
on their input and return early in one case, and do nothing otherwise:
1210

1311
~~~~
1412
# enum t { special_a(uint), special_b(uint) };
@@ -27,10 +25,9 @@ match input_2 {
2725
# }
2826
~~~~
2927

30-
This code could become tiresome if repeated many times.
31-
However, no function can capture its functionality to make it possible
32-
to abstract the repetition away.
33-
Rust's macro system, however, can eliminate the repetition. Macros are
28+
This code could become tiresome if repeated many times. However, no function
29+
can capture its functionality to make it possible to rewrite the repetition
30+
away. Rust's macro system, however, can eliminate the repetition. Macros are
3431
lightweight custom syntax extensions, themselves defined using the
3532
`macro_rules!` syntax extension. The following `early_return` macro captures
3633
the pattern in the above code:
@@ -40,7 +37,7 @@ the pattern in the above code:
4037
# fn f() -> uint {
4138
# let input_1 = special_a(0), input_2 = special_a(0);
4239
macro_rules! early_return(
43-
($inp:expr $sp:ident) => ( // invoke it like `(input_5 special_e)`
40+
($inp:expr $sp:ident) => ( //invoke it like `(input_5 special_e)`
4441
match $inp {
4542
$sp(x) => { return x; }
4643
_ => {}
@@ -96,10 +93,10 @@ that could be invoked like: `my_macro!(i->(( 2+2 )))`.
9693

9794
## Invocation location
9895

99-
A macro invocation may take the place of (and therefore expand to)
100-
an expression, an item, or a statement.
101-
The Rust parser will parse the macro invocation as a "placeholder"
102-
for whichever of those three nonterminals is appropriate for the location.
96+
A macro invocation may take the place of (and therefore expand to) either an
97+
expression, an item, or a statement. The Rust parser will parse the macro
98+
invocation as a "placeholder" for whichever of those three nonterminals is
99+
appropriate for the location.
103100

104101
At expansion time, the output of the macro will be parsed as whichever of the
105102
three nonterminals it stands in for. This means that a single macro might,
@@ -115,19 +112,17 @@ The right-hand side of the `=>` follows the same rules as the left-hand side,
115112
except that a `$` need only be followed by the name of the syntactic fragment
116113
to transcribe into the macro expansion; its type need not be repeated.
117114

118-
The right-hand side must be enclosed by delimiters, which the transcriber ignores.
119-
Therefore `() => ((1,2,3))` is a macro that expands to a tuple expression,
120-
`() => (let $x=$val)` is a macro that expands to a statement,
121-
and `() => (1,2,3)` is a macro that expands to a syntax error
122-
(since the transcriber interprets the parentheses on the right-hand-size as delimiters,
123-
and `1,2,3` is not a valid Rust expression on its own).
115+
The right-hand side must be enclosed by delimiters, which are ignored by the
116+
transcriber (therefore `() => ((1,2,3))` is a macro that expands to a tuple
117+
expression, `() => (let $x=$val)` is a macro that expands to a statement, and
118+
`() => (1,2,3)` is a macro that expands to a syntax error).
124119

125120
Except for permissibility of `$name` (and `$(...)*`, discussed below), the
126121
right-hand side of a macro definition is ordinary Rust syntax. In particular,
127122
macro invocations (including invocations of the macro currently being defined)
128123
are permitted in expression, statement, and item locations. However, nothing
129124
else about the code is examined or executed by the macro system; execution
130-
still has to wait until run-time.
125+
still has to wait until runtime.
131126

132127
## Interpolation location
133128

@@ -292,6 +287,7 @@ A macro may accept multiple different input grammars. The first one to
292287
successfully match the actual argument to a macro invocation is the one that
293288
"wins".
294289

290+
295291
In the case of the example above, we want to write a recursive macro to
296292
process the semicolon-terminated lines, one-by-one. So, we want the following
297293
input patterns:
@@ -373,19 +369,19 @@ return result + val;
373369
# }
374370
~~~~
375371

376-
This technique applies to many cases where transcribing a result all at once is not possible.
377-
The resulting code resembles ordinary functional programming in some respects,
378-
but has some important differences from functional programming.
372+
This technique is applicable in many cases where transcribing a result "all
373+
at once" is not possible. It resembles ordinary functional programming in some
374+
respects, but it is important to recognize the differences.
379375

380376
The first difference is important, but also easy to forget: the transcription
381377
(right-hand) side of a `macro_rules!` rule is literal syntax, which can only
382378
be executed at run-time. If a piece of transcription syntax does not itself
383379
appear inside another macro invocation, it will become part of the final
384380
program. If it is inside a macro invocation (for example, the recursive
385-
invocation of `biased_match_rec!`), it does have the opportunity to affect
381+
invocation of `biased_match_rec!`), it does have the opprotunity to affect
386382
transcription, but only through the process of attempted pattern matching.
387383

388-
The second, related, difference is that the evaluation order of macros feels
384+
The second difference is related: the evaluation order of macros feels
389385
"backwards" compared to ordinary programming. Given an invocation
390386
`m1!(m2!())`, the expander first expands `m1!`, giving it as input the literal
391387
syntax `m2!()`. If it transcribes its argument unchanged into an appropriate

branches/try/mk/tests.mk

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -244,29 +244,21 @@ $(foreach host,$(CFG_HOST_TRIPLES), \
244244

245245
define TEST_RUNNER
246246

247-
# If NO_REBUILD is set then break the dependencies on std so we can
248-
# test crates without rebuilding core and std first
249-
ifeq ($(NO_REBUILD),)
250-
STDTESTDEP_$(1)_$(2)_$(3) = $$(TLIB$(1)_T_$(2)_H_$(3))/$$(CFG_STDLIB_$(2))
251-
else
252-
STDTESTDEP_$(1)_$(2)_$(3) =
253-
endif
254-
255247
$(3)/test/coretest.stage$(1)-$(2)$$(X_$(2)): \
256248
$$(CORELIB_CRATE) $$(CORELIB_INPUTS) \
257-
$$(STDTESTDEP_$(1)_$(2)_$(3))
249+
$$(TLIB$(1)_T_$(2)_H_$(3))/$$(CFG_STDLIB_$(2))
258250
@$$(call E, compile_and_link: $$@)
259251
$$(STAGE$(1)_T_$(2)_H_$(3)) -o $$@ $$< --test
260252

261253
$(3)/test/stdtest.stage$(1)-$(2)$$(X_$(2)): \
262254
$$(STDLIB_CRATE) $$(STDLIB_INPUTS) \
263-
$$(STDTESTDEP_$(1)_$(2)_$(3))
255+
$$(TLIB$(1)_T_$(2)_H_$(3))/$$(CFG_STDLIB_$(2))
264256
@$$(call E, compile_and_link: $$@)
265257
$$(STAGE$(1)_T_$(2)_H_$(3)) -o $$@ $$< --test
266258

267259
$(3)/test/syntaxtest.stage$(1)-$(2)$$(X_$(2)): \
268260
$$(LIBSYNTAX_CRATE) $$(LIBSYNTAX_INPUTS) \
269-
$$(STDTESTDEP_$(1)_$(2)_$(3))
261+
$$(TLIB$(1)_T_$(2)_H_$(3))/$$(CFG_STDLIB_$(2))
270262
@$$(call E, compile_and_link: $$@)
271263
$$(STAGE$(1)_T_$(2)_H_$(3)) -o $$@ $$< --test
272264

branches/try/src/compiletest/common.rs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -63,9 +63,6 @@ pub struct config {
6363
// Run tests using the JIT
6464
jit: bool,
6565

66-
// Run tests using the new runtime
67-
newrt: bool,
68-
6966
// Explain what's going on
7067
verbose: bool
7168

branches/try/src/compiletest/compiletest.rc

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -61,8 +61,7 @@ pub fn parse_config(args: ~[~str]) -> config {
6161
getopts::optopt(~"runtool"), getopts::optopt(~"rustcflags"),
6262
getopts::optflag(~"verbose"),
6363
getopts::optopt(~"logfile"),
64-
getopts::optflag(~"jit"),
65-
getopts::optflag(~"newrt")];
64+
getopts::optflag(~"jit")];
6665

6766
fail_unless!(!args.is_empty());
6867
let args_ = vec::tail(args);
@@ -96,7 +95,6 @@ pub fn parse_config(args: ~[~str]) -> config {
9695
runtool: getopts::opt_maybe_str(matches, ~"runtool"),
9796
rustcflags: getopts::opt_maybe_str(matches, ~"rustcflags"),
9897
jit: getopts::opt_present(matches, ~"jit"),
99-
newrt: getopts::opt_present(matches, ~"newrt"),
10098
verbose: getopts::opt_present(matches, ~"verbose")
10199
}
102100
}
@@ -116,7 +114,6 @@ pub fn log_config(config: config) {
116114
logv(c, fmt!("runtool: %s", opt_str(config.runtool)));
117115
logv(c, fmt!("rustcflags: %s", opt_str(config.rustcflags)));
118116
logv(c, fmt!("jit: %b", config.jit));
119-
logv(c, fmt!("newrt: %b", config.newrt));
120117
logv(c, fmt!("verbose: %b", config.verbose));
121118
logv(c, fmt!("\n"));
122119
}

branches/try/src/compiletest/runtest.rs

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -484,17 +484,9 @@ fn compile_test_(config: config, props: TestProps,
484484

485485
fn exec_compiled_test(config: config, props: TestProps,
486486
testfile: &Path) -> ProcRes {
487-
488-
// If testing the new runtime then set the RUST_NEWRT env var
489-
let env = if config.newrt {
490-
props.exec_env + ~[(~"RUST_NEWRT", ~"1")]
491-
} else {
492-
props.exec_env
493-
};
494-
495487
compose_and_run(config, testfile,
496488
make_run_args(config, props, testfile),
497-
env,
489+
props.exec_env,
498490
config.run_lib_path, None)
499491
}
500492

0 commit comments

Comments
 (0)