Commit Graph

128216 Commits

Author SHA1 Message Date
Eric Huss c297e20e03 Add accessors to Command. 2020-09-26 18:58:38 -07:00
bors 623fb90b5a Auto merge of #76897 - Aaron1011:feature/min-proc-macro-metadata, r=petrochenkov
Encode less metadata for proc-macro crates

Currently, we serialize the same crate metadata for proc-macro crates as
we do for normal crates. This is quite wasteful - almost none of this
metadata is ever used, and much of it can't even be deserialized (if it
contains a foreign `CrateNum`).

This PR changes metadata encoding to skip encoding the majority of crate
metadata for proc-macro crates. Most of the `Lazy<[T]>` fields are left
completetly empty, while the non-lazy fields are left as-is.

Additionally, proc-macros now have a def span that does not include
their body. This was done for normal functions in #75465, but was missed
for proc-macros.

As a result of this PR, we should only ever encode local `CrateNum`s
when encoding proc-macro crates. I've added a specialized serialization
impl for `CrateNum` to assert this.
2020-09-26 20:57:31 +00:00
bors e37c99fa1c Auto merge of #77224 - RalfJung:rollup-hdvb96c, r=RalfJung
Rollup of 12 pull requests

Successful merges:

 - #75454 (Explicitly document the size guarantees that Option makes.)
 - #76631 (Add `x.py setup`)
 - #77076 (Add missing code examples on slice iter types)
 - #77093 (merge `need_type_info_err(_const)`)
 - #77122 (Add `#![feature(const_fn_floating_point_arithmetic)]`)
 - #77127 (Update mdBook)
 - #77161 (Remove TrustedLen requirement from BuilderMethods::switch)
 - #77166 (update Miri)
 - #77181 (Add doc alias for pointer primitive)
 - #77204 (Remove stray word from `ClosureKind::extends` docs)
 - #77207 (Rename `whence` to `span`)
 - #77211 (Remove unused #[allow(...)] statements from compiler/)

Failed merges:

 - #77170 (Remove `#[rustc_allow_const_fn_ptr]` and add `#![feature(const_fn_fn_ptr_basics)]`)

r? `@ghost`
2020-09-26 17:50:26 +00:00
Aaron Hill b9653568a7
Encode less metadata for proc-macro crates
Currently, we serialize the same crate metadata for proc-macro crates as
we do for normal crates. This is quite wasteful - almost none of this
metadata is ever used, and much of it can't even be deserialized (if it
contains a foreign `CrateNum`).

This PR changes metadata encoding to skip encoding the majority of crate
metadata for proc-macro crates. Most of the `Lazy<[T]>` fields are left
completetly empty, while the non-lazy fields are left as-is.

Additionally, proc-macros now have a def span that does not include
their body. This was done for normal functions in #75465, but was missed
for proc-macros.

As a result of this PR, we should only ever encode local `CrateNum`s
when encoding proc-macro crates. I've added a specialized serialization
impl for `CrateNum` to assert this.
2020-09-26 12:26:27 -04:00
Ralf Jung 9e02642fb3
Rollup merge of #77211 - est31:remove_unused_allow, r=oli-obk
Remove unused #[allow(...)] statements from compiler/
2020-09-26 12:58:34 +02:00
Ralf Jung 259e9477f4
Rollup merge of #77207 - camelid:whence-to-span, r=jyn514
Rename `whence` to `span`

It's called `span` elsewhere in the compiler and `span` is also less
surprising. `whence` is whimsical, but not super clear :)

See [this Discord conversation](https://discord.com/channels/442252698964721669/459149231702278154/758731658689511444) for more.

r? @jyn514
2020-09-26 12:58:32 +02:00
Ralf Jung 67f8c5914f
Rollup merge of #77204 - LingMan:patch-3, r=jonas-schievink
Remove stray word from `ClosureKind::extends` docs
2020-09-26 12:58:30 +02:00
Ralf Jung 0a19836a81
Rollup merge of #77181 - GuillaumeGomez:add-pointer-alias, r=jyn514,pickfire
Add doc alias for pointer primitive
2020-09-26 12:58:28 +02:00
Ralf Jung f614ae4a30
Rollup merge of #77166 - RalfJung:miri, r=RalfJung
update Miri

Fixes https://github.com/rust-lang/rust/issues/77130
2020-09-26 12:58:26 +02:00
Ralf Jung 7c47b1e5f4
Rollup merge of #77161 - est31:swich_len_already_trusted, r=petrochenkov
Remove TrustedLen requirement from BuilderMethods::switch

The main use case of TrustedLen is allowing APIs to specialize on it,
but no use of it uses that specialization. Instead, only the .len()
function provided by ExactSizeIterator is used, which is already
required to be accurate.

Thus, the TrustedLen requirement on BuilderMethods::switch is redundant.
2020-09-26 12:58:24 +02:00
Ralf Jung 7ff5b44a58
Rollup merge of #77127 - camelid:update-mdbook, r=Dylan-DPC
Update mdBook

0.4.2 -> 0.4.3

Also updated version requirement in `Cargo.toml` from 0.4.0 to 0.4.3.
2020-09-26 12:58:22 +02:00
Ralf Jung 3b544e73ae
Rollup merge of #77122 - ecstatic-morse:const-fn-arithmetic, r=RalfJung,oli-obk
Add `#![feature(const_fn_floating_point_arithmetic)]`

cc #76618

This is a template for splitting up `const_fn` into granular feature gates. I think this will make it easier, both for us and for users, to track stabilization of each individual feature. We don't *have* to do this, however. We could also keep stabilizing things out from under `const_fn`.

cc @rust-lang/wg-const-eval
r? @oli-obk
2020-09-26 12:58:20 +02:00
Ralf Jung ac8169dc10
Rollup merge of #77093 - lcnr:const-generics-infer-warning, r=varkor
merge `need_type_info_err(_const)`

I hoped that this would automatically solve #76737 but it doesn't quite seem like it

fixes #77092

r? @varkor
2020-09-26 12:58:17 +02:00
Ralf Jung 31fd0ad69f
Rollup merge of #77076 - GuillaumeGomez:missing-code-examples-slice-iter, r=Dylan-DPC
Add missing code examples on slice iter types

r? @Dylan-DPC
2020-09-26 12:58:15 +02:00
Ralf Jung c39598aeea
Rollup merge of #76631 - jyn514:x.py-setup, r=Mark-Simulacrum
Add `x.py setup`

Closes #76503.

- Suggest `x.py setup` if config.toml doesn't exist yet
- Prompt for a profile if not given on the command line
- Print the configuration that will be used
- Print helpful starting commands after setup
- Link to the dev-guide after finishing
2020-09-26 12:58:13 +02:00
Ralf Jung 1e62382a4f
Rollup merge of #75454 - ltratt:option_optimisation_guarantees, r=dtolnay
Explicitly document the size guarantees that Option makes.

Triggered by a discussion on wg-unsafe-code-guidelines about which layouts of `Option<T>` one can guarantee are optimised to a single pointer.

CC @RalfJung
2020-09-26 12:58:12 +02:00
bors 6f9a8a7f9b Auto merge of #76485 - estebank:format_arg_capture_spans, r=davidtwco
Point at named argument not found when using `format_args_capture` instead of whole format string
2020-09-26 10:05:49 +00:00
Guillaume Gomez 21ee1716ee Add doc alias for pointer primitive 2020-09-26 11:21:24 +02:00
Bastian Kauschke 9a607c0a27 unused into 2020-09-26 10:31:34 +02:00
Bastian Kauschke 32195ac8f4 rename functions 2020-09-26 10:28:15 +02:00
bors fd15e6180d Auto merge of #70743 - oli-obk:eager_const_to_pat_conversion, r=eddyb
Fully destructure constants into patterns

r? `@varkor`

as discussed in https://rust-lang.zulipchat.com/#narrow/stream/131828-t-compiler/topic/constants.20in.20patterns/near/192789924

we should probably crater it once reviewed
2020-09-26 06:44:28 +00:00
bors 9e1c436178 Auto merge of #74225 - poliorcetics:std-thread-unsafe-op-in-unsafe-fn, r=joshtriplett
Std/thread: deny unsafe op in unsafe fn

Partial fix of #73904.

This encloses `unsafe` operations in `unsafe fn` in `libstd/thread`.
`@rustbot` modify labels: F-unsafe-block-in-unsafe-fn
2020-09-26 03:54:00 +00:00
bors c6622d1d05 Auto merge of #76176 - marmeladema:fix-closure-path-printing, r=eddyb
Move from {{closure}}#0 syntax to {closure#0} for (def) path components

Part of #70334

I followed the approach described by `@eddyb` and introduced a `DefPathDataName` enum.
To preserve compatibility, in various places, I had to rely on formatting manually by calling `format!("{{{{{}}}}}", namespace)`.

My questions are:
* Do we want to convert for places to use the new naming scheme? Or shall I re-add `DefPathData::as_symbol` but renamed as `DefPathData::as_legacy_symbol` to avoid manually allocating the legacy symbols?
* Do we want to `impl Display for DisambiguatedDefPathData` to avoid manually calling `write!(s, "{{{}#{}}}", namespace, component.disambiguator)`?
* We might also want to improve naming for `DefPathDataName` and `DefPathData::get_name`

r? `@eddyb`
2020-09-26 01:36:50 +00:00
est31 12187b7f86 Remove unused #[allow(...)] statements from compiler/ 2020-09-26 01:25:55 +02:00
Camelid aa6a2f4035 Rename `whence` to `span`
It's called `span` elsewhere in the compiler and `span` is also less
surprising. `whence` is whimsical, but not super clear :)
2020-09-25 14:59:00 -07:00
marmeladema 5946c12476 Move `is_raw_guess` check in `ty::print::pretty` 2020-09-25 22:48:44 +01:00
marmeladema 35bad3edbf Address review comment 2020-09-25 22:48:44 +01:00
marmeladema 601c284e1e Fix tests 2020-09-25 22:48:43 +01:00
marmeladema f25d0bc559 Remove now unused `double_braced_*` symbols 2020-09-25 22:46:15 +01:00
marmeladema 23085b6360 Fix profiling query key creation 2020-09-25 22:46:15 +01:00
marmeladema bb8e1764bb Simplify some match statements on `DefPathDataName' 2020-09-25 22:46:15 +01:00
marmeladema 75130b06bf Avoid calling `Symbol::interner` in `compute_codegen_unit_name` 2020-09-25 22:46:15 +01:00
marmeladema 657ecdb75e Rename `DefPathData::get_name()` to `DefPathData::name()` 2020-09-25 22:46:15 +01:00
marmeladema 2708ad8bb4 Fix pretty-printing of `DisambiguatedDefPathData` 2020-09-25 22:46:15 +01:00
marmeladema 9f50c49117 Implement `Display` for `DisambiguatedDefPathData` and `DefPathData` 2020-09-25 22:46:15 +01:00
marmeladema f1878d19fa Move from {{closure}}#0 syntax to {closure#0} for (def) path components 2020-09-25 22:46:14 +01:00
bors 043f6d747c Auto merge of #77201 - matthewjasper:rename-get-unchecked, r=spastorino
Rename Iterator::get_unchecked

Closes #76479

r? `@pnkfelix`
2020-09-25 21:44:26 +00:00
LingMan 900daba2cb
Remove stray word from `ClosureKind::extends` docs 2020-09-25 23:35:07 +02:00
bors c6e4db620a Auto merge of #77198 - jonas-schievink:rollup-i59i41h, r=jonas-schievink
Rollup of 15 pull requests

Successful merges:

 - #76932 (Relax promises about condition variable.)
 - #76973 (Unstably allow assume intrinsic in const contexts)
 - #77005 (BtreeMap: refactoring around edges)
 - #77066 (Fix dest prop miscompilation around references)
 - #77073 (dead_code: look at trait impls even if they don't contain items)
 - #77086 (Include libunwind in the rust-src component.)
 - #77097 (Make [].as_[mut_]ptr_range() (unstably) const.)
 - #77106 (clarify that `changelog-seen = 1` goes to the beginning of config.toml)
 - #77120 (Add `--keep-stage-std` to `x.py` for keeping only standard library artifacts)
 - #77126 (Invalidate local LLVM cache less often)
 - #77146 (Install std for non-host targets)
 - #77155 (remove enum name from ImplSource variants)
 - #77176 (Removing erroneous semicolon in transmute documentation)
 - #77183 (Allow multiple allow_internal_unstable attributes)
 - #77189 (Remove extra space from vec drawing)

Failed merges:

r? `@ghost`
2020-09-25 19:35:33 +00:00
Guillaume Gomez 187162e991 Add missing code examples on slice iter types 2020-09-25 21:17:22 +02:00
Matthew Jasper 04a0b1d087 Rename Iterator::get_unchecked
It's possible for method resolution to pick this method over a lower
priority stable method,  causing compilation errors. Since this method
is permanently unstable, give it a name that is very unlikely to be used
in user code.
2020-09-25 19:52:01 +01:00
Matthew Jasper 323a27967a Improve <vec::IntoIter>::get_unchecked` safety comment 2020-09-25 19:46:06 +01:00
Jonas Schievink d72b7cc329
Rollup merge of #77189 - pickfire:patch-5, r=Mark-Simulacrum
Remove extra space from vec drawing
2020-09-25 19:42:54 +02:00
Jonas Schievink 12b8d8943d
Rollup merge of #77183 - bugadani:issue-77088, r=varkor
Allow multiple allow_internal_unstable attributes

Fixes #77088
2020-09-25 19:42:52 +02:00
Jonas Schievink a7bdf851cf
Rollup merge of #77176 - austinkeeley:intrinsics-documentatation-error, r=jyn514
Removing erroneous semicolon in transmute documentation

There is a semicolon in the example code that causes the expected value to not be returned.
2020-09-25 19:42:50 +02:00
Jonas Schievink e739468f97
Rollup merge of #77155 - lcnr:ImplSource, r=ecstatic-morse
remove enum name from ImplSource variants

This is quite a lot cleaner in my opinion.
2020-09-25 19:42:48 +02:00
Jonas Schievink ba3e25f992
Rollup merge of #77146 - Mark-Simulacrum:xpyinstall, r=alexcrichton
Install std for non-host targets

It seems reasonable that when configuring various targets you'd expect all of them to get std installed, even if you're not building compiler toolchains for each of those.

cc #76990

r? @alexcrichton
2020-09-25 19:42:46 +02:00
Jonas Schievink 61dc57c85a
Rollup merge of #77126 - Mark-Simulacrum:llvm-less-often, r=alexcrichton
Invalidate local LLVM cache less often

This avoids a download of LLVM after every rebase. The downside to this is that if we land some patch affecting LLVM built in CI that breaks this option, but that PR does not update the LLVM submodule, we'll likely not notice until the next update -- but this seems unlikely to happen in practice and I am not personally worried about it.

r? @alexcrichton
2020-09-25 19:42:44 +02:00
Jonas Schievink 0a3cf02fd7
Rollup merge of #77120 - ecstatic-morse:keep-stage-std, r=Mark-Simulacrum
Add `--keep-stage-std` to `x.py` for keeping only standard library artifacts

Unlike `--keep-stage 0`, `--keep-stage-std 0` will allow the stage 0 compiler artifacts (i.e., stage1/bin/rustc) to be rebuilt if it has changed. This allows contributors to iterate on later stages of the compiler in tandem with the standard library without needing to to rebuild the entire compiler. I often run into this when working on const-checking, since I may need to add a feature gate or make a small tweak to the standard library.
2020-09-25 19:42:43 +02:00
Jonas Schievink 8621ef1159
Rollup merge of #77106 - matthiaskrgr:changelog_seen, r=Mark-Simulacrum
clarify that `changelog-seen = 1` goes to the beginning of config.toml

Fixes #77105
2020-09-25 19:42:41 +02:00