Commit Graph

88081 Commits

Author SHA1 Message Date
Mika Lehtinen
794b81ea5e Rename and fix nolink-with-link-args test
There are three problems with the nolink-with-link-args test:

* The test fails when using MSVC. It's caused by the `linker-flavor=ld` flag which was added in #46291.
* In its comment, this test tests that "link_args are indeed passed when nolink is specified", but the `nolink` attribute has been removed [a long time ago](https://github.com/rust-lang/rust/pull/12826).
* Pattern has a small typo.

At first I was going to completely remove this test, but there is [a closed pull request for that](https://github.com/rust-lang/rust/pull/21090).

So:

* rename the file as suggested in the closed PR
* adjust the comment
* fix typo in the pattern
* add `ignore-msvc`.
2018-12-31 13:51:40 +02: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
Matthew Jasper
afb7c06834 Remove unused nll debug flags 2018-12-30 20:44:44 +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
Camille GILLOT
91c155bcd7 Change return types and check return values in tests.
This allows to verify that we handle
different types as return types,
and that we call the expected functions.
2018-12-30 14:47:12 +01:00
Camille GILLOT
2530ce9fa6 Add comment. 2018-12-30 14:47:12 +01:00
Camille GILLOT
2f42a188d9 Fix failing diagnostic test. 2018-12-30 14:47:12 +01:00
Camille GILLOT
f518cf9ba9 Move tests to ui. 2018-12-30 14:47:11 +01:00
Camille GILLOT
1827d52a3f rustc_typeck: Implement resolution advised in issue 45510.
When resolving Fn traits, the compiler failed to take into account
overloaded implementations.  To resolve this, we inform the trait dispatch
code that the arguments will becoming as a tuple of correct arity.
2018-12-30 14:47:11 +01:00
Camille GILLOT
6de9c13830 rustfmt: librust_typeck/check/callee.rs 2018-12-30 14:47:09 +01:00
Camille GILLOT
4e77c3a9b1 test: Add test for issues 45510 and 18952.
Those tests are directly taken from the comments on the bug reports.
2018-12-30 14:40:00 +01:00
David Wood
c20ba65a0b
Guarantee rustc_dump_user_substs error order.
This commit buffers the errors output by the `rustc_dump_user_substs`
attribute so that they can be output in order of span and would
therefore be consistent.
2018-12-30 14:30:59 +01:00
David Wood
0bfe184b1a
Stop duplicating projections of type annotation.
This commit changes how type annotations are handled in bindings during
MIR building.

Instead of building up a `PatternTypeProjections` with the
`CanonicalUserTypeAnnotation` and projections, the
`CanonicalUserTypeAnnotation` is stored in the
`canonical_user_type_annotations` map at the start and the (equivalent)
`UserTypeProjections` is built up with the new index and same projections.

This has the effect of deduplicating type annotations as instead of type
annotations being added to the `canonical_user_type_annotations` map
multiple times at the end after being duplicated (which happens in building
up `PatternTypeProjections`), it is instead added once.
2018-12-30 14:30:59 +01:00
David Wood
28fd1b04e5
Stop well-formedness checking unreachable code.
This commit stops well-formedness checking applying to unreachable code
and therefore stops some of the ICEs that the intended solution taken by
this PR causes.

By disabling these checks, we can land the other fixes and larger
refactors that this PR includes.
2018-12-30 14:30:59 +01:00
David Wood
95c18382cb
Fix unresolved inference variable ICE.
This commit moves well-formedness check for the
`UserTypeAnnotation::Ty(..)` case from always running to only when the
code is reachable. This solves the ICE that resulted from
`src/test/ui/issue-54943-1.rs` (a minimal repro of `dropck-eyepatch`
run-pass tests that failed).

The main well-formedness check that was intended to be run despite
unreachable code still is, that being the
`UserTypeAnnotation::TypeOf(..)` case. Before this PR, the other case
wasn't being checked at all.

It is possible to fix this ICE while still always checking
well-formedness for the `UserTypeAnnotation::Ty(..)` case but that
solution will ICE in unreachable code for that case, the diff for
that change [can be found here](0).

[0]: https://gist.github.com/davidtwco/f9751ffd9c0508f7251c0f17adc3af53
2018-12-30 14:30:59 +01:00
David Wood
6092d92d70
Add explicit error annotations to test.
This commit adds explicit error annotations to tests after rebasing
which is now required.
2018-12-30 14:30:58 +01:00
David Wood
dc41606ff4
Support user type annotations in ref bindings.
This commit adds support for user type annotations in variables declared
using `ref` bindings. When a variable declared using a `ref` binding,
then the `LocalDecl` has the type `&T` where the `&` was introduced by
the `ref` binding but the canonicalized type annotation has only a
`T` since the reference is implicit with the `ref` binding.

Therefore, to support type annotations, the canonicalized type
annotation either needs wrapped in a reference, or the `LocalDecl` type
must have a wrapped reference removed for comparison. It is easier to
remove the outer reference from the `LocalDecl` for the purpose of
comparison, so that is the approach this commit takes.
2018-12-30 14:30:58 +01:00
David Wood
162dcdc16f
Add user type annotations to MIR dump.
This commit writes the user type annotations to the MIR dump so that
they are visible again.
2018-12-30 14:30:58 +01:00
David Wood
4be7214d30
Type annotations in associated constant patterns.
This commit adds support for respecting user type annotations with
associated constants in patterns.
2018-12-30 14:30:58 +01:00
David Wood
b182a21163
Add test for unreachable well-formedness.
This commit adds a test for checking that types are well-formed when
unreachable.
2018-12-30 14:25:25 +01:00
David Wood
f2532012dd
Always check well-formedness.
This commit uses the map introduced by the previous commit to ensure
that types are always checked for well-formedness by the NLL type check.
Previously, without the map introduced by the previous commit, types
would not be checked for well-formedness if the `AscribeUserType`
statement that would trigger that check was removed as unreachable code.
2018-12-30 14:25:25 +01:00
David Wood
24a7a010d1
Refactor UserTypeAnnotation.
This commit refactors the `UserTypeAnnotation` type to be referred to by
an index within `UserTypeProjection`. `UserTypeAnnotation` is instead
kept in an `IndexVec` within the `Mir` struct.

Further, instead of `UserTypeAnnotation` containing canonicalized types,
it now contains normal types and the entire `UserTypeAnnotation` is
canonicalized. To support this, the type was moved from the `rustc::mir`
module to `rustc::ty` module.
2018-12-30 14:25:20 +01: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