]> git.lizzy.rs Git - rust.git/log
rust.git
2 years agoRollup merge of #97565 - lukas-code:patch-1, r=thomcc
Dylan DPC [Tue, 31 May 2022 05:57:36 +0000 (07:57 +0200)]
Rollup merge of #97565 - lukas-code:patch-1, r=thomcc

Add doc alias `memset` to `write_bytes`

I were looking for `memset` in rust, but the docs only pointed me to `slice::fill`.

With only the old aliases, one might write code like this, which is incorrect if the memory is uninitialized.
``` Rust
core::slice::from_raw_parts(ptr, len).fill(0)
```

2 years agoRollup merge of #97455 - JohnTitor:stabilize-toowned-clone-into, r=dtolnay
Dylan DPC [Tue, 31 May 2022 05:57:35 +0000 (07:57 +0200)]
Rollup merge of #97455 - JohnTitor:stabilize-toowned-clone-into, r=dtolnay

Stabilize `toowned_clone_into`

Closes #41263
FCP has been done: https://github.com/rust-lang/rust/issues/41263#issuecomment-1100760750

2 years agoRollup merge of #97371 - ChayimFriedman2:closure-non-block-add-semicolon, r=oli-obk
Dylan DPC [Tue, 31 May 2022 05:57:34 +0000 (07:57 +0200)]
Rollup merge of #97371 - ChayimFriedman2:closure-non-block-add-semicolon, r=oli-obk

Suggest adding a semicolon to a closure without block

This transforms `|| expr` into `|| { expr; }`.

Closes #97359.

2 years agoRollup merge of #97229 - Nilstrieb:doc-box-noalias, r=dtolnay
Dylan DPC [Tue, 31 May 2022 05:57:33 +0000 (07:57 +0200)]
Rollup merge of #97229 - Nilstrieb:doc-box-noalias, r=dtolnay

Document the current aliasing rules for `Box<T>`.

Currently, `Box<T>` gets `noalias`, meaning it has the same rules as `&mut T`. This is sparsely documented, even though it can have quite a big impact on unsafe code using box. Therefore, these rules are documented here, with a big warning that they are not normative and subject to change, since we have not yet committed to an aliasing model and the state of `Box<T>` is especially uncertain.

If you have any suggestions and improvements, make sure to leave them here. This is mostly intended to inform people about what is currently going on (to prevent misunderstandings such as [Jon Gjengset's Box aliasing](https://www.youtube.com/watch?v=EY7Wi9fV5bk)).

This is supposed to _only document current UB_ and not add any new guarantees or rules.

2 years agoRollup merge of #97089 - GuillaumeGomez:improve-settings-theme-display, r=jsha
Dylan DPC [Tue, 31 May 2022 05:57:32 +0000 (07:57 +0200)]
Rollup merge of #97089 - GuillaumeGomez:improve-settings-theme-display, r=jsha

Improve settings theme display

This is a follow-up of #96958. In this PR, I changed how the theme radio buttons are displayed and improved their look as well.

It now looks like this:

![Screenshot from 2022-05-17 20-46-20](https://user-images.githubusercontent.com/3050060/168887703-a01e3bd5-9644-4012-ac11-2ae7bacd6be6.png)
![Screenshot from 2022-05-17 20-46-12](https://user-images.githubusercontent.com/3050060/168887707-132f8b2d-1163-462f-b7dd-f861121bdee7.png)

You can test it [here](https://rustdoc.crud.net/imperio/improve-settings-theme-display/doc/foo/index.html).

r? `@jsha`

2 years agoAuto merge of #97566 - compiler-errors:rollup-qfxw4j8, r=compiler-errors
bors [Tue, 31 May 2022 01:17:00 +0000 (01:17 +0000)]
Auto merge of #97566 - compiler-errors:rollup-qfxw4j8, r=compiler-errors

Rollup of 6 pull requests

Successful merges:

 - #89685 (refactor: VecDeques Iter fields to private)
 - #97172 (Optimize the diagnostic generation for `extern unsafe`)
 - #97395 (Miri call ABI check: ensure type size+align stay the same)
 - #97431 (don't do `Sized` and other return type checks on RPIT's real type)
 - #97555 (Source code page: line number click adds `NaN`)
 - #97558 (Fix typos in comment)

Failed merges:

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

2 years agoFix typo uniqeness -> uniqueness
David Tolnay [Mon, 30 May 2022 23:49:28 +0000 (16:49 -0700)]
Fix typo uniqeness -> uniqueness

2 years agoRollup merge of #97558 - stoeckmann:typos, r=compiler-errors
Michael Goulet [Mon, 30 May 2022 22:57:31 +0000 (15:57 -0700)]
Rollup merge of #97558 - stoeckmann:typos, r=compiler-errors

Fix typos in comment

Just two typos in HashingControls' description.

2 years agoRollup merge of #97555 - GuillaumeGomez:line-number-click, r=notriddle
Michael Goulet [Mon, 30 May 2022 22:57:30 +0000 (15:57 -0700)]
Rollup merge of #97555 - GuillaumeGomez:line-number-click, r=notriddle

Source code page: line number click adds `NaN`

When you click on the parent element of the line numbers in the source code pages, it'll add `NaN` (like in https://doc.rust-lang.org/nightly/src/alloc/lib.rs.html#NaN). This PR fixes this bug.

cc ``@jsha``
r? ``@notriddle``

2 years agoRollup merge of #97431 - compiler-errors:issue-97413, r=oli-obk
Michael Goulet [Mon, 30 May 2022 22:57:29 +0000 (15:57 -0700)]
Rollup merge of #97431 - compiler-errors:issue-97413, r=oli-obk

don't do `Sized` and other return type checks on RPIT's real type

Fixes an ICE where we're doing `Sized` check against the RPIT's real type, instead of against the opaque type. This differs from what we're doing in MIR typeck, which causes ICE #97226.

This regressed in #96516 -- this adjusts that fix to be a bit more conservative. That PR was backported and thus the ICE is also present in stable. Not sure if it's worth to beta and/or stable backport, probably not the latter but I could believe the former.

r? `@oli-obk`

cc: another attempt to fix this ICE #97413. I believe this PR addresses the root cause.

2 years agoRollup merge of #97395 - RalfJung:call-abi, r=oli-obk
Michael Goulet [Mon, 30 May 2022 22:57:28 +0000 (15:57 -0700)]
Rollup merge of #97395 - RalfJung:call-abi, r=oli-obk

Miri call ABI check: ensure type size+align stay the same

We should almost certainly not accept calls where caller and callee disagree on the size or alignment of the type.

The checks we do *almost* imply that, except that `ScalarPair` types can have `repr(align)` and thus differ in size/align even when they are pairs of the same primitive type.

r? ``@oli-obk``

2 years agoRollup merge of #97172 - SparrowLii:unsafe_extern, r=compiler-errors
Michael Goulet [Mon, 30 May 2022 22:57:27 +0000 (15:57 -0700)]
Rollup merge of #97172 - SparrowLii:unsafe_extern, r=compiler-errors

Optimize the diagnostic generation for `extern unsafe`

This PR does the following about diagnostic generation when parsing foreign mod:
1. Fixes the FIXME about avoiding depending on the error message text.
2. Continue parsing when `unsafe` is followed by `{` (just like `unsafe extern {...}`).
3. Add test case.

2 years agoRollup merge of #89685 - DeveloperC286:iter_fields_to_private, r=oli-obk
Michael Goulet [Mon, 30 May 2022 22:57:27 +0000 (15:57 -0700)]
Rollup merge of #89685 - DeveloperC286:iter_fields_to_private, r=oli-obk

refactor: VecDeques Iter fields to private

Made the fields of VecDeque's Iter private by creating a Iter::new(...) function to create a new instance of Iter and migrating usage to use Iter::new(...).

2 years agoAuto merge of #97357 - davidtwco:diagnostic-translation-typed-subdiagnostic-simplific...
bors [Mon, 30 May 2022 22:49:36 +0000 (22:49 +0000)]
Auto merge of #97357 - davidtwco:diagnostic-translation-typed-subdiagnostic-simplification, r=oli-obk

errors: simplify referring to fluent attributes

To render the message of a Fluent attribute, the identifier of the Fluent message must be known. `DiagnosticMessage::FluentIdentifier` contains both the message's identifier and optionally the identifier of an attribute. Generated constants for each attribute would therefore need to be named uniquely (amongst all error messages) or be able to refer to only the attribute identifier which will be combined with a message identifier later. In this commit, the latter strategy is implemented as part of the `Diagnostic` type's functions for adding subdiagnostics of various kinds.

r? `@oli-obk`

2 years agoUpdate mut_ptr.rs
Lukas [Mon, 30 May 2022 22:40:34 +0000 (22:40 +0000)]
Update mut_ptr.rs

2 years agoUpdate intrinsics.rs
Lukas [Mon, 30 May 2022 22:38:29 +0000 (22:38 +0000)]
Update intrinsics.rs

2 years agoCheck for `can_have_side_effects()` and `in_external_macro()` inside `suggest_missing...
Chayim Refael Friedman [Mon, 30 May 2022 20:35:51 +0000 (20:35 +0000)]
Check for `can_have_side_effects()` and `in_external_macro()` inside `suggest_missing_semicolon()`

2 years agoAuto merge of #97025 - ouz-a:mini-derefer-generator, r=davidtwco
bors [Mon, 30 May 2022 20:06:25 +0000 (20:06 +0000)]
Auto merge of #97025 - ouz-a:mini-derefer-generator, r=davidtwco

Add validation layer for Derefer

_Follow up work to #96549 #96116 #95857 #95649_

This adds validation for Derefer making sure it is always the first projection.

r? rust-lang/mir-opt

2 years agoFix typos in comment
Tobias Stoeckmann [Mon, 30 May 2022 19:21:32 +0000 (21:21 +0200)]
Fix typos in comment

2 years agoAuto merge of #97480 - conradludgate:faster-format-literals, r=joshtriplett
bors [Mon, 30 May 2022 17:39:58 +0000 (17:39 +0000)]
Auto merge of #97480 - conradludgate:faster-format-literals, r=joshtriplett

improve format impl for literals

The basic idea of this change can be seen here https://godbolt.org/z/MT37cWoe1.

Updates the format impl to have a fast path for string literals and the default path for regular format args.

This change will allow `format!("string literal")` to be used interchangably with `"string literal".to_owned()`.

This would be relevant in the case of `f!"string literal"` being legal (https://github.com/rust-lang/rfcs/pull/3267) in which case it would be the easiest way to create owned strings from literals, while also being just as efficient as any other impl

2 years agovalidate derefer, run derefer inside generator
ouz-a [Wed, 11 May 2022 21:27:06 +0000 (00:27 +0300)]
validate derefer, run derefer inside generator

2 years agoAdd line number click GUI test
Guillaume Gomez [Mon, 30 May 2022 15:14:46 +0000 (17:14 +0200)]
Add line number click GUI test

2 years agoImprove source-code-page.goml GUI test code
Guillaume Gomez [Mon, 30 May 2022 15:07:21 +0000 (17:07 +0200)]
Improve source-code-page.goml GUI test code

2 years agoAuto merge of #97548 - Dylan-DPC:rollup-9x0va1d, r=Dylan-DPC
bors [Mon, 30 May 2022 14:59:12 +0000 (14:59 +0000)]
Auto merge of #97548 - Dylan-DPC:rollup-9x0va1d, r=Dylan-DPC

Rollup of 6 pull requests

Successful merges:

 - #97494 (Use Box::new() instead of box syntax in library tests)
 - #97499 (Remove "sys isn't exported yet" phrase)
 - #97504 (Ensure source file present when calculating max line number)
 - #97519 (Re-add help_on_error for download-ci-llvm)
 - #97531 (Note pattern mismatch coming from `for` loop desugaring)
 - #97545 (Reword safety comments in core/hash/sip.rs)

Failed merges:

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

2 years agoFix invalid line number computation when clicking on something else than a line number
Guillaume Gomez [Mon, 30 May 2022 14:53:24 +0000 (16:53 +0200)]
Fix invalid line number computation when clicking on something else than a line number

2 years agoerrors: simplify referring to fluent attributes
David Wood [Tue, 24 May 2022 14:09:47 +0000 (15:09 +0100)]
errors: simplify referring to fluent attributes

To render the message of a Fluent attribute, the identifier of the
Fluent message must be known. `DiagnosticMessage::FluentIdentifier`
contains both the message's identifier and optionally the identifier of
an attribute. Generated constants for each attribute would therefore
need to be named uniquely (amongst all error messages) or be able to
refer to only the attribute identifier which will be combined with a
message identifier later. In this commit, the latter strategy is
implemented as part of the `Diagnostic` type's functions for adding
subdiagnostics of various kinds.

Signed-off-by: David Wood <david.wood@huawei.com>
2 years agoRollup merge of #97545 - thomcc:sip-comment-safety, r=Dylan-DPC
Dylan DPC [Mon, 30 May 2022 12:33:53 +0000 (14:33 +0200)]
Rollup merge of #97545 - thomcc:sip-comment-safety, r=Dylan-DPC

Reword safety comments in core/hash/sip.rs

In https://rust-lang.zulipchat.com/#narrow/stream/136281-t-lang.2Fwg-unsafe-code-guidelines/topic/Is.20there.20any.20way.20to.20soundly.20do.20a.20masked.20out-of-bounds.20read.3F/near/284329248 it came up that this is using an atypical (and somewhat vague) phrasing of the safety requirement, so this slightly rewords it.

2 years agoRollup merge of #97531 - compiler-errors:for-loop-pat-mismatch, r=davidtwco
Dylan DPC [Mon, 30 May 2022 12:33:52 +0000 (14:33 +0200)]
Rollup merge of #97531 - compiler-errors:for-loop-pat-mismatch, r=davidtwco

Note pattern mismatch coming from `for` loop desugaring

Fixes #97163

2 years agoRollup merge of #97519 - binggh:readd-help-on-error, r=jyn514
Dylan DPC [Mon, 30 May 2022 12:33:51 +0000 (14:33 +0200)]
Rollup merge of #97519 - binggh:readd-help-on-error, r=jyn514

Re-add help_on_error for download-ci-llvm

Closes #97503

- Re-added `help_on_error` for `download_component()` and the downstream functions
- Removed dead code in `bootstrap.py`

Thanks `@jyn514` for the helpful tips!

(first contribution here, please let me know if I missed anything out!)

2 years agoRollup merge of #97504 - JohnTitor:cleanup-deps, r=davidtwco
Dylan DPC [Mon, 30 May 2022 12:33:50 +0000 (14:33 +0200)]
Rollup merge of #97504 - JohnTitor:cleanup-deps, r=davidtwco

Ensure source file present when calculating max line number

Resubmission of #89268, fixes #71363
The behavior difference of `simulate-remapped-rust-src-base` is not something we should take into account here, so limiting targets to run the test makes sense, I think.

r? `@davidtwco,` and `@estebank,` you might be interested in this change

2 years agoRollup merge of #97499 - est31:master, r=Dylan-DPC
Dylan DPC [Mon, 30 May 2022 12:33:49 +0000 (14:33 +0200)]
Rollup merge of #97499 - est31:master, r=Dylan-DPC

Remove "sys isn't exported yet" phrase

The oldest occurence is from 9e224c2bf18ebf8f871efb2e1aba43ed7970ebb7,
which is from the pre-1.0 days. In the years since then, std::sys still
hasn't been exported, and the last attempt was met with strong criticism:
https://github.com/rust-lang/rust/pull/97151

Thus, removing the "yet" part makes a lot of sense.

2 years agoRollup merge of #97494 - est31:remove_box_alloc_tests, r=Dylan-DPC
Dylan DPC [Mon, 30 May 2022 12:33:48 +0000 (14:33 +0200)]
Rollup merge of #97494 - est31:remove_box_alloc_tests, r=Dylan-DPC

Use Box::new() instead of box syntax in library tests

The tests inside `library/*` have no reason to use `box` syntax as they have 0 performance relevance. Therefore, we can safely remove them (instead of having to use alternatives like the one in #97293).

2 years agoAuto merge of #97546 - RalfJung:miri, r=oli-obk
bors [Mon, 30 May 2022 11:59:55 +0000 (11:59 +0000)]
Auto merge of #97546 - RalfJung:miri, r=oli-obk

update Miri

First update with the new ui test suite, let's hope this all works. :)
r? `@oli-obk`

Fixes https://github.com/rust-lang/rust/issues/97486

2 years agobe less redundant redundant
Ralf Jung [Mon, 30 May 2022 10:35:01 +0000 (12:35 +0200)]
be less redundant redundant

2 years agoAdd GUI test for settings display
Guillaume Gomez [Mon, 30 May 2022 10:12:29 +0000 (12:12 +0200)]
Add GUI test for settings display

2 years agoMove theme rules out of settings.css
Guillaume Gomez [Wed, 18 May 2022 09:17:56 +0000 (11:17 +0200)]
Move theme rules out of settings.css

2 years agoImprove display of settings radio buttons
Guillaume Gomez [Tue, 17 May 2022 16:09:07 +0000 (18:09 +0200)]
Improve display of settings radio buttons

2 years agoLet miri decide the flags to use for the test suite
Oli Scherer [Mon, 30 May 2022 10:10:28 +0000 (12:10 +0200)]
Let miri decide the flags to use for the test suite

2 years agoRemove "sys isn't exported yet" phrase
est31 [Sat, 28 May 2022 23:00:24 +0000 (01:00 +0200)]
Remove "sys isn't exported yet" phrase

The oldest occurence is from 9e224c2bf18ebf8f871efb2e1aba43ed7970ebb7,
which is from the pre-1.0 days. In the years since then, std::sys still
hasn't been exported, and the last attempt was met with strong criticism:
https://github.com/rust-lang/rust/pull/97151

Thus, removing the "yet" part makes a lot of sense.

2 years agoAuto merge of #96964 - oli-obk:const_trait_mvp, r=compiler-errors
bors [Mon, 30 May 2022 09:19:03 +0000 (09:19 +0000)]
Auto merge of #96964 - oli-obk:const_trait_mvp, r=compiler-errors

Replace `#[default_method_body_is_const]` with `#[const_trait]`

pulled out of #96077

related issues:  #67792 and #92158

cc `@fee1-dead`

This is groundwork to only allowing `impl const Trait` for traits that are marked with `#[const_trait]`. This is necessary to prevent adding a new default method from becoming a breaking change (as it could be a non-const fn).

2 years agoupdate diagnostic message on removed attribute
Oli Scherer [Mon, 16 May 2022 20:02:48 +0000 (22:02 +0200)]
update diagnostic message on removed attribute

Co-authored-by: fee1-dead <ent3rm4n@gmail.com>
2 years agoDefault methods of traits are also AssocFn defs as they essentially desugar to a...
Oli Scherer [Thu, 12 May 2022 07:43:41 +0000 (07:43 +0000)]
Default methods of traits are also AssocFn defs as they essentially desugar to a method in a new impl block

2 years agoReduce the scope of a mutable variable
Oli Scherer [Thu, 12 May 2022 07:43:05 +0000 (07:43 +0000)]
Reduce the scope of a mutable variable

2 years agoAdd a helper function for checking whether a default function in a trait can be treat...
Oli Scherer [Wed, 11 May 2022 16:02:20 +0000 (16:02 +0000)]
Add a helper function for checking whether a default function in a trait can be treated as `const`

2 years agoRemove `#[default..]` and add `#[const_trait]`
Deadbeef [Wed, 16 Mar 2022 09:49:54 +0000 (20:49 +1100)]
Remove `#[default..]` and add `#[const_trait]`

2 years agoupdate Miri
Ralf Jung [Mon, 30 May 2022 08:17:46 +0000 (10:17 +0200)]
update Miri

2 years agoReword safety comments in core/hash/sip.rs
Thom Chiovoloni [Mon, 30 May 2022 08:06:08 +0000 (01:06 -0700)]
Reword safety comments in core/hash/sip.rs

2 years agoOptimize the diagnostic generation for `extern unsafe`
SparrowLii [Mon, 30 May 2022 07:56:43 +0000 (15:56 +0800)]
Optimize the diagnostic generation for `extern unsafe`

2 years agoAuto merge of #97489 - GuillaumeGomez:settings-js-disabled, r=notriddle
bors [Mon, 30 May 2022 04:15:10 +0000 (04:15 +0000)]
Auto merge of #97489 - GuillaumeGomez:settings-js-disabled, r=notriddle

Add sentence in case JS is disabled on settings.html page

Instead of having an empty page, it'll look like this:

![Screenshot from 2022-05-28 17-46-23](https://user-images.githubusercontent.com/3050060/170833333-e1a59c2b-27ca-47da-9c08-2356e4a689cb.png)

r? `@notriddle`

2 years agoAuto merge of #97538 - compiler-errors:rollup-zp3ukke, r=compiler-errors
bors [Sun, 29 May 2022 23:25:51 +0000 (23:25 +0000)]
Auto merge of #97538 - compiler-errors:rollup-zp3ukke, r=compiler-errors

Rollup of 4 pull requests

Successful merges:

 - #97493 (Use `type_is_copy_modulo_regions` check in intrisicck)
 - #97518 (Fix order of closing HTML elements in rustdoc output)
 - #97530 (Add more eslint checks)
 - #97536 (Remove unused lifetimes from expand_macro)

Failed merges:

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

2 years agoRollup merge of #97536 - est31:remove_unused_lifetimes, r=compiler-errors
Michael Goulet [Sun, 29 May 2022 23:25:05 +0000 (16:25 -0700)]
Rollup merge of #97536 - est31:remove_unused_lifetimes, r=compiler-errors

Remove unused lifetimes from expand_macro

The function doesn't need the lifetimes
of the two arguments be bound together.

2 years agoRollup merge of #97530 - GuillaumeGomez:more-eslint-checks, r=jsha
Michael Goulet [Sun, 29 May 2022 23:25:04 +0000 (16:25 -0700)]
Rollup merge of #97530 - GuillaumeGomez:more-eslint-checks, r=jsha

Add more eslint checks

Here is a new batch of eslint checks:

 * [no-const-assign](https://eslint.org/docs/rules/no-const-assign)
 * [no-debugger](https://eslint.org/docs/rules/no-debugger)
 * [no-dupe-args](https://eslint.org/docs/rules/no-dupe-args)
 * [no-duple-else-if](https://eslint.org/docs/rules/no-dupe-else-if)
 * [no-dupe-keys](https://eslint.org/docs/rules/no-dupe-keys)
 * [no-duplicate-case](https://eslint.org/docs/rules/no-duplicate-case)
 * [no-ex-assign](https://eslint.org/docs/rules/no-ex-assign)

r? ``@notriddle``

2 years agoRollup merge of #97518 - badboy:rustdoc-ul-div-fix, r=notriddle
Michael Goulet [Sun, 29 May 2022 23:25:03 +0000 (16:25 -0700)]
Rollup merge of #97518 - badboy:rustdoc-ul-div-fix, r=notriddle

Fix order of closing HTML elements in rustdoc output

Initially reported here: https://users.rust-lang.org/t/documentation-itself-parsed-error/76232

2 years agoRollup merge of #97493 - compiler-errors:issue-97490, r=oli-obk
Michael Goulet [Sun, 29 May 2022 23:25:02 +0000 (16:25 -0700)]
Rollup merge of #97493 - compiler-errors:issue-97490, r=oli-obk

Use `type_is_copy_modulo_regions` check in intrisicck

This one canoncalizes region variables correctly, preventing an ICE

Fixes #97490

2 years agoRemove unused lifetimes from expand_macro
est31 [Sun, 29 May 2022 21:30:54 +0000 (23:30 +0200)]
Remove unused lifetimes from expand_macro

The function doesn't need the lifetimes
of the two arguments be bound together.

2 years agoUse type_is_copy_modulo_regions check in intrisicck
Michael Goulet [Sat, 28 May 2022 20:34:54 +0000 (13:34 -0700)]
Use type_is_copy_modulo_regions check in intrisicck

2 years agoNote pattern mismatch coming from for-loop desugaring
Michael Goulet [Sun, 29 May 2022 20:01:42 +0000 (13:01 -0700)]
Note pattern mismatch coming from for-loop desugaring

2 years agoAdd "no-ex-assign" eslint rule
Guillaume Gomez [Sun, 29 May 2022 19:44:10 +0000 (21:44 +0200)]
Add "no-ex-assign" eslint rule

2 years agoAdd "no-duplicate-case" eslint rule
Guillaume Gomez [Sun, 29 May 2022 19:43:37 +0000 (21:43 +0200)]
Add "no-duplicate-case" eslint rule

2 years agoAuto merge of #97514 - WaffleLapkin:panick, r=Dylan-DPC
bors [Sun, 29 May 2022 19:42:39 +0000 (19:42 +0000)]
Auto merge of #97514 - WaffleLapkin:panick, r=Dylan-DPC

Fix typo (panick -> panic)

Fix typo (panick -> panic) in `std::error` module docs.

2 years agoAdd "no-dupe-keys" eslint rule
Guillaume Gomez [Sun, 29 May 2022 19:42:11 +0000 (21:42 +0200)]
Add "no-dupe-keys" eslint rule

2 years agoAdd "no-dupe-else-if" eslint rule
Guillaume Gomez [Sun, 29 May 2022 19:41:05 +0000 (21:41 +0200)]
Add "no-dupe-else-if" eslint rule

2 years agoremove useless cold
Conrad Ludgate [Sat, 28 May 2022 11:08:27 +0000 (12:08 +0100)]
remove useless cold

2 years agoimprove format impl for literals
Conrad Ludgate [Sat, 28 May 2022 10:01:09 +0000 (11:01 +0100)]
improve format impl for literals

2 years agoAdd "no-dup-args" eslint rule
Guillaume Gomez [Sun, 29 May 2022 19:40:16 +0000 (21:40 +0200)]
Add "no-dup-args" eslint rule

2 years agoAdd "no-debugger" eslint rule
Guillaume Gomez [Sun, 29 May 2022 19:39:44 +0000 (21:39 +0200)]
Add "no-debugger" eslint rule

2 years agoAdd "no-const-assign" eslint rule
Guillaume Gomez [Sun, 29 May 2022 19:38:52 +0000 (21:38 +0200)]
Add "no-const-assign" eslint rule

2 years agoAuto merge of #97214 - Mark-Simulacrum:stage0-bump, r=pietroalbini
bors [Sun, 29 May 2022 16:28:21 +0000 (16:28 +0000)]
Auto merge of #97214 - Mark-Simulacrum:stage0-bump, r=pietroalbini

Finish bumping stage0

It looks like the last time had left some remaining cfg's -- which made me think
that the stage0 bump was actually successful. This brings us to a released 1.62
beta though.

This now brings us to cfg-clean, with the exception of check-cfg-features in bootstrap;
I'd prefer to leave that for a separate PR at this time since it's likely to be more tricky.

cc https://github.com/rust-lang/rust/pull/97147#issuecomment-1132845061

r? `@pietroalbini`

2 years agoRe-add help_on_error for download-ci-llvm
binggh [Sun, 29 May 2022 14:11:36 +0000 (22:11 +0800)]
Re-add help_on_error for download-ci-llvm

Remove dead code

Missing }

./x.py fmt

Remove duplicate check

Recursively remove all usage of help_on_error

2 years agoAuto merge of #94214 - nikic:rust-opaque-pointers, r=cuviper
bors [Sun, 29 May 2022 14:12:42 +0000 (14:12 +0000)]
Auto merge of #94214 - nikic:rust-opaque-pointers, r=cuviper

Prepare Rust for opaque pointers

Fix one codegen bug with opaque pointers, and update our IR tests to accept both typed pointer and opaque pointer IR. This is a bit annoying, but unavoidable if we want decent test coverage on both LLVM 14 and LLVM 15.

This prepares Rust for when LLVM will enable opaque pointers by default.

2 years agoFix order of closing HTML elements in rustdoc output
Jan-Erik Rediger [Sun, 29 May 2022 13:22:25 +0000 (15:22 +0200)]
Fix order of closing HTML elements in rustdoc output

2 years agoAuto merge of #97456 - Bryysen:issue-97319-fix, r=compiler-errors
bors [Sun, 29 May 2022 12:00:30 +0000 (12:00 +0000)]
Auto merge of #97456 - Bryysen:issue-97319-fix, r=compiler-errors

Improve error message for E0081

Closes #97319

2 years agoFix typo (panick -> panic)
Maybe Waffle [Sun, 29 May 2022 09:14:59 +0000 (13:14 +0400)]
Fix typo (panick -> panic)

2 years agoAuto merge of #97287 - compiler-errors:type-interner, r=jackh726,oli-obk
bors [Sun, 29 May 2022 08:20:13 +0000 (08:20 +0000)]
Auto merge of #97287 - compiler-errors:type-interner, r=jackh726,oli-obk

Move things to `rustc_type_ir`

Finishes some work proposed in https://github.com/rust-lang/compiler-team/issues/341.

r? `@ghost`

2 years agoAuto merge of #96687 - jyn514:download-rustc, r=Mark-Simulacrum
bors [Sun, 29 May 2022 05:56:09 +0000 (05:56 +0000)]
Auto merge of #96687 - jyn514:download-rustc, r=Mark-Simulacrum

Move download-rustc from python to rustbuild

- Remove download-rustc handling from bootstrap.py
- Allow a custom `pattern` in `builder.unpack()`
- Only download rustc once another part of bootstrap depends on it.

  This is somewhat necessary since the download functions rely on having a full
  `Builder`, which isn't available until after config parsing finishes.

Helps with https://github.com/rust-lang/rust/issues/94829.

2 years agoAuto merge of #96652 - notriddle:notriddle/self, r=GuillaumeGomez
bors [Sun, 29 May 2022 03:15:28 +0000 (03:15 +0000)]
Auto merge of #96652 - notriddle:notriddle/self, r=GuillaumeGomez

rustdoc: include impl generics / self in search index

Fixes #92205

2 years agoEnsure source file present when calculating max line number
Yuki Okushi [Sun, 29 May 2022 02:29:49 +0000 (11:29 +0900)]
Ensure source file present when calculating max line number

Co-authored-by: Ross MacArthur <ross@macarthur.io>
2 years agoAuto merge of #97500 - GuillaumeGomez:rollup-ms1bvps, r=GuillaumeGomez
bors [Sun, 29 May 2022 00:40:45 +0000 (00:40 +0000)]
Auto merge of #97500 - GuillaumeGomez:rollup-ms1bvps, r=GuillaumeGomez

Rollup of 5 pull requests

Successful merges:

 - #96950 (Add regression test for #96395)
 - #97028 (Add support for embedding pretty printers via `#[debugger_visualizer]` attribute)
 - #97478 (Remove FIXME on `ExtCtxt::fn_decl()`)
 - #97479 (Make some tests check-pass)
 - #97482 (ptr::invalid is not equivalent to a int2ptr cast)

Failed merges:

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

2 years agoUse Box::new() instead of box syntax in core tests
est31 [Sat, 28 May 2022 22:40:47 +0000 (00:40 +0200)]
Use Box::new() instead of box syntax in core tests

2 years agoUse Box::new() instead of box syntax in std tests
est31 [Sat, 28 May 2022 22:25:32 +0000 (00:25 +0200)]
Use Box::new() instead of box syntax in std tests

2 years agoRollup merge of #97482 - RalfJung:ptr-invalid, r=thomcc
Guillaume Gomez [Sat, 28 May 2022 23:12:33 +0000 (01:12 +0200)]
Rollup merge of #97482 - RalfJung:ptr-invalid, r=thomcc

ptr::invalid is not equivalent to a int2ptr cast

I just realized I forgot to update these docs when adding `from_exposed_addr`.
Right now the docs say `invalid` and `from_exposed_addr` are both equivalent to a cast, and that is clearly not what we want.

Cc ``@Gankra``

2 years agoRollup merge of #97479 - JohnTitor:make-check-pass, r=compiler-errors
Guillaume Gomez [Sat, 28 May 2022 23:12:32 +0000 (01:12 +0200)]
Rollup merge of #97479 - JohnTitor:make-check-pass, r=compiler-errors

Make some tests check-pass

This touches the tests related to lint, parser, and importing, all of them should be fine with `check-pass`.
r? ``@compiler-errors``

2 years agoRollup merge of #97478 - JohnTitor:fixme-fn-decl, r=compiler-errors
Guillaume Gomez [Sat, 28 May 2022 23:12:30 +0000 (01:12 +0200)]
Rollup merge of #97478 - JohnTitor:fixme-fn-decl, r=compiler-errors

Remove FIXME on `ExtCtxt::fn_decl()`

`ExtCtxt::fn_decl()` is used like `self.fn_decl(..)` or `self.cx.fn_decl(..)`, coverting it to an assoc fn, for example, makes it inconvenience (e.g. `self.cx.fn_decl(..)` would be longer to represent). Given that, it doesn't seem a "FIXME" thing and unused `self` is okay, I think.

2 years agoRollup merge of #97028 - ridwanabdillahi:pretty-printer, r=michaelwoerister
Guillaume Gomez [Sat, 28 May 2022 23:12:30 +0000 (01:12 +0200)]
Rollup merge of #97028 - ridwanabdillahi:pretty-printer, r=michaelwoerister

Add support for embedding pretty printers via `#[debugger_visualizer]` attribute

Initial support for [RFC 3191](https://github.com/rust-lang/rfcs/pull/3191) in PR https://github.com/rust-lang/rust/pull/91779 was scoped to supporting embedding NatVis files using a new attribute. This PR implements the pretty printer support as stated in the RFC mentioned above.

This change includes embedding pretty printers in the `.debug_gdb_scripts` just as the pretty printers for rustc are embedded today. Also added additional tests for embedded pretty printers. Additionally cleaned up error checking so all error checking is done up front regardless of the current target.

RFC: https://github.com/rust-lang/rfcs/pull/3191

2 years agoRollup merge of #96950 - JohnTitor:issue-96395, r=compiler-errors,oli-obk
Guillaume Gomez [Sat, 28 May 2022 23:12:29 +0000 (01:12 +0200)]
Rollup merge of #96950 - JohnTitor:issue-96395, r=compiler-errors,oli-obk

Add regression test for #96395

Closes #96395
This repeats "fixed" and "ICE", see https://github.com/rust-lang/glacier/pull/1243#issuecomment-1123768138
I think it's good to add a test before regressing again.
r? ``@compiler-errors`` for quick reviiew

cc ``@oli-obk`` you might want to check as you're familiar with MIR

2 years agoUse Box::new() instead of box syntax in alloc tests
est31 [Sat, 28 May 2022 21:22:07 +0000 (23:22 +0200)]
Use Box::new() instead of box syntax in alloc tests

2 years agoAuto merge of #97472 - cuviper:rebase-rustc-rayon, r=Mark-Simulacrum
bors [Sat, 28 May 2022 22:24:53 +0000 (22:24 +0000)]
Auto merge of #97472 - cuviper:rebase-rustc-rayon, r=Mark-Simulacrum

Update to rebased rustc-rayon 0.4

In rayon-rs/rayon#938, miri uncovered a race in `rustc-rayon-core` that had already been fixed in the regular `rayon-core`. I have now rebased that fork onto the latest rayon branch, and published as 0.4. I also updated `indexmap` to bump the dependency.

`Cargo.lock` changes:

    Updating indexmap v1.8.0 -> v1.8.2
    Updating rayon v1.5.1 -> v1.5.3
    Updating rayon-core v1.9.1 -> v1.9.3
    Updating rustc-rayon v0.3.2 -> v0.4.0
    Updating rustc-rayon-core v0.3.2 -> v0.4.1

2 years agoImprove error message for E0081
Bryysen [Fri, 27 May 2022 13:42:15 +0000 (15:42 +0200)]
Improve error message for E0081

Previously whenever a duplicate discriminant was detected for an Enum,
we would print the discriminant bits in the diagnostic without any
casting. This caused us to display incorrect values for negative
discriminants. After this PR we format the discriminant signedness
correctly. Also reworded some of the original error
messages.

2 years agoAuto merge of #97207 - RalfJung:backtrace, r=Mark-Simulacrum
bors [Sat, 28 May 2022 19:30:58 +0000 (19:30 +0000)]
Auto merge of #97207 - RalfJung:backtrace, r=Mark-Simulacrum

update libbacktrace

It seems like previously we were on a tag of the backtrace repo; not sure if there is a policy that it should always be a tag?

Cc https://github.com/rust-lang/backtrace-rs/pull/462 `@alexcrichton` `@DrMeepster`

2 years agoMake TyCtxt implement Interner, make HashStable generic and move to rustc_type_ir
Michael Goulet [Sat, 28 May 2022 03:03:57 +0000 (20:03 -0700)]
Make TyCtxt implement Interner, make HashStable generic and move to rustc_type_ir

2 years agoRemove some comments, inline interner fn
Michael Goulet [Fri, 27 May 2022 14:52:56 +0000 (07:52 -0700)]
Remove some comments, inline interner fn

2 years agoFix TyKind lint, make consts no longer fn, etc
Michael Goulet [Fri, 27 May 2022 03:22:28 +0000 (20:22 -0700)]
Fix TyKind lint, make consts no longer fn, etc

2 years agoInitial fixes on top of type interner commit
Michael Goulet [Sun, 22 May 2022 19:57:46 +0000 (12:57 -0700)]
Initial fixes on top of type interner commit

2 years agoMove things to rustc_type_ir
Wilco Kusee [Sun, 31 Jan 2021 09:32:34 +0000 (10:32 +0100)]
Move things to rustc_type_ir

2 years agoAdd GUI test for javascript disabled display of settings page
Guillaume Gomez [Sat, 28 May 2022 16:03:35 +0000 (18:03 +0200)]
Add GUI test for javascript disabled display of settings page

2 years agoAuto merge of #97461 - eddyb:proc-macro-less-payload, r=bjorn3
bors [Sat, 28 May 2022 16:49:52 +0000 (16:49 +0000)]
Auto merge of #97461 - eddyb:proc-macro-less-payload, r=bjorn3

proc_macro: don't pass a client-side function pointer through the server.

Before this PR, `proc_macro::bridge::Client<F>` contained both:
* the C ABI entry-point `run`, that the server can call to start the client
* some "payload" `f: F` passed to that entry-point
  * in practice, this was always a (client-side Rust ABI) `fn` pointer to the actual function the proc macro author wrote, i.e. `#[proc_macro] fn foo(input: TokenStream) -> TokenStream`

In other words, the client was passing one of its (Rust) `fn` pointers to the server, which was passing it back to the client, for the client to call (see later below for why that was ever needed).

I was inspired by `@nnethercote's` attempt to remove the `get_handle_counters` field from `Client` (see https://github.com/rust-lang/rust/pull/97004#issuecomment-1139273301), which combined with removing the `f` ("payload") field, could theoretically allow for a `#[repr(transparent)]` `Client` that mostly just newtypes the C ABI entry-point `fn` pointer <sub>(and in the context of e.g. wasm isolation, that's *all* you want, since you can reason about it from outside the wasm VM, as just a 32-bit "function table index", that you can pass to the wasm VM to call that function)</sub>.

<hr/>

So this PR removes that "payload". But it's not a simple refactor: the reason the field existed in the first place is because monomorphizing over a function type doesn't let you call the function without having a value of that type, because function types don't implement anything like `Default`, i.e.:
```rust
extern "C" fn ffi_wrapper<A, R, F: Fn(A) -> R>(arg: A) -> R {
    let f: F = ???; // no way to get a value of `F`
    f(arg)
}
```
That could be solved with something like this, if it was allowed:
```rust
extern "C" fn ffi_wrapper<
    A, R,
    F: Fn(A) -> R,
    const f: F // not allowed because the type is a generic param
>(arg: A) -> R {
    f(arg)
}
```

Instead, this PR contains a workaround in `proc_macro::bridge::selfless_reify` (see its module-level comment for more details) that can provide something similar to the `ffi_wrapper` example above, but limited to `F` being `Copy` and ZST (and requiring an `F` value to prove the caller actually can create values of `F` and it's not uninhabited or some other unsound situation).

<hr/>

Hopefully this time we don't have a performance regression, and this has a chance to land.

cc `@mystor` `@bjorn3`

2 years agonote to future self
Ralf Jung [Sat, 28 May 2022 16:15:04 +0000 (18:15 +0200)]
note to future self

2 years agoImprove settings page display with disabled javascript
Guillaume Gomez [Sat, 28 May 2022 15:54:47 +0000 (17:54 +0200)]
Improve settings page display with disabled javascript

2 years agoAuto merge of #97383 - dingxiangfei2009:restore-region-scope-tree-query, r=dingxiangf...
bors [Sat, 28 May 2022 14:30:25 +0000 (14:30 +0000)]
Auto merge of #97383 - dingxiangfei2009:restore-region-scope-tree-query, r=dingxiangfei2009

Try to cache region_scope_tree as a query

This PR will attempt to restore `region_scope_tree` as a query so that caching works again. It seems that `region_scope_tree` could be re-computed for nested items after all, which could explain the performance regression introduced by #95563.

cc `@Mark-Simulacrum` `@pnkfelix` I will try to trigger a perf run here.

2 years agoAuto merge of #97158 - JakobDegen:dse, r=tmiasko,cjgillot
bors [Sat, 28 May 2022 11:49:42 +0000 (11:49 +0000)]
Auto merge of #97158 - JakobDegen:dse, r=tmiasko,cjgillot

Split dead store elimination off dest prop

This splits off a part of #96451 . I've added this in as its own pass for now, so that it actually runs, can be tested, etc. In the dest prop PR, I'll stop invoking this as its own pass, so that it doesn't get invoked twice.

r? `@tmiasko`