Rollup merge of #63399 - estebank:vec-in-pat, r=Centril
More explicit diagnostic when using a `vec![]` in a pattern
```
error: unexpected `(` after qualified path
--> $DIR/vec-macro-in-pattern.rs:3:14
|
LL | Some(vec![x]) => (),
| ^^^^^^^
| |
| unexpected `(` after qualified path
| in this macro invocation
| use a slice pattern here instead
|
= help: for more information, see https://doc.rust-lang.org/edition-guide/rust-2018/slice-patterns.html
= note: this warning originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)
```
Rollup merge of #63337 - estebank:break-ee0308, r=Centril
Tweak mismatched types error
- Change expected/found for type mismatches in `break`
- Be more accurate when talking about diverging match arms
- Tweak wording of function without a return value
- Suggest calling bare functions when their return value can be coerced to the expected type
- Give more parsing errors when encountering `foo(_, _, _)`
Fix #51767, fix #62677, fix #63136, cc #37384, cc #35241, cc #51669.
Rollup merge of #63056 - petrochenkov:macstd2, r=alexcrichton
Give built-in macros stable addresses in the standard library
Continuation of https://github.com/rust-lang/rust/pull/62086.
Derive macros corresponding to traits from libcore are now available through the same paths as those traits:
- `Clone` - `{core,std}::clone::Clone`
- `PartialEq` - `{core,std}::cmp::PartialEq`
- `Eq` - `{core,std}::cmp::Eq`
- `PartialOrd` - `{core,std}::cmp::PartialOrd`
- `Ord` - `{core,std}::cmp::Ord`
- `Default` - `{core,std}::default::Default`
- `Debug` - `{core,std}::fmt::Debug`
- `Hash` - `{core,std}::hash::Hash`
- `Copy` - `{core,std}::marker::Copy`
Fn-like built-in macros are now available through libcore and libstd's root module, by analogy with non-builtin macros defined by libcore and libstd:
```rust
{core,std}::{
__rust_unstable_column,
asm,
assert,
cfg,
column,
compile_error,
concat,
concat_idents,
env,
file,
format_args,
format_args_nl,
global_asm,
include,
include_bytes,
include_str,
line,
log_syntax,
module_path,
option_env,
stringify,
trace_macros,
}
```
Derive macros without a corresponding trait in libcore or libstd are still available only through prelude (also see https://github.com/rust-lang/rust/pull/62507).
Attribute macros also keep being available only through prelude, mostly because they don't have an existing practice to follow. An advice from the library team on their eventual placement would be appreciated.
```rust
RustcDecodable,
RustcEncodable,
bench,
global_allocator,
test,
test_case,
```
Esteban Küber [Fri, 9 Aug 2019 01:24:00 +0000 (18:24 -0700)]
More explicit diagnostic when using a `vec![]` in a pattern
```
error: unexpected `(` after qualified path
--> $DIR/vec-macro-in-pattern.rs:3:14
|
LL | Some(vec![x]) => (),
| ^^^^^^^
| |
| unexpected `(` after qualified path
| in this macro invocation
| use a slice pattern here instead
|
= help: for more information, see https://doc.rust-lang.org/edition-guide/rust-2018/slice-patterns.html
= note: this warning originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)
```
bors [Fri, 9 Aug 2019 12:14:57 +0000 (12:14 +0000)]
Auto merge of #63408 - Centril:rollup-skqrez3, r=Centril
Rollup of 7 pull requests
Successful merges:
- #62672 (Deprecate `try!` macro)
- #62950 (Check rustbook links on all platforms when running locally)
- #63114 (Remove gensym in format_args)
- #63397 (Add tests for some ICEs)
- #63403 (Improve test output)
- #63404 (enable flt2dec tests in Miri)
- #63407 (reduce some test sizes in Miri)
Rollup merge of #63114 - matthewjasper:hygienic-format-args, r=petrochenkov
Remove gensym in format_args
This also fixes some things to allow us to export opaque macros from libcore:
* Don't consider items that are only reachable through opaque macros as public/exported (so they aren't linted as needing docs)
* Mark private items reachable from the root of libcore as unstable - they are now reachable (in principle) in other crates via macros in libcore
bors [Thu, 8 Aug 2019 23:39:01 +0000 (23:39 +0000)]
Auto merge of #63395 - Centril:rollup-kt805cj, r=Centril
Rollup of 6 pull requests
Successful merges:
- #63162 (Miri tests: use xargo to build separate libstd)
- #63289 (Don't recommend `extern crate` syntax)
- #63373 (gitignore: add comment explaining policy)
- #63374 (move of packed fields might or might not occur when they actually are sufficiently aligned)
- #63381 (reduce visibility)
- #63387 (Test interaction between `async { ... }` and `?`, `return`, and `break`)
Rollup merge of #63387 - Centril:async-block-control-flow-tests, r=cramertj
Test interaction between `async { ... }` and `?`, `return`, and `break`
Per the second checkbox in https://github.com/rust-lang/rust/issues/62121#issuecomment-506884048, test that `async { .. }` blocks:
1. do not allow `break` expressions.
2. get targeted by `return` and not the parent function.
3. get targeted by `?` and not the parent function.
Rollup merge of #63374 - RalfJung:pin-packed, r=cramertj
move of packed fields might or might not occur when they actually are sufficiently aligned
See https://github.com/taiki-e/pin-project/pull/34, where it was pointed out that we actually don't move fields of 1-aligned types when dropping a packed struct -- but e.g. in a `packed(2)` struct, we don't do something similar for 2-aligned types. The code for that is [here](https://github.com/rust-lang/rust/blob/db7c773a6be2f050d1d1504763819ea3916f5428/src/librustc_mir/util/alignment.rs#L7).
Rollup merge of #63373 - RalfJung:gitignore, r=alexcrichton
gitignore: add comment explaining policy
Based on https://github.com/rust-lang/rust/pull/63307#issuecomment-518539503, I added a comment what I think should be gitignored and what not. This is just a proposal, obviously. Also see https://github.com/rust-lang/rust/pull/53768 for some more discussion.
The summary is that if there are junk files that you create locally and are fine leaving around (such as `mir_dump`), git has the option for you to add them to `.git/info/exclude`. Others might prefer to keep their working dir clean of those same junk files, so we shouldn't just ignore them for everyone.
I then also cleaned up a few more things, but there were many things that I had no idea where they came from so I didn't touch them.
Rollup merge of #63162 - RalfJung:miri-xargo, r=alexcrichton
Miri tests: use xargo to build separate libstd
This uses `cargo miri setup` to prepare the libstd that is used for testing Miri, instead of adjusting the entire bootstrap process to make sure the libstd that already gets built is fit for Miri.
The issue with our current approach is that with `test-miri = true`, libstd and the test suite get built with `--cfg miri`, which e.g. means hashbrown uses no SIMD, and not all things are tested. Such global side-effects seem like footguns waiting to go off.
On the other hand, the new approach means we install xargo as a side-effect of doing `./x.py test src/tools/miri`, which might be surprising, and we also both have to build xargo and another libstd which costs some extra time. Not sure if the tools builders have enough time budget for that. Maybe there is a way to cache xargo?
We have to first first land https://github.com/rust-lang/miri/pull/870 in Miri and then update this PR to include that change (also to get CI to test Miri before bors), but I wanted to get the review started here.
Cc @oli-obk (for Miri) @alexcrichton (for CI) @Mark-Simulacrum (for bootstrap)
bors [Thu, 8 Aug 2019 17:19:22 +0000 (17:19 +0000)]
Auto merge of #63380 - Centril:rollup-tzfhtnu, r=Centril
Rollup of 8 pull requests
Successful merges:
- #63261 (bump rand in libcore/liballoc test suites)
- #63316 (Update rustfmt to 1.4.4)
- #63332 (Add an overflow check in truncate implementation for Unix.)
- #63342 (Don't use remap-path-prefix in dep-info files.)
- #63366 (doc: Fix typo in float from bytes methods)
- #63370 (Fix ICE #63364)
- #63377 (Improved documentation for compile_error!())
- #63379 (Add test for issue 53096)
Rollup merge of #63342 - ehuss:remap-path-dep-info, r=alexcrichton
Don't use remap-path-prefix in dep-info files.
This changes it so that dep-info files do not use remapped paths.
Having remapped paths causes problems with Cargo because if you remap to a nonexistent path (like `/rustc/$HASH` which rustc distributions do), then Cargo's change tracking thinks the files don't exist and will always rebuild.
I don't actually know if this is a good idea. I think it makes sense, but I do not know what the exact requirements are for reproducible builds. I consider these files separate from the binary artifacts generated, and as a build-system helper, so it seems reasonable to me.
I'm also not sure if this needs a test. I'll definitely add one on the cargo side if this is merged.
Rollup merge of #63261 - RalfJung:rand, r=nikomatsakis
bump rand in libcore/liballoc test suites
This pulls in the fix for https://github.com/rust-random/rand/issues/779, which trips Miri when running these test suites.
`SmallRng` (formerly used by libcore) is no longer built by default, it needs a feature gate. I opted to switch to `StdRng` instead. Or should I enable the feature gate?
5 commits in 8e7d614303b0dec7492e048e63855fcd3b944ec8..b4b3536839042a6743fc76f0d9ad2a812020aeaa
2019-07-16 21:02:33 +0100 to 2019-08-07 02:29:50 +0200
- Update partially initialized values in drop documentation. (rust-lang-nursery/reference#648)
- Define sound and unsound (rust-lang-nursery/reference#647)
- Fix a type in the modules section: functions => modules (rust-lang-nursery/reference#645)
- Fix some links. (rust-lang-nursery/reference#642)
- Update recursion_limit default limit (rust-lang-nursery/reference#633)
## rust-by-example
14 commits in e3679e214d8db44586aca9b20aa27517007d1923..f2c15ba5ee89ae9469a2cf60494977749901d764
2019-07-15 11:13:44 -0300 to 2019-08-07 10:14:25 -0300
- Remove redundant semicolons (rust-lang/rust-by-example#1239)
- Rename "Read Lines" chapter title (rust-lang/rust-by-example#1230)
- Added space between word and inline code block in unit_testing.md (rust-lang/rust-by-example#1237)
- [typo] fix unit_testing wrong output (rust-lang/rust-by-example#1210)
- flow_control/match/binding.md: `...' -> `..=' (rust-lang/rust-by-example#1233)
- generics/impl.md: follow rustfmt style (rust-lang/rust-by-example#1236)
- freeze.md: Incorrect example (rust-lang/rust-by-example#1226)
- Make `point` consistent (rust-lang/rust-by-example#1229)
- Fix typo at error -> panic (rust-lang/rust-by-example#1227)
- Snake didn't deserve to die 🐍 (rust-lang/rust-by-example#1228)
- Reorder links in destructuring.md (rust-lang/rust-by-example#1225)
- Rename variable names for consistent in iter_result.md (rust-lang/rust-by-example#1224)
- Fix several shell output and code highlights. (rust-lang/rust-by-example#1222)
- Add new example for Rc. (rust-lang/rust-by-example#1223)
## edition-guide
5 commits in f6c8b92d4e63edd28e862be952f33861f35956f8..e58bc4ca104e890ac56af846877c874c432a64b5
2019-07-06 22:10:32 +0200 to 2019-07-31 20:14:12 +0200
- Hide extraneous `use` in anonymous lifetime example. (rust-lang-nursery/edition-guide#190)
- Attempt to clarify "no more mod.rs". (rust-lang-nursery/edition-guide#187)
- Remove -preview for rustup components. (rust-lang-nursery/edition-guide#188)
- rust-lang-nursery/edition-guide#184 More clear explanation and Title. (rust-lang-nursery/edition-guide#185)
- More clear table headers (rust-lang-nursery/edition-guide#186)