bors [Mon, 13 Aug 2018 17:10:04 +0000 (17:10 +0000)]
Auto merge of #53270 - petrochenkov:macuse-regr, r=alexcrichton
Fix a few regressions from enabling macro modularization
The first commit restores the old behavior for some minor unstable stuff (`rustc_*` and `derive_*` attributes) and adds a new feature gate for arbitrary tokens in non-macro attributes.
The second commit fixes https://github.com/rust-lang/rust/issues/53205
The third commit fixes https://github.com/rust-lang/rust/issues/53144.
Same technique is used as for other things blocking expansion progress - if something causes indeterminacy too often, then prohibit it.
In this case referring to crate-local macro-expanded `#[macro_export]` macros via module-relative paths is prohibited, see comments in code for more details.
bors [Mon, 13 Aug 2018 02:28:13 +0000 (02:28 +0000)]
Auto merge of #53051 - varkor:trait-method-pattern-arguments-error, r=petrochenkov
Emit error for pattern arguments in trait methods
The error and check for this already existed, but the parser didn't try to parse trait method arguments as patterns, so the error was never emitted. This surfaces the error, so we get better errors than simple parse errors.
This improves the error message described in https://github.com/rust-lang/rust/issues/53046.
bors [Sun, 12 Aug 2018 21:52:22 +0000 (21:52 +0000)]
Auto merge of #53297 - GuillaumeGomez:rollup, r=GuillaumeGomez
Rollup of 15 pull requests
Successful merges:
- #52955 (Update compiler test documentation)
- #53019 (Don't collect() when size_hint is useless)
- #53025 (Consider changing assert! to debug_assert! when it calls visit_with)
- #53059 (Remove explicit returns where unnecessary)
- #53165 ( Add aarch64-unknown-netbsd target)
- #53210 (Deny future duplication of rustc-ap-syntax)
- #53223 (A few cleanups for rustc_data_structures)
- #53230 ([nll] enable feature(nll) on various crates for bootstrap: part 4)
- #53231 (Add let keyword doc)
- #53240 (Add individual documentation for <integer>`.swap_bytes`/.`reverse_bits`)
- #53253 (Remove unwanted console log)
- #53264 (Show that Command can be reused and remodified)
- #53267 (Fix styles)
- #53273 (Add links to std::char::REPLACEMENT_CHARACTER from docs.)
- #53283 (wherein we suggest float for integer literals where a float was expected)
Guillaume Gomez [Sun, 12 Aug 2018 21:27:04 +0000 (23:27 +0200)]
Rollup merge of #53273 - frewsxcv:frewsxcv-ufffd, r=GuillaumeGomez
Add links to std::char::REPLACEMENT_CHARACTER from docs.
There are a few places where we mention the replacement character in the
docs, and it could be helpful for users to utilize the constant which is
available in the standard library, so let’s link to it!
Guillaume Gomez [Sun, 12 Aug 2018 21:27:01 +0000 (23:27 +0200)]
Rollup merge of #53264 - Havvy:patch-3, r=GuillaumeGomez
Show that Command can be reused and remodified
The prior documentation did not make it clear this was possible.
I wanted to make the `list_dir` example work on Windows, but I don't know if passing "/" will error or show the root of the current volume (e.g. `C:`).
Guillaume Gomez [Sun, 12 Aug 2018 21:26:55 +0000 (23:26 +0200)]
Rollup merge of #53223 - ljedrz:cleanup_data_structures, r=oli-obk
A few cleanups for rustc_data_structures
- remove a redundant `clone()`
- make some calls to `.iter()` implicit
- collapse/simplify a few operations
- remove some explicit `return`s
- make `SnapshotMap::{commit, rollback_to}` take references
- remove unnecessary struct field names
- change `transmute()`s in `IdxSet::{from_slice, from_slice_mut}` to casts
- remove some unnecessary lifetime annotations
- split 2 long literals
Guillaume Gomez [Sun, 12 Aug 2018 21:26:50 +0000 (23:26 +0200)]
Rollup merge of #53025 - ljedrz:debug_asserts_limited, r=varkor
Consider changing assert! to debug_assert! when it calls visit_with
The perf run from #52956 revealed that there were 3 benchmarks that benefited most from changing `assert!`s to `debug_assert!`s:
- issue #46449: avg -4.7% for -check
- deeply-nested (AKA #38528): avg -3.4% for -check
- regression #31157: avg -3.2% for -check
I analyzed their fixing PRs and decided to look for potentially heavy assertions in the files they modified. I noticed that all of the non-trivial ones contained indirect calls to `visit_with()`.
It might be a good idea to consider changing `assert!` to `debug_assert!` in those places in order to get the performance wins shown by the benchmarks.
Guillaume Gomez [Sun, 12 Aug 2018 21:26:49 +0000 (23:26 +0200)]
Rollup merge of #53019 - ljedrz:bad_collects, r=estebank
Don't collect() when size_hint is useless
This adjusts PRs #52738 and #52697 by falling back to calculating capacity and extending or pushing in a loop where `collect()` can't be trusted to calculate the right capacity.
Guillaume Gomez [Sun, 12 Aug 2018 21:26:48 +0000 (23:26 +0200)]
Rollup merge of #52955 - tromey:compiler-test-docs, r=nikomatsakis
Update compiler test documentation
Update the compiler test documentation to document ignore-gdb-version
and min-system-llvm-version; and expand the min-gdb-version,
min-lldb-version, and min-llvm-version documentation a little.
varkor [Sat, 4 Aug 2018 01:23:21 +0000 (02:23 +0100)]
Emit error for pattern arguments in trait methods
The error and check for this already existed, but the parser didn't try to parse trait method arguments as patterns, so the error was never emitted. This surfaces the error, so we get better errors than simple parse errors.
Corey Farwell [Sat, 11 Aug 2018 18:09:59 +0000 (14:09 -0400)]
Add links to std::char::REPLACEMENT_CHARACTER from docs.
There are a few places where we mention the replacement character in the
docs, and it could be helpful for users to utilize the constant which is
available in the standard library, so let’s link to it!
bors [Fri, 10 Aug 2018 19:18:22 +0000 (19:18 +0000)]
Auto merge of #53177 - nikomatsakis:nll-redundant-borrows-and-escaping-values, r=pnkfelix
optimize redundant borrows and escaping paths in NLL
This builds on https://github.com/rust-lang/rust/pull/53168 and adds a commit that addresses https://github.com/rust-lang/rust/issues/53176 -- or at least I think it does. I marked this as WIP because I want to see the test results (and measure the performance). I also want to double check we're not adding in any unsoundness here.
memoryruins [Fri, 10 Aug 2018 10:31:10 +0000 (06:31 -0400)]
[nll] librustc_codegen_llvm: change Child signature to fix error pointed out by nll
As explained by eddyb in #53221, "An &ArchiveChild doesn't point into the archive itself, it points to an owned object that itself points to the archive, and LLVMRustArchiveMemberNew copies the ArchiveChild (whereas the current signature suggests it keeps the &ArchiveChild)."
bors [Fri, 10 Aug 2018 00:14:52 +0000 (00:14 +0000)]
Auto merge of #53073 - Mark-Simulacrum:data-structures, r=pnkfelix
Cleanup to librustc::session and related code
No functional changes, just some cleanup.
This also creates the `rustc_fs_util` crate, but I can remove that change if desired. It felt a little odd to force crates to depend on librustc for some fs utilities; and also seemed good to generally keep the size of librustc lower (for compile times); fs_util will compile in parallel with essentially the first crate since it has no dependencies beyond std.
With this change (just the `help` was added):
```
error[E0594]: cannot assign to immutable indexed content
--> index-error.rs:7:5
|
7 | map["peter"] = 27;
| ^^^^^^^^^^^^^^^^^ cannot borrow as mutable
|
= help: trait `IndexMut` is required to modify indexed content, but it is not implemented for std::collections::HashMap<&str, i32>
```
---
Yesterday I did some pair programming with a Rust-beginner. We created a type and implemented `Index` for it. Trying to modify the value returned by the index operation returns in a rather vague error that was not very clear for the Rust beginner. So I tried to improve the situation.
## Notes/questions for reviewers:
- Is the formulation OK like that? I'm fine with changing it.
- Can we be absolutely sure that `IndexMut` is actually not implemented in the case my `help` message is added? I'm fairly sure myself, but there could be some cases I didn't think of. Also, I don't know the compiler very well, so I don't know what exactly certain enum variants are used for.
- It would be nice to test if `IndexMut` is in fact not implemented for the type, but I couldn't figure out how to check that. If you think that additional check would be beneficial, could you tell me how to check if a trait is implemented?
- Do you think I should change the error message instead of only adding an additional help message?
bors [Thu, 9 Aug 2018 19:05:14 +0000 (19:05 +0000)]
Auto merge of #53216 - kennytm:rollup, r=kennytm
Rollup of 15 pull requests
Successful merges:
- #52773 (Avoid unnecessary pattern matching against Option and Result)
- #53082 (Fix doc link (again))
- #53094 (Automatically expand section if url id point to one of its component)
- #53106 (atomic ordering docs)
- #53110 (Account for --remap-path-prefix in save-analysis)
- #53116 (NetBSD: fix signedess of char)
- #53179 (Whitelist wasm32 simd128 target feature)
- #53183 (Suggest comma when missing in macro call)
- #53207 (Add individual docs for rotate_{left, right})
- #53211 ([nll] enable feature(nll) on various crates for bootstrap)
- #53214 ([nll] enable feature(nll) on various crates for bootstrap: part 2)
- #53215 (Slightly refactor syntax_ext/format)
- #53217 (inline some short functions)
- #53219 ([nll] enable feature(nll) on various crates for bootstrap: part 3)
- #53222 (A few cleanups for rustc_target)
kennytm [Thu, 9 Aug 2018 17:04:10 +0000 (01:04 +0800)]
Rollup merge of #53222 - ljedrz:cleanup_rustc_target, r=Mark-Simulacrum
A few cleanups for rustc_target
- remove redundant struct field names
- shorten a self-assignment
- prefer `unwrap_or_else` in case of function calls
- collapse an `if`
- collapse a double `map()`
- match on dereferenced objects
- consume `self` if it implements `Copy`
kennytm [Thu, 9 Aug 2018 17:03:45 +0000 (01:03 +0800)]
Rollup merge of #53215 - ljedrz:refactor_format, r=estebank
Slightly refactor syntax_ext/format
expand_preparsed_format_args:
- move a potential error `return` earlier in the processing
- pre-allocate some of the required space for `cx.pieces` and `cx.str_pieces`
- create `cx`-independent objects before `cx`
- build `pieces` and `errs` using `collect` instead of a `push` loop
describe_num_args:
- return `Cow<str>` instead of `String`
kennytm [Thu, 9 Aug 2018 08:58:49 +0000 (16:58 +0800)]
Rollup merge of #53183 - estebank:println-comma, r=oli-obk
Suggest comma when missing in macro call
When missing a comma in a macro call, suggest it, regardless of
position. When a macro call doesn't match any of the patterns, check
if the call's token stream could be missing a comma between two idents,
and if so, create a new token stream containing the comma and try to
match against the macro patterns. If successful, emit the suggestion.
This works on arbitrary macros, with no need of special support from
the macro writers.
```
error: no rules expected the token `d`
--> $DIR/missing-comma.rs:26:18
|
LL | foo!(a, b, c d, e);
| -^
| |
| help: missing comma here
```
Follow up to #52397.
bors [Thu, 9 Aug 2018 13:20:14 +0000 (13:20 +0000)]
Auto merge of #53031 - michaelwoerister:cross-lto, r=alexcrichton
Apply some fixes to cross-language LTO (especially when targeting MSVC)
This PR contains a few fixes that were needed in order to get Firefox compiling with Rust/C++ cross-language ThinLTO on Windows. The commits are self-contained and should be self-explanatory.