]> git.lizzy.rs Git - rust.git/log
rust.git
3 years agoFix SGX CI
Jethro Beekman [Tue, 1 Dec 2020 14:36:14 +0000 (15:36 +0100)]
Fix SGX CI

Broken in #79038

3 years agoAuto merge of #79596 - m-ou-se:rollup-hujx3c7, r=m-ou-se
bors [Tue, 1 Dec 2020 12:15:10 +0000 (12:15 +0000)]
Auto merge of #79596 - m-ou-se:rollup-hujx3c7, r=m-ou-se

Rollup of 11 pull requests

Successful merges:

 - #79038 (Change ui test that are run-pass and that do not test the compiler to library tests)
 - #79184 (Stop adding '*' at the end of slice and str typenames for MSVC case)
 - #79227 (Remove const_fn_feature_flags test)
 - #79444 (Move const ip in ui test to unit test)
 - #79522 (Validate lint docs separately.)
 - #79525 (Add -Z normalize-docs and enable it for compiler docs)
 - #79527 (Move intra-doc link tests into a subdirectory)
 - #79548 (Show since when a function is const in stdlib)
 - #79568 (update Miri)
 - #79573 (Update with status for various NetBSD ports.)
 - #79583 (Update books)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup

3 years agoRollup merge of #79583 - ehuss:update-books, r=ehuss
Mara Bos [Tue, 1 Dec 2020 10:50:26 +0000 (10:50 +0000)]
Rollup merge of #79583 - ehuss:update-books, r=ehuss

Update books

## nomicon

1 commits in 23c49f1d5ce4720bc5b7e3a920f47eccc8da6b63..d8383b65f7948c2ca19191b3b4bd709b403aaf45
2020-11-05 13:30:53 +0900 to 2020-11-22 10:24:42 -0500
- Clarify that any alignment is valid for ZSTs

## reference

5 commits in a7de763c213292f5b44bf10acb87ffa38724814d..a8afdca5d0715b2257b6f8b9a032fd4dd7dae855
2020-11-11 19:13:21 -0800 to 2020-11-30 06:44:46 -0800
- Describe relationship between reference and optimizers (rust-lang/reference#902)
- A simple missing space (rust-lang/reference#909)
- Cleanup formatting (rust-lang/reference#907)
- Use `doc`, not `test` for fn item inner attr example (rust-lang/reference#906)
- Update where our chat is. (rust-lang/reference#903)

## book

1 commits in 13e1c05420bca86ecc79e4ba5b6d02de9bd53c62..a190438d77d28041f24da4f6592e287fab073a61
2020-10-20 14:57:32 -0500 to 2020-11-16 10:44:08 -0600
- Change SipHash not found (404) link to SipHash in Wikipedia (rust-lang/book#2503)

## rust-by-example

4 commits in 1886fda6981b723e4de637074455558f8bc1e83c..236c734a2cb323541b3394f98682cb981b9ec086
2020-10-28 13:46:54 -0500 to 2020-11-30 14:05:49 -0300
- Update old invalid link (rust-lang/rust-by-example#1392)
- Moved "See also" link to the correct page. (rust-lang/rust-by-example#1389)
- Fix some markdown lint warnings (rust-lang/rust-by-example#1388)
- Minor grammar suggestion (rust-lang/rust-by-example#1386)

## embedded-book

1 commits in ca8169e69b479f615855d0eece7e318138fcfc00..ba34b8a968f9531d38c4dc4411d5568b7c076bfe
2020-10-15 15:06:35 +0000 to 2020-11-17 00:20:43 +0000
- Clarify CAS availability  (rust-embedded/book#273)

3 years agoRollup merge of #79573 - he32:master, r=jonas-schievink
Mara Bos [Tue, 1 Dec 2020 10:50:25 +0000 (10:50 +0000)]
Rollup merge of #79573 - he32:master, r=jonas-schievink

Update with status for various NetBSD ports.

The NetBSD ports of rust to aarch64, armv7*, i686, and powerpc**
all both build and run.  Status is as of rust 1.47.0.

*) Natively requires repeated successive build attempts (`rustc` is
   such a resource pig VM-consumption-wise), or run in a chroot
   on an aarch64 host where the available VM space is 4GB instead
   of the native 2GB.
**) Powerpc either requires `-latomic` in a directory searched by
   default by `ld` or to be built within pkgsrc which has a patch and
   support package to tackle this issue.

3 years agoRollup merge of #79568 - RalfJung:miri, r=RalfJung
Mara Bos [Tue, 1 Dec 2020 10:50:23 +0000 (10:50 +0000)]
Rollup merge of #79568 - RalfJung:miri, r=RalfJung

update Miri

This update includes https://github.com/rust-lang/miri/pull/1617, the data race detector by ``@JCTyblaidd.`` :)

Cc ``@rust-lang/miri`` r? ``@ghost``

3 years agoRollup merge of #79548 - CraftSpider:76998, r=jyn514
Mara Bos [Tue, 1 Dec 2020 10:50:21 +0000 (10:50 +0000)]
Rollup merge of #79548 - CraftSpider:76998, r=jyn514

Show since when a function is const in stdlib

Fixes #76998

This makes it so that functions with the `#[rustc_const_stable()]` attribute now show from what version they were stably declared const, alongside what version they were declared stable. Example from `Result`:
![image](https://user-images.githubusercontent.com/13342132/100561194-1be60d00-3286-11eb-99ff-1e81201218a9.png)

r? ``@jyn514``

3 years agoRollup merge of #79527 - jyn514:intra-doc-tests, r=Manishearth
Mara Bos [Tue, 1 Dec 2020 10:50:19 +0000 (10:50 +0000)]
Rollup merge of #79527 - jyn514:intra-doc-tests, r=Manishearth

Move intra-doc link tests into a subdirectory

They were starting to get unwieldy.

r? ``@Manishearth``

3 years agoRollup merge of #79525 - jyn514:feature-gate-normalize, r=GuillaumeGomez
Mara Bos [Tue, 1 Dec 2020 10:50:18 +0000 (10:50 +0000)]
Rollup merge of #79525 - jyn514:feature-gate-normalize, r=GuillaumeGomez

Add -Z normalize-docs and enable it for compiler docs

Works around https://github.com/rust-lang/rust/issues/79459 by only enabling normalization for the compiler itself (and anyone who opts-in on nightly). Eventually I want to remove this and enable normalization by default, but that's turned out to be [really hard](https://rust-lang.zulipchat.com/#narrow/stream/182449-t-compiler.2Fhelp/topic/How.20do.20I.20normalize.20projection.20types.20to.20a.20single.20type.3F/near/218125195).

This uses a command line option instead of a feature gate so it's easier to pass it to all crates at once. Theoretically it's better to use a feature gate instead so that it's easier for people to use on docs.rs, but I'm also not terribly concerned with how easy it to use a temporary hack.

Addresses https://github.com/rust-lang/rust/issues/77459.

3 years agoRollup merge of #79522 - ehuss:lint-check-validate, r=Mark-Simulacrum
Mara Bos [Tue, 1 Dec 2020 10:50:16 +0000 (10:50 +0000)]
Rollup merge of #79522 - ehuss:lint-check-validate, r=Mark-Simulacrum

Validate lint docs separately.

This addresses some concerns raised in https://github.com/rust-lang/rust/pull/76549#issuecomment-727638552 about errors with the lint docs being confusing and cumbersome. Errors from validating the lint documentation were being generated during `x.py doc` (and `x.py dist`), since extraction and validation are being done in a single step. This changes it so that extraction and validation are separated, so that `x.py doc` will not error if there is a validation problem, and tests are moved to `x.py test src/tools/lint-docs`.

This includes the following changes:

* Separate validation to `x.py test`.
* Added some more documentation on how to more easily modify and test the docs.
* Added more help to the error messages to hopefully provide more information on how to fix things.

The first commit just moves the code around, so you may consider looking at the other commits for a smaller diff.

3 years agoRollup merge of #79444 - sasurau4:test/move-const-ip, r=matklad
Mara Bos [Tue, 1 Dec 2020 10:50:15 +0000 (10:50 +0000)]
Rollup merge of #79444 - sasurau4:test/move-const-ip, r=matklad

Move const ip in ui test to unit test

Helps with #76268

r? ``@matklad``

3 years agoRollup merge of #79227 - sasurau4:test/move-cell-test-to-lib-core, r=jyn514
Mara Bos [Tue, 1 Dec 2020 10:50:12 +0000 (10:50 +0000)]
Rollup merge of #79227 - sasurau4:test/move-cell-test-to-lib-core, r=jyn514

Remove const_fn_feature_flags test

## Overview

Helps with #76268

I found `const_fn_feature_flags` is targeting feature-gate and remove it.

r? ``@matklad``

3 years agoRollup merge of #79184 - nanguye2496:nanguye2496/fix_slice_and_str_type_name, r=varkor
Mara Bos [Tue, 1 Dec 2020 10:50:10 +0000 (10:50 +0000)]
Rollup merge of #79184 - nanguye2496:nanguye2496/fix_slice_and_str_type_name, r=varkor

Stop adding '*' at the end of slice and str typenames for MSVC case

When computing debug info for MSVC debuggers, Rust compiler emits C++ style type names for compatibility with .natvis visualizers. All Ref types are treated as equivalences of C++ pointers in this process, and, as a result, their type names end with a '\*'. Since Slice and Str are treated as Ref by the compiler, their type names also end with a '\*'. This causes the .natvis engine for WinDbg fails to display data of Slice and Str objects. We addressed this problem simply by removing the '*' at the end of type names for Slice and Str types.

Debug info in WinDbg before the fix:
![image](https://user-images.githubusercontent.com/74681961/99594120-9a4dcf80-29a7-11eb-8cce-aedaf1da6d21.png)

Debug info in WinDbg after the fix:
![image](https://user-images.githubusercontent.com/74681961/99597173-717c0900-29ac-11eb-861e-98143a9177cf.png)

This change has also been tested with debuggers for Visual Studio, VS Code C++ and VS Code LLDB to make sure that it does not affect the behavior of other kinds of debugger.

3 years agoRollup merge of #79038 - CDirkx:move-ui-tests, r=dtolnay
Mara Bos [Tue, 1 Dec 2020 10:50:02 +0000 (10:50 +0000)]
Rollup merge of #79038 - CDirkx:move-ui-tests, r=dtolnay

Change ui test that are run-pass and that do not test the compiler to library tests

Part of #76268, these are some of the relevant ui tests I found that can be replaced by library tests.

Note: this PR just moves the tests, I have not checked for any overlap between these tests and existing library tests. The only test I changed is `env_home_dir`, where I added code to restore the old home dir after testing.

All moved tests:

| ui test | library test file | test |
| --- | --- | --- |
| `const\ascii_ctype.rs` | `core\tests\ascii.rs` | `ascii_ctype_const` |
| `const\const-str-ptr.rs` | `alloc\tests\str.rs` | `const_str_ptr` |
| `assert-eq-trailing-comma.rs` | `core\tests\macros.rs` | `assert_eq_trailing_comma` |
| `assert-escape.rs` | `core\tests\macros.rs` | `assert_escape` |
| `assert-ne-trailing-comma.rs` | `core\tests\macros.rs` | `assert_ne_trailing_comma` |
| `atomic-access-bool.rs` | `core\tests\atomic.rs` | `atomic_access_bool` |
| `atomic-alignment.rs` | `core\tests\atomic.rs` | `atomic_alignment` |
| `atomic-compare_exchange.rs` | `core\tests\atomic.rs` | `atomic_compare_exchange` |
| ~~`atomic-print.rs`~~ | ~~`std\tests\process.rs`~~ | ~~`atomic_print`~~ |
| `bool.rs` | `core\tests\bool.rs` | `test_bool` |
| `bool_not.rs` | `core\tests\bool.rs` | `test_bool_not` |
| `char_unicode.rs` | `core\tests\unicode.rs` | `version` |
| `cmp-default.rs` | `core\tests\cmp.rs` | `cmp_default` |
| `deref-mut-on-ref.rs` | `core\tests\ops.rs` | `deref_mut_on_ref` |
| `deref-on-ref.rs` | `core\tests\ops.rs` | `deref_on_ref` |
| `env-home-dir.rs` | `std\tests\env.rs` | `env_home_dir` |
| ~~`env-vars.rs`~~ | ~~`std\tests\env.rs`~~ | ~~`env_vars`~~ |
| `extend-for-unit.rs` | `core\tests\iter.rs` | `extend_for_unit` |
| `offset_from.rs` | `core\tests\ptr.rs` | `offset_from` |
| `option-ext.rs` | `core\tests\option.rs` | `option_ext` |
| `result-opt-conversions.rs` | `core\tests\result.rs` | `result_opt_conversions` |
| `sleep.rs` | `std\tests\thread.rs` | `sleep` |
| ~~`try-wait.rs`~~ | ~~`std\tests\process.rs`~~ | ~~`try_wait`~~ |
| `utf8.rs` | `alloc\tests\str.rs` | `utf8` |
| `utf8_chars.rs` | `alloc\tests\str.rs` | `utf8_chars` |
| `wrapping-int-api.rs` | `core\tests\num\wrapping.rs` | `wrapping_int_api` |

3 years agoAuto merge of #78876 - GuillaumeGomez:better-setting-keyboard-ux, r=jyn514
bors [Tue, 1 Dec 2020 09:58:59 +0000 (09:58 +0000)]
Auto merge of #78876 - GuillaumeGomez:better-setting-keyboard-ux, r=jyn514

Make keyboard interactions in the settings menu more pleasant

#78868 improved the keyboard interactions with the settings page. This PR goes a bit further by allowing more than just "space" to toggle the checkboxes.

r? `@jyn514`

3 years agoAuto merge of #78725 - sexxi-goose:fix-78720, r=nikomatsakis
bors [Tue, 1 Dec 2020 07:00:41 +0000 (07:00 +0000)]
Auto merge of #78725 - sexxi-goose:fix-78720, r=nikomatsakis

Remove extra call to upvar_tys

We already visit the tuple of upvar_tys, we don't need to visit each individual type.

Fixes #78720

r? `@ghost`

3 years agoAuto merge of #78142 - operutka:armv5te-unknown-linux-uclibcgnueabi-target, r=petroch...
bors [Tue, 1 Dec 2020 04:53:38 +0000 (04:53 +0000)]
Auto merge of #78142 - operutka:armv5te-unknown-linux-uclibcgnueabi-target, r=petrochenkov

Add built-in support for the armv5te-unknown-linux-uclibcgnueabi target

Hi!

I'd like to add built-in support for the `armv5te-unknown-linux-uclibcgnueabi` target. It's a pretty common target used by many devices like routers and IP cameras. It's mostly a copy-paste of `armv5te-unknown-linux-gnueabi`. I've tested it on a quite complex application that uses tokio, openssl and a lot of other stuff and everything seems to be working fine.

I'm not sure about the `post_link_args` but the point is that my linker fails when `-ldl` isn't specified. Maybe there is a better place where to put this option...

It's my first contribution to Rust itself, so feel free to wash my head :smile:

_Note: The app mentioned above was built with this in my `.cargo/config`:_
```
[unstable]
build-std = ["core", "std", "alloc", "proc_macro", "panic_abort"]
build-std-features = ["panic_immediate_abort"]
```

3 years agoAuto merge of #77875 - poliorcetics:more-intra-doc-links, r=jyn514
bors [Tue, 1 Dec 2020 02:45:26 +0000 (02:45 +0000)]
Auto merge of #77875 - poliorcetics:more-intra-doc-links, r=jyn514

More intra doc links

Helps with #75080.

I did a commit by group of file, I can squash if wanted.

`@rustbot` modify labels: T-doc, A-intra-doc-links

r? `@jyn514`

3 years agoUpdate books
Eric Huss [Tue, 1 Dec 2020 01:25:23 +0000 (17:25 -0800)]
Update books

3 years agoStop adding '*' at the end of type names for Ref and Slice when computing debug info...
Nam Nguyen [Wed, 18 Nov 2020 21:42:36 +0000 (13:42 -0800)]
Stop adding '*' at the end of type names for Ref and Slice when computing debug info for MSVC debuggers

3 years agoFix several broken links in doc that used the wrong qualifier or Self::
Alexis Bourget [Mon, 30 Nov 2020 20:21:15 +0000 (21:21 +0100)]
Fix several broken links in doc that used the wrong qualifier or Self::

3 years agoBack to #method for links on char
Alexis Bourget [Thu, 19 Nov 2020 13:55:57 +0000 (14:55 +0100)]
Back to #method for links on char

3 years agoptr links
Alexis Bourget [Tue, 13 Oct 2020 06:59:45 +0000 (08:59 +0200)]
ptr links

3 years agoUse core::primitive module instead of prim@
Alexis Bourget [Tue, 13 Oct 2020 06:52:48 +0000 (08:52 +0200)]
Use core::primitive module instead of prim@

3 years agoUse Self:: in links
Alexis Bourget [Tue, 13 Oct 2020 06:49:16 +0000 (08:49 +0200)]
Use Self:: in links

3 years agoIntra doc links for iterator adapters
Alexis Bourget [Mon, 12 Oct 2020 22:52:13 +0000 (00:52 +0200)]
Intra doc links for iterator adapters

3 years agoIntra doc links for f32/f64
Alexis Bourget [Mon, 12 Oct 2020 22:52:01 +0000 (00:52 +0200)]
Intra doc links for f32/f64

3 years agoIntra doc links for the pointer primitive
Alexis Bourget [Mon, 12 Oct 2020 22:40:40 +0000 (00:40 +0200)]
Intra doc links for the pointer primitive

3 years agoIntra doc links for str/mod.rs
Alexis Bourget [Mon, 12 Oct 2020 22:24:09 +0000 (00:24 +0200)]
Intra doc links for str/mod.rs

3 years agoIntra doc links for the char primitive
Alexis Bourget [Mon, 12 Oct 2020 22:18:41 +0000 (00:18 +0200)]
Intra doc links for the char primitive

3 years agoIntra doc links for cell.rs
Alexis Bourget [Mon, 12 Oct 2020 22:18:28 +0000 (00:18 +0200)]
Intra doc links for cell.rs

3 years agoUpdate with status for various NetBSD ports.
Havard Eidnes [Mon, 30 Nov 2020 18:18:21 +0000 (19:18 +0100)]
Update with status for various NetBSD ports.

The NetBSD ports of rust to aarch64, armv7*, i686, and powerpc**
all both build and run.

*) Natively requires repeated successive build attempts (rustc is
   such a resource pig VM-consumption-wise), or run in a chroot
   on an aarch64 host where the available VM space is 4GB instead
   of the native 2GB.
**) Powerpc either requires -latomic in a directory searched by
   default by 'ld' or to be built within pkgsrc which has a patch
   to tackle this.

3 years agoupdate Miri
Ralf Jung [Mon, 30 Nov 2020 15:37:40 +0000 (16:37 +0100)]
update Miri

3 years agoAuto merge of #76467 - jyn514:intra-link-self, r=Manishearth
bors [Mon, 30 Nov 2020 09:00:52 +0000 (09:00 +0000)]
Auto merge of #76467 - jyn514:intra-link-self, r=Manishearth

Fix intra-doc links for `Self` on cross-crate items and primitives

- Remove the difference between `parent_item` and `current_item`; these
  should never have been different.
- Remove `current_item` from `resolve` and `variant_field` so that
  `Self` is only substituted in one place at the very start.
- Resolve the current item as a `DefId`, not a `HirId`. This is what
  actually fixed the bug.

Hacks:
- `clean` uses `TypedefItem` when it _really_ should be
  `AssociatedTypeItem`. I tried fixing this without success and hacked
  around it instead (see comments)
- This second-guesses the `to_string()` impl since it wants
  fully-qualified paths. Possibly there's a better way to do this.

3 years agoAdd built-in support for the armv5te-unknown-linux-uclibceabi target
Ondrej Perutka [Mon, 30 Nov 2020 08:47:09 +0000 (09:47 +0100)]
Add built-in support for the armv5te-unknown-linux-uclibceabi target

3 years agoAdd support for stable-const-since in docs on items (standalone or assoc)
Rune Tynan [Mon, 30 Nov 2020 02:00:14 +0000 (21:00 -0500)]
Add support for stable-const-since in docs on items (standalone or assoc)

3 years agoMake ui test that are run-pass and do not test the compiler itself library tests
Christiaan Dirkx [Sun, 22 Nov 2020 08:08:04 +0000 (09:08 +0100)]
Make ui test that are run-pass and do not test the compiler itself library tests

3 years agoAuto merge of #79329 - camelid:int-lit-suffix-error, r=davidtwco
bors [Mon, 30 Nov 2020 01:42:14 +0000 (01:42 +0000)]
Auto merge of #79329 - camelid:int-lit-suffix-error, r=davidtwco

Update error to reflect that integer literals can have float suffixes

For example, `1` is parsed as an integer literal, but it can be turned
into a float with the suffix `f32`. Now the error calls them "numeric
literals" and notes that you can add a float suffix since they can be
either integers or floats.

3 years agoBe cautious of calling upvar_tys before mir
Aman Arora [Sat, 7 Nov 2020 06:04:27 +0000 (01:04 -0500)]
Be cautious of calling upvar_tys before mir

3 years agoRemove extra call to upvar_tys
Aman Arora [Wed, 4 Nov 2020 08:07:40 +0000 (03:07 -0500)]
Remove extra call to upvar_tys

Fixes #78720

3 years agoAuto merge of #78122 - fusion-engineering-forks:fmt-write-bounds-check, r=Mark-Simulacrum
bors [Sun, 29 Nov 2020 23:14:40 +0000 (23:14 +0000)]
Auto merge of #78122 - fusion-engineering-forks:fmt-write-bounds-check, r=Mark-Simulacrum

Avoid panic_bounds_check in fmt::write.

Writing any fmt::Arguments would trigger the inclusion of usize formatting and padding code in the resulting binary, because indexing used in fmt::write would generate code using panic_bounds_check, which prints the index and length.

These bounds checks are not necessary, as fmt::Arguments never contains any out-of-bounds indexes.

This change replaces them with unsafe get_unchecked, to reduce the amount of generated code, which is especially important for embedded targets.

---

Demonstration of the size of and the symbols in a 'hello world' no_std binary:

<details>
<summary>Source code</summary>

```rust
#![feature(lang_items)]
#![feature(start)]
#![no_std]

use core::fmt;
use core::fmt::Write;

#[link(name = "c")]
extern "C" {
    #[allow(improper_ctypes)]
    fn write(fd: i32, s: &str) -> isize;
    fn exit(code: i32) -> !;
}

struct Stdout;

impl fmt::Write for Stdout {
    fn write_str(&mut self, s: &str) -> fmt::Result {
        unsafe { write(1, s) };
        Ok(())
    }
}

#[start]
fn main(_argc: isize, _argv: *const *const u8) -> isize {
    let _ = writeln!(Stdout, "Hello World");
    0
}

#[lang = "eh_personality"]
fn eh_personality() {}

#[panic_handler]
fn panic(_: &core::panic::PanicInfo) -> ! {
    unsafe { exit(1) };
}
```
</details>

Before:
```
   text    data     bss     dec     hex filename
   6059     736       8    6803    1a93 before
```
```
0000000000001e00 T <T as core::any::Any>::type_id
0000000000003dd0 D core::fmt::num::DEC_DIGITS_LUT
0000000000001ce0 T core::fmt::num::imp::<impl core::fmt::Display for u64>::fmt
0000000000001ce0 T core::fmt::num::imp::<impl core::fmt::Display for usize>::fmt
0000000000001370 T core::fmt::write
0000000000001b30 t core::fmt::Formatter::pad_integral::write_prefix
0000000000001660 T core::fmt::Formatter::pad_integral
0000000000001350 T core::ops::function::FnOnce::call_once
0000000000001b80 t core::ptr::drop_in_place
0000000000001120 t core::ptr::drop_in_place
0000000000001c50 t core::iter::adapters::zip::Zip<A,B>::new
0000000000001c90 t core::iter::adapters::zip::Zip<A,B>::new
0000000000001b90 T core::panicking::panic_bounds_check
0000000000001c10 T core::panicking::panic_fmt
0000000000001130 t <&mut W as core::fmt::Write>::write_char
0000000000001200 t <&mut W as core::fmt::Write>::write_fmt
0000000000001250 t <&mut W as core::fmt::Write>::write_str
```

After:
```
   text    data     bss     dec     hex filename
   3068     600       8    3676     e5c after
```
```
0000000000001360 T core::fmt::write
0000000000001340 T core::ops::function::FnOnce::call_once
0000000000001120 t core::ptr::drop_in_place
0000000000001620 t core::iter::adapters::zip::Zip<A,B>::new
0000000000001660 t core::iter::adapters::zip::Zip<A,B>::new
0000000000001130 t <&mut W as core::fmt::Write>::write_char
0000000000001200 t <&mut W as core::fmt::Write>::write_fmt
0000000000001250 t <&mut W as core::fmt::Write>::write_str
```

3 years agoAdd -Z normalize-docs and enable it for compiler docs
Joshua Nelson [Sun, 29 Nov 2020 00:19:41 +0000 (19:19 -0500)]
Add -Z normalize-docs and enable it for compiler docs

3 years agoAuto merge of #79209 - spastorino:trait-inheritance-self, r=nikomatsakis
bors [Sun, 29 Nov 2020 21:04:23 +0000 (21:04 +0000)]
Auto merge of #79209 - spastorino:trait-inheritance-self, r=nikomatsakis

Allow Trait inheritance with cycles on associated types

Fixes #35237

r? `@nikomatsakis`

cc `@estebank`

3 years agoAdd test for cross-crate Self
Joshua Nelson [Sun, 29 Nov 2020 18:49:44 +0000 (13:49 -0500)]
Add test for cross-crate Self

3 years agoAuto merge of #79523 - Nadrieril:fix-usize-ranges, r=varkor
bors [Sun, 29 Nov 2020 18:50:19 +0000 (18:50 +0000)]
Auto merge of #79523 - Nadrieril:fix-usize-ranges, r=varkor

Fix overlap detection of `usize`/`isize` range patterns

`usize` and `isize` are a bit of a special case in the match usefulness algorithm, because the range of values they contain depends on the platform. Specifically, we don't want `0..usize::MAX` to count as an exhaustive match (see also [`precise_pointer_size_matching`](https://github.com/rust-lang/rust/issues/56354)). The way this was initially implemented is by treating those ranges like float ranges, i.e. with limited cleverness. This means we didn't catch the following as unreachable:
```rust
match 0usize {
    0..10 => {},
    10..20 => {},
    5..15 => {}, // oops, should be detected as unreachable
    _ => {},
}
```
This PRs fixes this oversight. Now the only difference between `usize` and `u64` range patterns is in what ranges count as exhaustive.

r? `@varkor`
`@rustbot` label +A-exhaustiveness-checking

3 years agoRemove `TypeKind` hack in favor of `with_crate_prefix`
Joshua Nelson [Sun, 29 Nov 2020 18:37:43 +0000 (13:37 -0500)]
Remove `TypeKind` hack in favor of `with_crate_prefix`

3 years agoFix intra-doc links for `Self` on primitives
Joshua Nelson [Tue, 8 Sep 2020 04:07:40 +0000 (00:07 -0400)]
Fix intra-doc links for `Self` on primitives

- Remove the difference between `parent_item` and `current_item`; these
  should never have been different.
- Remove `current_item` from `resolve` and `variant_field` so that
  `Self` is only substituted in one place at the very start.
- Resolve the current item as a `DefId`, not a `HirId`. This is what
  actually fixed the bug.

Hacks:
- `clean` uses `TypedefItem` when it _really_ should be
  `AssociatedTypeItem`. I tried fixing this without success and hacked
  around it instead (see comments)
- This stringifies DefIds, then resolves them a second time. This is
  really silly and rustdoc should just use DefIds throughout. Fixing
  this is a larger task than I want to take on right now.

3 years agoAuto merge of #79482 - faern:bump-dependencies-invalidly-assuming-mem-layout, r=Mark...
bors [Sun, 29 Nov 2020 16:39:23 +0000 (16:39 +0000)]
Auto merge of #79482 - faern:bump-dependencies-invalidly-assuming-mem-layout, r=Mark-Simulacrum

Bump dependencies invalidly assuming memory layout of SocketAddr

Bumps net2, socket2 and miow.
Helps unblock #78802

Done as separate PR since frequent lockfile collisions is a thing... And since the main PR can't be merged until large parts of the ecosystem uses the newer crates only, so we have to start somewhere.

3 years agolint-docs: Use strip-prefix to simplify.
Eric Huss [Sun, 29 Nov 2020 15:57:55 +0000 (07:57 -0800)]
lint-docs: Use strip-prefix to simplify.

3 years agolint-docs: Add some extra detail to the error message.
Eric Huss [Sat, 28 Nov 2020 21:35:36 +0000 (13:35 -0800)]
lint-docs: Add some extra detail to the error message.

This will hopefully help users figure out what was wrong and how
to fix it.

3 years agoAuto merge of #78380 - bstrie:rm-old-num-const-from-tests, r=jyn514
bors [Sun, 29 Nov 2020 14:29:23 +0000 (14:29 +0000)]
Auto merge of #78380 - bstrie:rm-old-num-const-from-tests, r=jyn514

Update tests to remove old numeric constants

Part of #68490.

Care has been taken to leave the old consts where appropriate, for testing backcompat regressions, module shadowing, etc. The intrinsics docs were accidentally referring to some methods on f64 as std::f64, which I changed due to being contrary with how we normally disambiguate the shadow module from the primitive. In one other place I changed std::u8 to std::ops since it was just testing path handling in macros.

For places which have legitimate uses of the old consts, deprecated attributes have been optimistically inserted. Although currently unnecessary, they exist to emphasize to any future deprecation effort the necessity of these specific symbols and prevent them from being accidentally removed.

3 years agoAuto merge of #77616 - jyn514:no-normalize, r=lcnr
bors [Sun, 29 Nov 2020 11:37:44 +0000 (11:37 +0000)]
Auto merge of #77616 - jyn514:no-normalize, r=lcnr

Don't run `resolve_vars_if_possible` in `normalize_erasing_regions`

Neither `@eddyb` nor I could figure out what this was for. I changed it to `assert_eq!(normalized_value, infcx.resolve_vars_if_possible(&normalized_value));` and it passed the UI test suite.

<details><summary>

Outdated, I figured out the issue - `needs_infer()` needs to come _after_ erasing the lifetimes

</summary>

Strangely, if I change it to `assert!(!normalized_value.needs_infer())` it panics almost immediately:

```
query stack during panic:
#0 [normalize_generic_arg_after_erasing_regions] normalizing `<str::IsWhitespace as str::pattern::Pattern>::Searcher`
#1 [needs_drop_raw] computing whether `str::iter::Split<str::IsWhitespace>` needs drop
#2 [mir_built] building MIR for `str::<impl str>::split_whitespace`
#3 [unsafety_check_result] unsafety-checking `str::<impl str>::split_whitespace`
#4 [mir_const] processing MIR for `str::<impl str>::split_whitespace`
#5 [mir_promoted] processing `str::<impl str>::split_whitespace`
#6 [mir_borrowck] borrow-checking `str::<impl str>::split_whitespace`
#7 [analysis] running analysis passes on this crate
end of query stack
```

I'm not entirely sure what's going on - maybe the two disagree?

</details>

For context, this came up while reviewing https://github.com/rust-lang/rust/pull/77467/ (cc `@lcnr).`

Possibly this needs a crater run?

r? `@nikomatsakis`
cc `@matthewjasper`

3 years agoAdd test to check for fmt::write bloat.
Mara Bos [Tue, 20 Oct 2020 18:20:31 +0000 (20:20 +0200)]
Add test to check for fmt::write bloat.

It checks that fmt::write by itself doesn't pull in any panicking or
or display code.

3 years agoBump dependencies invalidly assuming memory layout of SocketAddr
Linus Färnstrand [Fri, 27 Nov 2020 23:56:12 +0000 (00:56 +0100)]
Bump dependencies invalidly assuming memory layout of SocketAddr

Bumps net2, socket2 and miow.
Helps unblock https://github.com/rust-lang/rust/pull/78802

3 years agoAuto merge of #78863 - KodrAus:feat/simd-array, r=oli-obk
bors [Sun, 29 Nov 2020 09:28:09 +0000 (09:28 +0000)]
Auto merge of #78863 - KodrAus:feat/simd-array, r=oli-obk

Support repr(simd) on ADTs containing a single array field

This is a squash and rebase of `@gnzlbg's` #63531

I've never actually written code in the compiler before so just fumbled my way around until it would build 😅

I imagine there'll be some work we need to do in `rustc_codegen_cranelift` too for this now, but might need some input from `@bjorn3` to know what that is.

cc `@rust-lang/project-portable-simd`

-----

This PR allows using `#[repr(simd)]` on ADTs containing a single array field:

```rust
 #[repr(simd)] struct S0([f32; 4]);
 #[repr(simd)] struct S1<const N: usize>([f32; N]);
 #[repr(simd)] struct S2<T, const N: usize>([T; N]);
```

This should allow experimenting with portable packed SIMD abstractions on nightly that make use of const generics.

3 years agoargs may be passed by value
Ashley Mannix [Sun, 29 Nov 2020 08:36:30 +0000 (18:36 +1000)]
args may be passed by value

3 years agoAuto merge of #79455 - CraftSpider:master, r=jyn514
bors [Sun, 29 Nov 2020 07:05:49 +0000 (07:05 +0000)]
Auto merge of #79455 - CraftSpider:master, r=jyn514

Remove doctree::Macro and distinguish between `macro_rules!` and `pub macro`

This is a part of #78082, removing doctree::Macro. Uses the changes in #79372

Fixes #76761

3 years agoUpdate tests to remove old numeric constants
bstrie [Sat, 24 Oct 2020 23:21:40 +0000 (19:21 -0400)]
Update tests to remove old numeric constants

Part of #68490.

Care has been taken to leave the old consts where appropriate, for testing backcompat regressions, module shadowing, etc. The intrinsics docs were accidentally referring to some methods on f64 as std::f64, which I changed due to being contrary with how we normally disambiguate the shadow module from the primitive. In one other place I changed std::u8 to std::ops since it was just testing path handling in macros.

For places which have legitimate uses of the old consts, deprecated attributes have been optimistically inserted. Although currently unnecessary, they exist to emphasize to any future deprecation effort the necessity of these specific symbols and prevent them from being accidentally removed.

3 years agoAuto merge of #75752 - jakoschiko:test-suite-time, r=m-ou-se
bors [Sun, 29 Nov 2020 04:54:20 +0000 (04:54 +0000)]
Auto merge of #75752 - jakoschiko:test-suite-time, r=m-ou-se

libtest: Print the total time taken to execute a test suite

Print the total time taken to execute a test suite by default, without any kind of flag.

Closes #75660

# Example
```
anon@anon:~/code/rust/example$ cargo test
   Compiling example v0.1.0 (/home/anon/code/rust/example)
    Finished test [unoptimized + debuginfo] target(s) in 0.18s
     Running target/debug/deps/example-745b64d3885c3565

running 3 tests
test tests::foo ... ok
test tests::bar ... ok
test tests::baz ... ok

test result: ok. 3 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; 1.2s

   Doc-tests example

running 3 tests
test src/lib.rs - foo (line 3) ... ok
test src/lib.rs - bar (line 11) ... ok
test src/lib.rs - baz (line 19) ... ok

test result: ok. 3 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; 1.3s
```

```
anon@anon:~/code/rust/example$ cargo test -- --format terse
    Finished test [unoptimized + debuginfo] target(s) in 0.08s
     Running target/debug/deps/example-745b64d3885c3565

running 3 tests
...
test result: ok. 3 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; 1.2s

   Doc-tests example

running 3 tests
...
test result: ok. 3 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; 1.3s
```

```
anon@anon:~/code/rust/example$ cargo test -- --format json -Z unstable-options
   Compiling example v0.1.0 (/home/anon/code/rust/example)
    Finished test [unoptimized + debuginfo] target(s) in 0.25s
     Running target/debug/deps/example-745b64d3885c3565
{ "type": "suite", "event": "started", "test_count": 3 }
{ "type": "test", "event": "started", "name": "tests::bar" }
{ "type": "test", "event": "started", "name": "tests::baz" }
{ "type": "test", "event": "started", "name": "tests::foo" }
{ "type": "test", "name": "tests::foo", "event": "ok" }
{ "type": "test", "name": "tests::bar", "event": "ok" }
{ "type": "test", "name": "tests::baz", "event": "ok" }
{ "type": "suite", "event": "ok", "passed": 3, "failed": 0, "allowed_fail": 0, "ignored": 0, "measured": 0, "filtered_out": 0, "exec_time": "1.2s" }
   Doc-tests example
{ "type": "suite", "event": "started", "test_count": 3 }
{ "type": "test", "event": "started", "name": "src/lib.rs - bar (line 11)" }
{ "type": "test", "event": "started", "name": "src/lib.rs - baz (line 19)" }
{ "type": "test", "event": "started", "name": "src/lib.rs - foo (line 3)" }
{ "type": "test", "name": "src/lib.rs - foo (line 3)", "event": "ok" }
{ "type": "test", "name": "src/lib.rs - bar (line 11)", "event": "ok" }
{ "type": "test", "name": "src/lib.rs - baz (line 19)", "event": "ok" }
{ "type": "suite", "event": "ok", "passed": 3, "failed": 0, "allowed_fail": 0, "ignored": 0, "measured": 0, "filtered_out": 0, "exec_time": "1.3s" }
```

3 years agoAuto merge of #79529 - Dylan-DPC:rollup-6k20msr, r=Dylan-DPC
bors [Sun, 29 Nov 2020 02:45:48 +0000 (02:45 +0000)]
Auto merge of #79529 - Dylan-DPC:rollup-6k20msr, r=Dylan-DPC

Rollup of 11 pull requests

Successful merges:

 - #79327 (Require allocator to be static for boxed `Pin`-API)
 - #79340 (Rename "stability" CSS class to "item-info" and combine `document_stability` with `document_short`)
 - #79363 (BTreeMap: try to enhance various comments)
 - #79395 (Move ui if tests from top-level into `expr/if`)
 - #79443 (Improve rustdoc JS tests error output)
 - #79464 (Extend doc keyword feature by allowing any ident)
 - #79484 (add enable-full-tools to freebsd builds to prevent occasional link er…)
 - #79505 (Cleanup: shorter and faster code)
 - #79514 (Add test for issue #54121: order dependent trait bounds)
 - #79516 (Remove unnecessary `mut` binding)
 - #79528 (Fix a bootstrap comment)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup

3 years agoAdd test for macro by example syntax in decl macros with only one option
Rune Tynan [Sun, 29 Nov 2020 02:32:07 +0000 (21:32 -0500)]
Add test for macro by example syntax in decl macros with only one option

3 years agoRollup merge of #79528 - nooberfsh:fix_doc, r=Mark-Simulacrum
Dylan DPC [Sun, 29 Nov 2020 02:14:29 +0000 (03:14 +0100)]
Rollup merge of #79528 - nooberfsh:fix_doc, r=Mark-Simulacrum

Fix a bootstrap comment

3 years agoRollup merge of #79516 - jyn514:cleanup-trait-solver, r=Aaron1011
Dylan DPC [Sun, 29 Nov 2020 02:14:27 +0000 (03:14 +0100)]
Rollup merge of #79516 - jyn514:cleanup-trait-solver, r=Aaron1011

Remove unnecessary `mut` binding

Found while fiddling around with https://github.com/rust-lang/rust/issues/77459.

3 years agoRollup merge of #79514 - Julian-Wollersberger:order-dependent-bounds, r=Mark-Simulacrum
Dylan DPC [Sun, 29 Nov 2020 02:14:26 +0000 (03:14 +0100)]
Rollup merge of #79514 - Julian-Wollersberger:order-dependent-bounds, r=Mark-Simulacrum

Add test for issue #54121: order dependent trait bounds

This adds a test for #54121, which has already been fixed by #73905. Now that issue can be closed.

I tested the test [on the playground](https://play.rust-lang.org/?version=stable&mode=debug&edition=2018&gist=6cb061d3b81518f268649551eb67769f) where it indeed fails on stable 1.48, but compiles successfully on beta and nightly.

fixes #54121

3 years agoRollup merge of #79505 - matklad:cleanup, r=jonas-schievink
Dylan DPC [Sun, 29 Nov 2020 02:14:24 +0000 (03:14 +0100)]
Rollup merge of #79505 - matklad:cleanup, r=jonas-schievink

Cleanup: shorter and faster code

3 years agoRollup merge of #79484 - sreehax:master, r=Mark-Simulacrum
Dylan DPC [Sun, 29 Nov 2020 02:14:22 +0000 (03:14 +0100)]
Rollup merge of #79484 - sreehax:master, r=Mark-Simulacrum

add enable-full-tools to freebsd builds to prevent occasional link er…

On FreeBSD, there is sometimes an issue where linking a rust program will fail due to rust not finding a linker, even though lld is included in the base system. This seems to mostly affect bare metal/cross compilation things, such as wasm builds and arm/riscv bare metal work (eg. when trying to compile [this](https://github.com/quantumscraps/scraps)). On Linux and other operating systems, full tools are enabled for builds of rust, so there are no linking issues. This pr should enable fully functional builds on FreeBSD, assuming rust builds correctly with these options.

3 years agoRollup merge of #79464 - GuillaumeGomez:doc-keyword-ident, r=jyn514
Dylan DPC [Sun, 29 Nov 2020 02:14:21 +0000 (03:14 +0100)]
Rollup merge of #79464 - GuillaumeGomez:doc-keyword-ident, r=jyn514

Extend doc keyword feature by allowing any ident

Part of #51315.

As suggested by ``@danielhenrymantilla`` in [this comment](https://github.com/rust-lang/rust/issues/51315#issuecomment-733879934), this PR extends `#[doc(keyword = "...")]` to allow any ident to be used as keyword. The final goal is to allow (proc-)macro crates' owners to write documentation of the keywords they might introduce.

r? ``@jyn514``

3 years agoRollup merge of #79443 - GuillaumeGomez:improve-rustdoc-js-error-output, r=jyn514
Dylan DPC [Sun, 29 Nov 2020 02:14:19 +0000 (03:14 +0100)]
Rollup merge of #79443 - GuillaumeGomez:improve-rustdoc-js-error-output, r=jyn514

Improve rustdoc JS tests error output

It's pretty common when starting to add new tests for rustdoc-js to have issues to understand the errors. With this, it should make things a bit simpler. So now, in case of an error, it displays:

```
---- [js-doc-test] rustdoc-js/basic.rs stdout ----

error: rustdoc-js test failed!
failed to decode compiler output as json: line: {
output: Checking "basic" ... FAILED
==> Result not found in 'others': '{"path":"basic","name":"Fo"}'
Diff of first error:
{
    "path": "basic",
    - "name": "Fo",
    + "name": "Foo",
}
thread '[js-doc-test] rustdoc-js/basic.rs' panicked at 'explicit panic', src/tools/compiletest/src/json.rs:126:21
```

I think it was ``@camelid`` who asked about it a few days ago?

r? ``@jyn514``

3 years agoRollup merge of #79395 - Havvy:test-move-if, r=Mark-Simulacrum
Dylan DPC [Sun, 29 Nov 2020 02:14:17 +0000 (03:14 +0100)]
Rollup merge of #79395 - Havvy:test-move-if, r=Mark-Simulacrum

Move ui if tests from top-level into `expr/if`

This lowers the number of top-level files in src/test/ui from 1612 to 1604.

3 years agoRollup merge of #79363 - ssomers:btree_cleanup_comments, r=Mark-Simulacrum
Dylan DPC [Sun, 29 Nov 2020 02:14:15 +0000 (03:14 +0100)]
Rollup merge of #79363 - ssomers:btree_cleanup_comments, r=Mark-Simulacrum

BTreeMap: try to enhance various comments

All in internal documentation, propagating the "key-value pair" notation from public documentation.

r? ``@Mark-Simulacrum``

3 years agoRollup merge of #79340 - GuillaumeGomez:rename-stability, r=jyn514
Dylan DPC [Sun, 29 Nov 2020 02:14:13 +0000 (03:14 +0100)]
Rollup merge of #79340 - GuillaumeGomez:rename-stability, r=jyn514

Rename "stability" CSS class to "item-info" and combine `document_stability` with `document_short`

Follow-up of #79300

The point of this PR is to make the CSS class more accurate since it's not only about stability anymore.

r? ``@jyn514``

3 years agoMove `src/test/rustdoc-ui` intra-doc tests into a subdirectory
Joshua Nelson [Sun, 29 Nov 2020 02:10:37 +0000 (21:10 -0500)]
Move `src/test/rustdoc-ui` intra-doc tests into a subdirectory

This also changes the builder to allow using
`x.py test src/test/rustdoc-ui/intra-doc`; before, it would panic that
no paths were found.

3 years agoRollup merge of #79327 - TimDiekmann:static-alloc-pin-in-box, r=Mark-Simulacrum
Dylan DPC [Sun, 29 Nov 2020 02:14:07 +0000 (03:14 +0100)]
Rollup merge of #79327 - TimDiekmann:static-alloc-pin-in-box, r=Mark-Simulacrum

Require allocator to be static for boxed `Pin`-API

Allocators has to retain their validity until the instance and all of its clones are dropped. When pinning a value, it must live forever, thus, the allocator requires a `'static` lifetime for pinning a value. [Example from reddit](https://www.reddit.com/r/rust/comments/jymzdw/the_story_continues_vec_now_supports_custom/gd7qak2?utm_source=share&utm_medium=web2x&context=3):

```rust
let alloc = MyAlloc(/* ... */);
let pinned = Box::pin_in(42, alloc);
mem::forget(pinned); // Now `value` must live forever
// Otherwise `Pin`'s invariants are violated, storage invalidated
// before Drop was called.
// borrow of `memory` can end here, there is no value keeping it.
drop(alloc); // Oh, value doesn't live forever.
```

3 years agoMove `src/test/rustdoc` intra-doc link tests into a subdirectory
Joshua Nelson [Sun, 29 Nov 2020 01:25:41 +0000 (20:25 -0500)]
Move `src/test/rustdoc` intra-doc link tests into a subdirectory

They were starting to get unwieldy.

3 years agoFix a bootstrap comment
nooberfsh [Sun, 29 Nov 2020 02:02:24 +0000 (10:02 +0800)]
Fix a bootstrap comment

3 years agoAdd support for multi-argument decl macros
Rune Tynan [Sun, 29 Nov 2020 01:46:17 +0000 (20:46 -0500)]
Add support for multi-argument decl macros

3 years agolibtest: Make `sed` arguments compatible with apple
Jakob Schikowski [Sat, 28 Nov 2020 09:23:36 +0000 (10:23 +0100)]
libtest: Make `sed` arguments compatible with apple

3 years agolooser regex on local args
Ashley Mannix [Sun, 29 Nov 2020 00:18:07 +0000 (10:18 +1000)]
looser regex on local args

3 years agoAuto merge of #79511 - cjgillot:fitem-2, r=lcnr
bors [Sat, 28 Nov 2020 22:52:18 +0000 (22:52 +0000)]
Auto merge of #79511 - cjgillot:fitem-2, r=lcnr

Do not visit ForeignItemRef for HIR indexing and validation.

Similarly to what is done for ImplItemRef and TraitItemRef.

Fixes #79487

r? `@lcnr`

3 years agoDon't store `ty` and `span` in `IntRange`
Nadrieril [Sat, 28 Nov 2020 22:07:15 +0000 (22:07 +0000)]
Don't store `ty` and `span` in `IntRange`

We prefer to grab `ty` and `span` from `pcx`. This makes it consistent
with other constructors.

3 years agolint-docs: Add --validate flag to validate lint docs separately.
Eric Huss [Sat, 28 Nov 2020 21:29:51 +0000 (13:29 -0800)]
lint-docs: Add --validate flag to validate lint docs separately.

3 years agolint-docs: Move free functions into methods of LintExtractor.
Eric Huss [Sat, 28 Nov 2020 19:25:42 +0000 (11:25 -0800)]
lint-docs: Move free functions into methods of LintExtractor.

This helps avoid needing to pass so many parameters around.

3 years agoCorrectly detect `usize`/`isize` range overlaps
Nadrieril [Sat, 28 Nov 2020 21:23:38 +0000 (21:23 +0000)]
Correctly detect `usize`/`isize` range overlaps

3 years agoRemove unnecessary `mut` binding
Joshua Nelson [Sat, 28 Nov 2020 19:52:25 +0000 (14:52 -0500)]
Remove unnecessary `mut` binding

3 years agoAdd test for issue #54121:
Julian Wollersberger [Sat, 28 Nov 2020 18:44:31 +0000 (19:44 +0100)]
Add test for issue #54121:
"simple type inference fails depending on order of trait bounds"

3 years agoDo not visit ForeignItemRef for HIR indexing and validation.
Camille GILLOT [Sat, 28 Nov 2020 17:08:11 +0000 (18:08 +0100)]
Do not visit ForeignItemRef for HIR indexing and validation.

Similarly to what is done for ImplItemRef and TraitItemRef.

Fixes #79487

3 years agoAuto merge of #79507 - jonas-schievink:rollup-e5yeayh, r=jonas-schievink
bors [Sat, 28 Nov 2020 15:17:13 +0000 (15:17 +0000)]
Auto merge of #79507 - jonas-schievink:rollup-e5yeayh, r=jonas-schievink

Rollup of 10 pull requests

Successful merges:

 - #78086 (Improve doc for 'as _')
 - #78853 (rustc_parse: fix ConstBlock expr span)
 - #79234 (Resolve typedefs in HashMap gdb/lldb pretty-printers)
 - #79344 (Convert UNC path to local path to satisfy install script on Windows)
 - #79383 (Fix bold code formatting in keyword docs)
 - #79460 (Remove intermediate vectors from `add_bounds`)
 - #79474 (Change comments on types to doc-comments)
 - #79476 (Sync rustc_codegen_cranelift)
 - #79478 (Expand docs on Peekable::peek_mut)
 - #79486 (Slightly improve code samples in E0591)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup

3 years agoRollup merge of #79486 - camelid:E0591-code-cleanup, r=lcnr
Jonas Schievink [Sat, 28 Nov 2020 14:58:30 +0000 (15:58 +0100)]
Rollup merge of #79486 - camelid:E0591-code-cleanup, r=lcnr

Slightly improve code samples in E0591

* Improve formatting
* Don't hide `unsafe` block - it's important!

3 years agoRollup merge of #79478 - lukaslueg:peek_mut_docs, r=m-ou-se
Jonas Schievink [Sat, 28 Nov 2020 14:58:28 +0000 (15:58 +0100)]
Rollup merge of #79478 - lukaslueg:peek_mut_docs, r=m-ou-se

Expand docs on Peekable::peek_mut

Slightly expand docs on `std::iter::Peekable::peek_mut`, tracked in #78302

r? `@m-ou-se`

3 years agoRollup merge of #79476 - bjorn3:sync_cg_clif-2020-11-27, r=bjorn3
Jonas Schievink [Sat, 28 Nov 2020 14:58:26 +0000 (15:58 +0100)]
Rollup merge of #79476 - bjorn3:sync_cg_clif-2020-11-27, r=bjorn3

Sync rustc_codegen_cranelift

This implements a few extra simd intrinsics, fixes yet another 128bit bug and updates a few dependencies. It also fixes an cg_clif subtree update that did compile, but that caused a panic when compiling libcore. Other than that this is mostly cleanups.

`@rustbot` modify labels: +A-codegen +A-cranelift +T-compiler

3 years agoRollup merge of #79474 - jyn514:query-mode, r=Aaron1011
Jonas Schievink [Sat, 28 Nov 2020 14:58:25 +0000 (15:58 +0100)]
Rollup merge of #79474 - jyn514:query-mode, r=Aaron1011

Change comments on types to doc-comments

Found while investigating https://github.com/rust-lang/rust/issues/79459.

r? `@Aaron1011`

3 years agoRollup merge of #79460 - bugadani:simplify, r=jonas-schievink
Jonas Schievink [Sat, 28 Nov 2020 14:58:23 +0000 (15:58 +0100)]
Rollup merge of #79460 - bugadani:simplify, r=jonas-schievink

Remove intermediate vectors from `add_bounds`

This PR removes two short lived vectors that don't serve any obvious purpose.

3 years agoRollup merge of #79383 - abdnh:patch-1, r=shepmaster
Jonas Schievink [Sat, 28 Nov 2020 14:58:21 +0000 (15:58 +0100)]
Rollup merge of #79383 - abdnh:patch-1, r=shepmaster

Fix bold code formatting in keyword docs

3 years agoRollup merge of #79344 - JRF63:fix_install_script_win, r=Mark-Simulacrum
Jonas Schievink [Sat, 28 Nov 2020 14:58:19 +0000 (15:58 +0100)]
Rollup merge of #79344 - JRF63:fix_install_script_win, r=Mark-Simulacrum

Convert UNC path to local path to satisfy install script on Windows

`mkdir` with the `-p` flag attempts to create `//?` if passed a UNC path. This fails on both MSYS2 and Git Bash.

The UNC paths come from [canonicalizing](https://github.com/rust-lang/rust/blob/32da90b431919eedb3e281a91caea063ba4edb77/src/bootstrap/install.rs#L79) the install prefix path. `mkdir -p` gets invoked on the [install script](https://github.com/rust-lang/rust-installer/blob/d66f476b4d5e7fdf1ec215c9ac16c923dc292324/install-template.sh#L149).

3 years agoRollup merge of #79234 - ortem:fix-hashmap-pretty-printers, r=Mark-Simulacrum
Jonas Schievink [Sat, 28 Nov 2020 14:58:17 +0000 (15:58 +0100)]
Rollup merge of #79234 - ortem:fix-hashmap-pretty-printers, r=Mark-Simulacrum

Resolve typedefs in HashMap gdb/lldb pretty-printers

`GetTypedefedType` (LLDB) and `strip_typedefs` (GDB) calls are needed to resolve key and value types completely.
Without these calls, debugger doesn't show the actual type.

**Before** (without `GetTypedefedType`):
```
(lldb) frame variable hm[0]
(T) hm[0] = { ... }
```

**After** (with `GetTypedefedType`):
```
(lldb) frame variable hm[0]
((i32, alloc::string::String)) hm[0] = { ... }
```

Based on https://github.com/intellij-rust/intellij-rust/pull/6258

3 years agoRollup merge of #78853 - calebcartwright:fix-const-block-expr-span, r=spastorino
Jonas Schievink [Sat, 28 Nov 2020 14:58:15 +0000 (15:58 +0100)]
Rollup merge of #78853 - calebcartwright:fix-const-block-expr-span, r=spastorino

rustc_parse: fix ConstBlock expr span

The span for a ConstBlock expression should presumably run through the end of the block it contains and not stop at the keyword, just like is done with similar block-containing expression kinds, such as a TryBlock

3 years agoRollup merge of #78086 - poliorcetics:as-placeholder, r=Mark-Simulacrum
Jonas Schievink [Sat, 28 Nov 2020 14:58:13 +0000 (15:58 +0100)]
Rollup merge of #78086 - poliorcetics:as-placeholder, r=Mark-Simulacrum

Improve doc for 'as _'

Fix #78042.

`@rustbot` modify labels: A-coercions T-doc

3 years agoCleanup: shorter and faster code
Aleksey Kladov [Sat, 28 Nov 2020 14:47:34 +0000 (17:47 +0300)]
Cleanup: shorter and faster code

3 years agoRequire allocator to be static for boxed `Pin`-API
Tim Diekmann [Sat, 28 Nov 2020 14:24:30 +0000 (15:24 +0100)]
Require allocator to be static for boxed `Pin`-API

3 years agoBTreeMap: try to enhance various comments & local identifiers
Stein Somers [Thu, 5 Nov 2020 12:23:11 +0000 (13:23 +0100)]
BTreeMap: try to enhance various comments & local identifiers

3 years agoAuto merge of #78296 - Aaron1011:fix/stmt-tokens, r=petrochenkov
bors [Sat, 28 Nov 2020 07:48:56 +0000 (07:48 +0000)]
Auto merge of #78296 - Aaron1011:fix/stmt-tokens, r=petrochenkov

Properly handle attributes on statements

We now collect tokens for the underlying node wrapped by `StmtKind`
nstead of storing tokens directly in `Stmt`.

`LazyTokenStream` now supports capturing a trailing semicolon after it
is initially constructed. This allows us to avoid refactoring statement
parsing to wrap the parsing of the semicolon in `parse_tokens`.

Attributes on item statements
(e.g. `fn foo() { #[bar] struct MyStruct; }`) are now treated as
item attributes, not statement attributes, which is consistent with how
we handle attributes on other kinds of statements. The feature-gating
code is adjusted so that proc-macro attributes are still allowed on item
statements on stable.

Two built-in macros (`#[global_allocator]` and `#[test]`) needed to be
adjusted to support being passed `Annotatable::Stmt`.