Skip to content

Commit a45f0d7

Browse files
committed
Auto merge of rust-lang#84729 - jackh726:rollup-dnm8kg5, r=jackh726
Rollup of 10 pull requests Successful merges: - rust-lang#84451 (Use flex more consistently) - rust-lang#84590 (Point out that behavior might be switched on 2015 and 2018 too one day) - rust-lang#84682 (Don't rebind in `transitive_bounds_that_define_assoc_type`) - rust-lang#84683 (Minor grammar tweaks for readability to btree internals) - rust-lang#84688 (Remove unnecessary CSS rules for search results) - rust-lang#84690 (Remove unneeded bottom margin on search results) - rust-lang#84692 (Link between std::env::{var, var_os} and std::env::{vars, vars_os}) - rust-lang#84705 (make feature recommendations optional) - rust-lang#84706 (Drop alias `reduce` for `fold` - we have a `reduce` function) - rust-lang#84713 (Fix labels for regression issue template) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2 parents 478a07d + 087f964 commit a45f0d7

File tree

12 files changed

+120
-47
lines changed

12 files changed

+120
-47
lines changed

.github/ISSUE_TEMPLATE/regression.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
name: Regression
33
about: Report something that unexpectedly changed between Rust versions.
4-
labels: C-bug regression-untriaged
4+
labels: C-bug, regression-untriaged
55
---
66
<!--
77
Thank you for filing a regression report! 🐛 A regression is something that changed between versions of Rust but was not supposed to.

compiler/rustc_infer/src/traits/util.rs

+1-3
Original file line numberDiff line numberDiff line change
@@ -305,9 +305,7 @@ pub fn transitive_bounds_that_define_assoc_type<'tcx>(
305305
Some(assoc_name),
306306
));
307307
for (super_predicate, _) in super_predicates.predicates {
308-
let bound_predicate = super_predicate.kind();
309-
let subst_predicate = super_predicate
310-
.subst_supertrait(tcx, &bound_predicate.rebind(trait_ref.skip_binder()));
308+
let subst_predicate = super_predicate.subst_supertrait(tcx, &trait_ref);
311309
if let Some(binder) = subst_predicate.to_opt_poly_trait_ref() {
312310
stack.push(binder.value);
313311
}

compiler/rustc_middle/src/ty/flags.rs

+4
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,10 @@ impl FlagComputation {
5959
{
6060
let mut computation = FlagComputation::new();
6161

62+
if !value.bound_vars().is_empty() {
63+
computation.flags = computation.flags | TypeFlags::HAS_RE_LATE_BOUND;
64+
}
65+
6266
f(&mut computation, value.skip_binder());
6367

6468
self.add_flags(computation.flags);

compiler/rustc_resolve/src/diagnostics.rs

+7-1
Original file line numberDiff line numberDiff line change
@@ -487,7 +487,13 @@ impl<'a> Resolver<'a> {
487487
name
488488
));
489489
}
490-
err.help("use `#![feature(const_generics)]` and `#![feature(const_evaluatable_checked)]` to allow generic const expressions");
490+
491+
if self.session.is_nightly_build() {
492+
err.help(
493+
"use `#![feature(const_generics)]` and `#![feature(const_evaluatable_checked)]` \
494+
to allow generic const expressions"
495+
);
496+
}
491497

492498
err
493499
}

compiler/rustc_typeck/src/check/wfcheck.rs

+14-11
Original file line numberDiff line numberDiff line change
@@ -315,17 +315,20 @@ fn check_param_wf(tcx: TyCtxt<'_>, param: &hir::GenericParam<'_>) {
315315
),
316316
)
317317
} else {
318-
tcx.sess
319-
.struct_span_err(
320-
hir_ty.span,
321-
&format!(
322-
"{} is forbidden as the type of a const generic parameter",
323-
unsupported_type
324-
),
325-
)
326-
.note("the only supported types are integers, `bool` and `char`")
327-
.help("more complex types are supported with `#![feature(const_generics)]`")
328-
.emit()
318+
let mut err = tcx.sess.struct_span_err(
319+
hir_ty.span,
320+
&format!(
321+
"{} is forbidden as the type of a const generic parameter",
322+
unsupported_type
323+
),
324+
);
325+
err.note("the only supported types are integers, `bool` and `char`");
326+
if tcx.sess.is_nightly_build() {
327+
err.help(
328+
"more complex types are supported with `#![feature(const_generics)]`",
329+
);
330+
}
331+
err.emit()
329332
}
330333
};
331334

library/alloc/src/collections/btree/node.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ impl<K, V> LeafNode<K, V> {
8989

9090
/// The underlying representation of internal nodes. As with `LeafNode`s, these should be hidden
9191
/// behind `BoxedNode`s to prevent dropping uninitialized keys and values. Any pointer to an
92-
/// `InternalNode` can be directly casted to a pointer to the underlying `LeafNode` portion of the
92+
/// `InternalNode` can be directly cast to a pointer to the underlying `LeafNode` portion of the
9393
/// node, allowing code to act on leaf and internal nodes generically without having to even check
9494
/// which of the two a pointer is pointing at. This property is enabled by the use of `repr(C)`.
9595
#[repr(C)]
@@ -408,7 +408,7 @@ impl<K, V> NodeRef<marker::Dying, K, V, marker::LeafOrInternal> {
408408
}
409409

410410
impl<'a, K, V, Type> NodeRef<marker::Mut<'a>, K, V, Type> {
411-
/// Temporarily takes out another, mutable reference to the same node. Beware, as
411+
/// Temporarily takes out another mutable reference to the same node. Beware, as
412412
/// this method is very dangerous, doubly so since it may not immediately appear
413413
/// dangerous.
414414
///
@@ -759,15 +759,15 @@ impl<BorrowType, K, V, NodeType, HandleType> PartialEq
759759
impl<BorrowType, K, V, NodeType, HandleType>
760760
Handle<NodeRef<BorrowType, K, V, NodeType>, HandleType>
761761
{
762-
/// Temporarily takes out another, immutable handle on the same location.
762+
/// Temporarily takes out another immutable handle on the same location.
763763
pub fn reborrow(&self) -> Handle<NodeRef<marker::Immut<'_>, K, V, NodeType>, HandleType> {
764764
// We can't use Handle::new_kv or Handle::new_edge because we don't know our type
765765
Handle { node: self.node.reborrow(), idx: self.idx, _marker: PhantomData }
766766
}
767767
}
768768

769769
impl<'a, K, V, NodeType, HandleType> Handle<NodeRef<marker::Mut<'a>, K, V, NodeType>, HandleType> {
770-
/// Temporarily takes out another, mutable handle on the same location. Beware, as
770+
/// Temporarily takes out another mutable handle on the same location. Beware, as
771771
/// this method is very dangerous, doubly so since it may not immediately appear
772772
/// dangerous.
773773
///

library/core/src/iter/traits/iterator.rs

-1
Original file line numberDiff line numberDiff line change
@@ -2133,7 +2133,6 @@ pub trait Iterator {
21332133
/// ```
21342134
///
21352135
/// [`reduce()`]: Iterator::reduce
2136-
#[doc(alias = "reduce")]
21372136
#[doc(alias = "inject")]
21382137
#[inline]
21392138
#[stable(feature = "rust1", since = "1.0.0")]

library/std/src/env.rs

+11-2
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,10 @@ pub fn vars() -> Vars {
124124
/// variables at the time of this invocation. Modifications to environment
125125
/// variables afterwards will not be reflected in the returned iterator.
126126
///
127+
/// Note that the returned iterator will not check if the environment variables
128+
/// are valid Unicode. If you want to panic on invalid UTF-8,
129+
/// use the [`vars`] function instead.
130+
///
127131
/// # Examples
128132
///
129133
/// ```
@@ -180,8 +184,9 @@ impl fmt::Debug for VarsOs {
180184
///
181185
/// # Errors
182186
///
183-
/// * Environment variable is not present
184-
/// * Environment variable is not valid unicode
187+
/// Errors if the environment variable is not present.
188+
/// Errors if the environment variable is not valid Unicode. If this is not desired, consider using
189+
/// [`var_os`].
185190
///
186191
/// # Panics
187192
///
@@ -221,6 +226,10 @@ fn _var(key: &OsStr) -> Result<String, VarError> {
221226
/// `'='` or the NUL character `'\0'`, or when the value contains the NUL
222227
/// character.
223228
///
229+
/// Note that the method will not check if the environment variable
230+
/// is valid Unicode. If you want to have an error on invalid UTF-8,
231+
/// use the [`var`] function instead.
232+
///
224233
/// # Examples
225234
///
226235
/// ```

library/std/src/primitive_docs.rs

+47-2
Original file line numberDiff line numberDiff line change
@@ -553,8 +553,10 @@ mod prim_pointer {}
553553
/// # Editions
554554
///
555555
/// Prior to Rust 1.53, arrays did not implement `IntoIterator` by value, so the method call
556-
/// `array.into_iter()` auto-referenced into a slice iterator. That behavior is preserved in the
557-
/// 2015 and 2018 editions of Rust for compatability, ignoring `IntoIterator` by value.
556+
/// `array.into_iter()` auto-referenced into a slice iterator. Right now, the old behavior
557+
/// is preserved in the 2015 and 2018 editions of Rust for compatibility, ignoring
558+
/// `IntoIterator` by value. In the future, the behavior on the 2015 and 2018 edition
559+
/// might be made consistent to the behavior of later editions.
558560
///
559561
#[cfg_attr(bootstrap, doc = "```rust,edition2018,ignore")]
560562
#[cfg_attr(not(bootstrap), doc = "```rust,edition2018")]
@@ -601,6 +603,49 @@ mod prim_pointer {}
601603
/// }
602604
/// ```
603605
///
606+
/// Future language versions might start treating the `array.into_iter()`
607+
/// syntax on editions 2015 and 2018 the same as on edition 2021. So code using
608+
/// those older editions should still be written with this change in mind, to
609+
/// prevent breakage in the future. The safest way to accomplish this is to
610+
/// avoid the `into_iter` syntax on those editions. If an edition update is not
611+
/// viable/desired, there are multiple alternatives:
612+
/// * use `iter`, equivalent to the old behavior, creating references
613+
/// * use [`array::IntoIter`], equivalent to the post-2021 behavior (Rust 1.51+)
614+
/// * replace `for ... in array.into_iter() {` with `for ... in array {`,
615+
/// equivalent to the post-2021 behavior (Rust 1.53+)
616+
///
617+
#[cfg_attr(bootstrap, doc = "```rust,edition2018,ignore")]
618+
#[cfg_attr(not(bootstrap), doc = "```rust,edition2018")]
619+
/// use std::array::IntoIter;
620+
///
621+
/// let array: [i32; 3] = [0; 3];
622+
///
623+
/// // This iterates by reference:
624+
/// for item in array.iter() {
625+
/// let x: &i32 = item;
626+
/// println!("{}", x);
627+
/// }
628+
///
629+
/// // This iterates by value:
630+
/// for item in IntoIter::new(array) {
631+
/// let x: i32 = item;
632+
/// println!("{}", x);
633+
/// }
634+
///
635+
/// // This iterates by value:
636+
/// for item in array {
637+
/// let x: i32 = item;
638+
/// println!("{}", x);
639+
/// }
640+
///
641+
/// // IntoIter can also start a chain.
642+
/// // This iterates by value:
643+
/// for item in IntoIter::new(array).enumerate() {
644+
/// let (i, x): (usize, i32) = item;
645+
/// println!("array[{}] = {}", i, x);
646+
/// }
647+
/// ```
648+
///
604649
/// [slice]: prim@slice
605650
/// [`Debug`]: fmt::Debug
606651
/// [`Hash`]: hash::Hash

src/librustdoc/html/static/rustdoc.css

+8-22
Original file line numberDiff line numberDiff line change
@@ -117,9 +117,12 @@ h4:not(.method):not(.type):not(.tymethod):not(.associatedconstant) {
117117
}
118118
h1.fqn {
119119
display: flex;
120-
width: 100%;
121120
border-bottom: 1px dashed;
122121
margin-top: 0;
122+
123+
/* workaround to keep flex from breaking below 700 px width due to the float: right on the nav
124+
above the h1 */
125+
padding-left: 1px;
123126
}
124127
h1.fqn > .in-band > a:hover {
125128
text-decoration: underline;
@@ -385,17 +388,9 @@ nav.sub {
385388
position: relative;
386389
}
387390

388-
#results {
389-
position: absolute;
390-
right: 0;
391-
left: 0;
392-
overflow: auto;
393-
}
394-
395391
#results > table {
396392
width: 100%;
397393
table-layout: fixed;
398-
margin-bottom: 40px;
399394
}
400395

401396
.content pre.line-numbers {
@@ -453,20 +448,14 @@ nav.sub {
453448
}
454449

455450
.content .out-of-band {
456-
float: right;
451+
flex-grow: 0;
452+
text-align: right;
457453
font-size: 23px;
458454
margin: 0px;
459-
padding: 0px;
455+
padding: 0 0 0 12px;
460456
font-weight: normal;
461457
}
462458

463-
h1.fqn > .out-of-band {
464-
float: unset;
465-
flex: 1;
466-
text-align: right;
467-
margin-left: 8px;
468-
}
469-
470459
h3.impl > .out-of-band {
471460
font-size: 21px;
472461
}
@@ -486,6 +475,7 @@ h4 > code, h3 > code, .invisible > code {
486475
}
487476

488477
.content .in-band {
478+
flex-grow: 1;
489479
margin: 0px;
490480
padding: 0px;
491481
}
@@ -1484,10 +1474,6 @@ h4 > .notable-traits {
14841474
display: none !important;
14851475
}
14861476

1487-
h1.fqn {
1488-
overflow: initial;
1489-
}
1490-
14911477
.theme-picker {
14921478
left: 10px;
14931479
top: 54px;
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
// build-pass
2+
// compile-flags: --edition 2018
3+
// compile-flags: --crate-type rlib
4+
5+
use std::future::Future;
6+
7+
async fn handle<F>(slf: &F)
8+
where
9+
F: Fn(&()) -> Box<dyn for<'a> Future<Output = ()> + Unpin>,
10+
{
11+
(slf)(&()).await;
12+
}
13+
14+
fn main() {}

src/test/ui/lifetimes/issue-84604.rs

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
// run-pass
2+
// compile-flags: -Zsymbol-mangling-version=v0
3+
4+
pub fn f<T: ?Sized>() {}
5+
pub trait Frob<T: ?Sized> {}
6+
fn main() {
7+
f::<dyn Frob<str>>();
8+
f::<dyn for<'a> Frob<str>>();
9+
}

0 commit comments

Comments
 (0)