Commit Graph

87916 Commits

Author SHA1 Message Date
bors
36500deb1a Auto merge of #57203 - nagisa:readme, r=Mark-Simulacrum
Remove mention of required memory to build

Because it, obviously, changes all the time and 600MiB is way out-of-date now.
2019-01-01 11:47:58 +00:00
bors
7a2779a462 Auto merge of #57210 - estebank:str-err, r=zackmdavis
Tweak unicode escape diagnostics
2019-01-01 09:10:23 +00:00
bors
0432798fdb Auto merge of #57194 - matthiaskrgr:copyright_headers, r=Centril
remove more copyright headers

r? @Mark-Simulacrum
2019-01-01 06:34:11 +00:00
bors
d8371c61e6 Auto merge of #57199 - petrochenkov:ambig, r=estebank
resolve: Simplify treatment of ambiguity errors

If we have a glob conflict like this
```rust
mod m1 { struct S; }
mod m2 { struct S; }

use m1::*;
use m2::*;
```
we treat it as a special "ambiguity item" that's not an error by itself, but produces an error when actually used.
```rust
use m1::*; // primary
use m2::*; // secondary

=>

ambiguity S(m1::S, m2::S);
```

Ambiguity items were *sometimes* treated as their primary items for error recovery, but pretty irregularly.

After this PR they are always treated as their primary items, except that
- If an ambiguity item is marked as used, then it still produces an error.
- Ambiguity items are still filtered away when exported to other crates (which is also a use in some sense).
2019-01-01 02:08:39 +00:00
bors
fe6a54d220 Auto merge of #56878 - petrochenkov:privdyn, r=arielb1
privacy: Use common `DefId` visiting infrastructure for all privacy visitors

One repeating pattern in privacy checking is going through a type, visiting all `DefId`s inside it and doing something with them.
This is the case because visibilities and reachabilities are attached to `DefId`s.

Previously various privacy visitors visited types slightly differently using their own methods, with most recently written `TypePrivacyVisitor` being the "gold standard".
This mostly worked okay, but differences could manifest in overly conservative reachability analysis, some errors being reported twice, some private-in-public lints (not errors) being wrongly reported or not reported.

This PR does something that I wanted to do since https://github.com/rust-lang/rust/pull/32674#discussion_r58291608 - factoring out the common visiting logic!
Now all the common logic is contained in `struct DefIdVisitorSkeleton`, with specific privacy visitors deciding only what to do with visited `DefId`s (via `trait DefIdVisitor`).

A bunch of cleanups is also applied in the process.
This area is somewhat tricky due to lots of easily miss-able details, but thankfully it's was well covered by tests in https://github.com/rust-lang/rust/pull/46083 and previous PRs, so I'm relatively sure in the refactoring correctness.

Fixes https://github.com/rust-lang/rust/pull/56837#discussion_r241962239 in particular.
Also this will help with implementing https://github.com/rust-lang/rust/issues/48054.
2018-12-31 23:30:57 +00:00
Vadim Petrochenkov
60d1fa70bb Address review comments
Say "trait" instead of "type" in diagnostics for `dyn Trait`
2019-01-01 01:39:55 +03:00
Vadim Petrochenkov
8b1c424b6d privacy: Use common DefId visiting infra for all privacy visitors 2019-01-01 01:39:55 +03:00
bors
9eac386342 Auto merge of #57047 - euclio:field-structured-suggestions, r=estebank
use structured suggestions for nonexistent fields

r? @estebank
2018-12-31 20:56:19 +00:00
Esteban Küber
30961c958d Do not use unicode character in diagnostic help 2018-12-31 10:00:08 -08:00
Andy Russell
dfc326d0e2
use structured suggestions for nonexistent fields 2018-12-31 12:52:30 -05:00
Esteban Küber
b416f1398f Use structured suggestion for braceless unicode escape squence 2018-12-31 09:44:58 -08:00
Esteban Küber
7edc434b72 Account for \xFF and \u{FF} sequences in string format errors 2018-12-31 09:44:58 -08:00
bors
6efaef6189 Auto merge of #57220 - quark-zju:mcount, r=estebank
Add `-Z instrument-mcount`

This flag inserts `mcount` function call to the beginning of every function
after inline processing. So tracing tools like uftrace [1] (or ftrace for
Linux kernel modules) have a chance to examine function calls.

It is similar to the `-pg` flag provided by gcc or clang, but without
generating a `__gmon_start__` function for executables. If a program
runs without being traced, no `gmon.out` will be written to disk.

Under the hood, it simply adds `"instrument-function-entry-inlined"="mcount"`
attribute to every function. The `post-inline-ee-instrument` LLVM pass does
the actual job.

[1]: https://github.com/namhyung/uftrace
2018-12-31 14:30:17 +00:00
bors
433ef826f0 Auto merge of #57061 - Zoxc:graph-refactor, r=michaelwoerister
Group dep node data into a single structure

r? @michaelwoerister
2018-12-31 10:55:46 +00:00
John Kåre Alsaker
2738f2c891 Address comments 2018-12-31 09:16:06 +01:00
John Kåre Alsaker
18d6b37f2c Use entry API to avoid double lookup when interning dep nodes 2018-12-31 09:16:02 +01:00
John Kåre Alsaker
a426d47f58 Group dep node data into a single structure 2018-12-31 09:15:58 +01:00
bors
aeed63bf38 Auto merge of #57208 - estebank:issue-57198, r=petrochenkov
Do not complain about missing crate named as a keyword

Fix #57198.
2018-12-31 08:06:15 +00:00
bors
f39bd9b9cb Auto merge of #57044 - varkor:E0512-equal-type, r=matthewjasper
Add specific diagnostic when attempting to transmute between equal generic types

Also clarifies the wording of E0512.

Fixes https://github.com/rust-lang/rust/issues/49793.
2018-12-31 04:06:14 +00:00
bors
2cf7f55662 Auto merge of #57035 - Zoxc:query-pref9, r=michaelwoerister
Uninline some debugging code and use unlikely! macro

r? @michaelwoerister
2018-12-31 01:18:19 +00:00
varkor
7d5f6ceef0 Fix variable string size problem in transmute test 2018-12-30 23:45:58 +00:00
Esteban Küber
cef919e971 Address review comments: Remove new PathResult variant 2018-12-30 12:19:16 -08:00
Jun Wu
31a5066e0b Add -Z instrument-mcount
This flag inserts `mcount` function call to the beginning of every function
after inline processing. So tracing tools like uftrace [1] (or ftrace for
Linux kernel modules) have a chance to examine function calls.

It is similar to the `-pg` flag provided by gcc or clang, but without
generating a `__gmon_start__` function for executables. If a program
runs without being traced, no `gmon.out` will be written to disk.

Under the hood, it simply adds `"instrument-function-entry-inlined"="mcount"`
attribute to every function. The `post-inline-ee-instrument` LLVM pass does
the actual job.

[1]: https://github.com/namhyung/uftrace
2018-12-30 11:59:03 -08:00
bors
a2b0f247bf Auto merge of #57213 - matthiaskrgr:clippy_submodule_upd, r=oli-obk
submodules: update clippy from f7bdf500 to 39bd8449

Fixes clippy toolstate

Changes:
````
UI test cleanup: Extract iter_skip_next from methods.rs
Update test output after rebase
Remove false negatives from known problems
Implement use_self for tuple structs
Document known problems
rustup https://github.com/rust-lang/rust/pull/56225/
Remove unnecessary `use` statements after `cargo fix`
Apply cargo fix --edition-idioms fixes
Use match ergonomics for booleans lint
Use match ergonomics for block_in_if_condition lint
Use match ergonomics for bit_mask lint
Use match ergonomics for attrs lint
Use match ergonomics for assign_ops lint
Use match ergonomics for artithmetic lint
Use match ergonomics for approx_const lint
Remove crate:: prefixes from crate paths
Support array indexing expressions in unused write to a constant
Mark writes to constants as side-effect-less
Update README local run command to remove syspath
Remove unsafe from consts clippy lints
Fix formatting
Merge new_without_default_derive into new_without_default
Only print out question_mark lint when it actually triggered
Add failing test
Reinserted commata
Recomend `.as_ref()?` in certain situations
Deduplicate some code?
````
r? @oli-obk or anyone else
2018-12-30 18:49:01 +00:00
Matthias Krüger
9a1383edba submodules: update clippy from f7bdf500 to 39bd8449
Changes:
````
UI test cleanup: Extract iter_skip_next from methods.rs
Update test output after rebase
Remove false negatives from known problems
Implement use_self for tuple structs
Document known problems
rustup https://github.com/rust-lang/rust/pull/56225/
Remove unnecessary `use` statements after `cargo fix`
Apply cargo fix --edition-idioms fixes
Use match ergonomics for booleans lint
Use match ergonomics for block_in_if_condition lint
Use match ergonomics for bit_mask lint
Use match ergonomics for attrs lint
Use match ergonomics for assign_ops lint
Use match ergonomics for artithmetic lint
Use match ergonomics for approx_const lint
Remove crate:: prefixes from crate paths
Support array indexing expressions in unused write to a constant
Mark writes to constants as side-effect-less
Update README local run command to remove syspath
Remove unsafe from consts clippy lints
Fix formatting
Merge new_without_default_derive into new_without_default
Only print out question_mark lint when it actually triggered
Add failing test
Reinserted commata
Recomend `.as_ref()?` in certain situations
Deduplicate some code?
````
2018-12-30 18:16:09 +01:00
bors
953a9cf10d Auto merge of #57205 - petrochenkov:extrecov, r=estebank
Improve error recovery for some built-in macros

Fixes https://github.com/rust-lang/rust/issues/55897
2018-12-30 16:06:30 +00:00
bors
3ce6f6eca6 Auto merge of #57204 - czipperz:ord_docs_must_agree, r=sfackler
Make std::cmp::Ord documentation specify what it means to agree with ParitalEq

Resolves #57157
2018-12-30 13:24:11 +00:00
bors
7155690ffc Auto merge of #57158 - estebank:as-ref, r=zackmdavis
Suggest `.as_ref()` when appropriate for `Option` and `Result`

Fix #55198.
2018-12-30 09:51:44 +00:00
bors
0e6f8987aa Auto merge of #57195 - czipperz:mention_ToString_in_std_fmt_docs, r=SimonSapin
Mention ToString in std::fmt docs

I believe this should be added because `x.to_string()` is preferred over `format!("{}", x)` as the recommended way to convert a value to a string.  `std::fmt` and the `format` macro is where people look for documentation about this, and thus we should include references to this preferred functions there.

Resolves #55065
2018-12-30 07:12:13 +00:00
bors
171c1fc25e Auto merge of #57185 - petrochenkov:impice4, r=estebank
resolve: Fix one more ICE in import validation

So if you have an unresolved import
```rust
mod m {
    use foo::bar;
}
```
error recovery will insert a special item with `Def::Err` definition into module `m`, so other things depending on `bar` won't produce extra errors.

The issue was that erroneous `bar` was overwriting legitimate `bar`s coming from globs, e.g.
```rust
mod m {
    use baz::*; // imports real existing `bar`
    use foo::bar;
}
```
causing some unwanted diagnostics talking about "unresolved items", and producing inconsistent resolutions like https://github.com/rust-lang/rust/issues/57015.
This PR stops overwriting real successful resolutions with `Def::Err`s.

Fixes https://github.com/rust-lang/rust/issues/57015
2018-12-30 03:12:16 +00:00
Esteban Küber
5a2c301106 Do not complain about missing crate named as a keyword 2018-12-29 17:23:19 -08:00
Czipperz
56d6ff0634 Mention ToString in std::fmt docs 2018-12-29 19:17:03 -05:00
Czipperz
445dadca33 Specify criterion for PartialOrd 2018-12-29 19:14:06 -05:00
bors
a35cf79fcb Auto merge of #56843 - csmoe:non-copy, r=davidtwco
Add a note describing the type of the non-Copy moved variable

Closes #56654
r?@davidtwco
2018-12-29 23:45:45 +00:00
Czipperz
cf3959c5b0 Make std::cmp::Ord documentation specify what it means to agree with PartialEq 2018-12-29 17:48:43 -05:00
Vadim Petrochenkov
df4690ddf4 Improve error recovery for some built-in macros 2018-12-30 01:43:35 +03:00
Simonas Kazlauskas
087083e8a4 Remove mention of required memory to build
Because it, obviously, changes all the time and 600MiB is way
out-of-date now.
2018-12-30 00:17:31 +02:00
bors
59183180f7 Auto merge of #56225 - alexreg:type_alias_enum_variants, r=petrochenkov
Implement RFC 2338, "Type alias enum variants"

This PR implements [RFC 2338](https://github.com/rust-lang/rfcs/pull/2338), allowing one to write code like the following.

```rust
#![feature(type_alias_enum_variants)]

enum Foo {
    Bar(i32),
    Baz { i: i32 },
}

type Alias = Foo;

fn main() {
    let t = Alias::Bar(0);
    let t = Alias::Baz { i: 0 };
    match t {
        Alias::Bar(_i) => {}
        Alias::Baz { i: _i } => {}
    }
}
```

Since `Self` can be considered a type alias in this context, it also enables using `Self::Variant` as both a constructor and pattern.

Fixes issues #56199 and #56611.

N.B., after discussing the syntax for type arguments on enum variants with @petrochenkov and @eddyb (there are also a few comments on the [tracking issue](https://github.com/rust-lang/rust/issues/49683)), the consensus seems to be treat the syntax as follows, which ought to be backwards-compatible.

```rust
Option::<u8>::None; // OK
Option::None::<u8>; // OK, but lint in near future (hard error next edition?)
Alias::<u8>::None; // OK
Alias::None::<u8>; // Error
```

I do not know if this will need an FCP, but let's start one if so.
2018-12-29 21:03:11 +00:00
Esteban Küber
0ecc128ccb Use same_type instead of duplicating logic 2018-12-29 10:54:32 -08:00
bors
007115746c Auto merge of #57197 - kennytm:rollup, r=kennytm
Rollup of 7 pull requests

Successful merges:

 - #57149 (Fix typo in pin documentation)
 - #57153 (Small: Fix span in char documentation)
 - #57159 (Update references to closed issue)
 - #57163 (Give the crate select chevron room to breathe.)
 - #57168 (Removed aligned ZST requirement from docs of read_/write_unaligned.)
 - #57174 (Update link to rustc guide)
 - #57177 (Fix warning when compiling rustc)

Failed merges:

r? @ghost
2018-12-29 18:12:57 +00:00
Vadim Petrochenkov
06f22ba427 resolve: Simplify treatment of ambiguity errors 2018-12-29 19:26:29 +03:00
bors
d969c61e8c Auto merge of #56924 - ehuss:update-cargo-rls-miri, r=alexcrichton
Update cargo, rls, miri

Update cargo, rls, miri

Added `rustc-workspace-hack` to miri so that it shares the same features for serde as other tools.

cc @alexcrichton

## cargo

25 commits in 2cf1f5dda2f7ed84e94c4d32f643e0f1f15352f0..0d1f1bbeabd5b43a7f3ecfa16540af8e76d5efb4
2018-12-11 03:44:04 +0000 to 2018-12-19 14:45:14 +0000
- Remove Stale bot's configuration (rust-lang/cargo#6463)
- Add labels to issue templates (rust-lang/cargo#6464)
- Fix new man page links. (rust-lang/cargo#6459)
- Fix metabuild compile errors with --message-format=json. (rust-lang/cargo#6432)
- Support alt-registry names in [patch] table. (rust-lang/cargo#6456)
- Update the rustup URL (rust-lang/cargo#6455)
- New man pages. (rust-lang/cargo#6405)
- Reify the DepFingerprint type (rust-lang/cargo#6451)
- Extract Fingerprint::new (rust-lang/cargo#6449)
- Upgrade the metabuild to Rust 2018 (rust-lang/cargo#6448)
- Make edition comparing code consistent (rust-lang/cargo#6450)
- Document `name` and `authors` in [package] (rust-lang/cargo#6447)
- Travis: only use mdbook 0.1.7. (rust-lang/cargo#6443)
- Update git2-curl requirement from 0.8.1 to 0.9.0 (rust-lang/cargo#6439)
- Update git2 requirement from 0.7.5 to 0.8.0 (rust-lang/cargo#6438)
- Display errors when `cargo fix` fails. (rust-lang/cargo#6419)
- cargo fix: fix targets with shared sources. (rust-lang/cargo#6434)
- Fix panic-in-panic in tests. (rust-lang/cargo#6431)
- More Rust 2018 edition cleanups (rust-lang/cargo#6422)
- Cleanup some trait impls for SourceId (rust-lang/cargo#6429)
- Remove a nightly check from doc tests (rust-lang/cargo#6427)
- Replace CargoError with failure::Error (rust-lang/cargo#6425)
- Allow testsuite warnings in dev (rust-lang/cargo#6426)
- add `--dry-run` option to cargo update (rust-lang/cargo#6371)
- Migrate to some Rust 2018 idioms (rust-lang/cargo#6416)

## rls

16 commits in bd5b899afb05e14d33e210ede3da241ca1ca088f..6f5e4bba7b1586fca6e0ea7724cadb5683b2f308
2018-12-10 08:53:00 +0100 to 2018-12-21 17:11:08 +0100
- Update jsonrpc-core (rust-lang-nursery/rls#1206)
- Use `home_dir` from `home` crate (rust-lang-nursery/rls#1207)
- Update cargo. (rust-lang-nursery/rls#1204)
- Fix deprecated `trim_{left,right}` warnings (rust-lang-nursery/rls#1203)
- Respect ${CARGO,RUSTUP}_HOME for tooltip relative dirs (rust-lang-nursery/rls#1201)
- Separate tooltip tests that require Racer fallback (rust-lang-nursery/rls#1200)
- tests: Don't generate tooltip results in tests/fixtures (rust-lang-nursery/rls#1199)
- Overhaul fixture handling in tests (rust-lang-nursery/rls#1190)
- Don't return symbols with empty names (rust-lang-nursery/rls#1193)
- Don't check AppVeyor CI status for bors
- Properly infer full_docs (rust-lang-nursery/rls#1192)
- Update cargo (rust-lang-nursery/rls#1191)
- Improve hover test_tooltip tests (rust-lang-nursery/rls#1175)
- Fix unused warnings (rust-lang-nursery/rls#1185)
- Workaround rust-lang-nursery/rls#703 to prevent obscure failures due to sccache. (rust-lang-nursery/rls#1177)
- Disable travis cache (rust-lang-nursery/rls#1182)

## miri

14 commits in bccadeb4f7cbeeb14097a365653148afe8bbd159..6c2fc6daf1ac6849d1243b213f5a3fb07feeef29
2018-12-08 11:07:22 +0100 to 2018-12-26 14:28:25 +0100
- use memory::check_bounds_ptr for offset check (solson/miri#589)
- Fix comparing function pointers (solson/miri#587)
- fix for infallible allocation (solson/miri#586)
- fix test for latest nightly (solson/miri#585)
- Treat ref-to-raw cast like a reborrow: do a special kind of retag (solson/miri#572)
- Test cargo-miri on Windows (solson/miri#578)
- Cargo miri tweaks and test that we can exclude tests (solson/miri#580)
- Fix cargo miri test (solson/miri#550)
- fix for latest nightly (solson/miri#574)
- Add rustc-workspace-hack. (solson/miri#575)
- use RUSTC_WRAPPER for the cargo hook (solson/miri#573)
- do not auto-detect the targets in the sysroot, instead specify target manually through env var (solson/miri#570)
- Cleanup: Avoid repeating signatures, get rid of to_bytes hack (solson/miri#568)
- Support building and running with full MIR on foreign architectures, drop support for missing MIR (solson/miri#566)
2018-12-29 15:35:59 +00:00
bors
419044956a Auto merge of #57181 - petrochenkov:impice3, r=estebank
resolve: Fix another ICE in import validation

Imports are allowed to have ambiguous resolutions as long as all of them have same `Def`.
As it turned out, it's possible for different `Module`s to have same `Def` when `extern crate` items are involved.

Fixes https://github.com/rust-lang/rust/issues/56596
2018-12-29 12:55:48 +00:00
kennytm
68f370ce05
Rollup merge of #57177 - varkor:fix-duration_as_u128-warning, r=estebank
Fix warning when compiling rustc
2018-12-29 18:50:32 +08:00
kennytm
aed3eaafee
Rollup merge of #57174 - linclark:patch-1, r=varkor
Update link to rustc guide
2018-12-29 18:50:30 +08:00
kennytm
9a67b18888
Rollup merge of #57168 - kennytm:fix-unaligned-docs, r=rkruppe
Removed aligned ZST requirement from docs of read_/write_unaligned.

This is just a copy-paste error.
2018-12-29 18:50:29 +08:00
kennytm
af56d2bf1a
Rollup merge of #57163 - JohnHeitmann:chevron-fix, r=estebank
Give the crate select chevron room to breathe.

Before:
![screen shot 2018-12-27 at 10 26 10 pm](https://user-images.githubusercontent.com/4282480/50505100-9ff24300-0a26-11e9-9b74-37bdee6faf83.png)

After:
![screen shot 2018-12-27 at 10 25 57 pm](https://user-images.githubusercontent.com/4282480/50505110-a54f8d80-0a26-11e9-9fa2-7fed21773207.png)
2018-12-29 18:50:28 +08:00
kennytm
291d51c92d
Rollup merge of #57159 - ids1024:closed-issue, r=Centril
Update references to closed issue

Issue #28979 was closed with a link to #55467.
2018-12-29 18:50:27 +08:00
kennytm
97e591ae0c
Rollup merge of #57153 - estebank:doc, r=cramertj
Small: Fix span in char documentation
2018-12-29 18:50:26 +08:00
kennytm
72b27a7254
Rollup merge of #57149 - rust-lang:sgrif-patch-1, r=rkruppe
Fix typo in pin documentation

Affect is a verb, effect is a noun
2018-12-29 18:50:24 +08:00