Commit Graph

148923 Commits

Author SHA1 Message Date
Scott McMurray
8be67998a1 Extend rustc_on_implemented to improve a ?-on-ControlFlow error message 2021-05-23 07:18:02 -07:00
Guillaume Gomez
d7579b9134 Don't hide inherent implementations by default 2021-05-23 14:37:41 +02:00
bors
0f8cd43ee8 Auto merge of #85599 - RalfJung:immut-allocs, r=oli-obk
fix deallocation of immutable allocations

As part of https://github.com/rust-lang/miri/pull/1814, I realized that we currently allow deallocating immutable allocations. This PR fixes that, and also adds some new APIs that are required to still support the existing Miri backtrace support.

r? `@oli-obk`
2021-05-23 12:05:47 +00:00
klensy
7c0db6f0f1 fix pad_integral example 2021-05-23 14:48:16 +03:00
Ralf Jung
f9b36b4f65
fix comment
Co-authored-by: bjorn3 <bjorn3@users.noreply.github.com>
2021-05-23 13:26:51 +02:00
Ralf Jung
461b2f83f3 (try to) fix cranelift 2021-05-23 12:44:05 +02:00
Ralf Jung
585141b219 support creating mutable allocations from byte slices 2021-05-23 12:37:16 +02:00
Ralf Jung
c3005e85da avoid redundant immutability check 2021-05-23 11:55:31 +02:00
Ralf Jung
3bcba11c35 reject deallocation of read-only allocations 2021-05-23 11:53:23 +02:00
bors
6e92fb4098 Auto merge of #85490 - CDirkx:fix-vxworks, r=dtolnay
Fix `vxworks`

Some PRs made the `vxworks` target not build anymore. This PR fixes that:

- #82973: copy `ExitStatusError` implementation from `unix`.
- #84716: no `libc::chroot` available on `vxworks`, so for now don't implement `os::unix::fs::chroot`.
2021-05-23 05:40:18 +00:00
bors
92418ce65a Auto merge of #85594 - Dylan-DPC:rollup-40sgqgg, r=Dylan-DPC
Rollup of 6 pull requests

Successful merges:

 - #84758 (MSVC: Avoid using jmp stubs for dll function imports)
 - #85288 (add an example to explain std::io::Read::read returning 0 in some cases)
 - #85334 (Add doc aliases to `unit`)
 - #85525 (Fix my mailmap entry)
 - #85571 (Remove surplus prepend LinkedList fn)
 - #85575 (Fix auto-hide for implementations and implementors.)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2021-05-23 03:24:27 +00:00
Dylan DPC
85b45b5163
Rollup merge of #85575 - jsha:fix-toggle-settings, r=GuillaumeGomez
Fix auto-hide for implementations and implementors.

This sets their toggles to be closed in the HTML (matching the default
setting), and opens them if the setting indicates to do so.

This distinguishes between implementations and implementors based on
being descendants of certain named elements.

Demo https://hoffman-andrews.com/rust/fix-toggle-settings/std/io/trait.Read.html#implementors
and https://hoffman-andrews.com/rust/fix-toggle-settings/std/string/struct.String.html#trait-implementations

Fixes #85411

r? `@GuillaumeGomez`
2021-05-23 03:23:47 +02:00
Dylan DPC
75edb76937
Rollup merge of #85571 - workingjubilee:reverse-prepend, r=Amanieu
Remove surplus prepend LinkedList fn

This nightly library feature provides a function on `LinkedList<T>` that is identical to `fn append` with a reversed order of arguments. Observe this diff against the `fn append` doctest:
```diff
+#![feature(linked_list_prepend)]
 fn main() {
    use std::collections::LinkedList;
    let mut list1 = LinkedList::new();
    list1.push_back('a');
    let mut list2 = LinkedList::new();
    list2.push_back('b');
    list2.push_back('c');

-    list1.append(&mut list2);
+    list2.prepend(&mut list1);

-    let mut iter = list1.iter();
+    let mut iter = list2.iter();
     assert_eq!(iter.next(), Some(&'a'));
     assert_eq!(iter.next(), Some(&'b'));
     assert_eq!(iter.next(), Some(&'c'));
     assert!(iter.next().is_none());

-    assert!(list2.is_empty());
+    assert!(list1.is_empty());
 }
```

As this has received no obvious request to stabilize it, nor does it have a tracking issue, and was left on nightly and the consensus seems to have been to deprecate it in this pre-1.0 PR in 2014, https://github.com/rust-lang/rust/pull/20356, I propose simply removing it.
2021-05-23 03:23:47 +02:00
Dylan DPC
d978060cc6
Rollup merge of #85525 - camelid:fix-mailmap, r=Mark-Simulacrum
Fix my mailmap entry

r? `@Mark-Simulacrum`
2021-05-23 03:23:46 +02:00
Dylan DPC
4430aab045
Rollup merge of #85334 - r00ster91:patch-8, r=dtolnay
Add doc aliases to `unit`

I think it makes sense for `unit` to have the same doc aliases as `tuple` does.
2021-05-23 03:23:41 +02:00
Dylan DPC
b1e0d5fda5
Rollup merge of #85288 - Geal:clarify-std-io-read, r=dtolnay
add an example to explain std::io::Read::read returning 0 in some cases

I have always found the explanation about `Read::read` returning 0 to indicate EOF but not indefinitely, so here's more info using Linux as example. I can also add example code if necessary
2021-05-23 03:23:37 +02:00
Dylan DPC
d5fa533ab0
Rollup merge of #84758 - ChrisDenton:dllimport, r=dtolnay
MSVC: Avoid using jmp stubs for dll function imports

Windows import libraries contain two symbols for every function: `__imp_FunctionName` and `FunctionName` (where `FunctionName` is the name of the function to be imported).

`__imp_FunctionName` contains the address of the imported function. This will be filled in by the Windows executable loader at runtime. `FunctionName` contains a jmp stub that simply jumps to the address given by `__imp_FunctionName`. E.g. it's a function that solely contains a single jmp instruction:

```asm
jmp __imp_FunctionName
```

When using an external DLL function in Rust, by default the linker will link to FunctionName, causing a bit of indirection at runtime. In Microsoft's C++ it's possible to instead tell it to insert calls to the address in `__imp_FunctionName` by using the  `__declspec(dllimport)` attribute. In Rust it's possible to get effectively the same behaviour using the `#[link]` attribute on `extern` blocks.

----

The second commit also merges multiple `extern` blocks into one block. This is because otherwise Rust will currently create duplicate linker arguments for each block. In this case having duplicates shouldn't matter much other than the noise when displaying the linker command.
2021-05-23 03:23:34 +02:00
bors
9c3a2a57ef Auto merge of #81601 - jyn514:llvm-on-demand, r=Mark-Simulacrum
Move llvm submodule updates to rustbuild

This enables better caching, since LLVM is only updated when needed, not
whenever x.py is run. Before, bootstrap.py had to use heuristics to
guess if LLVM would be needed, and updated the module more often than
necessary as a result.

This syncs the LLVM submodule only just before building the compiler, so
people working on the standard library never have to worry about it.
Example output:

```
Copying stage0 std from stage0 (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu / x86_64-unknown-linux-gnu)
Updating submodule src/llvm-project
Submodule 'src/llvm-project' (https://github.com/rust-lang/llvm-project.git) registered for path 'src/llvm-project'
Submodule path 'src/llvm-project': checked out 'f9a8d70b6e0365ac2172ca6b7f1de0341297458d'
```

Implements https://github.com/rust-lang/rust/issues/76653#issuecomment-770265169. This could be easily extended to other submodules, like `rust-by-example` and `rustc-dev-guide`, which aren't needed for cargo's workspace resolution.
2021-05-23 00:40:48 +00:00
Joshua Nelson
0be4046bf9 Move llvm submodule updates to rustbuild
This enables better caching, since LLVM is only updated when needed, not
whenever x.py is run. Before, bootstrap.py had to use heuristics to
guess if LLVM would be needed, and updated the module more often than
necessary as a result.

This syncs the LLVM submodule only just before building the compiler, so
people working on the standard library never have to worry about it.
Example output:

```
Copying stage0 std from stage0 (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu / x86_64-unknown-linux-gnu)
Updating submodule src/llvm-project
Submodule 'src/llvm-project' (https://github.com/rust-lang/llvm-project.git) registered for path 'src/llvm-project'
Submodule path 'src/llvm-project': checked out 'f9a8d70b6e0365ac2172ca6b7f1de0341297458d'
```

- Don't try to update the LLVM submodule when using system LLVM

  Previously, this would try to update LLVM unconditionally. Now the
  submodule is only initialized if `llvm-config` is not set.

- Don't update LLVM submodule in dry runs

  This prevents the following test failures:

  ```
  running 17 tests
  fatal: invalid gitfile format: /checkout/src/llvm-project/.git
  test builder::tests::defaults::build_cross_compile ... FAILED

  ---- builder::tests::defaults::build_default stdout ----
  thread 'main' panicked at 'command did not execute successfully: "git" "rev-parse" "HEAD"
  expected success, got: exit code: 128', src/build_helper/lib.rs:139:9
  ```

- Try running git without --progress if it fails the first time

  This avoids having to do version detection to see if --progress is
  supported or not.

- Don't try to update submodules when the source repository isn't managed by git

- Update LLVM submodules that have already been checked out

- Only check for whether the submodule should be updated in lib.rs; update
it unconditionally in native.rs
2021-05-22 18:41:03 -05:00
bors
e4ca1662f2 Auto merge of #85578 - RalfJung:alloc-mem-extra, r=oli-obk
CTFE get_alloc_extra_mut: also provide ref to MemoryExtra

This would let me use mutable references in more places in Stacked Borrows, avoiding some `RefCell` overhead. :)

r? `@oli-obk`
2021-05-22 20:04:52 +00:00
bors
f98bd7eeca Auto merge of #85078 - RalfJung:const_fn_unsize, r=oli-obk
stabilize const_fn_unsize

I will post a stabilization report and ask for FCP in https://github.com/rust-lang/rust/issues/64992.
This PR is for the implementation side of stabilization.

r? `@oli-obk`
Fixes https://github.com/rust-lang/rust/issues/64992
2021-05-22 17:38:15 +00:00
Jacob Hoffman-Andrews
5ebbed6cb0 Fix auto-hide for implementations and implementors.
This sets their toggles to be closed in the HTML (matching the default
setting), and opens them if the setting indicates to do so.

This distinguishes between implementations and implementors based on
being descendants of certain named elements.
2021-05-22 09:07:24 -07:00
bors
ed20e1e533 Auto merge of #85514 - GuillaumeGomez:upgrade-minifer-version, r=Mark-Simulacrum
Upgrade minifier version to 0.0.41
2021-05-22 14:54:45 +00:00
Guillaume Gomez
8968c0e48f Add test for search result resize width 2021-05-22 16:41:26 +02:00
LeSeulArtichaut
3f31044d90 Handle typeck errors properly 2021-05-22 16:21:36 +02:00
LeSeulArtichaut
3797b0335a Remove some errors in UI tests
As we now need to run THIR unsafeck before MIR build, errors in unsafeck can cause the compilation to be aborted earlier.
2021-05-22 16:21:36 +02:00
LeSeulArtichaut
6dfdea9800 Make the THIR unsafeck use the thir_body query 2021-05-22 16:21:33 +02:00
Guillaume Gomez
c2bd786734 Set desc class on the div instead of the span to simplify CSS 2021-05-22 16:05:20 +02:00
Stefan Schindler
0415e0d882 Mobile description width: 100% 2021-05-22 15:29:59 +02:00
Stefan Schindler
ee7cc63e04 Add padding to mobile layout and fix width issue on both 2021-05-22 15:29:59 +02:00
Stefan Schindler
d8de2b4c33 Prepar to remove deep nesting 2021-05-22 15:29:59 +02:00
Stefan Schindler
221cba370c Implement staggered mobile layout 2021-05-22 15:29:59 +02:00
Ralf Jung
96ae300889 CTFE get_alloc_extra_mut: also provide ref to MemoryExtra 2021-05-22 15:20:20 +02:00
LeSeulArtichaut
6f64eb1fe6 Make THIR building a stealable query 2021-05-22 14:36:22 +02:00
LeSeulArtichaut
bd80018159 Move THIR structure definitions to rustc_middle 2021-05-22 14:36:22 +02:00
12101111
8e42fa55db
Add test for deduplicate native lib in linking 2021-05-22 19:51:26 +08:00
bors
104a3c3510 Auto merge of #85557 - hyd-dev:abi, r=RalfJung
Add `rustc_mir::interpret::Machine::enforce_abi()`

To specify whether to skip the [ABI](https://doc.rust-lang.org/nightly/nightly-rustc/rustc_target/abi/enum.Abi.html) check for function calls, so that we could test unwinding out of a `extern "C"` function call in Miri by disabling the check: https://github.com/rust-lang/miri/pull/1776#discussion_r633698382

I have tested that it works in Miri with a `-Zmiri-disable-abi-check` command line flag.
2021-05-22 11:49:13 +00:00
hyd-dev
7e42c975b9
Add default implementation for enforce_abi() 2021-05-22 19:11:47 +08:00
Ralf Jung
5c6f41e349 const_fn_unsize: check that the cast behaves correctly 2021-05-22 10:35:53 +02:00
Ralf Jung
65cd051b4a stabilize const_fn_unsize 2021-05-22 10:35:49 +02:00
bors
70cb58ce27 Auto merge of #85568 - GuillaumeGomez:search-result-extra-info, r=jsha
Search result extra info

The CSS rule was not updated when we updated the search result, this fixes it:

Before:
![Screenshot from 2021-05-21 22-56-17](https://user-images.githubusercontent.com/3050060/119197314-d31a4e80-ba87-11eb-863a-bc0b3de3bfb2.png)

After:
![Screenshot from 2021-05-21 22-54-53](https://user-images.githubusercontent.com/3050060/119197227-b54ce980-ba87-11eb-9f43-c10803ca1b90.png)

r? `@jsha`
2021-05-22 07:07:38 +00:00
bors
21e1cd9b95 Auto merge of #85531 - luqmana:flip-gc, r=petrochenkov
Swap TargetOptions::linker_is_gnu default from false to true and update targets as appropriate.

#85274 gated the `--gc-sections` flag on targets that specified `linker_is_gnu` to stop us from passing it to incompatible linkers. But that had the unintended effect of the flag no longer being passed on targets for which it is valid and hence caused a regression in binary size. Given that most `ld`-style linkers are GNU compatible, this change flips our default for `linker_is_gnu` from false to true. That also means updating the targets that relied on the previous default:
* Apple
* Illumos
* L4Re (not sure about this one)
* MSVC
* NvtPtx
* Solaris

Fixes #85519
2021-05-22 04:42:36 +00:00
bors
51d1610356 Auto merge of #85505 - flip1995:clippyup, r=Manishearth
Update Clippy

Bi-weekly Clippy update

r? `@Manishearth`
2021-05-22 01:59:57 +00:00
Jubilee Young
c516e71874 Remove surplus prepend LinkedList fn
Originally committed to Rust in 2013, it is identical to append
with a reversed order of arguments.
2021-05-21 16:05:11 -07:00
Guillaume Gomez
45fd4bc118 Add test for search result keyword extra info 2021-05-21 22:54:16 +02:00
Guillaume Gomez
4c88f0c63b Fix display for primitive and keyword extra info 2021-05-21 22:54:16 +02:00
bors
5dc8789e30 Auto merge of #85560 - GuillaumeGomez:rollup-8k90rc7, r=GuillaumeGomez
Rollup of 4 pull requests

Successful merges:

 - #85506 (Reset "focusedByTab" field when doing another search)
 - #85548 (Remove dead toggle JS code)
 - #85550 (facepalm: operator precedence fail on my part.)
 - #85555 (Check for more things in THIR unsafeck)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2021-05-21 19:17:22 +00:00
Guillaume Gomez
0f48e6365b
Rollup merge of #85555 - LeSeulArtichaut:thir-unsafeck, r=nikomatsakis
Check for more things in THIR unsafeck

Reunion of #85306, #85381 and #85419 with conflicts resolved.
r? `@nikomatsakis`
2021-05-21 20:06:09 +02:00
Guillaume Gomez
9ec88ce78a
Rollup merge of #85550 - pnkfelix:fix-max-rss-division-on-mac, r=Mark-Simulacrum
facepalm: operator precedence fail on my part.

This bug was only visible on mac. Also, print_step_rusage is a relatively new
internal feature, that is not heavily used, and has no tests. All of these
factors contributed to how this went uncaught this long. Thanks to Josh Triplett
for pointing it out!
2021-05-21 20:06:08 +02:00
Guillaume Gomez
3f0bc5c23b
Rollup merge of #85548 - GuillaumeGomez:remove-dead-js, r=jsha
Remove dead toggle JS code

Explanations on how I got there: I randomly saw `adjustToggle` while browsing through code, checked where it was called, put a `debugger;` instruction in it and checked on all pages while playing with settings and toggles. The breakpoint was never triggered. I then looked at `collapseNonInherent` (its grand-parent). In there, the breakpoint was triggered so I look at what was being done and in fact... nothing. So I simply removed it all, re-ran the tests and play with the UI. Everything is working as expected.

Better double check in case I forgot to check a case though, but if nothing has been left out, then it's a great cleanup once again. :)

r? ``@jsha``
2021-05-21 20:06:07 +02:00