Commit Graph

128528 Commits

Author SHA1 Message Date
Tyler Mandry
6bd57e3531 Bump bootstrap version and update changelog 2020-09-28 20:15:43 +00:00
Tyler Mandry
ed975054aa Update CI scripts to accommodate --host change 2020-09-28 20:15:43 +00:00
Vadim Petrochenkov
4a4a7f8599 expand: Minor fn ptr call cleanup 2020-09-28 23:10:48 +03:00
Vadim Petrochenkov
85ef265dbe expand: Stop un-interpolating NtIdents before passing them to built-in macros
This was a big hack, and built-in macros should be able to deal with `NtIdents` in the input by themselves like any other parser code.
2020-09-28 23:10:44 +03:00
Tyler Mandry
52ca5ca7b7 Remove skip_only_host_steps
And make tests explicitly list their hosts and targets.
2020-09-28 19:32:46 +00:00
Tyler Mandry
e715c7f234 bootstrap: Always build for host, even when target is given
This changes the behavior from *not* building for host whenever an
explicit target is specified. I find this much less confusing.

You can still disable host steps by passing an explicit empty list for
host.

Fixes #76990.
2020-09-28 19:32:46 +00:00
Jacob Hughes
5829560a68 Rename AllocErr to AllocError 2020-09-28 14:51:03 -04:00
varkor
c0b105780e Fix run-make-fulldeps tests 2020-09-28 19:44:53 +01:00
Bastian Kauschke
db5b70f193 move candidate_from_obligation_no_cache 2020-09-28 20:21:44 +02:00
Bastian Kauschke
a4783debe0 const evaluatable: improve TooGeneric handling 2020-09-28 20:18:06 +02:00
bors
fc2daaae61 Auto merge of #77302 - RalfJung:rollup-n8gg3v6, r=RalfJung
Rollup of 7 pull requests

Successful merges:

 - #76454 (UI to unit test for those using Cell/RefCell/UnsafeCell)
 - #76474 (Add option to pass a custom codegen backend from a driver)
 - #76711 (diag: improve closure/generic parameter mismatch)
 - #77170 (Remove `#[rustc_allow_const_fn_ptr]` and add `#![feature(const_fn_fn_ptr_basics)]`)
 - #77194 (Add doc alias for iterator fold)
 - #77288 (fix building libstd for Miri on macOS)
 - #77295 (Update unstable-book: Fix ABNF in inline assembly docs)

Failed merges:

r? `@ghost`
2020-09-28 18:02:45 +00:00
Ralf Jung
d9c11929a5
Rollup merge of #77295 - jethrogb:jb/unstable-book-asm, r=Amanieu
Update unstable-book: Fix ABNF in inline assembly docs

r? @Amanieu
2020-09-28 18:39:49 +02:00
Ralf Jung
a966f54bbb
Rollup merge of #77288 - RalfJung:miri-macos, r=Amanieu
fix building libstd for Miri on macOS

Fixes a Miri regression introduced by https://github.com/rust-lang/rust/pull/75295
Cc @tmiasko @Amanieu
2020-09-28 18:39:47 +02:00
Ralf Jung
aba966a592
Rollup merge of #77194 - pickfire:patch-7, r=withoutboats
Add doc alias for iterator fold

fold is known in python and javascript as reduce,
not sure about inject but it was written in doc there.

This was my first confusion when coming into rust, I somehow cannot find where is reduce, sometimes I still forget that it is known as `fold`.
2020-09-28 18:39:46 +02:00
Ralf Jung
85a59d40f1
Rollup merge of #77170 - ecstatic-morse:const-fn-ptr, r=oli-obk
Remove `#[rustc_allow_const_fn_ptr]` and add `#![feature(const_fn_fn_ptr_basics)]`

`rustc_allow_const_fn_ptr` was a hack to work around the lack of an escape hatch for the "min `const fn`" checks in const-stable functions. Now that we have co-opted `allow_internal_unstable` for this purpose, we no longer need a bespoke attribute.

Now this functionality is gated under `const_fn_fn_ptr_basics` (how concise!), and `#[allow_internal_unstable(const_fn_fn_ptr_basics)]` replaces `#[rustc_allow_const_fn_ptr]`. `const_fn_fn_ptr_basics` allows function pointer types to appear in the arguments and locals of a `const fn` as well as function pointer casts to be performed inside a `const fn`. Both of these were allowed in constants and statics already. Notably, this does **not** allow users to invoke function pointers in a const context. Presumably, we will use a nicer name for that (`const_fn_ptr`?).

r? @oli-obk
2020-09-28 18:39:44 +02:00
Ralf Jung
88ae20d8aa
Rollup merge of #76711 - davidtwco:issue-51154-param-closure, r=estebank
diag: improve closure/generic parameter mismatch

Fixes #51154.

This PR improves the diagnostic when a type parameter is expected and a closure is found, noting that each closure has a distinct type and therefore could not always match the caller-chosen type of the parameter.

r? @estebank
2020-09-28 18:39:42 +02:00
Ralf Jung
6a8cdbd285
Rollup merge of #76474 - bjorn3:driver_selected_codegen, r=oli-obk
Add option to pass a custom codegen backend from a driver

This allows the driver to pass information to the codegen backend. For example the headcrab debugger may in the future want to use cg_clif to JIT code to be injected in the debuggee. This would PR make it possible to tell cg_clif which symbol can be found at which address and to tell it to inject the JITed code into the right process.

This PR may also help with https://github.com/rust-lang/miri/pull/1540 by allowing miri to provide a codegen backend that only emits metadata and doesn't perform any codegen.

cc @nbaksalyar (headcrab)
cc @RalfJung (miri)
2020-09-28 18:39:40 +02:00
Ralf Jung
734c57d45c
Rollup merge of #76454 - poliorcetics:ui-to-unit-test-1, r=matklad
UI to unit test for those using Cell/RefCell/UnsafeCell

Helps with #76268.

I'm working on all files using `Cell` and moving them to unit tests when possible.

r? @matklad
2020-09-28 18:39:39 +02:00
bors
d62d3f7fa9 Auto merge of #76899 - wesleywiser:experimental_unsound_mir_opts_flag, r=oli-obk
[mir-opt] Introduce a new flag to enable experimental/unsound mir opts

This implements part of https://github.com/rust-lang/compiler-team/issues/319. The exact name of this flag was not decided as part of that MCP and some people expressed that it should include "unsound" in some way.

I've chosen to use `enable-experimental-unsound-mir-opts` as the name. While long, I don't think that matters too much as really it will only be used by some mir-opt tests. If you object or have a better name, please leave a comment!

r? `@oli-obk`
cc `@rust-lang/wg-mir-opt` `@RalfJung`
2020-09-28 15:32:27 +00:00
Joshua Nelson
d537067c97 Don't warn if the config file is somewhere other than config.toml
Previously, `config.config` was always hardcoded as `"config.toml"`.
I thought that it was being overridden with the actual value later, but
it turns out `flags.config` was being completely discarded. This keeps
`config.config` in sync with `flags.config`.
2020-09-28 10:28:15 -04:00
Jethro Beekman
6817b6238d Update unstable-book: Fix ABNF in inline assembly docs 2020-09-28 15:57:21 +02:00
Lzu Tao
d4772014d9 Prefer asm! in std - all in sgx module 2020-09-28 13:08:34 +00:00
bors
535d27ac9a Auto merge of #77236 - matthewjasper:defer-typeof-impl-trait, r=davidtwco
Compute underlying type of impl trait types later in compilation

Also change a `bug!` to `delay_span_bug`
Closes #74018
2020-09-28 12:47:23 +00:00
Jake Goulding
630e353101 Use an anchor for the try build 2020-09-28 07:45:39 -04:00
Jake Goulding
9da1582b8e Move the try builder below the auto builders
This allows us to make use of a YAML anchor when specifying the try
builder config.
2020-09-28 07:45:39 -04:00
bors
1d5a865b2f Auto merge of #77282 - glaubitz:sparc-linux, r=nagisa
Add missing definitions required by the sparc-unknown-linux-gnu target

This PR adds a few missing definitions required by sparc-unknown-linux-target which were discovered during build tests.
2020-09-28 10:37:41 +00:00
Tim Diekmann
c22d896b9b Change AllocRef::by_ref to take &self instead of &mut self 2020-09-28 10:42:29 +02:00
bors
96555ba608 Auto merge of #77261 - oli-obk:const_generic_array_serializer, r=matthewjasper
Deduplicate and generalize some (de/)serializer impls

I noticed this while implementing #77227 and getting a "not implemented for [T; 16]" error. There's likely more things we can deduplicate in this file, but I didn't need any additional changes.
2020-09-28 08:33:00 +00:00
Ralf Jung
dc8414b607 fix building libstd for Miri on macOS 2020-09-28 10:32:05 +02:00
bors
4e3eb52493 Auto merge of #77265 - vandenheuvel:chalkup, r=Dylan-DPC
Update chalk to 0.29.0
2020-09-28 06:20:02 +00:00
Aman Arora
adda0cd685 Add tests for updated closure/generator printing
Co-authored-by: Dhruv Jauhar <dhruvjhr@gmail.com>
Co-authored-by: Logan Mosier <logmosier@gmail.com>
2020-09-28 01:34:47 -04:00
Aman Arora
c923da0b49 pretty.rs: Update Closure and Generator print
Co-authored-by: Dhruv Jauhar <dhruvjhr@gmail.com>
Co-authored-by: Logan Mosier <logmosier@gmail.com>
2020-09-28 01:27:19 -04:00
Joe Richey
37f795697c
libary: Forward compiler-builtins "mem" feature
This fixes https://github.com/rust-lang/wg-cargo-std-aware/issues/53

Now users will be able to do:
```
cargo build -Zbuild-std=core -Zbuild-std-features=compiler-builtins-mem
```
and correctly get the Rust implemenations for `memcpy` and friends.

Signed-off-by: Joe Richey <joerichey@google.com>
2020-09-27 20:31:06 -07:00
bors
6369a98ebd Auto merge of #77008 - fortanix:raoul/lvi-tests, r=Mark-Simulacrum
LVI hardening tests

Mitigating the speculative execution LVI attack against SGX enclaves requires compiler changes (i.e., adding lfences). This pull requests adds various tests to check if this happens correctly.
2020-09-28 03:28:04 +00:00
bors
db7ee7cc0d Auto merge of #75295 - tmiasko:fds, r=Amanieu
Reopen standard file descriptors when they are missing on Unix

The syscalls returning a new file descriptors generally return lowest-numbered
file descriptor not currently opened, without any exceptions for those
corresponding to stdin, sdout, or stderr.

Previously when any of standard file descriptors has been closed before starting
the application, operations on std::io::{stderr,stdin,stdout} were likely to
either succeed while being performed on unrelated file descriptor, or fail with
EBADF which is silently ignored.

Avoid the issue by using /dev/null as a replacement when the standard file
descriptors are missing.

The implementation is based on the one found in musl. It was selected among a
few others on the basis of the lowest overhead in the case when all descriptors
are already present (measured on GNU/Linux).

Closes #57728.
Closes #46981.
Closes #60447.

Benefits:
* Makes applications robust in the absence of standard file descriptors.
* Upholds IntoRawFd / FromRawFd safety contract (which was broken previously).

Drawbacks:
* Additional syscall during startup.
* The standard descriptors might have been closed intentionally.
* Requires /dev/null.

Alternatives:
* Check if stdin, stdout, stderr are opened and provide no-op substitutes in std::io::{stdin,stdout,stderr} without reopening them directly.
* Leave the status quo, expect robust applications to reopen them manually.
2020-09-28 00:58:40 +00:00
Wesley Wiser
c653af81b1 Remove unnecessary -Zunsound-mir-opts uses in tests 2020-09-27 19:29:15 -04:00
Wesley Wiser
b9d0ea95c8 [mir-opt] Introduce a new flag to enable experimental/unsound mir opts 2020-09-27 19:21:01 -04:00
John Paul Adrian Glaubitz
d25b0364e1 library/std: Set OS raw type definitions for sparc-unknown-linux-gnu 2020-09-28 00:39:57 +02:00
John Paul Adrian Glaubitz
d9de08d65c library/std/sys_common: Define MIN_ALIGN for sparc-unknown-linux-gnu 2020-09-28 00:39:57 +02:00
John Paul Adrian Glaubitz
1fefba5e0b library/{panic_,}unwind: Add definitions for sparc-unknow-linux-gnu 2020-09-28 00:39:57 +02:00
Tomasz Miąsko
063d5e9d8b liveness: Test interaction with automatically_derived attribute 2020-09-27 23:55:53 +02:00
Tomasz Miąsko
33dde94d33 liveness: Inline visitor implementation for IrMaps 2020-09-27 23:55:53 +02:00
Tomasz Miąsko
536b51aca0 liveness: Store upvars_mentioned inside Liveness struct 2020-09-27 23:55:53 +02:00
Tomasz Miąsko
b629ffd96b liveness: Use visit_param to add variables corresponding to params 2020-09-27 23:55:53 +02:00
Tomasz Miąsko
e0db21dc7e liveness: Use upvars instead of FnKind to check for closures
Avoiding FnKind will make it easier to run liveness analysis on all
bodies in the future, not just fn-like things.
2020-09-27 23:55:52 +02:00
Tomasz Miąsko
e3319e7d16 liveness: Move body_owner field from IrMaps to Liveness
The Liveness struct is the only user of body_owner field.  Move the
field there.
2020-09-27 23:55:52 +02:00
bors
c0b15cc6ed Auto merge of #77242 - ecstatic-morse:dataflow-switch-int, r=jonas-schievink
Replace `discriminant_switch_effect` with more general version

#68528 added a new edge-specific effect for `SwitchInt` terminators, `discriminant_switch_effect`, to the dataflow framework. While this accomplished the short-term goal of making drop elaboration more precise, it wasn't really useful in other contexts: It only supported `SwitchInt`s on the discriminant of an `enum` and did not allow effects to be applied along the "otherwise" branch. In const-propagation, for example, arbitrary edge-specific effects for the targets of a `SwitchInt` can be used to remember the value a `match` scrutinee must have in each arm.

This PR replaces `discriminant_switch_effect` with a more general `switch_int_edge_effects` method. The new method has a slightly different interface from the other edge-specific effect methods (e.g. `call_return_effect`). This divergence is explained in the new method's documentation, and reading the changes to the various dataflow impls as well as `direction.rs` should further clarify things. This PR should not change behavior.
2020-09-27 21:54:49 +00:00
Tomasz Miąsko
7d98d2207a Reopen standard streams when they are closed on Unix
The syscalls returning a new file descriptors generally use
lowest-numbered file descriptor not currently opened, without any
exceptions for those corresponding to the standard streams.

Previously when any of standard streams has been closed before starting
the application, operations on std::io::{stderr,stdin,stdout} objects
were likely to operate on other logically unrelated file resources
opened afterwards.

Avoid the issue by reopening the standard streams when they are closed.
2020-09-27 22:55:43 +02:00
bors
7f7a1cbfd3 Auto merge of #77229 - tmiasko:liveness, r=lcnr
Small improvements in liveness pass

* Remove redundant debug logging (`add_variable` already contains logging).
* Remove redundant fields for a number of live nodes and variables.
* Delay conversion from a symbol to a string until linting.
* Inline contents of specials struct.
* Remove unnecessary local variable exit_ln.
* Use newtype_index for Variable and LiveNode.
* Access live nodes directly through self.lnks[ln].

No functional changes intended (except those related to the logging).
2020-09-27 19:38:01 +00:00
Dylan MacKenzie
807260be9f Remove feature gate test for rustc_allow_const_fn_ptr 2020-09-27 11:51:40 -07:00