Commit Graph

102385 Commits

Author SHA1 Message Date
Wesley Wiser
4505ff4bad [mir-opt] Handle aggregates in SimplifyLocals pass 2019-11-08 22:28:53 -05:00
Wesley Wiser
8316701d37 [mir-opt] Handle const-prop for the return place 2019-11-08 22:27:27 -05:00
Mazdak Farrokhzad
5011ec7fed move attr meta grammar to parse::validate_atr + ast_validation 2019-11-09 02:04:24 +01:00
Eduard-Mihai Burtescu
0da85d6228 rustc_metadata: don't let LLVM confuse rmeta blobs for COFF object files. 2019-11-09 02:06:22 +02:00
bors
475c713b2f Auto merge of #66194 - alexcrichton:update-clang, r=Mark-Simulacrum
Update Clang & build MSVC LLVM with it

This is a general update of our builders to Clang 9, and then it also attempts to tackle a bit of #66192 by building LLVM for rustc with Clang, not with the system `cl.exe` on MSVC.
2019-11-08 23:28:06 +00:00
Dylan MacKenzie
a3b03690c0 Clean up dead code in qualify_consts
We don't do promotion here anymore, so `Checker` will never even visit
the body of a non-const `fn`.
2019-11-08 15:00:20 -08:00
Dylan MacKenzie
b13c2c330d Bless tests now that we do promotion if min_const_fn fails
We bailed out of `QualifyAndPromoteConsts` immediately if the
`min_const_fn` checks failed, which sometimes resulted in additional,
spurious errors since promotion was skipped.

We now do promotion in a completely separate pass, so this is no longer
an issue.
2019-11-08 15:00:20 -08:00
Dylan MacKenzie
b316384e14 Use new PromoteTemps for promotion 2019-11-08 15:00:20 -08:00
Dylan MacKenzie
170272b74f Add a PromoteTemps pass
`remove_storage_dead_and_drop` has been copied to `promote_temps` and
now operates on an array of `Candidate`s instead of a bitset.
2019-11-08 14:58:27 -08:00
Dylan MacKenzie
3783ef6dbe Stop returning promotables from mir_const_qualif 2019-11-08 14:52:22 -08:00
Alexander Nye
619f057dae remove vestigial comments referring to defunct numeric trait hierarchy
see also https://github.com/rust-lang/rust/pull/23104/files
2019-11-08 13:51:07 -08:00
Mark Mansi
8635482e23 update rustc-guide 2019-11-08 11:48:12 -06:00
Bryan Burgers
413ab57c02 docs: Fix link to BufWriter::flush
One of the links in the docs was being rendered as a literal
open-bracket followed by a single quote, instead of being transformed
into a link. Fix it to match the link earlier in the same paragraph.
2019-11-08 10:18:58 -06:00
Lzu Tao
3db1005c9d add link to unstable book for asm! macro 2019-11-08 15:58:25 +00:00
bors
9e346646e9 Auto merge of #66225 - Centril:rollup-it0t5tk, r=Centril
Rollup of 5 pull requests

Successful merges:

 - #65785 (Transition future compat lints to {ERROR, DENY} - Take 2)
 - #66007 (Remove "here" from "expected one of X here")
 - #66043 (rename Memory::get methods to get_raw to indicate their unchecked nature)
 - #66154 (miri: Rename to_{u,i}size to to_machine_{u,i}size)
 - #66188 (`MethodSig` -> `FnSig` & Use it in `ItemKind::Fn`)

Failed merges:

r? @ghost
2019-11-08 15:52:14 +00:00
Mazdak Farrokhzad
65c77bc09a
Rollup merge of #66188 - Centril:fnsig, r=davidtwco
`MethodSig` -> `FnSig` & Use it in `ItemKind::Fn`

In both AST & HIR, rename `MethodSig` to `FnSig` and then proceed to use it in `ItemKind::Fn` so that the overall structure is more regular.

r? @davidtwco
2019-11-08 16:50:41 +01:00
Mazdak Farrokhzad
76db11c165
Rollup merge of #66154 - RalfJung:to_usize, r=oli-obk
miri: Rename to_{u,i}size to to_machine_{u,i}size

Having a function `to_usize` that does not return a (host) usize is somewhat confusing, so let's rename it.

r? @oli-obk
2019-11-08 16:50:40 +01:00
Mazdak Farrokhzad
3b0438aa7b
Rollup merge of #66043 - RalfJung:memory-get-raw, r=cramertj
rename Memory::get methods to get_raw to indicate their unchecked nature

Some recent Miri PRs started using these methods when they should not; this should discourage their use.

In fact we could make these methods private to the `interp` module as far as Miri is concerned -- with the exception of the `uninit` intrinsic which will hopefully go away soon. @bjorn3 @oli-obk does priroda need these methods? It would be great to be able to seal them away.
2019-11-08 16:50:38 +01:00
Mazdak Farrokhzad
5a6fd110b8
Rollup merge of #66007 - estebank:remove-here, r=Centril
Remove "here" from "expected one of X here"
2019-11-08 16:50:35 +01:00
Mazdak Farrokhzad
7ab50e4006
Rollup merge of #65785 - Centril:compat-to-error-2, r=oli-obk
Transition future compat lints to {ERROR, DENY} - Take 2

Follow up to https://github.com/rust-lang/rust/pull/63247 implementing https://github.com/rust-lang/rust/pull/63247#issuecomment-536295992.

- `legacy_ctor_visibility` (ERROR) -- closes #39207
- `legacy_directory_ownership` (ERROR) -- closes #37872
- `safe_extern_static` (ERROR) -- closes #36247
- `parenthesized_params_in_types_and_modules` (ERROR) -- closes #42238
- `duplicate_macro_exports` (ERROR)
- `nested_impl_trait` (ERROR) -- closes #59014
- `ill_formed_attribute_input` (DENY) -- transitions #57571
- `patterns_in_fns_without_body` (DENY) -- transitions #35203

r? @varkor
cc @petrochenkov
2019-11-08 16:50:33 +01:00
Mazdak Farrokhzad
b4c6abcf9e ast::ItemKind::Fn: use ast::FnSig 2019-11-08 09:32:20 +01:00
Mazdak Farrokhzad
2cd48e8a3b ast::MethodSig -> ast::FnSig 2019-11-08 09:32:20 +01:00
Mazdak Farrokhzad
27511b22df hir::MethodSig -> hir::FnSig 2019-11-08 09:32:20 +01:00
Mazdak Farrokhzad
30d7279628 hir::ItemKind::Fn: use hir::MethodSig 2019-11-08 09:32:20 +01:00
Ralf Jung
900fc9a2f0 miri: Rename to_{u,i}size to to_machine_{u,i}size
Having a function `to_usize` that does not return a usize is somewhat confusing
2019-11-08 09:21:49 +01:00
Ralf Jung
15ec8f7c52 rename Memory::get methods to get_raw to indicate their unchecked nature 2019-11-08 09:20:30 +01:00
bors
76ade3e8ac 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
2019-11-08 07:55:53 +00:00
Daniel Silverstone
33ded3ec7f
rustdoc: Deliberately load extern crates before processing docs
In order that we can successfully later resolve paths in crates
which weren't loaded as a result of merely parsing the crate
we're documenting, we force the resolution of the path to each
crate before cloning the resolver to use later.  Closes #66159

Signed-off-by: Daniel Silverstone <dsilvers@digital-scurf.org>
2019-11-08 07:41:40 +00:00
Daniel Silverstone
2c33568a77
rustdoc: Support --extern-private but treat as --extern
This makes `rustdoc` support `--extern-private` but treats it
the same as `--extern` which is useful for making the CLI more
similar to `rustc` to ease test suite integration.

Signed-off-by: Daniel Silverstone <dsilvers@digital-scurf.org>
2019-11-08 07:31:24 +00:00
bors
c34472b770 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
2019-11-08 04:44:23 +00:00
Yuki Okushi
1969f415fa
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.
2019-11-08 13:42:24 +09:00
Yuki Okushi
63a4551ed0
Rollup merge of #66165 - Wind-River:master_xyz, r=alexcrichton
Ignore these tests ,since the called commands doesn't exist in VxWorks
2019-11-08 13:42:22 +09:00
Yuki Okushi
14553819bb
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.
2019-11-08 13:42:21 +09:00
Yuki Okushi
392ebad5c6
Rollup merge of #66123 - GuillaumeGomez:no-more-hidden-elements, r=Dylan-DPC
No more hidden elements

Fixes #66046.

Follow-up of #66082.

r? @kinnison
2019-11-08 13:42:19 +09:00
Yuki Okushi
996d94a9db
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
2019-11-08 13:42:17 +09:00
Yuki Okushi
9dc5d0ec81
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
2019-11-08 13:42:16 +09:00
Yuki Okushi
a00c777b75
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");
```
2019-11-08 13:42:14 +09:00
Yuki Okushi
32aa327ba3
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
2019-11-08 13:42:12 +09:00
bors
d2574403b3 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
2019-11-08 01:15:50 +00:00
bors
e8f43b72eb 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
2019-11-07 22:02:41 +00:00
Alex Crichton
a7b0beac6d Attempt to fix *.yml confguration on Azure
Currently the `RUST_CONFIGURE_ARGS` variable apparently has a trailing
newline at the end of it due to the way it's configured in yaml. This
causes issues with MSVC's `install-clang.sh` step where the way the bash
syntax works out means that we drop the arg we're trying to add and it
doesn't actually get added!

The hopeful fix here is to tweak how we specify the yaml syntax to not
have a trailing newline, we'll see what CI says about this...
2019-11-07 13:06:56 -08:00
Alex Crichton
1e4c2ae622 Update clang to build LLVM to 9.0.0
This also ensure that we're using the same clang version for all our
major platforms instead of 8.0 on Linux and 7.0 on OSX/Windows.
2019-11-07 13:06:56 -08:00
Vadim Petrochenkov
5eb1cf1619 rustc_metadata: Rename schema to rmeta
And change `rmeta.rs` to `rmeta/mod.rs`
2019-11-07 21:06:48 +03:00
Vadim Petrochenkov
2b75147451 rustc_metadata: Privatize more entities 2019-11-07 21:06:47 +03:00
Vadim Petrochenkov
166d5f8b2f rustc_metadata: Privatize everything in decoder 2019-11-07 21:06:47 +03:00
Vadim Petrochenkov
0c9d4246b0 rustc_metadata: Move cstore_impl into mod decoder 2019-11-07 21:06:12 +03:00
Vadim Petrochenkov
8e1ae56bc6 rustc_metadata: Privatize everything in schema and schema/table 2019-11-07 21:06:12 +03:00
Vadim Petrochenkov
8590b16d9b rustc_metadata: Move decoder/encoder/table into mod schema 2019-11-07 21:04:42 +03:00
Eduard-Mihai Burtescu
ccde510c95 rustc_target: inline abi::FloatTy into abi::Primitive. 2019-11-07 16:54:25 +02:00
Eric Huss
ee459c6200 Update for unstable option refactoring. 2019-11-07 06:43:07 -08:00