]> git.lizzy.rs Git - rust.git/log
rust.git
4 years agoAuto merge of #66066 - ecstatic-morse:remove-promotion-from-qualify-consts, r=eddyb
bors [Fri, 8 Nov 2019 07:55:53 +0000 (07:55 +0000)]
Auto merge of #66066 - ecstatic-morse:remove-promotion-from-qualify-consts, r=eddyb

Remove promotion candidate gathering and checking from `qualify_consts.rs`

This makes promotion candidate gathering and checking the exclusive domain of `promote_consts`, but the `QualifyAndPromoteConsts` pass is still responsible for both const-checking and creating promoted MIR fragments.

This should not be merged until the beta branches on Nov. 5.

r? @eddyb

4 years agoAuto merge of #66208 - JohnTitor:rollup-2umgjer, r=JohnTitor
bors [Fri, 8 Nov 2019 04:44:23 +0000 (04:44 +0000)]
Auto merge of #66208 - JohnTitor:rollup-2umgjer, r=JohnTitor

Rollup of 8 pull requests

Successful merges:

 - #65554 (Enhance the documentation of BufReader for potential data loss)
 - #65580 (Add `MaybeUninit` methods `uninit_array`, `slice_get_ref`, `slice_get_mut`)
 - #66049 (consistent handling of missing sysroot spans)
 - #66056 (rustc_metadata: Some reorganization of the module structure)
 - #66123 (No more hidden elements)
 - #66157 (Improve math log documentation examples)
 - #66165 (Ignore these tests ,since the called commands doesn't exist in VxWorks)
 - #66190 (rustc_target: inline abi::FloatTy into abi::Primitive.)

Failed merges:

 - #66188 (`MethodSig` -> `FnSig` & Use it in `ItemKind::Fn`)

r? @ghost

4 years agoRollup merge of #66190 - eddyb:primflt, r=Centril
Yuki Okushi [Fri, 8 Nov 2019 04:42:24 +0000 (13:42 +0900)]
Rollup merge of #66190 - eddyb:primflt, r=Centril

rustc_target: inline abi::FloatTy into abi::Primitive.

This effectively undoes a small part of @oli-obk's #50967, now that the rest of the compiler doesn't use the `FloatTy` definition from `rustc_target`, post-#65884.

4 years agoRollup merge of #66165 - Wind-River:master_xyz, r=alexcrichton
Yuki Okushi [Fri, 8 Nov 2019 04:42:22 +0000 (13:42 +0900)]
Rollup merge of #66165 - Wind-River:master_xyz, r=alexcrichton

Ignore these tests ,since the called commands doesn't exist in VxWorks

4 years agoRollup merge of #66157 - srinivasreddy:improv, r=alexcrichton
Yuki Okushi [Fri, 8 Nov 2019 04:42:21 +0000 (13:42 +0900)]
Rollup merge of #66157 - srinivasreddy:improv, r=alexcrichton

Improve math log documentation examples

using 2.0.log(2.0) in examples does not make it clear which is the base and number. This example makes it clear for programmers who take a glance at the example by following the calculation. It is more intuitive, and eliminates the need for executing the example in the playground.

4 years agoRollup merge of #66123 - GuillaumeGomez:no-more-hidden-elements, r=Dylan-DPC
Yuki Okushi [Fri, 8 Nov 2019 04:42:19 +0000 (13:42 +0900)]
Rollup merge of #66123 - GuillaumeGomez:no-more-hidden-elements, r=Dylan-DPC

No more hidden elements

Fixes #66046.

Follow-up of #66082.

r? @kinnison

4 years agoRollup merge of #66056 - petrochenkov:metapriv, r=eddyb
Yuki Okushi [Fri, 8 Nov 2019 04:42:17 +0000 (13:42 +0900)]
Rollup merge of #66056 - petrochenkov:metapriv, r=eddyb

rustc_metadata: Some reorganization of the module structure

The new structure of `rustc_metadata` (or rather its parts affected by the refactoring) is
```
├── lib.rs
└── rmeta
    ├── decoder
    │   └── cstore_impl.rs
    ├── decoder.rs
    ├── encoder.rs
    ├── mod.rs
    └── table.rs
```

(`schema` is renamed to `rmeta`.)

The code inside `rmeta` is pretty self-contained, so we can now privatize almost everything in this module instead of using `pub(crate)`  which was necessary when all these modules accessed their neighbors in the old flat structure.

`encoder` and `decoder` work with structures defined by `rmeta`.
`table` is a part of `rmeta`.
`cstore_impl` actively uses decoder methods and exposes their results through very few public methods (`provide` and `_untracked` methods).

r? @eddyb @spastorino

4 years agoRollup merge of #66049 - RalfJung:missing-spans, r=alexcrichton
Yuki Okushi [Fri, 8 Nov 2019 04:42:16 +0000 (13:42 +0900)]
Rollup merge of #66049 - RalfJung:missing-spans, r=alexcrichton

consistent handling of missing sysroot spans

Due to https://github.com/rust-lang/rust/issues/53081, sysroot spans (pointing to code in libcore/libstd/...) fails to print on some x86 runners. This consolidates the ignore directives for that and references the relevant issue.

I also did that for the generated derive-error-span tests -- but there the script and the tests were not entirely in sync any more since https://github.com/rust-lang/rust/pull/64151. Cc @estebank @varkor

4 years agoRollup merge of #65580 - SimonSapin:maybeuninit-array, r=Amanieu
Yuki Okushi [Fri, 8 Nov 2019 04:42:14 +0000 (13:42 +0900)]
Rollup merge of #65580 - SimonSapin:maybeuninit-array, r=Amanieu

Add `MaybeUninit` methods `uninit_array`, `slice_get_ref`, `slice_get_mut`

Eventually these will hopefully become the idiomatic way to work with partially-initialized stack buffers.

All methods are unstable. Note that `uninit_array` takes a type-level `const usize` parameter, so it is blocked (at least in its current form) on const generics.

Example:

```rust
use std::mem::MaybeUninit;

let input = b"Foo";
let f = u8::to_ascii_uppercase;

let mut buffer: [MaybeUninit<u8>; 32] = MaybeUninit::uninit_array();
let vec;
let output = if let Some(buffer) = buffer.get_mut(..input.len()) {
    buffer.iter_mut().zip(input).for_each(|(a, b)| { a.write(f(b)); });
    unsafe { MaybeUninit::slice_get_ref(buffer) }
} else {
    vec = input.iter().map(f).collect::<Vec<u8>>();
    &vec
};

assert_eq!(output, b"FOO");
```

4 years agoRollup merge of #65554 - gliderkite:bufreader-doc-enhance, r=KodrAus
Yuki Okushi [Fri, 8 Nov 2019 04:42:12 +0000 (13:42 +0900)]
Rollup merge of #65554 - gliderkite:bufreader-doc-enhance, r=KodrAus

Enhance the documentation of BufReader for potential data loss

This is (IMO) and enhancement of the `std::io::BufReader` documentation, that aims to highlight how relatively easy is to end up with data loss when improperly using an instance of this class.

This is following the issue I had figuring out why my application was loosing data, because I focused my attention on the word *multiple instances* of `BufReader` in its `struct` documentation, even if I ever only had one instance.

Link to the issue: https://github.com/tokio-rs/tokio/issues/1662

4 years agoAuto merge of #64882 - ehuss:stabilize-bare-extern, r=eddyb
bors [Fri, 8 Nov 2019 01:15:50 +0000 (01:15 +0000)]
Auto merge of #64882 - ehuss:stabilize-bare-extern, r=eddyb

Stabilize --extern flag without a path.

This stabilizes the `--extern` flag without a path, implemented in #54116.

This flag is used to add a crate that may be found in the search path to the extern prelude. The intent of stabilizing this now is to change Cargo to emit this flag for `proc_macro` when building a proc-macro crate. This will allow the ability to elide `extern crate proc_macro;` for proc-macros, one of the few places where it is still necessary.

It is intended that Cargo may also use this flag for other cases in the future as part of the [std-aware work](https://github.com/rust-lang/wg-cargo-std-aware/). There will likely be some kind of syntax where users may declare dependencies on other crates (such as `alloc`), and Cargo will use this flag so that they may be used like any other crate. At this time there are no short-term plans to use it for anything other than proc-macro.

This will not help for non-proc-macro crates that use `proc_macro`, which I believe is not too common?

An alternate approach for proc-macro is to use the `meta` crate, but from my inquiries there doesn't appear to be anyone interested in pushing that forward. The `meta` crate also doesn't help with things like `alloc` or `test`.

cc #57288

4 years agoAuto merge of #66189 - Centril:rollup-3bsf45s, r=Centril
bors [Thu, 7 Nov 2019 22:02:41 +0000 (22:02 +0000)]
Auto merge of #66189 - Centril:rollup-3bsf45s, r=Centril

Rollup of 5 pull requests

Successful merges:

 - #63793 (Have tidy ensure that we document all `unsafe` blocks in libcore)
 - #64696 ([rustdoc] add sub settings)
 - #65916 (syntax: move stuff around)
 - #66087 (Update some build-pass ui tests to use check-pass where applicable)
 - #66182 (invalid_value lint: fix help text)

Failed merges:

r? @ghost

4 years agorustc_metadata: Rename `schema` to `rmeta`
Vadim Petrochenkov [Mon, 4 Nov 2019 08:57:17 +0000 (11:57 +0300)]
rustc_metadata: Rename `schema` to `rmeta`

And change `rmeta.rs` to `rmeta/mod.rs`

4 years agorustc_metadata: Privatize more entities
Vadim Petrochenkov [Sun, 3 Nov 2019 15:27:24 +0000 (18:27 +0300)]
rustc_metadata: Privatize more entities

4 years agorustc_metadata: Privatize everything in decoder
Vadim Petrochenkov [Sun, 3 Nov 2019 14:13:07 +0000 (17:13 +0300)]
rustc_metadata: Privatize everything in decoder

4 years agorustc_metadata: Move cstore_impl into mod decoder
Vadim Petrochenkov [Sun, 3 Nov 2019 14:36:16 +0000 (17:36 +0300)]
rustc_metadata: Move cstore_impl into mod decoder

4 years agorustc_metadata: Privatize everything in schema and schema/table
Vadim Petrochenkov [Sun, 3 Nov 2019 14:33:27 +0000 (17:33 +0300)]
rustc_metadata: Privatize everything in schema and schema/table

4 years agorustc_metadata: Move decoder/encoder/table into mod schema
Vadim Petrochenkov [Sun, 3 Nov 2019 12:56:11 +0000 (15:56 +0300)]
rustc_metadata: Move decoder/encoder/table into mod schema

4 years agorustc_target: inline abi::FloatTy into abi::Primitive.
Eduard-Mihai Burtescu [Thu, 7 Nov 2019 14:54:25 +0000 (16:54 +0200)]
rustc_target: inline abi::FloatTy into abi::Primitive.

4 years agoUpdate for unstable option refactoring.
Eric Huss [Wed, 16 Oct 2019 16:55:40 +0000 (09:55 -0700)]
Update for unstable option refactoring.

4 years agoRemove docs on --extern metadata precedence.
Eric Huss [Wed, 16 Oct 2019 14:37:53 +0000 (07:37 -0700)]
Remove docs on --extern metadata precedence.

4 years agoAdd test for --extern alloc=librustc.rlib
Eric Huss [Tue, 8 Oct 2019 16:45:24 +0000 (09:45 -0700)]
Add test for --extern alloc=librustc.rlib

4 years agoUpdate src/test/ui-fulldeps/pathless-extern-unstable.rs
Eric Huss [Mon, 7 Oct 2019 14:58:28 +0000 (07:58 -0700)]
Update src/test/ui-fulldeps/pathless-extern-unstable.rs

Add ERROR

Co-Authored-By: Mazdak Farrokhzad <twingoow@gmail.com>
4 years agoUpdate extern linking documentation.
Eric Huss [Mon, 30 Sep 2019 01:20:03 +0000 (18:20 -0700)]
Update extern linking documentation.

4 years agoUpdate built-in help for --extern.
Eric Huss [Mon, 30 Sep 2019 01:17:48 +0000 (18:17 -0700)]
Update built-in help for --extern.

4 years agoAdd more --extern tests.
Eric Huss [Mon, 30 Sep 2019 01:17:27 +0000 (18:17 -0700)]
Add more --extern tests.

4 years agoStabilize --extern flag without a path.
Eric Huss [Sat, 28 Sep 2019 19:04:06 +0000 (12:04 -0700)]
Stabilize --extern flag without a path.

4 years agoRollup merge of #66182 - RalfJung:invalid-value, r=Centril
Mazdak Farrokhzad [Thu, 7 Nov 2019 13:27:26 +0000 (14:27 +0100)]
Rollup merge of #66182 - RalfJung:invalid-value, r=Centril

invalid_value lint: fix help text

Now that we also warn about `MaybUninit::uninit().assume_init()`, just telling people "use `MaybeUninit`" isn't always sufficient. And anyway this seems like an important enough point to mention it here.

4 years agoRollup merge of #66087 - tmiasko:ui-mode, r=Centril
Mazdak Farrokhzad [Thu, 7 Nov 2019 13:27:24 +0000 (14:27 +0100)]
Rollup merge of #66087 - tmiasko:ui-mode, r=Centril

Update some build-pass ui tests to use check-pass where applicable

Helps with issue https://github.com/rust-lang/rust/issues/62277.

4 years agoRollup merge of #65916 - Centril:split-syntax-3, r=davidtwco
Mazdak Farrokhzad [Thu, 7 Nov 2019 13:27:23 +0000 (14:27 +0100)]
Rollup merge of #65916 - Centril:split-syntax-3, r=davidtwco

syntax: move stuff around

Part of https://github.com/rust-lang/rust/pull/65324.

r? @davidtwco
cc @estebank @petrochenkov

4 years agoRollup merge of #64696 - GuillaumeGomez:rustdoc-sub-settings, r=kinnison
Mazdak Farrokhzad [Thu, 7 Nov 2019 13:27:21 +0000 (14:27 +0100)]
Rollup merge of #64696 - GuillaumeGomez:rustdoc-sub-settings, r=kinnison

[rustdoc] add sub settings

This PR is to give a finer control over what types are automatically expanded or not as well as the possibility to add sub-settings in the settings page.

![Screenshot from 2019-09-23 00-46-14](https://user-images.githubusercontent.com/3050060/65395521-15aff300-dd9c-11e9-9437-429ca347d455.png)

r? @Mark-Simulacrum

4 years agoRollup merge of #63793 - oli-obk:🧹, r=dtolnay
Mazdak Farrokhzad [Thu, 7 Nov 2019 13:27:20 +0000 (14:27 +0100)]
Rollup merge of #63793 - oli-obk:🧹, r=dtolnay

Have tidy ensure that we document all `unsafe` blocks in libcore

cc @rust-lang/libs

I documented a few and added ignore flags on the other files. We can incrementally document the files, but won't regress any files this way.

4 years agomove syntax::{parse::literal -> util::literal}
Mazdak Farrokhzad [Fri, 11 Oct 2019 16:47:14 +0000 (18:47 +0200)]
move syntax::{parse::literal -> util::literal}

4 years agomove syntax::parse::lexer::comments -> syntax::util::comments
Mazdak Farrokhzad [Fri, 11 Oct 2019 12:39:52 +0000 (14:39 +0200)]
move syntax::parse::lexer::comments -> syntax::util::comments

4 years agosyntax::attr: remove usage of lexer
Mazdak Farrokhzad [Fri, 11 Oct 2019 12:14:30 +0000 (14:14 +0200)]
syntax::attr: remove usage of lexer

4 years agomove parse::classify -> util::classify
Mazdak Farrokhzad [Fri, 11 Oct 2019 11:17:20 +0000 (13:17 +0200)]
move parse::classify -> util::classify

4 years agomove PResult to librustc_errors
Mazdak Farrokhzad [Fri, 11 Oct 2019 11:06:36 +0000 (13:06 +0200)]
move PResult to librustc_errors

4 years agosyntax::parser::token -> syntax::token
Mazdak Farrokhzad [Fri, 11 Oct 2019 10:46:32 +0000 (12:46 +0200)]
syntax::parser::token -> syntax::token

4 years agomove unescape_error_reporting to lexer/
Mazdak Farrokhzad [Fri, 11 Oct 2019 10:32:18 +0000 (12:32 +0200)]
move unescape_error_reporting to lexer/

4 years agosyntax: simplify imports
Mazdak Farrokhzad [Fri, 11 Oct 2019 10:29:23 +0000 (12:29 +0200)]
syntax: simplify imports

4 years agomove parse/parser.rs -> parse/parser/mod.rs
Mazdak Farrokhzad [Fri, 25 Oct 2019 02:57:40 +0000 (04:57 +0200)]
move parse/parser.rs -> parse/parser/mod.rs

4 years agoMaybeUninit::uninit_array docs: better example
Simon Sapin [Sat, 26 Oct 2019 07:19:48 +0000 (09:19 +0200)]
MaybeUninit::uninit_array docs: better example

4 years agoApply docs suggestions from review
Simon Sapin [Sat, 26 Oct 2019 06:51:49 +0000 (08:51 +0200)]
Apply docs suggestions from review

Co-Authored-By: Mazdak Farrokhzad <twingoow@gmail.com>
4 years agoAdd `MaybeUninit` methods `uninit_array`, `slice_get_ref`, `slice_get_mut`
Simon Sapin [Fri, 18 Oct 2019 22:48:21 +0000 (00:48 +0200)]
Add `MaybeUninit` methods `uninit_array`, `slice_get_ref`, `slice_get_mut`

4 years agoOnly call onHashChange instead of both functions
Guillaume Gomez [Thu, 7 Nov 2019 09:16:14 +0000 (10:16 +0100)]
Only call onHashChange instead of both functions

4 years agoinvalid_value lint: fix help text
Ralf Jung [Thu, 7 Nov 2019 09:22:50 +0000 (10:22 +0100)]
invalid_value lint: fix help text

4 years agoRemove old isHidden function
Guillaume Gomez [Thu, 7 Nov 2019 09:13:44 +0000 (10:13 +0100)]
Remove old isHidden function

4 years agoAuto merge of #66180 - Centril:rollup-c1ji943, r=Centril
bors [Thu, 7 Nov 2019 07:55:39 +0000 (07:55 +0000)]
Auto merge of #66180 - Centril:rollup-c1ji943, r=Centril

Rollup of 5 pull requests

Successful merges:

 - #59789 (Revert two unapproved changes to rustc_typeck.)
 - #65752 (Use structured suggestions for missing associated items)
 - #65884 (syntax: ABI-oblivious grammar)
 - #65974 (A scheme for more macro-matcher friendly pre-expansion gating)
 - #66017 (Add future incompatibility lint for `array.into_iter()`)

Failed merges:

 - #66056 (rustc_metadata: Some reorganization of the module structure)

r? @ghost

4 years agoRollup merge of #66017 - LukasKalbertodt:array-into-iter-lint, r=matthewjasper
Mazdak Farrokhzad [Thu, 7 Nov 2019 07:51:58 +0000 (08:51 +0100)]
Rollup merge of #66017 - LukasKalbertodt:array-into-iter-lint, r=matthewjasper

Add future incompatibility lint for `array.into_iter()`

This is for #65819. This lint warns when calling `into_iter` on an array directly. That's because today the method call resolves to `<&[T] as IntoIterator>::into_iter` but that would change when adding `IntoIterator` impls for arrays. This problem is discussed in detail in #65819.

We still haven't decided how to proceed exactly, but it seems like adding a lint is a good idea regardless?

Also: this is the first time I implement a lint, so there are probably a lot of things I can improve. I used a different strategy than @scottmcm describes [here](https://github.com/rust-lang/rust/pull/65819#issuecomment-548667847) since I already started implementing this before they commented.

### TODO

- [x] Decide if we want this lint -> apparently [we want](https://github.com/rust-lang/rust/pull/65819#issuecomment-548964818)
- [x] Open a lint-tracking-issue and add the correct issue number in the code -> https://github.com/rust-lang/rust/issues/66145

4 years agoRollup merge of #65974 - Centril:matcher-friendly-gating, r=petrochenkov
Mazdak Farrokhzad [Thu, 7 Nov 2019 07:51:57 +0000 (08:51 +0100)]
Rollup merge of #65974 - Centril:matcher-friendly-gating, r=petrochenkov

A scheme for more macro-matcher friendly pre-expansion gating

Pre-expansion gating will now avoid gating macro matchers that did not result in `Success(...)`. That is, the following is now OK despite `box 42` being a valid `expr` and that form being pre-expansion gated:

```rust
macro_rules! m {
    ($e:expr) => { 0 }; // This fails on the input below due to `, foo`.
    (box $e:expr, foo) => { 1 }; // Successful matcher, we should get `2`.
}

fn main() {
    assert_eq!(1, m!(box 42, foo));
}
```

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

r? @petrochenkov
cc @Mark-Simulacrum

4 years agoRollup merge of #65884 - Centril:non-hardcoded-abis, r=petrochenkov
Mazdak Farrokhzad [Thu, 7 Nov 2019 07:51:55 +0000 (08:51 +0100)]
Rollup merge of #65884 - Centril:non-hardcoded-abis, r=petrochenkov

syntax: ABI-oblivious grammar

This PR has the following effects:

1. `extern $lit` is now legal where `$lit:literal` and `$lit` is substituted for a string literal.

2. `extern "abi_that_does_not_exist"` is now *syntactically* legal whereas before, the set of ABI strings was hard-coded into the grammar of the language. With this PR, the set of ABIs are instead validated and translated during lowering. That seems more appropriate.

3. `ast::FloatTy` is now distinct from `rustc_target::abi::FloatTy`. The former is used substantially more and the translation between them is only necessary in a single place.

4. As a result of 2-3, libsyntax no longer depends on librustc_target, which should improve pipe-lining somewhat.

cc @rust-lang/lang -- the points 1-2 slightly change the definition of the language but in a way which seems consistent with our general principles (in particular wrt. the discussions of turning things into semantic errors). I expect this to be uncontroversial but it's worth letting y'all know. :)

r? @varkor

4 years agoRollup merge of #65752 - estebank:sugg, r=Centril
Mazdak Farrokhzad [Thu, 7 Nov 2019 07:51:54 +0000 (08:51 +0100)]
Rollup merge of #65752 - estebank:sugg, r=Centril

Use structured suggestions for missing associated items

When encountering an `impl` that is missing associated items required by its `trait`, use structured suggestions at an appropriate place in the `impl`.

4 years agoRollup merge of #59789 - eddyb:typeck-reverts, r=nikomatsakis
Mazdak Farrokhzad [Thu, 7 Nov 2019 07:51:52 +0000 (08:51 +0100)]
Rollup merge of #59789 - eddyb:typeck-reverts, r=nikomatsakis

Revert two unapproved changes to rustc_typeck.

There was a breakdown in process (https://github.com/rust-lang/rust/pull/59004#issuecomment-477600735, https://github.com/rust-lang/rust/pull/58894#discussion_r272795560) and two changes were made to `rustc_typeck`'s "collect" queries, for rustdoc, that were neither needed *nor* correct.
I'm reverting them here, and will fix up rustdoc *somehow*, if necessary.

cc @rust-lang/compiler How do we ensure this doesn't happen again?

r? @nikomatsakis or @oli-obk

4 years agoUse -Zsave-analysis when compiling issue-37323.rs
Tomasz Miąsko [Wed, 6 Nov 2019 00:00:00 +0000 (00:00 +0000)]
Use -Zsave-analysis when compiling issue-37323.rs

4 years agosyntax: use distinct FloatTy from rustc_target.
Mazdak Farrokhzad [Mon, 28 Oct 2019 02:46:22 +0000 (03:46 +0100)]
syntax: use distinct FloatTy from rustc_target.

We also sever syntax's dependency on rustc_target as a result.
This should slightly improve pipe-lining.

Moreover, some cleanup is done in related code.

4 years agotest that extern lits accept raw strings annd escapes
Mazdak Farrokhzad [Wed, 30 Oct 2019 12:53:53 +0000 (13:53 +0100)]
test that extern lits accept raw strings annd escapes

4 years agotest that parser is oblivious to set of ABIs
Mazdak Farrokhzad [Mon, 28 Oct 2019 03:13:38 +0000 (04:13 +0100)]
test that parser is oblivious to set of ABIs

4 years agoparser: allow ABIs from literal macro fragments
Mazdak Farrokhzad [Sun, 27 Oct 2019 23:29:23 +0000 (00:29 +0100)]
parser: allow ABIs from literal macro fragments

4 years agocleanup can_begin_const_arg
Mazdak Farrokhzad [Sun, 27 Oct 2019 22:22:59 +0000 (23:22 +0100)]
cleanup can_begin_const_arg

4 years agoparser: don't hardcode ABIs into grammar
Mazdak Farrokhzad [Sun, 27 Oct 2019 22:14:35 +0000 (23:14 +0100)]
parser: don't hardcode ABIs into grammar

4 years agoAuto merge of #66175 - JohnTitor:rollup-ihqk5vn, r=JohnTitor
bors [Thu, 7 Nov 2019 03:54:25 +0000 (03:54 +0000)]
Auto merge of #66175 - JohnTitor:rollup-ihqk5vn, r=JohnTitor

Rollup of 12 pull requests

Successful merges:

 - #65794 (gate rustc_on_unimplemented under rustc_attrs)
 - #65945 (Optimize long-linker-command-line test)
 - #66044 (Improve uninit/zeroed lint)
 - #66076 (HIR docs: mention how to resolve method paths)
 - #66084 (Do not require extra LLVM backends for `x.py test` to pass)
 - #66111 (improve from_raw_parts docs)
 - #66114 (Improve std::thread::Result documentation)
 - #66117 (Fixed PhantomData markers in Arc and Rc)
 - #66146 (Remove unused parameters in `__thread_local_inner`)
 - #66147 (Miri: Refactor to_scalar_ptr out of existence)
 - #66162 (Fix broken link in README)
 - #66171 (Update link on CONTRIBUTING.md)

Failed merges:

r? @ghost

4 years agoIgnore these tests ,since the called commands doesn't exist in VxWorks
Umesh Kalappa [Wed, 30 Oct 2019 09:29:16 +0000 (02:29 -0700)]
Ignore these tests ,since the called commands doesn't exist in VxWorks

4 years agoRollup merge of #66171 - JohnTitor:update-link, r=ehuss
Yuki Okushi [Thu, 7 Nov 2019 00:20:49 +0000 (09:20 +0900)]
Rollup merge of #66171 - JohnTitor:update-link, r=ehuss

Update link on CONTRIBUTING.md

This is a lost article of #66162
Follow-up for rust-lang/rustc-guide#491

CC: @mark-i-m
4 years agoRollup merge of #66162 - Darksonn:master, r=ehuss
Yuki Okushi [Thu, 7 Nov 2019 00:20:48 +0000 (09:20 +0900)]
Rollup merge of #66162 - Darksonn:master, r=ehuss

Fix broken link in README

The link to the rustc guide on building and running the compiler is broken. It was broken in [rustc-guide#491](https://github.com/rust-lang/rustc-guide/pull/491).

4 years agoRollup merge of #66147 - RalfJung:no-scalar-ptr, r=oli-obk
Yuki Okushi [Thu, 7 Nov 2019 00:20:46 +0000 (09:20 +0900)]
Rollup merge of #66147 - RalfJung:no-scalar-ptr, r=oli-obk

Miri: Refactor to_scalar_ptr out of existence

`to_scalar_ptr` is somewhat subtle as it just throws away the 2nd component of a `ScalarPair` if there is one -- without any check if this is truly a pointer or so. And indeed we used it wrong on two occasions!

So I fixed those two, and then refactored things such that everyone calls `ref_to_mplace` instead (which they did anyway, I just moved up the calls), which is the only place that should interpret a `ScalarPair` as a wide ptr -- and it checks the type first. Thus we can remove `to_scalar_ptr` and `to_meta`.

r? @oli-obk

4 years agoRollup merge of #66146 - 3442853561:patch-2, r=Mark-Simulacrum
Yuki Okushi [Thu, 7 Nov 2019 00:20:45 +0000 (09:20 +0900)]
Rollup merge of #66146 - 3442853561:patch-2, r=Mark-Simulacrum

Remove unused parameters in `__thread_local_inner`

Fixes #65993.

4 years agoRollup merge of #66117 - olegnn:fixed_linked_list_marker, r=RalfJung
Yuki Okushi [Thu, 7 Nov 2019 00:20:44 +0000 (09:20 +0900)]
Rollup merge of #66117 - olegnn:fixed_linked_list_marker, r=RalfJung

Fixed PhantomData markers in Arc and Rc

Include owned internal structs in `PhantomData` markers in `Arc` (`PhantomData<T>` => `PhantomData<ArcInner<T>>`) and `Rc` (`PhantomData<T>` => `PhantomData<RcBox<T>>`).

4 years agoRollup merge of #66114 - golddranks:improve_thread_docs, r=Centril
Yuki Okushi [Thu, 7 Nov 2019 00:20:42 +0000 (09:20 +0900)]
Rollup merge of #66114 - golddranks:improve_thread_docs, r=Centril

Improve std::thread::Result documentation

Thanks to @dtolnay for pointing out the different premise of the contents of the `Err` variant in `std::thread::Result` WRT normal error handling.

4 years agoRollup merge of #66111 - RalfJung:from_raw_parts, r=Centril
Yuki Okushi [Thu, 7 Nov 2019 00:20:41 +0000 (09:20 +0900)]
Rollup merge of #66111 - RalfJung:from_raw_parts, r=Centril

improve from_raw_parts docs

Triggered by https://github.com/rust-lang/rfcs/pull/2806. Hopefully this helps clarify that joining slices across allocations is not possible in Rust currently.

r? @Centril

4 years agoRollup merge of #66084 - petrochenkov:x86arm, r=alexcrichton
Yuki Okushi [Thu, 7 Nov 2019 00:20:39 +0000 (09:20 +0900)]
Rollup merge of #66084 - petrochenkov:x86arm, r=alexcrichton

Do not require extra LLVM backends for `x.py test` to pass

For long time our testing passed with a partially built LLVM
```
[llvm]
targets = "X86;ARM"
```
, a [recent PR](https://github.com/rust-lang/rust/pull/65809) changed that.

4 years agoRollup merge of #66076 - RalfJung:qpath, r=davidtwco,oli-obk
Yuki Okushi [Thu, 7 Nov 2019 00:20:38 +0000 (09:20 +0900)]
Rollup merge of #66076 - RalfJung:qpath, r=davidtwco,oli-obk

HIR docs: mention how to resolve method paths

4 years agoRollup merge of #66044 - RalfJung:uninit-lint, r=oli-obk
Yuki Okushi [Thu, 7 Nov 2019 00:20:36 +0000 (09:20 +0900)]
Rollup merge of #66044 - RalfJung:uninit-lint, r=oli-obk

Improve uninit/zeroed lint

* Also warn when creating a raw pointer with a NULL vtable.
* Also identify `MaybeUninit::uninit().assume_init()` and `MaybeUninit::zeroed().assume_init()` as dangerous.

4 years agoRollup merge of #65945 - tmiasko:long-linker-command-line, r=alexcrichton
Yuki Okushi [Thu, 7 Nov 2019 00:20:34 +0000 (09:20 +0900)]
Rollup merge of #65945 - tmiasko:long-linker-command-line, r=alexcrichton

Optimize long-linker-command-line test

Replace O(n^3) text matching with inexpensive hash set lookups.

On my machine this reduces the total runtime of complete
run-make-fulldeps suite from roughly 75 seconds to 45 seconds.

4 years agoRollup merge of #65794 - Centril:unimpl-internal, r=varkor
Yuki Okushi [Thu, 7 Nov 2019 00:20:33 +0000 (09:20 +0900)]
Rollup merge of #65794 - Centril:unimpl-internal, r=varkor

gate rustc_on_unimplemented under rustc_attrs

Move `rustc_on_implemented` from the `on_implemented` gate to `rustc_attrs` as it is internal.

Closes #29628

r? @varkor

4 years agoAuto merge of #65750 - nnethercote:cheaper-doc-comments, r=petrochenkov
bors [Thu, 7 Nov 2019 00:10:52 +0000 (00:10 +0000)]
Auto merge of #65750 - nnethercote:cheaper-doc-comments, r=petrochenkov

Cheaper doc comments

This PR implements the idea from #60935: represent doc comments more cheaply, rather than converting them into `#[doc="..."]` attribute form. Unlike #60936 (which is about coalescing doc comments to reduce their number), this approach does not have any backwards compatibility concerns, and it eliminates about 80-90% of the current cost of doc comments (as estimated using the numbers in #60930, which eliminated the cost of doc comments entirely by treating them as normal comments).

r? @petrochenkov

4 years agoFix other broken link
Yuki Okushi [Wed, 6 Nov 2019 23:30:44 +0000 (08:30 +0900)]
Fix other broken link

4 years agoUpdate link on CONTRIBUTING.md
Yuki Okushi [Wed, 6 Nov 2019 21:48:28 +0000 (06:48 +0900)]
Update link on CONTRIBUTING.md

4 years agoAuto merge of #65728 - ecstatic-morse:promotion-const-proj, r=eddyb
bors [Wed, 6 Nov 2019 18:12:57 +0000 (18:12 +0000)]
Auto merge of #65728 - ecstatic-morse:promotion-const-proj, r=eddyb

Fix promotion in a `const` when projections are present

Resolves #65727.

This marks the entire local as "needs promotion" when only a projection of that local appears in a promotable context. This should only affect promotion in a `const` or `static`, not in a `fn` or `const fn`, which is handled in `promote_consts.rs`.

r? @eddyb

4 years agoreview comments
Esteban Küber [Wed, 30 Oct 2019 19:55:38 +0000 (12:55 -0700)]
review comments

4 years agoSuggest missing item from `trait` in `impl`
Esteban Küber [Thu, 24 Oct 2019 05:45:15 +0000 (22:45 -0700)]
Suggest missing item from `trait` in `impl`

4 years agoTry with crate::error::Error
Pyry Kontio [Wed, 6 Nov 2019 16:45:30 +0000 (01:45 +0900)]
Try with crate::error::Error

4 years agoFix broken link in README
Alice Ryhl [Wed, 6 Nov 2019 15:41:24 +0000 (16:41 +0100)]
Fix broken link in README

4 years agoAdd test for promotability in `let`
Dylan MacKenzie [Wed, 6 Nov 2019 15:09:16 +0000 (07:09 -0800)]
Add test for promotability in `let`

The old const-checker conservatively reset qualifs when
`IsNotPromotable` was in the return place. Unfortunately, named
variables have `IsNotPromotable`, so this could cause promotion to fail.
This should work now.

4 years agoRemove `IsNotPromotable` and `IsNotImplicitlyPromotable`
Dylan MacKenzie [Sun, 3 Nov 2019 20:49:01 +0000 (12:49 -0800)]
Remove `IsNotPromotable` and `IsNotImplicitlyPromotable`

The former was cleared from `qualifs_in_return_place`, and the latter
was never checked. `QUALIF_ERROR_BIT` no longer corresponds to a real
`Qualif`, however.

4 years agoRemove `promotion_candidates` from `Checker`
Dylan MacKenzie [Sun, 3 Nov 2019 20:42:38 +0000 (12:42 -0800)]
Remove `promotion_candidates` from `Checker`

Also removes any code used only to populate `promotion_candidates`
during const checking.

4 years agoRemove `valid_promotion_candidates`
Dylan MacKenzie [Sun, 3 Nov 2019 20:36:13 +0000 (12:36 -0800)]
Remove `valid_promotion_candidates`

We no longer compare the results of
`promote_consts::validate_candidates` with
`checker.promotion_candidates`, and `promote_consts` becomes the
canonical source for determining promotability.

4 years agousing 2.0.log(2.0) in examples does not make it clear which is the base and number...
Srinivas Reddy Thatiparthy [Wed, 6 Nov 2019 13:50:01 +0000 (19:20 +0530)]
using 2.0.log(2.0) in examples  does not make it clear which is the base and number. This example makes it clear for programmers who take a glance at the example by following the calculation. It is more intuitive, and eliminates the need for executing the example in the playground.

4 years agoReplace `array.into_iter()` with `iter()` in `libtest/tests.rs`
Lukas Kalbertodt [Fri, 1 Nov 2019 12:43:44 +0000 (13:43 +0100)]
Replace `array.into_iter()` with `iter()` in `libtest/tests.rs`

4 years agoAdd UI test for `array.into_iter()` lint
Lukas Kalbertodt [Fri, 1 Nov 2019 11:04:31 +0000 (12:04 +0100)]
Add UI test for `array.into_iter()` lint

4 years agoAdd future incompatibility lint for `array.into_iter()`
Lukas Kalbertodt [Fri, 1 Nov 2019 11:04:18 +0000 (12:04 +0100)]
Add future incompatibility lint for `array.into_iter()`

As we might want to add `IntoIterator` impls for arrays in the future,
and since that introduces a breaking change, this lint warns and
suggests using `iter()` instead (which is shorter and more explicit).

4 years agoAuto merge of #65134 - davidtwco:issue-19834-improper-ctypes-in-extern-C-fn, r=rkruppe
bors [Wed, 6 Nov 2019 12:45:35 +0000 (12:45 +0000)]
Auto merge of #65134 - davidtwco:issue-19834-improper-ctypes-in-extern-C-fn, r=rkruppe

improper_ctypes: `extern "C"` fns

cc #19834. Fixes #65867.

This pull request implements the change [described in this comment](https://github.com/rust-lang/rust/issues/19834#issuecomment-466671572).

cc @rkruppe @varkor @shepmaster

4 years agoMake doc comments cheaper with `AttrKind`.
Nicholas Nethercote [Wed, 23 Oct 2019 19:33:12 +0000 (06:33 +1100)]
Make doc comments cheaper with `AttrKind`.

`AttrKind` is a new type with two variants, `Normal` and `DocComment`. It's a
big performance win (over 10% in some cases) because `DocComment` lets doc
comments (which are common) be represented very cheaply.

`Attribute` gets some new helper methods to ease the transition:
- `has_name()`: check if the attribute name matches a single `Symbol`; for
  `DocComment` variants it succeeds if the symbol is `sym::doc`.
- `is_doc_comment()`: check if it has a `DocComment` kind.
- `{get,unwrap}_normal_item()`: extract the item from a `Normal` variant;
  panic otherwise.

Fixes #60935.

4 years agoRemove unnecessary `Deref` impl for `Attribute`.
Nicholas Nethercote [Wed, 23 Oct 2019 19:40:35 +0000 (06:40 +1100)]
Remove unnecessary `Deref` impl for `Attribute`.

This kind of thing just makes the code harder to read.

4 years agorollback gating for failing macro matchers
Mazdak Farrokhzad [Wed, 30 Oct 2019 16:34:00 +0000 (17:34 +0100)]
rollback gating for failing macro matchers

4 years agorevamp pre-expansion gating infra
Mazdak Farrokhzad [Wed, 30 Oct 2019 15:38:16 +0000 (16:38 +0100)]
revamp pre-expansion gating infra

4 years agoFix markdown link
Ralf Jung [Wed, 6 Nov 2019 10:15:30 +0000 (11:15 +0100)]
Fix markdown link

Co-Authored-By: Oliver Scherer <github35764891676564198441@oli-obk.de>
4 years agoThe unsafety in `iter.rs` is already documented wonderfully
Oliver Scherer [Fri, 25 Oct 2019 16:35:51 +0000 (18:35 +0200)]
The unsafety in `iter.rs` is already documented wonderfully

4 years agoRebase fallout
Oliver Scherer [Fri, 25 Oct 2019 10:03:34 +0000 (12:03 +0200)]
Rebase fallout

4 years agoSilence a deprecation warning
Oliver Scherer [Sat, 19 Oct 2019 11:02:17 +0000 (13:02 +0200)]
Silence a deprecation warning

4 years agoHalloween... time to get rid of 👻
Oliver Scherer [Sat, 19 Oct 2019 11:00:23 +0000 (13:00 +0200)]
Halloween... time to get rid of 👻