]> git.lizzy.rs Git - rust.git/log
rust.git
3 years agoMake char methods const
YenForYang [Mon, 30 Nov 2020 02:16:31 +0000 (20:16 -0600)]
Make char methods const

`escape_unicode`, `escape_default`, `len_utf8`, `len_utf16`, to_ascii_lowercase`, `eq_ignore_ascii_case`

`u8` methods `to_ascii_lowercase`, `to_ascii_uppercase` also must be made const

u8 methods made const

Update methods.rs

Update mod.rs

Update methods.rs

Fix `since` in rustc_const_stable to next stable

Fix `since` in rustc_const_stable to next stable

Update methods.rs

Update mod.rs

3 years agoAuto merge of #82102 - nagisa:nagisa/fix-dwo-name, r=davidtwco
bors [Tue, 23 Feb 2021 10:02:16 +0000 (10:02 +0000)]
Auto merge of #82102 - nagisa:nagisa/fix-dwo-name, r=davidtwco

Set path of the compile unit to the source directory

As part of the effort to implement split dwarf debug info, we ended up
setting the compile unit location to the output directory rather than
the source directory. Furthermore, it seems like we failed to remap the
prefixes for this as well!

The desired behaviour is to instead set the `DW_AT_GNU_dwo_name` to a
path relative to compiler's working directory. This still allows
debuggers to find the split dwarf files, while not changing the
behaviour of the code that is compiling with regular debug info, and not
changing the compiler's behaviour with regards to reproducibility.

Fixes #82074

cc `@alexcrichton` `@davidtwco`

3 years agoAuto merge of #82076 - jyn514:update-bootstrap, r=Mark-Simulacrum
bors [Tue, 23 Feb 2021 07:19:41 +0000 (07:19 +0000)]
Auto merge of #82076 - jyn514:update-bootstrap, r=Mark-Simulacrum

Update the bootstrap compiler

This updates the bootstrap compiler, notably leaving out a change to enable semicolon in macro expressions lint, because stdarch still depends on the old behavior.

3 years agoAuto merge of #82430 - Dylan-DPC:rollup-nu4kfyc, r=Dylan-DPC
bors [Tue, 23 Feb 2021 04:31:32 +0000 (04:31 +0000)]
Auto merge of #82430 - Dylan-DPC:rollup-nu4kfyc, r=Dylan-DPC

Rollup of 12 pull requests

Successful merges:

 - #79423 (Enable smart punctuation)
 - #81154 (Improve design of `assert_len`)
 - #81235 (Improve suggestion for tuple struct pattern matching errors.)
 - #81769 (Suggest `return`ing tail expressions that match return type)
 - #81837 (Slight perf improvement on char::to_ascii_lowercase)
 - #81969 (Avoid `cfg_if` in `std::os`)
 - #81984 (Make WASI's `hard_link` behavior match other platforms.)
 - #82091 (use PlaceRef abstractions more consistently)
 - #82128 (add diagnostic items for OsString/PathBuf/Owned as well as to_vec on slice)
 - #82166 (add s390x-unknown-linux-musl target)
 - #82234 (Remove query parameters when skipping search results)
 - #82255 (Make `treat_err_as_bug` Option<NonZeroUsize>)

Failed merges:

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

3 years agoRollup merge of #82255 - nhwn:nonzero-err-as-bug, r=davidtwco
Dylan DPC [Tue, 23 Feb 2021 01:51:55 +0000 (02:51 +0100)]
Rollup merge of #82255 - nhwn:nonzero-err-as-bug, r=davidtwco

Make `treat_err_as_bug` Option<NonZeroUsize>

`rustc -Z treat-err-as-bug=N` already requires `N` to be nonzero when the argument is parsed, so changing the type from `Option<usize>` to `Option<NonZeroUsize>` is a low-hanging fruit in terms of layout optimization.

3 years agoRollup merge of #82234 - GuillaumeGomez:remove-query-param-on-esc, r=Nemo157
Dylan DPC [Tue, 23 Feb 2021 01:51:54 +0000 (02:51 +0100)]
Rollup merge of #82234 - GuillaumeGomez:remove-query-param-on-esc, r=Nemo157

Remove query parameters when skipping search results

Fixes #81330.

This PR changes the following: when pressing ESC and that no other "action" was performed (understand: no closing the search result, or hiding a menu or something along the line), then we discard the URL query parameters (the `?whatever=dsjfs`). What do you think about this change ```@rust-lang/rustdoc``` ?

EDIT: finally we're simply removing the query parameter when we're skipping the search results.

r? ```@Nemo157```

3 years agoRollup merge of #82166 - kaniini:s390x-musl-target, r=nagisa
Dylan DPC [Tue, 23 Feb 2021 01:51:53 +0000 (02:51 +0100)]
Rollup merge of #82166 - kaniini:s390x-musl-target, r=nagisa

add s390x-unknown-linux-musl target

This is the first step in bringup for Rust on s390x.

The libc and std crates need modifications as well, but getting this upstream makes that work easier.

3 years agoRollup merge of #82128 - anall:feature/add_diagnostic_items, r=davidtwco
Dylan DPC [Tue, 23 Feb 2021 01:51:51 +0000 (02:51 +0100)]
Rollup merge of #82128 - anall:feature/add_diagnostic_items, r=davidtwco

add diagnostic items for OsString/PathBuf/Owned as well as to_vec on slice

This is adding diagnostic items to be used by rust-lang/rust-clippy#6730, but my understanding is the clippy-side change does need to be done over there since I am adding a new clippy feature.

Add diagnostic items to the following types:
  OsString (os_string_type)
  PathBuf (path_buf_type)
  Owned (to_owned_trait)

As well as the to_vec method on slice/[T]

3 years agoRollup merge of #82091 - henryboisdequin:use-place-ref-more, r=RalfJung
Dylan DPC [Tue, 23 Feb 2021 01:51:50 +0000 (02:51 +0100)]
Rollup merge of #82091 - henryboisdequin:use-place-ref-more, r=RalfJung

use PlaceRef abstractions more consistently

Addresses this [comment](https://github.com/rust-lang/rust/pull/80865/files#r558978715)
Associated issue: #80647

r? ```@RalfJung```

3 years agoRollup merge of #81984 - sunfishcode:wasi-link, r=alexcrichton
Dylan DPC [Tue, 23 Feb 2021 01:51:49 +0000 (02:51 +0100)]
Rollup merge of #81984 - sunfishcode:wasi-link, r=alexcrichton

Make WASI's `hard_link` behavior match other platforms.

Following #78026, `std::fs::hard_link` on most platforms does not follow
symlinks. Change the WASI implementation to also not follow symlinks.

r? ```@alexcrichton```

3 years agoRollup merge of #81969 - jonas-schievink:no-cfg-if, r=Mark-Simulacrum
Dylan DPC [Tue, 23 Feb 2021 01:51:48 +0000 (02:51 +0100)]
Rollup merge of #81969 - jonas-schievink:no-cfg-if, r=Mark-Simulacrum

Avoid `cfg_if` in `std::os`

rust-analyzer cannot currently load the `cfg_if` crate, which means that rust-analyzer is unable to see `std::os::{unix, windows, linux}` here. This works around that by avoiding `cfg_if`; the `#[cfg]` expressions are simple enough to reasonably write by hand.

Fixes https://github.com/rust-analyzer/rust-analyzer/issues/6038

3 years agoRollup merge of #81837 - gilescope:to_ascii_speedups, r=dtolnay
Dylan DPC [Tue, 23 Feb 2021 01:51:47 +0000 (02:51 +0100)]
Rollup merge of #81837 - gilescope:to_ascii_speedups, r=dtolnay

Slight perf improvement on char::to_ascii_lowercase

`char::to_ascii_lowercase()` was checking if it was ascii and then if it was in the right range. Instead propose to check once (I think removing a compare and a shift in the process: [godbolt](https://godbolt.org/z/e5Tora) ).

before:
```
        test char::methods::bench_to_ascii_lowercase                    ... bench:      11,196 ns/iter (+/- 632)
        test char::methods::bench_to_ascii_uppercase                    ... bench:      11,656 ns/iter (+/- 671)
```
after:
```
         test char::methods::bench_to_ascii_lowercase                    ... bench:       9,612 ns/iter (+/- 979)
         test char::methods::bench_to_ascii_uppercase                    ... bench:       8,241 ns/iter (+/- 701)
```

(calling u8::to_ascii_lowercase and letting that flip the 5th bit is also an option, but it's more instructions. I'm thinking for things around ascii and char we want to be as efficient as possible.)

3 years agoRollup merge of #81769 - estebank:tail-expr-as-potential-return, r=lcnr
Dylan DPC [Tue, 23 Feb 2021 01:51:46 +0000 (02:51 +0100)]
Rollup merge of #81769 - estebank:tail-expr-as-potential-return, r=lcnr

Suggest `return`ing tail expressions that match return type

Some newcomers are confused by the behavior of tail expressions,
interpreting that "leaving out the `;` makes it the return value".
To help them go in the right direction, suggest using `return` instead
when applicable.

3 years agoRollup merge of #81235 - reese:rw-tuple-diagnostics, r=estebank
Dylan DPC [Tue, 23 Feb 2021 01:51:44 +0000 (02:51 +0100)]
Rollup merge of #81235 - reese:rw-tuple-diagnostics, r=estebank

Improve suggestion for tuple struct pattern matching errors.

Closes #80174

This change allows numbers to be parsed as field names when pattern matching on structs, which allows us to provide better error messages when tuple structs are matched using a struct pattern.

r? ``@estebank``

3 years agoRollup merge of #81154 - dylni:improve-design-of-assert-len, r=KodrAus
Dylan DPC [Tue, 23 Feb 2021 01:51:43 +0000 (02:51 +0100)]
Rollup merge of #81154 - dylni:improve-design-of-assert-len, r=KodrAus

Improve design of `assert_len`

It was discussed in the [tracking issue](https://github.com/rust-lang/rust/issues/76393#issuecomment-761765448) that `assert_len`'s name and usage are confusing. This PR improves them based on a suggestion by ``@scottmcm`` in that issue.

I also improved the documentation to make it clearer when you might want to use this method.

Old example:

```rust
let range = range.assert_len(slice.len());
```

New example:

```rust
let range = range.ensure_subset_of(..slice.len());
```

Fixes #81157

3 years agoRollup merge of #79423 - camelid:smart-punct, r=jyn514
Dylan DPC [Tue, 23 Feb 2021 01:51:42 +0000 (02:51 +0100)]
Rollup merge of #79423 - camelid:smart-punct, r=jyn514

Enable smart punctuation

Closes #76690.

3 years agoAuto merge of #81937 - ssomers:btree_drainy_refactor_9b, r=Mark-Simulacrum
bors [Tue, 23 Feb 2021 00:30:37 +0000 (00:30 +0000)]
Auto merge of #81937 - ssomers:btree_drainy_refactor_9b, r=Mark-Simulacrum

BTree: move more shared iterator code into navigate.rs

The functions in navigate.rs only exist to support iterators, and these look easier on my eyes if there is a shared `struct` with the recurring pair of handles.

r? `@Mark-Simulacrum`

3 years agoAuto merge of #81978 - tmiasko:head-ctor, r=Mark-Simulacrum
bors [Mon, 22 Feb 2021 21:45:50 +0000 (21:45 +0000)]
Auto merge of #81978 - tmiasko:head-ctor, r=Mark-Simulacrum

Inline hot part of PatStack::head_ctor

When building rustc with `-Codegen-units=1` this inline hint ensures
that obtaining already initialized head constructor does not involve
a function call overhead and reduces the instruction count in
match-stress-enum-check full benchmark from 11.9G to 9.8G.

It shouldn't have significant impact on the currently default
configuration where it reflects existing inlining decisions.

3 years agoAvoid `cfg_if` in `std::os`
Jonas Schievink [Wed, 10 Feb 2021 18:35:35 +0000 (19:35 +0100)]
Avoid `cfg_if` in `std::os`

3 years agoAuto merge of #81362 - ssomers:btree_drainy_refactor_8, r=Mark-Simulacrum
bors [Mon, 22 Feb 2021 17:56:43 +0000 (17:56 +0000)]
Auto merge of #81362 - ssomers:btree_drainy_refactor_8, r=Mark-Simulacrum

BTreeMap: gather and decompose reusable tree fixing functions

This is kind of pushing it as a standalone refactor, probably only useful for #81075 (or similar).
r? `@Mark-Simulacrum`

3 years agoAuto merge of #77551 - simonvandel:extend-simplify-branch-same, r=oli-obk
bors [Mon, 22 Feb 2021 12:14:23 +0000 (12:14 +0000)]
Auto merge of #77551 - simonvandel:extend-simplify-branch-same, r=oli-obk

MIR-OPT: Pass to deduplicate blocks

This pass finds basic blocks that are completely equal,
and replaces all uses with just one of them.

```bash
$ RUSTC_LOG=rustc_mir::transform::deduplicate_blocks ./x.py build --stage 2 | grep "SUCCESS: Replacing: " > log
...
$ cat log | wc -l
23875
```

3 years agoAuto merge of #82393 - JohnTitor:rollup-5c8jryl, r=JohnTitor
bors [Mon, 22 Feb 2021 09:33:31 +0000 (09:33 +0000)]
Auto merge of #82393 - JohnTitor:rollup-5c8jryl, r=JohnTitor

Rollup of 9 pull requests

Successful merges:

 - #82098 (Add internal `collect_into_array[_unchecked]` to remove duplicate code)
 - #82228 (Provide NonZero_c_* integers)
 - #82287 (Make "missing field" error message more natural)
 - #82351 (Use the first paragraph, instead of cookie-cutter text, for rustdoc descriptions)
 - #82353 (rustdoc: Remove unnecessary `Cell` around `param_env`)
 - #82367 (remove redundant option/result wrapping of return values)
 - #82372 (improve UnsafeCell docs)
 - #82379 (Fix sizes of repr(C) enums on hexagon)
 - #82382 (rustdoc: Remove `fake_def_ids` RefCell)

Failed merges:

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

3 years agoRollup merge of #82382 - camelid:remove-fake_def_ids-refcell, r=jyn514
Yuki Okushi [Mon, 22 Feb 2021 09:26:14 +0000 (18:26 +0900)]
Rollup merge of #82382 - camelid:remove-fake_def_ids-refcell, r=jyn514

rustdoc: Remove `fake_def_ids` RefCell

3 years agoRollup merge of #82379 - nagisa:nagisa/hexagon-enums, r=estebank
Yuki Okushi [Mon, 22 Feb 2021 09:26:13 +0000 (18:26 +0900)]
Rollup merge of #82379 - nagisa:nagisa/hexagon-enums, r=estebank

Fix sizes of repr(C) enums on hexagon

Enums on hexagon use a smallest size (but at least 1 byte) that fits all
the enumeration values. This is unlike many other ABIs where enums are
at least 32 bits.

Fixes #82100

3 years agoRollup merge of #82372 - RalfJung:unsafe-cell, r=KodrAus
Yuki Okushi [Mon, 22 Feb 2021 09:26:11 +0000 (18:26 +0900)]
Rollup merge of #82372 - RalfJung:unsafe-cell, r=KodrAus

improve UnsafeCell docs

Sometimes [questions like this come up](https://rust-lang.zulipchat.com/#narrow/stream/136281-t-lang.2Fwg-unsafe-code-guidelines/topic/UnsafeCells.20as.20raw.20pointers) because the UnsafeCell docs say "it's the only legal way to obtain aliasable data that is considered mutable". That is not entirely correct, since raw pointers also provide that option. So I propose we focus the docs on the interaction of `UnsafeCell` and *shared references* specifically, which is really where they are needed.

3 years agoRollup merge of #82367 - matthiaskrgr:wraps, r=petrochenkov
Yuki Okushi [Mon, 22 Feb 2021 09:26:10 +0000 (18:26 +0900)]
Rollup merge of #82367 - matthiaskrgr:wraps, r=petrochenkov

remove redundant option/result wrapping of return values

If a function always returns `Ok(something)`, we can return `something` directly and remove the corresponding error handling in the callers.
clippy::unnecessary_wraps

3 years agoRollup merge of #82353 - camelid:no-more-param_env-cell, r=jyn514
Yuki Okushi [Mon, 22 Feb 2021 09:26:09 +0000 (18:26 +0900)]
Rollup merge of #82353 - camelid:no-more-param_env-cell, r=jyn514

rustdoc: Remove unnecessary `Cell` around `param_env`

r? `@jyn514`

3 years agoRollup merge of #82351 - notriddle:docs-meta-description, r=jyn514
Yuki Okushi [Mon, 22 Feb 2021 09:26:08 +0000 (18:26 +0900)]
Rollup merge of #82351 - notriddle:docs-meta-description, r=jyn514

Use the first paragraph, instead of cookie-cutter text, for rustdoc descriptions

Partially addresses #82283.

3 years agoRollup merge of #82287 - r00ster91:field_name_and, r=petrochenkov
Yuki Okushi [Mon, 22 Feb 2021 09:26:07 +0000 (18:26 +0900)]
Rollup merge of #82287 - r00ster91:field_name_and, r=petrochenkov

Make "missing field" error message more natural

```rust
struct A {
    x: i32,
    y: i32,
    z: i32,
}

fn main() {
    A { };
}
```
```
error[E0063]: missing fields `x`, `y`, `z` in initializer of `A`
 --> src/main.rs:8:5
  |
8 |     A { };
  |     ^ missing `x`, `y`, `z`
```
This error is now:
```
error[E0063]: missing fields `x`, `y` and `z` in initializer of `A`
 --> src/main.rs:8:5
  |
8 |     A { };
  |     ^ missing `x`, `y` and `z`
```
I thought it looked nicer and more natural this way. Also, if there is >3 fields missing, there is an "and" as well ("missing \`x\`, \`y\`, \`z\` *and* 1 other field"), but for <=3 there is not. As such it improves consistency too.

As for the implementation, originally I ended up with a chunky `push_str` algorithm but then I figured I could just do the formatting manually since it's just 3 field names at maximum. It is comparatively readable.

As a sidenote, one thing I was wondering about is, isn't there more cases where you have a list of things like field names? Maybe this whole thing can at some point later be made into a more general function to be used in multiple areas.

3 years agoRollup merge of #82228 - ijackson:nonzero-cint, r=KodrAus
Yuki Okushi [Mon, 22 Feb 2021 09:26:06 +0000 (18:26 +0900)]
Rollup merge of #82228 - ijackson:nonzero-cint, r=KodrAus

Provide NonZero_c_* integers

I'm pretty sure I am going want this for #73125 and it seems like an
omission that would be in any case good to remedy.

<strike>Because the raw C types are in `std`, not `core`, to achieve this we
must export the relevant macros from `core` so that `std` can use
them.  That's done with a new `num_internals` perma-unstable feature.

The macros need to take more parameters for the module to get the
types from and feature attributes to use.

I have eyeballed the docs output for core, to check that my changes to
these macros have made no difference to the core docs output.</strike>

3 years agoRollup merge of #82098 - LukasKalbertodt:add-collect-into-array, r=dtolnay
Yuki Okushi [Mon, 22 Feb 2021 09:26:04 +0000 (18:26 +0900)]
Rollup merge of #82098 - LukasKalbertodt:add-collect-into-array, r=dtolnay

Add internal `collect_into_array[_unchecked]` to remove duplicate code

Unlike the similar PRs  #69985, #75644 and #79659, this PR only adds private functions and does not propose any new public API. The change is just for the purpose of avoiding duplicate code.

Many array methods already contained the same kind of code and there are still many array related methods to come (e.g. `Iterator::{chunks, map_windows, next_n, ...}`, `[T; N]::{cloned, copied, ...}`, ...) which all basically need this functionality. Writing custom `unsafe` code for each of those doesn't seem like a good idea. I added two functions in this PR (and not just the `unsafe` version) because I already know that I need the `Option`-returning version for `Iterator::map_windows`.

This is closely related to https://github.com/rust-lang/rust/issues/81615. I think that all options listed in that issue can be implemented using the function added in this PR. The only instance where `collect_array_into` might not be general enough is when the caller want to handle incomplete arrays manually. Currently, if `iter` yields fewer than `N` items, `None` is returned and the already yielded items are dropped. But as this is just a private function, it can be made more general in future PRs.

And while this was not the goal, this seems to lead to better assembly for `array::map`: https://rust.godbolt.org/z/75qKTa (CC ``@JulianKnodt)``

Let me know what you think :)

CC ``@matklad`` ``@bstrie``

3 years agofix rebase
Esteban Küber [Mon, 22 Feb 2021 00:54:42 +0000 (16:54 -0800)]
fix rebase

3 years agoAuto merge of #79979 - GuillaumeGomez:rustdoc-gui-tests, r=Mark-Simulacrum
bors [Mon, 22 Feb 2021 06:47:59 +0000 (06:47 +0000)]
Auto merge of #79979 - GuillaumeGomez:rustdoc-gui-tests, r=Mark-Simulacrum

Rustdoc gui tests

This is a reopening of #70533.

For this first version, there will be no screenshot comparison. Also, a big change compared to the previous version: the tests are now hosted in the rust repository directly. Since there is no image, it's pretty lightweight to say the least.

So now, only remains the nodejs script to run the tests and the tests themselves. Just one thing is missing: where should I put the documentation for these tests? I'm not sure where would be the best place for that. The doc will contain important information like the documentation of the framework used and how to install it (`npm install browser-ui-test`, but still needs to be put somewhere so no one is lost).

We'd also need to install the package when running the CI too. For now, it runs as long as we have nodejs installed, but I think we don't it to run in all nodejs targets?

cc `@jyn514`

r? `@Mark-Simulacrum`

3 years agoAuto merge of #81732 - m-ou-se:inherit-overflow-checks, r=Mark-Simulacrum
bors [Mon, 22 Feb 2021 04:07:05 +0000 (04:07 +0000)]
Auto merge of #81732 - m-ou-se:inherit-overflow-checks, r=Mark-Simulacrum

Use `#[rustc_inherit_overflow_checks]` instead of Add::add etc.

See https://github.com/rust-lang/rust/issues/81721

3 years agorustdoc: Remove `fake_def_ids` RefCell
Camelid [Mon, 22 Feb 2021 01:52:23 +0000 (17:52 -0800)]
rustdoc: Remove `fake_def_ids` RefCell

3 years agotidy
Esteban Küber [Fri, 5 Feb 2021 19:34:55 +0000 (11:34 -0800)]
tidy

3 years agoDo not suggest `;` if expression is side effect free
Esteban Küber [Fri, 5 Feb 2021 01:36:06 +0000 (17:36 -0800)]
Do not suggest `;` if expression is side effect free

When a tail expression isn't unit, we previously always suggested adding
a trailing `;` to turn it into a statement. This suggestion isn't
appropriate for any expression that doesn't have side-effects, as the
user will have likely wanted to call something else or do something with
the resulting value, instead of just discarding it.

3 years agoreword `;` suggestions to have consistent wording
Esteban Küber [Thu, 4 Feb 2021 21:59:23 +0000 (13:59 -0800)]
reword `;` suggestions to have consistent wording

3 years agoSuggest `return`ing tail expressions that match return type
Esteban Küber [Thu, 4 Feb 2021 20:22:01 +0000 (12:22 -0800)]
Suggest `return`ing tail expressions that match return type

Some newcomers are confused by the behavior of tail expressions,
interpreting that "leaving out the `;` makes it the return value".
To help them go in the right direction, suggest using `return` instead
when applicable.

3 years agoAuto merge of #82295 - jyn514:feature-gate, r=Manishearth
bors [Mon, 22 Feb 2021 00:04:09 +0000 (00:04 +0000)]
Auto merge of #82295 - jyn514:feature-gate, r=Manishearth

[intra-doc links] Don't check feature gates of items re-exported across crates

It should be never break another crate to re-export a public item.

Note that this doesn't check the feature gate at
*all* for other crates:

- Feature-gates aren't currently serialized, so the only way to check
  the gate is with ad-hoc attribute checking.
- Checking the feature gate twice (once when documenting the original
  crate and one when documenting the current crate) seems not great.

This should still catch using the feature most of the time though, since
people tend to document their own crates.

Closes https://github.com/rust-lang/rust/issues/82284.

r? `@Manishearth`

3 years agoFix sizes of repr(C) enums on hexagon
Simonas Kazlauskas [Sun, 21 Feb 2021 22:22:15 +0000 (00:22 +0200)]
Fix sizes of repr(C) enums on hexagon

Enums on hexagon use a smallest size (but at least 1 byte) that fits all
the enumeration values. This is unlike many other ABIs where enums are
at least 32 bits.

3 years agoNew pass to deduplicate blocks
Simon Vandel Sillesen [Sun, 4 Oct 2020 13:52:14 +0000 (15:52 +0200)]
New pass to deduplicate blocks

3 years agoMake MatchBranchSimplification clean up after itself
Simon Vandel Sillesen [Sun, 4 Oct 2020 16:12:20 +0000 (18:12 +0200)]
Make MatchBranchSimplification clean up after itself

3 years agoDrive-by formatting of comment
Simon Vandel Sillesen [Sun, 4 Oct 2020 08:26:29 +0000 (10:26 +0200)]
Drive-by formatting of comment

3 years agoremove redundant wrapping of return types of allow_internal_unstable() and rustc_allo...
Matthias Krüger [Sun, 21 Feb 2021 17:11:27 +0000 (18:11 +0100)]
remove redundant wrapping of return types of allow_internal_unstable() and rustc_allow_const_fn_unstable()

3 years agoUpdate src/test/rustdoc/description.rs
Michael Howell [Sun, 21 Feb 2021 16:31:39 +0000 (09:31 -0700)]
Update src/test/rustdoc/description.rs

Co-authored-by: Joshua Nelson <joshua@yottadb.com>
3 years agoUpdate src/test/rustdoc/description.rs
Michael Howell [Sun, 21 Feb 2021 16:31:23 +0000 (09:31 -0700)]
Update src/test/rustdoc/description.rs

Co-authored-by: Joshua Nelson <joshua@yottadb.com>
3 years agoimprove UnsafeCell docs
Ralf Jung [Sun, 21 Feb 2021 16:24:19 +0000 (17:24 +0100)]
improve UnsafeCell docs

3 years agoUpdate CI scripts
Guillaume Gomez [Sun, 21 Feb 2021 13:27:22 +0000 (14:27 +0100)]
Update CI scripts

3 years agoAdd rustdoc gui tests
Guillaume Gomez [Sun, 21 Feb 2021 13:25:12 +0000 (14:25 +0100)]
Add rustdoc gui tests

3 years agoIgnore nodejs/npm files
Guillaume Gomez [Sun, 21 Feb 2021 13:21:38 +0000 (14:21 +0100)]
Ignore nodejs/npm files

3 years agoAdd new rustdoc-gui test suite
Guillaume Gomez [Sun, 21 Feb 2021 13:21:04 +0000 (14:21 +0100)]
Add new rustdoc-gui test suite

3 years agorustc_mir: remove redundant wrapping of return type in numeric_intrinsic()
Matthias Krüger [Sun, 21 Feb 2021 12:44:16 +0000 (13:44 +0100)]
rustc_mir: remove redundant wrapping of return type in numeric_intrinsic()

3 years agorustc_codegen_ssa: remove unneeded wrapping of return type of execute_copy_from_cache...
Matthias Krüger [Sun, 21 Feb 2021 12:40:39 +0000 (13:40 +0100)]
rustc_codegen_ssa: remove unneeded wrapping of return type of execute_copy_from_cache_work_item (always returns Ok(..))

3 years agoremove redundant return value Ok(()) of clear_relocations()
Matthias Krüger [Sun, 21 Feb 2021 12:25:28 +0000 (13:25 +0100)]
remove redundant return value Ok(()) of clear_relocations()

3 years agoparser: remove unneccessary wrapping of return value in parse_extern()
Matthias Krüger [Sun, 21 Feb 2021 12:06:00 +0000 (13:06 +0100)]
parser: remove unneccessary wrapping of return value in parse_extern()

3 years agoAuto merge of #82359 - JohnTitor:rollup-6puemik, r=JohnTitor
bors [Sun, 21 Feb 2021 12:23:45 +0000 (12:23 +0000)]
Auto merge of #82359 - JohnTitor:rollup-6puemik, r=JohnTitor

Rollup of 11 pull requests

Successful merges:

 - #81300 (BTree: share panicky test code & test panic during clear, clone)
 - #81706 (Document BinaryHeap unsafe functions)
 - #81833 (parallelize x.py test tidy)
 - #81966 (Add new `rustc` target for Arm64 machines that can target the iphonesimulator)
 - #82154 (Update RELEASES.md 1.50 to include methods stabilized in #79342)
 - #82177 (Do not delete bootstrap.exe on Windows during clean)
 - #82181 (Add check for ES5 in CI)
 - #82229 (Add [A-diagnostics] bug report template)
 - #82233 (try-back-block-type test: Use TryFromSliceError for From test)
 - #82302 (Remove unsafe impl Send for CompletedTest & TestResult)
 - #82349 (test: Print test name only once on timeout)

Failed merges:

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

3 years agoremove unneccessary wrapping of return value in mk_await_expr()
Matthias Krüger [Sun, 21 Feb 2021 12:01:01 +0000 (13:01 +0100)]
remove unneccessary wrapping of return value in mk_await_expr()

3 years agorustc_parse: remove unneccessary wrapping of return value in fn mk_range() which...
Matthias Krüger [Sun, 21 Feb 2021 11:54:49 +0000 (12:54 +0100)]
rustc_parse: remove unneccessary wrapping of return value in fn mk_range() which would always return Ok(..)

3 years agoremove unneccessary wrapping of return value of allow_unstable(), it would always...
Matthias Krüger [Sun, 21 Feb 2021 11:52:51 +0000 (12:52 +0100)]
remove unneccessary wrapping of return value of allow_unstable(), it would always return Some(thing)

3 years agoupdate tracking issue for raw_os_nonzero
Ashley Mannix [Sun, 21 Feb 2021 09:43:42 +0000 (19:43 +1000)]
update tracking issue for raw_os_nonzero

3 years agoAuto merge of #82340 - kennytm:fix-82254, r=Mark-Simulacrum
bors [Sun, 21 Feb 2021 09:42:50 +0000 (09:42 +0000)]
Auto merge of #82340 - kennytm:fix-82254, r=Mark-Simulacrum

Fix some Python2→3 error in publish_toolstate.py

Fix #82254.

The error is primarily due to `data = json.dumps(…)` producing a `str` instead of a `bytes`, which are different types on Python 3. But then `urllib.request.urlopen(…, data)` cannot accept `data` as a `str`, thus the error.

This PR added `.encode()` call after `json.dumps()` to ensure we are sending `bytes`. Additionally, we added type annotation to ensure things can statically type-check with `mypy` on both Python 2 and 3.

3 years agoRollup merge of #82349 - tmiasko:pretty-test-timeout, r=Mark-Simulacrum
Yuki Okushi [Sun, 21 Feb 2021 06:26:50 +0000 (15:26 +0900)]
Rollup merge of #82349 - tmiasko:pretty-test-timeout, r=Mark-Simulacrum

test: Print test name only once on timeout

Pretty formatter when using multiple test threads displays test name twice on
timeout event. This implicitly suggest that those are two different events,
while in fact they are always printed together.

Print test name only once.

Before:

```
running 3 tests
test src/lib.rs - c (line 16) ... ok
test src/lib.rs - a (line 3) ... ok
test src/lib.rs - b (line 9) ... test src/lib.rs - b (line 9) has been running for over 60 seconds
test src/lib.rs - b (line 9) ... ok
```

After:

```
running 3 tests
test src/lib.rs - c (line 16) ... ok
test src/lib.rs - a (line 3) ... ok
test src/lib.rs - b (line 9) has been running for over 60 seconds
test src/lib.rs - b (line 9) ... ok
```

3 years agoRollup merge of #82302 - tmiasko:test-unsafe-send, r=Mark-Simulacrum
Yuki Okushi [Sun, 21 Feb 2021 06:26:49 +0000 (15:26 +0900)]
Rollup merge of #82302 - tmiasko:test-unsafe-send, r=Mark-Simulacrum

Remove unsafe impl Send for CompletedTest & TestResult

3 years agoRollup merge of #82233 - ijackson:try-block-type-test, r=Mark-Simulacrum
Yuki Okushi [Sun, 21 Feb 2021 06:26:48 +0000 (15:26 +0900)]
Rollup merge of #82233 - ijackson:try-block-type-test, r=Mark-Simulacrum

try-back-block-type test: Use TryFromSliceError for From test

Using `i32` is rather fragile because it has many implementations.  Recently in an early draft of another MR (#82228) I did something that introduced a new `i32 as From<something>` impl and this test broke.

TryFromSliceError is nice because it doesn't seem likely to grow new conversions.  We still have one conversion, from Infallible.

My other MR is going to be reworked and won't need this any more but having done it I thought I would submit it rather than just throw it away.  Sorry for the tiny MR.

3 years agoRollup merge of #82229 - estebank:issue-templace, r=Mark-Simulacrum
Yuki Okushi [Sun, 21 Feb 2021 06:26:47 +0000 (15:26 +0900)]
Rollup merge of #82229 - estebank:issue-templace, r=Mark-Simulacrum

Add [A-diagnostics] bug report template

3 years agoRollup merge of #82181 - GuillaumeGomez:es5-checks-ci, r=Mark-Simulacrum
Yuki Okushi [Sun, 21 Feb 2021 06:26:46 +0000 (15:26 +0900)]
Rollup merge of #82181 - GuillaumeGomez:es5-checks-ci, r=Mark-Simulacrum

Add check for ES5 in CI

Follow-up of #82145.

r? ```@Mark-Simulacrum```

3 years agoRollup merge of #82177 - rylev:no-delete-bootstrap-windows, r=Mark-Simulacrum
Yuki Okushi [Sun, 21 Feb 2021 06:26:45 +0000 (15:26 +0900)]
Rollup merge of #82177 - rylev:no-delete-bootstrap-windows, r=Mark-Simulacrum

Do not delete bootstrap.exe on Windows during clean

Windows does not allow deleting currently running executables.

This an addition to ```@jyn514's``` change in https://github.com/rust-lang/rust/pull/80574.

3 years agoRollup merge of #82154 - CDirkx:ip-changelog, r=Mark-Simulacrum
Yuki Okushi [Sun, 21 Feb 2021 06:26:44 +0000 (15:26 +0900)]
Rollup merge of #82154 - CDirkx:ip-changelog, r=Mark-Simulacrum

Update RELEASES.md 1.50 to include methods stabilized in #79342

I noticed that #79342 was missing from the release notes for 1.50.

3 years agoRollup merge of #81966 - deg4uss3r:degausser/aarch64_apple_ios_sim, r=shepmaster
Yuki Okushi [Sun, 21 Feb 2021 06:26:42 +0000 (15:26 +0900)]
Rollup merge of #81966 - deg4uss3r:degausser/aarch64_apple_ios_sim, r=shepmaster

Add new `rustc` target for Arm64 machines that can target the iphonesimulator

This PR lands a new target (`aarch64-apple-ios-sim`) that targets arm64 iphone simulator, previously unreachable from Apple Silicon machines.

resolves #81632

r? `@shepmaster`

3 years agoRollup merge of #81833 - the8472:parallel-bootstrap-rustfmt, r=Mark-Simulacrum
Yuki Okushi [Sun, 21 Feb 2021 06:26:41 +0000 (15:26 +0900)]
Rollup merge of #81833 - the8472:parallel-bootstrap-rustfmt, r=Mark-Simulacrum

parallelize x.py test tidy

Running tidy on individual commits when rewriting git history was somewhat of an annoyance, so I have parallelized it a bit.

running `time ./x.py test tidy` with warm IO caches:

old:

```
real 0m11.123s
user 0m14.495s
sys 0m5.227s
```

new:

```
real 0m1.834s
user 0m13.545s
sys 0m3.094s
```

There's further room for improvement (<0.9s should be feasible) but that would require bigger changes.

3 years agoRollup merge of #81706 - SkiFire13:document-binaryheap-unsafe, r=Mark-Simulacrum
Yuki Okushi [Sun, 21 Feb 2021 06:26:40 +0000 (15:26 +0900)]
Rollup merge of #81706 - SkiFire13:document-binaryheap-unsafe, r=Mark-Simulacrum

Document BinaryHeap unsafe functions

`BinaryHeap` contains some private safe functions but that are actually unsafe to call. This PR marks them `unsafe` and documents all the `unsafe` function calls inside them.

While doing this I might also have found a bug: some "SAFETY" comments in `sift_down_range` and `sift_down_to_bottom` are valid only if you assume that `child` doesn't overflow. However it may overflow if `end > isize::MAX` which can be true for ZSTs (but I think only for them). I guess the easiest fix would be to skip any sifting if `mem::size_of::<T> == 0`.

Probably conflicts with #81127 but solving the eventual merge conflict should be pretty easy.

3 years agoRollup merge of #81300 - ssomers:btree_cleanup_leak_tests, r=Mark-Simulacrum
Yuki Okushi [Sun, 21 Feb 2021 06:26:36 +0000 (15:26 +0900)]
Rollup merge of #81300 - ssomers:btree_cleanup_leak_tests, r=Mark-Simulacrum

BTree: share panicky test code & test panic during clear, clone

Bases almost all tests of panic on the same, richer definition, and extends it to cloning to test panic during clone.

r? ```@Mark-Simulacrum```

3 years agoAuto merge of #79100 - a1phyr:better_assert_eq, r=m-ou-se
bors [Sun, 21 Feb 2021 05:41:09 +0000 (05:41 +0000)]
Auto merge of #79100 - a1phyr:better_assert_eq, r=m-ou-se

Improve assert_eq! and assert_ne!

This PR improves `assert_eq!` and `assert_ne!` by moving the panicking code in an external function.

It does not change the fast path, but the move of the formatting in the cold path (the panic) may have a positive effect on in instruction cache use and with inlining.

Moreover, the use of trait objects instead of generic may improve compile times for `assert_eq!`-heavy code.

Godbolt link: ~~https://rust.godbolt.org/z/TYa9MT~~ \
Updated: https://rust.godbolt.org/z/bzE84x

3 years agorustdoc: Remove unnecessary `Cell` around `param_env`
Camelid [Sun, 21 Feb 2021 01:12:22 +0000 (17:12 -0800)]
rustdoc: Remove unnecessary `Cell` around `param_env`

3 years agoUse has for non-regexes
Michael Howell [Sun, 21 Feb 2021 00:51:41 +0000 (17:51 -0700)]
Use has for non-regexes

3 years agoFix formatting for description rustdoc UI tests
Michael Howell [Sun, 21 Feb 2021 00:50:01 +0000 (17:50 -0700)]
Fix formatting for description rustdoc UI tests

3 years agoAdd rustdoc UI tests for new description behaviour
Michael Howell [Sun, 21 Feb 2021 00:38:41 +0000 (17:38 -0700)]
Add rustdoc UI tests for new description behaviour

3 years agoRevert changes to all.html
Michael Howell [Sun, 21 Feb 2021 00:26:05 +0000 (17:26 -0700)]
Revert changes to all.html

This code wasn't actually working, and trying to SEO optimize that page is pointless anyway.

3 years agoAuto merge of #82253 - RalfJung:miri, r=RalfJung
bors [Sun, 21 Feb 2021 00:19:45 +0000 (00:19 +0000)]
Auto merge of #82253 - RalfJung:miri, r=RalfJung

update Miri

Fixes Miri breakage (no issue was created as the toolstate tracking is currently broken: https://github.com/rust-lang/rust/issues/82254)

3 years agotest: Print test name only once on timeout
Tomasz Miąsko [Sun, 21 Feb 2021 00:00:00 +0000 (00:00 +0000)]
test: Print test name only once on timeout

Pretty formatter when using multiple test threads displays test name twice on
timeout event. This implicitly suggest that those are two different events,
while in fact they are always printed together.

Print test name only once.

Before:

```
running 3 tests
test src/lib.rs - c (line 16) ... ok
test src/lib.rs - a (line 3) ... ok
test src/lib.rs - b (line 9) ... test src/lib.rs - b (line 9) has been running for over 60 seconds
test src/lib.rs - b (line 9) ... ok
```

After:

```
running 3 tests
test src/lib.rs - c (line 16) ... ok
test src/lib.rs - a (line 3) ... ok
test src/lib.rs - b (line 9) has been running for over 60 seconds
test src/lib.rs - b (line 9) ... ok
```

3 years agoCut off plain text descriptions after headers
Michael Howell [Sat, 20 Feb 2021 23:45:56 +0000 (16:45 -0700)]
Cut off plain text descriptions after headers

Before:

    The Rust Standard LibraryThe Rust Standard Library is the foundation of portable Rust software, a set of minimal and battle-tested shared abstractions for the broader Rust ecosystem. It offers core types, like `Vec<T>` and `Option<T>`, library-defined operations on language primitives, standard macros, I/O and multithreading, among many other things.

After:

    The Rust Standard Library

3 years agoUse the first paragraph, instead of cookie-cutter text, for rustdoc descriptions
Michael Howell [Sat, 20 Feb 2021 21:43:25 +0000 (14:43 -0700)]
Use the first paragraph, instead of cookie-cutter text, for rustdoc descriptions

Fixes #82283

3 years agoFix some Python2->3 error in publish_toolstate.py by type-checking it
kennytm [Sat, 20 Feb 2021 18:23:46 +0000 (02:23 +0800)]
Fix some Python2->3 error in publish_toolstate.py by type-checking it

3 years agoAdd A-diagnostics bug report template
Esteban Küber [Wed, 17 Feb 2021 17:47:31 +0000 (09:47 -0800)]
Add A-diagnostics bug report template

3 years agoUse the new name for `split-debuginfo`
Joshua Nelson [Wed, 17 Feb 2021 02:34:28 +0000 (21:34 -0500)]
Use the new name for `split-debuginfo`

3 years agoDon't apply semicolon in expressions from macros yet
Mark Rousskov [Sun, 14 Feb 2021 13:56:35 +0000 (08:56 -0500)]
Don't apply semicolon in expressions from macros yet

std_detect is still using this and as it's in a submodule updating it will be a
pain. We can catch this either after a stdarch submodule bump or just on the
next cycle.

3 years agoUpdate the bootstrap compiler
Joshua Nelson [Sat, 13 Feb 2021 23:05:07 +0000 (18:05 -0500)]
Update the bootstrap compiler

Note this does not change `core::derive` since it was merged after the
beta bump.

3 years agoremove redundant box wrapper
The8472 [Fri, 12 Feb 2021 20:27:16 +0000 (21:27 +0100)]
remove redundant box wrapper

3 years agolimit rustfmt parallelism by taking -j into account
The8472 [Sat, 20 Feb 2021 21:52:44 +0000 (22:52 +0100)]
limit rustfmt parallelism by taking -j into account

3 years agoparallelize x.py test tidy
The8472 [Sat, 6 Feb 2021 16:29:56 +0000 (17:29 +0100)]
parallelize x.py test tidy

old:

```
real 0m11.123s
user 0m14.495s
sys 0m5.227s
```

new:

```
real 0m2.767s
user 0m13.014s
sys 0m1.691s
```

3 years agoiOS simulator: pick the target based on the environment variable
Jan-Erik Rediger [Sun, 14 Feb 2021 15:33:03 +0000 (16:33 +0100)]
iOS simulator: pick the target based on the environment variable

LLVM picks the right things to put into the compiled object file based
on the target deployment version.
We need to communicate it through the target triple.
Only with that LLVM will use the right commands in the file to make it
look and behave like code compiled for the arm64 iOS simulator target.

3 years agoAuto merge of #82341 - GuillaumeGomez:rollup-t7y7tyg, r=GuillaumeGomez
bors [Sat, 20 Feb 2021 21:38:53 +0000 (21:38 +0000)]
Auto merge of #82341 - GuillaumeGomez:rollup-t7y7tyg, r=GuillaumeGomez

Rollup of 7 pull requests

Successful merges:

 - #80595 (`impl PartialEq<Punct> for char`; symmetry for #78636)
 - #81991 (Fix panic in 'remove semicolon' when types are not local)
 - #82176 (fix MIR fn-ptr pretty-printing)
 - #82244 (Keep consistency in example for Stdin StdinLock)
 - #82260 (rustc: Show ``@path`` usage in stable)
 - #82316 (Fix minor mistake in LTO docs.)
 - #82332 (Don't generate src link on dummy spans)

Failed merges:

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

3 years agoAdd FIXME for safety comments that are invalid when T is a ZST
Giacomo Stevanato [Fri, 12 Feb 2021 09:50:16 +0000 (10:50 +0100)]
Add FIXME for safety comments that are invalid when T is a ZST

3 years agoDocument BinaryHeap unsafe functions
Giacomo Stevanato [Wed, 3 Feb 2021 11:45:55 +0000 (12:45 +0100)]
Document BinaryHeap unsafe functions

3 years agoFix suggestion span and move suggestions into new subwindow.
Reese Williams [Sat, 20 Feb 2021 20:33:08 +0000 (15:33 -0500)]
Fix suggestion span and move suggestions into new subwindow.

3 years agoRollup merge of #82332 - GuillaumeGomez:no-src-link-on-dummy-spans, r=jyn514
Guillaume Gomez [Sat, 20 Feb 2021 19:37:04 +0000 (20:37 +0100)]
Rollup merge of #82332 - GuillaumeGomez:no-src-link-on-dummy-spans, r=jyn514

Don't generate src link on dummy spans

Just realized that the "auto trait impls" had `[src]` links were leading to the crate root because they were dummy spans. This PR fixes this issue.

cc `@jyn514`
r? `@camelid`

3 years agoRollup merge of #82316 - ehuss:lto-doc-fix, r=GuillaumeGomez
Guillaume Gomez [Sat, 20 Feb 2021 19:37:03 +0000 (20:37 +0100)]
Rollup merge of #82316 - ehuss:lto-doc-fix, r=GuillaumeGomez

Fix minor mistake in LTO docs.

`-C lto=true` isn't a valid option.

3 years agoRollup merge of #82260 - ojeda:rustc-argfile, r=jyn514
Guillaume Gomez [Sat, 20 Feb 2021 19:37:02 +0000 (20:37 +0100)]
Rollup merge of #82260 - ojeda:rustc-argfile, r=jyn514

rustc: Show `@path` usage in stable

The feature was stabilized in #66172, but the usage string was not updated to be shown.

3 years agoRollup merge of #82244 - pickfire:patch-6, r=dtolnay
Guillaume Gomez [Sat, 20 Feb 2021 19:37:01 +0000 (20:37 +0100)]
Rollup merge of #82244 - pickfire:patch-6, r=dtolnay

Keep consistency in example for Stdin StdinLock

Stdin uses handle whereas StdinLock uses stdin_lock, changed it to handle.