Commit graph

124564 commits

Author SHA1 Message Date
Yuki Okushi
5f87ee0ab1
Rollup merge of #75152 - TimDiekmann:replace_memblock, r=Amanieu
Replace `Memoryblock` with `NonNull<[u8]>`

Closes rust-lang/wg-allocators#61

r? @Amanieu
2020-08-05 11:40:10 +09:00
Yuki Okushi
7123daff53
Rollup merge of #75149 - felixonmars:patch-1, r=wesleywiser
Correct a typo in interpret/memory.rs
2020-08-05 11:40:08 +09:00
Yuki Okushi
008228a708
Rollup merge of #75140 - GuillaumeGomez:cleanup-e0745, r=pickfire
Clean up E0745

r? @Dylan-DPC
2020-08-05 11:40:07 +09:00
Yuki Okushi
7b39f75187
Rollup merge of #75139 - pickfire:librustdoc-import, r=jyn514
Remove log alias from librustdoc

r? @jyn514
2020-08-05 11:40:05 +09:00
bors
07f1fdecfe Auto merge of #75161 - sunfishcode:wasm-no-threads, r=alexcrichton
Remove the `--no-threads` workaround for wasm targets.

Remove `--no-threads` from the wasm-ld command-line, which was a
workaround for [an old bug] which was fixed in LLVM 9.0, and is
no longer needed.

Also, the `--no-threads` option has been [removed upstream].

[an old bug]: https://bugs.llvm.org/show_bug.cgi?id=41508
[removed upstream]: https://reviews.llvm.org/D76885

r? @alexcrichton
2020-08-04 22:21:05 +00:00
Dan Gohman
1a3e4d8140 Remove the --no-threads workaround for wasm targets.
Remove `--no-threads` from the wasm-ld command-line, which was a
workaround for [an old bug] which was fixed in LLVM 9.0, and is
no longer needed.

Also, the `--no-threads` option has been [removed upstream].

[an old bug]: https://bugs.llvm.org/show_bug.cgi?id=41508
[removed upstream]: https://reviews.llvm.org/D76885
2020-08-04 13:31:08 -07:00
bors
f9d422ea78 Auto merge of #75136 - JohnTitor:unsizing-casts-non-null, r=oli-obk
Forbid non-derefable types explicitly in unsizing casts

Fixes #75118
r? @oli-obk
2020-08-04 19:37:01 +00:00
Tim Diekmann
93d98328d1
Revert missing "memory block" 2020-08-04 19:24:08 +02:00
Tim Diekmann
929e37d4bf Revert renaming of "memory block" 2020-08-04 19:15:48 +02:00
bors
d08eb98698 Auto merge of #75133 - nnethercote:rm-SubstFolder-fields, r=matthewjasper
Remove two fields from `SubstFolder`.

They're only used in error messages printed if there's an internal
compiler error, and the cost of maintaining them is high enough to show
up in profiles.

r? @matthewjasper
2020-08-04 17:07:40 +00:00
Tim Diekmann
ab9362ad9a Replace Memoryblock with NonNull<[u8]> 2020-08-04 18:03:34 +02:00
Felix Yan
6d75d7c084
Correct a typo in interpret/memory.rs 2020-08-04 23:01:32 +08:00
bors
5f6bd6ec0a Auto merge of #74850 - TimDiekmann:remove-in-place-alloc, r=Amanieu
Remove in-place allocation and revert to separate methods for zeroed allocations

closes rust-lang/wg-allocators#58
2020-08-04 11:22:45 +00:00
Guillaume Gomez
0275cd7409 Clean up E0745 2020-08-04 13:09:15 +02:00
Ivan Tham
c577d71e03 Remove log alias from librustdoc 2020-08-04 17:57:35 +08:00
bors
c9b80bb3ff Auto merge of #75095 - pietroalbini:fallible-fast-fail, r=Mark-Simulacrum
ci: disable fast-fail on auto-fallible

The purpose of the auto-fallible job is to run builders that are likely to fail on CI without gating on them. Having fast-fail enabled there kinda defeats the purpose, as if one of them fails we can't monitor the outcome of the other ones.

This was prompted by the aarch64-gnu builder consistently failing due to a broken test, preventing us from seeing if the macOS spurious failure is fixed.

r? @Mark-Simulacrum
2020-08-04 09:18:22 +00:00
Pietro Albini
268bc7fa2f
ci: disable fail-fast on auto-fallible
The purpose of the auto-fallible job is to run builders that are likely
to fail on CI without gating on them. Having fail-fast enabled there
kinda defeats the purpose, as if one of them fails we can't monitor the
outcome of the other ones.

This was prompted by the aarch64-gnu builder consistently failing due to
a broken test, preventing us from seeing if the macOS spurious failure
is fixed.
2020-08-04 11:14:28 +02:00
Yuki Okushi
cd7204ef39
Forbid non-derefable types explicitly in unsizing casts 2020-08-04 17:46:10 +09:00
Nicholas Nethercote
eeb4b83289 Remove two fields from SubstFolder.
They're only used in error messages printed if there's an internal
compiler error, and the cost of maintaining them is high enough to show
up in profiles.
2020-08-04 17:44:58 +10:00
bors
40857b9453 Auto merge of #75111 - mati865:use-lld-option, r=Mark-Simulacrum
Make rust.use-lld config option work with non MSVC targets

Builds fine and passes tests on Linux.
Not overriding `use-lld` by `linker` makes sense on those platforms since very old GCC versions don't understand `-fuse-ld=lld`. This allows pointing to newer GCC or Clang that will know how to call LLD.
2020-08-04 05:37:44 +00:00
bors
80f84eb9c6 Auto merge of #75058 - ssomers:btree_cleanup_insert_2, r=Mark-Simulacrum
Clarify reuse of a BTreeMap insert support function and treat split support likewise

r? @Mark-Simulacrum
2020-08-04 03:48:48 +00:00
bors
60c2e8d438 Auto merge of #75126 - JohnTitor:rollup-aejluzx, r=JohnTitor
Rollup of 8 pull requests

Successful merges:

 - #74759 (add `unsigned_abs` to signed integers)
 - #75043 (rustc_ast: `(Nested)MetaItem::check_name` -> `has_name`)
 - #75056 (Lint path statements to suggest using drop when the type needs drop)
 - #75081 (Fix logging for rustdoc)
 - #75083 (Do not trigger `unused_braces` for `while let`)
 - #75084 (Stabilize Ident::new_raw)
 - #75103 (Disable building rust-analyzer on riscv64)
 - #75106 (Enable docs on in the x86_64-unknown-linux-musl manifest)

Failed merges:

r? @ghost
2020-08-04 01:48:32 +00:00
Yuki Okushi
aa84a76150
Rollup merge of #75106 - etherealist:docs_manifest, r=Mark-Simulacrum
Enable docs on in the x86_64-unknown-linux-musl manifest

Add the rust-docs component to toolchain x86_64-unknown-linux-musl, which allows people using rustup on their musl-based linux distribution to download the rust-docs.

Generating and uploading the docs was enabled in b5d143b (#74871).

In #75102 @Mark-Simulacrum found that we are uploading the docs, but the correct manifest is missing.

* The relevant call to build-manifest seems to be [in bootstrap](c058a8b8dc/src/bootstrap/dist.rs (L2334))

* The manifest is then used in [promote-release crontab](https://github.com/rust-lang/rust-central-station/blob/master/crontab)
2020-08-04 09:27:10 +09:00
Yuki Okushi
40adcabb77
Rollup merge of #75103 - Mark-Simulacrum:no-ra-for-riscv64, r=matklad
Disable building rust-analyzer on riscv64

riscv64 has an LLVM bug that makes rust-analyzer not build. Should permit future rust-analyzer ups (e.g., https://github.com/rust-lang/rust/pull/74813) to land.
2020-08-04 09:27:08 +09:00
Yuki Okushi
622759d129
Rollup merge of #75084 - Aaron1011:stabilize/ident-new-raw, r=petrochenkov
Stabilize Ident::new_raw

Tracking issue: #54723

This is a continuation of PR #59002
2020-08-04 09:27:06 +09:00
Yuki Okushi
4eb9253660
Rollup merge of #75083 - JohnTitor:follow-up-unused-braces, r=lcnr
Do not trigger `unused_braces` for `while let`

Follow-up for #75031
r? @lcnr
2020-08-04 09:27:04 +09:00
Yuki Okushi
c2bc733d99
Rollup merge of #75081 - jyn514:fix-logging, r=Mark-Simulacrum
Fix logging for rustdoc

https://github.com/rust-lang/rust/pull/74726#issuecomment-667765557
2020-08-04 09:27:03 +09:00
Yuki Okushi
485bfa7a75
Rollup merge of #75056 - Veykril:path_statements_lint, r=oli-obk
Lint path statements to suggest using drop when the type needs drop

Fixes #48852. With this change the current lint description doesn't really fit entirely anymore I think.
2020-08-04 09:27:01 +09:00
Yuki Okushi
262fce481d
Rollup merge of #75043 - petrochenkov:hasname, r=nnethercote
rustc_ast: `(Nested)MetaItem::check_name` -> `has_name`

For consistency with `Attribute::has_name` which doesn't mark the attribute as used either.

Replace all uses of `check_name` with `has_name` outside of rustc, only rustc needs to mark attributes as used.

cc https://github.com/rust-lang/rust/pull/74932
r? @nnethercote
2020-08-04 09:26:59 +09:00
Yuki Okushi
cc0ac7eece
Rollup merge of #74759 - carbotaniuman:uabs, r=shepmaster
add `unsigned_abs` to signed integers

Mentioned on rust-lang/rfcs#2914

This PR simply adds an `unsigned_abs` to signed integers function which returns the correct absolute value as a unsigned integer.
2020-08-04 09:26:58 +09:00
bors
1d601d6ff1 Auto merge of #74695 - alexcrichton:more-wasm-float-cast-fixes, r=nagisa
rustc: Improving safe wasm float->int casts

This commit improves code generation for WebAssembly targets when
translating floating to integer casts. This improvement is only relevant
when the `nontrapping-fptoint` feature is not enabled, but the feature
is not enabled by default right now. Additionally this improvement only
affects safe casts since unchecked casts were improved in #74659.

Some more background for this issue is present on #73591, but the
general gist of the issue is that in LLVM the `fptosi` and `fptoui`
instructions are defined to return an `undef` value if they execute on
out-of-bounds values; they notably do not trap. To implement these
instructions for WebAssembly the LLVM backend must therefore generate
quite a few instructions before executing `i32.trunc_f32_s` (for
example) because this WebAssembly instruction traps on out-of-bounds
values. This codegen into wasm instructions happens very late in the
code generator, so what ends up happening is that rustc inserts its own
codegen to implement Rust's saturating semantics, and then LLVM also
inserts its own codegen to make sure that the `fptosi` instruction
doesn't trap. Overall this means that a function like this:

    #[no_mangle]
    pub unsafe extern "C" fn cast(x: f64) -> u32 {
        x as u32
    }

will generate this WebAssembly today:

    (func $cast (type 0) (param f64) (result i32)
      (local i32 i32)
      local.get 0
      f64.const 0x1.fffffffep+31 (;=4.29497e+09;)
      f64.gt
      local.set 1
      block  ;; label = @1
        block  ;; label = @2
          local.get 0
          f64.const 0x0p+0 (;=0;)
          local.get 0
          f64.const 0x0p+0 (;=0;)
          f64.gt
          select
          local.tee 0
          f64.const 0x1p+32 (;=4.29497e+09;)
          f64.lt
          local.get 0
          f64.const 0x0p+0 (;=0;)
          f64.ge
          i32.and
          i32.eqz
          br_if 0 (;@2;)
          local.get 0
          i32.trunc_f64_u
          local.set 2
          br 1 (;@1;)
        end
        i32.const 0
        local.set 2
      end
      i32.const -1
      local.get 2
      local.get 1
      select)

This PR improves the situation by updating the code generation for
float-to-int conversions in rustc, specifically only for WebAssembly
targets and only for some situations (float-to-u8 still has not great
codegen). The fix here is to use basic blocks and control flow to avoid
speculatively executing `fptosi`, and instead LLVM's raw intrinsic for
the WebAssembly instruction is used instead. This effectively extends
the support added in #74659 to checked casts. After this commit the
codegen for the above Rust function looks like:

    (func $cast (type 0) (param f64) (result i32)
      (local i32)
      block  ;; label = @1
        local.get 0
        f64.const 0x0p+0 (;=0;)
        f64.ge
        local.tee 1
        i32.const 1
        i32.xor
        br_if 0 (;@1;)
        local.get 0
        f64.const 0x1.fffffffep+31 (;=4.29497e+09;)
        f64.le
        i32.eqz
        br_if 0 (;@1;)
        local.get 0
        i32.trunc_f64_u
        return
      end
      i32.const -1
      i32.const 0
      local.get 1
      select)

For reference, in Rust 1.44, which did not have saturating
float-to-integer casts, the codegen LLVM would emit is:

    (func $cast (type 0) (param f64) (result i32)
      block  ;; label = @1
        local.get 0
        f64.const 0x1p+32 (;=4.29497e+09;)
        f64.lt
        local.get 0
        f64.const 0x0p+0 (;=0;)
        f64.ge
        i32.and
        i32.eqz
        br_if 0 (;@1;)
        local.get 0
        i32.trunc_f64_u
        return
      end
      i32.const 0)

So we're relatively close to the original codegen, although it's
slightly different because the semantics of the function changed where
we're emulating the `i32.trunc_sat_f32_s` instruction rather than always
replacing out-of-bounds values with zero.

There is still work that could be done to improve casts such as `f32` to
`u8`. That form of cast still uses the `fptosi` instruction which
generates lots of branch-y code. This seems less important to tackle now
though. In the meantime this should take care of most use cases of
floating-point conversion and as a result I'm going to speculate that
this...

Closes #73591
2020-08-03 23:57:50 +00:00
Tim Diekmann
6395659168
Apply suggestions from code review
Co-authored-by: Amanieu d'Antras <amanieu@gmail.com>
2020-08-04 00:21:05 +02:00
bors
d8cbd9caca Auto merge of #74526 - erikdesjardins:reftrack, r=Mark-Simulacrum
Add track_caller to RefCell::{borrow, borrow_mut}

So panic messages point at the offending borrow.

Fixes #74472
2020-08-03 21:43:27 +00:00
Vadim Petrochenkov
05f414b72a rustc_ast: More detailed docs for Attribute::check_name 2020-08-04 00:34:11 +03:00
Vadim Petrochenkov
0a88346be6 rustc_ast: (Nested)MetaItem::check_name -> has_name
For consistency with `Attribute::has_name` which doesn't mark the attribute as used either.

Replace all uses of `check_name` with `has_name` outside of rustc
2020-08-04 00:34:11 +03:00
Aaron Hill
6deda6a6a0
Stabilize Ident::new_raw
Tracking issue: #54723

This is a continuation of PR #59002
2020-08-03 17:23:31 -04:00
Mateusz Mikuła
594f81a2b4 Make rust.use-lld config option work with non MSVC targets 2020-08-03 18:10:37 +02:00
bors
829d69b9c6 Auto merge of #74827 - ssomers:btree_cleanup_insert, r=Mark-Simulacrum
Move bulk of BTreeMap::insert method down to new method on handle

Adjust the boundary between the map and node layers for insertion: do more in the node layer, keep root manipulation and pointer dereferencing separate. No change in undefined behaviour or performance.

r? @Mark-Simulacrum
2020-08-03 15:46:02 +00:00
Mark Rousskov
d2fc809fdb Disable building rust-analyzer on riscv64
riscv64 has an LLVM bug that makes rust-analyzer not build.
2020-08-03 10:15:27 -04:00
David Sonder
f130e18c01
Enable docs on in the x86_64-unknown-linux-musl manifest
Add the rust-docs component to toolchain x86_64-unknown-linux-musl, which allows
people using rustup on their musl-based linux distribution to download the
rust-docs.

Generating and uploading the docs was enabled in b5d143b.
2020-08-03 16:02:20 +02:00
bors
c186aed59a Auto merge of #75092 - kennytm:fix-75009, r=pietroalbini
Fix broken git commit in stdarch

Follow-up on #75009, point to the real master commit.
2020-08-03 09:34:06 +00:00
kennytm
fd7596c9a5
fix broken git commit in stdarch 2020-08-03 15:52:30 +08:00
bors
dbc2ef25fb Auto merge of #75076 - tmiasko:simplify-goto, r=oli-obk
Fix change detection in CfgSimplifier::collapse_goto_chain

Check that the old target is different from the new collapsed one, before concluding that anything changed.

Fixes #75074
Fixes #75051
2020-08-03 07:20:21 +00:00
bors
1b0ff9e7d0 Auto merge of #75068 - petrochenkov:ignore-debinfo, r=Mark-Simulacrum
tests: Ignore src/test/debuginfo/rc_arc.rs on Windows

It requires loading pretty-printers (`src\etc\gdb_load_rust_pretty_printers.py`), but GDB doesn't load them on Windows.

Not sure how this passes through CI, due to an old GDB version perhaps?
2020-08-03 05:25:03 +00:00
bors
7637cbb79b Auto merge of #75055 - cjgillot:clean-cache, r=oli-obk
Introduce an abstraction for EvaluationCache and SelectionCache

The small duplicated code has been moved to librustc_query_system.

The remaining changes are some cleanups of structural impls.
2020-08-03 03:37:33 +00:00
Yuki Okushi
2e5c50195a
Do not trigger unused_braces for while let 2020-08-03 12:18:10 +09:00
Joshua Nelson
e97e6fbe34 Fix logging for rustdoc 2020-08-02 22:24:54 -04:00
bors
8244b1b114 Auto merge of #74969 - nnethercote:rm-GCX_PTR, r=Mark-Simulacrum
Remove `GCX_PTR`.

We store an `ImplicitCtxt` pointer in a thread-local value (TLV). This allows
implicit access to a `GlobalCtxt` and some other things.

We also store a `GlobalCtxt` pointer in `GCX_PTR`. This is always the same
`GlobalCtxt` as the one within the `ImplicitCtxt` pointer in TLV. `GCX_PTR`
is only used in the parallel compiler's `handle_deadlock()` function.

This commit does the following.
- It removes `GCX_PTR`.
- It also adds `ImplicitCtxt::new()`, which constructs an `ImplicitCtxt` from a
  `GlobalCtxt`. `ImplicitCtxt::new()` + `tls::enter_context()` is now
  equivalent to the old `tls::enter_global()`.
- Makes `tls::get_tlv()` public for the parallel compiler, because it's
  now used in `handle_deadlock()`.

r? @petrochenkov
2020-08-03 01:50:25 +00:00
Tim Diekmann
24ddf76ed7
Merge branch 'master' into remove-in-place-alloc 2020-08-03 02:18:20 +02:00
bors
19ecce332e Auto merge of #74948 - lzutao:stalize-result-as-deref, r=dtolnay
Stabilize `Result::as_deref` and `as_deref_mut`

FCP completed in https://github.com/rust-lang/rust/issues/50264#issuecomment-645681400.

This PR stabilizes two new APIs for `std::result::Result`:
```rust
fn as_deref(&self) -> Result<&T::Target, &E> where T: Deref;
fn as_deref_mut(&mut self) -> Result<&mut T::Target, &mut E> where T: DerefMut;
```

This PR also removes two rarely used unstable APIs from `Result`:
```rust
fn as_deref_err(&self) -> Result<&T, &E::Target> where E: Deref;
fn as_deref_mut_err(&mut self) -> Result<&mut T, &mut E::Target> where E: DerefMut;
```

Closes #50264
2020-08-02 23:55:12 +00:00