]> git.lizzy.rs Git - rust.git/log
rust.git
23 months agoAuto merge of #96978 - lqd:win_pgo2, r=Mark-Simulacrum
bors [Mon, 11 Jul 2022 20:32:06 +0000 (20:32 +0000)]
Auto merge of #96978 - lqd:win_pgo2, r=Mark-Simulacrum

Utilize PGO for windows x64 rustc dist builds

This PR adds PGO support for the CI x64 windows dist builds.

These are the results from running the rustc-perf benchmarks:
![image](https://user-images.githubusercontent.com/247183/177662869-683a8034-7c95-42bf-9900-9ffd66677fcf.png)

Thanks to `@Kobzol,` `@michaelwoerister,` `@wesleywiser,` `@Mark-Simulacrum` for their precious help.

23 months agoAuto merge of #98637 - cjgillot:bare-trait-anon-lt, r=petrochenkov
bors [Mon, 11 Jul 2022 17:09:37 +0000 (17:09 +0000)]
Auto merge of #98637 - cjgillot:bare-trait-anon-lt, r=petrochenkov

Create fresh lifetime parameters for bare fn trait too

The current code fails to account for the equivalence between `dyn FnMut(&mut u8)` and bare `FnMut(&mut u8)`, and treated them differently.

This PR introduces a special case for `Fn` traits, which are always fully resolved.

Fixes #98616
Fixes #98726
This will require a beta-backport, as beta contains that bug.

r? `@petrochenkov`

23 months agointroduce PGO on the `dist-x86_64-msvc` builder
Rémy Rakic [Tue, 14 Jun 2022 19:02:26 +0000 (21:02 +0200)]
introduce PGO on the `dist-x86_64-msvc` builder

This adds windows-specific behavior into the PGO script, and enables it
on CI.

23 months agomake linux PGO script more generic
Rémy Rakic [Tue, 14 Jun 2022 20:19:07 +0000 (22:19 +0200)]
make linux PGO script more generic

This extracts the linux-isms into variables, so that the script can be
extended to do PGO on windows. These variables will be overriden in a
few spots, in windows-specific blocks.

23 months agoextend bootstrap for PGO on windows
Rémy Rakic [Mon, 16 May 2022 01:40:52 +0000 (03:40 +0200)]
extend bootstrap for PGO on windows

When building LLVM/LLD as part of a build that asks LLVM to generate profiles, e.g. when
doing PGO, cmake or clang-cl don't automatically link clang's profiler runtime in,
causing undefined reference errors at link-time.

We do that manually, by adding clang's resource library folder to the library search path:
- for LLVM itself, by extending the linker args that `rustc_llvm`'s build script
  uses, to avoid the linker errors when linking `rustc_driver`.
- for LLD, by extending cmake's linker flags during the LLD build step.

23 months agobump CI LLVM to 14.0.5
Rémy Rakic [Fri, 13 May 2022 07:22:36 +0000 (09:22 +0200)]
bump CI LLVM to 14.0.5

The version 14.0.2 we currently use is busted on windows at the very
least.

23 months agoAuto merge of #99151 - Dylan-DPC:rollup-40aqkxy, r=Dylan-DPC
bors [Mon, 11 Jul 2022 12:16:20 +0000 (12:16 +0000)]
Auto merge of #99151 - Dylan-DPC:rollup-40aqkxy, r=Dylan-DPC

Rollup of 5 pull requests

Successful merges:

 - #98882 (explain doc comments in macros a bit)
 - #98907 (Deny float const params even when `adt_const_params` is enabled)
 - #99091 (Do not mention private types from other crates as impl candidates)
 - #99140 (Implement `SourceMap::is_span_accessible`)
 - #99147 (Mention similarly named associated type even if it's not clearly in supertrait)

Failed merges:

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

23 months agoRollup merge of #99147 - compiler-errors:issue-55673, r=lcnr
Dylan DPC [Mon, 11 Jul 2022 09:49:33 +0000 (15:19 +0530)]
Rollup merge of #99147 - compiler-errors:issue-55673, r=lcnr

Mention similarly named associated type even if it's not clearly in supertrait

Due to query cycle avoidance, we sometimes restrict the candidates in `complain_about_assoc_type_not_found` too much so that we can't detect typo replacements from just supertraits.

This creates a more general note of the existence of a similarly named associated type from _all_ visible traits when possible.

Fixes #55673

23 months agoRollup merge of #99140 - TaKO8Ki:implement-is-accessible-span, r=fee1-dead
Dylan DPC [Mon, 11 Jul 2022 09:49:32 +0000 (15:19 +0530)]
Rollup merge of #99140 - TaKO8Ki:implement-is-accessible-span, r=fee1-dead

Implement `SourceMap::is_span_accessible`

This patch adds `SourceMap::is_span_accessible` and replaces `span_to_snippet(span).is_ok()` and `span_to_snippet(span).is_err()` with it. This removes a `&str` to `String` conversion.

23 months agoRollup merge of #99091 - compiler-errors:private-types-should-stay-private, r=lcnr
Dylan DPC [Mon, 11 Jul 2022 09:49:31 +0000 (15:19 +0530)]
Rollup merge of #99091 - compiler-errors:private-types-should-stay-private, r=lcnr

Do not mention private types from other crates as impl candidates

Fixes #99080

23 months agoRollup merge of #98907 - compiler-errors:plz-no-float, r=oli-obk
Dylan DPC [Mon, 11 Jul 2022 09:49:30 +0000 (15:19 +0530)]
Rollup merge of #98907 - compiler-errors:plz-no-float, r=oli-obk

Deny float const params even when `adt_const_params` is enabled

Supersedes #98825
Fixes #98813

r? ``@oli-obk``

23 months agoRollup merge of #98882 - compiler-errors:explain-doc-comments-in-macros, r=davidtwco
Dylan DPC [Mon, 11 Jul 2022 09:49:29 +0000 (15:19 +0530)]
Rollup merge of #98882 - compiler-errors:explain-doc-comments-in-macros, r=davidtwco

explain doc comments in macros a bit

Open to suggestions on improving this... macro parsing is very foreign to me.

Should we have a structured suggestion to turn them into their regular non-doc comments?

Fixes #92846
Fixes #97850

23 months agoAuto merge of #97841 - nvzqz:inline-encode-wide, r=thomcc
bors [Mon, 11 Jul 2022 09:30:54 +0000 (09:30 +0000)]
Auto merge of #97841 - nvzqz:inline-encode-wide, r=thomcc

Inline Windows `OsStrExt::encode_wide`

User crates currently produce much more code than necessary because the optimizer fails to make assumptions about this method.

23 months agorename a method
Takayuki Maeda [Mon, 11 Jul 2022 07:51:19 +0000 (16:51 +0900)]
rename a method

23 months agoUse Visibility::is_accessible_from to make suggestion more specific
Michael Goulet [Mon, 11 Jul 2022 07:06:18 +0000 (07:06 +0000)]
Use Visibility::is_accessible_from to make suggestion more specific

23 months agoDo not mention private Self types from other crates
Michael Goulet [Sat, 9 Jul 2022 18:39:51 +0000 (18:39 +0000)]
Do not mention private Self types from other crates

23 months agoMention similarly named associated type even if it's not clearly in supertrait
Michael Goulet [Mon, 11 Jul 2022 06:53:01 +0000 (06:53 +0000)]
Mention similarly named associated type even if it's not clearly in supertrait

23 months agoAuto merge of #98369 - jyn514:configure.py, r=Mark-Simulacrum
bors [Mon, 11 Jul 2022 06:37:20 +0000 (06:37 +0000)]
Auto merge of #98369 - jyn514:configure.py, r=Mark-Simulacrum

Remove unsupported options in configure.py

I've seen people using `optimize = false` and `full-bootstrap = true` in the past, without knowing
that they're not recommended. Remove `optimize` and a few other options that are always a bad idea,
and document that full-bootstrap is only for testing reproducible builds.

23 months agoAuto merge of #99130 - jyn514:std-cache-invalidation, r=Mark-Simulacrum
bors [Mon, 11 Jul 2022 03:56:37 +0000 (03:56 +0000)]
Auto merge of #99130 - jyn514:std-cache-invalidation, r=Mark-Simulacrum

Fix `x build library/std compiler/rustc`

Previously, this was broken because of improper caching:
1. `StepDescription::maybe_run` builds `Compile::Std`, which only built `std` and not `proc_macro`
1. `Std` calls `builder.ensure(StdLink)`
1. `Rustc` calls `ensure(Std)`, which builds all crates, including `proc_macro`
1. `Rustc` calls `ensure(StdLink)`. `ensure` would see that it had already been run and do nothing.  <-- bug is here
1. Cargo gives an error that `proc_macro` doesn't exist.

This fixes the caching by adding `crates` to `StdLink`, so it will get rerun if the crates that are built change.

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

23 months agoimplement `is_accessible_span`
Takayuki Maeda [Mon, 11 Jul 2022 02:36:15 +0000 (11:36 +0900)]
implement `is_accessible_span`

23 months agoAuto merge of #98526 - jyn514:download-llvm-outside-checkout, r=Mark-Simulacrum
bors [Mon, 11 Jul 2022 01:15:47 +0000 (01:15 +0000)]
Auto merge of #98526 - jyn514:download-llvm-outside-checkout, r=Mark-Simulacrum

Allow using `download-ci-llvm = true` outside the git checkout

`@bjorn3` noticed that this is already allowed today when download-llvm is disabled, but breaks with it enabled:
```
$ ./rust2/x.py build
fatal: not a git repository (or any of the parent directories): .git
thread 'main' panicked at 'command did not execute successfully: "git" "rev-list" "--author=bors@rust-lang.org" "-n1" "--first-parent" "HEAD" "--" "/home/jnelson/rust-lang/rust2/src/llvm-project" "/home/jnelson/rust-lang/rust2/src/bootstrap/download-ci-llvm-stamp" "/home/jnelson/rust-lang/rust2/src/version"
expected success, got: exit status: 128', src/bootstrap/native.rs:134:20
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
```

Support it too for consistency. It's unclear to me when anyone would need to use this, but `@bjorn3`
feels we should support it, and it's not much additional effort to get it working.

23 months agoDeny floats even when adt_const_params is enabled
Michael Goulet [Mon, 4 Jul 2022 23:44:41 +0000 (23:44 +0000)]
Deny floats even when adt_const_params is enabled

23 months agouse subdiagnostic for message
Michael Goulet [Fri, 8 Jul 2022 03:21:49 +0000 (03:21 +0000)]
use subdiagnostic for message

23 months agoexplain doc comments in macros a bit
Michael Goulet [Mon, 4 Jul 2022 08:42:40 +0000 (08:42 +0000)]
explain doc comments in macros a bit

23 months agoFix `x build library/std compiler/rustc`
Joshua Nelson [Sun, 10 Jul 2022 22:24:43 +0000 (17:24 -0500)]
Fix `x build library/std compiler/rustc`

Previously, this was broken because of improper caching:
1. `StepDescription::maybe_run` builds `Compile::Std`, which only built `std` and not `proc_macro`
1. `Std` calls `builder.ensure(StdLink)`
1. `Rustc` calls `ensure(Std)`, which builds all crates, including `proc_macro`
1. `Rustc` calls `ensure(StdLink)`. `ensure` would see that it had already been run and do nothing.  <-- bug is here
1. Cargo gives an error that `proc_macro` doesn't exist.

This fixes the caching by adding `crates` to `StdLink`, so it will get rerun if the crates that are
built change.  This also does the same for `RustcLink`; it doesn't matter in practice currently
because nothing uses it except `impl Step for Rustc`, but it will avoid bugs if we start using it in
the future (e.g. to build individual crates for rustfmt).

23 months agoAuto merge of #99133 - matthiaskrgr:rollup-eignphd, r=matthiaskrgr
bors [Sun, 10 Jul 2022 22:34:50 +0000 (22:34 +0000)]
Auto merge of #99133 - matthiaskrgr:rollup-eignphd, r=matthiaskrgr

Rollup of 5 pull requests

Successful merges:

 - #98713 (promote placeholder bounds to 'static obligations)
 - #99094 (Remove extra space in AtomicPtr::new docs)
 - #99095 (Remove duplicate notes from error on inter-crate ambiguous impl of traits)
 - #99114 (Group .test-arrow CSS rules and fix rgb/rgba property)
 - #99128 (Fix `download-ci-llvm` NixOS patching for binaries)

Failed merges:

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

23 months agoRollup merge of #99128 - oxalica:fix/ci-llvm-patchelf, r=jyn514
Matthias Krüger [Sun, 10 Jul 2022 22:33:51 +0000 (00:33 +0200)]
Rollup merge of #99128 - oxalica:fix/ci-llvm-patchelf, r=jyn514

Fix `download-ci-llvm` NixOS patching for binaries

LLVM tools should also be patched, since they are used in some tests, specially,
- src/test/run-make-fulldeps/cross-lang-lto (llvm-ar)
- src/test/run-make-fulldeps/cross-lang-lto-upstream-rlibs (llvm-ar)
- src/test/run-make-fulldeps/issue-64153 (llvm-objdump)

To be more future proof, we should patch all binaries in `bin`, which is done in this PR.

23 months agoRollup merge of #99114 - GuillaumeGomez:css-cleanup, r=Dylan-DPC
Matthias Krüger [Sun, 10 Jul 2022 22:33:50 +0000 (00:33 +0200)]
Rollup merge of #99114 - GuillaumeGomez:css-cleanup, r=Dylan-DPC

Group .test-arrow CSS rules and fix rgb/rgba property

Surprisingly, the web browsers were handling the `rgb`/`rgba` typo correctly. At least it now is as expected.

For the rest, it's simply grouping `.test-arrow` rules.

r? ``@Dylan-DPC``

23 months agoRollup merge of #99095 - rhysd:issue-99092, r=compiler-errors
Matthias Krüger [Sun, 10 Jul 2022 22:33:49 +0000 (00:33 +0200)]
Rollup merge of #99095 - rhysd:issue-99092, r=compiler-errors

Remove duplicate notes from error on inter-crate ambiguous impl of traits

Fixes #99092

23 months agoRollup merge of #99094 - AldaronLau:atomic-ptr-extra-space, r=Dylan-DPC
Matthias Krüger [Sun, 10 Jul 2022 22:33:48 +0000 (00:33 +0200)]
Rollup merge of #99094 - AldaronLau:atomic-ptr-extra-space, r=Dylan-DPC

Remove extra space in AtomicPtr::new docs

23 months agoRollup merge of #98713 - nikomatsakis:issue-98693, r=jackh726
Matthias Krüger [Sun, 10 Jul 2022 22:33:47 +0000 (00:33 +0200)]
Rollup merge of #98713 - nikomatsakis:issue-98693, r=jackh726

promote placeholder bounds to 'static obligations

In NLL, when we are promoting a bound out from a closure, if we have a requirement that `T: 'a` where `'a` is in a higher universe, we were previously ignoring that, which is totally wrong. We should be promoting those constraints to `'static`, since universes are not expressible across closure boundaries.

Fixes #98693

~~(Marking as WIP because I'm still running tests, haven't add the new test, etc)~~

r? ``@jackh726``

23 months agoFix `download-ci-llvm` NixOS patching for binaries
oxalica [Sun, 10 Jul 2022 21:40:48 +0000 (05:40 +0800)]
Fix `download-ci-llvm` NixOS patching for binaries

LLVM tools should also be patched, since they are used in some tests,
specially,
- src/test/run-make-fulldeps/cross-lang-lto (llvm-ar)
- src/test/run-make-fulldeps/cross-lang-lto-upstream-rlibs (llvm-ar)
- src/test/run-make-fulldeps/issue-64153 (llvm-objdump)

To be more future proof, we should patch all binaries in `bin`.

23 months agoAllow using `download-ci-llvm = true` outside the git checkout
Joshua Nelson [Sun, 26 Jun 2022 09:39:46 +0000 (04:39 -0500)]
Allow using `download-ci-llvm = true` outside the git checkout

@bjorn3 noticed that this is already allowed today when download-llvm is disabled, but breaks with it enabled:
```
$ ./rust2/x.py build
fatal: not a git repository (or any of the parent directories): .git
thread 'main' panicked at 'command did not execute successfully: "git" "rev-list" "--author=bors@rust-lang.org" "-n1" "--first-parent" "HEAD" "--" "/home/jnelson/rust-lang/rust2/src/llvm-project" "/home/jnelson/rust-lang/rust2/src/bootstrap/download-ci-llvm-stamp" "/home/jnelson/rust-lang/rust2/src/version"
expected success, got: exit status: 128', src/bootstrap/native.rs:134:20
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
```

Support it too for consistency. It's unclear to me when anyone would need to use this, but @bjorn3
feels we should support it, and it's not much additional effort to get it working.

This also updates a bunch of other git commands that were similarly depending on the current directory.

23 months agoRemove unsupported options in configure.py
Joshua Nelson [Wed, 22 Jun 2022 03:26:13 +0000 (22:26 -0500)]
Remove unsupported options in configure.py

I've seen people using `optimize = false` and `full-bootstrap = true` in the past, without knowing
that they're not recommended. Remove `optimize` and a few other options that are always a bad idea,
and document that full-bootstrap is only for testing reproducible builds.

23 months agoAuto merge of #99107 - weihanglo:update-cargo, r=ehuss
bors [Sun, 10 Jul 2022 19:26:03 +0000 (19:26 +0000)]
Auto merge of #99107 - weihanglo:update-cargo, r=ehuss

Update cargo

7 commits in c0bbd42ce5e83fe2a93e817c3f9b955492d3130a..b1dd22e668af5279e13a071ad4b17435bd6bfa4c
2022-07-03 13:41:11 +0000 to 2022-07-09 14:48:50 +0000

- Mention `[patch]` config in "Overriding Dependencies" (rust-lang/cargo#10836)
- Update terminal-width flag. (rust-lang/cargo#10833)
- Refactor check_yanked to avoid some duplication (rust-lang/cargo#10835)
- Fix publishing to crates.io with -Z sparse-registry (rust-lang/cargo#10831)
- Make `is_yanked` return `Poll<>` (rust-lang/cargo#10830)
- Fix corrupted git checkout recovery. (rust-lang/cargo#10829)
- add a cache for discovered workspace roots (rust-lang/cargo#10776)

23 months agoAuto merge of #98785 - compiler-errors:no-check-expr-in-check-compatible, r=estebank
bors [Sun, 10 Jul 2022 16:45:17 +0000 (16:45 +0000)]
Auto merge of #98785 - compiler-errors:no-check-expr-in-check-compatible, r=estebank

Do not call `check_expr` in `check_compatible`, since it has side-effects

Fixes a weird suggestion in #98784

found later:
Fixes #98894
Fixes #98897

23 months agoAuto merge of #98463 - mystor:expand_expr_bool, r=eddyb
bors [Sun, 10 Jul 2022 14:02:45 +0000 (14:02 +0000)]
Auto merge of #98463 - mystor:expand_expr_bool, r=eddyb

proc_macro: Fix expand_expr expansion of bool literals

Previously, the expand_expr method would expand bool literals as a
`Literal` token containing a `LitKind::Bool`, rather than as an `Ident`.
This is not a valid token, and the `LitKind::Bool` case needs to be
handled seperately.

Tests were added to more deeply compare the streams in the expand-expr
test suite to catch mistakes like this in the future.

23 months agoAuto merge of #99112 - matthiaskrgr:rollup-uv2zk4d, r=matthiaskrgr
bors [Sun, 10 Jul 2022 11:35:12 +0000 (11:35 +0000)]
Auto merge of #99112 - matthiaskrgr:rollup-uv2zk4d, r=matthiaskrgr

Rollup of 5 pull requests

Successful merges:

 - #99045 (improve print styles)
 - #99086 (Fix display of search result crate filter dropdown)
 - #99100 (Fix binary name in help message for test binaries)
 - #99103 (Avoid some `&str` to `String` conversions)
 - #99109 (fill new tracking issue for `feature(strict_provenance_atomic_ptr)`)

Failed merges:

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

23 months agoGroup .test-arrow CSS rules and fix rgb/rgba property
Guillaume Gomez [Sun, 10 Jul 2022 10:48:11 +0000 (12:48 +0200)]
Group .test-arrow CSS rules and fix rgb/rgba property

23 months agoRollup merge of #99109 - WaffleLapkin:atomic_ti, r=Dylan-DPC
Matthias Krüger [Sun, 10 Jul 2022 09:52:18 +0000 (11:52 +0200)]
Rollup merge of #99109 - WaffleLapkin:atomic_ti, r=Dylan-DPC

fill new tracking issue for `feature(strict_provenance_atomic_ptr)`

New tracking issue: #99108.

The generic strict provenance issue has a lot of discussions on its own, so I think it's meaningful to have a separate issue for atomic ptr methods.

23 months agoRollup merge of #99103 - TaKO8Ki:avoid-&str-to-string-conversions, r=oli-obk
Matthias Krüger [Sun, 10 Jul 2022 09:52:17 +0000 (11:52 +0200)]
Rollup merge of #99103 - TaKO8Ki:avoid-&str-to-string-conversions, r=oli-obk

Avoid some `&str` to `String` conversions

This patch removes some `&str` to `String` conversions.

23 months agoRollup merge of #99100 - Smittyvb:test-cli-binary-name, r=thomcc
Matthias Krüger [Sun, 10 Jul 2022 09:52:16 +0000 (11:52 +0200)]
Rollup merge of #99100 - Smittyvb:test-cli-binary-name, r=thomcc

Fix binary name in help message for test binaries

Currently the help output for a test binary uses the first argument instead of the binary name in the help output:

```
$ cargo test -- --help
...
Usage: --help [OPTIONS] [FILTERS...]
...
```

This fixes it to use the name of the binary (or `...` if there is no binary name passed on argv):

```
$ cargo test -- --help
...
Usage: /tmp/x/target/debug/deps/x-80c11a15ad4e1bf3 [OPTIONS] [FILTERS...]
...
```

23 months agoRollup merge of #99086 - GuillaumeGomez:search-result-crate-filter-dropdown, r=notriddle
Matthias Krüger [Sun, 10 Jul 2022 09:52:15 +0000 (11:52 +0200)]
Rollup merge of #99086 - GuillaumeGomez:search-result-crate-filter-dropdown, r=notriddle

Fix display of search result crate filter dropdown

In case a crate name is too long, the `<select>` completely overflows its parent. Another problem is that there is left margin on the `select` which break the alignment. You can see both issues here:

![Screenshot from 2022-07-09 15-31-12](https://user-images.githubusercontent.com/3050060/178108959-0eb5af19-ec60-4d34-a2fd-c27147683c78.png)

And with the fix:

![Screenshot from 2022-07-09 15-33-37](https://user-images.githubusercontent.com/3050060/178108980-71030a92-84ee-4ee5-98e3-f97d03a6fbaf.png)

cc `@jsha`
r? `@notriddle`

23 months agoRollup merge of #99045 - 1011X:patch-1, r=GuillaumeGomez
Matthias Krüger [Sun, 10 Jul 2022 09:52:14 +0000 (11:52 +0200)]
Rollup merge of #99045 - 1011X:patch-1, r=GuillaumeGomez

improve print styles

this change removes some interactive elements in ``@media` print` form.

more specifically, it removes the sidebar, source links, the expand/collapse toggle buttons, and the `#copy-path` button.
it also adjusts some spacing and removes the `.top-doc` description completely if it's currently collapsed.

23 months agofill new tracking issue for `feature(strict_provenance_atomic_ptr)`
Maybe Waffle [Sun, 10 Jul 2022 09:17:33 +0000 (13:17 +0400)]
fill new tracking issue for `feature(strict_provenance_atomic_ptr)`

23 months agoAuto merge of #95295 - CAD97:layout-isize, r=scottmcm
bors [Sun, 10 Jul 2022 08:54:32 +0000 (08:54 +0000)]
Auto merge of #95295 - CAD97:layout-isize, r=scottmcm

Enforce that layout size fits in isize in Layout

As it turns out, enforcing this _in APIs that already enforce `usize` overflow_ is fairly trivial. `Layout::from_size_align_unchecked` continues to "allow" sizes which (when rounded up) would overflow `isize`, but these are now declared as library UB for `Layout`, meaning that consumers of `Layout` no longer have to check this before making an allocation.

(Note that this is "immediate library UB;" IOW it is valid for a future release to make this immediate "language UB," and there is an extant patch to do so, to allow Miri to catch this misuse.)

See also #95252, [Zulip discussion](https://rust-lang.zulipchat.com/#narrow/stream/219381-t-libs/topic/Layout.20Isn't.20Enforcing.20The.20isize.3A.3AMAX.20Rule).
Fixes https://github.com/rust-lang/rust/issues/95334

Some relevant quotes:

`@eddyb,` https://github.com/rust-lang/rust/pull/95252#issuecomment-1078513769

> [B]ecause of the non-trivial presence of both of these among code published on e.g. crates.io:
>
>   1. **`Layout` "producers" / `GlobalAlloc` "users"**: smart pointers (including `alloc::rc` copies with small tweaks), collections, etc.
>   2. **`Layout` "consumers" / `GlobalAlloc` "providers"**: perhaps fewer of these, but anything built on top of OS APIs like `mmap` will expose `> isize::MAX` allocations (on 32-bit hosts) if they lack extra checks
>
> IMO the only responsible option is to enforce the `isize::MAX` limit in `Layout`, which:
>
>   * makes `Layout` _sound_ in terms of only ever allowing allocations where `(alloc_base_ptr: *mut u8).offset(size)` is never UB
>   * frees both "producers" and "consumers" of `Layout` from manually reimplementing the checks
>     * manual checks can be risky, e.g. if the final size passed to the allocator isn't the one being checked
>     * this applies retroactively, fixing the overall soundness of existing code with zero transition period or _any_ changes required from users (as long as going through `Layout` is mandatory, making a "choke point")
>
>
> Feel free to quote this comment onto any relevant issue, I might not be able to keep track of developments.

`@Gankra,` https://github.com/rust-lang/rust/pull/95252#issuecomment-1078556371

> As someone who spent way too much time optimizing libcollections checks for this stuff and tried to splatter docs about it everywhere on the belief that it was a reasonable thing for people to manually take care of: I concede the point, it is not reasonable. I am wholy spiritually defeated by the fact that _liballoc_ of all places is getting this stuff wrong. This isn't throwing shade at the folks who implemented these Rc features, but rather a statement of how impractical it is to expect anyone out in the wider ecosystem to enforce them if _some of the most audited rust code in the library that defines the very notion of allocating memory_ can't even reliably do it.
>
> We need the nuclear option of Layout enforcing this rule. Code that breaks this rule is _deeply_ broken and any "regressions" from changing Layout's contract is a _correctness_ fix. Anyone who disagrees and is sufficiently motivated can go around our backs but the standard library should 100% refuse to enable them.

cc also `@RalfJung` `@rust-lang/wg-allocators.` Even though this technically supersedes #95252, those potential failure points should almost certainly still get nicer panics than just "unwrap failed" (which they would get by this PR).

It might additionally be worth recommending to users of the `Layout` API that they should ideally use `.and_then`/`?` to complete the entire layout calculation, and then `panic!` from a single location at the end of `Layout` manipulation, to reduce the overhead of the checks and optimizations preserving the exact location of each `panic` which are conceptually just one failure: allocation too big.

Probably deserves a T-lang and/or T-libs-api FCP (this technically solidifies the [objects must be no larger than `isize::MAX`](https://rust-lang.github.io/unsafe-code-guidelines/layout/scalars.html#isize-and-usize) rule further, and the UCG document says this hasn't been RFCd) and a crater run. Ideally, no code exists that will start failing with this addition; if it does, it was _likely_ (but not certainly) causing UB.

Changes the raw_vec allocation path, thus deserves a perf run as well.

I suggest hiding whitespace-only changes in the diff view.

23 months ago7 commits in c0bbd42ce5e83fe2a93e817c3f9b955492d3130a..b1dd22e668af5279e13a071ad4b174...
Weihang Lo [Sun, 10 Jul 2022 07:59:36 +0000 (08:59 +0100)]
7 commits in c0bbd42ce5e83fe2a93e817c3f9b955492d3130a..b1dd22e668af5279e13a071ad4b17435bd6bfa4c
2022-07-03 13:41:11 +0000 to 2022-07-09 14:48:50 +0000

- Mention `[patch]` config in "Overriding Dependencies" (rust-lang/cargo#10836)
- Update terminal-width flag. (rust-lang/cargo#10833)
- Refactor check_yanked to avoid some duplication (rust-lang/cargo#10835)
- Fix publishing to crates.io with -Z sparse-registry (rust-lang/cargo#10831)
- Make `is_yanked` return `Poll<>` (rust-lang/cargo#10830)
- Fix corrupted git checkout recovery. (rust-lang/cargo#10829)
- add a cache for discovered workspace roots (rust-lang/cargo#10776)

23 months agoRemove duplicate notes from error on inter-crate ambiguous impl of traits (fix #99092)
rhysd [Sat, 9 Jul 2022 17:48:53 +0000 (02:48 +0900)]
Remove duplicate notes from error on inter-crate ambiguous impl of traits (fix #99092)

23 months agoAuto merge of #97522 - xfix:stabilize-slice-from-raw-parts, r=dtolnay
bors [Sun, 10 Jul 2022 06:26:03 +0000 (06:26 +0000)]
Auto merge of #97522 - xfix:stabilize-slice-from-raw-parts, r=dtolnay

Partially stabilize const_slice_from_raw_parts

This doesn't stabilize methods working on mutable pointers.

This pull request continues from #94946.

Pinging `@rust-lang/wg-const-eval` this because I use `rustc_allow_const_fn_unstable`. I believe this is justifiable as it's already possible to use `slice::from_raw_parts` in stable by abusing `transmute`. The stable alternative to this would be to provide a stable const implementation of `std::ptr::from_raw_parts` (as it can already be implemented in stable).

```rust
use std::mem;

#[repr(C)]
struct Slice<T> {
    data: *const T,
    len: usize,
}

fn main() {
    let data: *const i32 = [1, 2, 3, 4].as_ptr();
    let len = 4;
    println!("{:?}", unsafe {
        mem::transmute::<Slice<i32>, &[i32]>(Slice { data, len })
    });
}
```

`@rustbot` modify labels: +T-libs-api

23 months agoAuto merge of #98213 - notriddle:notriddle/clap-3, r=Mark-Simulacrum
bors [Sun, 10 Jul 2022 03:45:08 +0000 (03:45 +0000)]
Auto merge of #98213 - notriddle:notriddle/clap-3, r=Mark-Simulacrum

Bump to clap 3

This PR, along with several others, will entirely remove the Clap 2 dependency from the rust source tree.

* https://github.com/rust-lang/rust-installer/pull/114
* https://github.com/rust-lang/rls/pull/1779

This PR includes a submodule bump for rust-installer, which includes the following PRs:

* https://github.com/rust-lang/rust-installer/pull/114
* https://github.com/rust-lang/rust-installer/pull/113
* https://github.com/rust-lang/rust-installer/pull/115

23 months agoFix binary name in help message for test binaries
Smitty [Sat, 9 Jul 2022 22:52:37 +0000 (18:52 -0400)]
Fix binary name in help message for test binaries

23 months agoAuto merge of #98950 - ChrisDenton:getoverlapped-io, r=thomcc
bors [Sat, 9 Jul 2022 22:37:56 +0000 (22:37 +0000)]
Auto merge of #98950 - ChrisDenton:getoverlapped-io, r=thomcc

Windows: Fallback for overlapped I/O

Fixes #98947

23 months agoPartially stabilize const_slice_from_raw_parts
Konrad Borowski [Sun, 29 May 2022 16:01:26 +0000 (18:01 +0200)]
Partially stabilize const_slice_from_raw_parts

This doesn't stabilize methods working on mutable pointers.

23 months agoDo not call `check_expr` in `check_compatible`, since it has side-effects and we...
Michael Goulet [Fri, 1 Jul 2022 22:16:05 +0000 (22:16 +0000)]
Do not call `check_expr` in `check_compatible`, since it has side-effects and we've already checked all args

23 months agoAuto merge of #99056 - lcnr:higher_ranked_sub, r=oli-obk
bors [Sat, 9 Jul 2022 19:57:13 +0000 (19:57 +0000)]
Auto merge of #99056 - lcnr:higher_ranked_sub, r=oli-obk

don't use `commit_if_ok` during `higher_ranked_sub`

This snapshot doesn't really do anything useful for us, especially once we deal with placeholder outlive bounds during trait solving.

I guess that currently the idea is that `higher_ranked_sub` could cause a later `leak_check` to fail even if the combine operation isn't actually relevant. But really, using combine outside of snapshot and ignoring its result is wrong anyways, as it can constrain inference variables.

r? rust-lang/types

23 months agoRemove extra space in AtomicPtr::new docs
Jeron Aldaron Lau [Sat, 9 Jul 2022 19:20:34 +0000 (14:20 -0500)]
Remove extra space in AtomicPtr::new docs

23 months agoavoid some `&str` to `String` conversions
Takayuki Maeda [Sat, 9 Jul 2022 18:18:56 +0000 (03:18 +0900)]
avoid some `&str` to `String` conversions

23 months agoAuto merge of #98957 - RalfJung:zst-are-different, r=lcnr,oli-obk
bors [Sat, 9 Jul 2022 17:16:00 +0000 (17:16 +0000)]
Auto merge of #98957 - RalfJung:zst-are-different, r=lcnr,oli-obk

 don't allow ZST in ScalarInt

There are several indications that we should not ZST as a ScalarInt:
- We had two ways to have ZST valtrees, either an empty `Branch` or a `Leaf` with a ZST in it.
  `ValTree::zst()` used the former, but the latter could possibly arise as well.
- Likewise, the interpreter had `Immediate::Uninit` and `Immediate::Scalar(Scalar::ZST)`.
- LLVM codegen already had to special-case ZST ScalarInt.

So I propose we stop using ScalarInt to represent ZST (which are clearly not integers). Instead, we can add new ZST variants to those types that did not have other variants which could be used for this purpose.

Based on https://github.com/rust-lang/rust/pull/98831. Only the commits starting from "don't allow ZST in ScalarInt" are new.

r? `@oli-obk`

23 months agoUpdate Cargo.lock
Michael Howell [Mon, 20 Jun 2022 18:41:56 +0000 (11:41 -0700)]
Update Cargo.lock

23 months agoFix epage's nits
Michael Howell [Mon, 20 Jun 2022 18:04:34 +0000 (11:04 -0700)]
Fix epage's nits

* Use real newlines in command descriptions
* Make `--dest-dir` optional
* Show help message when no subcommand is supplied

23 months agoUpdate submodule rust-installer
Michael Howell [Sat, 18 Jun 2022 15:54:00 +0000 (08:54 -0700)]
Update submodule rust-installer

This includes the following pull requests:

* https://github.com/rust-lang/rust-installer/pull/114
* https://github.com/rust-lang/rust-installer/pull/113

23 months agoBump to clap 3
Michael Howell [Fri, 17 Jun 2022 21:53:03 +0000 (14:53 -0700)]
Bump to clap 3

23 months agoAuto merge of #99082 - matthiaskrgr:rollup-nouwsh7, r=matthiaskrgr
bors [Sat, 9 Jul 2022 14:46:29 +0000 (14:46 +0000)]
Auto merge of #99082 - matthiaskrgr:rollup-nouwsh7, r=matthiaskrgr

Rollup of 3 pull requests

Successful merges:

 - #99022 (MIR dataflow: Rename function to `always_storage_live_locals`)
 - #99050 (Clarify MIR semantics of storage statements)
 - #99067 (Intra-doc-link-ify reference to Clone::clone_from)

Failed merges:

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

23 months agoAdd GUI test for search result crate filter dropdown
Guillaume Gomez [Sat, 9 Jul 2022 13:54:36 +0000 (15:54 +0200)]
Add GUI test for search result crate filter dropdown

23 months agoFix display of search result crate filter dropdown
Guillaume Gomez [Sat, 9 Jul 2022 13:54:14 +0000 (15:54 +0200)]
Fix display of search result crate filter dropdown

23 months agotweak names and output and bless
Ralf Jung [Wed, 6 Jul 2022 14:14:46 +0000 (10:14 -0400)]
tweak names and output and bless

23 months agoreview feedback
Ralf Jung [Tue, 5 Jul 2022 21:38:46 +0000 (17:38 -0400)]
review feedback

23 months agofix cranelift and gcc backends
Ralf Jung [Tue, 5 Jul 2022 20:53:48 +0000 (16:53 -0400)]
fix cranelift and gcc backends

23 months agodon't allow ZST in ScalarInt
Ralf Jung [Sun, 3 Jul 2022 15:17:23 +0000 (11:17 -0400)]
don't allow ZST in ScalarInt

There are several indications that we should not ZST as a ScalarInt:
- We had two ways to have ZST valtrees, either an empty `Branch` or a `Leaf` with a ZST in it.
  `ValTree::zst()` used the former, but the latter could possibly arise as well.
- Likewise, the interpreter had `Immediate::Uninit` and `Immediate::Scalar(Scalar::ZST)`.
- LLVM codegen already had to special-case ZST ScalarInt.

So instead add new ZST variants to those types that did not have other variants
which could be used for this purpose.

23 months agoRollup merge of #99067 - est31:to_owned_link, r=Dylan-DPC
Matthias Krüger [Sat, 9 Jul 2022 10:52:52 +0000 (12:52 +0200)]
Rollup merge of #99067 - est31:to_owned_link, r=Dylan-DPC

Intra-doc-link-ify reference to Clone::clone_from

23 months agoRollup merge of #99050 - JakobDegen:storage-docs, r=tmiasko
Matthias Krüger [Sat, 9 Jul 2022 10:52:51 +0000 (12:52 +0200)]
Rollup merge of #99050 - JakobDegen:storage-docs, r=tmiasko

Clarify MIR semantics of storage statements

Seems worthwhile to start closing out some of the less controversial open questions about MIR semantics. Hopefully this is fairly non-controversial - it's what we implement already, and I see no reason to do anything more restrictive. cc ``@tmiasko`` who commented on this when it was discussed in the original PR that added these docs.

23 months agoRollup merge of #99022 - pierwill:always-storage-live-locals, r=pierwill
Matthias Krüger [Sat, 9 Jul 2022 10:52:50 +0000 (12:52 +0200)]
Rollup merge of #99022 - pierwill:always-storage-live-locals, r=pierwill

MIR dataflow: Rename function to `always_storage_live_locals`

Related to #99021.

r?  ```@JakobDegen``` (as discussed on Zulip)

23 months agoAuto merge of #98328 - topjohnwu:fix_cross, r=jyn514
bors [Sat, 9 Jul 2022 10:45:30 +0000 (10:45 +0000)]
Auto merge of #98328 - topjohnwu:fix_cross, r=jyn514

Fix several issues during cross compiling

- When cross compiling LLVM on an arm64 macOS machine to x86_64, CMake will produce universal binaries by default, causing link errors. Explicitly set `CMAKE_OSX_ARCHITECTURES` to the one single target architecture so that the executables and libraries will be single architecture.
- When cross compiling rustc with `llvm.clang = true`, `CLANG_TABLEGEN` has to be set to the host `clang-tblgen` executable to build clang.

23 months agoAuto merge of #99078 - Dylan-DPC:rollup-gnw6cli, r=Dylan-DPC
bors [Sat, 9 Jul 2022 07:15:34 +0000 (07:15 +0000)]
Auto merge of #99078 - Dylan-DPC:rollup-gnw6cli, r=Dylan-DPC

Rollup of 7 pull requests

Successful merges:

 - #98350 (Implement support for DWARF version 5.)
 - #98915 (Clarify deriving code)
 - #98980 (fix ICE in ConstProp)
 - #99008 (Adding suggestion for E0530)
 - #99043 (Collapse some weirdly-wrapping derives)
 - #99048 (Remove a string comparison about types)
 - #99070 (Update integer_atomics tracking issue)

Failed merges:

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

23 months agoRollup merge of #99070 - tamird:update-tracking-issue, r=RalfJung
Dylan DPC [Sat, 9 Jul 2022 05:58:09 +0000 (11:28 +0530)]
Rollup merge of #99070 - tamird:update-tracking-issue, r=RalfJung

Update integer_atomics tracking issue

Updates #32976.
Updates #99069.

r? ``@RalfJung``

23 months agoRollup merge of #99048 - TaKO8Ki:remove-type-string-comparison, r=compiler-errors
Dylan DPC [Sat, 9 Jul 2022 05:58:08 +0000 (11:28 +0530)]
Rollup merge of #99048 - TaKO8Ki:remove-type-string-comparison, r=compiler-errors

Remove a string comparison about types

23 months agoRollup merge of #99043 - compiler-errors:derive-nit, r=cjgillot
Dylan DPC [Sat, 9 Jul 2022 05:58:07 +0000 (11:28 +0530)]
Rollup merge of #99043 - compiler-errors:derive-nit, r=cjgillot

Collapse some weirdly-wrapping derives

self-explanatory

23 months agoRollup merge of #99008 - obeis:issue-98974, r=compiler-errors
Dylan DPC [Sat, 9 Jul 2022 05:58:06 +0000 (11:28 +0530)]
Rollup merge of #99008 - obeis:issue-98974, r=compiler-errors

Adding suggestion for E0530

Closes #98974

23 months agoRollup merge of #98980 - RalfJung:const-prop-ice, r=oli-obk
Dylan DPC [Sat, 9 Jul 2022 05:58:05 +0000 (11:28 +0530)]
Rollup merge of #98980 - RalfJung:const-prop-ice, r=oli-obk

fix ICE in ConstProp

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

23 months agoRollup merge of #98915 - nnethercote:clarify-deriving-code, r=Mark-Simulacrum
Dylan DPC [Sat, 9 Jul 2022 05:58:04 +0000 (11:28 +0530)]
Rollup merge of #98915 - nnethercote:clarify-deriving-code, r=Mark-Simulacrum

Clarify deriving code

A number of clarifications to the deriving code.

r? ``@Mark-Simulacrum``

23 months agoRollup merge of #98350 - pcwalton:dwarf5, r=michaelwoerister
Dylan DPC [Sat, 9 Jul 2022 05:58:03 +0000 (11:28 +0530)]
Rollup merge of #98350 - pcwalton:dwarf5, r=michaelwoerister

Implement support for DWARF version 5.

DWARF version 5 brings a number of improvements over version 4. Quoting from
the announcement [1]:

> Version 5 incorporates improvements in many areas: better data compression,
> separation of debugging data from executable files, improved description of
> macros and source files, faster searching for symbols, improved debugging
> optimized code, as well as numerous improvements in functionality and
> performance.

On platforms where DWARF version 5 is supported (Linux, primarily), this commit
adds support for it behind a new `-Z dwarf-version=5` flag.

[1]: https://dwarfstd.org/Public_Review.php

r? ``@michaelwoerister``

23 months agoAuto merge of #99028 - tmiasko:inline, r=estebank
bors [Sat, 9 Jul 2022 04:34:51 +0000 (04:34 +0000)]
Auto merge of #99028 - tmiasko:inline, r=estebank

Miscellaneous inlining improvements

Add `#[inline]` to a few trivial non-generic methods from a perf report
that otherwise wouldn't be candidates for inlining.

23 months agoAuto merge of #98961 - zeevm:issue-98958-fix, r=oli-obk
bors [Sat, 9 Jul 2022 02:04:17 +0000 (02:04 +0000)]
Auto merge of #98961 - zeevm:issue-98958-fix, r=oli-obk

Only enable ConstProp on opt level >= 1

r? `@JakobDegen`

23 months agoMinor updates based on review comments.
Nicholas Nethercote [Thu, 7 Jul 2022 21:57:34 +0000 (07:57 +1000)]
Minor updates based on review comments.

23 months agoClarify MIR semantics of storage statements
Jakob Degen [Fri, 8 Jul 2022 07:58:48 +0000 (00:58 -0700)]
Clarify MIR semantics of storage statements

23 months agoAuto merge of #98816 - estebank:implicit-sized, r=oli-obk
bors [Fri, 8 Jul 2022 23:17:34 +0000 (23:17 +0000)]
Auto merge of #98816 - estebank:implicit-sized, r=oli-obk

Track implicit `Sized` obligations in type params

When we evaluate `ty::GenericPredicates` we introduce the implicit
`Sized` predicate of type params, but we do so with only the `Predicate`
its `Span` as context, we don't have an `Obligation` or
`ObligationCauseCode` we could influence. To try and carry this
information through, we add a new field to `ty::GenericPredicates` that
tracks both which predicates come from a type param and whether that
param has any bounds already (to use in suggestions).

We also suggest adding a `?Sized` bound if appropriate on E0599.

Address part of #98539.

23 months agoSimplify `cs_fold`.
Nicholas Nethercote [Tue, 5 Jul 2022 01:23:55 +0000 (11:23 +1000)]
Simplify `cs_fold`.

`cs_fold` has four distinct cases, covered by three different function
arguments:

- first field
- combine current field with previous results
- no fields
- non-matching enum variants

This commit clarifies things by replacing the three function arguments
with one that takes a new `CsFold` type with four slightly different)
cases

- single field
- combine result for current field with results for previous fields
- no fields
- non-matching enum variants

This makes the code shorter and clearer.

23 months agoFix some inconsistencies.
Nicholas Nethercote [Tue, 5 Jul 2022 00:21:37 +0000 (10:21 +1000)]
Fix some inconsistencies.

This makes `cs_cmp`, `cs_partial_cmp`, and `cs_op` (for `PartialEq`)
more similar. It also fixes some out of date comments.

23 months agoCut down large comment about zero-variant enums.
Nicholas Nethercote [Mon, 4 Jul 2022 23:50:36 +0000 (09:50 +1000)]
Cut down large comment about zero-variant enums.

When deriving functions for zero-variant enums, we just generated a
function body that calls `std::instrincs::unreachable`. There is a large
comment with some not-very-useful historical discussion about
alternatives, including some discussion of feature-gating zero-variant
enums, which is clearly irrelevant today.

This commit cuts the comment down greatly.

23 months agoAvoid transposes in deriving code.
Nicholas Nethercote [Mon, 4 Jul 2022 23:04:41 +0000 (09:04 +1000)]
Avoid transposes in deriving code.

The deriving code has some complex parts involving iterations over
selflike args and also fields within structs and enum variants.

The return types for a few functions demonstrate this:

- `TraitDef::create_{struct_pattern,enum_variant_pattern}` returns a
  `(P<ast::Pat>, Vec<(Span, Option<Ident>, P<Expr>)>)`
- `TraitDef::create_struct_field_accesses` returns a `Vec<(Span,
  Option<Ident>, P<Expr>)>`.

This results in per-field data stored within per-selflike-arg data, with
lots of repetition within the per-field data elements. This then has to
be "transposed" in two places (`expand_struct_method_body` and
`expand_enum_method_body`) into per-self-like-arg data stored within
per-field data. It's all quite clumsy and confusing.

This commit rearranges things greatly. Data is obtained in the needed
form up-front, avoiding the need for transposition. Also, various
functions are split, removed, and added, to make things clearer and
avoid tuple return values.

The diff is hard to read, which reflects the messiness of the original
code -- there wasn't an easy way to break these changes into small
pieces. (Sorry!) It's a net reduction of 35 lines and a readability
improvement. The generated code is unchanged.

23 months agoRemove `FieldInfo::attrs`.
Nicholas Nethercote [Mon, 4 Jul 2022 22:59:17 +0000 (08:59 +1000)]
Remove `FieldInfo::attrs`.

It's unused. This also removes the need for the lifetime on `FieldInfo`,
which is nice.

23 months agoRename `FieldInfo` fields.
Nicholas Nethercote [Mon, 4 Jul 2022 22:47:04 +0000 (08:47 +1000)]
Rename `FieldInfo` fields.

Use `self_exprs` and `other_selflike_exprs` in a manner similar to the
previous commit.

23 months agoClarify args terminology.
Nicholas Nethercote [Mon, 4 Jul 2022 22:25:47 +0000 (08:25 +1000)]
Clarify args terminology.

The deriving code has inconsistent terminology to describe args.

In some places it distinguishes between:
- the `&self` arg (if present), versus
- all other args.

In other places it distinguishes between:
- the `&self` arg (if present) and any other arguments with the same
  type (in practice there is at most one, e.g. in `PartialEq::eq`),
  versus
- all other args.

The terms "self_args" and "nonself_args" are sometimes used for the
former distinction, and sometimes for the latter. "args" is also
sometimes used for "all other args".

This commit makes the code consistently uses "self_args"/"nonself_args"
for the former and "selflike_args"/"nonselflike_args" for the latter.
This change makes the code easier to read.

The commit also adds a panic on an impossible path (the `Self_` case) in
`extract_arg_details`.

23 months agoUpdate integer_atomics tracking issue
Tamir Duberstein [Fri, 8 Jul 2022 21:52:04 +0000 (17:52 -0400)]
Update integer_atomics tracking issue

Updates #32976.
Updates #99069.

23 months agoIntra-doc-link-ify reference to Clone::clone_from
est31 [Fri, 8 Jul 2022 20:41:41 +0000 (22:41 +0200)]
Intra-doc-link-ify reference to Clone::clone_from

23 months agoAuto merge of #99034 - RalfJung:miri, r=Mark-Simulacrum
bors [Fri, 8 Jul 2022 20:36:33 +0000 (20:36 +0000)]
Auto merge of #99034 - RalfJung:miri, r=Mark-Simulacrum

update Miri

Fixes https://github.com/rust-lang/rust/issues/98922
r? `@ghost`

23 months agoImplement support for DWARF version 5.
Patrick Walton [Mon, 20 Jun 2022 23:26:51 +0000 (16:26 -0700)]
Implement support for DWARF version 5.

DWARF version 5 brings a number of improvements over version 4. Quoting from
the announcement [1]:

> Version 5 incorporates improvements in many areas: better data compression,
> separation of debugging data from executable files, improved description of
> macros and source files, faster searching for symbols, improved debugging
> optimized code, as well as numerous improvements in functionality and
> performance.

On platforms where DWARF version 5 is supported (Linux, primarily), this commit
adds support for it behind a new `-Z dwarf-version=5` flag.

[1]: https://dwarfstd.org/Public_Review.php

23 months agoAuto merge of #98614 - oli-obk:take_unsound_opaque_types, r=wesleywiser
bors [Fri, 8 Jul 2022 17:55:26 +0000 (17:55 +0000)]
Auto merge of #98614 - oli-obk:take_unsound_opaque_types, r=wesleywiser

don't succeed `evaluate_obligation` query if new opaque types were registered

fixes #98608
fixes #98604

The root cause of all this is that in type flag computation we entirely ignore nongeneric things like struct fields and the signature of function items. So if a flag had to be set for a struct if it is set for a field, that will only happen if the field is generic, as only the generic parameters are checked.

I now believe we cannot use type flags to handle opaque types. They seem like the wrong tool for this.

Instead, this PR replaces the previous logic by adding a new variant of `EvaluatedToOk`: `EvaluatedToOkModuloOpaqueTypes`, which says that there were some opaque types that got hidden types bound, but that binding may not have been legal (because we don't know if the opaque type was in its defining scope or not).

23 months agoset all padding for main element in print
Infra [Fri, 8 Jul 2022 16:44:16 +0000 (12:44 -0400)]
set all padding for main element in print

23 months agoAuto merge of #99054 - Dylan-DPC:rollup-0zuhhds, r=Dylan-DPC
bors [Fri, 8 Jul 2022 15:24:57 +0000 (15:24 +0000)]
Auto merge of #99054 - Dylan-DPC:rollup-0zuhhds, r=Dylan-DPC

Rollup of 4 pull requests

Successful merges:

 - #98533 (Add a `-Zdump-drop-tracking-cfg` debugging flag)
 - #98654 (An optimization for `pest-2.1.3`)
 - #98657 (Migrate some diagnostics from `rustc_const_eval` to `SessionDiagnostic`)
 - #98794 (Highlight conflicting param-env candidates)

Failed merges:

 - #98957 ( don't allow ZST in ScalarInt )

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