]> git.lizzy.rs Git - rust.git/log
rust.git
4 years agoAuto merge of #66459 - eddyb:update-llvm-wasm-dwarf, r=alexcrichton
bors [Mon, 18 Nov 2019 09:14:12 +0000 (09:14 +0000)]
Auto merge of #66459 - eddyb:update-llvm-wasm-dwarf, r=alexcrichton

Update src/llvm-project to include rust-lang/llvm-project#27.

See https://github.com/rust-lang/llvm-project/pull/27, which works around https://github.com/rust-lang/llvm-project/pull/20#discussion_r344425408 (where I stumbled over some UB in DWARF emission for WASM, resulting in non-deterministic output).

r? @alexcrichton cc @yurydelendik

4 years agostd::error::Chain: remove Copy
Harald Hoyer [Fri, 15 Nov 2019 13:29:35 +0000 (14:29 +0100)]
std::error::Chain: remove Copy

remove Copy from Iterator as per comment
https://github.com/rust-lang/rust/issues/58520#issuecomment-553682166

4 years agoRename generated lifetime.
Camille GILLOT [Fri, 15 Nov 2019 17:58:40 +0000 (18:58 +0100)]
Rename generated lifetime.

4 years agoRetire EnumLiftImpl.
Camille GILLOT [Fri, 15 Nov 2019 17:30:20 +0000 (18:30 +0100)]
Retire EnumLiftImpl.

4 years agoRetire BraceStructLiftImpl.
Camille GILLOT [Fri, 15 Nov 2019 17:19:52 +0000 (18:19 +0100)]
Retire BraceStructLiftImpl.

4 years agoCreate derive proc-macro for Lift trait.
Camille GILLOT [Thu, 14 Nov 2019 22:31:49 +0000 (23:31 +0100)]
Create derive proc-macro for Lift trait.

4 years agoAuto merge of #66396 - smmalis37:pythontest, r=alexcrichton
bors [Mon, 18 Nov 2019 06:09:04 +0000 (06:09 +0000)]
Auto merge of #66396 - smmalis37:pythontest, r=alexcrichton

Make a test compatible across python versions.

Progress on #65063

This PR allows this test to work on both python2 and python3, ~~and it also allows `./x.py test` to fully complete on my system without python2 installed at all.~~

4 years agoAuto merge of #66238 - ehuss:stabilize-rustdoc-edition, r=GuillaumeGomez
bors [Mon, 18 Nov 2019 03:06:42 +0000 (03:06 +0000)]
Auto merge of #66238 - ehuss:stabilize-rustdoc-edition, r=GuillaumeGomez

rustdoc: Stabilize `edition` annotation.

The rustdoc `edition` annotation is currently ignored on stable. This means that the tests will be ignored, unless there is a `rust` annotation, then it will use the global edition. I suspect this was just an oversight during the edition stabilization, but I don't know. Example:

```rust
/// ```edition2018
/// // This code block was ignored on stable.
/// ```

/// ```rust,edition2018
/// // This code block would use whatever edition is passed on the command line.
/// ```
```

AFAIK, it is not possible to write a test that verifies stable behavior, as all tests appear to set RUSTC_BOOTSTRAP which forces all tests to run as "nightly", even on a stable release.

Closes #65980

4 years agoAuto merge of #65456 - estebank:trait-bound-borrow, r=matthewjasper
bors [Mon, 18 Nov 2019 00:05:38 +0000 (00:05 +0000)]
Auto merge of #65456 - estebank:trait-bound-borrow, r=matthewjasper

Suggest borrowing when it would satisfy an unmet trait bound

When there are multiple implementors for the same trait that is present
in an unmet binding, modify the E0277 error to refer to the parent
obligation and verify whether borrowing the argument being passed in
would satisfy the unmet bound. If it would, suggest it.

Fix #56368.

4 years agoreview comments
Esteban Küber [Thu, 14 Nov 2019 19:29:01 +0000 (11:29 -0800)]
review comments

4 years agoDo not ICE on trait aliases with missing obligations
Esteban Küber [Thu, 14 Nov 2019 00:06:28 +0000 (16:06 -0800)]
Do not ICE on trait aliases with missing obligations

4 years ago`ConstantValue` is the only other ctor allowed when subtracting from slice ctors
Nadrieril [Sun, 17 Nov 2019 19:24:48 +0000 (19:24 +0000)]
`ConstantValue` is the only other ctor allowed when subtracting from slice ctors

4 years agoStore SliceKinds directly when subtracting
Nadrieril [Sun, 17 Nov 2019 19:08:01 +0000 (19:08 +0000)]
Store SliceKinds directly when subtracting

4 years agoAuto merge of #66385 - ecstatic-morse:check-only-pass2, r=eddyb
bors [Sun, 17 Nov 2019 18:38:15 +0000 (18:38 +0000)]
Auto merge of #66385 - ecstatic-morse:check-only-pass2, r=eddyb

Make dataflow-based const qualification the canonical one

For over a month, dataflow-based const qualification has been running in parallel with `qualify_consts` to check the bodies of `const` and `static`s. This PR removes the old qualification pass completely in favor of the dataflow-based one.

**edit:**
This PR also stops checking `QUALIF_ERROR_BIT` during promotion. This check appears to no longer serve a purpose now that the CTFE engine is more robust.

As a side-effect, this resolves #66167.

r? @eddyb

4 years agoSmall improvement to exhaustiveness diagnostics
Nadrieril [Sun, 17 Nov 2019 17:48:45 +0000 (17:48 +0000)]
Small improvement to exhaustiveness diagnostics

4 years agoFactor out slice constructor struct and simplify
Nadrieril [Sun, 17 Nov 2019 17:33:39 +0000 (17:33 +0000)]
Factor out slice constructor struct and simplify

4 years agorustc_metadata: Cleanup crate search with exact paths
Vadim Petrochenkov [Sun, 17 Nov 2019 16:21:43 +0000 (19:21 +0300)]
rustc_metadata: Cleanup crate search with exact paths

4 years agorustc_metadata: Remove `CrateMetadata::is_proc_macro_crate`
Vadim Petrochenkov [Sun, 17 Nov 2019 15:54:22 +0000 (18:54 +0300)]
rustc_metadata: Remove `CrateMetadata::is_proc_macro_crate`

4 years agorustc_metadata: Stop leaking `Lazy` from the `rmeta` module
Vadim Petrochenkov [Sun, 17 Nov 2019 15:46:38 +0000 (18:46 +0300)]
rustc_metadata: Stop leaking `Lazy` from the `rmeta` module

4 years agorustc_metadata: Move `CrateMetadata` into `decoder.rs`
Vadim Petrochenkov [Sun, 17 Nov 2019 13:50:46 +0000 (16:50 +0300)]
rustc_metadata: Move `CrateMetadata` into `decoder.rs`

It allows to make most of its fields private

4 years agorustc_metadata: Give a constructor to `CratePaths`
Vadim Petrochenkov [Sun, 17 Nov 2019 13:13:46 +0000 (16:13 +0300)]
rustc_metadata: Give a constructor to `CratePaths`

4 years agorustc_metadata: Minor cleanup
Vadim Petrochenkov [Sun, 17 Nov 2019 13:09:14 +0000 (16:09 +0300)]
rustc_metadata: Minor cleanup

4 years agorustc_metadata: Give a constructor to `CrateMetadata`
Vadim Petrochenkov [Sun, 17 Nov 2019 12:27:49 +0000 (15:27 +0300)]
rustc_metadata: Give a constructor to `CrateMetadata`

4 years agorustc_metadata: Give a constructor to `CrateLocator`
Vadim Petrochenkov [Sun, 17 Nov 2019 11:49:23 +0000 (14:49 +0300)]
rustc_metadata: Give a constructor to `CrateLocator`

4 years agorustc_metadata: `locator::Context` -> `CrateLocator`
Vadim Petrochenkov [Sun, 17 Nov 2019 11:17:24 +0000 (14:17 +0300)]
rustc_metadata: `locator::Context` -> `CrateLocator`

4 years agorustc_metadata: Move some structs from `cstore` to `decoder`
Vadim Petrochenkov [Sun, 17 Nov 2019 10:47:30 +0000 (13:47 +0300)]
rustc_metadata: Move some structs from `cstore` to `decoder`

This allows to privatize their fields.

4 years agoUnify the various slice constructors
Nadrieril [Sun, 17 Nov 2019 15:54:44 +0000 (15:54 +0000)]
Unify the various slice constructors

4 years agoAdd JohnTitor to rustc-guide toolstate notification list
Yuki Okushi [Sun, 17 Nov 2019 15:47:38 +0000 (00:47 +0900)]
Add JohnTitor to rustc-guide toolstate notification list

Also update org names of some books

4 years agoAuto merge of #66384 - cjgillot:typefoldable, r=Zoxc
bors [Sun, 17 Nov 2019 15:25:10 +0000 (15:25 +0000)]
Auto merge of #66384 - cjgillot:typefoldable, r=Zoxc

Derive TypeFoldable using a proc-macro

A new proc macro is added in librustc_macros.
It is used to derive TypeFoldable inside librustc and librustc_traits.

For now, the macro uses the `'tcx` lifetime implicitly, and does not allow for a more robust selection of the adequate lifetime.

The Clone-based TypeFoldable implementations are not migrated.

Closes #65674

4 years agoAuto merge of #66488 - RalfJung:miri, r=RalfJung
bors [Sun, 17 Nov 2019 10:45:37 +0000 (10:45 +0000)]
Auto merge of #66488 - RalfJung:miri, r=RalfJung

update Miri

r? @ghost Cc @oli-obk

4 years agoupdate Miri
Ralf Jung [Sun, 17 Nov 2019 10:40:18 +0000 (11:40 +0100)]
update Miri

4 years agoRename directory `rustc_plugin` -> `rustc_plugin_impl`
Vadim Petrochenkov [Sat, 16 Nov 2019 21:54:24 +0000 (00:54 +0300)]
Rename directory `rustc_plugin` -> `rustc_plugin_impl`

4 years agorustc_plugin: Remove the compatibility shim
Vadim Petrochenkov [Sat, 16 Nov 2019 20:35:27 +0000 (23:35 +0300)]
rustc_plugin: Remove the compatibility shim

4 years agoAuto merge of #66336 - ehuss:update-cargo-books, r=Mark-Simulacrum
bors [Sun, 17 Nov 2019 07:45:00 +0000 (07:45 +0000)]
Auto merge of #66336 - ehuss:update-cargo-books, r=Mark-Simulacrum

Update Cargo, books

## cargo

12 commits in 5da4b4d47963868d9878480197581ccbbdaece74..8280633db680dec5bfe1de25156d1a1d53e6d190
2019-10-28 21:53:41 +0000 to 2019-11-11 23:17:05 +0000
- Don't panic when parsing `/proc/stat` (rust-lang/cargo#7580)
- Fix unused configuration key warning for a few keys under `build`. (rust-lang/cargo#7575)
- Add back support for `BROWSER` envvar in `cargo doc --open`. (rust-lang/cargo#7576)
- Only include "already existing ..." comment in gitignore on conflict (rust-lang/cargo#7570)
- Add VS Code user dir to .gitignore (rust-lang/cargo#7578)
- Added aliases to subcommand typo suggestions. (rust-lang/cargo#7486)
- Use multiple requirement syntax consistently (rust-lang/cargo#7573)
- Update verison to 0.42 (rust-lang/cargo#7568)
- Expand documentation on build scripts. (rust-lang/cargo#7565)
- Update crossbeam-utils requirement from 0.6 to 0.7 (rust-lang/cargo#7566)
- don't download std-docs on CI (rust-lang/cargo#7513)
- Change my-buddy to github-handle (rust-lang/cargo#7553)

## nomicon

2 commits in 5004ad30d69f93553ceef74439fea2159d1f769e..58e36e0e08dec5a379ac568827c058e25990d6cd
2019-10-12 19:52:40 +0200 to 2019-10-30 08:14:24 -0500
- remove references to the nursery
- Add github action to replace Travis.yml (rust-lang-nursery/nomicon#172)

## reference

7 commits in 4b21b646669e0af49fae7cae301898dc4bfaa1f0..45558c464fb458affbcdcb34323946da45c8a117
2019-10-27 22:33:11 +0100 to 2019-11-08 14:47:35 +0100
- Audit code blocks. (rust-lang-nursery/reference#715)
- Update coherence and orphan rules documentation to match RFC 2451 (rust-lang-nursery/reference#703)
- Update organization name (rust-lang-nursery/reference#713)
- State that no_implicit_prelude also applies to nested modules (rust-lang-nursery/reference#707)
- expand Copy docs (rust-lang-nursery/reference#711)
- github action doesn't use the nursery (rust-lang-nursery/reference#706)
- Migrate to GitHub Actions. (rust-lang-nursery/reference#705)

## book

1 commits in 28fa3d15b0bc67ea5e79eeff2198e4277fc61baf..e79dd62aa63396714278d484d91d48826737f47f
2019-10-29 07:16:09 -0500 to 2019-10-30 07:33:12 -0500
- No need for an iterator here to fetch values (rust-lang/book#1957)

## rust-by-example

1 commits in f3197ddf2abab9abdbc029def8164f4a748b0d91..dcee312c66267eb5a2f6f1561354003950e29105
2019-10-29 10:17:40 -0300 to 2019-10-31 11:26:53 -0300
- refactor: simplify extracting Result from Option (rust-lang/rust-by-example#1283)

## edition-guide

2 commits in e58bc4ca104e890ac56af846877c874c432a64b5..f553fb26c60c4623ea88a1cfe731eafe0643ce34
2019-07-31 20:14:12 +0200 to 2019-10-30 08:27:42 -0500
- remove old references to the nursery
- Port from Travis to GitHub Actions (rust-lang-nursery/edition-guide#192)

4 years agoAuto merge of #66485 - JohnTitor:rollup-vbwhg6r, r=JohnTitor
bors [Sun, 17 Nov 2019 04:37:53 +0000 (04:37 +0000)]
Auto merge of #66485 - JohnTitor:rollup-vbwhg6r, r=JohnTitor

Rollup of 11 pull requests

Successful merges:

 - #65739 (Improve documentation of `Vec::split_off(...)`)
 - #66271 (syntax: Keep string literals in ABIs and `asm!` more precisely)
 - #66344 (rustc_plugin: Remove `Registry::register_attribute`)
 - #66381 (find_deprecation: deprecation attr may be ill-formed meta.)
 - #66395 (Centralize panic macro documentation)
 - #66456 (Move `DIAGNOSTICS` usage to `rustc_driver`)
 - #66465 (add missing 'static lifetime in docs)
 - #66466 (miri panic_unwind: fix hack for SEH platforms)
 - #66469 (Use "field is never read" instead of "field is never used")
 - #66471 (Add test for issue 63116)
 - #66477 (Clarify transmute_copy documentation example)

Failed merges:

r? @ghost

4 years agoRollup merge of #66477 - ALSchwalm:clarify-transmute-copy, r=Centril
Yuki Okushi [Sun, 17 Nov 2019 04:36:25 +0000 (13:36 +0900)]
Rollup merge of #66477 - ALSchwalm:clarify-transmute-copy, r=Centril

Clarify transmute_copy documentation example

Currently the documentation for `transmute_copy` implies that the function accepts a slice due to the variable name chosen in the example. This is misleading as `foo_slice` is actually an array and `transmute_copy` cannot take an unsized type anyway.

This PR just clarifies things by renaming the variable used in the example.

4 years agoRollup merge of #66471 - Alexendoo:test-issue-63116, r=Centril
Yuki Okushi [Sun, 17 Nov 2019 04:36:24 +0000 (13:36 +0900)]
Rollup merge of #66471 - Alexendoo:test-issue-63116, r=Centril

Add test for issue 63116

Closes #63116

4 years agoRollup merge of #66469 - CosineP:fix/field-lint, r=petrochenkov
Yuki Okushi [Sun, 17 Nov 2019 04:36:22 +0000 (13:36 +0900)]
Rollup merge of #66469 - CosineP:fix/field-lint, r=petrochenkov

Use "field is never read" instead of "field is never used"

this is my first PR here so please let me know if i am doing it wrong
closes #64465
i will be referencing this with a book PR that updates the same language

4 years agoRollup merge of #66466 - RalfJung:seh, r=oli-obk
Yuki Okushi [Sun, 17 Nov 2019 04:36:21 +0000 (13:36 +0900)]
Rollup merge of #66466 - RalfJung:seh, r=oli-obk

miri panic_unwind: fix hack for SEH platforms

The old hack didn't work as we ended up duplicating the `eh_personality` lang item...

I have no idea if rustc cares that `eh_catch_typeinfo` has a certain shape, but better safe than sorry. I cannot test this locally.

r? @oli-obk Cc @Aaron1011

4 years agoRollup merge of #66465 - mulimoen:fix_lifetime_elision_not_shown, r=rkruppe
Yuki Okushi [Sun, 17 Nov 2019 04:36:19 +0000 (13:36 +0900)]
Rollup merge of #66465 - mulimoen:fix_lifetime_elision_not_shown, r=rkruppe

add missing 'static lifetime in docs

4 years agoRollup merge of #66456 - Centril:driver-codes, r=Mark-Simulacrum
Yuki Okushi [Sun, 17 Nov 2019 04:36:18 +0000 (13:36 +0900)]
Rollup merge of #66456 - Centril:driver-codes, r=Mark-Simulacrum

Move `DIAGNOSTICS` usage to `rustc_driver`

Remove `rustc_interface`'s dependency on `rustc_error_codes` and centralize all usages of `DIAGNOSTICS` in `rustc_driver`. Once we remove all references to `rustc_error_codes` in all other crates but `rustc_driver`, this should allow for incremental recompilation of the compiler to be smoother when tweaking error codes. This works towards https://github.com/rust-lang/rust/issues/66210#issuecomment-551862528.

(May include traces of minor drive-by cleanup.)

r? @Mark-Simulacrum

4 years agoRollup merge of #66395 - jplatte:centralize-panic-docs, r=Dylan-DPC
Yuki Okushi [Sun, 17 Nov 2019 04:36:16 +0000 (13:36 +0900)]
Rollup merge of #66395 - jplatte:centralize-panic-docs, r=Dylan-DPC

Centralize panic macro documentation

This is just the main commit from #61511 (which got closed because the author didn't reply) cherry-picked on the current master. Building `core` and `std` on this branch in stage 1 succeeded, which I thinks means the issues from the previous PR should be gone (but let's see what CI says).

4 years agoRollup merge of #66381 - Centril:66340, r=petrochenkov
Yuki Okushi [Sun, 17 Nov 2019 04:36:15 +0000 (13:36 +0900)]
Rollup merge of #66381 - Centril:66340, r=petrochenkov

find_deprecation: deprecation attr may be ill-formed meta.

Fixes #66340.

r? @petrochenkov
cc @pnkfelix

4 years agoRollup merge of #66344 - petrochenkov:noregattr, r=matthewjasper
Yuki Okushi [Sun, 17 Nov 2019 04:36:13 +0000 (13:36 +0900)]
Rollup merge of #66344 - petrochenkov:noregattr, r=matthewjasper

rustc_plugin: Remove `Registry::register_attribute`

Legacy plugins cannot register inert attributes anymore.

The preferred replacement is to use `register_tool` ([tracking issue](https://github.com/rust-lang/rust/issues/66079)).
```rust
#![register_tool(servo)]

#[servo::must_root]
struct S;
```

The more direct replacement is `register_attribute` ([tracking issue](https://github.com/rust-lang/rust/issues/66080))
```rust
#![register_attr(must_root)]

#[must_root]
struct S;
```
, but it requires registering each attribute individually rather than registering the tool once, and is more likely to be removed rather than stabilized.

4 years agoRollup merge of #66271 - petrochenkov:abism, r=Centril
Yuki Okushi [Sun, 17 Nov 2019 04:36:12 +0000 (13:36 +0900)]
Rollup merge of #66271 - petrochenkov:abism, r=Centril

syntax: Keep string literals in ABIs and `asm!` more precisely

As a result we don't lose spans when `extern` functions or blocks are passed to proc macros, and also escape all string literals consistently.
Continuation of https://github.com/rust-lang/rust/pull/60679, which did a similar thing with all literals besides those in ABIs and `asm!`.

TODO: Add tests.

Fixes https://github.com/rust-lang/rust/issues/60493
Fixes https://github.com/rust-lang/rust/issues/64561
r? @Centril

4 years agoRollup merge of #65739 - mqudsi:vec_split_off_docs, r=dtolnay
Yuki Okushi [Sun, 17 Nov 2019 04:36:10 +0000 (13:36 +0900)]
Rollup merge of #65739 - mqudsi:vec_split_off_docs, r=dtolnay

Improve documentation of `Vec::split_off(...)`

The previous ordering of the sentences kept switching between the return
value and the value of `self` after execution, making it hard to follow.

Additionally, as rendered in the browser, the period in "`Self`. `self`"
was difficult to make out as being a sentence separator and not one code
block.

4 years agoreview comments
Esteban Küber [Sun, 17 Nov 2019 01:10:13 +0000 (17:10 -0800)]
review comments

4 years agoSuggest calling async closure when needed
Esteban Küber [Sat, 9 Nov 2019 02:04:05 +0000 (18:04 -0800)]
Suggest calling async closure when needed

When using an async closure as a value in a place that expects a future,
suggest calling the closure.

Fix #65923.

4 years agoreview comments and fix rebase
Esteban Küber [Wed, 6 Nov 2019 18:39:57 +0000 (10:39 -0800)]
review comments and fix rebase

4 years agoAuto merge of #66394 - wesleywiser:fix_oom, r=oli-obk
bors [Sat, 16 Nov 2019 22:54:33 +0000 (22:54 +0000)]
Auto merge of #66394 - wesleywiser:fix_oom, r=oli-obk

Fix two OOM issues related to `ConstProp`

Fixes #66342
Fixes #66397

r? @oli-obk

4 years agoAdd test for issue 63116
Alex Macleod [Sat, 16 Nov 2019 14:54:09 +0000 (14:54 +0000)]
Add test for issue 63116

4 years agoAdd some more tests
Vadim Petrochenkov [Sat, 16 Nov 2019 22:11:35 +0000 (01:11 +0300)]
Add some more tests

4 years agoAddress review comments
Vadim Petrochenkov [Sat, 16 Nov 2019 17:11:05 +0000 (20:11 +0300)]
Address review comments

4 years agoAccount for `rustc_on_unimplemented`
Esteban Küber [Sun, 27 Oct 2019 20:42:20 +0000 (13:42 -0700)]
Account for `rustc_on_unimplemented`

4 years agoRemove unnecessary note
Esteban Küber [Wed, 16 Oct 2019 03:35:54 +0000 (20:35 -0700)]
Remove unnecessary note

4 years agoModify primary label message to be inline with error message
Esteban Küber [Wed, 16 Oct 2019 02:09:15 +0000 (19:09 -0700)]
Modify primary label message to be inline with error message

4 years agoSuggest borrowing when it would satisfy an unmet trait bound
Esteban Küber [Wed, 16 Oct 2019 01:42:27 +0000 (18:42 -0700)]
Suggest borrowing when it would satisfy an unmet trait bound

When there are multiple implementors for the same trait that is present
in an unmet binding, modify the E0277 error to refer to the parent
obligation and verify whether borrowing the argument being passed in
would satisfy the unmet bound. If it would, suggest it.

4 years agoTweak code formatting
Esteban Küber [Wed, 16 Oct 2019 01:27:42 +0000 (18:27 -0700)]
Tweak code formatting

4 years agoClarify transmute_copy documentation example
Adam Schwalm [Sat, 16 Nov 2019 20:47:33 +0000 (14:47 -0600)]
Clarify transmute_copy documentation example

4 years agoRevise the text of `vec::split_off()` per review in #65739
Mahmoud Al-Qudsi [Sat, 16 Nov 2019 20:11:08 +0000 (14:11 -0600)]
Revise the text of `vec::split_off()` per review in #65739

Remove the incorrect usage of "copy" as the trait is not called.

4 years agoImprove documentation of `Vec::split_off(...)`
Mahmoud Al-Qudsi [Wed, 23 Oct 2019 21:32:16 +0000 (16:32 -0500)]
Improve documentation of `Vec::split_off(...)`

The previous ordering of the sentences kept switching between the return
value and the value of `self` after execution, making it hard to follow.

Additionally, as rendered in the browser, the period in "`Self`. `self`"
was difficult to make out as being a sentence separator and not one code
block.

4 years agoAuto merge of #64694 - petrochenkov:reshelp, r=matthewjasper
bors [Sat, 16 Nov 2019 19:50:48 +0000 (19:50 +0000)]
Auto merge of #64694 - petrochenkov:reshelp, r=matthewjasper

Fully integrate derive helpers into name resolution

```rust
#[derive(Foo)]
#[foo_helper] // already goes through name resolution
struct S {
    #[foo_helper] // goes through name resolution after this PR
    field: u8
}
```
How name resolution normally works:
- We have an identifier we need to resolve, take its location (in some sense) and look what names are in scope in that location.

How derive helper attributes are "resolved" (before this PR):
- After resolving the derive `Foo` we visit the derive's input (`struct S { ... } `) as a piece of AST and mark attributes textually matching one of the derive's helper attributes (`foo_helper`) as "known", so they never go through name resolution.

This PR changes the rules for derive helpers, so they are not proactively marked as known (which is a big hack ignoring any ambiguities or hygiene), but go through regular name resolution instead.
This change was previously blocked by attributes not being resolved in some positions at all (fixed in https://github.com/rust-lang/rust/pull/63468).

"Where exactly are derive helpers in scope?" is an interesting question, and I need some feedback from proc macro authors to answer it, see the post below (https://github.com/rust-lang/rust/pull/64694#issuecomment-533925160).

4 years agoparse: Use string literal parsing in the `asm` macro
Vadim Petrochenkov [Sun, 10 Nov 2019 14:04:12 +0000 (17:04 +0300)]
parse: Use string literal parsing in the `asm` macro

4 years agoparse: Support parsing optional literals
Vadim Petrochenkov [Sun, 10 Nov 2019 12:32:41 +0000 (15:32 +0300)]
parse: Support parsing optional literals

Revert weird renaming of the former `LitError::report`

4 years agoast: Keep string literals in ABIs precisely
Vadim Petrochenkov [Sat, 9 Nov 2019 21:44:59 +0000 (00:44 +0300)]
ast: Keep string literals in ABIs precisely

4 years agoast: Keep `extern` qualifiers in functions more precisely
Vadim Petrochenkov [Sat, 9 Nov 2019 19:05:20 +0000 (22:05 +0300)]
ast: Keep `extern` qualifiers in functions more precisely

4 years agoOnly run tests on x86_64
Wesley Wiser [Fri, 15 Nov 2019 01:48:42 +0000 (20:48 -0500)]
Only run tests on x86_64

4 years agoUpdate ui tests
clemencetbk [Sat, 16 Nov 2019 17:05:26 +0000 (12:05 -0500)]
Update ui tests

4 years agoAdd explanation message for E0641
clemencetbk [Sat, 16 Nov 2019 17:04:17 +0000 (12:04 -0500)]
Add explanation message for E0641

4 years agoAdd regression test for issue 53820
Nadrieril [Sat, 16 Nov 2019 16:43:55 +0000 (16:43 +0000)]
Add regression test for issue 53820

4 years agoIntroduce new FixedLenSlice constructor
Nadrieril [Sat, 16 Nov 2019 16:05:32 +0000 (16:05 +0000)]
Introduce new FixedLenSlice constructor

It is used in the case where a variable-length slice pattern is used to
match on an array of known size. This allows considering only those
entries in the array that are captured by one of the patterns.
As a side-effect, diagnostics improve a bit for those cases.

4 years agoAdd some tests
Nadrieril [Sat, 16 Nov 2019 16:18:46 +0000 (16:18 +0000)]
Add some tests

4 years agorustc_plugin: Remove `Registry::register_attribute`
Vadim Petrochenkov [Tue, 12 Nov 2019 18:22:16 +0000 (21:22 +0300)]
rustc_plugin: Remove `Registry::register_attribute`

4 years agoAdd some more tests
Vadim Petrochenkov [Sat, 5 Oct 2019 13:59:52 +0000 (16:59 +0300)]
Add some more tests

4 years agoexpand: Stop marking derive helper attributes as known
Vadim Petrochenkov [Sat, 5 Oct 2019 13:30:08 +0000 (16:30 +0300)]
expand: Stop marking derive helper attributes as known

Pass them through name resolution instead

4 years agoresolve: Introduce a new scope for derive helpers
Vadim Petrochenkov [Thu, 3 Oct 2019 22:53:20 +0000 (01:53 +0300)]
resolve: Introduce a new scope for derive helpers

4 years agoresolve: `Scope::DeriveHelpers` -> `Scope::DeriveHelpersCompat`
Vadim Petrochenkov [Thu, 3 Oct 2019 22:44:57 +0000 (01:44 +0300)]
resolve: `Scope::DeriveHelpers` -> `Scope::DeriveHelpersCompat`

These helpers are resolved before their respective derives through a kind of look ahead into future expansions.
Some of these will migrate to proper resolution, others will be deprecated.

```
#[trait_helper] // Deprecate
#[derive(Trait)]
#[trait_helper] // Migrate to proper resolution
```

4 years agoAuto merge of #66333 - mark-i-m:fix-rustc-guide-1, r=ehuss
bors [Sat, 16 Nov 2019 14:27:53 +0000 (14:27 +0000)]
Auto merge of #66333 - mark-i-m:fix-rustc-guide-1, r=ehuss

Fix rustc guide again

r? @ehuss

Sorry, links change fast in this world...

4 years agoTweak VarLenSlice subtraction
Nadrieril [Wed, 6 Nov 2019 16:52:37 +0000 (16:52 +0000)]
Tweak VarLenSlice subtraction

4 years agoUse "field is never read" instead of "field is never used"
cosine [Sat, 16 Nov 2019 12:12:37 +0000 (07:12 -0500)]
Use "field is never read" instead of "field is never used"

4 years agoavoid linking errors
Ralf Jung [Sat, 16 Nov 2019 08:37:45 +0000 (09:37 +0100)]
avoid linking errors

4 years agomiri panic_unwind: fix hack for SEH platforms
Ralf Jung [Sat, 16 Nov 2019 08:27:06 +0000 (09:27 +0100)]
miri panic_unwind: fix hack for SEH platforms

4 years agoadd missing 'static lifetime in docs
Magnus Ulimoen [Sat, 16 Nov 2019 07:22:40 +0000 (08:22 +0100)]
add missing 'static lifetime in docs

The example refers to a static lifetime parameter that can be elided.
This parameter is not included, meaning lifetime elision is not shown.

4 years agoAuto merge of #66255 - ehuss:update-cc, r=alexcrichton
bors [Sat, 16 Nov 2019 07:26:57 +0000 (07:26 +0000)]
Auto merge of #66255 - ehuss:update-cc, r=alexcrichton

Update cc, git2, num_cpus.

This updates the `cc` crate, bringing in better parallel building support. Also updates `git2` which enables the parallel feature. (Note: I don't expect it will have a significant impact on build time, but seems good to update anyways.)

The main thorn is that `cc` gained knowledge about RISC-V architectures (https://github.com/alexcrichton/cc-rs/pull/428, https://github.com/alexcrichton/cc-rs/pull/429, https://github.com/alexcrichton/cc-rs/pull/430), but the builders on CI do not have the riscv C compiler installed. This means that bootstraps' cc detection was finding a C compiler that isn't installed, and fails.

The solution here is to override the cc detection to `false`. The C compiler isn't actually used on riscv platforms. AFAIK, the only location would be compiler_builtins, and it currently forces C support off (https://github.com/rust-lang/compiler-builtins/blob/a533ae9c5aa325db209659679535fe1f186eae81/build.rs#L49-L55).

Other possible solutions:
- Add the override in cc_detect for riscv (or any "no-C" platform like wasm32 and nvptx)
- Install and use the appropriate c compiler. I tried this the `g++-riscv64-linux-gnu` package, but it failed missing some header file.

Closes #66232

4 years agoAuto merge of #66453 - Centril:rollup-w1ohzxs, r=Centril
bors [Sat, 16 Nov 2019 02:40:52 +0000 (02:40 +0000)]
Auto merge of #66453 - Centril:rollup-w1ohzxs, r=Centril

Rollup of 5 pull requests

Successful merges:

 - #66350 (protect creation of destructors by a mutex)
 - #66407 (Add more tests for fixed ICEs)
 - #66415 (Add --force-run-in-process unstable option to libtest)
 - #66427 (Move the JSON error emitter to librustc_errors)
 - #66441 (libpanic_unwind for Miri: make sure we have the SEH lang items when needed)

Failed merges:

r? @ghost

4 years agomove DIAGNOSTICS usage to rustc_driver
Mazdak Farrokhzad [Fri, 15 Nov 2019 18:41:50 +0000 (19:41 +0100)]
move DIAGNOSTICS usage to rustc_driver

4 years agoAuto merge of #66326 - Nadrieril:refactor-intrange, r=varkor
bors [Fri, 15 Nov 2019 23:28:50 +0000 (23:28 +0000)]
Auto merge of #66326 - Nadrieril:refactor-intrange, r=varkor

Refactor integer range handling in the usefulness algorithm

Integer range handling had accumulated a lot of debt. This cleans up a lot of it.

In particular this:
- removes unnecessary conversions between `Const` and `u128`, and between `Constructor` and `IntRange`
- clearly distinguishes between on the one hand ranges of integers that may or may not be matched exhaustively, and on the other hand ranges of non-integers that are never matched exhaustively and are compared using Const-based shenanigans
- cleans up some overly complicated code paths
- generally tries to be more idiomatic.

As a nice side-effect, I measured a 10% perf increase on `unicode_normalization`.

There's one thing that I feel remains to clean up: the [overlapping range check](https://github.com/rust-lang/rust/pull/64007), which is currently quite ad-hoc. But that is intricate enough that I'm leaving it out of this PR.

There's also one little thing I'm not sure I understand: can `try_eval_bits` fail for an integer constant value in that code ? What would that mean, and how do I construct a test case for this possibility ?

4 years agoRespond to review feedback
Wesley Wiser [Thu, 14 Nov 2019 11:17:41 +0000 (06:17 -0500)]
Respond to review feedback

4 years ago[ConstProp] Avoid OOM crashes by not evaluating large Places
Wesley Wiser [Thu, 14 Nov 2019 01:37:33 +0000 (20:37 -0500)]
[ConstProp] Avoid OOM crashes by not evaluating large Places

Fixes #66397

4 years agoFix spurious CI filures due to OOM
Wesley Wiser [Thu, 14 Nov 2019 00:19:25 +0000 (19:19 -0500)]
Fix spurious CI filures due to OOM

Fixes #66342

4 years agoUpdate src/llvm-project to include rust-lang/llvm-project#27.
Eduard-Mihai Burtescu [Fri, 15 Nov 2019 20:56:40 +0000 (22:56 +0200)]
Update src/llvm-project to include rust-lang/llvm-project#27.

4 years agoChange makefile back to python27.
Steven Malis [Fri, 15 Nov 2019 19:19:13 +0000 (11:19 -0800)]
Change makefile back to python27.

4 years agoRemove newtype for qualifs in `rustc_metadata`
Dylan MacKenzie [Thu, 14 Nov 2019 20:07:35 +0000 (12:07 -0800)]
Remove newtype for qualifs in `rustc_metadata`

We have a proper type for these now, so the wrapper is no longer
necessary.

4 years agoFix nits from review
Dylan MacKenzie [Thu, 14 Nov 2019 19:58:50 +0000 (11:58 -0800)]
Fix nits from review

4 years agoUse `mir::QualifSet` to store qualifs
Dylan MacKenzie [Thu, 14 Nov 2019 17:16:08 +0000 (09:16 -0800)]
Use `mir::QualifSet` to store qualifs

4 years agoUse a bespoke type for the result of `mir_const_qualif`
Dylan MacKenzie [Thu, 14 Nov 2019 17:15:23 +0000 (09:15 -0800)]
Use a bespoke type for the result of `mir_const_qualif`

4 years agoA `Downcast` is now reached when const-checking a `for` loop
Dylan MacKenzie [Wed, 13 Nov 2019 22:48:59 +0000 (14:48 -0800)]
A `Downcast` is now reached when const-checking a `for` loop

I believe this occurs because the old checker stopped processing basic
blocks after a `SwitchInt`.

4 years agoRemove -Z flag for suppressing validation mismatch ICE
Dylan MacKenzie [Wed, 13 Nov 2019 20:57:58 +0000 (12:57 -0800)]
Remove -Z flag for suppressing validation mismatch ICE

4 years agoAdd explanation of test for validation mismatch
Dylan MacKenzie [Wed, 13 Nov 2019 20:51:16 +0000 (12:51 -0800)]
Add explanation of test for validation mismatch

4 years agoSilence miri unleashed warnings in test
Dylan MacKenzie [Wed, 13 Nov 2019 20:50:41 +0000 (12:50 -0800)]
Silence miri unleashed warnings in test