Skip to content

Commit 83964c1

Browse files
committed
Auto merge of #113491 - matthiaskrgr:rollup-mueqz7h, r=matthiaskrgr
Rollup of 6 pull requests Successful merges: - #113005 (Don't call `query_normalize` when reporting similar impls) - #113064 (std: edit [T]::swap docs) - #113138 (Add release notes for 1.71.0) - #113217 (resolve typerelative ctors to adt) - #113254 (Use consistent formatting in Readme) - #113482 (Migrate GUI colors test to original CSS color format) r? `@ghost` `@rustbot` modify labels: rollup
2 parents d1389b9 + de9b9c8 commit 83964c1

File tree

57 files changed

+996
-302
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

57 files changed

+996
-302
lines changed

README.md

+17-12
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,9 @@ Read ["Installation"] from [The Book].
2222

2323
The Rust build system uses a Python script called `x.py` to build the compiler,
2424
which manages the bootstrapping process. It lives at the root of the project.
25-
It also uses a file named `config.toml` to determine various configuration settings for the build.
26-
You can see a full list of options in `config.example.toml`.
25+
It also uses a file named `config.toml` to determine various configuration
26+
settings for the build. You can see a full list of options in
27+
`config.example.toml`.
2728

2829
The `x.py` command can be run directly on most Unix systems in the following
2930
format:
@@ -33,7 +34,8 @@ format:
3334
```
3435

3536
This is how the documentation and examples assume you are running `x.py`.
36-
See the [rustc dev guide][rustcguidebuild] if this does not work on your platform.
37+
See the [rustc dev guide][rustcguidebuild] if this does not work on your
38+
platform.
3739

3840
More information about `x.py` can be found by running it with the `--help` flag
3941
or reading the [rustc dev guide][rustcguidebuild].
@@ -105,24 +107,26 @@ See [the rustc-dev-guide for more info][sysllvm].
105107

106108
When complete, `./x.py install` will place several programs into
107109
`$PREFIX/bin`: `rustc`, the Rust compiler, and `rustdoc`, the
108-
API-documentation tool. By default, it will also include [Cargo], Rust's package manager.
109-
You can disable this behavior by passing `--set build.extended=false` to `./configure`.
110+
API-documentation tool. By default, it will also include [Cargo], Rust's
111+
package manager. You can disable this behavior by passing
112+
`--set build.extended=false` to `./configure`.
110113

111114
[Cargo]: https://github.com/rust-lang/cargo
112115

113116
#### Configure and Make
114117

115-
This project provides a configure script and makefile (the latter of which just invokes `x.py`).
116-
`./configure` is the recommended way to programatically generate a `config.toml`. `make` is not
117-
recommended (we suggest using `x.py` directly), but it is supported and we try not to break it
118-
unnecessarily.
118+
This project provides a configure script and makefile (the latter of which just
119+
invokes `x.py`). `./configure` is the recommended way to programatically
120+
generate a `config.toml`. `make` is not recommended (we suggest using `x.py`
121+
directly), but it is supported and we try not to break it unnecessarily.
119122

120123
```sh
121124
./configure
122125
make && sudo make install
123126
```
124127

125-
`configure` generates a `config.toml` which can also be used with normal `x.py` invocations.
128+
`configure` generates a `config.toml` which can also be used with normal `x.py`
129+
invocations.
126130

127131
### Building on Windows
128132

@@ -193,7 +197,7 @@ toolchain.
193197
#### MSVC
194198

195199
MSVC builds of Rust additionally require an installation of Visual Studio 2017
196-
(or later) so `rustc` can use its linker. The simplest way is to get
200+
(or later) so `rustc` can use its linker. The simplest way is to get
197201
[Visual Studio], check the "C++ build tools" and "Windows 10 SDK" workload.
198202

199203
[Visual Studio]: https://visualstudio.microsoft.com/downloads/
@@ -234,7 +238,8 @@ Windows build triples are:
234238

235239
The build triple can be specified by either specifying `--build=<triple>` when
236240
invoking `x.py` commands, or by creating a `config.toml` file (as described in
237-
[Building on a Unix-like system](#building-on-a-unix-like-system)), and passing `--set build.build=<triple>` to `./configure`.
241+
[Building on a Unix-like system](#building-on-a-unix-like-system)), and passing
242+
`--set build.build=<triple>` to `./configure`.
238243

239244
## Building Documentation
240245

RELEASES.md

+143
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,146 @@
1+
Version 1.71.0 (2023-07-13)
2+
==========================
3+
4+
<a id="1.71.0-Language"></a>
5+
6+
Language
7+
--------
8+
9+
- [Stabilize `raw-dylib`, `link_ordinal`, `import_name_type` and `-Cdlltool`.](https://github.com/rust-lang/rust/pull/109677/)
10+
- [Uplift `clippy::{drop,forget}_{ref,copy}` lints.](https://github.com/rust-lang/rust/pull/109732/)
11+
- [Type inference is more conservative around constrained vars.](https://github.com/rust-lang/rust/pull/110100/)
12+
- [Use fulfillment to check `Drop` impl compatibility](https://github.com/rust-lang/rust/pull/110577/)
13+
14+
<a id="1.71.0-Compiler"></a>
15+
16+
Compiler
17+
--------
18+
19+
- [Evaluate place expression in `PlaceMention`](https://github.com/rust-lang/rust/pull/104844/),
20+
making `let _ =` patterns more consistent with respect to the borrow checker.
21+
- [Add `--print deployment-target` flag for Apple targets.](https://github.com/rust-lang/rust/pull/105354/)
22+
- [Stabilize `extern "C-unwind"` and friends.](https://github.com/rust-lang/rust/pull/106075/)
23+
The existing `extern "C"` etc. may change behavior for cross-language unwinding in a future release.
24+
- [Update the version of musl used on `*-linux-musl` targets to 1.2.3](https://github.com/rust-lang/rust/pull/107129/),
25+
enabling [time64](https://musl.libc.org/time64.html) on 32-bit systems.
26+
- [Stabilize `debugger_visualizer`](https://github.com/rust-lang/rust/pull/108668/)
27+
for embedding metadata like Microsoft's Natvis.
28+
- [Enable flatten-format-args by default.](https://github.com/rust-lang/rust/pull/109999/)
29+
- [Make `Self` respect tuple constructor privacy.](https://github.com/rust-lang/rust/pull/111245/)
30+
- [Improve niche placement by trying two strategies and picking the better result.](https://github.com/rust-lang/rust/pull/108106/)
31+
- [Use `apple-m1` as the target CPU for `aarch64-apple-darwin`.](https://github.com/rust-lang/rust/pull/109899/)
32+
- [Add Tier 3 support for the `x86_64h-apple-darwin` target.](https://github.com/rust-lang/rust/pull/108795/)
33+
- [Promote `loongarch64-unknown-linux-gnu` to Tier 2 with host tools.](https://github.com/rust-lang/rust/pull/110936/)
34+
35+
Refer to Rust's [platform support page][platform-support-doc]
36+
for more information on Rust's tiered platform support.
37+
38+
<a id="1.71.0-Libraries"></a>
39+
40+
Libraries
41+
---------
42+
- [Rework handling of recursive panics.](https://github.com/rust-lang/rust/pull/110975/)
43+
Additional panics are allowed while unwinding, as long as they are caught before escaping
44+
a `Drop` implementation, but panicking within a panic hook is now an immediate abort.
45+
- [Loosen `From<&[T]> for Box<[T]>` bound to `T: Clone`.](https://github.com/rust-lang/rust/pull/103406/)
46+
- [Remove unnecessary `T: Send` bound](https://github.com/rust-lang/rust/pull/111134/)
47+
in `Error for mpsc::SendError<T>` and `TrySendError<T>`.
48+
- [Fix docs for `alloc::realloc`](https://github.com/rust-lang/rust/pull/108630/)
49+
to match `Layout` requirements that the size must not exceed `isize::MAX`.
50+
- [Document `const {}` syntax for `std::thread_local`.](https://github.com/rust-lang/rust/pull/110620/)
51+
This syntax was stabilized in Rust 1.59, but not previously mentioned in release notes.
52+
53+
<a id="1.71.0-Stabilized-APIs"></a>
54+
55+
Stabilized APIs
56+
---------------
57+
58+
- [`CStr::is_empty`](https://doc.rust-lang.org/stable/std/ffi/struct.CStr.html#method.is_empty)
59+
- [`BuildHasher::hash_one`](https://doc.rust-lang.org/stable/std/hash/trait.BuildHasher.html#method.hash_one)
60+
- [`NonZeroI*::is_positive`](https://doc.rust-lang.org/stable/std/num/struct.NonZeroI32.html#method.is_positive)
61+
- [`NonZeroI*::is_negative`](https://doc.rust-lang.org/stable/std/num/struct.NonZeroI32.html#method.is_negative)
62+
- [`NonZeroI*::checked_neg`](https://doc.rust-lang.org/stable/std/num/struct.NonZeroI32.html#method.checked_neg)
63+
- [`NonZeroI*::overflowing_neg`](https://doc.rust-lang.org/stable/std/num/struct.NonZeroI32.html#method.overflowing_neg)
64+
- [`NonZeroI*::saturating_neg`](https://doc.rust-lang.org/stable/std/num/struct.NonZeroI32.html#method.saturating_neg)
65+
- [`NonZeroI*::wrapping_neg`](https://doc.rust-lang.org/stable/std/num/struct.NonZeroI32.html#method.wrapping_neg)
66+
- [`Neg for NonZeroI*`](https://doc.rust-lang.org/stable/std/num/struct.NonZeroI32.html#impl-Neg-for-NonZeroI32)
67+
- [`Neg for &NonZeroI*`](https://doc.rust-lang.org/stable/std/num/struct.NonZeroI32.html#impl-Neg-for-%26NonZeroI32)
68+
- [`From<[T; N]> for (T...)`](https://doc.rust-lang.org/stable/std/primitive.array.html#impl-From%3C%5BT;+1%5D%3E-for-(T,))
69+
(array to N-tuple for N in 1..=12)
70+
- [`From<(T...)> for [T; N]`](https://doc.rust-lang.org/stable/std/primitive.array.html#impl-From%3C(T,)%3E-for-%5BT;+1%5D)
71+
(N-tuple to array for N in 1..=12)
72+
- [`windows::io::AsHandle for Box<T>`](https://doc.rust-lang.org/stable/std/os/windows/io/trait.AsHandle.html#impl-AsHandle-for-Box%3CT%3E)
73+
- [`windows::io::AsHandle for Rc<T>`](https://doc.rust-lang.org/stable/std/os/windows/io/trait.AsHandle.html#impl-AsHandle-for-Rc%3CT%3E)
74+
- [`windows::io::AsHandle for Arc<T>`](https://doc.rust-lang.org/stable/std/os/windows/io/trait.AsHandle.html#impl-AsHandle-for-Arc%3CT%3E)
75+
- [`windows::io::AsSocket for Box<T>`](https://doc.rust-lang.org/stable/std/os/windows/io/trait.AsSocket.html#impl-AsSocket-for-Box%3CT%3E)
76+
- [`windows::io::AsSocket for Rc<T>`](https://doc.rust-lang.org/stable/std/os/windows/io/trait.AsSocket.html#impl-AsSocket-for-Rc%3CT%3E)
77+
- [`windows::io::AsSocket for Arc<T>`](https://doc.rust-lang.org/stable/std/os/windows/io/trait.AsSocket.html#impl-AsSocket-for-Arc%3CT%3E)
78+
79+
These APIs are now stable in const contexts:
80+
81+
- [`<*const T>::read`](https://doc.rust-lang.org/stable/std/primitive.pointer.html#method.read)
82+
- [`<*const T>::read_unaligned`](https://doc.rust-lang.org/stable/std/primitive.pointer.html#method.read_unaligned)
83+
- [`<*mut T>::read`](https://doc.rust-lang.org/stable/std/primitive.pointer.html#method.read-1)
84+
- [`<*mut T>::read_unaligned`](https://doc.rust-lang.org/stable/std/primitive.pointer.html#method.read_unaligned-1)
85+
- [`ptr::read`](https://doc.rust-lang.org/stable/std/ptr/fn.read.html)
86+
- [`ptr::read_unaligned`](https://doc.rust-lang.org/stable/std/ptr/fn.read_unaligned.html)
87+
- [`<[T]>::split_at`](https://doc.rust-lang.org/stable/std/primitive.slice.html#method.split_at)
88+
89+
<a id="1.71.0-Cargo"></a>
90+
91+
Cargo
92+
-----
93+
- [Allow named debuginfo options in `Cargo.toml`.](https://github.com/rust-lang/cargo/pull/11958/)
94+
- [Add `workspace_default_members` to the output of `cargo metadata`.](https://github.com/rust-lang/cargo/pull/11978/)
95+
- [`cargo add` now considers `rust-version` when selecting packages.](https://github.com/rust-lang/cargo/pull/12078/)
96+
- [Automatically inherit workspace fields when running `cargo new`/`cargo init`.](https://github.com/rust-lang/cargo/pull/12069/)
97+
98+
<a id="1.71.0-Rustdoc"></a>
99+
100+
Rustdoc
101+
-------
102+
103+
- [Add a new `rustdoc::unescaped_backticks` lint for broken inline code.](https://github.com/rust-lang/rust/pull/105848/)
104+
- [Support strikethrough with single tildes.](https://github.com/rust-lang/rust/pull/111152/) (`~~old~~` vs. `~new~`)
105+
106+
<a id="1.71.0-Misc"></a>
107+
108+
Misc
109+
----
110+
111+
<a id="1.71.0-Compatibility-Notes"></a>
112+
113+
Compatibility Notes
114+
-------------------
115+
116+
- [Remove structural match from `TypeId`.](https://github.com/rust-lang/rust/pull/103291/)
117+
Code that uses a constant `TypeId` in a pattern will potentially be broken.
118+
Known cases have already been fixed -- in particular, users of the `log`
119+
crate's `kv_unstable` feature should update to `log v0.4.18` or later.
120+
- [Add a `sysroot` crate to represent the standard library crates.](https://github.com/rust-lang/rust/pull/108865/)
121+
This does not affect stable users, but may require adjustment in tools that build their own standard library.
122+
- [Cargo optimizes its usage under `rustup`.](https://github.com/rust-lang/cargo/pull/11917/) When
123+
Cargo detects it will run `rustc` pointing to a rustup proxy, it'll try bypassing the proxy and
124+
use the underlying binary directly. There are assumptions around the interaction with rustup and
125+
`RUSTUP_TOOLCHAIN`. However, it's not expected to affect normal users.
126+
- [When querying a package, Cargo tries only the original name, all hyphens, and all underscores to
127+
handle misspellings.](https://github.com/rust-lang/cargo/pull/12083/) Previously, Cargo tried each
128+
combination of hyphens and underscores, causing excessive requests to crates.io.
129+
- Cargo now [disallows `RUSTUP_HOME`](https://github.com/rust-lang/cargo/pull/12101/) and
130+
[`RUSTUP_TOOLCHAIN`](https://github.com/rust-lang/cargo/pull/12107/) in the `[env]` configuration
131+
table. This is considered to be not a use case Cargo would like to support, since it will likely
132+
cause problems or lead to confusion.
133+
134+
<a id="1.71.0-Internal-Changes"></a>
135+
136+
Internal Changes
137+
----------------
138+
139+
These changes do not affect any public interfaces of Rust, but they represent
140+
significant improvements to the performance or internals of rustc and related
141+
tools.
142+
143+
1144
Version 1.70.0 (2023-06-01)
2145
==========================
3146

compiler/rustc_mir_build/src/thir/cx/expr.rs

+32-15
Original file line numberDiff line numberDiff line change
@@ -215,17 +215,18 @@ impl<'tcx> Cx<'tcx> {
215215
// so we wouldn't have to compute and store the actual value
216216

217217
let hir::ExprKind::Path(ref qpath) = source.kind else {
218-
return ExprKind::Cast { source: self.mirror_expr(source)};
218+
return ExprKind::Cast { source: self.mirror_expr(source) };
219219
};
220220

221221
let res = self.typeck_results().qpath_res(qpath, source.hir_id);
222222
let ty = self.typeck_results().node_type(source.hir_id);
223223
let ty::Adt(adt_def, substs) = ty.kind() else {
224-
return ExprKind::Cast { source: self.mirror_expr(source)};
224+
return ExprKind::Cast { source: self.mirror_expr(source) };
225225
};
226226

227-
let Res::Def(DefKind::Ctor(CtorOf::Variant, CtorKind::Const), variant_ctor_id) = res else {
228-
return ExprKind::Cast { source: self.mirror_expr(source)};
227+
let Res::Def(DefKind::Ctor(CtorOf::Variant, CtorKind::Const), variant_ctor_id) = res
228+
else {
229+
return ExprKind::Cast { source: self.mirror_expr(source) };
229230
};
230231

231232
let idx = adt_def.variant_index_with_ctor_id(variant_ctor_id);
@@ -358,19 +359,35 @@ impl<'tcx> Cx<'tcx> {
358359
});
359360
}
360361
}
361-
let adt_data =
362-
if let hir::ExprKind::Path(hir::QPath::Resolved(_, ref path)) = fun.kind {
363-
// Tuple-like ADTs are represented as ExprKind::Call. We convert them here.
364-
expr_ty.ty_adt_def().and_then(|adt_def| match path.res {
365-
Res::Def(DefKind::Ctor(_, CtorKind::Fn), ctor_id) => {
362+
363+
// Tuple-like ADTs are represented as ExprKind::Call. We convert them here.
364+
let adt_data = if let hir::ExprKind::Path(ref qpath) = fun.kind
365+
&& let Some(adt_def) = expr_ty.ty_adt_def() {
366+
match qpath {
367+
hir::QPath::Resolved(_, ref path) => {
368+
match path.res {
369+
Res::Def(DefKind::Ctor(_, CtorKind::Fn), ctor_id) => {
370+
Some((adt_def, adt_def.variant_index_with_ctor_id(ctor_id)))
371+
}
372+
Res::SelfCtor(..) => Some((adt_def, FIRST_VARIANT)),
373+
_ => None,
374+
}
375+
}
376+
hir::QPath::TypeRelative(_ty, _) => {
377+
if let Some((DefKind::Ctor(_, CtorKind::Fn), ctor_id)) =
378+
self.typeck_results().type_dependent_def(fun.hir_id)
379+
{
366380
Some((adt_def, adt_def.variant_index_with_ctor_id(ctor_id)))
381+
} else {
382+
None
367383
}
368-
Res::SelfCtor(..) => Some((adt_def, FIRST_VARIANT)),
369-
_ => None,
370-
})
371-
} else {
372-
None
373-
};
384+
385+
}
386+
_ => None,
387+
}
388+
} else {
389+
None
390+
};
374391
if let Some((adt_def, index)) = adt_data {
375392
let substs = self.typeck_results().node_substs(fun.hir_id);
376393
let user_provided_types = self.typeck_results().user_provided_types();

0 commit comments

Comments
 (0)