Skip to content

Commit c6fb7b9

Browse files
committed
Auto merge of #110375 - JohnTitor:rollup-ghvdaxm, r=JohnTitor
Rollup of 8 pull requests Successful merges: - #110033 (Add 1.69.0 release notes) - #110272 (fix: skip implied bounds if unconstrained lifetime exists) - #110307 (Allow everyone to set the beta-nominated label) - #110347 (Add intra-doc links to size_of_* functions) - #110350 (Add a UI test for #79605) - #110356 (Fix `x test rust-installer` when `cargo` is set to a relative path) - #110364 (remove redundant clones) - #110366 (fix some clippy::complexity) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2 parents 50b816f + a898374 commit c6fb7b9

File tree

17 files changed

+220
-43
lines changed

17 files changed

+220
-43
lines changed

Diff for: RELEASES.md

+102
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,105 @@
1+
Version 1.69.0 (2023-04-20)
2+
==========================
3+
4+
<a id="1.69.0-Language"></a>
5+
6+
Language
7+
--------
8+
9+
- [Deriving built-in traits on packed structs works with `Copy` fields.](https://github.com/rust-lang/rust/pull/104429/)
10+
- [Stabilize the `cmpxchg16b` target feature on x86 and x86_64.](https://github.com/rust-lang/rust/pull/106774/)
11+
- [Improve analysis of trait bounds for associated types.](https://github.com/rust-lang/rust/pull/103695/)
12+
- [Allow associated types to be used as union fields.](https://github.com/rust-lang/rust/pull/106938/)
13+
- [Allow `Self: Autotrait` bounds on dyn-safe trait methods.](https://github.com/rust-lang/rust/pull/107082/)
14+
- [Treat `str` as containing `[u8]` for auto trait purposes.](https://github.com/rust-lang/rust/pull/107941/)
15+
16+
<a id="1.69.0-Compiler"></a>
17+
18+
Compiler
19+
--------
20+
21+
- [Upgrade `*-pc-windows-gnu` on CI to mingw-w64 v10 and GCC 12.2.](https://github.com/rust-lang/rust/pull/100178/)
22+
- [Rework min_choice algorithm of member constraints.](https://github.com/rust-lang/rust/pull/105300/)
23+
- [Support `true` and `false` as boolean flags in compiler arguments.](https://github.com/rust-lang/rust/pull/107043/)
24+
- [Default `repr(C)` enums to `c_int` size.](https://github.com/rust-lang/rust/pull/107592/)
25+
26+
<a id="1.69.0-Libraries"></a>
27+
28+
Libraries
29+
---------
30+
31+
- [Implement the unstable `DispatchFromDyn` for cell types, allowing downstream experimentation with custom method receivers.](https://github.com/rust-lang/rust/pull/97373/)
32+
- [Document that `fmt::Arguments::as_str()` may return `Some(_)` in more cases after optimization, subject to change.](https://github.com/rust-lang/rust/pull/106823/)
33+
- [Implement `AsFd` and `AsRawFd` for `Rc`.](https://github.com/rust-lang/rust/pull/107317/)
34+
35+
<a id="1.69.0-Stabilized-APIs"></a>
36+
37+
Stabilized APIs
38+
---------------
39+
40+
- [`CStr::from_bytes_until_nul`](https://doc.rust-lang.org/stable/core/ffi/struct.CStr.html#method.from_bytes_until_nul)
41+
- [`core::ffi::FromBytesUntilNulError`](https://doc.rust-lang.org/stable/core/ffi/struct.FromBytesUntilNulError.html)
42+
43+
These APIs are now stable in const contexts:
44+
45+
- [`SocketAddr::new`](https://doc.rust-lang.org/stable/std/net/enum.SocketAddr.html#method.new)
46+
- [`SocketAddr::ip`](https://doc.rust-lang.org/stable/std/net/enum.SocketAddr.html#method.ip)
47+
- [`SocketAddr::port`](https://doc.rust-lang.org/stable/std/net/enum.SocketAddr.html#method.port)
48+
- [`SocketAddr::is_ipv4`](https://doc.rust-lang.org/stable/std/net/enum.SocketAddr.html#method.is_ipv4)
49+
- [`SocketAddr::is_ipv6`](https://doc.rust-lang.org/stable/std/net/enum.SocketAddr.html#method.is_ipv6)
50+
- [`SocketAddrV4::new`](https://doc.rust-lang.org/stable/std/net/struct.SocketAddrV4.html#method.new)
51+
- [`SocketAddrV4::ip`](https://doc.rust-lang.org/stable/std/net/struct.SocketAddrV4.html#method.ip)
52+
- [`SocketAddrV4::port`](https://doc.rust-lang.org/stable/std/net/struct.SocketAddrV4.html#method.port)
53+
- [`SocketAddrV6::new`](https://doc.rust-lang.org/stable/std/net/struct.SocketAddrV6.html#method.new)
54+
- [`SocketAddrV6::ip`](https://doc.rust-lang.org/stable/std/net/struct.SocketAddrV6.html#method.ip)
55+
- [`SocketAddrV6::port`](https://doc.rust-lang.org/stable/std/net/struct.SocketAddrV6.html#method.port)
56+
- [`SocketAddrV6::flowinfo`](https://doc.rust-lang.org/stable/std/net/struct.SocketAddrV6.html#method.flowinfo)
57+
- [`SocketAddrV6::scope_id`](https://doc.rust-lang.org/stable/std/net/struct.SocketAddrV6.html#method.scope_id)
58+
59+
<a id="1.69.0-Cargo"></a>
60+
61+
Cargo
62+
-----
63+
64+
- [Cargo now suggests `cargo fix` or `cargo clippy --fix` when compilation warnings are auto-fixable.](https://github.com/rust-lang/cargo/pull/11558/)
65+
- [Cargo now suggests `cargo add` if you try to install a library crate.](https://github.com/rust-lang/cargo/pull/11410/)
66+
- [Cargo now sets the `CARGO_BIN_NAME` environment variable also for binary examples.](https://github.com/rust-lang/cargo/pull/11705/)
67+
68+
<a id="1.69.0-Rustdoc"></a>
69+
70+
Rustdoc
71+
-----
72+
73+
- [Vertically compact trait bound formatting.](https://github.com/rust-lang/rust/pull/102842/)
74+
- [Only include stable lints in `rustdoc::all` group.](https://github.com/rust-lang/rust/pull/106316/)
75+
- [Compute maximum Levenshtein distance based on the query.](https://github.com/rust-lang/rust/pull/107141/)
76+
- [Remove inconsistently-present sidebar tooltips.](https://github.com/rust-lang/rust/pull/107490/)
77+
- [Search by macro when query ends with `!`.](https://github.com/rust-lang/rust/pull/108143/)
78+
79+
<a id="1.69.0-Compatibility-Notes"></a>
80+
81+
Compatibility Notes
82+
-------------------
83+
84+
- [The `rust-analysis` component from `rustup` now only contains a warning placeholder.](https://github.com/rust-lang/rust/pull/101841/) This was primarily intended for RLS, and the corresponding `-Zsave-analysis` flag has been removed from the compiler as well.
85+
- [Unaligned references to packed fields are now a hard error.](https://github.com/rust-lang/rust/pull/102513/) This has been a warning since 1.53, and denied by default with a future-compatibility warning since 1.62.
86+
- [Update the minimum external LLVM to 14.](https://github.com/rust-lang/rust/pull/107573/)
87+
- [Cargo now emits errors on invalid characters in a registry token.](https://github.com/rust-lang/cargo/pull/11600/)
88+
- [When `default-features` is set to false of a workspace dependency, and an inherited dependency of a member has `default-features = true`, Cargo will enable default features of that dependency.](https://github.com/rust-lang/cargo/pull/11409/)
89+
- [Cargo denies `CARGO_HOME` in the `[env]` configuration table. Cargo itself doesn't pick up this value, but recursive calls to cargo would, which was not intended.](https://github.com/rust-lang/cargo/pull/11644/)
90+
- [Debuginfo for build dependencies is now off if not explicitly set. This is expected to improve the overall build time.](https://github.com/rust-lang/cargo/pull/11252/)
91+
92+
<a id="1.69.0-Internal-Changes"></a>
93+
94+
Internal Changes
95+
----------------
96+
97+
These changes do not affect any public interfaces of Rust, but they represent
98+
significant improvements to the performance or internals of rustc and related
99+
tools.
100+
101+
- [Move `format_args!()` into AST (and expand it during AST lowering)](https://github.com/rust-lang/rust/pull/106745/)
102+
1103
Version 1.68.2 (2023-03-28)
2104
===========================
3105

Diff for: compiler/rustc_borrowck/src/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -528,7 +528,7 @@ impl<'cx, 'tcx> BorrowckInferCtxt<'cx, 'tcx> {
528528
where
529529
F: Fn() -> RegionCtxt,
530530
{
531-
let next_region = self.infcx.next_nll_region_var(origin.clone());
531+
let next_region = self.infcx.next_nll_region_var(origin);
532532
let vid = next_region.as_var();
533533

534534
if cfg!(debug_assertions) && !self.inside_canonicalization_ctxt() {

Diff for: compiler/rustc_hir_analysis/src/collect/predicates_of.rs

+2-3
Original file line numberDiff line numberDiff line change
@@ -645,9 +645,8 @@ pub(super) fn implied_predicates_with_filter(
645645
};
646646

647647
// Combine the two lists to form the complete set of superbounds:
648-
let implied_bounds = &*tcx
649-
.arena
650-
.alloc_from_iter(superbounds.predicates().into_iter().chain(where_bounds_that_match));
648+
let implied_bounds =
649+
&*tcx.arena.alloc_from_iter(superbounds.predicates().chain(where_bounds_that_match));
651650
debug!(?implied_bounds);
652651

653652
// Now require that immediate supertraits are converted,

Diff for: compiler/rustc_hir_typeck/src/fn_ctxt/adjust_fulfillment_errors.rs

+13-17
Original file line numberDiff line numberDiff line change
@@ -164,24 +164,20 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
164164
{
165165
for param in
166166
[param_to_point_at, fallback_param_to_point_at, self_param_to_point_at]
167+
.into_iter()
168+
.flatten()
167169
{
168-
if let Some(param) = param {
169-
let refined_expr = self.point_at_field_if_possible(
170-
def_id,
171-
param,
172-
variant_def_id,
173-
fields,
174-
);
175-
176-
match refined_expr {
177-
None => {}
178-
Some((refined_expr, _)) => {
179-
error.obligation.cause.span = refined_expr
180-
.span
181-
.find_ancestor_in_same_ctxt(error.obligation.cause.span)
182-
.unwrap_or(refined_expr.span);
183-
return true;
184-
}
170+
let refined_expr =
171+
self.point_at_field_if_possible(def_id, param, variant_def_id, fields);
172+
173+
match refined_expr {
174+
None => {}
175+
Some((refined_expr, _)) => {
176+
error.obligation.cause.span = refined_expr
177+
.span
178+
.find_ancestor_in_same_ctxt(error.obligation.cause.span)
179+
.unwrap_or(refined_expr.span);
180+
return true;
185181
}
186182
}
187183
}

Diff for: compiler/rustc_monomorphize/src/partitioning/default.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ impl<'tcx> Partitioner<'tcx> for DefaultPartitioning {
8989
}
9090

9191
PreInliningPartitioning {
92-
codegen_units: codegen_units.into_values().map(|codegen_unit| codegen_unit).collect(),
92+
codegen_units: codegen_units.into_values().collect(),
9393
roots,
9494
internalization_candidates,
9595
}

Diff for: compiler/rustc_parse/src/parser/diagnostics.rs

+3-5
Original file line numberDiff line numberDiff line change
@@ -570,15 +570,13 @@ impl<'a> Parser<'a> {
570570
let expect = tokens_to_string(&expected);
571571
let actual = super::token_descr(&self.token);
572572
let (msg_exp, (label_sp, label_exp)) = if expected.len() > 1 {
573+
let fmt = format!("expected one of {expect}, found {actual}");
573574
let short_expect = if expected.len() > 6 {
574575
format!("{} possible tokens", expected.len())
575576
} else {
576-
expect.clone()
577+
expect
577578
};
578-
(
579-
format!("expected one of {expect}, found {actual}"),
580-
(self.prev_token.span.shrink_to_hi(), format!("expected one of {short_expect}")),
581-
)
579+
(fmt, (self.prev_token.span.shrink_to_hi(), format!("expected one of {short_expect}")))
582580
} else if expected.is_empty() {
583581
(
584582
format!("unexpected token: {actual}"),

Diff for: compiler/rustc_query_impl/src/profiling_support.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -231,7 +231,7 @@ pub(crate) fn alloc_self_profile_query_strings_for_query_cache<'tcx, C>(
231231
// locked while doing so. Instead we copy out the
232232
// `(query_key, dep_node_index)` pairs and release the lock again.
233233
let mut query_keys_and_indices = Vec::new();
234-
query_cache.iter(&mut |k, _, i| query_keys_and_indices.push((k.clone(), i)));
234+
query_cache.iter(&mut |k, _, i| query_keys_and_indices.push((*k, i)));
235235

236236
// Now actually allocate the strings. If allocating the strings
237237
// generates new entries in the query cache, we'll miss them but

Diff for: compiler/rustc_trait_selection/src/traits/error_reporting/mod.rs

+9-6
Original file line numberDiff line numberDiff line change
@@ -2944,22 +2944,25 @@ impl<'tcx> InferCtxtPrivExt<'tcx> for TypeErrCtxt<'_, 'tcx> {
29442944
rustc_transmute::Answer::No(reason) => {
29452945
let dst = trait_ref.skip_binder().substs.type_at(0);
29462946
let src = trait_ref.skip_binder().substs.type_at(1);
2947-
let custom_err_msg = format!("`{src}` cannot be safely transmuted into `{dst}` in the defining scope of `{scope}`").to_string();
2947+
let custom_err_msg = format!(
2948+
"`{src}` cannot be safely transmuted into `{dst}` in the defining scope of `{scope}`"
2949+
);
29482950
let reason_msg = match reason {
29492951
rustc_transmute::Reason::SrcIsUnspecified => {
2950-
format!("`{src}` does not have a well-specified layout").to_string()
2952+
format!("`{src}` does not have a well-specified layout")
29512953
}
2954+
29522955
rustc_transmute::Reason::DstIsUnspecified => {
2953-
format!("`{dst}` does not have a well-specified layout").to_string()
2956+
format!("`{dst}` does not have a well-specified layout")
29542957
}
2958+
29552959
rustc_transmute::Reason::DstIsBitIncompatible => {
29562960
format!("At least one value of `{src}` isn't a bit-valid value of `{dst}`")
2957-
.to_string()
29582961
}
2962+
29592963
rustc_transmute::Reason::DstIsPrivate => format!(
29602964
"`{dst}` is or contains a type or field that is not visible in that scope"
2961-
)
2962-
.to_string(),
2965+
),
29632966
// FIXME(bryangarza): Include the number of bytes of src and dst
29642967
rustc_transmute::Reason::DstIsTooBig => {
29652968
format!("The size of `{src}` is smaller than the size of `{dst}`")

Diff for: compiler/rustc_trait_selection/src/traits/outlives_bounds.rs

+12-1
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,18 @@ impl<'a, 'tcx: 'a> InferCtxtExt<'a, 'tcx> for InferCtxt<'tcx> {
5555
) -> Vec<OutlivesBound<'tcx>> {
5656
let ty = self.resolve_vars_if_possible(ty);
5757
let ty = OpportunisticRegionResolver::new(self).fold_ty(ty);
58-
assert!(!ty.needs_infer());
58+
59+
// We do not expect existential variables in implied bounds.
60+
// We may however encounter unconstrained lifetime variables in invalid
61+
// code. See #110161 for context.
62+
assert!(!ty.has_non_region_infer());
63+
if ty.needs_infer() {
64+
self.tcx.sess.delay_span_bug(
65+
self.tcx.def_span(body_id),
66+
"skipped implied_outlives_bounds due to unconstrained lifetimes",
67+
);
68+
return vec![];
69+
}
5970

6071
let span = self.tcx.def_span(body_id);
6172
let result = param_env

Diff for: library/core/src/mem/mod.rs

+13-6
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@ pub fn forget_unsized<T: ?Sized>(t: T) {
170170
///
171171
/// The following table gives the size for primitives.
172172
///
173-
/// Type | size_of::\<Type>()
173+
/// Type | `size_of::<Type>()`
174174
/// ---- | ---------------
175175
/// () | 0
176176
/// bool | 1
@@ -190,8 +190,8 @@ pub fn forget_unsized<T: ?Sized>(t: T) {
190190
///
191191
/// Furthermore, `usize` and `isize` have the same size.
192192
///
193-
/// The types `*const T`, `&T`, `Box<T>`, `Option<&T>`, and `Option<Box<T>>` all have
194-
/// the same size. If `T` is Sized, all of those types have the same size as `usize`.
193+
/// The types [`*const T`], `&T`, [`Box<T>`], [`Option<&T>`], and `Option<Box<T>>` all have
194+
/// the same size. If `T` is `Sized`, all of those types have the same size as `usize`.
195195
///
196196
/// The mutability of a pointer does not change its size. As such, `&T` and `&mut T`
197197
/// have the same size. Likewise for `*const T` and `*mut T`.
@@ -203,7 +203,7 @@ pub fn forget_unsized<T: ?Sized>(t: T) {
203203
///
204204
/// ## Size of Structs
205205
///
206-
/// For `structs`, the size is determined by the following algorithm.
206+
/// For `struct`s, the size is determined by the following algorithm.
207207
///
208208
/// For each field in the struct ordered by declaration order:
209209
///
@@ -299,6 +299,10 @@ pub fn forget_unsized<T: ?Sized>(t: T) {
299299
/// ```
300300
///
301301
/// [alignment]: align_of
302+
/// [`*const T`]: primitive@pointer
303+
/// [`Box<T>`]: ../../std/boxed/struct.Box.html
304+
/// [`Option<&T>`]: crate::option::Option
305+
///
302306
#[inline(always)]
303307
#[must_use]
304308
#[stable(feature = "rust1", since = "1.0.0")]
@@ -311,7 +315,7 @@ pub const fn size_of<T>() -> usize {
311315

312316
/// Returns the size of the pointed-to value in bytes.
313317
///
314-
/// This is usually the same as `size_of::<T>()`. However, when `T` *has* no
318+
/// This is usually the same as [`size_of::<T>()`]. However, when `T` *has* no
315319
/// statically-known size, e.g., a slice [`[T]`][slice] or a [trait object],
316320
/// then `size_of_val` can be used to get the dynamically-known size.
317321
///
@@ -328,6 +332,8 @@ pub const fn size_of<T>() -> usize {
328332
/// let y: &[u8] = &x;
329333
/// assert_eq!(13, mem::size_of_val(y));
330334
/// ```
335+
///
336+
/// [`size_of::<T>()`]: size_of
331337
#[inline]
332338
#[must_use]
333339
#[stable(feature = "rust1", since = "1.0.0")]
@@ -340,7 +346,7 @@ pub const fn size_of_val<T: ?Sized>(val: &T) -> usize {
340346

341347
/// Returns the size of the pointed-to value in bytes.
342348
///
343-
/// This is usually the same as `size_of::<T>()`. However, when `T` *has* no
349+
/// This is usually the same as [`size_of::<T>()`]. However, when `T` *has* no
344350
/// statically-known size, e.g., a slice [`[T]`][slice] or a [trait object],
345351
/// then `size_of_val_raw` can be used to get the dynamically-known size.
346352
///
@@ -363,6 +369,7 @@ pub const fn size_of_val<T: ?Sized>(val: &T) -> usize {
363369
/// [`size_of_val`] on a reference to a type with an extern type tail.
364370
/// - otherwise, it is conservatively not allowed to call this function.
365371
///
372+
/// [`size_of::<T>()`]: size_of
366373
/// [trait object]: ../../book/ch17-02-trait-objects.html
367374
/// [extern type]: ../../unstable-book/language-features/extern-types.html
368375
///

Diff for: src/bootstrap/config.rs

+3-1
Original file line numberDiff line numberDiff line change
@@ -1009,7 +1009,9 @@ impl Config {
10091009
});
10101010
config.initial_cargo = build
10111011
.cargo
1012-
.map(PathBuf::from)
1012+
.map(|cargo| {
1013+
t!(PathBuf::from(cargo).canonicalize(), "`initial_cargo` not found on disk")
1014+
})
10131015
.unwrap_or_else(|| config.out.join(config.build.triple).join("stage0/bin/cargo"));
10141016

10151017
// NOTE: it's important this comes *after* we set `initial_rustc` just above.

Diff for: src/librustdoc/passes/collect_intra_doc_links.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1349,7 +1349,7 @@ impl LinkCollector<'_, '_> {
13491349
if has_derive_trait_collision {
13501350
candidates.macro_ns = None;
13511351
}
1352-
candidates.into_iter().filter_map(|res| res).flatten().collect::<Vec<_>>()
1352+
candidates.into_iter().flatten().flatten().collect::<Vec<_>>()
13531353
}
13541354
}
13551355
}

Diff for: tests/ui/generics/issue-79605.rs

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
struct X<'a, T>(&'a T);
2+
3+
impl X<'_, _> {}
4+
//~^ ERROR the placeholder `_` is not allowed within types on item signatures for implementations
5+
6+
fn main() {}

Diff for: tests/ui/generics/issue-79605.stderr

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
error[E0121]: the placeholder `_` is not allowed within types on item signatures for implementations
2+
--> $DIR/issue-79605.rs:3:12
3+
|
4+
LL | impl X<'_, _> {}
5+
| ^ not allowed in type signatures
6+
|
7+
help: use type parameters instead
8+
|
9+
LL | impl<T> X<'_, T> {}
10+
| +++ ~
11+
12+
error: aborting due to previous error
13+
14+
For more information about this error, try `rustc --explain E0121`.

Diff for: tests/ui/implied-bounds/issue-110161.rs

+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
// ICE regression relating to unconstrained lifetimes in implied
2+
// bounds. See #110161.
3+
4+
// compile-flags: --crate-type=lib
5+
6+
trait LtTrait {
7+
type Ty;
8+
}
9+
10+
// erroneous `Ty` impl
11+
impl LtTrait for () {
12+
//~^ ERROR not all trait items implemented, missing: `Ty` [E0046]
13+
}
14+
15+
// `'lt` is not constrained by the erroneous `Ty`
16+
impl<'lt, T> LtTrait for Box<T>
17+
where
18+
T: LtTrait<Ty = &'lt ()>,
19+
{
20+
type Ty = &'lt ();
21+
}
22+
23+
// unconstrained lifetime appears in implied bounds
24+
fn test(_: <Box<()> as LtTrait>::Ty) {}
25+
26+
fn test2<'x>(_: &'x <Box<()> as LtTrait>::Ty) {}

0 commit comments

Comments
 (0)