Commit Graph

98126 Commits

Author SHA1 Message Date
Nathan
76a1345242 Update tests for excess semicolon lint 2019-08-12 10:14:07 -04:00
Nathan
2f6cb5f75e Add lint for excess trailing semicolons 2019-08-12 10:14:07 -04:00
nathanwhit
71415ef9bd Parse excess semicolons as empty stmts for linting 2019-08-12 10:14:07 -04:00
Martin Finkel
c9da160aad review feedback: move uwp link code to get_linker 2019-08-12 15:07:23 +02:00
bors
60960a260f Auto merge of #63483 - RalfJung:invalid-value, r=Centril
Improve invalid_value lint message

The lint now explains which type is involved and why it cannot be initialized this way. It also points at the innermost struct/enum field that has an offending type, if any.

See https://github.com/erlepereira/x11-rs/issues/99#issuecomment-520311911 for how this helps in some real-world code hitting this lint.
2019-08-12 12:43:33 +00:00
Eduard-Mihai Burtescu
34dcca20e5 syntax: account for CVarArgs being in the argument list. 2019-08-12 15:28:10 +03:00
Igor Matuszewski
5124f34e50 Update RLS
This fixes handling default configuration for the `crate_blacklist`
RLS configuration.

Technically this isn't needed, as the VS Code extension can be
configured to accept a predefined blacklist that's equal to the default
one but it's best that it also lands so that we don't need to work
around that.

cc https://github.com/rust-lang/rust/pull/63472
2019-08-12 13:59:50 +02:00
Mazdak Farrokhzad
c8fc4c106c extract parse_pat_{tuple_}struct + recover_one_fewer_dotdot 2019-08-12 12:50:44 +02:00
Mazdak Farrokhzad
ddf734deb2 extract fatal_unexpected_non_pat 2019-08-12 12:50:44 +02:00
Mazdak Farrokhzad
37f37a5df1 parser/pat: minor misc cleanup 2019-08-12 12:50:44 +02:00
Mazdak Farrokhzad
49740b792d extract parse_pat_range_starting_with_lit 2019-08-12 12:50:44 +02:00
Mazdak Farrokhzad
e6f980f9b8 extract parse_pat_range_starting_with_path 2019-08-12 12:50:44 +02:00
Mazdak Farrokhzad
e32bd69d0f extract parse_pat_mac_invoc 2019-08-12 12:50:44 +02:00
Mazdak Farrokhzad
231da7e044 extract ban_pat_range_if_ambiguous 2019-08-12 12:50:44 +02:00
Mazdak Farrokhzad
3b651330e0 extract recover_pat_ident_mut_first 2019-08-12 12:50:44 +02:00
Observer42
e30480ca86
Apply suggestions from code review
Co-Authored-By: Mazdak Farrokhzad <twingoow@gmail.com>
2019-08-12 18:07:14 +08:00
Ralf Jung
0499923b18 more informative error message from invalid_value lint 2019-08-12 11:23:56 +02:00
bors
c01be67ea4 Auto merge of #63489 - Centril:rollup-uuf6z1s, r=Centril
Rollup of 9 pull requests

Successful merges:

 - #62108 (Use sharded maps for queries)
 - #63297 (Improve pointer offset method docs)
 - #63406 (Suggest using a qualified path in patterns with inconsistent bindings)
 - #63431 (Revert "Simplify MIR generation for logical ops")
 - #63449 (resolve: Remove remaining special cases from built-in macros)
 - #63461 (docs: add stdlib env::var(_os) panic)
 - #63473 (Regression test for #56870)
 - #63474 (Add tests for issue #53598 and #57700)
 - #63480 (Fixes #63477)

Failed merges:

r? @ghost
2019-08-12 08:58:48 +00:00
Mazdak Farrokhzad
9d297190c8
Rollup merge of #63480 - OptimisticPeach:patch-1, r=Centril
Fixes #63477

Adds a closing parenthesis.
2019-08-12 10:58:24 +02:00
Mazdak Farrokhzad
7bdff66d35
Rollup merge of #63474 - adamAndMath:master, r=Centril
Add tests for issue #53598 and #57700

Closes #53598 and #57700
2019-08-12 10:58:22 +02:00
Mazdak Farrokhzad
58ac2b2b6b
Rollup merge of #63473 - adrian-budau:master, r=Centril
Regression test for #56870

Closes #56870.
2019-08-12 10:58:21 +02:00
Mazdak Farrokhzad
4d27aaccf1
Rollup merge of #63461 - tommilligan:doc-var-panic, r=joshtriplett
docs: add stdlib env::var(_os) panic

Closes #63456
2019-08-12 10:58:19 +02:00
Mazdak Farrokhzad
33f53d699c
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).
2019-08-12 10:58:18 +02:00
Mazdak Farrokhzad
e19ce5d16a
Rollup merge of #63431 - andjo403:revert_mir_simplification, r=matthewjasper
Revert "Simplify MIR generation for logical ops"

This reverts commit e38e954a0d.

llvm were not able to optimize the code that well with the simplified mir.

Closes: #62993
2019-08-12 10:58:16 +02:00
Mazdak Farrokhzad
ab2d7e9a50
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.

Fixes #50831.
2019-08-12 10:58:15 +02:00
Mazdak Farrokhzad
e9615f2487
Rollup merge of #63297 - RalfJung:ptr_offset, r=dtolnay
Improve pointer offset method docs

Cc @rkruppe @gnzlbg
2019-08-12 10:58:13 +02:00
Mazdak Farrokhzad
0b4823de23
Rollup merge of #62108 - Zoxc:sharded-queries, r=oli-obk
Use sharded maps for queries

Based on https://github.com/rust-lang/rust/pull/61779.

r? @Gankro
2019-08-12 10:58:12 +02:00
Ralf Jung
fecf305867 DiagnosticBuilder docs 2019-08-12 10:53:09 +02:00
Ilija Tovilo
91af5c2daf
Bring back suggestion for splitting <- into < -
Closes #62632
2019-08-12 10:46:34 +02:00
Pietro Albini
eb832b2a32
ci: move mirrors to their standalone bucket
Currently mirrors are stored in the rust-lang-ci2 S3 bucket along with
CI toolchains. This is problematic for multiple reasons:

- CI IAM credentials are allowed to both edit and delete those files.
  A malicious user gaining access to those credentials would be able to
  change our mirrored dependencies, possibly backdooring the compiler.

- Contents of the rust-lang-ci2 bucket are disposable except for the
  mirrors' content. When we implement backups for S3 buckets we'd have
  to replicate just that part of the bucket, complicating the backup
  logic and increasing the chance of mistakes. A standalone bucket will
  be way easier to backup.

This commit switches our CI to use the new rust-lang-ci-mirrors bucket.
2019-08-12 10:31:35 +02:00
Observer42
fa7a40cc6e Document From trait for BinaryHeap 2019-08-12 16:07:13 +08:00
Mazdak Farrokhzad
c69b3ede8a extract parse_pat_tuple_or_parens 2019-08-12 09:28:49 +02:00
Mazdak Farrokhzad
90793c0f12 extract parse_pat_deref 2019-08-12 09:28:49 +02:00
Mazdak Farrokhzad
a4af9d1ac2 parse_pat_with_range_pat: remove unnecessary assignments. 2019-08-12 09:28:49 +02:00
OptimisticPeach
3d38187afd
Fixes #63477
Adds a closing parenthesis.
2019-08-12 00:15:14 -04:00
bors
72f8043d44 Auto merge of #63469 - Centril:refactor-parser, r=petrochenkov
libsyntax: Refactor `parser.rs` into reasonably sized logical units

Here we split `parser.rs` (~7.9 KLOC) into more reasonably sized files (all < 1.8 KLOC):

- `./src/libsyntax/parse/`
   - `parser.rs`
   - `parser/`
      - `pat.rs`
      - `expr.rs`
      - `stmt.rs`
      - `ty.rs`
      - `path.rs`
      - `generics.rs`
      - `item.rs`
      - `module.rs`

Closes https://github.com/rust-lang/rust/issues/60015.

r? @petrochenkov
2019-08-12 02:35:55 +00:00
bors
899efd5108 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.
2019-08-11 22:53:30 +00:00
Adam
5981dfffba Move tests into type-alias-impl-trait 2019-08-11 22:30:21 +02:00
Adam
6ed4a42fcf Add test for issue 53598 and 57700 2019-08-11 22:17:28 +02:00
Adrian Budau
75d2db97fe
Regression test for #56870 2019-08-11 23:02:47 +03:00
bors
00ee1b47f4 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)

Failed merges:

r? @ghost
2019-08-11 19:19:33 +00:00
Mark Rousskov
4229dc3538
Rollup merge of #63464 - Mark-Simulacrum:deref-instance, r=eddyb
Copy ty::Instance instead of passing by reference

ty::Instance is small and Copy, we should not be adding additional
indirection.

Fixes #63409.

r? @eddyb
2019-08-11 15:18:49 -04:00
Mark Rousskov
86ceab47b1
Rollup merge of #63453 - Mark-Simulacrum:rustdoc-clean-2, r=GuillaumeGomez
rustdoc: general cleanup

Almost all commits stand alone; but all commits can be reviewed individually.
2019-08-11 15:18:47 -04:00
Mark Rousskov
e16b12fd49
Rollup merge of #63442 - lzutao:vec-bin-search-insert, r=Mark-Simulacrum
Add an example to show how to insert item to a sorted vec

Closes #61684
cc #61742
r? @Mark-Simulacrum, @jonas-schievink
2019-08-11 15:18:46 -04:00
Mark Rousskov
c805a38dff
Rollup merge of #63441 - bjorn3:patch-1, r=Mark-Simulacrum
Derive Debug for CrateInfo
2019-08-11 15:18:44 -04:00
Mark Rousskov
8122a01b27
Rollup merge of #63440 - RalfJung:ctfe-backtrace, r=oli-obk
rename RUST_CTFE_BACKTRACE to RUSTC_CTFE_BACKTRACE

This matches `RUSTC_LOG`. Both affect only rustc, not any Rust program.
2019-08-11 15:18:43 -04:00
Mark Rousskov
24a83374b6
Rollup merge of #63433 - RalfJung:miri-call, r=oli-obk
Miri shouldn't look at types

r? @oli-obk

Fixes https://github.com/rust-lang/rust/issues/62137
2019-08-11 15:18:41 -04:00
Mark Rousskov
061245e2b1
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.
2019-08-11 15:18:40 -04:00
Mark Rousskov
88629778e6
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).
2019-08-11 15:18:38 -04:00
Igor Matuszewski
c8a2855442 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.
2019-08-11 21:10:16 +02:00