Skip to content

Commit fcfb670

Browse files
committed
---
yaml --- r: 135397 b: refs/heads/snap-stage3 c: 79d0e82 h: refs/heads/master i: 135395: 7335a25 v: v3
1 parent ca1dbda commit fcfb670

File tree

455 files changed

+2589
-6234
lines changed

Some content is hidden

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

455 files changed

+2589
-6234
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
refs/heads/master: 74090504219e4e37c1a6d9fdd8600f44b51c7b04
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
4-
refs/heads/snap-stage3: da7dcee8f16b7ea635b9e0ca83b529e1d92421b0
4+
refs/heads/snap-stage3: 79d0e82f7386e9525e5232bf1083f74b0385838f
55
refs/heads/try: 14378ea357c06c23607ca61ade44f60a7a64a1c7
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b

branches/snap-stage3/.travis.yml

Lines changed: 15 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -1,60 +1,26 @@
11
# Use something that's not 'ruby' so we don't set up things like
2-
# RVM/bundler/ruby and whatnot. Right now 'rust' isn't a language on travis and
3-
# it treats unknown languages as ruby-like I believe.
2+
# RVM/bundler/ruby and whatnot. Right now 'rust' as a language actually
3+
# downloads a rust/cargo snapshot, which we don't really want for building rust.
44
language: c
55

6-
# Before we start doing anything, install a stock LLVM
6+
# Make sure we've got an up-to-date g++ compiler to get past the LLVM configure
7+
# script.
78
install:
8-
- sudo sh -c "echo 'deb http://llvm.org/apt/precise/ llvm-toolchain-precise-3.4 main' >> /etc/apt/sources.list"
9-
- sudo sh -c "echo 'deb http://llvm.org/apt/precise/ llvm-toolchain-precise main' >> /etc/apt/sources.list"
10-
- sudo sh -c "echo 'deb http://ppa.launchpad.net/ubuntu-toolchain-r/test/ubuntu precise main' >> /etc/apt/sources.list"
11-
- wget -O - http://llvm.org/apt/llvm-snapshot.gpg.key | sudo apt-key add -
9+
- sudo add-apt-repository -y ppa:ubuntu-toolchain-r/test
1210
- sudo apt-get update -qq
13-
- sudo apt-get install -qq --force-yes -y llvm-$LLVM_VERSION
14-
llvm-${LLVM_VERSION}-dev clang-$LLVM_VERSION lldb-$LLVM_VERSION
11+
- sudo apt-get install g++-4.7
1512

16-
17-
# All of the llvm tools are suffixed with "-$VERS" which we don't want, so
18-
# symlink them all into a local directory and just use that
13+
# The test suite is in general way too stressful for travis, especially in
14+
# terms of time limit and reliability. In the past we've tried to scale things
15+
# back to only build the stage1 compiler and run a subset of tests, but this
16+
# didn't end up panning out very well.
1917
#
20-
# FIXME: this shouldn't update the src/llvm sub-repo, that takes about a minute
21-
# it's gotta download so much stuff.
18+
# As a result, we're just using travis to run `make tidy` now. It'll help
19+
# everyone find out about their trailing spaces early on!
2220
before_script:
23-
- mkdir -p local-llvm/bin
24-
- ln -nsf /usr/bin/llvm-config-$LLVM_VERSION local-llvm/bin/llvm-config
25-
- ln -nsf /usr/bin/llvm-mc-$LLVM_VERSION local-llvm/bin/llvm-mc
26-
- ln -nsf /usr/bin/llvm-as-$LLVM_VERSION local-llvm/bin/llvm-as
27-
- ln -nsf /usr/bin/llvm-dis-$LLVM_VERSION local-llvm/bin/llvm-dis
28-
- ln -nsf /usr/bin/llc-$LLVM_VERSION local-llvm/bin/llc
29-
- ln -nsf /usr/include/llvm-$LLVM_VERSION local-llvm/include
30-
- ./configure --disable-optimize-tests --llvm-root=`pwd`/local-llvm
31-
--enable-fast-make --enable-clang
32-
33-
# Tidy everything up first, then build a few things, and then run a few tests.
34-
# Note that this is meant to run in a "fairly small" amount of time, so this
35-
# isn't exhaustive at all.
36-
#
37-
# As a result of https://github.com/travis-ci/travis-ci/issues/1066, we run
38-
# everything in one large command instead of multiple commands.
39-
script: |
40-
if [[ $TRAVIS_PULL_REQUEST != 'false' ]]; then
41-
if [[ $LLVM_VERSION != '3.4' ]]; then exit 0; fi
42-
fi &&
43-
make tidy &&
44-
make -j4 rustc-stage1 RUSTFLAGS='-Z time-passes' &&
45-
make check-stage1-std check-stage1-rpass check-stage1-cfail check-stage1-rfail check-stage1-doc
46-
47-
env:
48-
global:
49-
- NO_BENCH=1
50-
matrix:
51-
- LLVM_VERSION=3.3
52-
- LLVM_VERSION=3.4
53-
54-
# We track this ourselves, and in theory we don't have to update the LLVM repo
55-
# (but sadly we do right now anyway).
56-
git:
57-
submodules: false
21+
- ./configure
22+
script:
23+
- make tidy
5824

5925
notifications:
6026
email: false

branches/snap-stage3/configure

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -921,6 +921,7 @@ do
921921
make_dir $h/test/doc-guide-pointers
922922
make_dir $h/test/doc-guide-container
923923
make_dir $h/test/doc-guide-tasks
924+
make_dir $h/test/doc-guide-plugin
924925
make_dir $h/test/doc-rust
925926
done
926927

branches/snap-stage3/mk/ctags.mk

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ CTAGS_LOCATIONS=$(patsubst ${CFG_SRC_DIR}src/llvm,, \
2828
$(patsubst ${CFG_SRC_DIR}src/rt/sundown,, \
2929
$(patsubst ${CFG_SRC_DIR}src/rt/vg,, \
3030
$(wildcard ${CFG_SRC_DIR}src/*) $(wildcard ${CFG_SRC_DIR}src/rt/*) \
31-
)))))))))))
31+
)))))))))
3232
CTAGS_OPTS=--options="${CFG_SRC_DIR}src/etc/ctags.rust" --languages=-javascript --recurse ${CTAGS_LOCATIONS}
3333
# We could use `--languages=Rust`, but there is value in producing tags for the
3434
# C++ parts of the code base too (at the time of writing, those are .h and .cpp

branches/snap-stage3/mk/docs.mk

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
######################################################################
2828
DOCS := index intro tutorial guide guide-ffi guide-macros guide-lifetimes \
2929
guide-tasks guide-container guide-pointers guide-testing \
30-
guide-runtime complement-bugreport \
30+
guide-runtime guide-plugin complement-bugreport \
3131
complement-lang-faq complement-design-faq complement-project-faq rust \
3232
rustdoc guide-unsafe guide-strings reference
3333

branches/snap-stage3/mk/rt.mk

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
# that's per-target so you're allowed to conditionally add files based on the
3636
# target.
3737
################################################################################
38-
NATIVE_LIBS := rust_builtin hoedown uv_support morestack miniz context_switch \
38+
NATIVE_LIBS := rust_builtin hoedown morestack miniz context_switch \
3939
rustrt_native rust_test_helpers
4040

4141
# $(1) is the target triple
@@ -50,7 +50,6 @@ NATIVE_DEPS_hoedown_$(1) := hoedown/src/autolink.c \
5050
hoedown/src/html_smartypants.c \
5151
hoedown/src/stack.c \
5252
hoedown/src/version.c
53-
NATIVE_DEPS_uv_support_$(1) := rust_uv.c
5453
NATIVE_DEPS_miniz_$(1) = miniz.c
5554
NATIVE_DEPS_rust_builtin_$(1) := rust_builtin.c \
5655
rust_android_dummy.c

branches/snap-stage3/src/compiletest/compiletest.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
// except according to those terms.
1010

1111
#![crate_type = "bin"]
12-
#![feature(phase, slicing_syntax)]
12+
#![feature(phase)]
1313

1414
#![deny(warnings)]
1515

branches/snap-stage3/src/compiletest/runtest.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -874,7 +874,7 @@ fn check_error_patterns(props: &TestProps,
874874
if done { return; }
875875

876876
let missing_patterns =
877-
props.error_patterns[next_err_idx..];
877+
props.error_patterns.slice(next_err_idx, props.error_patterns.len());
878878
if missing_patterns.len() == 1u {
879879
fatal_proc_rec(format!("error pattern '{}' not found!",
880880
missing_patterns[0]).as_slice(),

branches/snap-stage3/src/doc/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ something like:
3333
pandoc --from=markdown --to=html5 --number-sections -o reference.html reference.md
3434
~~~~
3535

36-
(rust.md being the Rust Reference Manual.)
36+
(reference.md being the Rust Reference Manual.)
3737

3838
The syntax for pandoc flavored markdown can be found at:
3939
http://johnmacfarlane.net/pandoc/README.html#pandocs-markdown

branches/snap-stage3/src/doc/complement-design-faq.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ representation as a primitive. This allows using Rust `enum`s in FFI where C
3939
`enum`s are also used, for most use cases. The attribute can also be applied
4040
to `struct`s to get the same layout as a C struct would.
4141

42-
[repr]: http://doc.rust-lang.org/rust.html#miscellaneous-attributes
42+
[repr]: reference.html#miscellaneous-attributes
4343

4444
## There is no GC
4545

@@ -56,7 +56,7 @@ Types which are [`Sync`][sync] are thread-safe when multiple shared
5656
references to them are used concurrently. Types which are not `Sync` are not
5757
thread-safe, and thus when used in a global require unsafe code to use.
5858

59-
[sync]: http://doc.rust-lang.org/core/kinds/trait.Sync.html
59+
[sync]: core/kinds/trait.Sync.html
6060

6161
### If mutable static items that implement `Sync` are safe, why is taking &mut SHARABLE unsafe?
6262

@@ -139,8 +139,8 @@ and explicitly calling the `clone` method. Making user-defined copy operators
139139
explicit surfaces the underlying complexity, forcing the developer to opt-in
140140
to potentially expensive operations.
141141

142-
[copy]: http://doc.rust-lang.org/core/kinds/trait.Copy.html
143-
[clone]: http://doc.rust-lang.org/core/clone/trait.Clone.html
142+
[copy]: core/kinds/trait.Copy.html
143+
[clone]: core/clone/trait.Clone.html
144144

145145
## No move constructors
146146

branches/snap-stage3/src/doc/guide-lifetimes.md

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -305,21 +305,17 @@ copying.
305305
# Circle(Point, f64), // origin, radius
306306
# Rectangle(Point, Size) // upper-left, dimensions
307307
# }
308-
# static tau: f64 = 6.28;
309308
fn compute_area(shape: &Shape) -> f64 {
310309
match *shape {
311-
Circle(_, radius) => 0.5 * tau * radius * radius,
310+
Circle(_, radius) => std::f64::consts::PI * radius * radius,
312311
Rectangle(_, ref size) => size.w * size.h
313312
}
314313
}
315314
~~~
316315

317316
The first case matches against circles. Here, the pattern extracts the
318317
radius from the shape variant and the action uses it to compute the
319-
area of the circle. (Like any up-to-date engineer, we use the [tau
320-
circle constant][tau] and not that dreadfully outdated notion of pi).
321-
322-
[tau]: http://www.math.utah.edu/~palais/pi.html
318+
area of the circle.
323319

324320
The second match is more interesting. Here we match against a
325321
rectangle and extract its size: but rather than copy the `size`

branches/snap-stage3/src/doc/guide-macros.md

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,14 @@
11
% The Rust Macros Guide
22

3+
<div class="unstable-feature">
4+
<b>Warning:</b> There are currently various problems with invoking macros, how
5+
they interact with their environment, and how they are used outside of the
6+
location in which they are defined. Macro definitions are likely to change
7+
slightly in the future. For this reason, they are hidden behind the
8+
<code>macro_rules</code> <a href="reference.html#compiler-features">feature
9+
attribute</a>.
10+
</div>
11+
312
# Introduction
413

514
Functions are the primary tool that programmers can use to build abstractions.
@@ -448,6 +457,66 @@ fn main() {
448457
The two `'x` names did not clash, which would have caused the loop
449458
to print "I am never printed" and to run forever.
450459

460+
# Scoping and macro import/export
461+
462+
Macros occupy a single global namespace. The interaction with Rust's system of
463+
modules and crates is somewhat complex.
464+
465+
Definition and expansion of macros both happen in a single depth-first,
466+
lexical-order traversal of a crate's source. So a macro defined at module scope
467+
is visible to any subsequent code in the same module, which includes the body
468+
of any subsequent child `mod` items.
469+
470+
If a module has the `macro_escape` attribute, its macros are also visible in
471+
its parent module after the child's `mod` item. If the parent also has
472+
`macro_escape` then the macros will be visible in the grandparent after the
473+
parent's `mod` item, and so forth.
474+
475+
Independent of `macro_escape`, the `macro_export` attribute controls visibility
476+
between crates. Any `macro_rules!` definition with the `macro_export`
477+
attribute will be visible to other crates that have loaded this crate with
478+
`phase(plugin)`. There is currently no way for the importing crate to control
479+
which macros are imported.
480+
481+
An example:
482+
483+
```rust
484+
# #![feature(macro_rules)]
485+
macro_rules! m1 (() => (()))
486+
487+
// visible here: m1
488+
489+
mod foo {
490+
// visible here: m1
491+
492+
#[macro_export]
493+
macro_rules! m2 (() => (()))
494+
495+
// visible here: m1, m2
496+
}
497+
498+
// visible here: m1
499+
500+
macro_rules! m3 (() => (()))
501+
502+
// visible here: m1, m3
503+
504+
#[macro_escape]
505+
mod bar {
506+
// visible here: m1, m3
507+
508+
macro_rules! m4 (() => (()))
509+
510+
// visible here: m1, m3, m4
511+
}
512+
513+
// visible here: m1, m3, m4
514+
# fn main() { }
515+
```
516+
517+
When this library is loaded with `#[phase(plugin)] extern crate`, only `m2`
518+
will be imported.
519+
451520
# A final note
452521

453522
Macros, as currently implemented, are not for the faint of heart. Even
@@ -457,3 +526,10 @@ tricky. Invoking the `log_syntax!` macro can help elucidate intermediate
457526
states, invoking `trace_macros!(true)` will automatically print those
458527
intermediate states out, and passing the flag `--pretty expanded` as a
459528
command-line argument to the compiler will show the result of expansion.
529+
530+
If Rust's macro system can't do what you need, you may want to write a
531+
[compiler plugin](guide-plugin.html) instead. Compared to `macro_rules!`
532+
macros, this is significantly more work, the interfaces are much less stable,
533+
and the warnings about debugging apply ten-fold. In exchange you get the
534+
flexibility of running arbitrary Rust code within the compiler. Syntax
535+
extension plugins are sometimes called "procedural macros" for this reason.

0 commit comments

Comments
 (0)