Commit Graph

50916 Commits

Author SHA1 Message Date
bors
5b5e521869 Auto merge of #32006 - jseyfried:fix_expanded_mod_path, r=nikomatsakis
This PR changes the search paths for macro-expanded non-inline modules so that they match ordinary non-inline modules (fixes #31624). This is a [breaking-change].

Right now, the search paths for a macro-expanded non-inline module are computed as if the module were declared in the top level of the file in which the macro was defined.
For example, consider `./foo/mod.rs`:
```rust
mod inconsequential { // moving the macro outside this module wouldn't change anything
    macro_rules! mod_decl {
        ($i:ident) => { mod $i; }
    }
}
```
and `./lib.rs`:
```rust
mod foo;

mod bar {
    mod_decl!(baz);
    //^ Now, rustc expects `./foo/baz.rs` (or `./foo/baz/mod.rs`)
    //| After this PR, rustc will expect `./bar/baz.rs` (or `./bar/baz/mod.rs`)
}
```
r? @alexcrichton
2016-03-04 06:55:11 +00:00
bors
8e261d12e3 Auto merge of #31945 - sfackler:net2, r=alexcrichton
I have these tagged as stable in 1.9, so this shouldn't merge until the 1.8 beta's cut.
2016-03-04 04:19:30 +00:00
bors
e91f889ed3 Auto merge of #31671 - ranma42:printcfg, r=alexcrichton
Show `cfg` as possible argument to `--print` and make it so that `--print cfg` also outputs the `target_feature`s.

Should I also extend `src/test/run-make/print-cfg/Makefile` to check that `target_feature`s are actually printed?
2016-03-03 21:37:18 +00:00
bors
809b14acf1 Auto merge of #31797 - apasel422:issue-28950, r=alexcrichton
Closes #28950.

r? @eddyb
2016-03-03 19:52:11 +00:00
Steven Fackler
e4aa513139 Fix netbsd 2016-03-03 09:54:15 -08:00
bors
493d999ffa Auto merge of #32007 - nikomatsakis:compiletest-incremental, r=alexcrichton
This PR extends compiletest to support **test revisions** and with a preliminary **incremental testing harness**. run-pass, compile-fail, and run-fail tests may be tagged with

```
// revisions: a b c d
```

This will cause the test to be re-run four times with `--cfg {a,b,c,d}` in turn. This means you can write very closely related things using `cfg`. You can also configure the headers/expected-errors by writing `//[foo] header: value` or `//[foo]~ ERROR bar`, where `foo` is the name of your revision. See the changes to `coherence-cow.rs` as a proof of concept.

The main point of this work is to support the incremental testing harness. This PR contains an initial, unused version. The code that uses it will land later. The incremental testing harness compiles each revision in turn, and requires that the revisions have particular names (e.g., `rpass2`, `cfail3`), which tell it whether a particular revision is expected to compile or not.

Two questions:

- Is there compiletest documentation anywhere I can update?
- Should I hold off on landing the incremental testing harness until I have the code to exercise it? (That will come in a separate PR, still fixing a few details)

r? @alexcrichton
cc @rust-lang/compiler <-- new testing capabilities
2016-03-03 17:41:13 +00:00
Steven Fackler
ee62aab2ed Fix android build 2016-03-03 08:19:30 -08:00
Niko Matsakis
fc4d0ecf20 mention caveat about should-fail in docs 2016-03-03 11:18:42 -05:00
Niko Matsakis
aa19b41f25 make pretty printer tests understand revisions, and make them ignore the
should-fail annotation
2016-03-03 11:17:32 -05:00
bors
f6e125f04a Auto merge of #31979 - jseyfried:rename_ctxt, r=eddyb
r? @eddyb
2016-03-03 10:22:41 +00:00
Niko Matsakis
9601e6f252 Do not assert revisions list is empty for pretty printing tests 2016-03-03 04:17:39 -05:00
Andrea Canciani
4e46eee110 Hide gated cfg attributes from the output of --print cfg
Gated cfg attributes are not available on the stable and beta release
channels, therefore they should not be presented to users of those
channels in order to avoid confusion.
2016-03-03 10:06:09 +01:00
bors
4aa913cd23 Auto merge of #32012 - bluss:more-drop-in-place, r=alexcrichton
Use `drop_in_place` in Vec and VecDeque

We can use drop_in_place's DST capabilities directly in Vec::drop and similarly in VecDeque::drop. I verfied this has the same effect as the previous `needs_drop` code; `drop_in_place` it itself an intrinsic.

The VecDeque replacement should be more efficient too, even in release mode (slice iteration makes a more efficient loop than the deque iterator).
2016-03-03 08:35:51 +00:00
Jeffrey Seyfried
37ba66a66e Rename middle::ty::ctxt to TyCtxt 2016-03-03 07:37:56 +00:00
Steven Fackler
631fa2b8c0 Fix comments and OSX build 2016-03-02 22:05:14 -08:00
bors
7cee8b9ffb Auto merge of #31824 - jseyfried:privacy_in_resolve, r=nikomatsakis
This PR privacy checks paths as they are resolved instead of in `librustc_privacy` (fixes #12334 and fixes #31779). This removes the need for the `LastPrivate` system introduced in PR #9735, the limitations of which cause #31779.

This PR also reports privacy violations in paths to intra- and inter-crate items the same way -- it always reports the first inaccessible segment of the path.

Since it fixes #31779, this is a [breaking-change]. For example, the following code would break:
```rust
mod foo {
    pub use foo::bar::S;
    mod bar { // `bar` should be private to `foo`
        pub struct S;
    }
}

impl foo::S {
    fn f() {}
}

fn main() {
    foo::bar::S::f(); // This is now a privacy error
}
```

r? @alexcrichton
2016-03-03 02:21:28 +00:00
Jeffrey Seyfried
e2aa90e780 Add test 2016-03-02 23:50:19 +00:00
Jeffrey Seyfried
472fcb5973 Fix the search paths for macro-expanded non-inline modules 2016-03-02 23:50:19 +00:00
Jeffrey Seyfried
cccc0880d9 Add filename to Parser 2016-03-02 23:50:13 +00:00
bors
7b0b80ae21 Auto merge of #32005 - vegai:31686, r=Manishearth
Fix note for type alias in trait position

Fixes #31686
2016-03-02 22:15:51 +00:00
Andrea Canciani
c984cbd939 Build the same configuration when compiling and for --print cfg
The configuration returned by `config::build_configuration` needs to
be modified with `target_features::add_configuration` in order to also
contain the target features. This is already done for the
configuration used when compiling and when creating the documentation,
but was missing in the `cfg` printing code.
2016-03-02 22:07:03 +01:00
Andrea Canciani
01daf90d5d Add usage documentation for --print cfg
The `--print` flag was extended in #31278 to accept `cfg`, but the
usage message was not updated.
2016-03-02 21:58:59 +01:00
vegai
01a6e8653b Type defined here note added to test 2016-03-02 22:29:54 +02:00
Niko Matsakis
fff9c2b6db add a run-fail meta test 2016-03-02 14:26:28 -05:00
Niko Matsakis
ad3ed80503 rename should-panic to should-fail, per acrichto's suggestion 2016-03-02 14:26:28 -05:00
Niko Matsakis
0d6b4e0386 make it possible for a test to declare should-panic
and write a really basic "meta test" of the compilertest framework
2016-03-02 14:26:27 -05:00
Niko Matsakis
1d76ccd9d4 Update COMPILER_TESTS.md documentation to discuss revisions 2016-03-02 14:26:03 -05:00
bors
b9e61c9f40 Auto merge of #31996 - gandro:update-libc, r=alexcrichton
This fixes the `x86_64-rumprun-netbsd` target.

r? @alexcrichton
2016-03-02 17:41:00 +00:00
vegai
86357c37d2 Fix test to reflect new note 2016-03-02 19:27:56 +02:00
Ulrik Sverdrup
7ceafaee4f Use ptr::drop_in_place in VecDeque::drop
Just like for Vec. This should benefit both non-optimized and optimized
performance. Non-optimized since the intrinsic drop_in_place is easily
removed, and optimized because iterating the slices is more efficient
than using the VecDeque iterators.
2016-03-02 18:05:41 +01:00
Ulrik Sverdrup
1da364e98f Use ptr::drop_in_place in Vec::truncate 2016-03-02 18:05:40 +01:00
Ulrik Sverdrup
c0f8b08594 Use ptr::drop_in_place in Vec::drop
Directly use the drop glue for [T]. Still optimizes out in -O1 like with
the `needs_drop` intrinsic.
2016-03-02 18:05:40 +01:00
bors
675723e243 Auto merge of #32000 - xaocon:master, r=steveklabnik
Vectors come up in sections dedicated to ownership with the assumption that we know something about it but we haven't seen it yet. On the other hand, you need not know anything about ownership or lifetimes to understand the basics of vectors covered in the vector section of the book. Additionally, by moving it where it is there is a natural progression from loops to an iterative type which discusses for loops. This kind of interaction is generally better for learning.

I would like to have moved the struct section as well but I'm less confident about how to handle it since the ownership sections discuss structs and the structs section talks about mutable borrow.
2016-03-02 14:35:33 +00:00
Niko Matsakis
3fb80e33a8 thread revision identifier around in test output 2016-03-02 05:16:26 -05:00
Niko Matsakis
4cffa9b4e3 convert coherence-cow to use revisions 2016-03-02 05:16:26 -05:00
Niko Matsakis
c5bdc35b60 refactor and generalize revisions 2016-03-02 05:02:04 -05:00
bors
25e42ac106 Auto merge of #31937 - petrochenkov:field, r=eddyb
The names are "0", "1", "2" etc, the same as used in field access.

This generally make things simpler and potentially allows to reuse braced struct machinery (struct patterns, struct expressions) for tuple structs.

I haven't touched the AST for stability reasons, but I intend to do it later.

r? @eddyb
2016-03-02 08:42:38 +00:00
Vadim Petrochenkov
bc93fbc32f Add test (fixes #27340) 2016-03-02 10:32:04 +03:00
Vadim Petrochenkov
9047b201bf Move span into StructField
+ some cleanup in rustdoc
2016-03-02 10:32:04 +03:00
Vadim Petrochenkov
8b026a6e48 Use numeric field Names ("0", "1" etc) for positional fields 2016-03-02 10:31:19 +03:00
Vadim Petrochenkov
8b60b948d9 Get rid of hir::StructFieldKind 2016-03-02 10:31:19 +03:00
vegai
bd7e422996 Add a span note on type definition spot 2016-03-02 07:06:22 +02:00
bors
0400d929e8 Auto merge of #32001 - Manishearth:rollup, r=Manishearth
- Successful merges: #31919, #31982, #31985, #31989, #31999
- Failed merges:
2016-03-02 02:40:07 +00:00
Niko Matsakis
bb2a425d58 introduce the notion of revisions, currently unused
a test file may specify `// revisions: foo bar baz`

headers and expected errors may be made specific to a revision
by writing `//[foo] header` or `//[foo]~ ERROR`
2016-03-01 21:10:36 -05:00
Niko Matsakis
d78b4a9350 change compile_flags to eagerly split into a vector on whitespace 2016-03-01 21:09:36 -05:00
Manish Goregaokar
b515bb3b6b Rollup merge of #31999 - bluss:fundamental-raw-ptr, r=eddyb
Use raw pointer casts for slice, str's .as_ptr()

We can now use raw pointer casts `*const [T] as *const T` and
`*const str as *const u8` instead of .repr() for getting the
pointer out of a slice.
2016-03-02 07:01:16 +05:30
Manish Goregaokar
fe565954ea Rollup merge of #31989 - Kimundi:more_flexible_str_pattern_indirection, r=bluss
This allows a bit more flexibility in how to use it, see the included test case.
2016-03-02 07:01:15 +05:30
Manish Goregaokar
3f7867c21f Rollup merge of #31985 - ashleysommer:libbackgrace_emscripten_fix, r=alexcrichton
Was getting error:
```
running: "sh" "/home/flubba86/rust/src/libstd/../libbacktrace/configure" "--with-pic" "--disable-multilib" "--disable-shared" "--disable-host-shared" "--host=asmjs-unknown-emscripten" "--build=x86_64-unknown-linux-gnu"
...
Invalid configuration `asmjs-unknown-emscripten': system `emscripten' not recognized
```
This commit adds the emscripten target to the libbacktrace configure script so it is no longer unrecognized.
2016-03-02 07:01:15 +05:30
Manish Goregaokar
4ed3826f27 Rollup merge of #31982 - apasel422:sync, r=alexcrichton
These types were already `!Sync`, but this improves error messages when they are used in contexts that require `Sync`, aligning them with conventions used with `Rc`, among others.

r? @alexcrichton
2016-03-02 07:01:15 +05:30
Manish Goregaokar
9d4422e1fc Rollup merge of #31919 - petrochenkov:blockpub, r=nikomatsakis
Closes https://github.com/rust-lang/rust/issues/31776

r? @nikomatsakis
2016-03-02 07:01:15 +05:30