Commit Graph

102473 Commits

Author SHA1 Message Date
Gabriel Smith
eaf8fd0569 test: const-generics: Update tests removing unrequired braces
Braces were left in cases where generic args were in the generic const
paths.
2019-11-18 17:23:22 -05:00
Gabriel Smith
fb6cfde5ba rustc: lowering: Lower type args as const args when resolved in value
namespace
2019-11-18 17:23:22 -05:00
Gabriel Smith
7b4642f441 resolve: late: Check if type arg is really a const arg
A path type argument could be a generic const argument due to
limitations as to what we can determine at parsing. We double check just
to be sure by trying to resolve in the type namespace first, and if that
fails we try again in the value namespace. If resolution in the value
namespace succeeds, we have a generic const argument on our hands.
2019-11-18 17:01:48 -05:00
Gabriel Smith
128ca7415f rustc: hir: Add method to check validity of a Res/Def in a namespace 2019-11-18 17:01:48 -05:00
Gabriel Smith
041a612dad resolve: Allow idents to resolve to primitives in the type namespace 2019-11-18 17:01:33 -05:00
bors
a0d40f8bdf 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
2019-11-18 09:14:12 +00:00
bors
9966af3897 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.~~
2019-11-18 06:09:04 +00:00
bors
d67ca28354 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
2019-11-18 03:06:42 +00:00
bors
361791bb5f 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.
2019-11-18 00:05:38 +00:00
bors
0f0c640e0e 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
2019-11-17 18:38:15 +00:00
bors
d8014582b8 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
2019-11-17 15:25:10 +00:00
bors
4b6cef1e32 Auto merge of #66488 - RalfJung:miri, r=RalfJung
update Miri

r? @ghost Cc @oli-obk
2019-11-17 10:45:37 +00:00
Ralf Jung
2bfa622a99 update Miri 2019-11-17 11:40:18 +01:00
bors
5966d9b4d9 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)
2019-11-17 07:45:00 +00:00
bors
8831d766ac 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
2019-11-17 04:37:53 +00:00
Yuki Okushi
f65cb87a09
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.
2019-11-17 13:36:25 +09:00
Yuki Okushi
750dd03a23
Rollup merge of #66471 - Alexendoo:test-issue-63116, r=Centril
Add test for issue 63116

Closes #63116
2019-11-17 13:36:24 +09:00
Yuki Okushi
c0fccf5d62
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
2019-11-17 13:36:22 +09:00
Yuki Okushi
937195beb1
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
2019-11-17 13:36:21 +09:00
Yuki Okushi
404081fd48
Rollup merge of #66465 - mulimoen:fix_lifetime_elision_not_shown, r=rkruppe
add missing 'static lifetime in docs
2019-11-17 13:36:19 +09:00
Yuki Okushi
6e6c46c694
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
2019-11-17 13:36:18 +09:00
Yuki Okushi
05482d03bc
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).
2019-11-17 13:36:16 +09:00
Yuki Okushi
842612fcc0
Rollup merge of #66381 - Centril:66340, r=petrochenkov
find_deprecation: deprecation attr may be ill-formed meta.

Fixes #66340.

r? @petrochenkov
cc @pnkfelix
2019-11-17 13:36:15 +09:00
Yuki Okushi
54998d1b3f
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.
2019-11-17 13:36:13 +09:00
Yuki Okushi
b83d50d34f
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
2019-11-17 13:36:12 +09:00
Yuki Okushi
d8f2526703
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.
2019-11-17 13:36:10 +09:00
Esteban Küber
2fe8371268 review comments and fix rebase 2019-11-16 16:12:22 -08:00
bors
2cdc289cb8 Auto merge of #66394 - wesleywiser:fix_oom, r=oli-obk
Fix two OOM issues related to `ConstProp`

Fixes #66342
Fixes #66397

r? @oli-obk
2019-11-16 22:54:33 +00:00
Alex Macleod
cfe94b421b Add test for issue 63116 2019-11-16 22:32:59 +00:00
Vadim Petrochenkov
28aec1beaa Add some more tests 2019-11-17 01:11:35 +03:00
Vadim Petrochenkov
11580ced40 Address review comments 2019-11-17 01:11:28 +03:00
Esteban Küber
7a2f3ee73f Account for rustc_on_unimplemented 2019-11-16 13:23:19 -08:00
Esteban Küber
0f7f2346a6 Remove unnecessary note 2019-11-16 13:23:19 -08:00
Esteban Küber
970503b2e1 Modify primary label message to be inline with error message 2019-11-16 13:23:19 -08:00
Esteban Küber
f57413b717 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.
2019-11-16 13:23:19 -08:00
Esteban Küber
405a3dd91c Tweak code formatting 2019-11-16 13:23:19 -08:00
Adam Schwalm
3407c49c41 Clarify transmute_copy documentation example 2019-11-16 14:47:33 -06:00
Mahmoud Al-Qudsi
a36c3f6f68 Revise the text of vec::split_off() per review in #65739
Remove the incorrect usage of "copy" as the trait is not called.
2019-11-16 14:15:07 -06:00
Mahmoud Al-Qudsi
8c7530ade8 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.
2019-11-16 14:15:07 -06:00
bors
5c5b8afd80 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).
2019-11-16 19:50:48 +00:00
Vadim Petrochenkov
a699f17483 parse: Use string literal parsing in the asm macro 2019-11-16 21:21:37 +03:00
Vadim Petrochenkov
b85a3da421 parse: Support parsing optional literals
Revert weird renaming of the former `LitError::report`
2019-11-16 21:21:37 +03:00
Vadim Petrochenkov
00bc449602 ast: Keep string literals in ABIs precisely 2019-11-16 21:21:37 +03:00
Vadim Petrochenkov
266f547127 ast: Keep extern qualifiers in functions more precisely 2019-11-16 21:21:37 +03:00
Wesley Wiser
2dea8af20c Only run tests on x86_64 2019-11-16 13:01:12 -05:00
Vadim Petrochenkov
8575743793 rustc_plugin: Remove Registry::register_attribute 2019-11-16 18:50:23 +03:00
Vadim Petrochenkov
8668c1a190 Add some more tests 2019-11-16 18:31:55 +03:00
Vadim Petrochenkov
808522894b expand: Stop marking derive helper attributes as known
Pass them through name resolution instead
2019-11-16 18:31:47 +03:00
Vadim Petrochenkov
a3126a5013 resolve: Introduce a new scope for derive helpers 2019-11-16 18:20:57 +03:00
Vadim Petrochenkov
c064630e77 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
```
2019-11-16 18:20:39 +03:00