about summary refs log tree commit diff
AgeCommit message (Collapse)AuthorLines
2020-09-29core::global_allocator docs link to std::alloc::GlobalAllocShahar Or (mightyiam)-0/+2
2020-09-29Auto merge of #77257 - ecstatic-morse:optimize-int-range-from-pat, ↵bors-9/+30
r=Mark-Simulacrum Optimize `IntRange::from_pat`, then shrink `ParamEnv` Resolves #77058. r? `@Mark-Simulacrum` cc `@vandenheuvel` Looking at the output of `perf report` for #76244, the hot instructions seemed to be around the call to `pat_constructor` in `IntRange::from_pat`. I carried out an obvious optimization, but it actually made the instruction count higher (see #77075). However, it seems to have mitigated whatever was causing the pipeline stalls, so when combined with #76244, it's a net win. As you can see below, the regression in #76244 seems to have originated from something measured by `stalled-cycles-backend`. I'll try to collect some finer-grained stats to see if I can isolate it. I wish I had a better idea of what was going on here. I'd like to prevent the regression from reappearing in the future due to small changes in unrelated code. <details> <summary>Current `master`:</summary> ``` Performance counter stats for 'cargo +baseline-stage1 check': 2,275.67 msec task-clock:u # 0.998 CPUs utilized 0 context-switches:u # 0.000 K/sec 0 cpu-migrations:u # 0.000 K/sec 49,826 page-faults:u # 0.022 M/sec 5,117,221,678 cycles:u # 2.249 GHz 299,655,943 stalled-cycles-frontend:u # 5.86% frontend cycles idle 2,284,213,395 stalled-cycles-backend:u # 44.64% backend cycles idle 8,051,871,959 instructions:u # 1.57 insn per cycle # 0.28 stalled cycles per insn 1,359,589,402 branches:u # 597.447 M/sec 7,359,347 branch-misses:u # 0.54% of all branches 2.281030026 seconds time elapsed 2.108197000 seconds user 0.164183000 seconds sys ``` </details> <details> <summary>Shrink `ParamEnv` without changing `IntRange::from_pat`:</summary> ``` Performance counter stats for 'cargo +perf-stage1 check': 2,751.79 msec task-clock:u # 0.996 CPUs utilized 0 context-switches:u # 0.000 K/sec 0 cpu-migrations:u # 0.000 K/sec 50,103 page-faults:u # 0.018 M/sec 6,260,590,019 cycles:u # 2.275 GHz 317,355,920 stalled-cycles-frontend:u # 5.07% frontend cycles idle 3,397,743,582 stalled-cycles-backend:u # 54.27% backend cycles idle 8,276,224,367 instructions:u # 1.32 insn per cycle # 0.41 stalled cycles per insn 1,370,453,386 branches:u # 498.023 M/sec 7,281,031 branch-misses:u # 0.53% of all branches 2.763265838 seconds time elapsed 2.544578000 seconds user 0.204548000 seconds sys ``` </details> <details> <summary>Shrink `ParamEnv` and change `IntRange::from_pat`: </summary> ``` Performance counter stats for 'cargo +perf-stage1 check': 2,295.57 msec task-clock:u # 0.996 CPUs utilized 0 context-switches:u # 0.000 K/sec 0 cpu-migrations:u # 0.000 K/sec 49,959 page-faults:u # 0.022 M/sec 5,151,407,066 cycles:u # 2.244 GHz 324,517,829 stalled-cycles-frontend:u # 6.30% frontend cycles idle 2,301,671,001 stalled-cycles-backend:u # 44.68% backend cycles idle 8,130,868,329 instructions:u # 1.58 insn per cycle # 0.28 stalled cycles per insn 1,356,618,512 branches:u # 590.972 M/sec 7,323,800 branch-misses:u # 0.54% of all branches 2.304509653 seconds time elapsed 2.128090000 seconds user 0.163909000 seconds sys ``` </details>
2020-09-28Auto merge of #77302 - RalfJung:rollup-n8gg3v6, r=RalfJungbors-882/+940
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-28Rollup merge of #77295 - jethrogb:jb/unstable-book-asm, r=AmanieuRalf Jung-1/+1
Update unstable-book: Fix ABNF in inline assembly docs r? @Amanieu
2020-09-28Rollup merge of #77288 - RalfJung:miri-macos, r=AmanieuRalf Jung-49/+50
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-28Rollup merge of #77194 - pickfire:patch-7, r=withoutboatsRalf Jung-0/+2
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-28Rollup merge of #77170 - ecstatic-morse:const-fn-ptr, r=oli-obkRalf Jung-135/+146
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-28Rollup merge of #76711 - davidtwco:issue-51154-param-closure, r=estebankRalf Jung-5/+37
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-28Rollup merge of #76474 - bjorn3:driver_selected_codegen, r=oli-obkRalf Jung-5/+37
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-28Rollup merge of #76454 - poliorcetics:ui-to-unit-test-1, r=matkladRalf Jung-687/+667
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-28Auto merge of #76899 - wesleywiser:experimental_unsound_mir_opts_flag, r=oli-obkbors-216/+263
[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-28Update unstable-book: Fix ABNF in inline assembly docsJethro Beekman-1/+1
2020-09-28Auto merge of #77236 - matthewjasper:defer-typeof-impl-trait, r=davidtwcobors-430/+375
Compute underlying type of impl trait types later in compilation Also change a `bug!` to `delay_span_bug` Closes #74018
2020-09-28Auto merge of #77282 - glaubitz:sparc-linux, r=nagisabors-2/+4
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-28Auto merge of #77261 - oli-obk:const_generic_array_serializer, r=matthewjasperbors-23/+12
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-28fix building libstd for Miri on macOSRalf Jung-49/+50
2020-09-28Auto merge of #77265 - vandenheuvel:chalkup, r=Dylan-DPCbors-12/+12
Update chalk to 0.29.0
2020-09-28Auto merge of #77008 - fortanix:raoul/lvi-tests, r=Mark-Simulacrumbors-2/+519
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-28Auto merge of #75295 - tmiasko:fds, r=Amanieubors-2/+82
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-27Remove unnecessary -Zunsound-mir-opts uses in testsWesley Wiser-168/+177
2020-09-27[mir-opt] Introduce a new flag to enable experimental/unsound mir optsWesley Wiser-359/+397
2020-09-28library/std: Set OS raw type definitions for sparc-unknown-linux-gnuJohn Paul Adrian Glaubitz-0/+1
2020-09-28library/std/sys_common: Define MIN_ALIGN for sparc-unknown-linux-gnuJohn Paul Adrian Glaubitz-0/+1
2020-09-28library/{panic_,}unwind: Add definitions for sparc-unknow-linux-gnuJohn Paul Adrian Glaubitz-2/+2
2020-09-27Auto merge of #77242 - ecstatic-morse:dataflow-switch-int, r=jonas-schievinkbors-132/+228
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-27Reopen standard streams when they are closed on UnixTomasz Miąsko-2/+82
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-27Auto merge of #77229 - tmiasko:liveness, r=lcnrbors-121/+91
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-27Remove feature gate test for `rustc_allow_const_fn_ptr`Dylan MacKenzie-47/+0
2020-09-27Mark `min_const_fn_fn_ptr` test as gate testDylan MacKenzie-2/+4
2020-09-27Bless testsDylan MacKenzie-44/+106
2020-09-27Update tests with new feature gateDylan MacKenzie-26/+32
2020-09-27Remove `rustc_allow_const_fn_ptr`Dylan MacKenzie-42/+8
This 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 the bespoke attribute.
2020-09-27Add a feature gate for basic function pointer use in `const fn`Dylan MacKenzie-7/+29
2020-09-27Auto merge of #77272 - jonas-schievink:rollup-dydo5kn, r=jonas-schievinkbors-30/+520
Rollup of 7 pull requests Successful merges: - #76839 (Add asm! support for MIPS) - #77203 (Check for missing const-stability attributes in `rustc_passes`) - #77249 (Separate `private_intra_doc_links` and `broken_intra_doc_links` into separate lints) - #77252 (reduce overlong line) - #77256 (Fix typo in ExpnData documentation) - #77262 (Remove duplicate comment) - #77263 (Clean up trivial if let) Failed merges: r? `@ghost`
2020-09-27Rollup merge of #77263 - bugadani:cleanup, r=lcnrJonas Schievink-1/+1
Clean up trivial if let
2020-09-27Rollup merge of #77262 - bugadani:redundant-comment, r=Dylan-DPCJonas Schievink-3/+0
Remove duplicate comment
2020-09-27Rollup merge of #77256 - jyn514:typo, r=Aaron1011Jonas Schievink-1/+1
Fix typo in ExpnData documentation This mis-highlighted the entire documentation as code: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_span/hygiene/struct.ExpnData.html#structfield.krate
2020-09-27Rollup merge of #77252 - tshepang:overlong, r=jyn514Jonas Schievink-1/+2
reduce overlong line
2020-09-27Rollup merge of #77249 - jyn514:private-links, r=ManishearthJonas Schievink-12/+75
Separate `private_intra_doc_links` and `broken_intra_doc_links` into separate lints This is not ideal because it means `deny(broken_intra_doc_links)` will no longer `deny(private_intra_doc_links)`. However, it can't be fixed with a new lint group, because `broken` is already in the `rustdoc` lint group; there would need to be a way to nest groups somehow. This also removes the early `return` so that the link will be generated even though it gives a warning. r? @Manishearth cc @ecstatic-morse (https://github.com/rust-lang/rust/pull/77242#issuecomment-699565095)
2020-09-27Rollup merge of #77203 - ecstatic-morse:const-stability-attr-checks, r=oli-obkJonas Schievink-11/+52
Check for missing const-stability attributes in `rustc_passes` Currently, this happens as a side effect of `is_min_const_fn`, which is non-obvious. Also adds a test for this case, since we didn't seem to have one before.
2020-09-27Rollup merge of #76839 - lzutao:mips-asm, r=AmanieuJonas Schievink-1/+389
Add asm! support for MIPS For now, I only add support for mips32. mips64 may come in future PRs if I could learn more about the target.
2020-09-27Auto merge of #77259 - dgbo:master, r=kennytmbors-0/+0
update stdarch submodule This commit update the src/stdarch submodule, we primarily want to include [https://github.com/rust-lang/stdarch/pull/918](url) which provides prefetch hints for aarch64. This PR could deliver ~20% performance gain on our aarch64 server in Filecoin. Wish this could be used as soon as possible. Thanks.
2020-09-27Add documentation for `private_intra_doc_links`Joshua Nelson-1/+41
2020-09-27Separate `private_intra_doc_links` and `broken_intra_doc_links` into ↵Joshua Nelson-12/+35
separate lints This is not ideal because it means `deny(broken_intra_doc_links)` will no longer `deny(private_intra_doc_links)`. However, it can't be fixed with a new lint group, because `broken` is already in the `rustdoc` lint group; there would need to be a way to nest groups somehow. This also removes the early `return` so that the link will be generated even though it gives a warning.
2020-09-27Update chalk to 0.29.0Bram van den Heuvel-12/+12
2020-09-27Auto merge of #77118 - exrook:stability-generic-parameters-2, r=varkorbors-34/+1171
Stability annotations on generic parameters (take 2.5) Rebase of #72314 + more tests Implements rust-lang/wg-allocators#2.
2020-09-27Add option to pass a custom codegen backend from a driverbjorn3-5/+37
2020-09-27Auto merge of #71274 - RalfJung:raw-init-check-aggregate, r=petrochenkovbors-8/+59
might_permit_raw_init: also check aggregate fields This is the next step for https://github.com/rust-lang/rust/issues/66151: when doing `mem::zeroed`/`mem::uninitialized`, also recursively check fields of aggregates (except for arrays) for whether they permit zero/uninit initialization.
2020-09-27Clean up trivial if letDániel Buga-1/+1
2020-09-27Remove duplicate commentDániel Buga-3/+0