]> git.lizzy.rs Git - rust.git/log
rust.git
21 months agoRollup merge of #102468 - RalfJung:tidy, r=jyn514
Michael Howell [Thu, 29 Sep 2022 17:15:20 +0000 (10:15 -0700)]
Rollup merge of #102468 - RalfJung:tidy, r=jyn514

tidy: make rustc dependency error less confusing

The current wording leads to very confusing messages:
```
tidy error: Dependencies for main workspace not explicitly permitted:
* unicode-ident 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)
```
Miri is part of that workspace, and there never was a problem adding Miri dependencies. The actual error is that due to a crate bump this now showed up as a rustc dependency, and *those* are restricted.

21 months agoRollup merge of #102447 - notriddle:notriddle/method-toggle, r=jsha
Michael Howell [Thu, 29 Sep 2022 17:15:19 +0000 (10:15 -0700)]
Rollup merge of #102447 - notriddle:notriddle/method-toggle, r=jsha

rustdoc: add method spacing to trait methods

More cleanup for 8846c0853d8687fda0e5f23f6687b03b243980ee, this time in trait layouts when things are collapsed.

This PR makes two changes to the appearance of trait pages:

* It adds the `method-toggle` class to method toggles on traits, making the DOM more consistent with type pages (which already have this class).

  ## Before

  ![image](https://user-images.githubusercontent.com/1593513/192914353-ed17e1eb-df1d-480b-9998-3b5e8283b0ee.png)

  ## After

  ![image](https://user-images.githubusercontent.com/1593513/192914570-bdd0f2e1-5254-4e2e-9576-a797b82b3b3b.png)

* It adds a bottom margin to docblocks nested directly in the implementors list, giving it a similar appearance to if it was nested within a toggle.

  ## Before

  ![image](https://user-images.githubusercontent.com/1593513/192914503-1c3f39d5-690f-44ec-8f11-385302477d04.png)

  ## After

  ![image](https://user-images.githubusercontent.com/1593513/192914702-cbce4b3b-5cc6-49dc-b7f8-73be9e76791c.png)

21 months agoRollup merge of #102442 - notriddle:notriddle/header-weight, r=GuillaumeGomez
Michael Howell [Thu, 29 Sep 2022 17:15:19 +0000 (10:15 -0700)]
Rollup merge of #102442 - notriddle:notriddle/header-weight, r=GuillaumeGomez

rustdoc: remove bad CSS font-weight on `.impl`, `.method`, etc

This line was added in c494a06064017f307a8d9dc4797e614d2ed99143, because at the time, the headers had these classes on them. Now, the headers are children of the `<section>` with the class on it.

This commit also adds a test case, to make sure the srclink font weight does not regress again.

21 months agoRollup merge of #102437 - notriddle:notriddle/margin-top-h2, r=jsha
Michael Howell [Thu, 29 Sep 2022 17:15:18 +0000 (10:15 -0700)]
Rollup merge of #102437 - notriddle:notriddle/margin-top-h2, r=jsha

rustdoc: cut margin-top from first header in docblock

Fixes a regression caused by 8846c0853d8687fda0e5f23f6687b03b243980ee, where a header's top margin used to be collapsed, but isn't any more.

## Before

![image](https://user-images.githubusercontent.com/1593513/192893092-8e158bf7-ae18-41ef-8f11-6f34c724d345.png)

## After

![image](https://user-images.githubusercontent.com/1593513/192893139-d6ee06bf-9c0b-4194-bd5d-636312c89367.png)

21 months agoRollup merge of #102426 - sunfishcode:sunfishcode/no-wasm-init-memory, r=nagisa
Michael Howell [Thu, 29 Sep 2022 17:15:18 +0000 (10:15 -0700)]
Rollup merge of #102426 - sunfishcode:sunfishcode/no-wasm-init-memory, r=nagisa

Don't export `__wasm_init_memory` on WebAssembly.

Since #72889, the Rust wasm target doesn't use --passive-segments, so remove the `--export=__wasm_init_memory`.

As documented in the [tool-conventions Linking convention], `__wasm_init_memory` is not intended to be exported.

[tool-conventions Linking convention]: https://github.com/WebAssembly/tool-conventions/blob/7c064f304858f67ebf22964a84b7e9658e29557a/Linking.md#shared-memory-and-passive-segments

21 months agoRollup merge of #102214 - cassaundra:fix-format-args-span, r=cjgillot
Michael Howell [Thu, 29 Sep 2022 17:15:17 +0000 (10:15 -0700)]
Rollup merge of #102214 - cassaundra:fix-format-args-span, r=cjgillot

Fix span of byte-escaped left format args brace

Fix #102057 (see issue for example).

Previously, the use of escaped left braces (`\x7B`) in format args resulted in an incorrectly offset span. This patch fixes that by considering any escaped characters within the string instead of using a constant offset.

21 months agomore clear function and variable names
Ralf Jung [Thu, 29 Sep 2022 14:09:14 +0000 (16:09 +0200)]
more clear function and variable names

21 months agoAuto merge of #102471 - Dylan-DPC:rollup-ij3okjt, r=Dylan-DPC
bors [Thu, 29 Sep 2022 13:27:28 +0000 (13:27 +0000)]
Auto merge of #102471 - Dylan-DPC:rollup-ij3okjt, r=Dylan-DPC

Rollup of 7 pull requests

Successful merges:

 - #102336 (Fix associated type bindings with anon const in GAT position)
 - #102342 (Add negation methods for signed non-zero integers.)
 - #102385 (Don't export `__heap_base` and `__data_end` on wasm32-wasi.)
 - #102435 (Improve example of Iterator::reduce)
 - #102436 (rustdoc: clean up "normalize.css 8" input override CSS)
 - #102452 (fix minor ungrammatical sentence)
 - #102455 (Use let-chaining in `WhileTrue::check_expr`.)

Failed merges:

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

21 months agoRollup merge of #102455 - nnethercote:WhileTrue-check_expr, r=lqd
Dylan DPC [Thu, 29 Sep 2022 12:43:22 +0000 (18:13 +0530)]
Rollup merge of #102455 - nnethercote:WhileTrue-check_expr, r=lqd

Use let-chaining in `WhileTrue::check_expr`.

This has been bugging me for a while.

r? `@lqd`

21 months agoRollup merge of #102452 - granolocks:grammar-tweak, r=thomcc
Dylan DPC [Thu, 29 Sep 2022 12:43:21 +0000 (18:13 +0530)]
Rollup merge of #102452 - granolocks:grammar-tweak, r=thomcc

fix minor ungrammatical sentence

This fixes an innocuous ungrammatical sentence in example code in the  `TryFrom` documentation.

21 months agoRollup merge of #102436 - notriddle:notriddle/normalize-form, r=GuillaumeGomez
Dylan DPC [Thu, 29 Sep 2022 12:43:21 +0000 (18:13 +0530)]
Rollup merge of #102436 - notriddle:notriddle/normalize-form, r=GuillaumeGomez

rustdoc: clean up "normalize.css 8" input override CSS

These rules were copied from normalize.css 3, and are mostly redundant.

* `optgroup` isn't used in rustdoc at all
* `textarea` is only used for the "copy" button, so it's not visible
* The remaining buttons and inputs mostly have styles set anyway.
* We should never be setting `color` without also setting the background to something. Otherwise, you get white-on-gray text. That seems to be [the reason] why `normalize.css` changed this.

[the reason]: https://github.com/necolas/normalize.css/pull/502

21 months agoRollup merge of #102435 - GuillaumeGomez:improve-iterator-reduce-example, r=thomcc...
Dylan DPC [Thu, 29 Sep 2022 12:43:20 +0000 (18:13 +0530)]
Rollup merge of #102435 - GuillaumeGomez:improve-iterator-reduce-example, r=thomcc,vacuus

Improve example of Iterator::reduce

Fixes #81819.

I took your example `@bstrie` from https://github.com/rust-lang/rust/issues/81819 and applied it here.

r? `@thomcc`

21 months agoRollup merge of #102385 - sunfishcode:sunfishcode/wasm-no-export-heap-base, r=davidtwco
Dylan DPC [Thu, 29 Sep 2022 12:43:20 +0000 (18:13 +0530)]
Rollup merge of #102385 - sunfishcode:sunfishcode/wasm-no-export-heap-base, r=davidtwco

Don't export `__heap_base` and `__data_end` on wasm32-wasi.

`__heap_base` and `__data_end` are exported for use by wasm-bindgen, which uses the wasm32-unknown-unknown target. On wasm32-wasi, as a step toward implementing the Canonical ABI, and as an aid to building speicalized WASI API polyfill wrappers, don't export `__heap_base` and `__data_end` on wasm32-wasi.

21 months agoRollup merge of #102342 - jmillikin:nonzero-negation, r=scottmcm
Dylan DPC [Thu, 29 Sep 2022 12:43:19 +0000 (18:13 +0530)]
Rollup merge of #102342 - jmillikin:nonzero-negation, r=scottmcm

Add negation methods for signed non-zero integers.

Performing negation with defined wrapping semantics (such as `wrapping_neg()`) on a non-zero integer currently requires unpacking to a primitive and re-wrapping. Since negation of non-zero signed integers always produces a non-zero result, it is safe to implement the various `*_neg()` methods for `NonZeroI{N}`.

I'm not sure what to do about the `#[unstable(..., issue = "none")]` here -- should I file a tracking issue, or is that handled by the Rust dev team?

ACP: https://github.com/rust-lang/libs-team/issues/105

21 months agoRollup merge of #102336 - compiler-errors:issue-102333, r=jackh726
Dylan DPC [Thu, 29 Sep 2022 12:43:19 +0000 (18:13 +0530)]
Rollup merge of #102336 - compiler-errors:issue-102333, r=jackh726

Fix associated type bindings with anon const in GAT position

The first commit formats `type_of.rs`, which is really hard to maintain since it uses a bunch of features like `let`-chains and `if let` match arm bindings. Best if you just review the second two diffs.

Fixes #102333

21 months agomake tidy dependency error less confusing
Ralf Jung [Thu, 29 Sep 2022 11:42:57 +0000 (13:42 +0200)]
make tidy dependency error less confusing

21 months agoAuto merge of #102461 - oli-obk:split_collect_rs, r=lcnr
bors [Thu, 29 Sep 2022 10:44:29 +0000 (10:44 +0000)]
Auto merge of #102461 - oli-obk:split_collect_rs, r=lcnr

Split collect.rs

This file was way too big (adding a few lines of code caused tidy to trigger)

21 months agoSome path updates
Oli Scherer [Thu, 29 Sep 2022 09:33:30 +0000 (09:33 +0000)]
Some path updates

21 months agoSplit collect.rs
Oli Scherer [Thu, 29 Sep 2022 09:31:46 +0000 (09:31 +0000)]
Split collect.rs

21 months agoAuto merge of #102328 - cuviper:ibm-stack-probes, r=nagisa
bors [Thu, 29 Sep 2022 08:00:54 +0000 (08:00 +0000)]
Auto merge of #102328 - cuviper:ibm-stack-probes, r=nagisa

Enable inline stack probes on PowerPC and SystemZ

The LLVM PowerPC and SystemZ targets have both supported `"probe-stack"="inline-asm"` for longer than our current minimum LLVM 13 requirement, so we can turn this on for all `powerpc`, `powerpc64`, `powerpc64le`, and `s390x` targets in Rust. These are all tier-2 or lower, so CI does not run their tests, but I have confirmed that their `linux-gnu` variants do pass on RHEL.

cc #43241

21 months agoAuto merge of #102450 - JohnTitor:rollup-ahleg93, r=JohnTitor
bors [Thu, 29 Sep 2022 05:12:30 +0000 (05:12 +0000)]
Auto merge of #102450 - JohnTitor:rollup-ahleg93, r=JohnTitor

Rollup of 8 pull requests

Successful merges:

 - #98368 (Make `std::os::fd` public.)
 - #102085 (Code refactoring smart_resolve_report_errors)
 - #102351 (Improve E0585 help)
 - #102368 (Add a niche to `Duration`, unix `SystemTime`, and non-apple `Instant`)
 - #102393 (Add regression test for issue 94923)
 - #102399 (Account for use of index-based lifetime names in print of binder)
 - #102416 (remove FIXME, improve documentation)
 - #102433 (env::temp_dir: fix a typo)

Failed merges:

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

21 months agofix minor ungrammatical sentence
Gabe Koss [Thu, 29 Sep 2022 04:20:05 +0000 (00:20 -0400)]
fix minor ungrammatical sentence

21 months agorustdoc: add method spacing to trait methods
Michael Howell [Thu, 29 Sep 2022 00:38:25 +0000 (17:38 -0700)]
rustdoc: add method spacing to trait methods

More cleanup for 8846c0853d8687fda0e5f23f6687b03b243980ee, this time in trait
layouts when things are collapsed.

21 months agoRollup merge of #102433 - RalfJung:temp-dir-typo, r=thomcc
Yuki Okushi [Thu, 29 Sep 2022 02:42:06 +0000 (11:42 +0900)]
Rollup merge of #102433 - RalfJung:temp-dir-typo, r=thomcc

env::temp_dir: fix a typo

21 months agoRollup merge of #102416 - lcnr:specialization-fixme, r=compiler-errors
Yuki Okushi [Thu, 29 Sep 2022 02:42:06 +0000 (11:42 +0900)]
Rollup merge of #102416 - lcnr:specialization-fixme, r=compiler-errors

remove FIXME, improve documentation

r? types

21 months agoRollup merge of #102399 - b-naber:binder-print-ice, r=lcnr
Yuki Okushi [Thu, 29 Sep 2022 02:42:06 +0000 (11:42 +0900)]
Rollup merge of #102399 - b-naber:binder-print-ice, r=lcnr

Account for use of index-based lifetime names in print of binder

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

r? ```@lcnr```

cc ```@steffahn```

21 months agoRollup merge of #102393 - Rageking8:add-regression-test-for-issue-94923, r=JohnTitor
Yuki Okushi [Thu, 29 Sep 2022 02:42:05 +0000 (11:42 +0900)]
Rollup merge of #102393 - Rageking8:add-regression-test-for-issue-94923, r=JohnTitor

Add regression test for issue 94923

Fixes #94923

21 months agoRollup merge of #102368 - beetrees:nano-niche, r=joshtriplett
Yuki Okushi [Thu, 29 Sep 2022 02:42:05 +0000 (11:42 +0900)]
Rollup merge of #102368 - beetrees:nano-niche, r=joshtriplett

Add a niche to `Duration`, unix `SystemTime`, and non-apple `Instant`

As the nanoseconds fields is always between `0` and `(NANOS_PER_SEC - 1)` inclusive, use the `rustc_layout_scalar_valid_range` attributes to create a niche in the nanosecond field of `Duration` and `Timespec` (which is used to implement unix `SystemTime` and non-apple unix `Instant`; windows `Instant` is implemented with `Duration` and therefore will also benefit). This change has the benefit of making `Option<T>` the same size as `T` for the previously mentioned types. Also shrinks the nanoseconds field of `Timespec` to a `u32` as nanoseconds do not need the extra range of an `i64`, shrinking `Timespec` by 4 bytes on 32-bit platforms.

r? ```@joshtriplett```

21 months agoRollup merge of #102351 - Rageking8:improve-E0585, r=wesleywiser
Yuki Okushi [Thu, 29 Sep 2022 02:42:04 +0000 (11:42 +0900)]
Rollup merge of #102351 - Rageking8:improve-E0585, r=wesleywiser

Improve E0585 help

21 months agoRollup merge of #102085 - chenyukang:code-refactor, r=cjgillot
Yuki Okushi [Thu, 29 Sep 2022 02:42:03 +0000 (11:42 +0900)]
Rollup merge of #102085 - chenyukang:code-refactor, r=cjgillot

Code refactoring smart_resolve_report_errors

`smart_resolve_report_errors` https://github.com/rust-lang/rust/blob/4ecfdfac51b159f68fce608792affb34a70e6f73/compiler/rustc_resolve/src/late/diagnostics.rs#L143
is almost 600 lines of code, we should do some code refactoring.

21 months agoRollup merge of #98368 - sunfishcode:sunfishcode/std-os-fd, r=joshtriplett
Yuki Okushi [Thu, 29 Sep 2022 02:42:03 +0000 (11:42 +0900)]
Rollup merge of #98368 - sunfishcode:sunfishcode/std-os-fd, r=joshtriplett

Make `std::os::fd` public.

`std::os::fd` defines types like `OwnedFd` and `RawFd` and is common
between Unix and non-Unix platforms that share a basic file-descriptor
concept. Rust currently uses this internally to simplify its own code,
but it would be useful for external users in the same way, so make it
public.

This means that `OwnedFd` etc. will all appear in three places, for
example on unix platforms:
 - `std::os::fd::OwnedFd`
 - `std::os::unix::io::OwnedFd`
 - `std::os::unix::prelude::OwnedFd`

r? `````@joshtriplett`````

21 months agoAuto merge of #101833 - jyn514:cross-compile-compiler-builtins, r=Mark-Simulacrum
bors [Thu, 29 Sep 2022 02:28:50 +0000 (02:28 +0000)]
Auto merge of #101833 - jyn514:cross-compile-compiler-builtins, r=Mark-Simulacrum

Make the `c` feature for `compiler-builtins` an explicit opt-in

Its build script doesn't support cross-compilation. I tried fixing it, but the cc crate itself doesn't appear to support cross-compiling to windows either unless you use the -gnu toolchain:
```
  error occurred: Failed to find tool. Is `lib.exe` installed?
```

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

21 months agorustdoc: remove bad CSS font-weight on `.impl`, `.method`, etc
Michael Howell [Wed, 28 Sep 2022 21:47:56 +0000 (14:47 -0700)]
rustdoc: remove bad CSS font-weight on `.impl`, `.method`, etc

This line was added in c494a06064017f307a8d9dc4797e614d2ed99143, because at
the time, the headers had these classes on them. Now, the headers are
children of the `<section>` with the class on it.

This commit also adds a test case, to make sure the srclink font weight does
not regress again.

21 months agoUse let-chaining in `WhileTrue::check_expr`.
Nicholas Nethercote [Wed, 28 Sep 2022 23:10:57 +0000 (09:10 +1000)]
Use let-chaining in `WhileTrue::check_expr`.

This has been bugging me for a while.

21 months agoImprove example of Iterator::reduce
Guillaume Gomez [Wed, 28 Sep 2022 21:01:10 +0000 (23:01 +0200)]
Improve example of Iterator::reduce

21 months agorustdoc: clean up "normalize.css 8" input override CSS
Michael Howell [Wed, 28 Sep 2022 20:52:13 +0000 (13:52 -0700)]
rustdoc: clean up "normalize.css 8" input override CSS

These rules were copied from normalize.css 3, and are mostly redundant.

* `optgroup` isn't used in rustdoc at all
* `textarea` is only used for the "copy" button, so it's not visible
* The remaining buttons and inputs mostly have styles set anyway.
* We should never be setting `color` without also setting the
  background to something. Otherwise, you get white-on-gray
  text. That seems to be [the reason] why `normalize.css` changed this.

[the reason]: https://github.com/necolas/normalize.css/pull/502

21 months agononzero_negation_ops: `inline(always)` -> `inline`.
John Millikin [Wed, 28 Sep 2022 22:33:05 +0000 (07:33 +0900)]
nonzero_negation_ops: `inline(always)` -> `inline`.

21 months agononzero_negation_ops: Set `issue = "102443"`.
John Millikin [Wed, 28 Sep 2022 22:32:15 +0000 (07:32 +0900)]
nonzero_negation_ops: Set `issue = "102443"`.

21 months agoAuto merge of #102384 - camelid:extrainfo, r=GuillaumeGomez
bors [Wed, 28 Sep 2022 22:15:28 +0000 (22:15 +0000)]
Auto merge of #102384 - camelid:extrainfo, r=GuillaumeGomez

rustdoc: Remove `clean::TraitWithExtraInfo` and queryify `is_notable_trait`

cc `@notriddle` `@GuillaumeGomez`

21 months agorustdoc: cut margin-top from first header in docblock
Michael Howell [Wed, 28 Sep 2022 21:33:56 +0000 (14:33 -0700)]
rustdoc: cut margin-top from first header in docblock

Fixes a regression caused by 8846c0853d8687fda0e5f23f6687b03b243980ee, where
a header's top margin used to be collapsed, but isn't any more.

21 months agoFix span of byte-escaped left format args brace
Cassaundra Smith [Fri, 23 Sep 2022 23:26:17 +0000 (16:26 -0700)]
Fix span of byte-escaped left format args brace

Fix #102057.

21 months agoenv::temp_dir: fix a typo
Ralf Jung [Wed, 28 Sep 2022 19:51:09 +0000 (21:51 +0200)]
env::temp_dir: fix a typo

21 months agoAuto merge of #100719 - CohenArthur:rust-safe-intrinsic-attribute, r=wesleywiser
bors [Wed, 28 Sep 2022 19:07:50 +0000 (19:07 +0000)]
Auto merge of #100719 - CohenArthur:rust-safe-intrinsic-attribute, r=wesleywiser

Add `#[rustc_safe_intrinsic]`

This PR adds the `#[rustc_safe_intrinsic]` attribute as mentionned on Zulip. The goal of this attribute is to avoid keeping a list of symbols as the source for stable intrinsics, and instead rely on an attribute. This is similar to `#[rustc_const_stable]` and `#[rustc_const_unstable]`, which among other things, are used to mark the constness of intrinsic functions.

21 months agoDon't export `__wasm_init_memory` on WebAssembly.
Dan Gohman [Wed, 28 Sep 2022 18:13:51 +0000 (11:13 -0700)]
Don't export `__wasm_init_memory` on WebAssembly.

Since #72889, the Rust wasm target doesn't use --passive-segments, so
remove the `--export=__wasm_init_memory`.

As documented in the [tool-conventions Linking convention],
`__wasm_init_memory` is not intended to be exported.

[tool-conventions Linking convention]: https://github.com/WebAssembly/tool-conventions/blob/7c064f304858f67ebf22964a84b7e9658e29557a/Linking.md#shared-memory-and-passive-segments

21 months agoAdd a niche to `Duration`, unix `SystemTime`, and non-apple `Instant`
beetrees [Wed, 14 Sep 2022 10:43:02 +0000 (11:43 +0100)]
Add a niche to `Duration`, unix `SystemTime`, and non-apple `Instant`

21 months agoimprove E0585 help
Rageking8 [Tue, 27 Sep 2022 08:08:04 +0000 (16:08 +0800)]
improve E0585 help

21 months agoupdate fixme
lcnr [Wed, 28 Sep 2022 15:04:29 +0000 (17:04 +0200)]
update fixme

21 months agoAuto merge of #101454 - cjgillot:concat-binders, r=estebank
bors [Wed, 28 Sep 2022 14:42:55 +0000 (14:42 +0000)]
Auto merge of #101454 - cjgillot:concat-binders, r=estebank

Do not overwrite lifetime binders for another HirId.

This PR makes higher-ranked bounds in where clauses a bit more principled.
We used to conflate `for<'a> T: Trait` with `(for<'a> T): Trait`.
This PR separates both binders.

This caused issued with fn types, which have their own binder, causing us to overwrite the predicates's binders with `fn`'s binders, ICEing.

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

21 months agoAuto merge of #101619 - Xiretza:rustc_parse-session-diagnostics, r=davidtwco
bors [Wed, 28 Sep 2022 11:11:42 +0000 (11:11 +0000)]
Auto merge of #101619 - Xiretza:rustc_parse-session-diagnostics, r=davidtwco

Migrate more of rustc_parse to SessionDiagnostic

Still far from complete, but I thought I'd add a checkpoint here because rebasing was starting to get annoying.

21 months agoadd test
b-naber [Wed, 28 Sep 2022 10:31:19 +0000 (12:31 +0200)]
add test

21 months agoaccount for use of index-based lifetime names in print of binder
b-naber [Wed, 28 Sep 2022 10:31:08 +0000 (12:31 +0200)]
account for use of index-based lifetime names in print of binder

21 months agoadd regression test
Rageking8 [Wed, 28 Sep 2022 08:30:06 +0000 (16:30 +0800)]
add regression test

21 months agoMake the `c` feature for `compiler-builtins` opt-in instead of inferred
Joshua Nelson [Thu, 15 Sep 2022 00:33:00 +0000 (19:33 -0500)]
Make the `c` feature for `compiler-builtins` opt-in instead of inferred

The build script for `compiler_builtins` doesn't support cross-compilation. I tried fixing it, but the cc crate itself
doesn't appear to support cross-compiling to windows either unless you use the -gnu toolchain:
```
  error occurred: Failed to find tool. Is `lib.exe` installed?
```

Rather than trying to fix it or special-case the platforms without bugs,
make it opt-in instead of automatic.

21 months agoAuto merge of #102302 - nnethercote:more-lexer-improvements, r=matklad
bors [Wed, 28 Sep 2022 08:14:04 +0000 (08:14 +0000)]
Auto merge of #102302 - nnethercote:more-lexer-improvements, r=matklad

More lexer improvements

A follow-up to #99884.

r? `@matklad`

21 months agorustc_safe_intrinsic: Add UI test
Arthur Cohen [Tue, 27 Sep 2022 05:22:07 +0000 (07:22 +0200)]
rustc_safe_intrinsic: Add UI test

21 months agorustc_safe_intrinsic: Keep list of safe intrinsics within the compiler
Arthur Cohen [Fri, 9 Sep 2022 14:38:33 +0000 (16:38 +0200)]
rustc_safe_intrinsic: Keep list of safe intrinsics within the compiler

21 months agoAuto merge of #102388 - JohnTitor:rollup-mbyw6fl, r=JohnTitor
bors [Wed, 28 Sep 2022 04:18:19 +0000 (04:18 +0000)]
Auto merge of #102388 - JohnTitor:rollup-mbyw6fl, r=JohnTitor

Rollup of 8 pull requests

Successful merges:

 - #100747 (Add long description and test for E0311)
 - #102232 (Stabilize bench_black_box)
 - #102288 (Suggest unwrapping `???<T>` if a method cannot be found on it but is present on `T`.)
 - #102338 (Deny associated type bindings within associated type bindings)
 - #102347 (Unescaping cleanups)
 - #102348 (Tweak `FulfillProcessor`.)
 - #102378 (Use already resolved `self_ty` in `confirm_fn_pointer_candidate`)
 - #102380 (rustdoc: remove redundant mobile `.source > .sidebar` CSS)

Failed merges:

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

21 months agoRollup merge of #102380 - notriddle:notriddle/rustdoc-source-sidebar, r=camelid
Yuki Okushi [Wed, 28 Sep 2022 04:07:20 +0000 (13:07 +0900)]
Rollup merge of #102380 - notriddle:notriddle/rustdoc-source-sidebar, r=camelid

rustdoc: remove redundant mobile `.source > .sidebar` CSS

When the source sidebar and standard sidebar had most of their code merged in 07e3f998b1ceb4b8d2a7992782e60f5e776aa114, the properties `z-index: 11`, `margin: 0`, and `position: fixed` were already being set on the `.sidebar` class, so no need to repeat them.

https://github.com/rust-lang/rust/blob/57ee5cf5a93923dae9c98bffb11545fc3a31368d/src/librustdoc/html/static/css/rustdoc.css#L1742-L1754

21 months agoRollup merge of #102378 - compiler-errors:issue-102289, r=jackh726
Yuki Okushi [Wed, 28 Sep 2022 04:07:20 +0000 (13:07 +0900)]
Rollup merge of #102378 - compiler-errors:issue-102289, r=jackh726

Use already resolved `self_ty` in `confirm_fn_pointer_candidate`

Fixes #102289

21 months agoRollup merge of #102348 - nnethercote:tweak-FulfillProcessor, r=jackh726
Yuki Okushi [Wed, 28 Sep 2022 04:07:19 +0000 (13:07 +0900)]
Rollup merge of #102348 - nnethercote:tweak-FulfillProcessor, r=jackh726

Tweak `FulfillProcessor`.

Avoids some unnecessary references and lifetimes.

r? `@jackh726`

21 months agoRollup merge of #102347 - nnethercote:unescaping-cleanups, r=matklad
Yuki Okushi [Wed, 28 Sep 2022 04:07:18 +0000 (13:07 +0900)]
Rollup merge of #102347 - nnethercote:unescaping-cleanups, r=matklad

Unescaping cleanups

Some minor improvements.

r? `@matklad`

21 months agoRollup merge of #102338 - compiler-errors:assoc-ty-binding-in-assoc-ty-binding, r...
Yuki Okushi [Wed, 28 Sep 2022 04:07:18 +0000 (13:07 +0900)]
Rollup merge of #102338 - compiler-errors:assoc-ty-binding-in-assoc-ty-binding, r=cjgillot

Deny associated type bindings within associated type bindings

Fixes #102335

This was made worse by #100865, which unified the way we generate substs for GATs and non-generic associated types. However, the issue was not _caused_ by #100865, evidenced by the test I added for GATs:

```rust
trait T {
    type A: S<C<(), i32 = ()> = ()>;
    //~^ ERROR associated type bindings are not allowed here
}

trait Q {}

trait S {
    type C<T>: Q;
}

fn main() {}
```

^ which passes on beta (where GATs are stable) and presumably ever since GATs support was added to `create_substs_for_associated_item` in astconv.

21 months agoRollup merge of #102288 - mejrs:inner, r=compiler-errors
Yuki Okushi [Wed, 28 Sep 2022 04:07:17 +0000 (13:07 +0900)]
Rollup merge of #102288 - mejrs:inner, r=compiler-errors

Suggest unwrapping `???<T>` if a method cannot be found on it but is present on `T`.

This suggests various ways to get inside wrapper types if the method cannot be found on the wrapper type, but is present on the wrappee.

For this PR, those wrapper types include `Localkey`, `MaybeUninit`, `RefCell`, `RwLock` and `Mutex`.

21 months agoRollup merge of #102232 - Urgau:stabilize-bench_black_box, r=TaKO8Ki
Yuki Okushi [Wed, 28 Sep 2022 04:07:17 +0000 (13:07 +0900)]
Rollup merge of #102232 - Urgau:stabilize-bench_black_box, r=TaKO8Ki

Stabilize bench_black_box

This PR stabilize `feature(bench_black_box)`.

```rust
pub fn black_box<T>(dummy: T) -> T;
```

The FCP was completed in https://github.com/rust-lang/rust/issues/64102.

`@rustbot` label +T-libs-api -T-libs

21 months agoRollup merge of #100747 - MatthewPeterKelly:mpk/add-long-error-message-for-E0311...
Yuki Okushi [Wed, 28 Sep 2022 04:07:16 +0000 (13:07 +0900)]
Rollup merge of #100747 - MatthewPeterKelly:mpk/add-long-error-message-for-E0311, r=MatthewPeterKelly

Add long description and test for E0311

Adds a long description and unit test for the E0311 compiler error.

Fixes one line-item in https://github.com/rust-lang/rust/issues/61137.

21 months agoAuto merge of #100996 - m-ou-se:format-args-2, r=estebank
bors [Wed, 28 Sep 2022 01:36:28 +0000 (01:36 +0000)]
Auto merge of #100996 - m-ou-se:format-args-2, r=estebank

Rewrite and refactor format_args!() builtin macro.

This is a near complete rewrite of `compiler/rustc_builtin_macros/src/format.rs`.

This gets rid of the massive unmaintanable [`Context` struct](https://github.com/rust-lang/rust/blob/76531befc4b0352247ada67bd225e8cf71ee5686/compiler/rustc_builtin_macros/src/format.rs#L176-L263), and splits the macro expansion into three parts:

1. First, `parse_args` will parse the `(literal, arg, arg, name=arg, name=arg)` syntax, but doesn't parse the template (the literal) itself.
2. Second, `make_format_args` will parse the template, the format options, resolve argument references, produce diagnostics, and turn the whole thing into a `FormatArgs` structure.
3. Finally, `expand_parsed_format_args` will turn that `FormatArgs` structure into the expression that the macro expands to.

In other words, the `format_args` builtin macro used to be a hard-to-maintain 'single pass compiler', which I've split into a three phase compiler with a parser/tokenizer (step 1), semantic analysis (step 2), and backend (step 3). (It's compilers all the way down. ^^)

This can serve as a great starting point for https://github.com/rust-lang/rust/issues/99012, which will only need to change the implementation of 3, while leaving step 1 and 2 unchanged.

It also makes https://github.com/rust-lang/compiler-team/issues/541 easier, which could then upgrade the new `FormatArgs` struct to an `ast` node and remove step 3, moving that step to later in the compilation process.

It also fixes a few diagnostics bugs.

This also [significantly reduces](https://gist.github.com/m-ou-se/b67b2d54172c4837a5ab1b26fa3e5284) the amount of generated code for cases with arguments in non-default order without formatting options, like `"{1} {0}"` or `"{a} {}"`, etc.

21 months agoAddress review comments.
Nicholas Nethercote [Wed, 28 Sep 2022 00:28:36 +0000 (10:28 +1000)]
Address review comments.

21 months agorustdoc: Queryify `is_notable_trait`
Noah Lev [Wed, 28 Sep 2022 00:06:38 +0000 (17:06 -0700)]
rustdoc: Queryify `is_notable_trait`

This might help with #102375.

21 months agoDon't export `__heap_base` and `__data_end` on wasm32-wasi.
Dan Gohman [Wed, 28 Sep 2022 00:33:59 +0000 (17:33 -0700)]
Don't export `__heap_base` and `__data_end` on wasm32-wasi.

`__heap_base` and `__data_end` are exported for use by wasm-bindgen, which
uses the wasm32-unknown-unknown target. On wasm32-wasi, as a step toward
implementing the Canonical ABI, and as an aid to building speicalized WASI
API polyfill wrappers, don't export `__heap_base` and `__data_end` on
wasm32-wasi.

21 months agoDeduplicate some logic
mejrs [Wed, 28 Sep 2022 00:36:58 +0000 (02:36 +0200)]
Deduplicate some logic

21 months agoreview updates
Matthew Kelly [Tue, 27 Sep 2022 23:23:59 +0000 (19:23 -0400)]
review updates

21 months agoAuto merge of #102377 - matthiaskrgr:rollup-1zvj50t, r=matthiaskrgr
bors [Tue, 27 Sep 2022 22:41:47 +0000 (22:41 +0000)]
Auto merge of #102377 - matthiaskrgr:rollup-1zvj50t, r=matthiaskrgr

Rollup of 9 pull requests

Successful merges:

 - #101555 (Stabilize `#![feature(mixed_integer_ops)]`)
 - #102253 (rustdoc: use CSS containment to speed up render)
 - #102281 (make invalid_value lint a bit smarter around enums)
 - #102284 (Structured suggestion for missing `mut`/`const` in raw pointer)
 - #102330 (rustdoc: remove no-op CSS `.srclink { font-weight; font-size }`)
 - #102337 (Avoid LLVM-deprecated `Optional::hasValue`)
 - #102356 (session: remove now-unnecessary lint `#[allow]`s)
 - #102367 (rustdoc: remove redundant `#help-button` CSS)
 - #102369 (Fix search result colors)

Failed merges:

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

21 months agoSmall cleanups in unescaping code.
Nicholas Nethercote [Tue, 27 Sep 2022 06:32:22 +0000 (16:32 +1000)]
Small cleanups in unescaping code.

- Rename `unescape_raw_str_or_raw_byte_str` as
  `unescape_raw_str_or_byte_str`, which is more accurate.
- Remove the unused `Mode::in_single_quotes` method.
- Make some assertions more precise, and add a missing one to
  `unescape_char_or_byte`.
- Change all the assertions to `debug_assert!`, because this code is
  reasonably hot, and the assertions aren't required for memory safety,
  and any violations are likely to be sufficiently obvious that normal
  tests will trigger them.

21 months agorustdoc: remove redundant mobile `.source > .sidebar` CSS
Michael Howell [Tue, 27 Sep 2022 21:25:48 +0000 (14:25 -0700)]
rustdoc: remove redundant mobile `.source > .sidebar` CSS

When the source sidebar and standard sidebar had most of their code merged in
07e3f998b1ceb4b8d2a7992782e60f5e776aa114, the properties `z-index: 11`,
`margin: 0`, and `position: fixed` were already being set on the `.sidebar`
class, so no need to repeat them.

21 months agoAdd newline
mejrs [Tue, 27 Sep 2022 21:12:52 +0000 (23:12 +0200)]
Add newline

21 months agoUse already resolved self_ty in confirm_fn_pointer_candidate
Michael Goulet [Tue, 27 Sep 2022 20:00:24 +0000 (20:00 +0000)]
Use already resolved self_ty in confirm_fn_pointer_candidate

21 months agoAuto merge of #102365 - weihanglo:update-cargo, r=ehuss
bors [Tue, 27 Sep 2022 19:42:46 +0000 (19:42 +0000)]
Auto merge of #102365 - weihanglo:update-cargo, r=ehuss

Update cargo

22 commits in 73ba3f35e0205844418260722c11602113179c4a..f5fed93ba24607980647962c59863bbabb03ce14 2022-09-18 06:38:16 +0000 to 2022-09-27 12:03:57 +0000

- build-scripts.md: Use em dash consistently. (rust-lang/cargo#11150)
- Indicate how Cargo locates the manifest (rust-lang/cargo#10770)
- Reduce references to `[project]` within cargo (rust-lang/cargo#11135)
- Iteratively construct target cfg (rust-lang/cargo#11114)
- update comment about `CARGO_BIN_EXE_` (rust-lang/cargo#11146)
- Call out that not all config values can be set via env vars (rust-lang/cargo#11139)
- Bump to 0.67.0, update changelog (rust-lang/cargo#11137)
- ci: update toolchain for building api doc (rust-lang/cargo#11134)
- Http publish not noop (rust-lang/cargo#11111)
- Improve errors for TOML fields that support workspace inheritance (rust-lang/cargo#11113)
- switch to `std::task::ready!()` where possible (rust-lang/cargo#11130)
- Report cmd aliasing failure with more contexts (rust-lang/cargo#11087)
- minor: remove unused mut (rust-lang/cargo#11127)
- fix(cli): Forward non-UTF8 arguments to external subcommands (rust-lang/cargo#11118)
- This change adds an example to the authors attribute in the manifest. (rust-lang/cargo#10938)
- Add support for relative git submodule paths (rust-lang/cargo#11106)
- make unknown features on `cargo add` more discoverable (rust-lang/cargo#11098)
- Unlink old final artifacts before compilation (rust-lang/cargo#11122)
- refactor(cli): Prepare for clap v4 (rust-lang/cargo#11116)
- fix(cli): Error trailing args rather than ignore (rust-lang/cargo#11119)
- Add a minor clarification (rust-lang/cargo#11093)
- doc(changelog): mention CVE fixes (rust-lang/cargo#11104)

21 months agoRollup merge of #102369 - GuillaumeGomez:results-colors, r=notriddle
Matthias Krüger [Tue, 27 Sep 2022 19:42:25 +0000 (21:42 +0200)]
Rollup merge of #102369 - GuillaumeGomez:results-colors, r=notriddle

Fix search result colors

Fixes regression introduced in https://github.com/rust-lang/rust/commit/99c00714cff0d13b6c5092c9949cb4e93a121346.

As you can see, ayu lost some colors for its search results:

beta/nightly:
![Screenshot from 2022-09-27 19-46-49](https://user-images.githubusercontent.com/3050060/192606456-e7bb58dd-cf76-49a0-b1ae-28565adb1dc6.png)

stable:
![Screenshot from 2022-09-27 19-46-36](https://user-images.githubusercontent.com/3050060/192606453-e720e219-a336-4ff1-989b-2fdb76e789eb.png)

We'll need to backport it to beta too to prevent it reaching stable.

r? `@notriddle`

21 months agoRollup merge of #102367 - notriddle:notriddle/help-text-align, r=GuillaumeGomez
Matthias Krüger [Tue, 27 Sep 2022 19:42:25 +0000 (21:42 +0200)]
Rollup merge of #102367 - notriddle:notriddle/help-text-align, r=GuillaumeGomez

rustdoc: remove redundant `#help-button` CSS

When the separate top and bottom styles were added in cd3f4da244578a2ab4d17d10016c61b9191b21e4, some of the CSS rules were needlessly duplicated.

The `text-align: initial` rule on `.side-by-side` was always redundant, since the rules that centered the text were set on children, not parents.

21 months agoRollup merge of #102356 - davidtwco:translation-bootstrap-bump-allow-lint, r=lcnr
Matthias Krüger [Tue, 27 Sep 2022 19:42:24 +0000 (21:42 +0200)]
Rollup merge of #102356 - davidtwco:translation-bootstrap-bump-allow-lint, r=lcnr

session: remove now-unnecessary lint `#[allow]`s

In #101230, the internal diagnostic migration lints - `diagnostic_outside_of_impl` and `untranslatable_diagnostic` - were modified so that they wouldn't trigger on functions annotated with `#[rustc_lint_diagnostics]`. However, this change has to make it into the bootstrap compiler before the `#[allow]` annotations that it aims to remove can be removed, which is possible now that #102051 has landed.

21 months agoRollup merge of #102337 - cuviper:llvm-optional-bool, r=nikic
Matthias Krüger [Tue, 27 Sep 2022 19:42:24 +0000 (21:42 +0200)]
Rollup merge of #102337 - cuviper:llvm-optional-bool, r=nikic

Avoid LLVM-deprecated `Optional::hasValue`

LLVM 15 added `Optional::has_value`, and LLVM `main` (16) has deprecated
`hasValue`. However, its `explicit operator bool` does the same thing,
and was added long ago, so we can use that across our full LLVM range of
compatibility.

21 months agoRollup merge of #102330 - notriddle:notriddle/srclink, r=GuillaumeGomez
Matthias Krüger [Tue, 27 Sep 2022 19:42:23 +0000 (21:42 +0200)]
Rollup merge of #102330 - notriddle:notriddle/srclink, r=GuillaumeGomez

rustdoc: remove no-op CSS `.srclink { font-weight; font-size }`

When this CSS was added in 34bd2b845b3acd84c5a9bddae3ff8081c19ec5e9, source links were nested below headers.

https://github.com/rust-lang/rust/blob/34bd2b845b3acd84c5a9bddae3ff8081c19ec5e9/src/librustdoc/html/render.rs#L4015-L4019

Now, thanks to 458e7219bc2a62f72368279945cfda632a016da1, they are now siblings of headers, and thanks to 270d09dca9aae263671c4d32bbc7cb60dc378af8, they have the same font size that they would've had anyway.

21 months agoRollup merge of #102284 - compiler-errors:missing-type-in-raw-ptr, r=davidtwco
Matthias Krüger [Tue, 27 Sep 2022 19:42:23 +0000 (21:42 +0200)]
Rollup merge of #102284 - compiler-errors:missing-type-in-raw-ptr, r=davidtwco

Structured suggestion for missing `mut`/`const` in raw pointer

Fixes #102261

21 months agoRollup merge of #102281 - RalfJung:invalid-enums, r=cjgillot
Matthias Krüger [Tue, 27 Sep 2022 19:42:22 +0000 (21:42 +0200)]
Rollup merge of #102281 - RalfJung:invalid-enums, r=cjgillot

make invalid_value lint a bit smarter around enums

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

21 months agoRollup merge of #102253 - jsha:css-contain, r=notriddle
Matthias Krüger [Tue, 27 Sep 2022 19:42:22 +0000 (21:42 +0200)]
Rollup merge of #102253 - jsha:css-contain, r=notriddle

rustdoc: use CSS containment to speed up render

https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Containment

This affected layout a little and required adjustments to the CSS to keep spacing the same. In particular, the margins of adjacent items usually overlap with each other. However, when an item has contain: layout, any margins of child nodes push out the size of the item itself. This was making spacing between items a little too big. To solve that, I removed margins in some places: in particular for certain classes that often occur at the end of a `details.rustdoc-toggle` block, I removed their bottom margin. Generally, the margins provided by the next item down are sufficient.

Also remove an unnecessary margin-top on .code-header.

In particular this helps with the problem that rustdoc in some situations can generate giant HTML pages, which can crash a Chrome tab on typical modern hardware, for instance: `https://docs.rs/iced-x86/1.16.0/iced_x86/code_asm/struct.CodeAssembler.html` (26MB, 409k DOM nodes). This doesn't, of course, universally solve the problem, but it pushes out the boundary of the largest page rustdoc can produce without crashing a browser tab.

Demos:

https://rustdoc.crud.net/jsha/css-contain/std/string/struct.String.html
(warning: giant page, _may_ crash a browser tab) https://rustdoc.crud.net/jsha/css-contain-icedx86/iced_x86/code_asm/struct.CodeAssembler.html

r? `@notriddle`

21 months agoRollup merge of #101555 - jhpratt:stabilize-mixed_integer_ops, r=joshtriplett
Matthias Krüger [Tue, 27 Sep 2022 19:42:21 +0000 (21:42 +0200)]
Rollup merge of #101555 - jhpratt:stabilize-mixed_integer_ops, r=joshtriplett

Stabilize `#![feature(mixed_integer_ops)]`

Tracked and FCP completed in #87840.

````@rustbot```` label +T-libs-api +S-waiting-on-review +relnotes

r? rust-lang/t-libs-api

21 months agoAddress feedback
mejrs [Tue, 27 Sep 2022 11:06:31 +0000 (13:06 +0200)]
Address feedback

21 months agoWrapper suggestions
mejrs [Sun, 25 Sep 2022 22:55:35 +0000 (00:55 +0200)]
Wrapper suggestions

21 months agorustdoc: remove `clean::TraitWithExtraInfo`
Michael Howell [Tue, 27 Sep 2022 19:27:04 +0000 (12:27 -0700)]
rustdoc: remove `clean::TraitWithExtraInfo`

Instead, it gathers the extra info later, when it's actually requested.

21 months agoBless stats.
Camille GILLOT [Tue, 27 Sep 2022 18:29:24 +0000 (20:29 +0200)]
Bless stats.

21 months agoImplement IntoDiagnosticArg for rustc_ast::token::Token(Kind)
Xiretza [Thu, 22 Sep 2022 16:39:17 +0000 (18:39 +0200)]
Implement IntoDiagnosticArg for rustc_ast::token::Token(Kind)

21 months agoDon't unnecessarily stringify paths in diagnostics
Xiretza [Wed, 14 Sep 2022 18:11:42 +0000 (20:11 +0200)]
Don't unnecessarily stringify paths in diagnostics

21 months agoDocument use of Symbol::to_string()
Xiretza [Wed, 14 Sep 2022 16:35:22 +0000 (18:35 +0200)]
Document use of Symbol::to_string()

21 months agoMigrate even more diagnostics in rustc_parse to diagnostic structs
Xiretza [Thu, 8 Sep 2022 16:23:31 +0000 (18:23 +0200)]
Migrate even more diagnostics in rustc_parse to diagnostic structs

21 months agoMigrate "struct literal body without path" error to diagnostic struct
Xiretza [Sun, 4 Sep 2022 18:19:49 +0000 (20:19 +0200)]
Migrate "struct literal body without path" error to diagnostic struct

21 months agoMigrate "expected semicolon" diagnostics to diagnostic structs
Xiretza [Sun, 4 Sep 2022 18:12:00 +0000 (20:12 +0200)]
Migrate "expected semicolon" diagnostics to diagnostic structs

21 months agoMigrate "expected identifier" diagnostics to diagnostic structs
Xiretza [Sun, 4 Sep 2022 08:14:00 +0000 (10:14 +0200)]
Migrate "expected identifier" diagnostics to diagnostic structs

21 months agoRework "inner attribute not permitted" errors
Xiretza [Wed, 31 Aug 2022 11:20:59 +0000 (13:20 +0200)]
Rework "inner attribute not permitted" errors

21 months agoRemove error condition in parse_attribute
Xiretza [Thu, 1 Sep 2022 17:29:59 +0000 (19:29 +0200)]
Remove error condition in parse_attribute

This function is only ever called when the `#` has already been
consumed, no need to produce an error message here.

21 months agoMigrate more rustc_parse diagnostics to diagnostic structs
Xiretza [Thu, 1 Sep 2022 17:29:23 +0000 (19:29 +0200)]
Migrate more rustc_parse diagnostics to diagnostic structs