Commit Graph

216747 Commits

Author SHA1 Message Date
Jack Huey
1a663c0f53 Cleanup free_region_relations a bit 2023-02-09 20:38:27 -05:00
bors
8996ea93b6 Auto merge of #107853 - Dylan-DPC:rollup-macf1qo, r=Dylan-DPC
Rollup of 6 pull requests

Successful merges:

 - #107648 (unused-lifetimes: don't warn about lifetimes originating from expanded code)
 - #107655 (rustdoc: use the same URL escape rules for fragments as for examples)
 - #107659 (test: snapshot for derive suggestion in diff files)
 - #107786 (Implement some tweaks in the new solver)
 - #107803 (Do not bring trait alias supertraits into scope)
 - #107815 (Disqualify `auto trait` built-in impl in new solver if explicit `impl` exists)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2023-02-09 20:23:00 +00:00
Dylan DPC
b080a1a4fc
Rollup merge of #107815 - compiler-errors:new-solver-no-auto-if-impl, r=lcnr
Disqualify `auto trait` built-in impl in new solver if explicit `impl` exists
2023-02-09 23:18:37 +05:30
Dylan DPC
16a4138387
Rollup merge of #107803 - eggyal:do_not_bring_trait_alias_supertraits_into_scope, r=compiler-errors
Do not bring trait alias supertraits into scope

Fixes #107747
cc #41517
2023-02-09 23:18:36 +05:30
Dylan DPC
39ba11036a
Rollup merge of #107786 - compiler-errors:new-solver-some-tweaks, r=lcnr
Implement some tweaks in the new solver

I've been testing the new solver on some small codebases, and these are a few small changes I've needed to make.

The most "controversial" here is implementing `trait_candidate_should_be_dropped_in_favor_of`, which I just implemented to always return false. This surprisingly allows some code to compile, without us having to actually decide on any semantics yet.

r? `@rust-lang/initiative-trait-system-refactor`
2023-02-09 23:18:35 +05:30
Dylan DPC
5aa062e249
Rollup merge of #107659 - bvanjoi:issue-107649, r=estebank
test: snapshot for derive suggestion in diff files

fixed #107649
2023-02-09 23:18:35 +05:30
Dylan DPC
188dd72b5f
Rollup merge of #107655 - notriddle:notriddle/small-url-encode, r=GuillaumeGomez
rustdoc: use the same URL escape rules for fragments as for examples

Carries over improvements from #107284
2023-02-09 23:18:34 +05:30
Dylan DPC
be1789a56d
Rollup merge of #107648 - matthiaskrgr:unused_lifetime_104432_fix, r=cjgillot
unused-lifetimes: don't warn about lifetimes originating from expanded code

previously, we would warn like this:

````
warning: lifetime parameter `'s` never used
 --> /tmp/unusedlif/code.rs:6:62
  |
5 | #[derive(Clone)]
  |          - help: elide the unused lifetime
6 | struct ShimMethod4<T: Trait2 + 'static>(pub &'static dyn for<'s> Fn(&'s mut T::As));
  |                                                              ^^
  |
  = note: requested on the command line with `-W unused-lifetimes`
````

Fixes #104432
2023-02-09 23:18:34 +05:30
Michael Goulet
68e27b3052 Disqualify auto-trait builtin impl in new solver if impl exists 2023-02-09 17:23:50 +00:00
Michael Goulet
654f43f34e Move winnowing to assembly 2023-02-09 17:22:39 +00:00
Michael Goulet
8987e68247 Implement a dummy drop-in-favor-of for the new solver 2023-02-09 17:22:37 +00:00
Michael Goulet
8c67ecd124 Use elaborated item bounds for alias types 2023-02-09 17:16:47 +00:00
Michael Goulet
8dadd54f52 Fix subst issue with object_ty_for_trait 2023-02-09 17:16:47 +00:00
bohan
7615045ebd test: snapshot for derive suggestion in diff files 2023-02-09 22:28:53 +08:00
bors
8cca42a47f Auto merge of #107843 - bjorn3:sync_cg_clif-2023-02-09, r=bjorn3
Sync rustc_codegen_cranelift

* Couple of bugfixes
* A significant runtime perf improvement
* Implemented sym and const support for inline asm
* Improved self profile integration

r? `@ghost`

`@rustbot` label +A-codegen +A-cranelift +T-compiler
2023-02-09 14:12:59 +00:00
bjorn3
e25566e20b Merge commit '7d53619064ab7045c383644cb445052d2a3d46db' into sync_cg_clif-2023-02-09 2023-02-09 12:38:16 +01:00
bors
5919f62cf6 Auto merge of #107840 - matthiaskrgr:rollup-e6v7x0a, r=matthiaskrgr
Rollup of 5 pull requests

Successful merges:

 - #107446 (Migrate some of `rustc_parse` to derive diagnostics)
 - #107752 (Specify dlltool prefix when generating import libs)
 - #107808 (bootstrap.py: fix build-failure message)
 - #107834 (create symlink for legacy rustfmt path)
 - #107835 (use idiomatic formatting)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2023-02-09 10:42:15 +00:00
Matthias Krüger
f2a2e298ba
Rollup merge of #107835 - tshepang:fmt, r=WaffleLapkin
use idiomatic formatting

Also, remove needless `else`
2023-02-09 11:21:59 +01:00
Matthias Krüger
a8df4b1530
Rollup merge of #107834 - zephaniahong:issue-107547-fix, r=albertlarsan68
create symlink for legacy rustfmt path

Fixes #107547 .
Main change is in the `download.rs` file. Created a symlink for the legacy rustfmt path to the new rustfmt path. Other file changes are simply as a result of porting over the symlink_file function from the Build struct to the config Struct
2023-02-09 11:21:59 +01:00
Matthias Krüger
a3e152ca81
Rollup merge of #107808 - kadiwa4:built-unsuccessfully, r=albertlarsan68
bootstrap.py: fix build-failure message

A small mistake I did.
Corrects #107470, fixes #107804

r? `@albertlarsan68` (since you reviewed the last one)
2023-02-09 11:21:58 +01:00
Matthias Krüger
a621769881
Rollup merge of #107752 - riverar:rafael/gnu_dlltool_temp_prefix, r=petrochenkov
Specify dlltool prefix when generating import libs

Ref: https://github.com/rust-lang/rust/pull/106610#issuecomment-1418221274

tl;dr: This PR adds an explicit dlltool temporary filename prefix. The prefix resolves a race condition by ensuring dlltool temporary files are siloed in an appropriate/unique Rust temporary directory.

---

GNU dlltool, as part of its import library generation logic, uses a bunch of temporary files on disk. In the interest of deterministic build runs, dlltool supports deterministic temporary filenames. The temporary filename prefix is automatically generated internally or can be explicitly specified via a `--temp-prefix` argument.

GNU dlltool **2.38** (that ships with `x86_64-12.2.0-release-posix-seh-rt_v10-rev0` [installed during CI](https://github.com/rust-lang/rust/blob/master/src/ci/scripts/install-mingw.sh)) generates a prefix based on the target library name ([source](https://sourceware.org/git/?p=binutils-gdb.git;a=blob;f=binutils/dlltool.c;h=d95bf3f5470b999fa3b30bc887791859f48d81d1;hb=20756b0fbe065a84710aa38f2457563b57546440#l3992)). The tool writes to files such as `target_dll_h.s` and `target_dll_s00203.o` in the current working directory.

This presents a problem when multiple instances of rustc_codegen_llvm are running to generate an import library (as part of the raw_dylib feature) for the same target library (e.g. kernel32) ([source](https://github.com/rust-lang/rust/blob/master/compiler/rustc_codegen_llvm/src/back/archive.rs#L185-L196)). That is, dlltool instances race and may overwrite or delete files belonging to each other.

GNU dlltool **2.39**+ (not used in Rust CI) generates a prefix based on the output library path ([source](https://sourceware.org/git/?p=binutils-gdb.git;a=blob;f=binutils/dlltool.c;h=e2af20847009945b4c61a6fef08268fbb4429715;hb=b51c2fec1da205ea3e7354cbb3e253018d64873c#l3992)). The tool, when invoked as part of rustc_codegen_llvm, writes to files at paths such as `C_Users_Foo_AppData_Local_Temp_rustcOFqhXZ_target_lib_h.s`. (The output library path is normalized and non-alphanumeric characters are replaced with underscores.)
2023-02-09 11:21:58 +01:00
Matthias Krüger
3b9543c89d
Rollup merge of #107446 - clubby789:rustc-parse-diag-migrate, r=compiler-errors
Migrate some of `rustc_parse` to derive diagnostics

`@rustbot` label +A-translation
r? rust-lang/diagnostics
cc #100717
2023-02-09 11:21:57 +01:00
Tshepang Mbambo
b651679d90 use idiomatic formatting
Also, remove needless else
2023-02-09 10:57:52 +02:00
Zephaniah Ong
41c6c5d499 port over symlink_file function from Build to Config and create symlink for legacy rustfmt path 2023-02-09 16:01:29 +08:00
bors
c40919b7a7 Auto merge of #106938 - GuillaumeGomez:normalize-projection-field-ty, r=oli-obk
Add missing normalization for union fields types

Overshadows https://github.com/rust-lang/rust/pull/106808.
From the experiment https://github.com/rust-lang/rust/pull/103985.

In short, it allows to use projections as a type for union's fields.

cc `@compiler-errors`
r? `@oli-obk`
2023-02-09 07:08:19 +00:00
bors
e7acd078f4 Auto merge of #107828 - compiler-errors:rollup-gyj6dgj, r=compiler-errors
Rollup of 9 pull requests

Successful merges:

 - #107317 (Implement `AsFd` and `AsRawFd` for `Rc`)
 - #107429 (Stabilize feature `cstr_from_bytes_until_nul`)
 - #107713 (Extend `BYTE_SLICE_IN_PACKED_STRUCT_WITH_DERIVE`.)
 - #107761 (Replace a command line flag with an env var to allow tools to initialize the tracing loggers at their own discretion)
 - #107790 ( x.py fails all downloads that use a tempdir with snap curl #107722)
 - #107799 (correctly update goals in the cache)
 - #107813 (Do not eagerly recover for bad `impl Trait` types in macros)
 - #107817 (rustdoc: use svgo to shrink `wheel.svg`)
 - #107819 (Set `rust-analyzer.check.invocationLocation` to `root`)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2023-02-09 04:03:20 +00:00
Michael Goulet
3e07554fd7
Rollup merge of #107819 - clubby789:x-py-root, r=jyn514
Set `rust-analyzer.check.invocationLocation` to `root`

Add
```json
    "rust-analyzer.check.invocationLocation": "root",
    "rust-analyzer.check.invocationStrategy": "once",
```
to the bundled VS code config. This prevents an error with r-a invoking `python3 x.py` in `src/bootstrap` where `x.py` does not exist.

r? ``@jyn514``
2023-02-08 20:01:28 -08:00
Michael Goulet
ae2ecff04b
Rollup merge of #107817 - notriddle:notriddle/wheel-svg, r=GuillaumeGomez
rustdoc: use svgo to shrink `wheel.svg`

use [svgo] to shrink `wheel.svg`

[svgo]: https://github.com/svg/svgo

    $ du -bs src/librustdoc/html/static/images/wheel.svg wheel-old.svg
    2972    src/librustdoc/html/static/images/wheel.svg
    3764    wheel-old.svg

100*((2972-3764)/3764) = -21.04%
2023-02-08 20:01:27 -08:00
Michael Goulet
ab09405e99
Rollup merge of #107813 - compiler-errors:bad-impl-trait-in-macro-is-ok, r=estebank
Do not eagerly recover for bad `impl Trait` types in macros

Fixes #107796

cc #106712, ```@estebank``` and ```@Ezrashaw``` please make sure to use [`Parser::may_recover`](https://doc.rust-lang.org/nightly/nightly-rustc/rustc_parse/parser/struct.Parser.html#method.may_recover) for all eager-token-consuming parser recoveries.

This also fixes a separate regression from #99915, that was introduced before we added `may_recover` though.
2023-02-08 20:01:26 -08:00
Michael Goulet
46c7c91ce7
Rollup merge of #107799 - lcnr:update-provisional-result, r=oli-obk
correctly update goals in the cache

we may want to actually write the response for our goal into the provisional or global cache instead of simply using the result from the last iteration '^^

r? ```@rust-lang/initiative-trait-system-refactor```
2023-02-08 20:01:26 -08:00
Michael Goulet
04ebaba17b
Rollup merge of #107790 - tharunsuresh-code:snap_curl, r=jyn514
x.py fails all downloads that use a tempdir with snap curl #107722

Have used the open() library from python to capture the binary output of the curl command and write it to a file using stdout of the subprocess. Added a single-line comment mentioning the redirect operator.
2023-02-08 20:01:25 -08:00
Michael Goulet
32bb73eede
Rollup merge of #107761 - oli-obk:miri_🪵, r=TaKO8Ki
Replace a command line flag with an env var to allow tools to initialize the tracing loggers at their own discretion

fixes https://github.com/rust-lang/miri/issues/2778

this was introduced in https://github.com/rust-lang/rust/pull/104645, so this PR reverts the flag-part and uses an env var instead.
2023-02-08 20:01:25 -08:00
Michael Goulet
04f770839d
Rollup merge of #107713 - nnethercote:extend-BYTE_SLICE_IN_PACKED_STRUCT_WITH_DERIVE, r=RalfJung
Extend `BYTE_SLICE_IN_PACKED_STRUCT_WITH_DERIVE`.

To temporarily allow a `str` field in a packed struct using `derive`, along with `[u8]`.

r? ``@RalfJung``
2023-02-08 20:01:25 -08:00
Michael Goulet
aee4570adf
Rollup merge of #107429 - tgross35:from-bytes-until-null-stabilization, r=dtolnay
Stabilize feature `cstr_from_bytes_until_nul`

This PR seeks to stabilize `cstr_from_bytes_until_nul`.

Partially addresses #95027

This function has only been on nightly for about 10 months, but I think it is simple enough that there isn't harm discussing stabilization. It has also had at least a handful of mentions on both the user forum and the discord, so it seems like it's already in use or at least known.

This needs FCP still.

Comment on potential discussion points:
- eventual conversion of `CStr` to be a single thin pointer: this function will still be useful to provide a safe way to create a `CStr` after this change.
- should this return a length too, to address concerns about the `CStr` change? I don't see it as being particularly useful, and it seems less ergonomic (i.e. returning `Result<(&CStr, usize), FromBytesUntilNulError>`). I think users that also need this length without the additional `strlen` call are likely better off using a combination of other methods, but this is up for discussion
- `CString::from_vec_until_nul`: this is also useful, but it doesn't even have a nightly implementation merged yet. I propose feature gating that separately, as opposed to blocking this `CStr` implementation on that

Possible alternatives:

A user can use `from_bytes_with_nul` on a slice up to `my_slice[..my_slice.iter().find(|c| c == 0).unwrap()]`. However; that is significantly less ergonomic, and is a bit more work for the compiler to optimize compared the direct `memchr` call that this wraps.

## New stable API

```rs
// both in core::ffi

pub struct FromBytesUntilNulError(());

impl CStr {
    pub const fn from_bytes_until_nul(
        bytes: &[u8]
    ) -> Result<&CStr, FromBytesUntilNulError>
}
```

cc ```@ericseppanen``` original author, ```@Mark-Simulacrum``` original reviewer, ```@m-ou-se``` brought up some issues on the thin pointer CStr

```@rustbot``` modify labels: +T-libs-api +needs-fcp
2023-02-08 20:01:24 -08:00
Michael Goulet
a478b836fa
Rollup merge of #107317 - ids1024:asfd-rc, r=dtolnay
Implement `AsFd` and `AsRawFd` for `Rc`

Fixes https://github.com/rust-lang/rust/issues/105931.
2023-02-08 20:01:24 -08:00
Nicholas Nethercote
a70d03b624 Extend BYTE_SLICE_IN_PACKED_STRUCT_WITH_DERIVE.
To temporarily allow a `str` field in a packed struct using `derive`,
along with `[u8]`.
2023-02-09 11:47:12 +11:00
bors
575d424c94 Auto merge of #107717 - nnethercote:opt-TyKind-eq, r=compiler-errors
Optimize `TyKind::eq`.

r? `@ghost`
2023-02-09 00:41:31 +00:00
clubby789
730470c8dd Set rust-analyzer.check.invocationLocation to root 2023-02-08 22:53:50 +00:00
Michael Howell
8cb5be96c4 rustdoc: use [svgo] to shrink wheel.svg
[svgo]: https://github.com/svg/svgo

    $ du -bs src/librustdoc/html/static/images/wheel.svg wheel-old.svg
    2972    src/librustdoc/html/static/images/wheel.svg
    3764    wheel-old.svg

100*((2972-3764)/3764) = -21.04%
2023-02-08 14:17:19 -07:00
bors
ef934d9b63 Auto merge of #107811 - matthiaskrgr:rollup-rpjzshk, r=matthiaskrgr
Rollup of 8 pull requests

Successful merges:

 - #105641 (Implement cursors for BTreeMap)
 - #107271 (Treat Drop as a rmw operation)
 - #107710 (Update strip-ansi-escapes and vte)
 - #107758 (Change `arena_cache` to not alter the declared query result)
 - #107777 (Make `derive_const` derive properly const-if-const impls)
 - #107780 (Rename `replace_bound_vars_with_*` to `instantiate_binder_with_*`)
 - #107793 (Add missing tracking issue for `RawOsError`)
 - #107807 (Fix small debug typo)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2023-02-08 20:11:35 +00:00
Alan Egerton
38ec810c37
Do not assemble supertraits for trait aliases 2023-02-08 19:55:50 +00:00
KaDiWa
62edacf738
bootstrap.py: fix build-failure message 2023-02-08 19:19:23 +01:00
lcnr
4c7c5e597f add (currently ICEing) test 2023-02-08 19:11:14 +01:00
lcnr
a5164605bc correctly update goals in the cache 2023-02-08 19:11:14 +01:00
Michael Goulet
0017822b70 Do not eagerly recover for bad impl-trait in macros 2023-02-08 17:56:08 +00:00
Matthias Krüger
3eea052dbb
Rollup merge of #107807 - GuillaumeGomez:fix-small-debug-typo, r=notriddle
Fix small debug typo

r? ``@notriddle``
2023-02-08 18:32:45 +01:00
Matthias Krüger
c7c66e1b12
Rollup merge of #107793 - joboet:raw_os_error_ty_tracking, r=Dylan-DPC
Add missing tracking issue for `RawOsError`

I forgot to add it in the original PR…

See #107792.

```@rustbot``` label +T-libs-api -T-libs
2023-02-08 18:32:44 +01:00
Matthias Krüger
ec65285fdd
Rollup merge of #107780 - compiler-errors:instantiate-binder, r=lcnr
Rename `replace_bound_vars_with_*` to `instantiate_binder_with_*`

Mentioning "binder" rather than "bound vars", imo, makes it clearer that we're doing something to the binder as a whole.

Also, "instantiate" is the verb that I'm always reaching for when I'm looking for these functions, and the name that we use in the new solver anyways.

r? types
2023-02-08 18:32:44 +01:00
Matthias Krüger
5b8403c463
Rollup merge of #107777 - compiler-errors:derive_const-actually-derive-const, r=fee1-dead
Make `derive_const` derive properly const-if-const impls

Fixes #107774
Fixes #107666

Also fixes rendering of const-if-const bounds in pretty printing.

r? ```@oli-obk``` or ```@fee1-dead```
2023-02-08 18:32:43 +01:00
Matthias Krüger
abc2203e36
Rollup merge of #107758 - Zoxc:arena-enref, r=cjgillot
Change `arena_cache` to not alter the declared query result

This makes the return types a bit clearer, limiting `arena_cache`'s effect to just the computation side. It also makes it easier to potentially remove `arena_cache`.

r? ```@cjgillot```
2023-02-08 18:32:43 +01:00