about summary refs log tree commit diff
path: root/src
AgeCommit message (Collapse)AuthorLines
2020-09-30Add test for issue #74761samlich-0/+31
2020-09-29Auto merge of #77145 - pietroalbini:refactor-build-manifest-versions, ↵bors-217/+290
r=Mark-Simulacrum Refactor versions detection in build-manifest This PR refactors how `build-manifest` handles versions, making the following changes: * `build-manifest` now detects the "package releases" on its own, without relying on rustbuild providing them through CLI arguments. This drastically simplifies calling the tool outside of `x.py`, and will allow to ship the prebuilt tool in a tarball in the future, with the goal of stopping to invoke `x.py` during `promote-release`. * The `tar` command is not used to extract the version and the git hash from tarballs anymore. The `flate2` and `tar` crates are used instead. This makes detecting those pieces of data way faster, as the archive is decompressed just once and we stop parsing the archive once all the information is retrieved. * The code to extract the version and the git hash now stores all the collected data dynamically, without requiring to add new fields to the `Builder` struct every time. I tested the changes locally and it should behave the same as before. r? `@Mark-Simulacrum`
2020-09-29Auto merge of #76754 - varkor:diagnostic-cleanup-ii, r=ecstatic-morsebors-420/+421
Clean up diagnostics for arithmetic operation errors Plus a small tweak to a range pattern error message.
2020-09-29Auto merge of #77253 - jyn514:crate-link, r=Manishearthbors-1/+23
Resolve `crate` in intra-doc links properly across crates Closes https://github.com/rust-lang/rust/issues/77193; see https://github.com/rust-lang/rust/issues/77193#issuecomment-699065946 for an explanation of what's going on here. ~~This also fixes the BTreeMap docs that have been broken for a while; see the description on the second commit for why and how.~~ Nope, see the second commit for why the link had to be changed. r? `@Manishearth` cc `@dylni` `@dylni` note that this doesn't solve your original problem - now _both_ `with_code` and `crate::with_code` will be broken links. However this will fix a lot of other broken links (in particular I think https://docs.rs/sqlx/0.4.0-beta.1/sqlx/query/struct.Query.html is because of this bug). I'll open another issue for resolving additional docs in the new scope.
2020-09-28Fix run-make-fulldeps testsvarkor-24/+24
2020-09-28Auto merge of #77302 - RalfJung:rollup-n8gg3v6, r=RalfJungbors-817/+143
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 #77170 - ecstatic-morse:const-fn-ptr, r=oli-obkRalf Jung-86/+109
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-0/+21
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-3/+12
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-727/+0
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-215/+258
[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-417/+346
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 #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-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-358/+392
2020-09-27Reopen standard streams when they are closed on UnixTomasz Miąsko-2/+20
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-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-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/+63
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-0/+20
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/+207
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-27Add documentation for `private_intra_doc_links`Joshua Nelson-0/+40
2020-09-27Resolve `crate` properly across cratesJoshua Nelson-1/+23
2020-09-27Separate `private_intra_doc_links` and `broken_intra_doc_links` into ↵Joshua Nelson-12/+23
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-27Auto merge of #77118 - exrook:stability-generic-parameters-2, r=varkorbors-0/+1009
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-3/+12
2020-09-27Auto merge of #71274 - RalfJung:raw-init-check-aggregate, r=petrochenkovbors-4/+40
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-27update tokei and ripgrep in cargotestRalf Jung-2/+2
2020-09-27Auto merge of #76955 - jyn514:refactor-diagnostics, r=eucliobors-279/+305
Refactor and fix intra-doc link diagnostics, and fix links to primitives Closes https://github.com/rust-lang/rust/issues/76925, closes https://github.com/rust-lang/rust/issues/76693, closes https://github.com/rust-lang/rust/issues/76692. Originally I only meant to fix #76925. But the hack with `has_primitive` was so bad it was easier to fix the primitive issues than to try and work around it. Note that this still has one bug: `std::primitive::i32::MAX` does not resolve. However, this fixes the ICE so I'm fine with fixing the link in a later PR. This is part of a series of refactors to make #76467 possible. This is best reviewed commit-by-commit; it has detailed commit messages. r? `@euclio`
2020-09-27Auto merge of #77154 - fusion-engineering-forks:lazy-stdio, r=dtolnaybors-0/+20
Remove std::io::lazy::Lazy in favour of SyncOnceCell The (internal) std::io::lazy::Lazy was used to lazily initialize the stdout and stdin buffers (and mutexes). It uses atexit() to register a destructor to flush the streams on exit, and mark the streams as 'closed'. Using the stream afterwards would result in a panic. Stdout uses a LineWriter which contains a BufWriter that will flush the buffer on drop. This one is important to be executed during shutdown, to make sure no buffered output is lost. It also forbids access to stdout afterwards, since the buffer is already flushed and gone. Stdin uses a BufReader, which does not implement Drop. It simply forgets any previously read data that was not read from the buffer yet. This means that in the case of stdin, the atexit() function's only effect is making stdin inaccessible to the program, such that later accesses result in a panic. This is uncessary, as it'd have been safe to access stdin during shutdown of the program. --- This change removes the entire io::lazy module in favour of SyncOnceCell. SyncOnceCell's fast path is much faster (a single atomic operation) than locking a sys_common::Mutex on every access like Lazy did. However, SyncOnceCell does not use atexit() to drop the contained object during shutdown. As noted above, this is not a problem for stdin. It simply means stdin is now usable during shutdown. The atexit() call for stdout is moved to the stdio module. Unlike the now-removed Lazy struct, SyncOnceCell does not have a 'gone and unusable' state that panics. Instead of adding this again, this simply replaces the buffer with one with zero capacity. This effectively flushes the old buffer *and* makes any writes afterwards pass through directly without touching a buffer, making print!() available during shutdown without panicking. --- In addition, because the contents of the SyncOnceCell are no longer dropped, we can now use `&'static` instead of `Arc` in `Stdout` and `Stdin`. This also saves two levels of indirection in `stdin()` and `stdout()`, since Lazy effectively stored a `Box<Arc<T>>`, and SyncOnceCell stores the `T` directly.
2020-09-27Add MIPS asm! supportLzu Tao-1/+207
This patch also: * Add soft-float supports: only f32 * zero-extend i8/i16 to i32 because MIPS only supports register-length arithmetic. * Update table in asm! chapter in unstable book.
2020-09-27Auto merge of #76986 - jonas-schievink:ret-in-reg, r=nagisabors-0/+32
Return values up to 128 bits in registers This fixes https://github.com/rust-lang/rust/issues/26494#issuecomment-619506345 by making Rust's default ABI pass return values up to 128 bits in size in registers, just like the System V ABI. The result is that these methods from the comment linked above now generate the same code, making the Rust ABI as efficient as the `"C"` ABI: ```rust pub struct Stats { x: u32, y: u32, z: u32, } pub extern "C" fn sum_c(a: &Stats, b: &Stats) -> Stats { return Stats {x: a.x + b.x, y: a.y + b.y, z: a.z + b.z }; } pub fn sum_rust(a: &Stats, b: &Stats) -> Stats { return Stats {x: a.x + b.x, y: a.y + b.y, z: a.z + b.z }; } ``` ```asm sum_rust: movl (%rsi), %eax addl (%rdi), %eax movl 4(%rsi), %ecx addl 4(%rdi), %ecx movl 8(%rsi), %edx addl 8(%rdi), %edx shlq $32, %rcx orq %rcx, %rax retq ```
2020-09-27reduce overlong lineTshepang Lekhonkhobe-1/+2
2020-09-27Rollup merge of #77243 - Aaron1011:more-derive-test, r=petrochenkovJonas Schievink-6/+1652
Test more attributes in test issue-75930-derive-cfg.rs Split out from #76130 This tests our handling of combining derives, derive helper attributes, attribute macros, and `cfg`/`cfg_attr`
2020-09-27Rollup merge of #77231 - oli-obk:clippy_const_fn, r=ManishearthJonas Schievink-1/+393
Move helper function for `missing_const_for_fn` out of rustc to clippy cc @rust-lang/clippy @ecstatic-morse #76618 r? @Manishearth I also removed all support for suggesting a function could be `const fn` when that would require feature gates to actually work. This means we'll now have to maintain this ourselves in clippy, but that's how most lints work anyway, so...
2020-09-27Rollup merge of #77129 - ehuss:update-cargo, r=ehussJonas Schievink-0/+0
Update cargo 7 commits in 8777a6b1e8834899f51b7e09cc9b8d85b2417110..05c611ae3c4255b7a2bcf4fcfa65b20286a07839 2020-09-15 19:11:03 +0000 to 2020-09-23 23:10:38 +0000 - --workspace flag for locate-project to find the workspace root (rust-lang/cargo#8712) - Remove some badges documentation. (rust-lang/cargo#8727) - Add plain message format for locate-project (rust-lang/cargo#8707) - Add a term option to configure the progress bar (rust-lang/cargo#8165) - Replace d_as_f64 with as_secs_f64 (rust-lang/cargo#8721) - Add cross check to filters_target test. (rust-lang/cargo#8713) - Add test for whitespace behavior in env flags. (rust-lang/cargo#8706)
2020-09-26Test more attributes in test issue-75930-derive-cfg.rsAaron Hill-6/+1652
Split out from #76130 This tests our handling of combining derives, derive helper attributes, attribute macros, and `cfg`/`cfg_attr`
2020-09-26Fix UI test falloutvarkor-1/+1
2020-09-26Auto merge of #77224 - RalfJung:rollup-hdvb96c, r=RalfJungbors-164/+351
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-26Call `type_of` for opaque types later in compilationMatthew Jasper-417/+346
This ensures that various wf checks have already been done before we typeck item bodies.
2020-09-26Add a test for 128-bit return valuesJonas Schievink-0/+32
2020-09-26Remove all unstable feature support in the `missing_const_for_fn` lintOliver Scherer-97/+25
2020-09-26Move `qualify_min_const_fn` out of rustc into clippyOliver Scherer-1/+465
2020-09-26Normalise `BITS` in UI testvarkor-7/+7
2020-09-26Bless mir-opt 32-bit testsvarkor-21/+21