]> git.lizzy.rs Git - rust.git/log
rust.git
23 months agoRollup merge of #99436 - Nilstrieb:toggle-box-noalias, r=fee1-dead
Dylan DPC [Wed, 20 Jul 2022 10:47:20 +0000 (16:17 +0530)]
Rollup merge of #99436 - Nilstrieb:toggle-box-noalias, r=fee1-dead

Add flag to configure `noalias` on `Box<T>`

The aliasing rules of `Box<T>` are still not decided, but currently, `Box<T>` is unique and gets `noalias`. To aid making an informed decision about the future of `Box<T>`, this PR adds a flag `-Zbox-noalias` to configure `noalias` for `Box<T>` (for example, for benchmarking). The same flag already exists for `&mut T` `noalias`, where it was added because it was the problem of various miscompilations in LLVM.

For more information, see rust-lang/unsafe-code-guidelines#326

23 months agoRollup merge of #99383 - ouz-a:issue_57961, r=oli-obk
Dylan DPC [Wed, 20 Jul 2022 10:47:19 +0000 (16:17 +0530)]
Rollup merge of #99383 - ouz-a:issue_57961, r=oli-obk

Formalize defining_use_anchor

This tackles issue #57961

Introduces new enum called `DefiningAnchor` that replaces `Option<LocalDefId>` of `defining_use_anchor`. Now every use of it is explicit and exhaustively matched, catching errors like one in the linked issue. This is not a perfect fix but it's a step in the right direction.

r? `@oli-obk`

23 months agoRollup merge of #99345 - compiler-errors:issue-99073-redux, r=oli-obk
Dylan DPC [Wed, 20 Jul 2022 10:47:18 +0000 (16:17 +0530)]
Rollup merge of #99345 - compiler-errors:issue-99073-redux, r=oli-obk

Do not allow typeck children items to constrain outer RPITs

Fixes #99073 in a simpler and more conservative way than #99079. Simply raise a mismatched types error if we try to constrain an RPIT in an item that isn't the RPIT's parent.

r? `@oli-obk`

23 months agoRollup merge of #98101 - vladimir-ea:stdlib_watch_os, r=thomcc
Dylan DPC [Wed, 20 Jul 2022 10:47:17 +0000 (16:17 +0530)]
Rollup merge of #98101 - vladimir-ea:stdlib_watch_os, r=thomcc

stdlib support for Apple WatchOS

This is a follow-up to https://github.com/rust-lang/rust/pull/95243 (Add Apple WatchOS compiler targets) that adds stdlib support for Apple WatchOS.

`@deg4uss3r`
`@nagisa`

23 months agoUse FxIndexMap instead of otherwise unused StableMap for WEAK_ITEMS_REFS.
Michael Woerister [Fri, 8 Jul 2022 15:45:55 +0000 (17:45 +0200)]
Use FxIndexMap instead of otherwise unused StableMap for WEAK_ITEMS_REFS.

23 months agoAuto merge of #99495 - oli-obk:revert_98582, r=oli-obk
bors [Wed, 20 Jul 2022 10:34:42 +0000 (10:34 +0000)]
Auto merge of #99495 - oli-obk:revert_98582, r=oli-obk

Revert "Rollup merge of #98582 - oli-obk:unconstrained_opaque_type, r…

…=estebank"

This reverts commit 6f8fb911ad504b77549cf3256a09465621beab9d, reversing
changes made to 7210e46dc69a4b197a313d093fe145722c248b7d.

r? `@ghost`

rebase of https://github.com/rust-lang/rust/pull/99368

23 months agoattr: fix expected meta-item for `#[stable]`
David Wood [Wed, 13 Jul 2022 09:36:12 +0000 (10:36 +0100)]
attr: fix expected meta-item for `#[stable]`

When an unexpected meta item is provided to `#[stable]`, the diagnostic
lists "since" and "note" as expected meta-items, however the surrounding
code actually expects "feature" and "since".

Signed-off-by: David Wood <david.wood@huawei.com>
23 months agoattr/passes: comment -> doc comment
David Wood [Wed, 13 Jul 2022 09:09:37 +0000 (10:09 +0100)]
attr/passes: comment -> doc comment

Change some regular comments into documentation comments.

Signed-off-by: David Wood <david.wood@huawei.com>
23 months agoAdd GUI tests for search input border color
Guillaume Gomez [Wed, 20 Jul 2022 01:52:16 +0000 (03:52 +0200)]
Add GUI tests for search input border color

23 months agoRemove CSS transition for search input border-color
Guillaume Gomez [Wed, 20 Jul 2022 10:19:17 +0000 (12:19 +0200)]
Remove CSS transition for search input border-color

23 months agouse def_id
ouz-a [Wed, 20 Jul 2022 09:51:07 +0000 (12:51 +0300)]
use def_id

23 months agoclippy::perf fixes
Matthias Krüger [Wed, 20 Jul 2022 09:48:11 +0000 (11:48 +0200)]
clippy::perf fixes

23 months agotake opaq types
ouz-a [Sat, 2 Jul 2022 13:37:49 +0000 (16:37 +0300)]
take opaq types

23 months agoavoid `&str` to String conversions
Takayuki Maeda [Wed, 20 Jul 2022 09:19:57 +0000 (18:19 +0900)]
avoid `&str` to String conversions

23 months agoavoid a `Symbol` to `String` conversion
Takayuki Maeda [Wed, 20 Jul 2022 09:19:25 +0000 (18:19 +0900)]
avoid a `Symbol` to `String` conversion

23 months agoLibrary changes for Apple WatchOS
Vladimir Michael Eatwell [Wed, 23 Mar 2022 16:05:01 +0000 (16:05 +0000)]
Library changes for Apple WatchOS

23 months agoRevert "Rollup merge of #98582 - oli-obk:unconstrained_opaque_type, r=estebank"
Oli Scherer [Wed, 20 Jul 2022 07:55:58 +0000 (07:55 +0000)]
Revert "Rollup merge of #98582 - oli-obk:unconstrained_opaque_type, r=estebank"

This reverts commit 6f8fb911ad504b77549cf3256a09465621beab9d, reversing
changes made to 7210e46dc69a4b197a313d093fe145722c248b7d.

23 months agocompiletest: dedup revision line logic.
Luqman Aden [Wed, 20 Jul 2022 02:13:33 +0000 (19:13 -0700)]
compiletest: dedup revision line logic.

23 months agoUse revision support to remove near identical debuginfo test.
Luqman Aden [Wed, 20 Jul 2022 01:30:12 +0000 (18:30 -0700)]
Use revision support to remove near identical debuginfo test.

23 months agocompiletest: allow using revisions with debuginfo tests
Luqman Aden [Wed, 20 Jul 2022 01:27:33 +0000 (18:27 -0700)]
compiletest: allow using revisions with debuginfo tests

23 months agoAuto merge of #99493 - Dylan-DPC:rollup-lli4gcx, r=Dylan-DPC
bors [Wed, 20 Jul 2022 07:03:54 +0000 (07:03 +0000)]
Auto merge of #99493 - Dylan-DPC:rollup-lli4gcx, r=Dylan-DPC

Rollup of 5 pull requests

Successful merges:

 - #98784 (Suggest returning local on "expected `ty`, found `()`" due to expr-less block)
 - #98916 (Windows: Use `FindFirstFileW` for getting the metadata of locked system files)
 - #99433 (Erase regions before comparing signatures of foreign fns.)
 - #99452 (int_macros was only using to_xe_bytes_doc and not from_xe_bytes_doc)
 - #99481 (Add regression test for #71547)

Failed merges:

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

23 months agoRollup merge of #99481 - JohnTitor:issue-71547, r=compiler-errors
Dylan DPC [Wed, 20 Jul 2022 05:59:41 +0000 (11:29 +0530)]
Rollup merge of #99481 - JohnTitor:issue-71547, r=compiler-errors

Add regression test for #71547

Closes #71547
r? `@compiler-errors`

Signed-off-by: Yuki Okushi <jtitor@2k36.org>
23 months agoRollup merge of #99452 - Stargateur:fix/typo, r=JohnTitor
Dylan DPC [Wed, 20 Jul 2022 05:59:40 +0000 (11:29 +0530)]
Rollup merge of #99452 - Stargateur:fix/typo, r=JohnTitor

int_macros was only using to_xe_bytes_doc and not from_xe_bytes_doc

typo in doc [here](https://doc.rust-lang.org/std/primitive.isize.html#method.from_ne_bytes) "returns" => "takes"

`@rustbot` label +T-rustdoc

23 months agoRollup merge of #99433 - cjgillot:erase-foreign-sig, r=compiler-errors
Dylan DPC [Wed, 20 Jul 2022 05:59:39 +0000 (11:29 +0530)]
Rollup merge of #99433 - cjgillot:erase-foreign-sig, r=compiler-errors

Erase regions before comparing signatures of foreign fns.

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

The version with explicit lifetimes is probably tracked in another bug, but I could not find it.

23 months agoRollup merge of #98916 - ChrisDenton:hiberfil.sys, r=thomcc
Dylan DPC [Wed, 20 Jul 2022 05:59:38 +0000 (11:29 +0530)]
Rollup merge of #98916 - ChrisDenton:hiberfil.sys, r=thomcc

Windows: Use `FindFirstFileW` for getting the metadata of locked system files

Fixes #96980

Usually opening a file handle with access set to metadata only will always succeed, even if the file is locked. However some special system files, such as `C:\hiberfil.sys`, are locked by the system in a way that denies even that. So as a fallback we try reading the cached metadata from the directory.

Note that the test is a bit iffy. I don't know if `hiberfil.sys` actually exists in the CI.

r? rust-lang/libs

23 months agoRollup merge of #98784 - compiler-errors:forgot-to-return-binding, r=estebank
Dylan DPC [Wed, 20 Jul 2022 05:59:37 +0000 (11:29 +0530)]
Rollup merge of #98784 - compiler-errors:forgot-to-return-binding, r=estebank

Suggest returning local on "expected `ty`, found `()`" due to expr-less block

Putting this up for _initial_ review. Notably, this doesn't consider if the value has possibly been moved, or whether the type is `Copy`. It also provides a structured suggestion if there's one "preferred" binding that matches the type (i.e. one binding in the block or its parent), otherwise it just points them out if there's fewer than 4 of them.

Fixes #98177

r? `@estebank`

23 months agoAuto merge of #98843 - Urgau:check-cfg-stage0, r=Mark-Simulacrum
bors [Wed, 20 Jul 2022 04:23:09 +0000 (04:23 +0000)]
Auto merge of #98843 - Urgau:check-cfg-stage0, r=Mark-Simulacrum

Enable check-cfg in stage0

Now that the bootstrap cargo supports `rustc-check-cfg` we can now enable it with `-Zcheck-cfg=output` and use it in `rustc_llvm` to unblock `--check-cfg` support in stage0.

r? `@Mark-Simulacrum`

23 months agoSuggest returning binding from block or enclosing scope on coerce_forced_unit error
Michael Goulet [Tue, 19 Jul 2022 02:54:51 +0000 (02:54 +0000)]
Suggest returning binding from block or enclosing scope on coerce_forced_unit error

23 months agoFix CSS on search input focus
Guillaume Gomez [Wed, 20 Jul 2022 01:28:19 +0000 (03:28 +0200)]
Fix CSS on search input focus

23 months agoFix crate filter select display
Guillaume Gomez [Wed, 20 Jul 2022 01:00:23 +0000 (03:00 +0200)]
Fix crate filter select display

23 months agoAuto merge of #99484 - ehuss:update-cargo, r=ehuss
bors [Wed, 20 Jul 2022 00:08:55 +0000 (00:08 +0000)]
Auto merge of #99484 - ehuss:update-cargo, r=ehuss

Update cargo

9 commits in 8827baaa781b37872134c1ba692a6f0aeb37890e..d8d30a75376f78bb0fabe3d28ee9d87aa8035309
2022-07-14 02:56:51 +0000 to 2022-07-19 13:59:17 +0000
- docs: fixing minor error in the default timing report filename (rust-lang/cargo#10879)
- Stabilize `--crate-type` flag for `cargo rustc` (rust-lang/cargo#10838)
- Stabilize `-Zmultitarget` (rust-lang/cargo#10766)
- Clean up leftover in unstable documentation (rust-lang/cargo#10874)
- Normalize path for `cargo vendor` output (rust-lang/cargo#10668)
- add a reason to `masquerade_as_nightly_cargo` so it is searchable (rust-lang/cargo#10868)
- Allow '.' in workspace.default-members in non-virtual workspaces. (rust-lang/cargo#10784)
- remove`.masquerade_as_nightly_cargo()` from various tests the no longer need it (rust-lang/cargo#10867)
- remove `.masquerade_as_nightly_cargo()` from build_script_extra_link_arg.rs (rust-lang/cargo#10866)

23 months agoUpdate cargo
Eric Huss [Wed, 20 Jul 2022 00:01:12 +0000 (17:01 -0700)]
Update cargo

23 months agoRemove #[allow(unused_qualifications)] lines from derive diff test
Michael Holloway [Tue, 19 Jul 2022 23:38:58 +0000 (19:38 -0400)]
Remove #[allow(unused_qualifications)] lines from derive diff test

23 months agoFinish bumping stage0
Mark Rousskov [Fri, 20 May 2022 12:54:10 +0000 (08:54 -0400)]
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.

23 months agoportable-simd: use simd_arith_offset to avoid ptr-int transmutation
Ralf Jung [Tue, 12 Apr 2022 15:01:22 +0000 (11:01 -0400)]
portable-simd: use simd_arith_offset to avoid ptr-int transmutation

23 months agoFix a numerical underflow in tuple wrap suggestion
Michael Goulet [Tue, 19 Jul 2022 22:47:00 +0000 (22:47 +0000)]
Fix a numerical underflow in tuple wrap suggestion

23 months agoremove a type string comparison in `check_str_addition`
Takayuki Maeda [Tue, 19 Jul 2022 22:07:18 +0000 (07:07 +0900)]
remove a type string comparison in `check_str_addition`

23 months agoAdd regression test for #71547
Yuki Okushi [Tue, 19 Jul 2022 21:42:35 +0000 (06:42 +0900)]
Add regression test for #71547

Signed-off-by: Yuki Okushi <jtitor@2k36.org>
23 months agointerpret: rename Tag/PointerTag to Prov/Provenance
Ralf Jung [Mon, 18 Jul 2022 22:47:31 +0000 (18:47 -0400)]
interpret: rename Tag/PointerTag to Prov/Provenance

Let's avoid using two different terms for the same thing -- let's just call it "provenance" everywhere.
In Miri, provenance consists of an AllocId and an SbTag (Stacked Borrows tag), which made this even more confusing.

23 months agoAuto merge of #98180 - notriddle:notriddle/rustdoc-fn, r=petrochenkov,GuillaumeGomez
bors [Tue, 19 Jul 2022 19:36:57 +0000 (19:36 +0000)]
Auto merge of #98180 - notriddle:notriddle/rustdoc-fn, r=petrochenkov,GuillaumeGomez

Improve the function pointer docs

This is #97842 but for function pointers instead of tuples. The concept is basically the same.

* Reduce duplicate impls; show `fn (T₁, T₂, …, Tₙ)` and include a sentence saying that there exists up to twelve of them.
* Show `Copy` and `Clone`.
* Show auto traits like `Send` and `Sync`, and blanket impls like `Any`.

https://notriddle.com/notriddle-rustdoc-test/std/primitive.fn.html

23 months agoErase regions before comparing signatures of foreign fns.
Camille GILLOT [Mon, 18 Jul 2022 18:41:27 +0000 (20:41 +0200)]
Erase regions before comparing signatures of foreign fns.

23 months agobetter error for bad depth on macro metavar expr
Michael Goulet [Sun, 17 Jul 2022 00:04:30 +0000 (00:04 +0000)]
better error for bad depth on macro metavar expr

23 months agoAuto merge of #99309 - RalfJung:no-large-copies, r=oli-obk
bors [Tue, 19 Jul 2022 16:33:45 +0000 (16:33 +0000)]
Auto merge of #99309 - RalfJung:no-large-copies, r=oli-obk

interpret: make some large types not Copy

Also remove some unused trait impls (mostly HashStable).

This didn't find any unnecessary copies that I managed to avoid, but it might still be better to require explicit clone for these types? Not sure.

r? `@oli-obk`

23 months agouse opaque_ty_origin_unchecked instead of destructuring HIR
Michael Goulet [Sun, 17 Jul 2022 17:37:23 +0000 (10:37 -0700)]
use opaque_ty_origin_unchecked instead of destructuring HIR

23 months agoDo not allow typeck children items to constrain outer RPITs
Michael Goulet [Sat, 16 Jul 2022 20:08:04 +0000 (20:08 +0000)]
Do not allow typeck children items to constrain outer RPITs

23 months agoUse `T` for all the function primitive docs lists
Michael Howell [Thu, 16 Jun 2022 21:44:09 +0000 (14:44 -0700)]
Use `T` for all the function primitive docs lists

23 months agoImprove the function pointer docs
Michael Howell [Thu, 16 Jun 2022 21:14:38 +0000 (14:14 -0700)]
Improve the function pointer docs

* Reduce duplicate impls; show only the `fn (T)` and include a sentence
  saying that there exists up to twelve of them.
* Show `Copy` and `Clone`.
* Show auto traits like `Send` and `Sync`, and blanket impls like `Any`.

23 months agoAdd flag to configure `noalias` on `Box<T>`
nils [Mon, 18 Jul 2022 16:17:27 +0000 (18:17 +0200)]
Add flag to configure `noalias` on `Box<T>`

To aid making an informed decision about the aliasing
rules of box, give users an option to remove `noalias`
from box.

23 months agoAuto merge of #99462 - matthiaskrgr:rollup-ihhwaru, r=matthiaskrgr
bors [Tue, 19 Jul 2022 13:49:56 +0000 (13:49 +0000)]
Auto merge of #99462 - matthiaskrgr:rollup-ihhwaru, r=matthiaskrgr

Rollup of 9 pull requests

Successful merges:

 - #98028 (Add E0790 as more specific variant of E0283)
 - #99384 (use body's param-env when checking if type needs drop)
 - #99401 (Avoid `Symbol` to `&str` conversions)
 - #99419 (Stabilize `core::task::ready!`)
 - #99435 (Revert "Stabilize $$ in Rust 1.63.0")
 - #99438 (Improve suggestions for `NonZeroT` <- `T` coercion error)
 - #99441 (Update mdbook)
 - #99453 (:arrow_up: rust-analyzer)
 - #99457 (use `par_for_each_in` in `par_body_owners` and `collect_crate_mono_items`)

Failed merges:

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

23 months agoRollup merge of #99457 - SparrowLii:para_iter, r=fee1-dead
Matthias Krüger [Tue, 19 Jul 2022 11:30:52 +0000 (13:30 +0200)]
Rollup merge of #99457 - SparrowLii:para_iter, r=fee1-dead

use `par_for_each_in` in `par_body_owners` and `collect_crate_mono_items`

Using `par_iter` in non-parallel mode will cause the entire process to abort when any iteration panics.  So we can use `par_for_each_in` instead to make the error message consistent with parallel mode. This means that the compiler will output more error messages in some cases. This fixes the following ui tests when set `parallel-compiler = true`:
```
    [ui] src/test\ui\privacy\privacy2.rs
    [ui] src/test\ui\privacy\privacy3.rs
    [ui] src/test\ui\type_length_limit.rs
```

This refers to #68171

Updates #75760

23 months agoRollup merge of #99453 - lnicola:rust-analyzer-2022-07-19, r=lnicola
Matthias Krüger [Tue, 19 Jul 2022 11:30:51 +0000 (13:30 +0200)]
Rollup merge of #99453 - lnicola:rust-analyzer-2022-07-19, r=lnicola

:arrow_up: rust-analyzer

r? `@ghost`

23 months agoRollup merge of #99441 - ehuss:update-mdbook, r=Mark-Simulacrum
Matthias Krüger [Tue, 19 Jul 2022 11:30:50 +0000 (13:30 +0200)]
Rollup merge of #99441 - ehuss:update-mdbook, r=Mark-Simulacrum

Update mdbook

Updates mdbook from 0.4.18 to 0.4.20.
Changelog: https://github.com/rust-lang/mdBook/blob/master/CHANGELOG.md#mdbook-0420

This mainly includes some minor formatting and display changes.

23 months agoRollup merge of #99438 - WaffleLapkin:dont_wrap_in_non_zero, r=compiler-errors
Matthias Krüger [Tue, 19 Jul 2022 11:30:49 +0000 (13:30 +0200)]
Rollup merge of #99438 - WaffleLapkin:dont_wrap_in_non_zero, r=compiler-errors

Improve suggestions for `NonZeroT` <- `T` coercion error

Currently, when encountering a type mismatch error with `NonZeroT` and `T` (for example `NonZeroU8` and `u8`) we errorneusly suggest wrapping expression in `NonZeroT`:
```text
error[E0308]: mismatched types
 --> ./t.rs:7:35
  |
7 |     let _: std::num::NonZeroU64 = 1;
  |            --------------------   ^ expected struct `NonZeroU64`, found integer
  |            |
  |            expected due to this
  |
help: try wrapping the expression in `std::num::NonZeroU64`
  |
7 |     let _: std::num::NonZeroU64 = std::num::NonZeroU64(1);
  |                                   +++++++++++++++++++++ +
```

I've removed this suggestion and added suggestions to call `new` (for `Option<NonZeroT>` <- `T` case) or `new` and `unwrap` (for `NonZeroT` <- `T` case):

```text
error[E0308]: mismatched types
 --> ./t.rs:7:35
  |
7 |     let _: std::num::NonZeroU64 = 1;
  |            --------------------   ^ expected struct `NonZeroU64`, found integer
  |            |
  |            expected due to this
  |
help: Consider calling `NonZeroU64::new`
  |
7 |     let _: std::num::NonZeroU64 = NonZeroU64::new(1).unwrap();
  |                                   ++++++++++++++++ ++++++++++

error[E0308]: mismatched types
 --> ./t.rs:8:43
  |
8 |     let _: Option<std::num::NonZeroU64> = 1;
  |            ----------------------------   ^ expected enum `Option`, found integer
  |            |
  |            expected due to this
  |
  = note: expected enum `Option<NonZeroU64>`
             found type `{integer}`
help: Consider calling `NonZeroU64::new`
  |
8 |     let _: Option<std::num::NonZeroU64> = NonZeroU64::new(1);
  |                                           ++++++++++++++++ +
```

r? `@compiler-errors`

23 months agoRollup merge of #99435 - CAD97:revert-dollar-dollar-crate, r=Mark-Simulacrum
Matthias Krüger [Tue, 19 Jul 2022 11:30:48 +0000 (13:30 +0200)]
Rollup merge of #99435 - CAD97:revert-dollar-dollar-crate, r=Mark-Simulacrum

Revert "Stabilize $$ in Rust 1.63.0"

This mechanically reverts commit 9edaa76adce4de737db54194eb13d6c298827b37, the one commit from #95860.

https://github.com/rust-lang/rust/issues/99035; the behavior of `$$crate` is potentially unexpected and not ready to be stabilized. https://github.com/rust-lang/rust/pull/99193 attempts to forbid `$$crate` without also destabilizing `$$` more generally.

`@rustbot` modify labels +T-compiler +T-lang +P-medium +beta-nominated +relnotes

(applying the labels I think are accurate from the issue and alternative partial revert)

cc `@Mark-Simulacrum`

23 months agoRollup merge of #99419 - yoshuawuyts:stabilize-task-ready, r=Mark-Simulacrum
Matthias Krüger [Tue, 19 Jul 2022 11:30:47 +0000 (13:30 +0200)]
Rollup merge of #99419 - yoshuawuyts:stabilize-task-ready, r=Mark-Simulacrum

Stabilize `core::task::ready!`

This stabilizes `core::task::ready!` for Rust 1.64. The FCP for stabilization was just completed here https://github.com/rust-lang/rust/issues/70922#issuecomment-1186231855. Thanks!

Closes #70922

cc/ ``@rust-lang/libs-api``

23 months agoRollup merge of #99401 - TaKO8Ki:avoid-symbol-to-&str-conversions, r=nnethercote
Matthias Krüger [Tue, 19 Jul 2022 11:30:46 +0000 (13:30 +0200)]
Rollup merge of #99401 - TaKO8Ki:avoid-symbol-to-&str-conversions, r=nnethercote

Avoid `Symbol` to `&str` conversions

`Symbol::as_str` is a slowish operation, so this patch removes some usages of it.

23 months agoRollup merge of #99384 - compiler-errors:issue-99375, r=oli-obk
Matthias Krüger [Tue, 19 Jul 2022 11:30:45 +0000 (13:30 +0200)]
Rollup merge of #99384 - compiler-errors:issue-99375, r=oli-obk

use body's param-env when checking if type needs drop

The type comes from the body, so we should be using the body's param-env, as opposed to the ADT's param env, because we know less in the latter compared to the former.

Fixes #99375

23 months agoRollup merge of #98028 - aticu:master, r=estebank
Matthias Krüger [Tue, 19 Jul 2022 11:30:44 +0000 (13:30 +0200)]
Rollup merge of #98028 - aticu:master, r=estebank

Add E0790 as more specific variant of E0283

Fixes #81701

I think this should be good to go, there are only two things where I am somewhat unsure:
- Is there a better way to get the fully-qualified path for the suggestion? I tried `self.tcx.def_path_str`, but that didn't seem to always give a correct path for the context.
- Should all this be extracted into it's own method or is it fine where it is?

r? `@estebank`

23 months agoAuto merge of #98912 - nrc:provider-it, r=yaahc
bors [Tue, 19 Jul 2022 11:28:20 +0000 (11:28 +0000)]
Auto merge of #98912 - nrc:provider-it, r=yaahc

core::any: replace some generic types with impl Trait

This gives a cleaner API since the caller only specifies the concrete type they usually want to.

r? `@yaahc`

23 months agouse `par_for_each_in` in `par_body_owners` and `collect_crate_mono_items`
SparrowLii [Tue, 19 Jul 2022 09:00:51 +0000 (17:00 +0800)]
use `par_for_each_in` in `par_body_owners` and `collect_crate_mono_items`

23 months agoAuto merge of #99451 - Dylan-DPC:rollup-ceghu18, r=Dylan-DPC
bors [Tue, 19 Jul 2022 08:32:32 +0000 (08:32 +0000)]
Auto merge of #99451 - Dylan-DPC:rollup-ceghu18, r=Dylan-DPC

Rollup of 8 pull requests

Successful merges:

 - #97183 (wf-check generators)
 - #98320 (Mention first and last macro in backtrace)
 - #99335 (Use split_once in FromStr docs)
 - #99347 (Use `LocalDefId` in `OpaqueTypeKey`)
 - #99392 (Fix debuginfo tests.)
 - #99404 (Use span_bug for unexpected field projection type)
 - #99410 (Update invalid atomic ordering lint)
 - #99434 (Fix `Skip::next` for non-fused inner iterators)

Failed merges:

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

23 months agoDon't use main; improve example
aticu [Mon, 13 Jun 2022 07:32:54 +0000 (09:32 +0200)]
Don't use main; improve example

23 months agoAdd E0790 as more specific variant of E0283
aticu [Sun, 12 Jun 2022 15:46:57 +0000 (17:46 +0200)]
Add E0790 as more specific variant of E0283

23 months ago:arrow_up: rust-analyzer
Laurențiu Nicola [Tue, 19 Jul 2022 07:16:45 +0000 (10:16 +0300)]
:arrow_up: rust-analyzer

23 months agoint_macros was only using to_xe_bytes_doc and not from_xe_bytes_doc
Antoine PLASKOWSKI [Tue, 19 Jul 2022 06:32:08 +0000 (08:32 +0200)]
int_macros was only using to_xe_bytes_doc and not from_xe_bytes_doc

23 months agoRollup merge of #99434 - timvermeulen:skip_next_non_fused, r=scottmcm
Dylan DPC [Tue, 19 Jul 2022 06:08:58 +0000 (11:38 +0530)]
Rollup merge of #99434 - timvermeulen:skip_next_non_fused, r=scottmcm

Fix `Skip::next` for non-fused inner iterators

`iter.skip(n).next()` will currently call `nth` and `next` in succession on `iter`, without checking whether `nth` exhausts the iterator. Using `?` to propagate a `None` value returned by `nth` avoids this.

23 months agoRollup merge of #99410 - tmiasko:atomic-lint, r=fee1-dead
Dylan DPC [Tue, 19 Jul 2022 06:08:57 +0000 (11:38 +0530)]
Rollup merge of #99410 - tmiasko:atomic-lint, r=fee1-dead

Update invalid atomic ordering lint

The restriction that success ordering must be at least as strong as its
failure ordering in compare-exchange operations was lifted in #98383.

23 months agoRollup merge of #99404 - jmqd:master, r=compiler-errors
Dylan DPC [Tue, 19 Jul 2022 06:08:56 +0000 (11:38 +0530)]
Rollup merge of #99404 - jmqd:master, r=compiler-errors

Use span_bug for unexpected field projection type

Improves the compiler error backtrace information, as shown in #99363,
by using `span_bug` instead of `bug`.

New output:

```
build/aarch64-apple-darwin/stage1/bin/rustc /tmp/test.rs --edition=2021
error: internal compiler error: compiler/rustc_middle/src/ty/closure.rs:185:25: Unexpected type Opaque(DefId(0:5 ~ test[db0f]::main::T::{opaque#0}), []) for `Field` projection
  --> /tmp/test.rs:11:27
   |
11 |         let Foo((a, b)) = foo;
   |                           ^^^

thread 'rustc' panicked at 'Box<dyn Any>', /Users/jmq/src/forked/rust/compiler/rustc_errors/src/lib.rs:1331:9
stack backtrace:
```

(Remainder of output truncated.)

23 months agoRollup merge of #99392 - nnethercote:fix-debuginfo-tests, r=pnkfelix
Dylan DPC [Tue, 19 Jul 2022 06:08:55 +0000 (11:38 +0530)]
Rollup merge of #99392 - nnethercote:fix-debuginfo-tests, r=pnkfelix

Fix debuginfo tests.

This is needed for my Ubuntu 22.04 box due to a slight change in gdb
output. The fix is similar to the fix in #95063.

23 months agoRollup merge of #99347 - compiler-errors:opaque-type-key-local-def-id, r=oli-obk
Dylan DPC [Tue, 19 Jul 2022 06:08:54 +0000 (11:38 +0530)]
Rollup merge of #99347 - compiler-errors:opaque-type-key-local-def-id, r=oli-obk

Use `LocalDefId` in `OpaqueTypeKey`

Addresses a `// FIXME(oli-obk): make this a LocalDefId`

r? ``@oli-obk``

23 months agoRollup merge of #99335 - Dav1dde:fromstr-docs, r=JohnTitor
Dylan DPC [Tue, 19 Jul 2022 06:08:53 +0000 (11:38 +0530)]
Rollup merge of #99335 - Dav1dde:fromstr-docs, r=JohnTitor

Use split_once in FromStr docs

Current implementation:

```rust
    fn from_str(s: &str) -> Result<Self, Self::Err> {
        let coords: Vec<&str> = s.trim_matches(|p| p == '(' || p == ')' )
                                 .split(',')
                                 .collect();

        let x_fromstr = coords[0].parse::<i32>()?;
        let y_fromstr = coords[1].parse::<i32>()?;

        Ok(Point { x: x_fromstr, y: y_fromstr })
    }
```

Creating the vector is not necessary, `split_once` does the job better.

Alternatively we could also remove `trim_matches` with `strip_prefix` and `strip_suffix`:

```rust
        let (x, y) = s
            .strip_prefix('(')
            .and_then(|s| s.strip_suffix(')'))
            .and_then(|s| s.split_once(','))
            .unwrap();
```

The question is how much 'correctness' is too much and distracts from the example. In a real implementation you would also not unwrap (or originally access the vector without bounds checks), but implementing a custom Error and adding a `From<ParseIntError>` and implementing the `Error` trait adds a lot of code to the example which is not relevant to the `FromStr` trait.

23 months agoRollup merge of #98320 - compiler-errors:macro-backtrace, r=estebank
Dylan DPC [Tue, 19 Jul 2022 06:08:52 +0000 (11:38 +0530)]
Rollup merge of #98320 - compiler-errors:macro-backtrace, r=estebank

Mention first and last macro in backtrace

Slight improvement to diagnostic mentioning what macro an error originates from. Not sure if it's worthwhile.

23 months agoRollup merge of #97183 - oli-obk:tait_ice_async, r=jackh726
Dylan DPC [Tue, 19 Jul 2022 06:08:51 +0000 (11:38 +0530)]
Rollup merge of #97183 - oli-obk:tait_ice_async, r=jackh726

wf-check generators

fixes #90409

We should not rely on generators being well formed by construction now that they can get used via type alias impl trait (and thus users can choose generic arguments that are invalid). This can cause surprising behaviour if (definitely unsound) transmutes are used, and it's generally saner to just check for well formedness.

23 months agoAuto merge of #98189 - mystor:fast_ident_literal, r=eddyb
bors [Tue, 19 Jul 2022 05:46:45 +0000 (05:46 +0000)]
Auto merge of #98189 - mystor:fast_ident_literal, r=eddyb

proc_macro/bridge: stop using a remote object handle for proc_macro Ident and Literal

This is the fourth part of https://github.com/rust-lang/rust/pull/86822, split off as requested in https://github.com/rust-lang/rust/pull/86822#pullrequestreview-1008655452. This patch transforms the `Ident` and `Group` types into structs serialized over IPC rather than handles.

Symbol values are interned on both the client and server when deserializing, to avoid unnecessary string copies and keep the size of `TokenTree` down. To do the interning efficiently on the client, the proc-macro crate is given a vendored version of the fxhash hasher, as `SipHash` appeared to cause performance issues. This was done rather than depending on `rustc_hash` as it is unfortunately difficult to depend on crates from within `proc_macro` due to it being built at the same time as `std`.

In addition, a custom arena allocator and symbol store was also added, inspired by those in `rustc_arena` and `rustc_span`. To prevent symbol re-use across multiple invocations of a macro on the same thread, a new range of `Symbol` names are used for each invocation of the macro, and symbols from previous invocations are cleaned-up.

In order to keep `Ident` creation efficient, a special ASCII-only case was added to perform ident validation without using RPC for simple identifiers. Full identifier validation couldn't be easily added, as it would require depending on the `rustc_lexer` and `unicode-normalization` crates from within `proc_macro`. Unicode identifiers are validated and normalized using RPC.

See the individual commit messages for more details on trade-offs and design decisions behind these patches.

23 months agoMention first and last macro in backtrace
Michael Goulet [Tue, 21 Jun 2022 02:25:52 +0000 (19:25 -0700)]
Mention first and last macro in backtrace

23 months agoAuto merge of #98120 - TaKO8Ki:box-diagnostic-metadata-field, r=estebank
bors [Tue, 19 Jul 2022 03:02:30 +0000 (03:02 +0000)]
Auto merge of #98120 - TaKO8Ki:box-diagnostic-metadata-field, r=estebank

[Experiment] Box `diagnostic_metadata` field

closes #97954

r? `@estebank`

23 months agoDon't add attribute to allow unused-qualifications to derive impl's
Samrat Man Singh [Thu, 7 May 2020 05:23:44 +0000 (10:53 +0530)]
Don't add attribute to allow unused-qualifications to derive impl's

Currently `#![forbid(unused_qualifications)]` is incompatible with all
derive's because we add `#[allow(unused_qualifications)]` in all
generated impl's.

23 months agoUse LocalDefId in OpaqueTypeKey
Michael Goulet [Sat, 16 Jul 2022 20:53:08 +0000 (20:53 +0000)]
Use LocalDefId in OpaqueTypeKey

23 months agotests: fix `rustdoc` tests
Artur Sinila [Tue, 19 Jul 2022 00:46:32 +0000 (03:46 +0300)]
tests: fix `rustdoc` tests

23 months agotests: fix `rustc-pass-by-value-self`
Artur Sinila [Tue, 19 Jul 2022 00:19:24 +0000 (03:19 +0300)]
tests: fix `rustc-pass-by-value-self`

23 months agotests: fix `rustc-pass-by-value-self`
Artur Sinila [Mon, 18 Jul 2022 23:54:13 +0000 (02:54 +0300)]
tests: fix `rustc-pass-by-value-self`

23 months agofeat: omit suffixes in const generics (e.g. `1_i32`)
Artur Sinila [Mon, 18 Jul 2022 23:25:14 +0000 (02:25 +0300)]
feat: omit suffixes in const generics (e.g. `1_i32`)

Closes #99255

23 months agoAuto merge of #99442 - Kobzol:revert-99062-lld-icf, r=Mark-Simulacrum
bors [Mon, 18 Jul 2022 23:20:08 +0000 (23:20 +0000)]
Auto merge of #99442 - Kobzol:revert-99062-lld-icf, r=Mark-Simulacrum

Revert "Use ICF (identical code folding) for building rustc"

Reverts rust-lang/rust#99062

Fixes: https://github.com/rust-lang/rust/issues/99440
23 months agoAdd a note about privacy to wrapping suggestion
Maybe Waffle [Mon, 18 Jul 2022 22:33:36 +0000 (02:33 +0400)]
Add a note about privacy to wrapping suggestion

23 months agoApply suggestions from the review
Maybe Waffle [Mon, 18 Jul 2022 22:15:56 +0000 (02:15 +0400)]
Apply suggestions from the review

- Use `expr.hir_id.owner` instead of `self.tcx.parent_module(expr.hir_id)`
- Use `.type_at()` instead of `.first()` + `.expect_ty()`
- Use single `.find()` with `&&` condition

Co-authored-by: Michael Goulet <michael@errs.io>
23 months agoRevert "Use ICF (identical code folding) for building rustc"
Jakub Beránek [Mon, 18 Jul 2022 21:50:00 +0000 (23:50 +0200)]
Revert "Use ICF (identical code folding) for building rustc"

23 months agoUpdate mdbook
Eric Huss [Mon, 18 Jul 2022 21:41:10 +0000 (14:41 -0700)]
Update mdbook

23 months agocheck accessibility before suggesting wrapping expressions
Maybe Waffle [Mon, 18 Jul 2022 21:16:25 +0000 (01:16 +0400)]
check accessibility before suggesting wrapping expressions

23 months agoAuto merge of #99422 - Dylan-DPC:rollup-htjofm6, r=Dylan-DPC
bors [Mon, 18 Jul 2022 20:39:24 +0000 (20:39 +0000)]
Auto merge of #99422 - Dylan-DPC:rollup-htjofm6, r=Dylan-DPC

Rollup of 7 pull requests

Successful merges:

 - #98839 (Add assertion that `transmute_copy`'s U is not larger than T)
 - #98998 (Remove branch target prologues from `#[naked] fn`)
 - #99198 (add missing null ptr check in alloc example)
 - #99344 (rustdoc: avoid inlining items with duplicate `(type, name)`)
 - #99351 (Use `typeck_results` to get accurate qpath res for arg mismatch error)
 - #99378 (interpret/visitor: add missing early return)
 - #99394 (Add regression test for #95230)

Failed merges:

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

23 months agoSuggest a fix for `NonZero*` <- `*` coercion error
Maybe Waffle [Mon, 18 Jul 2022 20:11:21 +0000 (00:11 +0400)]
Suggest a fix for `NonZero*` <- `*` coercion error

23 months agoAdd note to test about `Unfuse`
Tim Vermeulen [Mon, 18 Jul 2022 19:53:35 +0000 (21:53 +0200)]
Add note to test about `Unfuse`

23 months agoRevert "Stabilize $$ in Rust 1.63.0"
Christopher Durham [Mon, 18 Jul 2022 19:22:01 +0000 (15:22 -0400)]
Revert "Stabilize $$ in Rust 1.63.0"

This reverts commit 9edaa76adce4de737db54194eb13d6c298827b37.

23 months agoFix `Skip::next` for non-fused inner iterators
Tim Vermeulen [Mon, 18 Jul 2022 19:10:47 +0000 (21:10 +0200)]
Fix `Skip::next` for non-fused inner iterators

23 months agoGroup CSS font rule
Guillaume Gomez [Mon, 18 Jul 2022 15:45:54 +0000 (17:45 +0200)]
Group CSS font rule

23 months agointerpret: make some large types not Copy
Ralf Jung [Sat, 16 Jul 2022 02:58:20 +0000 (22:58 -0400)]
interpret: make some large types not Copy

23 months agoDo not suggest "wrapping the expression in `std::num::NonZeroU64`"
Maybe Waffle [Mon, 18 Jul 2022 17:55:47 +0000 (21:55 +0400)]
Do not suggest "wrapping the expression in `std::num::NonZeroU64`"

23 months agointerpret: remove some unused trait impls
Ralf Jung [Sat, 16 Jul 2022 00:57:14 +0000 (20:57 -0400)]
interpret: remove some unused trait impls

23 months agoAuto merge of #99406 - flip1995:clippyup, r=Manishearth
bors [Mon, 18 Jul 2022 17:48:00 +0000 (17:48 +0000)]
Auto merge of #99406 - flip1995:clippyup, r=Manishearth

Update Clippy

23 months agoCheck generators for well formedness
Oli Scherer [Fri, 27 May 2022 20:09:06 +0000 (20:09 +0000)]
Check generators for well formedness

23 months agoproc_macro: Move subspan to be a method on Span in the bridge
Nika Layzell [Sat, 9 Jul 2022 15:34:06 +0000 (11:34 -0400)]
proc_macro: Move subspan to be a method on Span in the bridge

This method is still only used for Literal::subspan, however the
implementation only depends on the Span component, so it is simpler and
more efficient for now to pass down only the information that is needed.
In the future, if more information about the Literal is required in the
implementation (e.g. to validate that spans line up as expected with
source text), that extra information can be added back with extra
arguments.