Skip to content

Commit f1edd04

Browse files
committed
Auto merge of #91361 - Mark-Simulacrum:stable-next, r=Mark-Simulacrum
[stable] 1.57.0 artifacts This is the standard beta->stable promotion, and includes a last-minute backports of: * #90044 via inclusion of #91220. * [beta] Don't treat unnormalized function arguments as well-formed #91242 r? `@Mark-Simulacrum`
2 parents 7e15b23 + a9174cf commit f1edd04

File tree

11 files changed

+172
-49
lines changed

11 files changed

+172
-49
lines changed

RELEASES.md

+115-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,117 @@
1+
Version 1.57.0 (2021-12-02)
2+
==========================
3+
4+
Language
5+
--------
6+
7+
- [Macro attributes may follow `#[derive]` and will see the original (pre-`cfg`) input.][87220]
8+
- [Accept curly-brace macros in expressions, like `m!{ .. }.method()` and `m!{ .. }?`.][88690]
9+
- [Allow panicking in constant evaluation.][89508]
10+
11+
Compiler
12+
--------
13+
14+
- [Create more accurate debuginfo for vtables.][89597]
15+
- [Add `armv6k-nintendo-3ds` at Tier 3\*.][88529]
16+
- [Add `armv7-unknown-linux-uclibceabihf` at Tier 3\*.][88952]
17+
- [Add `m68k-unknown-linux-gnu` at Tier 3\*.][88321]
18+
- [Add SOLID targets at Tier 3\*:][86191] `aarch64-kmc-solid_asp3`, `armv7a-kmc-solid_asp3-eabi`, `armv7a-kmc-solid_asp3-eabihf`
19+
20+
\* Refer to Rust's [platform support page][platform-support-doc] for more
21+
information on Rust's tiered platform support.
22+
23+
Libraries
24+
---------
25+
26+
- [Avoid allocations and copying in `Vec::leak`][89337]
27+
- [Add `#[repr(i8)]` to `Ordering`][89507]
28+
- [Optimize `File::read_to_end` and `read_to_string`][89582]
29+
- [Update to Unicode 14.0][89614]
30+
- [Many more functions are marked `#[must_use]`][89692], producing a warning
31+
when ignoring their return value. This helps catch mistakes such as expecting
32+
a function to mutate a value in place rather than return a new value.
33+
34+
Stabilised APIs
35+
---------------
36+
37+
- [`[T; N]::as_mut_slice`][`array::as_mut_slice`]
38+
- [`[T; N]::as_slice`][`array::as_slice`]
39+
- [`collections::TryReserveError`]
40+
- [`HashMap::try_reserve`]
41+
- [`HashSet::try_reserve`]
42+
- [`String::try_reserve`]
43+
- [`String::try_reserve_exact`]
44+
- [`Vec::try_reserve`]
45+
- [`Vec::try_reserve_exact`]
46+
- [`VecDeque::try_reserve`]
47+
- [`VecDeque::try_reserve_exact`]
48+
- [`Iterator::map_while`]
49+
- [`iter::MapWhile`]
50+
- [`proc_macro::is_available`]
51+
- [`Command::get_program`]
52+
- [`Command::get_args`]
53+
- [`Command::get_envs`]
54+
- [`Command::get_current_dir`]
55+
- [`CommandArgs`]
56+
- [`CommandEnvs`]
57+
58+
These APIs are now usable in const contexts:
59+
60+
- [`hint::unreachable_unchecked`]
61+
62+
Cargo
63+
-----
64+
65+
- [Stabilize custom profiles][cargo/9943]
66+
67+
Compatibility notes
68+
-------------------
69+
70+
Internal changes
71+
----------------
72+
These changes provide no direct user facing benefits, but represent significant
73+
improvements to the internals and overall performance of rustc
74+
and related tools.
75+
76+
- [Added an experimental backend for codegen with `libgccjit`.][87260]
77+
78+
[86191]: https://github.com/rust-lang/rust/pull/86191/
79+
[87220]: https://github.com/rust-lang/rust/pull/87220/
80+
[87260]: https://github.com/rust-lang/rust/pull/87260/
81+
[88243]: https://github.com/rust-lang/rust/pull/88243/
82+
[88321]: https://github.com/rust-lang/rust/pull/88321/
83+
[88529]: https://github.com/rust-lang/rust/pull/88529/
84+
[88690]: https://github.com/rust-lang/rust/pull/88690/
85+
[88952]: https://github.com/rust-lang/rust/pull/88952/
86+
[89337]: https://github.com/rust-lang/rust/pull/89337/
87+
[89507]: https://github.com/rust-lang/rust/pull/89507/
88+
[89508]: https://github.com/rust-lang/rust/pull/89508/
89+
[89582]: https://github.com/rust-lang/rust/pull/89582/
90+
[89597]: https://github.com/rust-lang/rust/pull/89597/
91+
[89614]: https://github.com/rust-lang/rust/pull/89614/
92+
[89692]: https://github.com/rust-lang/rust/issues/89692/
93+
[cargo/9943]: https://github.com/rust-lang/cargo/pull/9943/
94+
[`array::as_mut_slice`]: https://doc.rust-lang.org/std/primitive.array.html#method.as_mut_slice
95+
[`array::as_slice`]: https://doc.rust-lang.org/std/primitive.array.html#method.as_slice
96+
[`collections::TryReserveError`]: https://doc.rust-lang.org/std/collections/struct.TryReserveError.html
97+
[`HashMap::try_reserve`]: https://doc.rust-lang.org/std/collections/hash_map/struct.HashMap.html#method.try_reserve
98+
[`HashSet::try_reserve`]: https://doc.rust-lang.org/std/collections/hash_set/struct.HashSet.html#method.try_reserve
99+
[`String::try_reserve`]: https://doc.rust-lang.org/alloc/string/struct.String.html#method.try_reserve
100+
[`String::try_reserve_exact`]: https://doc.rust-lang.org/alloc/string/struct.String.html#method.try_reserve_exact
101+
[`Vec::try_reserve`]: https://doc.rust-lang.org/std/vec/struct.Vec.html#method.try_reserve
102+
[`Vec::try_reserve_exact`]: https://doc.rust-lang.org/std/vec/struct.Vec.html#method.try_reserve_exact
103+
[`VecDeque::try_reserve`]: https://doc.rust-lang.org/std/collections/struct.VecDeque.html#method.try_reserve
104+
[`VecDeque::try_reserve_exact`]: https://doc.rust-lang.org/std/collections/struct.VecDeque.html#method.try_reserve_exact
105+
[`Iterator::map_while`]: https://doc.rust-lang.org/std/iter/trait.Iterator.html#method.map_while
106+
[`iter::MapWhile`]: https://doc.rust-lang.org/std/iter/struct.MapWhile.html
107+
[`proc_macro::is_available`]: https://doc.rust-lang.org/proc_macro/fn.is_available.html
108+
[`Command::get_program`]: https://doc.rust-lang.org/std/process/struct.Command.html#method.get_program
109+
[`Command::get_args`]: https://doc.rust-lang.org/std/process/struct.Command.html#method.get_args
110+
[`Command::get_envs`]: https://doc.rust-lang.org/std/process/struct.Command.html#method.get_envs
111+
[`Command::get_current_dir`]: https://doc.rust-lang.org/std/process/struct.Command.html#method.get_current_dir
112+
[`CommandArgs`]: https://doc.rust-lang.org/std/process/struct.CommandArgs.html
113+
[`CommandEnvs`]: https://doc.rust-lang.org/std/process/struct.CommandEnvs.html
114+
1115
Version 1.56.1 (2021-11-01)
2116
===========================
3117

@@ -85,7 +199,7 @@ Cargo
85199
- [Cargo supports specifying a minimum supported Rust version in Cargo.toml.][`rust-version`]
86200
This has no effect at present on dependency version selection.
87201
We encourage crates to specify their minimum supported Rust version, and we encourage CI systems
88-
that support Rust code to include a crate's specified minimum version in the text matrix for that
202+
that support Rust code to include a crate's specified minimum version in the test matrix for that
89203
crate by default.
90204

91205
Compatibility notes

compiler/rustc_borrowck/src/type_check/free_region_relations.rs

+2-4
Original file line numberDiff line numberDiff line change
@@ -258,7 +258,6 @@ impl UniversalRegionRelationsBuilder<'cx, 'tcx> {
258258
debug!("build: input_or_output={:?}", ty);
259259
// We add implied bounds from both the unnormalized and normalized ty
260260
// See issue #87748
261-
let constraints_implied_1 = self.add_implied_bounds(ty);
262261
let TypeOpOutput { output: norm_ty, constraints: constraints1, .. } = self
263262
.param_env
264263
.and(type_op::normalize::Normalize::new(ty))
@@ -286,10 +285,9 @@ impl UniversalRegionRelationsBuilder<'cx, 'tcx> {
286285
// }
287286
// ```
288287
// Both &Self::Bar and &() are WF
289-
let constraints_implied_2 =
290-
if ty != norm_ty { self.add_implied_bounds(norm_ty) } else { None };
288+
let constraints_implied = self.add_implied_bounds(norm_ty);
291289
normalized_inputs_and_output.push(norm_ty);
292-
constraints1.into_iter().chain(constraints_implied_1).chain(constraints_implied_2)
290+
constraints1.into_iter().chain(constraints_implied)
293291
})
294292
.collect();
295293

compiler/rustc_codegen_llvm/src/llvm_util.rs

+4-1
Original file line numberDiff line numberDiff line change
@@ -417,7 +417,10 @@ pub fn llvm_global_features(sess: &Session) -> Vec<String> {
417417
features.extend(sess.opts.cg.target_feature.split(',').flat_map(&filter));
418418

419419
// FIXME: Move outline-atomics to target definition when earliest supported LLVM is 12.
420-
if get_version() >= (12, 0, 0) && sess.target.llvm_target.contains("aarch64-unknown-linux") {
420+
if get_version() >= (12, 0, 0)
421+
&& sess.target.llvm_target.contains("aarch64-unknown-linux")
422+
&& sess.target.llvm_target != "aarch64-unknown-linux-musl"
423+
{
421424
features.push("+outline-atomics".to_string());
422425
}
423426

compiler/rustc_typeck/src/check/compare_method.rs

+1-6
Original file line numberDiff line numberDiff line change
@@ -266,14 +266,9 @@ fn compare_predicate_entailment<'tcx>(
266266
// First liberate late bound regions and subst placeholders
267267
let trait_sig = tcx.liberate_late_bound_regions(impl_m.def_id, tcx.fn_sig(trait_m.def_id));
268268
let trait_sig = trait_sig.subst(tcx, trait_to_placeholder_substs);
269-
// Next, add all inputs and output as well-formed tys. Importantly,
270-
// we have to do this before normalization, since the normalized ty may
271-
// not contain the input parameters. See issue #87748.
272-
wf_tys.extend(trait_sig.inputs_and_output.iter());
273269
let trait_sig =
274270
inh.normalize_associated_types_in(impl_m_span, impl_m_hir_id, param_env, trait_sig);
275-
// Also add the resulting inputs and output as well-formed.
276-
// This probably isn't strictly necessary.
271+
// Add the resulting inputs and output as well-formed.
277272
wf_tys.extend(trait_sig.inputs_and_output.iter());
278273
let trait_fty = tcx.mk_fn_ptr(ty::Binder::dummy(trait_sig));
279274

compiler/rustc_typeck/src/check/mod.rs

-1
Original file line numberDiff line numberDiff line change
@@ -391,7 +391,6 @@ fn typeck_with_fallback<'tcx>(
391391
let mut wf_tys = FxHashSet::default();
392392
// Compute the fty from point of view of inside the fn.
393393
let fn_sig = tcx.liberate_late_bound_regions(def_id.to_def_id(), fn_sig);
394-
wf_tys.extend(fn_sig.inputs_and_output.iter());
395394
let fn_sig = inh.normalize_associated_types_in(
396395
body.value.span,
397396
body_id.hir_id,

compiler/rustc_typeck/src/check/wfcheck.rs

-5
Original file line numberDiff line numberDiff line change
@@ -960,11 +960,6 @@ fn check_fn_or_method<'fcx, 'tcx>(
960960
) {
961961
let sig = fcx.tcx.liberate_late_bound_regions(def_id, sig);
962962

963-
// Unnormalized types in signature are WF too
964-
implied_bounds.extend(sig.inputs());
965-
// FIXME(#27579) return types should not be implied bounds
966-
implied_bounds.insert(sig.output());
967-
968963
// Normalize the input and output types one at a time, using a different
969964
// `WellFormedLoc` for each. We cannot call `normalize_associated_types`
970965
// on the entire `FnSig`, since this would use the same `WellFormedLoc`

src/ci/channel

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
beta
1+
stable
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
error: lifetime may not live long enough
2+
--> $DIR/implied-bounds-unnorm-associated-type.rs:14:5
3+
|
4+
LL | fn f<'a, 'b>(s: &'b str, _: <&'a &'b () as Trait>::Type) -> &'a str {
5+
| -- -- lifetime `'b` defined here
6+
| |
7+
| lifetime `'a` defined here
8+
LL | s
9+
| ^ returning this value requires that `'b` must outlive `'a`
10+
|
11+
= help: consider adding the following bound: `'b: 'a`
12+
13+
error: aborting due to previous error
14+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
// check-fail
2+
// See issue #91068. Types in the substs of an associated type can't be implied
3+
// to be WF, since they don't actually have to be constructed.
4+
5+
trait Trait {
6+
type Type;
7+
}
8+
9+
impl<T> Trait for T {
10+
type Type = ();
11+
}
12+
13+
fn f<'a, 'b>(s: &'b str, _: <&'a &'b () as Trait>::Type) -> &'a str {
14+
s //~ ERROR lifetime mismatch [E0623]
15+
}
16+
17+
fn main() {
18+
let x = String::from("Hello World!");
19+
let y = f(&x, ());
20+
drop(x);
21+
println!("{}", y);
22+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
error[E0623]: lifetime mismatch
2+
--> $DIR/implied-bounds-unnorm-associated-type.rs:14:5
3+
|
4+
LL | fn f<'a, 'b>(s: &'b str, _: <&'a &'b () as Trait>::Type) -> &'a str {
5+
| ------- ----------
6+
| |
7+
| these two types are declared with different lifetimes...
8+
LL | s
9+
| ^ ...but data from `s` flows here
10+
11+
error: aborting due to previous error
12+
13+
For more information about this error, try `rustc --explain E0623`.

src/test/ui/generic-associated-types/issue-87748.rs

-30
This file was deleted.

0 commit comments

Comments
 (0)