Rollup merge of #63449 - petrochenkov:builtinagain, r=eddyb
resolve: Remove remaining special cases from built-in macros
Edition and definition sites of the macros are now also taken from the `#[rustc_builtin_macro]` definitions in `libcore`.
---
The edition switch may be a breaking change for `Rustc{Encodable,Decodable}` derives if they are used in combination with the unstable crate `serialize` from sysroot like this
```rust
extern crate serialize;
use serialize as rustc_serialize;
#[derive(RustcEncodable)]
struct S;
```
(see the updated `ui-fulldeps` tests).
Rollup merge of #63406 - jakubadamw:resolve-inconsistent-names-suggest-qualified-path, r=petrochenkov
Suggest using a qualified path in patterns with inconsistent bindings
A program like the following one:
```rust
enum E { A, B, C }
fn f(x: E) -> bool {
match x {
A | B => false,
C => true
}
}
```
is rejected by the compiler due to `E` variant paths not being in scope.
In this case `A`, `B` are resolved as pattern bindings and consequently
the pattern is considered invalid as the inner or-patterns do not bind
to the same set of identifiers.
This is expected but the compiler errors that follow could be surprising
or confusing to some users. This commit adds a help note explaining that
if the user desired to match against variants or consts, they should use
a qualified path. The help note is restricted to cases where the identifier
starts with an upper-case sequence so as to reduce the false negatives.
Since this happens during resolution, there's no clean way to check what
it is the patterns match against. The syntactic criterium, however, is in line
with the convention that's assumed by the `non-camel-case-types` lint.
bors [Sun, 11 Aug 2019 22:53:30 +0000 (22:53 +0000)]
Auto merge of #63472 - Xanewok:update-rls, r=Mark-Simulacrum
Update RLS
This update includes the ability to warn on deprecated config keys.
It's important to be able to warn the user whenever they're using
an old configuration rather than giving them a cryptic "unknown
configuration error"
cc https://github.com/rust-lang/rls-vscode/issues/639
Since we removed a config value in the current nightly, it'd be
very good if this change can make also make it before cutting the
next release.
bors [Sun, 11 Aug 2019 19:19:33 +0000 (19:19 +0000)]
Auto merge of #63471 - Mark-Simulacrum:rollup-m756lnx, r=Mark-Simulacrum
Rollup of 8 pull requests
Successful merges:
- #61969 (Add #[repr(transparent)] for several types)
- #63346 (Lint on some incorrect uses of mem::zeroed / mem::uninitialized)
- #63433 (Miri shouldn't look at types)
- #63440 (rename RUST_CTFE_BACKTRACE to RUSTC_CTFE_BACKTRACE)
- #63441 (Derive Debug for CrateInfo)
- #63442 (Add an example to show how to insert item to a sorted vec)
- #63453 (rustdoc: general cleanup)
- #63464 (Copy ty::Instance instead of passing by reference)
Mark Rousskov [Sun, 11 Aug 2019 19:18:40 +0000 (15:18 -0400)]
Rollup merge of #63346 - RalfJung:zeroed-lint, r=eddyb
Lint on some incorrect uses of mem::zeroed / mem::uninitialized
Cc https://github.com/rust-lang/rust/issues/62825 and https://internals.rust-lang.org/t/make-mem-uninitialized-and-mem-zeroed-panic-for-some-types-where-0-is-a-niche/10605
This does not yet handle `NonNull`/`NonZero*`, but it is a start.
I also improved some doc issues I hit on the way, and added a useful helper to `TyS`.
EDIT: I added the relnotes label mostly as a proposal -- I think this is worth mentioning, but leave the decision up to the release team.
Mark Rousskov [Sun, 11 Aug 2019 19:18:38 +0000 (15:18 -0400)]
Rollup merge of #61969 - MikailBag:master, r=Centril
Add #[repr(transparent)] for several types
In some functions, types mentioned in this PR are transmuted into their inner value.
Example for `PathBuf`: https://github.com/rust-lang/rust/blob/master/src/libstd/path.rs#L1132.
This PR adds `#[repr(transparent)]` to those types, so their correct behavior doesn't depend on compiler details. (As far as I understand, currently that line, converting `PathBuf` to `Vec<u8>`, is UB).
Igor Matuszewski [Sun, 11 Aug 2019 19:10:16 +0000 (21:10 +0200)]
Update RLS
This update includes the ability to warn on deprecated config keys.
It's important to be able to warn the user whenever they're using
an old configuration rather than giving them a cryptic "unknown
configuration error"
cc https://github.com/rust-lang/rls-vscode/issues/639
Since we removed a config value in the current nightly, it'd be
very good if this change can make also make it before cutting the
next release.
Mark Rousskov [Sat, 10 Aug 2019 22:27:17 +0000 (18:27 -0400)]
Remove fmt::Display impls on Markdown structs
These impls prevent ergonomic use of the config (e.g., forcing us to use
RefCell) despite all usecases for these structs only using their Display
impls once.
Mark Rousskov [Sat, 10 Aug 2019 19:20:21 +0000 (15:20 -0400)]
Remove ReentrantMutex
This drops the parking_lot dependency; the ReentrantMutex type appeared
to be unused (at least, no compilation failures occurred).
This is technically a possible change in behavior of its users, as
lock() would wait on other threads releasing their guards, but since we
didn't actually remove any threading or such in this code, it appears
that we never used that behavior (the behavior change is only noticeable
if the type previously was used in two threads, in a single thread
ReentrantMutex is useless).
bors [Sun, 11 Aug 2019 13:37:37 +0000 (13:37 +0000)]
Auto merge of #63446 - Centril:refactor-lowering, r=oli-obk
Refactor and categorize lowering wrt. items / exprs
Split lowering into more files along the lines of "expression related" and "item related".
Also refactor huge methods into smaller ones.
A next step might be to introduce "type related" and merge patterns and statements combined with expressions into "value related". There's still more work to do but the PR was getting too big :)
bors [Sun, 11 Aug 2019 02:05:40 +0000 (02:05 +0000)]
Auto merge of #63413 - RalfJung:miri, r=oli-obk
update Miri
With https://github.com/rust-lang/rust/pull/63404 landed, we need https://github.com/rust-lang/miri/pull/898 to avoid failures in https://github.com/RalfJung/miri-test-libstd.
Suggest using a qualified path in patterns with inconsistent bindings
A program like the following one:
```rust
enum E { A, B, C }
fn f(x: E) -> bool {
match x {
A | B => false,
C => true
}
}
```
is rejected by the compiler due to `E` variant paths not being in scope.
In this case `A`, `B` are resolved as pattern bindings and consequently
the pattern is considered invalid as the inner or-patterns do not bind
to the same set of identifiers.
This is expected but the compiler errors that follow could be surprising
or confusing to some users. This commit adds a help note explaining that
if the user desired to match against variants or consts, they should use
a qualified path. The note is restricted to cases where the identifier
starts with an upper-case sequence so as to reduce the false negatives.
Since this happens during resolution, there's no clean way to check what
the patterns match against. The syntactic criterium, however, is in line
with the convention that's assumed by the `non-camel-case-types` lint.
Rollup merge of #63432 - Centril:simplify-lowering, r=eddyb
Cleanup & Simplify stuff in lowering
Closes https://github.com/rust-lang/rust/issues/60253 as a byproduct.
It turns out that it is in fact necessary to have a `DropTemps(...)` around the `match_expr` and there is a test (https://github.com/rust-lang/rust/blob/master/src/test/ui/issues/issue-13304.rs) which fails without that.
Rollup merge of #63429 - rust-lang:gitignore-readd-tmp, r=Mark-Simulacrum
.gitignore: Readd `/tmp/`
Specifically, `/tmp/partitioning-tests/` it is generated by the incremental tests, https://github.com/rust-lang/rust/search?p=2&q=partitioning-tests&unscoped_q=partitioning-tests. These are cleaned up by compiletest but not if you kill testing prematurely (which I just did to test out a rollup, and it is annoying to `rm -rf tmp/`).