]> git.lizzy.rs Git - rust.git/log
rust.git
23 months agoRollup merge of #99851 - yotamofek:patch-1, r=Mark-Simulacrum
Dylan DPC [Thu, 28 Jul 2022 16:44:50 +0000 (22:14 +0530)]
Rollup merge of #99851 - yotamofek:patch-1, r=Mark-Simulacrum

Fix small typo in Cargo.toml comment

23 months agoRollup merge of #99817 - notriddle:notriddle/clean-trait-removal, r=GuillaumeGomez
Dylan DPC [Thu, 28 Jul 2022 16:44:49 +0000 (22:14 +0530)]
Rollup merge of #99817 - notriddle:notriddle/clean-trait-removal, r=GuillaumeGomez

rustdoc: remove Clean trait impls for more items

Follow up to https://github.com/rust-lang/rust/pull/99638 and https://github.com/rust-lang/rust/pull/99672

23 months agoRollup merge of #99807 - Nilstrieb:wsl-ui-test-fix, r=Mark-Simulacrum
Dylan DPC [Thu, 28 Jul 2022 16:44:48 +0000 (22:14 +0530)]
Rollup merge of #99807 - Nilstrieb:wsl-ui-test-fix, r=Mark-Simulacrum

Fix PermissionDenied UI tests on WSL

On my WSL with `appendWindowsPath=true`, running an invalid command returns `PermissionDenied` instead of `NotFound`, causing two UI tests to fail.

23 months agoRollup merge of #99689 - dtolnay:write, r=Mark-Simulacrum
Dylan DPC [Thu, 28 Jul 2022 16:44:46 +0000 (22:14 +0530)]
Rollup merge of #99689 - dtolnay:write, r=Mark-Simulacrum

Revert `write!` and `writeln!` to late drop temporaries

Closes (on master, but not on beta) #99684 by reverting the `write!` and `writeln!` parts of #96455.

argument position | before<br>#94868 | after<br>#94868 | after<br>#96455 | after<br>this PR | desired<br>(unimplementable)
--- |:---:|:---:|:---:|:---:|:---:
`write!($tmp, "…", …)` | **⸺late** | **⸺late** | *early⸺* | **⸺late** | **⸺late**
`write!(…, "…", $tmp)` | **⸺late** | **⸺late** | *early⸺* | **⸺late** | *early⸺*
`writeln!($tmp, "…", …)` | **⸺late** | **⸺late** | *early⸺* | **⸺late** | **⸺late**
`writeln!(…, "…", $tmp)` | **⸺late** | **⸺late** | *early⸺* | **⸺late** | *early⸺*
`print!("…", $tmp)` | **⸺late** | **⸺late** | *early⸺* | *early⸺* | *early⸺*
`println!("…", $tmp)` | *early⸺* | **⸺late** | *early⸺* | *early⸺* | *early⸺*
`eprint!("…", $tmp)` | **⸺late** | **⸺late** | *early⸺* | *early⸺* | *early⸺*
`eprintln!("…", $tmp)` | *early⸺* | **⸺late**| *early⸺* | *early⸺* | *early⸺*
`panic!("…", $tmp)` | *early⸺* | *early⸺* | *early⸺* | *early⸺* | *early⸺*

"Late drop" refers to dropping temporaries at the nearest semicolon **outside** of the macro invocation.

"Early drop" refers to dropping temporaries inside of the macro invocation.

23 months agoRollup merge of #99628 - vincenzopalazzo:macros/is_number_doc, r=joshtriplett
Dylan DPC [Thu, 28 Jul 2022 16:44:46 +0000 (22:14 +0530)]
Rollup merge of #99628 - vincenzopalazzo:macros/is_number_doc, r=joshtriplett

add more docs regarding ideographic numbers

This was discussed in the last lib meeting and I try to avoid forgetting to open a PR because I think having some docs can help people.

However, I think we need to discuss a little bit if this is enough or if we need to add more clarification? Maybe an example?

Inspiration Source: https://github.com/rust-lang/rust/issues/84056#issuecomment-1184725924

Including suggestion https://github.com/rust-lang/rust/pull/99626#issuecomment-1192983043 my bad command git close the PR

23 months agoUpdate thumbv4t_none_eabi.rs
Lokathor [Thu, 28 Jul 2022 16:43:05 +0000 (10:43 -0600)]
Update thumbv4t_none_eabi.rs

23 months agoAuto merge of #99780 - Nilstrieb:mir-opt-test-line-no, r=oli-obk
bors [Thu, 28 Jul 2022 16:22:19 +0000 (16:22 +0000)]
Auto merge of #99780 - Nilstrieb:mir-opt-test-line-no, r=oli-obk

Use line numbers relative to the function in mir-opt tests

As shown in #99770, the line numbers can be a big source of needless and confusing diffs. This PR adds a new flag `-Zmir-pretty-relative-line-numbers` to make them relative to the function declaration, which avoids most needless diffs from attribute changes.

`@JakobDegen` told me that there has been a zulip conversation about disabling line numbers with mixed opinions, so I'd like to get some feedback here, for this hopefully better solution.

r? rust-lang/wg-mir-opt

23 months ago--bless tests
Maybe Waffle [Thu, 28 Jul 2022 15:33:10 +0000 (19:33 +0400)]
--bless tests

23 months agoadd more docs regarding ideographic numbers
Vincenzo Palazzo [Fri, 22 Jul 2022 22:48:45 +0000 (22:48 +0000)]
add more docs regarding ideographic numbers

Signed-off-by: Vincenzo Palazzo <vincenzopalazzodev@gmail.com>
23 months agofix memchr features in workspace-hack
klensy [Thu, 28 Jul 2022 14:24:46 +0000 (17:24 +0300)]
fix memchr features in workspace-hack

23 months agofix: remove fake no_dead_strip for osx
csmoe [Thu, 28 Jul 2022 14:22:13 +0000 (22:22 +0800)]
fix: remove fake no_dead_strip for osx

23 months agoanonymize all bound vars, not just regions
lcnr [Mon, 25 Jul 2022 18:24:13 +0000 (20:24 +0200)]
anonymize all bound vars, not just regions

23 months ago`BoundVarReplacer`: trait object instead of 3 fns
lcnr [Mon, 25 Jul 2022 17:27:52 +0000 (19:27 +0200)]
`BoundVarReplacer`: trait object instead of 3 fns

23 months agoAuto merge of #99849 - Dylan-DPC:rollup-1yfpplw, r=Dylan-DPC
bors [Thu, 28 Jul 2022 13:32:35 +0000 (13:32 +0000)]
Auto merge of #99849 - Dylan-DPC:rollup-1yfpplw, r=Dylan-DPC

Rollup of 5 pull requests

Successful merges:

 - #99714 (Fix regression introduced with #99383)
 - #99723 (Allow using stable os::fd::raw items through unstable os::wasi module)
 - #99810 (Fix settings slider on small width screens)
 - #99837 (Avoid `Symbol` to `String` conversions)
 - #99846 (Refactor `UnresolvedImportError`)

Failed merges:

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

23 months agoimprove type mismatch error for functions
Maybe Waffle [Thu, 28 Jul 2022 13:29:47 +0000 (17:29 +0400)]
improve type mismatch error for functions

This also fixes the argument names in `report_closure_arg_mismatch`
(confusing expected/found)

23 months agoBuild rust demangler before running run-make tests
Tomasz Miąsko [Mon, 25 Jul 2022 00:00:00 +0000 (00:00 +0000)]
Build rust demangler before running run-make tests

23 months agoDiagnose missing make includes
Tomasz Miąsko [Mon, 25 Jul 2022 00:00:00 +0000 (00:00 +0000)]
Diagnose missing make includes

23 months agoMove coverage tests from run-make-fulldeps to run-make
Tomasz Miąsko [Mon, 25 Jul 2022 00:00:00 +0000 (00:00 +0000)]
Move coverage tests from run-make-fulldeps to run-make

23 months agobless mir opt tests
Nilstrieb [Wed, 27 Jul 2022 18:47:42 +0000 (20:47 +0200)]
bless mir opt tests

23 months agoFix small typo in Cargo.toml comment
Yotam Ofek [Thu, 28 Jul 2022 11:29:58 +0000 (14:29 +0300)]
Fix small typo in Cargo.toml comment

23 months agoRollup merge of #99846 - TaKO8Ki:refactor-UnresolvedImportError, r=davidtwco
Dylan DPC [Thu, 28 Jul 2022 11:08:35 +0000 (16:38 +0530)]
Rollup merge of #99846 - TaKO8Ki:refactor-UnresolvedImportError, r=davidtwco

Refactor `UnresolvedImportError`

This patch changes the type of `note` field in `UnresolvedImportError` to `Option<String>`.

23 months agoRollup merge of #99837 - TaKO8Ki:avoid-symbol-to-string-conversions, r=fee1-dead
Dylan DPC [Thu, 28 Jul 2022 11:08:34 +0000 (16:38 +0530)]
Rollup merge of #99837 - TaKO8Ki:avoid-symbol-to-string-conversions, r=fee1-dead

Avoid `Symbol` to `String` conversions

follow-up to #99508

23 months agoRollup merge of #99810 - GuillaumeGomez:fix-settings-slider-small-width, r=notriddle
Dylan DPC [Thu, 28 Jul 2022 11:08:31 +0000 (16:38 +0530)]
Rollup merge of #99810 - GuillaumeGomez:fix-settings-slider-small-width, r=notriddle

Fix settings slider on small width screens

Fixes #99794.

Screenshot of the fix:

![Screenshot from 2022-07-27 14-17-08](https://user-images.githubusercontent.com/3050060/181250007-55f982d1-89db-45b7-a4f1-0d1729e6a3e3.png)

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

23 months agoRollup merge of #99723 - bstrie:wasifd, r=yaahc
Dylan DPC [Thu, 28 Jul 2022 11:08:31 +0000 (16:38 +0530)]
Rollup merge of #99723 - bstrie:wasifd, r=yaahc

Allow using stable os::fd::raw items through unstable os::wasi module

This fixes a regression from stable to nightly.

Closes #99502.

23 months agoRollup merge of #99714 - ouz-a:issue_57961, r=oli-obk
Dylan DPC [Thu, 28 Jul 2022 11:08:30 +0000 (16:38 +0530)]
Rollup merge of #99714 - ouz-a:issue_57961, r=oli-obk

Fix regression introduced with #99383

Fixes #99642

23 months agoRemove Clean trait implementation for VariantData fields
Guillaume Gomez [Thu, 28 Jul 2022 11:08:08 +0000 (13:08 +0200)]
Remove Clean trait implementation for VariantData fields

23 months agoRemove Clean trait implementation for VariantStruct
Guillaume Gomez [Thu, 28 Jul 2022 11:05:19 +0000 (13:05 +0200)]
Remove Clean trait implementation for VariantStruct

23 months agotype alias covers whole return
ouz-a [Thu, 28 Jul 2022 10:52:49 +0000 (13:52 +0300)]
type alias covers whole return

23 months agoAuto merge of #99756 - fasterthanlime:ra-sync-and-pms-component, r=Mark-Simulacrum
bors [Thu, 28 Jul 2022 10:51:46 +0000 (10:51 +0000)]
Auto merge of #99756 - fasterthanlime:ra-sync-and-pms-component, r=Mark-Simulacrum

Sync `rust-analyzer`, add `rust-analyzer-proc-macro-srv` binary to Rustc component

As discussed earlier with `@jyn514` and `@pietroalbini,` I'm also going to use this PR to have `dist::Rustc` build the `rust-analyzer-proc-macro-srv` binary introduced in:

  * https://github.com/rust-lang/rust-analyzer/pull/12871

23 months agoupdate few deps
klensy [Tue, 26 Jul 2022 16:16:43 +0000 (19:16 +0300)]
update few deps

openssl-src v111.18.0+1.1.1n -> v111.22.0+1.1.1q
openssl-probe v0.1.2 -> v0.1.5
indoc v1.0.3 -> v1.0.6
bstr v0.2.13 -> v0.2.17
crc32fast v1.2.0 -> v1.3.2
diff v0.1.12 -> v0.1.13
ignore v0.4.17 -> v0.4.18
globset v0.4.5 -> v0.4.9
regex v1.5.5 -> v1.5.6

23 months agoUse line numbers relative to function in mir opt tests
Nilstrieb [Wed, 27 Jul 2022 18:42:07 +0000 (20:42 +0200)]
Use line numbers relative to function in mir opt tests

This adds a new option, `-Zmir-pretty-relative-line-numbers`, that
is then used in compiletest for the mir-opt tests.

23 months agocreate type alias
ouz-a [Thu, 28 Jul 2022 09:56:57 +0000 (12:56 +0300)]
create type alias

23 months agoRemove Clean trait implementation for ty::Visibility
Guillaume Gomez [Thu, 28 Jul 2022 09:52:59 +0000 (11:52 +0200)]
Remove Clean trait implementation for ty::Visibility

23 months agoremove an unnecessary line break
Takayuki Maeda [Thu, 28 Jul 2022 09:28:29 +0000 (18:28 +0900)]
remove an unnecessary line break

23 months agoUpdate custom.md
xtexChooser [Thu, 28 Jul 2022 09:21:04 +0000 (17:21 +0800)]
Update custom.md

23 months agochange the type of `note` field to `Option<String>`
Takayuki Maeda [Thu, 28 Jul 2022 09:17:55 +0000 (18:17 +0900)]
change the type of `note` field to `Option<String>`

23 months agoIntroduce an ArchiveBuilderBuilder
bjorn3 [Thu, 28 Jul 2022 09:07:49 +0000 (09:07 +0000)]
Introduce an ArchiveBuilderBuilder

This avoids monomorphizing all linker code for each codegen backend and
will allow passing in extra information to the archive builder from the
codegen backend.

23 months agoInline inject_dll_import_lib
bjorn3 [Thu, 28 Jul 2022 08:43:15 +0000 (08:43 +0000)]
Inline inject_dll_import_lib

23 months agoMove output argument from ArchiveBuilder::new to .build()
bjorn3 [Thu, 28 Jul 2022 08:39:19 +0000 (08:39 +0000)]
Move output argument from ArchiveBuilder::new to .build()

23 months agoAuto merge of #9253 - Serial-ATA:fix-fmt-err, r=flip1995
bors [Thu, 28 Jul 2022 07:54:15 +0000 (07:54 +0000)]
Auto merge of #9253 - Serial-ATA:fix-fmt-err, r=flip1995

Tell the user how to revert `dev setup intellij`

changelog: none

23 months agoTell the user how to revert `dev setup intellij`
Serial [Thu, 28 Jul 2022 07:40:21 +0000 (03:40 -0400)]
Tell the user how to revert `dev setup intellij`

23 months agoUse more idiomatic rust, comment for lint logic
Preston From [Thu, 28 Jul 2022 06:10:19 +0000 (00:10 -0600)]
Use more idiomatic rust, comment for lint logic

23 months agoavoid `Symbol` to `String` conversions
Takayuki Maeda [Thu, 28 Jul 2022 01:20:55 +0000 (10:20 +0900)]
avoid `Symbol` to `String` conversions

23 months agoAuto merge of #99182 - RalfJung:mitigate-uninit, r=scottmcm
bors [Thu, 28 Jul 2022 01:11:10 +0000 (01:11 +0000)]
Auto merge of #99182 - RalfJung:mitigate-uninit, r=scottmcm

mem::uninitialized: mitigate many incorrect uses of this function

Alternative to https://github.com/rust-lang/rust/pull/98966: fill memory with `0x01` rather than leaving it uninit. This is definitely bitewise valid for all `bool` and nonnull types, and also those `Option<&T>` that we started putting `noundef` on. However it is still invalid for `char` and some enums, and on references the `dereferenceable` attribute is still violated, so the generated LLVM IR still has UB -- but in fewer cases, and `dereferenceable` is hopefully less likely to cause problems than clearly incorrect range annotations.

This can make using `mem::uninitialized` a lot slower, but that function has been deprecated for years and we keep telling everyone to move to `MaybeUninit` because it is basically impossible to use `mem::uninitialized` correctly. For the cases where that hasn't helped (and all the old code out there that nobody will ever update), we can at least mitigate the effect of using this API. Note that this is *not* in any way a stable guarantee -- it is still UB to call `mem::uninitialized::<bool>()`, and Miri will call it out as such.

This is somewhat similar to https://github.com/rust-lang/rust/pull/87032, which proposed to make `uninitialized` return a buffer filled with 0x00. However
- That PR also proposed to reduce the situations in which we panic, which I don't think we should do at this time.
- The 0x01 bit pattern means that nonnull requirements are satisfied, which (due to references) is the most common validity invariant.

`@5225225` I hope I am using `cfg(sanitize)` the right way; I was not sure for which ones to test here.
Cc https://github.com/rust-lang/rust/issues/66151
Fixes https://github.com/rust-lang/rust/issues/87675

23 months agoAuto merge of #9182 - Serial-ATA:new_lint-type-flag, r=xFrednet
bors [Wed, 27 Jul 2022 22:17:29 +0000 (22:17 +0000)]
Auto merge of #9182 - Serial-ATA:new_lint-type-flag, r=xFrednet

Add `--type` flag to `dev new_lint`

changelog: none

This only works with directories, `--type={copies, doc, ...}` won't work. Should they be counted?

23 months agoAuto merge of #99725 - lcnr:dedup-region_bound_pairs, r=compiler-errors
bors [Wed, 27 Jul 2022 22:02:14 +0000 (22:02 +0000)]
Auto merge of #99725 - lcnr:dedup-region_bound_pairs, r=compiler-errors

use `FxIndexSet` for `region_bound_pairs`

should help with #99217 and might generally be a perf improvement.

r? types

23 months agoDocument `--type` flag
Serial [Wed, 27 Jul 2022 00:23:50 +0000 (20:23 -0400)]
Document `--type` flag

23 months agoadd suggestion when there is a impl of external trait on pointer
Vincenzo Palazzo [Sun, 24 Jul 2022 17:45:21 +0000 (17:45 +0000)]
add suggestion when there is a impl of external trait on pointer

Signed-off-by: Vincenzo Palazzo <vincenzopalazzodev@gmail.com>
23 months agoAuto merge of #99816 - GuillaumeGomez:rollup-tyobksa, r=GuillaumeGomez
bors [Wed, 27 Jul 2022 18:22:33 +0000 (18:22 +0000)]
Auto merge of #99816 - GuillaumeGomez:rollup-tyobksa, r=GuillaumeGomez

Rollup of 7 pull requests

Successful merges:

 - #94247 (Fix slice::ChunksMut aliasing)
 - #99358 (Allow `ValTree::try_to_raw_bytes` on `u8` array)
 - #99651 (Deeply deny fn and raw ptrs in const generics)
 - #99710 (lint: add bad opt access internal lint)
 - #99717 (Add some comments to the docs issue template to clarify)
 - #99728 (Clean up HIR-based lifetime resolution)
 - #99812 (Fix headings colors)

Failed merges:

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

23 months agorustdoc: remove Clean trait impl for ty::GenericParamDef
Michael Howell [Wed, 27 Jul 2022 18:13:39 +0000 (11:13 -0700)]
rustdoc: remove Clean trait impl for ty::GenericParamDef

23 months agorustdoc: remove Clean trait impl for hir::Term
Michael Howell [Wed, 27 Jul 2022 18:08:22 +0000 (11:08 -0700)]
rustdoc: remove Clean trait impl for hir::Term

23 months agorustdoc: remove Clean trait impl for ty::Term
Michael Howell [Wed, 27 Jul 2022 18:04:54 +0000 (11:04 -0700)]
rustdoc: remove Clean trait impl for ty::Term

23 months agoRollup merge of #99812 - GuillaumeGomez:fix-headings-colors, r=jsha,notriddle
Guillaume Gomez [Wed, 27 Jul 2022 15:55:08 +0000 (17:55 +0200)]
Rollup merge of #99812 - GuillaumeGomez:fix-headings-colors, r=jsha,notriddle

Fix headings colors

Fixes #99797.

![image](https://user-images.githubusercontent.com/3050060/181260966-49faf9d3-f6b8-4de4-bc7d-ed9f0467cf68.png)

cc `@jsha`
r? `@notriddle`

23 months agoRollup merge of #99728 - cjgillot:ast-lifetimes-anon-clean, r=petrochenkov
Guillaume Gomez [Wed, 27 Jul 2022 15:55:07 +0000 (17:55 +0200)]
Rollup merge of #99728 - cjgillot:ast-lifetimes-anon-clean, r=petrochenkov

Clean up HIR-based lifetime resolution

Based on https://github.com/rust-lang/rust/pull/97313.

Fixes #98932.

r? `@petrochenkov`

23 months agoRollup merge of #99728 - cjgillot:ast-lifetimes-anon-clean, r=petrochenkov
Guillaume Gomez [Wed, 27 Jul 2022 15:55:07 +0000 (17:55 +0200)]
Rollup merge of #99728 - cjgillot:ast-lifetimes-anon-clean, r=petrochenkov

Clean up HIR-based lifetime resolution

Based on https://github.com/rust-lang/rust/pull/97313.

Fixes #98932.

r? `@petrochenkov`

23 months agoRollup merge of #99717 - JohnTitor:upd-docs-issue-tmpl, r=Mark-Simulacrum
Guillaume Gomez [Wed, 27 Jul 2022 15:55:06 +0000 (17:55 +0200)]
Rollup merge of #99717 - JohnTitor:upd-docs-issue-tmpl, r=Mark-Simulacrum

Add some comments to the docs issue template to clarify

Newcomers may not know that some docs have their own repositories (e.g. the book, the reference), or that the documentation and rustdoc are different.
Actually, this template was used to report an issue related to the book: https://github.com/rust-lang/rust/issues/99699
This adds some comments to clarify the above things. I'm not sure if the current wording is the best, any suggestion would be helpful!

Signed-off-by: Yuki Okushi <jtitor@2k36.org>
23 months agoRollup merge of #99710 - davidtwco:internal-lint-opts, r=lcnr
Guillaume Gomez [Wed, 27 Jul 2022 15:55:05 +0000 (17:55 +0200)]
Rollup merge of #99710 - davidtwco:internal-lint-opts, r=lcnr

lint: add bad opt access internal lint

Prompted by [Zulip discussion](https://rust-lang.zulipchat.com/#narrow/stream/131828-t-compiler/topic/sess.2Ecrate_types.28.29.20vs.20sess.2Eopts.2Ecrate_types/near/290682847).

Some command-line options accessible through `sess.opts` are best accessed through wrapper functions on `Session`, `TyCtxt` or otherwise, rather than through field access on the option struct in the `Session`.

Adds a new lint which triggers on those options that should be accessed through a wrapper function so that this is prohibited. Options are annotated with a new attribute `rustc_lint_opt_deny_field_access` which can specify the error message (i.e. "use this other function instead") to be emitted.

A simpler alternative would be to simply rename the options in the option type so that it is clear they should not be used, however this doesn't prevent uses, just discourages them. Another alternative would be to make the option fields private, and adding accessor functions on the option types, however the wrapper functions sometimes rely on additional state from `Session` or `TyCtxt` which wouldn't be available in an function on the option type, so the accessor would simply make the field available and its use would be discouraged too.

**Leave a comment if there's an option I should add this to.**

23 months agoRollup merge of #99651 - compiler-errors:fn-and-raw-ptr-in-const-generics, r=oli-obk
Guillaume Gomez [Wed, 27 Jul 2022 15:55:04 +0000 (17:55 +0200)]
Rollup merge of #99651 - compiler-errors:fn-and-raw-ptr-in-const-generics, r=oli-obk

Deeply deny fn and raw ptrs in const generics

I think this is right -- just because we wrap a fn ptr in a wrapper type does not mean we should allow it in a const parameter.

We now reject both of these in the same way:

```
#![feature(adt_const_params)]

#[derive(Eq, PartialEq)]
struct Wrapper();

fn foo<const W: Wrapper>() {}

fn foo2<const F: fn()>() {}
```

This does regress one test (`src/test/ui/consts/refs_check_const_eq-issue-88384.stderr`), but I'm not sure it should've passed in the first place.

cc: ``@b-naber`` who introduced that test^
fixes #99641

23 months agoRollup merge of #99358 - compiler-errors:issue-99325, r=oli-obk
Guillaume Gomez [Wed, 27 Jul 2022 15:55:03 +0000 (17:55 +0200)]
Rollup merge of #99358 - compiler-errors:issue-99325, r=oli-obk

Allow `ValTree::try_to_raw_bytes` on `u8` array

Fixes #99325

cc `@b-naber` I think who touched this last in 705d818bd52a6324d5e7693cc4306457395eebc8

23 months agoRollup merge of #94247 - saethlin:chunksmut-aliasing, r=the8472
Guillaume Gomez [Wed, 27 Jul 2022 15:55:01 +0000 (17:55 +0200)]
Rollup merge of #94247 - saethlin:chunksmut-aliasing, r=the8472

Fix slice::ChunksMut aliasing

Fixes https://github.com/rust-lang/rust/issues/94231, details in that issue.
cc `@RalfJung`

This isn't done just yet, all the safety comments are placeholders. But otherwise, it seems to work.

I don't really like this approach though. There's a lot of unsafe code where there wasn't before, but as far as I can tell the only other way to uphold the aliasing requirement imposed by `__iterator_get_unchecked` is to use raw slices, which I think require the same amount of unsafe code. All that would do is tie the `len` and `ptr` fields together.

Oh I just looked and I'm pretty sure that `ChunksExactMut`, `RChunksMut`, and `RChunksExactMut` also need to be patched. Even more reason to put up a draft.

23 months agoAuto merge of #99731 - ehuss:let-chain-bracket-check, r=compiler-errors
bors [Wed, 27 Jul 2022 15:32:01 +0000 (15:32 +0000)]
Auto merge of #99731 - ehuss:let-chain-bracket-check, r=compiler-errors

Remove let-chain close brace check.

#98633 added some checks to forbid let-expressions that aren't in a let chain. This check looks at the preceding token to determine if it is a valid let-chain position. One of those tokens it checks is the close brace `}`. However, to my understanding, it is not possible for a let chain to be preceded by a close brace. This PR removes the check to avoid any confusion.

This is a followup to the discussion at https://github.com/rust-lang/rust/pull/98633#pullrequestreview-1030962803. It wasn't clear what issues the original PR ran into, but I have run the full set of CI tests and nothing failed.  I also can't conceive of a situation where this would be possible.  This doesn't reject any valid code, I'm just removing it to avoid confusion to anyone looking at this code in the future.

23 months agoAdd GUI tests for headings border and text color
Guillaume Gomez [Wed, 27 Jul 2022 13:36:43 +0000 (15:36 +0200)]
Add GUI tests for headings border and text color

23 months agoMake CFI tests opaque pointers compatible
Nikita Popov [Wed, 27 Jul 2022 13:07:58 +0000 (15:07 +0200)]
Make CFI tests opaque pointers compatible

23 months agoAllow using stable os::fd::raw items through unstable os::wasi module
bstrie [Wed, 27 Jul 2022 14:20:21 +0000 (10:20 -0400)]
Allow using stable os::fd::raw items through unstable os::wasi module

This fixes a regression from stable to nightly.

Closes #99502.

23 months agoRemove outdated rustc_allocator test
Nikita Popov [Wed, 27 Jul 2022 13:04:20 +0000 (15:04 +0200)]
Remove outdated rustc_allocator test

This attribute now does more than just place noalias on the return,
and has specific requirements for the signature.

Drop the test entirely, as we already check __rust_alloc attributes
in other codegen tests.

23 months agoAlso wait on other threads if a WorkerFatalError occurs
Nikita Popov [Wed, 27 Jul 2022 11:07:48 +0000 (13:07 +0200)]
Also wait on other threads if a WorkerFatalError occurs

This means that codegen_aborted may be set when new codegen
requests arrive, so drop some related assertions. The new work
will simply be ignored.

23 months agoReliably signal coordinator thread on panic during ongoing codegen
Nikita Popov [Mon, 25 Jul 2022 12:04:26 +0000 (14:04 +0200)]
Reliably signal coordinator thread on panic during ongoing codegen

Replace the separate AbortCodegenOnDrop guard by integrating this
functionality into OngoingCodegen (or rather, the Coordinator part
of it). This ensures that we send a CodegenAborted message and
wait for workers to finish even if the panic occurs outside
codegen_crate() (e.g. inside join_codegen()).

This requires some minor changes to the handling of CodegenAborted,
as it can now occur when the main thread is LLVMing rather than
Codegenning.

23 months agoUpdate codegen test for opaque pointers
Nikita Popov [Tue, 19 Jul 2022 13:54:31 +0000 (15:54 +0200)]
Update codegen test for opaque pointers

23 months agoAdd elementtype attributes for llvm.arm.ldrex/strex intrinsics
Nikita Popov [Tue, 19 Jul 2022 13:03:39 +0000 (15:03 +0200)]
Add elementtype attributes for llvm.arm.ldrex/strex intrinsics

These intrinsics (and a few more, but there are the only ones
exposed by stdarch) require an elementtype attribute in LLVM 15.

23 months agoShip `rust-analyzer-proc-macro-srv` binary with dist::Rustc
Amos Wenger [Tue, 26 Jul 2022 14:25:48 +0000 (16:25 +0200)]
Ship `rust-analyzer-proc-macro-srv` binary with dist::Rustc

This builds `src/tools/rust-analyzer/crates/proc-macro-srv-cli` and
ships it as part of Rustc's dist component. This allows rust-analyzer's
proc macro support to work on all rustc versions (stable, beta and
nightly) starting now.

23 months agoFix headings border
Guillaume Gomez [Wed, 27 Jul 2022 13:36:27 +0000 (15:36 +0200)]
Fix headings border

23 months agoFix invalid css property value
Guillaume Gomez [Wed, 27 Jul 2022 13:00:43 +0000 (15:00 +0200)]
Fix invalid css property value

23 months agoFix linkage-attr/issue-10755.rs ui test on WSL
Nilstrieb [Wed, 27 Jul 2022 12:05:05 +0000 (14:05 +0200)]
Fix linkage-attr/issue-10755.rs ui test on WSL

It checked for a "not found", but on WSL with appendWindowsPath=true,
PermissionDenied is the error instead.

23 months agoAdd GUI test for item info position
Guillaume Gomez [Tue, 26 Jul 2022 19:40:01 +0000 (21:40 +0200)]
Add GUI test for item info position

23 months agoAdd GUI test for settings in small device
Guillaume Gomez [Wed, 27 Jul 2022 12:45:07 +0000 (14:45 +0200)]
Add GUI test for settings in small device

23 months agoFix settings display on small screen size
Guillaume Gomez [Wed, 27 Jul 2022 12:24:47 +0000 (14:24 +0200)]
Fix settings display on small screen size

23 months agoAuto merge of #99802 - JohnTitor:rollup-uaklql1, r=JohnTitor
bors [Wed, 27 Jul 2022 12:32:54 +0000 (12:32 +0000)]
Auto merge of #99802 - JohnTitor:rollup-uaklql1, r=JohnTitor

Rollup of 5 pull requests

Successful merges:

 - #99079 (Check that RPITs constrained by a recursive call in a closure are compatible)
 - #99704 (Add `Self: ~const Trait` to traits with `#[const_trait]`)
 - #99769 (Sync rustc_codegen_cranelift)
 - #99783 (rustdoc: remove Clean trait impls for more items)
 - #99789 (Refactor: use `pluralize!`)

Failed merges:

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

23 months agoFix process-spawn-nonexistent on WSL
Nilstrieb [Wed, 27 Jul 2022 11:58:29 +0000 (13:58 +0200)]
Fix process-spawn-nonexistent on WSL

If appendWindowsPath is set to true (the default IIRC), running invalid
commands returns PermissionDenied instead of NotFound.

23 months agodoc/rustc: describe the uefi target platforms
David Rheinsberg [Tue, 26 Jul 2022 12:39:01 +0000 (14:39 +0200)]
doc/rustc: describe the uefi target platforms

Add a `platform-support` entry to the rustc-docs for the different
`*-unknown-uefi` targets. This describes in detail how this platform
works, a few basic examples, and how to compile for the platform.

Red Hat is sponsoring my work on this platform, so I am putting myself
down as target maintainer. Co-maintainers are more than welcome to join
me in the effort. Communication is going on off-list to coordinate the
different efforts.

Note that the ultimate goal is to move the UEFI targets to Tier-2 so
bootloaders can be more easily supported in commercial products. This
documentation is the first step towards that goal, but should be a
viable documentation even for the current Tier-3 status of the targets.

I also want to point out that there is an ongoing GSoC-effort to port
the rust standard library to UEFI (by Ayush Singh). While this work is
not necessarily required to get to Tier-2, we definitely should
coordinate the efforts and update the documentation as soon as any such
ports are merged.

Note that the targets are already used by multiple commercial and non
commercial production systems, including, but not limited to:

 * Tianocore-EDK2 (Official UEFI SDK by Intel) comes with rust support
   in its staging repository (not part of any release, yet).
   (https://github.com/tianocore/edk2-staging/tree)
 * Intel's research program "Project Mu" uses the rust UEFI targets to
   show possible future replacements for Tianocore-EDK2.
 * The Rust OS "Redox" uses the UEFI targets for its bootloader.
   (https://www.redox-os.org/)
 * The hugely popular in-depth documentation of OS development in Rust
   by Philipp Oppermann uses the UEFI targets.
   (https://os.phil-opp.com/)

Signed-off-by: David Rheinsberg <david.rheinsberg@gmail.com>
23 months agoadd tests and comment
ouz-a [Wed, 27 Jul 2022 11:43:46 +0000 (14:43 +0300)]
add tests and comment

23 months agoUpdate mentions to `rustc_metadata::rmeta::Lazy`
Yuki Okushi [Wed, 27 Jul 2022 11:09:46 +0000 (20:09 +0900)]
Update mentions to `rustc_metadata::rmeta::Lazy`

Signed-off-by: Yuki Okushi <jtitor@2k36.org>
23 months agolint: add bad opt access internal lint
David Wood [Mon, 25 Jul 2022 12:02:39 +0000 (13:02 +0100)]
lint: add bad opt access internal lint

Some command-line options accessible through `sess.opts` are best
accessed through wrapper functions on `Session`, `TyCtxt` or otherwise,
rather than through field access on the option struct in the `Session`.

Adds a new lint which triggers on those options that should be accessed
through a wrapper function so that this is prohibited. Options are
annotated with a new attribute `rustc_lint_opt_deny_field_access` which
can specify the error message (i.e. "use this other function instead")
to be emitted.

A simpler alternative would be to simply rename the options in the
option type so that it is clear they should not be used, however this
doesn't prevent uses, just discourages them. Another alternative would
be to make the option fields private, and adding accessor functions on
the option types, however the wrapper functions sometimes rely on
additional state from `Session` or `TyCtxt` which wouldn't be available
in an function on the option type, so the accessor would simply make the
field available and its use would be discouraged too.

Signed-off-by: David Wood <david.wood@huawei.com>
23 months agolint: add bad opt access internal lint
David Wood [Mon, 25 Jul 2022 12:02:39 +0000 (13:02 +0100)]
lint: add bad opt access internal lint

Some command-line options accessible through `sess.opts` are best
accessed through wrapper functions on `Session`, `TyCtxt` or otherwise,
rather than through field access on the option struct in the `Session`.

Adds a new lint which triggers on those options that should be accessed
through a wrapper function so that this is prohibited. Options are
annotated with a new attribute `rustc_lint_opt_deny_field_access` which
can specify the error message (i.e. "use this other function instead")
to be emitted.

A simpler alternative would be to simply rename the options in the
option type so that it is clear they should not be used, however this
doesn't prevent uses, just discourages them. Another alternative would
be to make the option fields private, and adding accessor functions on
the option types, however the wrapper functions sometimes rely on
additional state from `Session` or `TyCtxt` which wouldn't be available
in an function on the option type, so the accessor would simply make the
field available and its use would be discouraged too.

Signed-off-by: David Wood <david.wood@huawei.com>
23 months agosession: disable internal lints for rustdoc
David Wood [Tue, 26 Jul 2022 10:42:27 +0000 (11:42 +0100)]
session: disable internal lints for rustdoc

If an internal lint uses `typeck_results` or similar queries then that
can result in rustdoc checking code that it shouldn't (e.g. from other
platforms) and emit compilation errors.

Signed-off-by: David Wood <david.wood@huawei.com>
23 months agoAdd some comments to the docs issue template to clarify
Yuki Okushi [Mon, 25 Jul 2022 13:50:16 +0000 (22:50 +0900)]
Add some comments to the docs issue template to clarify

Signed-off-by: Yuki Okushi <jtitor@2k36.org>
23 months agoRollup merge of #99789 - TaKO8Ki:use-pluralize-macro, r=compiler-errors
Yuki Okushi [Wed, 27 Jul 2022 10:05:36 +0000 (19:05 +0900)]
Rollup merge of #99789 - TaKO8Ki:use-pluralize-macro, r=compiler-errors

Refactor: use `pluralize!`

Use `pluralize!` in more places

23 months agoRollup merge of #99783 - notriddle:notriddle/clean-trait-removal, r=GuillaumeGomez
Yuki Okushi [Wed, 27 Jul 2022 10:05:35 +0000 (19:05 +0900)]
Rollup merge of #99783 - notriddle:notriddle/clean-trait-removal, r=GuillaumeGomez

rustdoc: remove Clean trait impls for more items

Follow up to #99638 and #99672

23 months agoRollup merge of #99769 - bjorn3:sync_cg_clif-2022-07-26, r=bjorn3
Yuki Okushi [Wed, 27 Jul 2022 10:05:34 +0000 (19:05 +0900)]
Rollup merge of #99769 - bjorn3:sync_cg_clif-2022-07-26, r=bjorn3

Sync rustc_codegen_cranelift

I did a large refactoring of the intrinsics module to remove the intrinsic_match macro which is not very clear to other people. This also enables rustfmt to run on this code. While I already did a sync yesterday, I am going to do another sync again to avoid potential conflicts as those will likely be painful to resolve.

r? ``@ghost``

``@rustbot`` label +A-codegen +A-cranelift +T-compiler

23 months agoRollup merge of #99704 - fee1-dead-contrib:add_self_tilde_const_trait, r=oli-obk
Yuki Okushi [Wed, 27 Jul 2022 10:05:33 +0000 (19:05 +0900)]
Rollup merge of #99704 - fee1-dead-contrib:add_self_tilde_const_trait, r=oli-obk

Add `Self: ~const Trait` to traits with `#[const_trait]`

r? `@oli-obk`

23 months agoRollup merge of #99079 - compiler-errors:issue-99073, r=oli-obk
Yuki Okushi [Wed, 27 Jul 2022 10:05:32 +0000 (19:05 +0900)]
Rollup merge of #99079 - compiler-errors:issue-99073, r=oli-obk

Check that RPITs constrained by a recursive call in a closure are compatible

Fixes #99073

Adapts a similar visitor pattern to `find_opaque_ty_constraints` (that we use to check TAITs), but with some changes:
0. Only walk the "OnlyBody" children, instead of all items in the RPIT's defining scope
1. Only walk through the body's children if we found a constraining usage
2. Don't actually do any inference, just do a comparison and error if they're mismatched

----

r? `@oli-obk` -- you know all this impl-trait stuff best... is this the right approach? I can explain the underlying issue better if you'd like, in case that might reveal a better solution. Not sure if it's possible to gather up the closure's defining usages of the RPIT while borrowck'ing the outer function, that might be a better place to put this check...

23 months agolint: add comment about diag lints in group
David Wood [Tue, 26 Jul 2022 10:46:01 +0000 (11:46 +0100)]
lint: add comment about diag lints in group

Add a brief comment explaining why the diagnostic migration lints aren't
included in the `rustc::internal` diagnostic group.

Signed-off-by: David Wood <david.wood@huawei.com>
23 months agoAuto merge of #98748 - saethlin:optimize-bufreader, r=Mark-Simulacrum
bors [Wed, 27 Jul 2022 09:49:06 +0000 (09:49 +0000)]
Auto merge of #98748 - saethlin:optimize-bufreader, r=Mark-Simulacrum

Remove some redundant checks from BufReader

The implementation of BufReader contains a lot of redundant checks. While any one of these checks is not particularly expensive to execute, especially when taken together they dramatically inhibit LLVM's ability to make subsequent optimizations by confusing data flow increasing the code size of anything that uses BufReader.

In particular, these changes have a ~2x increase on the benchmark that this adds a `black_box` to. I'm adding that `black_box` here just in case LLVM gets clever enough to remove the reads entirely. Right now it can't, but these optimizations are really setting it up to do so.

We get this optimization by factoring all the actual buffer management and bounds-checking logic into a new module inside `bufreader` with a new `Buffer` type. This makes it much easier to ensure that we have correctly encapsulated the management of the region of the buffer that we have read bytes into, and it lets us provide a new faster way to do small reads. `Buffer::consume_with` lets a caller do a read from the buffer with a single bounds check, instead of the double-check that's required to use `buffer` + `consume`.

Unfortunately I'm not aware of a lot of open-source usage of `BufReader` in perf-critical environments. Some time ago I tweaked this code because I saw `BufReader` in a profile at work, and I contributed some benchmarks to the `bincode` crate which exercise `BufReader::buffer`. These changes appear to help those benchmarks at little, but all these sorts of benchmarks are kind of fragile so I'm wary of quoting anything specific.

23 months agoAuto merge of #9249 - JohnTitor:book-prefer-checkout-v3, r=flip1995
bors [Wed, 27 Jul 2022 08:20:55 +0000 (08:20 +0000)]
Auto merge of #9249 - JohnTitor:book-prefer-checkout-v3, r=flip1995

Use `action/checkout@v3` in the book

As this type of document is often copied/pasted, using a newer version of `actions/checkout` would be better.

changelog: none

Signed-off-by: Yuki Okushi <jtitor@2k36.org>
23 months agoUse `action/checkout@v3` in the book
Yuki Okushi [Wed, 27 Jul 2022 07:49:34 +0000 (16:49 +0900)]
Use `action/checkout@v3` in the book

Signed-off-by: Yuki Okushi <jtitor@2k36.org>
23 months agoAuto merge of #99778 - ehuss:update-cargo, r=ehuss
bors [Wed, 27 Jul 2022 06:59:51 +0000 (06:59 +0000)]
Auto merge of #99778 - ehuss:update-cargo, r=ehuss

Update cargo

5 commits in d8d30a75376f78bb0fabe3d28ee9d87aa8035309..85b500ccad8cd0b63995fd94a03ddd4b83f7905b
2022-07-19 13:59:17 +0000 to 2022-07-24 21:10:46 +0000
- Make the empty rustc-wrapper test more explicit. (rust-lang/cargo#10899)
- expand RUSTC_WRAPPER docs (rust-lang/cargo#10896)
- Stabilize Workspace Inheritance (rust-lang/cargo#10859)
- Fix typo in unstable docs: s/PROGJCT/PROJECT/ (rust-lang/cargo#10890)
- refactor(source): Open query API for adding more types of queries (rust-lang/cargo#10883)

23 months agouse check_region_obligations_and_report_errors in more places to avoid ICEs
Michael Goulet [Wed, 27 Jul 2022 05:27:45 +0000 (05:27 +0000)]
use check_region_obligations_and_report_errors in more places to avoid ICEs

23 months agoAuto merge of #99792 - JohnTitor:rollup-20i7ewx, r=JohnTitor
bors [Wed, 27 Jul 2022 04:18:49 +0000 (04:18 +0000)]
Auto merge of #99792 - JohnTitor:rollup-20i7ewx, r=JohnTitor

Rollup of 8 pull requests

Successful merges:

 - #98583 (Stabilize Windows `FileTypeExt` with `is_symlink_dir` and `is_symlink_file`)
 - #99698 (Prefer visibility map parents that are not `doc(hidden)` first)
 - #99700 (Add a clickable link to the layout section)
 - #99712 (passes: port more of `check_attr` module)
 - #99759 (Remove dead code from cg_llvm)
 - #99765 (Don't build std for *-uefi targets)
 - #99771 (Update pulldown-cmark version to 0.9.2 (fixes url encoding for some chars))
 - #99775 (rustdoc: do not allocate String when writing path full name)

Failed merges:

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

23 months agoRollup merge of #99775 - notriddle:notriddle/as-str, r=camelid
Yuki Okushi [Wed, 27 Jul 2022 02:52:59 +0000 (11:52 +0900)]
Rollup merge of #99775 - notriddle:notriddle/as-str, r=camelid

rustdoc: do not allocate String when writing path full name

No idea if this makes any perf difference, but it just seems like premature pessimisation to use String when str will do.

23 months agoRollup merge of #99771 - GuillaumeGomez:update-pulldown-cmark, r=Urgau
Yuki Okushi [Wed, 27 Jul 2022 02:52:58 +0000 (11:52 +0900)]
Rollup merge of #99771 - GuillaumeGomez:update-pulldown-cmark, r=Urgau

Update pulldown-cmark version to 0.9.2 (fixes url encoding for some chars)

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

r? ``@Dylan-DPC``

23 months agoRollup merge of #99765 - nicholasbishop:bishop-disable-uefi-std-build, r=jyn514
Yuki Okushi [Wed, 27 Jul 2022 02:52:57 +0000 (11:52 +0900)]
Rollup merge of #99765 - nicholasbishop:bishop-disable-uefi-std-build, r=jyn514

Don't build std for *-uefi targets

https://github.com/rust-lang/rust/issues/97322