Commit Graph

49735 Commits

Author SHA1 Message Date
Eduard Burtescu
93c32b55e2 trans: split trans_consume off from trans_operand. 2016-06-20 23:18:21 +03:00
Steven Allen
03d86ba2f5 Add regression test for #23281
Closes #23281
2016-06-20 14:23:43 -04:00
Guillaume Gomez
ddfaf10f6b Add error code flag 2016-06-20 19:38:26 +02:00
Jeffrey Seyfried
9a6864dcd2 Add more hygiene tests 2016-06-20 12:13:59 +00:00
Jeffrey Seyfried
d19ee0dcc0 Add regression test 2016-06-20 12:13:59 +00:00
Jeffrey Seyfried
a93455eb5d Remove unit tests 2016-06-20 12:13:57 +00:00
Jeffrey Seyfried
d7fa72abe2 Fix hygiene regression 2016-06-20 11:27:54 +00:00
Seo Sanghyeon
9d03128f58 Run debuginfo tests on Travis 2016-06-20 19:31:07 +09:00
bors
5522e678bc Auto merge of #33950 - srinivasreddy:rtstartup_rustfmt, r=Manishearth
run rustfmt on rtstartup folder
2016-06-20 02:32:07 -07:00
Liigo Zhuang
7f4b75e173 diagnostics comes from different places now 2016-06-20 16:05:30 +08:00
bors
25f349db3e Auto merge of #34348 - dsprenkels:issue-34194-test, r=alexcrichton
Add regression test for #34194

This pull request adds a regression test for #34194.

Closes #34194.
2016-06-19 22:18:52 -07:00
Oliver Middleton
b8bddb00bd rustdoc: Add more types to the sidebar
They're displayed in the same order as they are on modules pages.
2016-06-19 23:19:57 +01:00
Corey Farwell
d5a27594a3 Add examples for std:🧵:Thread::name. 2016-06-19 17:55:57 -04:00
Alexander Stocko
e79b672a88 Fixed links in book/compiler-plugins.md 2016-06-19 16:11:43 -04:00
bors
8d8a88f4a5 Auto merge of #34335 - ollie27:docs_collections_mods, r=GuillaumeGomez
Add short summaries to btree modules

Also improve hash_map and hash_set module short summaries.

These are missing from [here](https://doc.rust-lang.org/nightly/std/collections/#modules).

r? @steveklabnik
2016-06-19 12:56:13 -07:00
Daan Sprenkels
223cd21023 doc: std::ops md formatting fix 2016-06-19 14:25:15 +02:00
Aleksey Kladov
677aa47d68 Document CStr::as_ptr dangers. 2016-06-19 15:14:51 +03:00
bors
d06f1dcd7d Auto merge of #34313 - frewsxcv:panicking-example, r=steveklabnik
Add example in docs for `std:🧵:panicking`.

None
2016-06-19 02:24:15 -07:00
bors
3313e50594 Auto merge of #34351 - Stebalien:issue-22434, r=sfackler
Add test case for #22434

Closes #22434
2016-06-18 23:18:14 -07:00
bors
b1ae194fa6 Auto merge of #34295 - jseyfried:cfg_decoration, r=eddyb
Perform `cfg` attribute processing on decorator-generated items

Fixes https://users.rust-lang.org/t/unused-attribute-warning-for-custom-derive-attribute/6180.
r? @nrc
2016-06-18 20:12:09 -07:00
bors
9a68124737 Auto merge of #34350 - Stebalien:test-30276, r=eddyb
Add test case for #30276

Make sure that treating a DST tuple constructor as a function doesn't ICE.

Closes #30276
2016-06-18 17:07:15 -07:00
Jeffrey Seyfried
5033eca65f Generalize and abstract ThinAttributes 2016-06-19 00:01:55 +00:00
Steven Allen
7c452b1f0a Add test case for #22434
Closes #22434
2016-06-18 18:43:44 -04:00
Steven Allen
0e55c04940 Add test case for #30276
Make sure that treating a DST tuple constructor as a function doesn't ICE.

Closes #30276
2016-06-18 18:29:52 -04:00
bors
35784cbe0d Auto merge of #34310 - erickt:tuple-struct-attrs, r=nrc
Pretty-print attributes on tuple structs and add tests

This adds support to the pretty printer to print attributes added to tuple struct elements.  Furthermore, it adds a test that makes sure we will print attributes on all variant data types.
2016-06-18 14:02:32 -07:00
Daan Sprenkels
317ed84184 Add regression test for #34194 2016-06-18 20:05:44 +02:00
bors
11d4708f3a Auto merge of #34342 - GuillaumeGomez:E0406, r=eddyb
Removed unused E0406 and unused functions

Fixes #34301.

It removes the unused E0406 and also unused functions.

cc @eddyb
2016-06-18 10:58:25 -07:00
Guillaume Gomez
8637b4b034 Remove unused functions calls and unused E0406 2016-06-18 17:02:41 +02:00
bors
f4d03da825 Auto merge of #34336 - petrochenkov:icemctuple, r=arielb1
Fix ICE in memory categorization of tuple patterns

Fixes https://github.com/rust-lang/rust/issues/34334

It seems to be ok for `pat_ty` to return `Err` even if type checking is done, because it uses `infcx.node_ty` which is supposed to return `Err` for all kinds of erroneous types so its callers could quickly bail out with `?`.

r? @arielb1
2016-06-18 07:20:12 -07:00
bors
8545424b96 Auto merge of #34314 - tshepang:misnamed, r=steveklabnik
doc: fix mis-named binding & remove not needed `mut`
2016-06-18 01:58:28 -07:00
Vadim Petrochenkov
8c0fef80d7 Fix ICE in memory categorization of tuple patterns 2016-06-18 03:15:07 +03:00
Oliver Middleton
fdeda33a9a Add short summaries to btree modules
Also improve hash_map and hash_set module short summaries.
2016-06-17 23:50:34 +01:00
bors
646015cae4 Auto merge of #34323 - GuillaumeGomez:unreachable_not_unreachable, r=pnkfelix
Fix panic when using debug in rustc

When I was using `println!("{:?}")` [here](https://github.com/rust-lang/rust/blob/master/src/librustc_resolve/lib.rs#L1610) and [here](https://github.com/rust-lang/rust/blob/master/src/librustc_typeck/collect.rs#L836), I was able to get into this `unreachache`.
2016-06-17 15:33:00 -07:00
Corey Farwell
9944b223a2 Add example in docs for std:🧵:panicking. 2016-06-18 00:17:36 +02:00
bors
1f9423a87a Auto merge of #34292 - ollie27:rustdoc_depr_impl, r=GuillaumeGomez
rustdoc: Add stability notices to impl items

Also fixes missing stability notices on methods with no docs.

For example [`f64::is_positive`](https://doc.rust-lang.org/nightly/std/primitive.f64.html#method.is_positive) is missing its deprecation message.
2016-06-17 11:12:00 -07:00
吴冉波
d0a0befb54 Traits where syntax's extra usage example more clearly
r? @steveklabnik
2016-06-17 22:54:06 +08:00
bors
c8eff682fd Auto merge of #33090 - bluss:special-zip-2, r=aturon
Specialize .zip() for efficient slice and slice iteration

The idea is to introduce a private trait TrustedRandomAccess and specialize .zip() for random access iterators into a counted loop.

The implementation in the PR is internal and has no visible effect in the API

Why a counted loop? To have each slice iterator compile to just a pointer, and both pointers are indexed with the same loop counter value in the generated code. When this succeeds, copying loops are readily recognized and replaced with memcpy and addition loops autovectorize well.

The TrustedRandomAccess approach works very well on the surface. Microbenchmarks optimize well, following the ideas above, and that is a dramatic improvement of .zip()'s codegen.

```rust
// old zip before this PR: bad, byte-for-byte loop
// with specialized zip: memcpy
pub fn copy_zip(xs: &[u8], ys: &mut [u8]) {
    for (a, b) in ys.iter_mut().zip(xs) {
        *a = *b;
    }
}

// old zip before this PR: single addition per iteration
// with specialized zip: vectorized
pub fn add_zip(xs: &[f32], ys: &mut [f32]) {
    for (a, b) in ys.iter_mut().zip(xs) { *a += *b; }
}

// old zip before this PR: single addition per iteration
// with specialized zip: vectorized (!!)
pub fn add_zip3(xs: &[f32], ys: &[f32], zs: &mut [f32]) {
    for ((a, b), c) in zs.iter_mut().zip(xs).zip(ys) { *a += *b * *c; }
}
```

Yet in more complex situations, the .zip() loop can still fall back to its old behavior where phantom null checks throw in fake premature end of the loop conditionals. Remember that a NULL inside
Option<(&T, &T)> makes it a `None` value and a premature (in this case)
end of the loop.

So even if we have 1) an explicit `Some` in the code and 2) the types of the pointers are `&T` or `&mut T` which are nonnull, we can still get a phantom null check at that point.

One example that illustrates the difference is `copy_zip` with slice versus Vec arguments. The involved iterator types are exactly the same, but the Vec version doesn't compile down to memcpy. Investigating into this, the function argument metadata emitted to llvm plays the biggest role. As eddyb summarized, we need nonnull for the loop to autovectorize and noalias for it to replace with memcpy.

There was an experiment to use `assume` to add a non-null assumption on each of the two elements in the specialized zip iterator, but this only helped in some of the test cases and regressed others. Instead I think the nonnull/noalias metadata issue is something we need to solve separately anyway.

These have conditionally implemented TrustedRandomAccess

- Enumerate
- Zip

These have not implemented it

- Map is sideeffectful. The forward case would be workable, but the double ended case is complicated.
- Chain, exact length semantics unclear
- Filter, FilterMap, FlatMap and many others don't offer random access and/or exact length
2016-06-17 03:36:32 -07:00
Guillaume Gomez
9ac3d9b63c Fix panic when using debug 2016-06-17 12:33:55 +02:00
Erick Tryzelaar
9de2de1d21 Pretty-print attributes on tuple structs and add tests
This adds support to the pretty printer to print attributes
added to tuple struct elements.  Furthermore, it adds a test
that makes sure we will print attributes on all variant data
types.
2016-06-17 10:05:19 +01:00
Jeffrey Seyfried
f0b21c2d1e Rename ast::ExprKind::Again -> ast::ExprKind::Continue 2016-06-17 05:21:25 +00:00
Jeffrey Seyfried
962d5c16b5 Fix fallout 2016-06-17 05:21:23 +00:00
Jeffrey Seyfried
b5dbe01a2c Refactor away ast::Decl and refactor ast::Stmt 2016-06-17 05:04:40 +00:00
bors
be203ac258 Auto merge of #34306 - arielb1:mir-dump-fixes, r=eddyb
Fixes for `-Z dump-mir`

Do not overwrite the parent MIR when dumping promoted MIR.

r? @eddyb
2016-06-16 21:57:06 -07:00
bors
114be1e9f0 Auto merge of #34315 - Manishearth:rollup, r=Manishearth
Rollup of 4 pull requests

- Successful merges: #34298, #34302, #34307, #34312
- Failed merges:
2016-06-16 19:07:41 -07:00
Manish Goregaokar
019c594c6a Rollup merge of #34312 - erickt:add-try, r=nikomatsakis
Revert using ? for try! in the libsyntax pretty printer

The use of ...?instead of try!(...) in libsyntax makes extracting libsyntax into syntex quite painful since it's not stable yet. This makes backports take a much longer time and causes a lot of problems for the syntex dependencies. Even if it was, it'd take a few release cycles until syntex would be able to use it. Since it's not stable and that this feature is just syntax sugar, it would be most helpful if we could remove it.

cc #34311
2016-06-17 00:12:04 +01:00
Manish Goregaokar
5bac0c3985 Rollup merge of #34307 - nagisa:more-cache, r=arielb1
[MIR] Cache drops for early scope exits

Previously we would rebuild all drops on every early exit from a scope, which for code like:

```rust
match x {
    A => return 1,
    B => return 2,
    ...
    C => return 27
}
```

would produce 27 exactly same chains of drops for each return, basically a `O(n*m)` explosion. [This](https://cloud.githubusercontent.com/assets/679122/16125192/3355e32c-33fb-11e6-8564-c37cab2477a0.png) is such a case for a match on 80-variant enum with 3 droppable variables in scope.

For [`::core::iter::Iterator::partial_cmp`](6edea2cfda/src/libcore/iter/iterator.rs (L1909)) the CFG looked like [this](https://cloud.githubusercontent.com/assets/679122/16122708/ce0024d8-33f0-11e6-93c2-e1c44b910db2.png) (after initial SimplifyCfg). With this patch the CFG looks like [this](https://cloud.githubusercontent.com/assets/679122/16122806/294fb16e-33f1-11e6-95f6-16c5438231af.png) instead.

Some numbers (overall very small wins, however neither of the crates have many cases which abuse this corner case):

|                         | old time | old rss | new time | new rss  |
|-------------------------|----------|---------|----------|----------|
| core dump               | 0.879        |   224MB     |   0.871  |  223MB   |
| core MIR passes         | 0.759        | 224MB       | 0.718    | 223MB    |
| core MIR codegen passes | 1.762        | 230MB       | 1.442    | 228MB    |
| core trans              | 3.263        | 279MB       | 3.116    | 278MB    |
| core llvm passes        | 5.611        | 263MB       | 5.565    | 263MB    |
| std dump                | 0.487        |   190MB     |   0.475  |  192MB   |
| std MIR passes          | 0.311       | 190MB       | 0.288    | 192MB    |
| std MIR codegen passes  | 0.753        | 195MB       | 0.720    | 197MB    |
| std trans               | 2.589        | 287MB       | 2.523    | 287MB    |
| std llvm passes         | 7.268        | 245MB       | 7.447    | 246MB    |
2016-06-17 00:12:04 +01:00
Manish Goregaokar
51b20bcbf4 Rollup merge of #34302 - retep998:🐇-sanity-is-overrated-🐇, r=alexcrichton
Fix issue where rustbuild expected msvc to have ar

I made `cc2ar` return an `Option`.

r? @alexcrichton
2016-06-17 00:12:04 +01:00
Manish Goregaokar
986bb53a7b Rollup merge of #34298 - nrc:save-parent, r=eddyb
save-analysis: some tweaks
2016-06-17 00:12:04 +01:00
bors
f911d87b3b Auto merge of #34272 - jseyfried:simplify_gated_cfg_checking, r=nrc
Simplify gated cfg checking

r? @nrc
2016-06-16 16:09:45 -07:00
Tshepang Lekhonkhobe
1253e82b7f doc: fix mis-named binding & remove not needed mut 2016-06-16 23:20:58 +02:00
Simonas Kazlauskas
04d63ccf5a Cache drops for early scope exits
Previously we would rebuild all drops on every early exit from a scope, which for code like:

```rust
match x {
    a => return 1,
    b => return 2,
    ...
    z => return 27
}
```

would produce 27 exactly same chains of drops for each return, a O(n*m) explosion in drops.
2016-06-17 00:00:44 +03:00
Erick Tryzelaar
ba5cab1fe0 Revert using ? for try! in the libsyntax pretty printer
The use of ...?instead of try!(...) in libsyntax makes
extracting libsyntax into syntex quite painful since it's
not stable yet. This makes backports take a much longer time
and causes a lot of problems for the syntex dependencies. Even
if it was, it'd take a few release cycles until syntex would
be able to use it. Since it's not stable and that this feature
is just syntax sugar, it would be most helpful if we could remove
it.

cc #34311
2016-06-16 21:16:55 +01:00
Jeffrey Seyfried
2cd6ccf0b1 Simplify gated cfg checking 2016-06-16 19:24:44 +00:00
bors
18f28719ef Auto merge of #34187 - luser:extern-crate-abspaths, r=michaelwoerister
Add an abs_path member to FileMap, use it when writing debug info.

Fixes #34179.

When items are inlined from extern crates, the filename in the debug info
is taken from the FileMap that's serialized in the rlib metadata.
Currently this is just FileMap.name, which is whatever path is passed to rustc.
Since libcore and libstd are built by invoking rustc with relative paths,
they wind up with relative paths in the rlib, and when linked into a binary
the debug info uses relative paths for the names, but since the compilation
directory for the final binary, tools trying to read source filenames
will wind up with bad paths. We noticed this in Firefox with source
filenames from libcore/libstd having bad paths.

This change stores an absolute path in FileMap.abs_path, and uses that
if available for writing debug info. This is not going to magically make
debuggers able to find the source, but it will at least provide sensible
paths.
2016-06-16 12:13:25 -07:00
Ted Mielczarek
24e7491660 Add an abs_path member to FileMap, use it when writing debug info.
When items are inlined from extern crates, the filename in the debug info
is taken from the FileMap that's serialized in the rlib metadata.
Currently this is just FileMap.name, which is whatever path is passed to rustc.
Since libcore and libstd are built by invoking rustc with relative paths,
they wind up with relative paths in the rlib, and when linked into a binary
the debug info uses relative paths for the names, but since the compilation
directory for the final binary, tools trying to read source filenames
will wind up with bad paths. We noticed this in Firefox with source
filenames from libcore/libstd having bad paths.

This change stores an absolute path in FileMap.abs_path, and uses that
if available for writing debug info. This is not going to magically make
debuggers able to find the source, but it will at least provide sensible
paths.
2016-06-16 18:08:46 +01:00
bors
12b6345bc2 Auto merge of #34296 - dsprenkels:issue-23122-tests, r=alexcrichton
Add regression tests for #23122

This PR adds two regression tests for #23122.

Closes #23122.
2016-06-16 09:26:36 -07:00
Ariel Ben-Yehuda
a6d694ea00 fix MirSource::Promoted handling 2016-06-16 17:30:09 +03:00
Ariel Ben-Yehuda
5da8bf8402 stop having 'static in dump-mir names 2016-06-16 16:54:20 +03:00
Ariel Ben-Yehuda
63cdd7ab50 use a different filename for original and promoted MIRs 2016-06-16 16:54:20 +03:00
bors
7aba683c76 Auto merge of #34239 - jseyfried:fix_macro_use_scope_regression, r=nrc
Revert a change in the scope of macros imported from crates to fix a regression

Fixes #34212.
The regression was caused by #34032, which changed the scope of macros imported from extern crates to match the scope of macros imported from modules.
r? @nrc
2016-06-16 06:37:18 -07:00
Peter Atashian
e0992df35f
Fix issue where rustbuild expected msvc to have ar
Signed-off-by: Peter Atashian <retep998@gmail.com>
2016-06-16 08:38:06 -04:00
bors
6edea2cfda Auto merge of #34216 - jseyfried:nested_cfg_attr, r=nrc
Support nested `cfg_attr` attributes

Support arbitrarily deeply nested `cfg_attr` attributes (e.g. `#[cfg_attr(foo, cfg_attr(bar, baz))]`).
This makes configuration idempotent.

Currently, the nighties do not support any `cfg_attr` nesting. Stable and beta support just one level of `cfg_attr` nesting (expect for attributes on macro-expanded nodes, where no nesting is supported).

This is a [breaking-change]. For example, the following would break:
```rust
macro_rules! m { () => {
    #[cfg_attr(all(), cfg_attr(all(), cfg(foo)))]
    fn f() {}
} }
m!();

fn main() { f() } //~ ERROR unresolved name `f`
```
r? @nrc
2016-06-16 03:49:55 -07:00
Nick Cameron
a835d7487c save-analysis: add a decl_id for methods
This is non-null if the method is in a (non-inherent) impl and in that case will be the id for the method declaration in the implemented trait.
2016-06-16 11:28:39 +01:00
bors
a479a6a7a6 Auto merge of #34290 - arielb1:short-ladder, r=eddyb
don't generate drop ladder steps for fields that don't need dropping

cc @eddyb

This should help with #34166
2016-06-16 01:01:26 -07:00
Jeffrey Seyfried
c41cf30e9d Strip unconfigured nodes from decorator-generated AST 2016-06-16 07:58:43 +00:00
Daan Sprenkels
7ee3eaa79c Add regression tests for #23122 2016-06-16 09:46:25 +02:00
Jeffrey Seyfried
83d283b67b Avoid expanding decorator-generated items twice 2016-06-16 06:44:38 +00:00
Ariel Ben-Yehuda
68129a682a fix codegen-units fallout 2016-06-16 09:26:44 +03:00
bors
7339eca0cc Auto merge of #34000 - estebank:missingargs, r=jseyfried
Show types of all args when missing args

When there're missing arguments in a function call, present a list of
all the expected types:

```rust
fn main() {
    t("");
}

fn t(a: &str, x: String) {}
```

```bash
% rustc file.rs
file.rs:3:5: 2:8 error: this function takes 2 parameters but 0
parameters were supplied [E0061]
file.rs:3     t();
              ^~~
file.rs:3:5: 2:8 help: run `rustc --explain E0061` to see a detailed explanation
file.rs:3:5: 2:8 note: the following parameter types were expected: &str, std::string::String
error: aborting due to previous error
```

Fixes #33649
2016-06-15 22:12:26 -07:00
Jeffrey Seyfried
58372af058 Add test for MultiItemModifiers that add items 2016-06-16 03:55:57 +00:00
Jeffrey Seyfried
ac1a1d32f6 Allow MultiItemModifiers to expand into zero or many items 2016-06-16 03:55:55 +00:00
Jeffrey Seyfried
34191ed1c8 Refactor MultiModifier expansion 2016-06-16 03:55:53 +00:00
Jeffrey Seyfried
6ba7b7c22d Implement HasAttrs for Annotatable 2016-06-16 03:55:52 +00:00
Esteban Küber
1020e3036b Show types of all args when missing args
When there're missing arguments in a function call, present a list of
all the expected types:

```rust
fn main() {
    t("");
}

fn t(a: &str, x: String) {}
```

```bash
% rustc file.rs
file.rs:3:5: 2:8 error: this function takes 2 parameters but 0
parameters were supplied [E0061]
file.rs:3     t();
              ^~~
file.rs:3:5: 2:8 help: run `rustc --explain E0061` to see a detailed explanation
file.rs:3:5: 2:8 note: the following parameter types were expected: &str, std::string::String
error: aborting due to previous error
```

Fixes #33649
2016-06-15 18:40:11 -07:00
Manish Goregaokar
e3d6bb1f71 Rollup merge of #34270 - gkoz:error_file_exists, r=alexcrichton
Add ERROR_FILE_EXISTS to ErrorKind conversion on Windows

Bug report: https://users.rust-lang.org/t/detecting-error-kind-for-opening-file/6215
Reference: https://msdn.microsoft.com/en-us/library/windows/desktop/ms681382(v=vs.85).aspx#error_file_exists
2016-06-16 01:39:44 +01:00
Manish Goregaokar
2675a55a8f Rollup merge of #34268 - zackmdavis:if_let_over_none_unit_arm, r=jseyfried
prefer `if let` to match with `None => ()` arm in some places

Casual grepping revealed some places in the codebase (some of which
antedated `if let`'s December 2014 stabilization in c200ae5a) where we
were using a match with a `None => ()` arm where (in the present
author's opinion) an `if let` conditional would be more readable. (Other
places where matching to the unit value did seem to better express the
intent were left alone.)

It's likely that we don't care about making such trivial,
non-functional, sheerly æsthetic changes.

But if we do, this is a patch.
2016-06-16 01:39:44 +01:00
Manish Goregaokar
d84993b054 Rollup merge of #34207 - petrochenkov:nohyg, r=jseyfried
Remove last traces of identifier hygiene from HIR

e783a0a5e3 removed the [last](https://github.com/rust-lang/rust/pull/33654#discussion_r63415218) [use](https://github.com/rust-lang/rust/pull/33654#discussion_r63416284) of hygiene at post-resolve compilation stages, so we can avoid renaming during lowering to HIR and just keep original names.

r? @nrc
2016-06-16 01:39:43 +01:00
Oliver Middleton
195fc5a325 rustdoc: Add stability notices to impl items
Also fixes missing stability notices on methods with no docs.
2016-06-15 23:56:24 +01:00
Ariel Ben-Yehuda
2960bc8246 don't generate drop ladder steps for fields that don't need dropping 2016-06-16 00:48:02 +03:00
Alex Burka
b54afbee1f include list of characters 2016-06-15 16:42:36 -04:00
Alex Burka
523dbfc312 update reference for #29734 2016-06-15 16:35:03 -04:00
bors
bb4a79b087 Auto merge of #34220 - srinivasreddy:rf_cargotest, r=brson
run rustfmt on cargotest folder in src/tools/cargotest
2016-06-15 13:11:19 -07:00
bors
5755936a63 Auto merge of #34218 - srinivasreddy:rf_linkchecker, r=brson
run rustfmt on linkchecker folderin src/tools/linkchecker
2016-06-15 10:28:30 -07:00
Zack M. Davis
8531d58104 prefer if let to match with None => () arm in some places
Casual grepping revealed some places in the codebase (some of which
antedated `if let`'s December 2014 stabilization in c200ae5a) where we
were using a match with a `None => ()` arm where (in the present
author's opinion) an `if let` conditional would be more readable. (Other
places where matching to the unit value did seem to better express the
intent were left alone.)

It's likely that we don't care about making such trivial,
non-functional, sheerly æsthetic changes.

But if we do, this is a patch.
2016-06-15 08:13:10 -07:00
bors
9b06d2ad33 Auto merge of #33300 - seanmonstar:map-entry-take, r=alexcrichton
Map::Entry methods to recover key and value together

See https://github.com/rust-lang/rust/issues/32281#issuecomment-213066344
2016-06-15 07:37:27 -07:00
Sean McArthur
217a964027 Map::Entry::take() method to recover key and value together 2016-06-15 05:45:50 -07:00
bors
a94881563c Auto merge of #34180 - durka:patch-24, r=brson
derive Hash (and not Copy) for ranges

Fixes #34170.

Also, `RangeInclusive` was `Copy` by mistake -- fix that, which is a [breaking-change] to that unstable type.
2016-06-15 04:48:29 -07:00
Gleb Kozyrev
552afd30d0 Fix a docs typo 2016-06-15 13:06:48 +03:00
Gleb Kozyrev
1db97575cc Test ErrorKind::AlreadyExists for files 2016-06-15 13:05:43 +03:00
bors
c5f3706c0d Auto merge of #34263 - ollie27:docs_ip, r=alexcrichton
Improve IP reserved address docs

- Add links to all RFCs to make it clear these are not Rust RFCs.
- Correct RFC numbers to match the numbers in [RFC 6890](https://tools.ietf.org/html/rfc6890)
- Clean up formatting to show addresses and ranges in parentheses like (255.255.255.255)

r? @steveklabnik
2016-06-14 20:36:31 -07:00
bors
1a942f60f0 Auto merge of #34245 - ollie27:rustdoc_redirect_rename, r=alexcrichton
rustdoc: Fix redirect pages for renamed reexports

We need to use the name of the target not the name of the current item
when creating the link.

An example in `std` is [`std::sys::ext`](https://doc.rust-lang.org/nightly/std/sys/ext/index.html).
2016-06-14 17:11:05 -07:00
bors
6b4511755c Auto merge of #34221 - srinivasreddy:rm_redundant, r=alexcrichton
remove redundant test case in bitvector.rs

`bitvec_iter_works_2` does exactly same as `bitvec_iter_works_1`, so i removed it.
2016-06-14 13:42:28 -07:00
bors
be8bd82268 Auto merge of #34234 - GuillaumeGomez:bad_inlining, r=steveklabnik
Fix invalid inlining

r? @steveklabnik

So to put a context. @nox found an issue on the generated doc:

![screenshot from 2016-06-11 19-53-38](https://cloud.githubusercontent.com/assets/3050060/15987898/f7341de0-303b-11e6-9cd7-f2a6df423ee7.png)

So as you can see, the two variants are on the same where they shouldn't. I found out that the issue is also on structs:

![screenshot from 2016-06-11 19-53-31](https://cloud.githubusercontent.com/assets/3050060/15987900/0f66c5de-303c-11e6-90fc-5e49d11b6903.png)

And so such is the result of the PR:

![screenshot from 2016-06-12 01-15-21](https://cloud.githubusercontent.com/assets/3050060/15987904/19d9183c-303c-11e6-91c1-7c3f1163fbb0.png)
![screenshot from 2016-06-12 01-15-24](https://cloud.githubusercontent.com/assets/3050060/15987905/1b5d2db0-303c-11e6-8f43-9a8ad2371007.png)
2016-06-14 07:49:56 -07:00
Oliver Middleton
0c742d263c rustdoc: Fix redirect pages for renamed reexports
We need to use the name of the target not the name of the current item
when creating the link.
2016-06-14 15:24:06 +01:00
Ulrik Sverdrup
5df05c6e22 specialize zip: Use associated type for specialized zip struct data
The associated type must be 'static to avoid dropck related errors.
2016-06-14 15:51:49 +02:00
Ulrik Sverdrup
85cd49fc39 specialize zip: Add benchmarks 2016-06-14 15:51:49 +02:00
Ulrik Sverdrup
c2ef20fd38 specialize zip: Add codegen test 2016-06-14 15:51:49 +02:00
Ulrik Sverdrup
13f8f40961 specialize zip: TrustedRandomAccess for Enumerate 2016-06-14 15:51:49 +02:00
Ulrik Sverdrup
515c4d3c1e specialize zip: TrustedRandomAccess for Zip 2016-06-14 15:51:49 +02:00
Ulrik Sverdrup
a8f2e9b359 specialize zip: Specialize .zip() for TrustedRandomAccess iterators
This allows common iterator compositions like a.zip(b) where a, b
are slice::{Iter, IterMut} compile to *much* better code.
2016-06-14 15:51:49 +02:00
Ulrik Sverdrup
592eaa5bb3 specialize zip: Implement TrustedRandomAccess for slice iterators 2016-06-14 15:51:49 +02:00
Ulrik Sverdrup
f8d2fdf02b specialize zip: Introduce TrustedRandomAccess trait 2016-06-14 15:50:49 +02:00
bors
2940eb54bd Auto merge of #34232 - ollie27:rustdoc_inline, r=alexcrichton
rustdoc: Don't inline #[doc(hidden)] pub use

Currently if a `#[doc(hidden)] pub use` item is inlined the `hidden`
attribute is ignored so the item can appear in the docs. By never inlining
such imports, they can be stripped.

An example in `std` is [`__OsLocalKeyInner`](https://doc.rust-lang.org/nightly/std/thread/struct.__OsLocalKeyInner.html) which clearly should not be documented.
2016-06-14 05:04:38 -07:00
Gleb Kozyrev
5db9424de3 Add ERROR_FILE_EXISTS to ErrorKind conversion on Windows
Bug report:
https://users.rust-lang.org/t/detecting-error-kind-for-opening-file/6215
Reference:
https://msdn.microsoft.com/en-us/library/windows/desktop/ms681382(v=vs.85).aspx#error_file_exists
2016-06-14 12:10:42 +03:00
Jeffrey Seyfried
0644aba0b3 Remove the type parameter from syntax::visit::Visitor 2016-06-14 07:40:32 +00:00
Jeffrey Seyfried
683e480ffe Refactor away WithAttrs trait 2016-06-14 07:40:30 +00:00
Jeffrey Seyfried
5bf7970ac7 Change fold_tt and fold_tts to take token trees by value (instead of by reference) 2016-06-14 07:40:18 +00:00
Jeffrey Seyfried
febe6a46f6 Refactor away field ctxt of ast::Mac_ 2016-06-14 07:39:33 +00:00
Jeffrey Seyfried
01a0877a73 Remove inherent method attrs() on AST nodes. attrs() is now a method of trait HasAttrs. 2016-06-14 07:39:32 +00:00
bors
1af8f3e362 Auto merge of #34266 - liigo:patch-8, r=Manishearth
reference: link to proper ffi attributes
2016-06-14 00:24:33 -07:00
bors
bf84f4e171 Auto merge of #33749 - jseyfried:fix_call_site_span, r=nrc
Fix macro call site spans

Fix macro call site spans.
r? @nrc
2016-06-13 21:07:30 -07:00
Liigo Zhuang
4dcebd2fa9 reference: link to proper ffi attributes 2016-06-14 10:50:48 +08:00
bors
6551acc8e5 Auto merge of #34262 - dsprenkels:enum_pattern_resolve_ice, r=eddyb
Add regression test for #33293

This PR adds a regression test for #33293.

Closes #33293.
r? @eddyb
2016-06-13 18:26:30 -07:00
Jeffrey Seyfried
2477341d05 Replace println!(""); invocations with calls to a dummy function in debuginfo test 2016-06-13 22:57:08 +00:00
Oliver Middleton
61043fd3c1 Improve IP reserved address docs
- Add links to all RFCs to make it clear these are not Rust RFCs.
- Correct RFC numbers to match the numbers in [RFC 6890](https://tools.ietf.org/html/rfc6890)
- Clean up formatting to show addresses and ranges in parentheses like (255.255.255.255)
2016-06-13 23:49:04 +01:00
bors
ab0b87458f Auto merge of #34243 - c3st7n:add_test_issue_issue_23477, r=nagisa
Add test case for issue #23477

My first pull request, any feedback welcome.

Fixes #23477
2016-06-13 15:44:17 -07:00
Chris Tomlinson
d991b1f624 Correct broken test 2016-06-13 22:27:13 +01:00
Daan Sprenkels
297742e3b8 Add regression test for #33293 2016-06-13 23:24:29 +02:00
Joseph Dunne
dc3d878e0f Add support for macro expansion inside trait items 2016-06-13 21:46:43 +01:00
Florian Berger
4e0fd65d96 doc: Fix typo 2016-06-13 21:35:37 +03:00
bors
c0df44708e Auto merge of #34242 - zackmdavis:explain_E0453, r=GuillaumeGomez
add long explanation for E0453, lint attribute overruled by outer forbid

This is a subtask of #32777.

-----

r? @GuillaumeGomez
2016-06-13 07:38:40 -07:00
bors
5e3136def7 Auto merge of #34252 - dsprenkels:issue-32364-test, r=eddyb
Add regression test for #32364

This PR adds a regression test for #32364.

r? @eddyb
2016-06-13 02:31:29 -07:00
Zack M. Davis
e4c566ccef edit E0453 long explanation for style, clarity, and citizenship
It turns out that the subsequent lines of the error message comment
should be aligned like this.

The "turns the corresponding compiler warning" language may not be
strictly the most accurate—a lint check isn't the same as a compiler
warning; it emits a compiler warning if it's set to the `warn` level—
but it may be worth glossing over such distinctions in favor of simple,
familar phrasings for the sake of pedagogy; thanks to Guillaume Gomez
for the wording suggestion.

Let's also fix up the introductory clauses of the sentences about how to
fix the error to put a little more emphasis on the fact that the
`forbid` setting was probably there for a reason.
2016-06-12 21:14:30 -07:00
bors
6b40b74af5 Auto merge of #34226 - srinivasreddy:tuple_slice_cleanup, r=alexcrichton
Add additional test cases to test all arities of tuple; And remove type suffix - i32 on integers
2016-06-12 20:49:37 -07:00
Daan Sprenkels
df564451db Add regression test for #32364 2016-06-13 00:36:22 +02:00
bors
51d2d3da80 Auto merge of #34133 - m-decoster:master, r=GuillaumeGomez
Add explanations for E0503 and E0508.

(cannot use `..` because it was mutably borrowed, cannot move out of type `..`, a non-copy fixed-size array)

Part of #32777.
2016-06-12 15:35:32 -07:00
Chris Tomlinson
1bf4068805 Add test case for issue 23477 2016-06-12 22:20:54 +01:00
Zack M. Davis
c17f1a66f9 add long explanation for E0453, lint attribute overruled by outer forbid
This is a subtask of #32777.
2016-06-12 12:58:24 -07:00
bors
abc57aba05 Auto merge of #34241 - dsprenkels:issue-32031-test, r=eddyb
add a test case for issue #32031

I propose a test case to finish the fix for issue #32031. Please review this commit thoroughly, as I have never written a codegen test before.

r? @eddyb
2016-06-12 12:48:57 -07:00
Guillaume Gomez
7746d7c52f Add error codes block code flag 2016-06-12 18:40:40 +02:00
Daan Sprenkels
688840fdd6 add a test case for issue #32031 2016-06-12 18:09:38 +02:00
bors
a76698b5ee Auto merge of #34045 - ollie27:rustdoc_stripped, r=brson
rustdoc: Don't generate empty files for stripped items

We need to traverse stripped modules to generate redirect pages, but we shouldn't generate
anything else for them.

This now renders the file contents to a Vec before writing it to a file in one go. I think
that's probably a better strategy anyway.

Fixes: #34025
2016-06-12 06:05:55 -07:00
bors
b1b752655d Auto merge of #34161 - kennytm:fix-E0277-format, r=GuillaumeGomez
Fix markdown formatting error of E0277, E0310 and E0502.

Fix bad format we see in https://doc.rust-lang.org/nightly/error-index.html#E0277.
2016-06-12 03:11:36 -07:00
Mathieu De Coster
e06fbe159c Add explanation for E0503 2016-06-12 10:32:55 +02:00
Mathieu De Coster
81cd752264 Add explanation for E0508 2016-06-12 10:31:54 +02:00
kennytm
ae75593864
Fix markdown formatting error of E0277, E0284, E0310, E0502. 2016-06-12 16:09:44 +08:00
bors
5b09f2a1a6 Auto merge of #34238 - jpreiss:master, r=steveklabnik
fix typo in primitive-types section on slices
2016-06-12 00:05:47 -07:00
Jeffrey Seyfried
236b67af51 Add regression test 2016-06-12 06:28:37 +00:00
Jeffrey Seyfried
2d1f3009cc Load macros from #[macro_use] crates earlier in expansion 2016-06-12 05:56:52 +00:00
Jeffrey Seyfried
3b8e1f309e Implement Into<Vec<T>> for SmallVector<T> 2016-06-12 05:56:52 +00:00
Jeffrey Seyfried
8104df27ec Add method visit_with to MacroGenerable 2016-06-12 05:56:47 +00:00
James Alan Preiss
c0c43b1e27 typo fix in loops.md 2016-06-11 20:46:23 -07:00
James Alan Preiss
77aeb7b6f1 fix typo in primitive-types section on slices 2016-06-11 20:31:01 -07:00
bors
4c45d26a82 Auto merge of #34132 - AtheMathmo:no-stdlib, r=steveklabnik
Note warning of default features on libc

The default features of libc include libstd. This should be noted on this page.
2016-06-11 19:57:47 -07:00
Guillaume Gomez
7cd891280b Fix invalid inlining 2016-06-12 01:34:45 +02:00
Oliver Middleton
a7c467418f rustdoc: Don't inline #[doc(hidden)] pub use
Currently if a `#[doc(hidden)] pub use` item is inlined the `hidden`
attribute is ignored so the item can appear in the docs. By never inlining
such imports, they can be stripped.
2016-06-11 23:00:42 +01:00
Alex Burka
df924ca2a1 add fixme about duplicated errors 2016-06-11 15:51:04 -04:00
Srinivas Reddy Thatiparthy
fa91c14bc0 Add additional test cases to test all arities of tuple; And remove type suffix - i32 on integers 2016-06-11 22:31:24 +05:30
bors
35841eea8b Auto merge of #34153 - apasel422:btree, r=alexcrichton
Update tracking issue for `{BTreeMap, BTreeSet}::{append, split_off}`

r? @alexcrichton
2016-06-11 08:52:22 -07:00
Srinivas Reddy Thatiparthy
99e9f2ddc1 remove redundant test case 2016-06-11 20:59:58 +05:30
Srinivas Reddy Thatiparthy
028073dd60 run rustfmt on cargotest folder in src/tools/cargotest 2016-06-11 19:05:31 +05:30
Srinivas Reddy Thatiparthy
c9c2a034a3 run rustfmt on linkchecker folderin src/tools/linkchecker 2016-06-11 19:04:28 +05:30
bors
7d8e6dd3bf Auto merge of #34211 - srinivasreddy:rf_libstd_coll, r=brson
run rustfmt on libstd/collections/hash folder
2016-06-11 04:23:49 -07:00
Nick Cameron
c28374ef0b save-analysis: some refinements to JSON data
Split variable and function kinds to give more information. Give children for methods, structs, enums, and traits.
2016-06-11 12:23:57 +02:00
bors
682abf79af Auto merge of #34208 - shepmaster:llvm-3.7-linking-intrinsics, r=alexcrichton
Remove linking and intrinsics code made dead by only supporting LLVM 3.7 and up

This is mostly based on Alex's throwaway comment:

> probably reject those that LLVM just doesn't support...

So I'm more than happy to adjust the PR based on how you thought this should look. Also happy to split it into two PRs, one for linking and one for intrinsics.

r? @alexcrichton

/cc @nagisa @brson
2016-06-11 01:32:44 -07:00
bors
945ba12362 Auto merge of #34002 - jseyfried:strip_tests_in_cfg, r=nrc
Treat `#[test]` like `#[cfg(test)]` in non-test builds

This PR treats `#[test]` like `#[cfg(test)]` in non-test builds. In particular, like `#[cfg(test)]`,
 - `#[test]` nodes are stripped during `cfg` processing, and
 - `#[test]` is disallowed on non-optional expressions.

Closes #33946.
r? @nrc
2016-06-10 22:41:24 -07:00
Jeffrey Seyfried
65d256e82a Support nested cfg_attr attributes 2016-06-11 04:59:36 +00:00
Jeffrey Seyfried
29c4b6726a Refactor away the CfgFolder trait. 2016-06-11 03:13:48 +00:00
Jeffrey Seyfried
c89846c271 Forbid #[test] attributes on non-optional expressions. 2016-06-11 03:13:47 +00:00
Jeffrey Seyfried
66b9ade341 Strip #[test] nodes during cfg processing on non-test builds. 2016-06-11 03:13:44 +00:00
bors
f80ff7da39 Auto merge of #34174 - shepmaster:16-bit-mir, r=Aatch
Support 16-bit pointers in MIR
2016-06-10 19:50:42 -07:00
bors
0554abac63 Auto merge of #34172 - jseyfried:avoid_configuring_interpolated_ast, r=alexcrichton
Fix ICE regression caused by configuring interpolated AST

Fixes #34171.
r? @nrc
2016-06-10 16:55:30 -07:00
Srinivas Reddy Thatiparthy
bb19d1dc2e run rustfmt on libstd/collections/hash folder 2016-06-11 05:12:14 +05:30
Jake Goulding
448e254ca0 All intrinsics are available in all supported LLVM versions 2016-06-10 18:26:44 -04:00
Jake Goulding
3f36f7a980 Remove linking with AR
Since we only support LLVM 3.7 and above, we will never need to use the
AR linker. Remove the possibility of calling it and all the now-dead
code.
2016-06-10 18:26:42 -04:00
Andrew Paseltiner
9bf5daca90
Update tracking issue for {BTreeMap, BTreeSet}::{append, split_off} 2016-06-10 17:25:49 -04:00
Vadim Petrochenkov
f59afbc214 Remove last traces of identifier hygiene from HIR 2016-06-11 00:12:39 +03:00
bors
8c6bd23aaa Auto merge of #34199 - jseyfried:visit_all_attrs, r=nrc
Visit statement and expression attributes in the AST visitor

Currently, these attributes are not visited, so they are not gated feature checked in the post expansion visitor. This only affects crates using `#![feature(stmt_expr_attributes)]`.
r? @nrc
2016-06-10 10:37:35 -07:00
Jake Goulding
1858cfb80d Allow truncating constants to 16-bit u/isize 2016-06-10 13:07:04 -04:00
bors
a267d6cee4 Auto merge of #34200 - sanxiyn:rollup, r=sanxiyn
Rollup of 12 pull requests

- Successful merges: #34088, #34129, #34136, #34145, #34146, #34148, #34159, #34160, #34165, #34175, #34184, #34185
- Failed merges:
2016-06-10 07:43:52 -07:00
Seo Sanghyeon
107d423f1a Rollup merge of #34185 - tshepang:shorten-paragraph, r=steveklabnik
doc: intro should be 1 sentence

Also, do not repeat name of type
2016-06-10 21:16:46 +09:00
Seo Sanghyeon
e58c967c86 Rollup merge of #34175 - rwz:patch-2, r=alexcrichton
Fix BTreeMap example typo

The whole example is made around movies reviews, but that one line says "review some books".
2016-06-10 21:16:46 +09:00
Seo Sanghyeon
71b05c2608 Rollup merge of #34165 - ollie27:docs_char_case, r=steveklabnik
docs: Improve char::to_{lower,upper}case examples

Collect the results to a String to make it clear that it will not always
return only one char and add examples showing that.

r? @steveklabnik
2016-06-10 21:16:46 +09:00
Seo Sanghyeon
886df542e2 Rollup merge of #34160 - hoodie:bug/GoT_References, r=GuillaumeGomez
Fixed two little Game Of Thrones References

Fixed: conflicting spelling of "Jon Snow"
Fixed: It's call "Night's Watch"
2016-06-10 21:16:45 +09:00
Seo Sanghyeon
493f14903e Rollup merge of #34148 - srinivasreddy:bitflags_rustfmt, r=nagisa
run rustfmt on librustc_bitflags folder
2016-06-10 21:16:45 +09:00
Seo Sanghyeon
63bb68b861 Rollup merge of #34146 - srinivasreddy:libflate_rustfmt, r=nagisa
run rustfmt on libflate folder
2016-06-10 21:16:45 +09:00
Seo Sanghyeon
06e069ea16 Rollup merge of #34145 - matklad:any-docs, r=steveklabnik
docs: simplify wording

It took me more then a moment to decipher "with no non-`'static`" thing :)

"`'static` type" should say the same thing more clearly.

r? @steveklabnik
2016-06-10 21:16:45 +09:00
Seo Sanghyeon
b6940932d4 Rollup merge of #34136 - imjacobclark:ice-test-case-25579, r=nikomatsakis
Test case for borrowk ICE #25579

r? @nikomatsakis

Fixes #25579
2016-06-10 21:16:44 +09:00
Seo Sanghyeon
b2581974a3 Rollup merge of #34129 - jviide:from-string-box-error, r=steveklabnik
Remove a gotcha from book/error-handling.md

The book's "Error handling with `Box<Error>`" section talks about `Box<Error>`. In the actual example `Box<Error + Send + Sync>` is used instead so that the corresponding From impls could be used to convert a plain string to an error type. Rust 1.7 added support for conversion from `&str`/`String` to
`Box<Error>`, so this gotcha and later references to it can now be removed.

r? @steveklabnik
2016-06-10 21:16:44 +09:00
Seo Sanghyeon
4f6e8f8259 Rollup merge of #34088 - srinivasreddy:rustfmt_map.rs, r=nrc
run rustfmt on map.rs in libcollections/btree folder
2016-06-10 21:16:44 +09:00
bors
68241f00ad Auto merge of #34178 - shepmaster:llvm-3.7-and-up, r=alexcrichton
Reflect supporting only LLVM 3.7+ in the LLVM wrappers

Based on 12abddb06b, it appears we can drop support for these older LLVM versions. Hopefully, this will make it slightly easier to support the changes needed for LLVM 3.9.

r? @nagisa

/cc @brson
2016-06-10 04:50:46 -07:00
Jeffrey Seyfried
8475a4b0c6 Check that custom attributes are disallowed on statements and expressions 2016-06-10 10:38:14 +00:00
Jeffrey Seyfried
11b538840f Visit statement and expression attributes 2016-06-10 10:38:11 +00:00
bors
a9234c11e0 Auto merge of #34086 - srinivasreddy:rustfmt_liballoc_jemalloc, r=nagisa
run rustfmt on liballoc_jemalloc folder
2016-06-10 00:19:09 -07:00
bors
c09d546ee5 Auto merge of #34046 - Vtec234:fix-atomic-doc, r=steveklabnik
Fix wrong statement in compare_exchange doc

The documentation for `core::sync::atomic::AtomicSomething::compare_exchange` contains a wrong, or imprecise, statement about the return value. It goes:

The return value is a result indicating whether the new value was written and containing
the previous value. On success this value is guaranteed to be equal to `new`.

In the second sentence, `this value` is gramatically understood as referring to `return value` from the first sentence. Due to how CAS works, the returned value is always what was in the atomic variable _before_ the operation occurred, not what was written into it during the operation. Hence, the fixed doc should say:

The return value is a result indicating whether the new value was written and containing
the previous value. On success this value is guaranteed to be equal to `current`.

This version is confirmed by the runnable examples in variants of `AtomicSomething`, e.g.

    assert_eq!(some_bool.compare_exchange(true, false, Ordering::Acquire, Ordering::Relaxed),
    Ok(true));

where the returned value is `Ok(current)`. This PR fixes all occurrences of this bug I could find.

An alternative solution would be to modify the second sentence so that it refers to the value _written_ into the Atomic rather than what was there before, in which case it would be correct. Example alternative formulation:

On success the value written into the `bool`/`usize`/`whatever` is guaranteed to be equal to `new`.

r? @steveklabnik
2016-06-09 21:29:26 -07:00
bors
2798772b51 Auto merge of #34173 - srinivasreddy:rm_redundant, r=alexcrichton
remove redundant  assert statements
2016-06-09 18:38:46 -07:00
Vadim Petrochenkov
6d7b35bd98 Address review comments + fix rebase 2016-06-10 01:06:37 +03:00
Ariel Ben-Yehuda
e783a0a5e3 make all pattern bindings with the same name resolve to the first one
This simplifies the code considerably, removing one of the
last uses of hygienic matching out of resolution.
2016-06-10 01:06:37 +03:00
Vadim Petrochenkov
392b6e7c81 Add tests 2016-06-10 01:03:54 +03:00
Vadim Petrochenkov
ee4e55398b Introduce TyCtxt::expect_def/expect_resolution helpers and use them where possible 2016-06-10 01:03:54 +03:00
Vadim Petrochenkov
4c30f6405c Move the hack with fake partial resolution for <A>::B from typeck to resolve 2016-06-10 01:03:54 +03:00
Vadim Petrochenkov
91b9dabdeb resolve: Rewrite resolve_pattern 2016-06-10 01:03:54 +03:00
Oliver Middleton
ee469058e1 Implement Binary, Octal, LowerHex and UpperHex for Wrapping<T> 2016-06-09 23:03:14 +01:00
Tshepang Lekhonkhobe
3dfc8c1869 doc: intro should be 1 sentence
Also, do not repeat name of type
2016-06-09 23:23:09 +02:00
Jake Goulding
e51958ba72 Support getting the minimum 16-bit isize value 2016-06-09 17:02:20 -04:00
Jake Goulding
f3d9de4528 Remove unneeded indirection of GET_ARCHIVE 2016-06-09 15:59:27 -04:00
Jake Goulding
4f01329e0e Reflect supporting only LLVM 3.7+ in the LLVM wrappers 2016-06-09 15:59:26 -04:00
Alex Burka
53618c3629 test traits defined on ranges 2016-06-09 15:32:43 -04:00
bors
ee00760a14 Auto merge of #34149 - arielb1:remove-remove-dead-blocks, r=nikomatsakis
MIR cleanups and predecessor cache

This PR cleans up a few things in MIR and adds a predecessor cache to allow graph algorithms to be run easily.

r? @nikomatsakis
2016-06-09 12:07:38 -07:00
Ariel Ben-Yehuda
ce4fdefbd8 fix issues 2016-06-09 21:47:58 +03:00
Alex Burka
9e78cd73b5 make RangeInclusive Hash and !Copy
[breaking-change] due to the removal of Copy which shouldn't have been there in the first place, as per policy set forth in #27186.
2016-06-09 13:26:02 -04:00
Alex Burka
85e76e804d derive Hash for ranges
Fixes #34170.
2016-06-09 10:52:36 -04:00
bors
0740a93cc2 Auto merge of #33895 - AndrewBrinker:master, r=steveklabnik
Rewrote "How Safe and Unsafe Interact" Nomicon chapter.

The previous version of the chapter covered a lot of ground, but was a little meandering and hard to follow at times. This draft is intended to be clearer and more direct, while still providing the same information as the previous version.

r? @steveklabnik
2016-06-09 07:13:34 -07:00
Ariel Ben-Yehuda
f5b1ba6e90 use the type name as the pass name 2016-06-09 15:24:46 +03:00
Ariel Ben-Yehuda
065a264976 refactor simplify_cfg and split off simplify_branches 2016-06-09 15:24:43 +03:00
Ariel Ben-Yehuda
2ee00e6d9d add hook infrastructure for automatically dumping MIR on every pass 2016-06-09 15:21:43 +03:00
Ariel Ben-Yehuda
798be90648 introduce an unreachable terminator
Use it instead of a `panic` for inexhaustive matches and correct the
comment. I think we trust our match-generation algorithm enough to
generate these blocks, and not generating an `unreachable` means that
LLVM won't optimize `match void() {}` to an `unreachable`.
2016-06-09 15:16:15 +03:00
Ariel Ben-Yehuda
6405527ded add a cache for MIR predecessors 2016-06-09 15:01:45 +03:00
Ariel Ben-Yehuda
e3af9fa490 make the basic_blocks field private 2016-06-09 14:55:19 +03:00
Ariel Ben-Yehuda
bc1eb67721 introduce the type-safe IdxVec and use it instead of loose indexes 2016-06-09 14:26:08 +03:00
bors
33c8992b80 Auto merge of #34109 - pnkfelix:fix-issue-34101, r=arielb1
Fix issue #34101

Fix issue #34101: do not track subcontent of type with dtor nor gather flags for untracked content.

(Includes a regression test, which needed to go into `compile-fail/`
due to weaknesses when combining `#[deny(warnings)]` with
`tcx.sess.span_warn(..)`)
2016-06-09 04:24:50 -07:00
Ariel Ben-Yehuda
e9003c5574 merge the RemoveDeadBlocks pass into the SimplifyCfg pass 2016-06-09 13:23:00 +03:00
bors
24526cc3cc Auto merge of #34108 - jseyfried:refactor_prelude_injection, r=nrc
Refactor away the prelude injection fold

Instead, just inject `#[prelude_import] use [core|std]::prelude::v1::*;` at the crate root while injecting `extern crate [core|std];` and process `#[no_implicit_prelude]` attributes in `resolve`.

r? @nrc
2016-06-09 01:35:26 -07:00
bors
dc77c5ebe8 Auto merge of #34032 - jseyfried:load_macros_in_expansion, r=nrc
Support `#[macro_use]` on macro-expanded crates

This PR loads macros from `#[macro_use]` crates during expansion so that
 - macro-expanded `#[macro_use]` crates work (fixes #33936, fixes #28071), and
 - macros imported from crates have the same scope as macros imported from modules.

This is a [breaking-change]. For example, this will break:
```rust
macro_rules! m {
    () => { #[macro_use(foo)] extern crate core; } //~ ERROR imported macro not found
}
m!();
```
Also, this will break:
```rust
macro_rules! try { () => {} }
// #[macro_use] mod bar { macro_rules! try { ... } } //< ... just like this would ...
fn main() { try!(); } //< ... making this an error
```

r? @nrc
2016-06-08 22:45:35 -07:00
Pavel Pravosud
8180a910f9 Fix BTreeMap example typo
The whole example is made around movies reviews, but that one line says "review some books".
2016-06-08 20:32:24 -07:00
Srinivas Reddy Thatiparthy
c605480521 clean up for test cases 2016-06-09 08:20:08 +05:30
Srinivas Reddy Thatiparthy
c6ed7adf7a remove redundant assert statements 2016-06-09 08:12:31 +05:30
bors
bb4b3fb7f9 Auto merge of #32202 - arielb1:slice-patterns, r=nikomatsakis
Implement RFC495 semantics for slice patterns

non-MIR translation is still not supported for these and will happily ICE.

This is a [breaking-change] for many uses of slice_patterns.

[RFC 495 text](https://github.com/rust-lang/rfcs/blob/master/text/0495-array-pattern-changes.md)
2016-06-08 19:30:33 -07:00
Jeffrey Seyfried
dbf0326ddc Add comment and clean up expand_annotatable 2016-06-09 00:49:42 +00:00
Jeffrey Seyfried
13e3925e8d Add regression test 2016-06-09 00:45:04 +00:00
Jeffrey Seyfried
51499b6e1f Load macros from extern crates during expansion. 2016-06-09 00:44:17 +00:00
Jeffrey Seyfried
c751ec626d Add regression test 2016-06-09 00:31:19 +00:00
Jeffrey Seyfried
8254e55760 Avoid configuring interpolated items. 2016-06-09 00:26:35 +00:00
bors
34505e2228 Auto merge of #34167 - eddyb:fix-pairs-for-real, r=nikomatsakis
trans: don't misuse C_nil for ZSTs other than ().

`C_nil` is actually `C_null` for `()` so `TempRef::new_operand` was treating all ZSTs as `()`.
This should allow running Servo with `RUSTFLAGS=-Zorbit`, assuming there are no other bugs.
2016-06-08 16:41:01 -07:00
Ariel Ben-Yehuda
2de6ea7a35 fix Cargo.lock 2016-06-09 01:05:37 +03:00
Ariel Ben-Yehuda
f0174fcbee use the slice_pat hack in libstd too 2016-06-09 00:38:38 +03:00
Ariel Ben-Yehuda
9b1abf5c65 remove residual slice pattern junk from mem_categorization 2016-06-09 00:38:38 +03:00
Ariel Ben-Yehuda
fcabfa9735 add an help message when using an old-style slice pattern 2016-06-09 00:38:38 +03:00
Ariel Ben-Yehuda
5cf4139d21 fix tests 2016-06-09 00:38:38 +03:00
Ariel Ben-Yehuda
a673cedf7b fix stdtest 2016-06-09 00:38:38 +03:00
Ariel Ben-Yehuda
b2100cc7b5 fix damage in librustc 2016-06-09 00:38:38 +03:00
Ariel Ben-Yehuda
8ac3b46cac address review comments 2016-06-09 00:38:38 +03:00
Ariel Ben-Yehuda
5af5f26753 handle string literals correctly in match checking
The root of the problem is that a string literal pattern is essentially of
the form `&LITERAL`, in a single block, while match checking wants to
split that.

To fix that, I added a type field to the patterns in match checking,
which allows us to distinguish between a full and split pattern.

That file is ugly and needs to be cleaned. However, `trans::_match` calls
it, so I think we should delay the cleanup until we kill that.

Fixes #30240
2016-06-09 00:38:38 +03:00
Ariel Ben-Yehuda
1a614f8568 wrap calls to lvalue_ty 2016-06-09 00:38:38 +03:00
Ariel Ben-Yehuda
5c717a6fc2 implement RFC495 semantics for slice patterns
non-MIR translation is still not supported for these and will happily ICE.

This is a [breaking-change] for many uses of slice_patterns.
2016-06-09 00:38:38 +03:00
Eduard Burtescu
22fa769bc4 trans: don't misuse C_nil for ZSTs other than (). 2016-06-09 00:33:57 +03:00
Ariel Ben-Yehuda
088b7e2108 fix translation of unsized types and arrays 2016-06-08 23:58:53 +03:00
Ariel Ben-Yehuda
70c25c848c remove the librustc_trans -> librustc_mir dependency 2016-06-08 23:58:53 +03:00
bors
0d531bfb88 Auto merge of #33989 - eddyb:mir-viz, r=nikomatsakis
[MIR] Make scopes debuginfo-specific (visibility scopes).

Fixes #32949 by having MIR (visibility) scopes mimic the lexical structure.
Unlike #33235, this PR also removes all scopes without variable bindings.

Printing of scopes also changed, e.g. for:
```rust
fn foo(x: i32, y: i32) { let a = 0; let b = 0; let c = 0; }
```
Before my changes:
```rust
fn foo(arg0: i32, arg1: i32) -> () {
    let var0: i32;                       // "x" in scope 1 at <anon>:1:8: 1:9
    let var1: i32;                       // "y" in scope 1 at <anon>:1:16: 1:17
    let var2: i32;                       // "a" in scope 3 at <anon>:1:30: 1:31
    let var3: i32;                       // "b" in scope 6 at <anon>:1:41: 1:42
    let var4: i32;                       // "c" in scope 9 at <anon>:1:52: 1:53

    ...

    scope tree:
    0 1 2 3 {
        4 5
        6 {
            7 8
            9 10 11
        }
    }
}
```
After my changes:
```rust
fn foo(arg0: i32, arg1: i32) -> () {
    scope 1 {
        let var0: i32;                   // "x" in scope 1 at <anon>:1:8: 1:9
        let var1: i32;                   // "y" in scope 1 at <anon>:1:16: 1:17
        scope 2 {
            let var2: i32;               // "a" in scope 2 at <anon>:1:30: 1:31
            scope 3 {
                let var3: i32;           // "b" in scope 3 at <anon>:1:41: 1:42
                scope 4 {
                    let var4: i32;       // "c" in scope 4 at <anon>:1:52: 1:53
                }
            }
        }
    }

    ...
}
2016-06-08 13:51:57 -07:00
Oliver Middleton
bc4def9e74 docs: Improve char::to_{lower,upper}case examples
Collect the results to a String to make it clear that it will not always
return only one char and add examples showing that.
2016-06-08 19:24:03 +01:00
bors
4b240fe96a Auto merge of #34083 - alexcrichton:dumb-hack, r=nrc
rustc: Try to contain prepends to PATH

This commit attempts to bring our prepends to PATH on Windows when loading
plugins because we've been seeing quite a few issues with failing to spawn a
process on Windows, the leading theory of which is that PATH is too large as a
result of this. Currently this is mostly a stab in the dark as it's not
confirmed to actually fix the problem, but it's probably not a bad change to
have anyway!

cc #33844
Closes #17360
2016-06-08 07:43:29 -07:00
Hendrik Sollich
92e8228813 Fixed two little Game Of Thrones References
Fixed: conflicting spelling of "Jon Snow"
Fixed: It's call "Night's Watch"
2016-06-08 14:44:00 +02:00
Jacob Clark
4c5f3a6d65 Resolving line length build fail 2016-06-08 13:26:18 +01:00
bors
d3e014e295 Auto merge of #34068 - ollie27:rustdoc_redirect_const, r=brson
rustdoc: Fix generating redirect pages for statics and consts

These were missing from the cache for some reason meaning the redirect pages failed to render.
2016-06-08 04:53:34 -07:00
bors
ff1315591f Auto merge of #34010 - jseyfried:decorate_expanded, r=nrc
Run decorators on expanded AST

Fixes #32950.
r? @nrc
2016-06-08 02:05:38 -07:00
Jacob Clark
0379493bd9
Resolving build failure 2016-06-08 07:22:49 +01:00
bors
368f6ae8cb Auto merge of #34003 - frewsxcv:13727-regressions, r=brson
Add regression tests for #13727.

Fixes https://github.com/rust-lang/rust/issues/13727.
2016-06-07 21:38:30 -07:00
bors
371bf0eda2 Auto merge of #33982 - LeoTestard:remove-check-matcher-old, r=pnkfelix
Remove the old FOLLOW checking (aka `check_matcher_old`).

It was supposed to be removed at the next release cycle but is still in the tree since like 6 months.
Potential breaking change, since some cases (such as #25658) will change from a warning to an error. But the warning stating that it will be a hard error in the next release has been there for 6 months now.
I think it's safe to break this code. ^_^
2016-06-07 17:56:35 -07:00
Andrew Brinker
af33b30bc6 Fixed based on feedback from steveklabnik 2016-06-07 18:09:24 -04:00
bors
ec872dc8a3 Auto merge of #34141 - eddyb:trans-abi-memcpy, r=nikomatsakis
trans: always use a memcpy for ABI argument/return casts.

When storing incoming arguments or values returned by call/invoke, always do a `memcpy` from a temporary of the cast type, if there is an ABI cast.
While Clang has gotten smarter ([store](https://godbolt.org/g/EphFuK) vs [memcpy](https://godbolt.org/g/5dikH9)), a `memcpy` will always work.
This is what @dotdash has wanted to do all along, and it fixes #32049.
2016-06-07 14:45:39 -07:00