Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rollup of 6 pull requests #113491

Merged
merged 21 commits into from
Jul 8, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
28f3986
use Const::eval instead of QueryNormalize in error reporting
compiler-errors Jun 24, 2023
30c61ee
std: edit [T]::swap docs
marcospb19 Jun 26, 2023
2c33dfe
Don't sort strings right after we just sorted by types
compiler-errors Jun 27, 2023
13fcd8d
Add release notes for 1.71.0
cuviper Jun 28, 2023
281e072
Remove target feature note
cuviper Jun 29, 2023
43f4fa4
Move the TypeId change to Compatibility Notes
cuviper Jun 29, 2023
a30f797
Add a release note about recursive panics
cuviper Jun 29, 2023
76a7772
resolve typerelative ctors to adt
ericmarkmartin Jun 30, 2023
7dfb9ed
add regression test
ericmarkmartin Jul 1, 2023
b9e991a
add thir-print test
ericmarkmartin Jul 1, 2023
7bb9de8
Use consistent formatting in Readme
atouchet Jul 2, 2023
07b1912
refactor
ericmarkmartin Jul 2, 2023
afccc44
add mir dump test
ericmarkmartin Jul 5, 2023
261c023
rename constants in mir dump test
ericmarkmartin Jul 5, 2023
50b4d1f
Migrate GUI colors test to original CSS color format
GuillaumeGomez Jul 8, 2023
48a0d03
Rollup merge of #113005 - compiler-errors:dont-query-normalize, r=cjg…
matthiaskrgr Jul 8, 2023
8c56299
Rollup merge of #113064 - marcospb19:add-note-in-vec-swap-docs, r=Mar…
matthiaskrgr Jul 8, 2023
14aeef3
Rollup merge of #113138 - cuviper:relnotes-1.71.0, r=Mark-Simulacrum
matthiaskrgr Jul 8, 2023
b637be7
Rollup merge of #113217 - ericmarkmartin:lower-type-relative-ctor-to-…
matthiaskrgr Jul 8, 2023
dd83228
Rollup merge of #113254 - atouchet:rd3, r=Mark-Simulacrum
matthiaskrgr Jul 8, 2023
de9b9c8
Rollup merge of #113482 - GuillaumeGomez:migrate-gui-test-color-20, r…
matthiaskrgr Jul 8, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 17 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,9 @@ Read ["Installation"] from [The Book].

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

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

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

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

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

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

#### Configure and Make

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

```sh
./configure
make && sudo make install
```

`configure` generates a `config.toml` which can also be used with normal `x.py` invocations.
`configure` generates a `config.toml` which can also be used with normal `x.py`
invocations.

### Building on Windows

Expand Down Expand Up @@ -193,7 +197,7 @@ toolchain.
#### MSVC

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

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

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

## Building Documentation

Expand Down
143 changes: 143 additions & 0 deletions RELEASES.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,146 @@
Version 1.71.0 (2023-07-13)
==========================

<a id="1.71.0-Language"></a>

Language
--------

- [Stabilize `raw-dylib`, `link_ordinal`, `import_name_type` and `-Cdlltool`.](https://github.com/rust-lang/rust/pull/109677/)
- [Uplift `clippy::{drop,forget}_{ref,copy}` lints.](https://github.com/rust-lang/rust/pull/109732/)
- [Type inference is more conservative around constrained vars.](https://github.com/rust-lang/rust/pull/110100/)
- [Use fulfillment to check `Drop` impl compatibility](https://github.com/rust-lang/rust/pull/110577/)

<a id="1.71.0-Compiler"></a>

Compiler
--------

- [Evaluate place expression in `PlaceMention`](https://github.com/rust-lang/rust/pull/104844/),
making `let _ =` patterns more consistent with respect to the borrow checker.
- [Add `--print deployment-target` flag for Apple targets.](https://github.com/rust-lang/rust/pull/105354/)
- [Stabilize `extern "C-unwind"` and friends.](https://github.com/rust-lang/rust/pull/106075/)
The existing `extern "C"` etc. may change behavior for cross-language unwinding in a future release.
- [Update the version of musl used on `*-linux-musl` targets to 1.2.3](https://github.com/rust-lang/rust/pull/107129/),
enabling [time64](https://musl.libc.org/time64.html) on 32-bit systems.
- [Stabilize `debugger_visualizer`](https://github.com/rust-lang/rust/pull/108668/)
for embedding metadata like Microsoft's Natvis.
- [Enable flatten-format-args by default.](https://github.com/rust-lang/rust/pull/109999/)
- [Make `Self` respect tuple constructor privacy.](https://github.com/rust-lang/rust/pull/111245/)
- [Improve niche placement by trying two strategies and picking the better result.](https://github.com/rust-lang/rust/pull/108106/)
- [Use `apple-m1` as the target CPU for `aarch64-apple-darwin`.](https://github.com/rust-lang/rust/pull/109899/)
- [Add Tier 3 support for the `x86_64h-apple-darwin` target.](https://github.com/rust-lang/rust/pull/108795/)
- [Promote `loongarch64-unknown-linux-gnu` to Tier 2 with host tools.](https://github.com/rust-lang/rust/pull/110936/)

Refer to Rust's [platform support page][platform-support-doc]
for more information on Rust's tiered platform support.

<a id="1.71.0-Libraries"></a>

Libraries
---------
- [Rework handling of recursive panics.](https://github.com/rust-lang/rust/pull/110975/)
Additional panics are allowed while unwinding, as long as they are caught before escaping
a `Drop` implementation, but panicking within a panic hook is now an immediate abort.
- [Loosen `From<&[T]> for Box<[T]>` bound to `T: Clone`.](https://github.com/rust-lang/rust/pull/103406/)
- [Remove unnecessary `T: Send` bound](https://github.com/rust-lang/rust/pull/111134/)
in `Error for mpsc::SendError<T>` and `TrySendError<T>`.
- [Fix docs for `alloc::realloc`](https://github.com/rust-lang/rust/pull/108630/)
to match `Layout` requirements that the size must not exceed `isize::MAX`.
- [Document `const {}` syntax for `std::thread_local`.](https://github.com/rust-lang/rust/pull/110620/)
This syntax was stabilized in Rust 1.59, but not previously mentioned in release notes.

<a id="1.71.0-Stabilized-APIs"></a>

Stabilized APIs
---------------

- [`CStr::is_empty`](https://doc.rust-lang.org/stable/std/ffi/struct.CStr.html#method.is_empty)
- [`BuildHasher::hash_one`](https://doc.rust-lang.org/stable/std/hash/trait.BuildHasher.html#method.hash_one)
- [`NonZeroI*::is_positive`](https://doc.rust-lang.org/stable/std/num/struct.NonZeroI32.html#method.is_positive)
- [`NonZeroI*::is_negative`](https://doc.rust-lang.org/stable/std/num/struct.NonZeroI32.html#method.is_negative)
- [`NonZeroI*::checked_neg`](https://doc.rust-lang.org/stable/std/num/struct.NonZeroI32.html#method.checked_neg)
- [`NonZeroI*::overflowing_neg`](https://doc.rust-lang.org/stable/std/num/struct.NonZeroI32.html#method.overflowing_neg)
- [`NonZeroI*::saturating_neg`](https://doc.rust-lang.org/stable/std/num/struct.NonZeroI32.html#method.saturating_neg)
- [`NonZeroI*::wrapping_neg`](https://doc.rust-lang.org/stable/std/num/struct.NonZeroI32.html#method.wrapping_neg)
- [`Neg for NonZeroI*`](https://doc.rust-lang.org/stable/std/num/struct.NonZeroI32.html#impl-Neg-for-NonZeroI32)
- [`Neg for &NonZeroI*`](https://doc.rust-lang.org/stable/std/num/struct.NonZeroI32.html#impl-Neg-for-%26NonZeroI32)
- [`From<[T; N]> for (T...)`](https://doc.rust-lang.org/stable/std/primitive.array.html#impl-From%3C%5BT;+1%5D%3E-for-(T,))
(array to N-tuple for N in 1..=12)
- [`From<(T...)> for [T; N]`](https://doc.rust-lang.org/stable/std/primitive.array.html#impl-From%3C(T,)%3E-for-%5BT;+1%5D)
(N-tuple to array for N in 1..=12)
- [`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)
- [`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)
- [`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)
- [`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)
- [`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)
- [`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)

These APIs are now stable in const contexts:

- [`<*const T>::read`](https://doc.rust-lang.org/stable/std/primitive.pointer.html#method.read)
- [`<*const T>::read_unaligned`](https://doc.rust-lang.org/stable/std/primitive.pointer.html#method.read_unaligned)
- [`<*mut T>::read`](https://doc.rust-lang.org/stable/std/primitive.pointer.html#method.read-1)
- [`<*mut T>::read_unaligned`](https://doc.rust-lang.org/stable/std/primitive.pointer.html#method.read_unaligned-1)
- [`ptr::read`](https://doc.rust-lang.org/stable/std/ptr/fn.read.html)
- [`ptr::read_unaligned`](https://doc.rust-lang.org/stable/std/ptr/fn.read_unaligned.html)
- [`<[T]>::split_at`](https://doc.rust-lang.org/stable/std/primitive.slice.html#method.split_at)

<a id="1.71.0-Cargo"></a>

Cargo
-----
- [Allow named debuginfo options in `Cargo.toml`.](https://github.com/rust-lang/cargo/pull/11958/)
- [Add `workspace_default_members` to the output of `cargo metadata`.](https://github.com/rust-lang/cargo/pull/11978/)
- [`cargo add` now considers `rust-version` when selecting packages.](https://github.com/rust-lang/cargo/pull/12078/)
- [Automatically inherit workspace fields when running `cargo new`/`cargo init`.](https://github.com/rust-lang/cargo/pull/12069/)

<a id="1.71.0-Rustdoc"></a>

Rustdoc
-------

- [Add a new `rustdoc::unescaped_backticks` lint for broken inline code.](https://github.com/rust-lang/rust/pull/105848/)
- [Support strikethrough with single tildes.](https://github.com/rust-lang/rust/pull/111152/) (`~~old~~` vs. `~new~`)

<a id="1.71.0-Misc"></a>

Misc
----

<a id="1.71.0-Compatibility-Notes"></a>

Compatibility Notes
-------------------

- [Remove structural match from `TypeId`.](https://github.com/rust-lang/rust/pull/103291/)
Code that uses a constant `TypeId` in a pattern will potentially be broken.
Known cases have already been fixed -- in particular, users of the `log`
crate's `kv_unstable` feature should update to `log v0.4.18` or later.
- [Add a `sysroot` crate to represent the standard library crates.](https://github.com/rust-lang/rust/pull/108865/)
This does not affect stable users, but may require adjustment in tools that build their own standard library.
- [Cargo optimizes its usage under `rustup`.](https://github.com/rust-lang/cargo/pull/11917/) When
Cargo detects it will run `rustc` pointing to a rustup proxy, it'll try bypassing the proxy and
use the underlying binary directly. There are assumptions around the interaction with rustup and
`RUSTUP_TOOLCHAIN`. However, it's not expected to affect normal users.
- [When querying a package, Cargo tries only the original name, all hyphens, and all underscores to
handle misspellings.](https://github.com/rust-lang/cargo/pull/12083/) Previously, Cargo tried each
combination of hyphens and underscores, causing excessive requests to crates.io.
- Cargo now [disallows `RUSTUP_HOME`](https://github.com/rust-lang/cargo/pull/12101/) and
[`RUSTUP_TOOLCHAIN`](https://github.com/rust-lang/cargo/pull/12107/) in the `[env]` configuration
table. This is considered to be not a use case Cargo would like to support, since it will likely
cause problems or lead to confusion.

<a id="1.71.0-Internal-Changes"></a>

Internal Changes
----------------

These changes do not affect any public interfaces of Rust, but they represent
significant improvements to the performance or internals of rustc and related
tools.


Version 1.70.0 (2023-06-01)
==========================

Expand Down
47 changes: 32 additions & 15 deletions compiler/rustc_mir_build/src/thir/cx/expr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -215,17 +215,18 @@ impl<'tcx> Cx<'tcx> {
// so we wouldn't have to compute and store the actual value

let hir::ExprKind::Path(ref qpath) = source.kind else {
return ExprKind::Cast { source: self.mirror_expr(source)};
return ExprKind::Cast { source: self.mirror_expr(source) };
};

let res = self.typeck_results().qpath_res(qpath, source.hir_id);
let ty = self.typeck_results().node_type(source.hir_id);
let ty::Adt(adt_def, substs) = ty.kind() else {
return ExprKind::Cast { source: self.mirror_expr(source)};
return ExprKind::Cast { source: self.mirror_expr(source) };
};

let Res::Def(DefKind::Ctor(CtorOf::Variant, CtorKind::Const), variant_ctor_id) = res else {
return ExprKind::Cast { source: self.mirror_expr(source)};
let Res::Def(DefKind::Ctor(CtorOf::Variant, CtorKind::Const), variant_ctor_id) = res
else {
return ExprKind::Cast { source: self.mirror_expr(source) };
};

let idx = adt_def.variant_index_with_ctor_id(variant_ctor_id);
Expand Down Expand Up @@ -358,19 +359,35 @@ impl<'tcx> Cx<'tcx> {
});
}
}
let adt_data =
if let hir::ExprKind::Path(hir::QPath::Resolved(_, ref path)) = fun.kind {
// Tuple-like ADTs are represented as ExprKind::Call. We convert them here.
expr_ty.ty_adt_def().and_then(|adt_def| match path.res {
Res::Def(DefKind::Ctor(_, CtorKind::Fn), ctor_id) => {

// Tuple-like ADTs are represented as ExprKind::Call. We convert them here.
let adt_data = if let hir::ExprKind::Path(ref qpath) = fun.kind
&& let Some(adt_def) = expr_ty.ty_adt_def() {
match qpath {
hir::QPath::Resolved(_, ref path) => {
match path.res {
Res::Def(DefKind::Ctor(_, CtorKind::Fn), ctor_id) => {
Some((adt_def, adt_def.variant_index_with_ctor_id(ctor_id)))
}
Res::SelfCtor(..) => Some((adt_def, FIRST_VARIANT)),
_ => None,
}
}
hir::QPath::TypeRelative(_ty, _) => {
if let Some((DefKind::Ctor(_, CtorKind::Fn), ctor_id)) =
self.typeck_results().type_dependent_def(fun.hir_id)
{
Some((adt_def, adt_def.variant_index_with_ctor_id(ctor_id)))
} else {
None
}
Res::SelfCtor(..) => Some((adt_def, FIRST_VARIANT)),
_ => None,
})
} else {
None
};

}
_ => None,
}
} else {
None
};
if let Some((adt_def, index)) = adt_data {
let substs = self.typeck_results().node_substs(fun.hir_id);
let user_provided_types = self.typeck_results().user_provided_types();
Expand Down
Loading
Loading