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 10 pull requests #84729

Merged
merged 23 commits into from
Apr 30, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
3090b01
Use flex more consistently.
Apr 22, 2021
5bd3187
Point out that behavior might be switched on 2015 and 2018 editions t…
est31 Apr 26, 2021
12642d9
Add a paragraph with possible alternatives on older editions
est31 Apr 27, 2021
31ae3b2
Add HAS_RE_LATE_BOUND if there are bound vars
jackh726 Apr 28, 2021
5f82e22
Don't rebind in transitive_bounds_that_define_assoc_type
jackh726 Apr 28, 2021
3e016a7
Minor grammar tweaks for readability
Ben-Lichtman Apr 29, 2021
8c04695
Remove unnecessary CSS rules for search results
GuillaumeGomez Apr 29, 2021
a20831e
Remove unneeded bottom margin on search results
GuillaumeGomez Apr 29, 2021
a352336
Ignore doctests in bootstrap
est31 Apr 29, 2021
d0c0b8a
Link between std::env::{var, var_os} and std::env::{vars, vars_os}
wooster0 Apr 29, 2021
da6261e
make feature recommendations optional
lcnr Apr 29, 2021
20b569f
Drop alias `reduce` for `fold` - we have a `reduce` function
joshtriplett Apr 29, 2021
16ff6c8
Fix labels for regression issue template
camelid Apr 29, 2021
2e58633
Rollup merge of #84451 - torhovland:flex, r=jsha
jackh726 Apr 29, 2021
e720df6
Rollup merge of #84590 - est31:array_into_iter, r=nikomatsakis
jackh726 Apr 29, 2021
26a4f46
Rollup merge of #84682 - jackh726:transitive_bounds_rebind, r=nikomat…
jackh726 Apr 29, 2021
15582fc
Rollup merge of #84683 - Ben-Lichtman:grammar, r=jonas-schievink
jackh726 Apr 29, 2021
92c9591
Rollup merge of #84688 - GuillaumeGomez:remove-unnecessary-css-for-se…
jackh726 Apr 29, 2021
8460539
Rollup merge of #84690 - GuillaumeGomez:unneeded-bottom-margin-search…
jackh726 Apr 29, 2021
6e50ac8
Rollup merge of #84692 - r00ster91:var-var_os-vars, r=joshtriplett
jackh726 Apr 29, 2021
e6d8683
Rollup merge of #84705 - lcnr:const_generics-rec, r=joshtriplett
jackh726 Apr 29, 2021
32c5f39
Rollup merge of #84706 - joshtriplett:reduce-aliases, r=m-ou-se
jackh726 Apr 29, 2021
087f964
Rollup merge of #84713 - camelid:fix-regression-issue-template, r=Mar…
jackh726 Apr 29, 2021
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
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/regression.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
name: Regression
about: Report something that unexpectedly changed between Rust versions.
labels: C-bug regression-untriaged
labels: C-bug, regression-untriaged
---
<!--
Thank you for filing a regression report! 🐛 A regression is something that changed between versions of Rust but was not supposed to.
Expand Down
4 changes: 1 addition & 3 deletions compiler/rustc_infer/src/traits/util.rs
Original file line number Diff line number Diff line change
Expand Up @@ -305,9 +305,7 @@ pub fn transitive_bounds_that_define_assoc_type<'tcx>(
Some(assoc_name),
));
for (super_predicate, _) in super_predicates.predicates {
let bound_predicate = super_predicate.kind();
let subst_predicate = super_predicate
.subst_supertrait(tcx, &bound_predicate.rebind(trait_ref.skip_binder()));
let subst_predicate = super_predicate.subst_supertrait(tcx, &trait_ref);
if let Some(binder) = subst_predicate.to_opt_poly_trait_ref() {
stack.push(binder.value);
}
Expand Down
4 changes: 4 additions & 0 deletions compiler/rustc_middle/src/ty/flags.rs
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,10 @@ impl FlagComputation {
{
let mut computation = FlagComputation::new();

if !value.bound_vars().is_empty() {
computation.flags = computation.flags | TypeFlags::HAS_RE_LATE_BOUND;
}

f(&mut computation, value.skip_binder());

self.add_flags(computation.flags);
Expand Down
8 changes: 7 additions & 1 deletion compiler/rustc_resolve/src/diagnostics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -487,7 +487,13 @@ impl<'a> Resolver<'a> {
name
));
}
err.help("use `#![feature(const_generics)]` and `#![feature(const_evaluatable_checked)]` to allow generic const expressions");

if self.session.is_nightly_build() {
err.help(
"use `#![feature(const_generics)]` and `#![feature(const_evaluatable_checked)]` \
to allow generic const expressions"
);
}

err
}
Expand Down
25 changes: 14 additions & 11 deletions compiler/rustc_typeck/src/check/wfcheck.rs
Original file line number Diff line number Diff line change
Expand Up @@ -315,17 +315,20 @@ fn check_param_wf(tcx: TyCtxt<'_>, param: &hir::GenericParam<'_>) {
),
)
} else {
tcx.sess
.struct_span_err(
hir_ty.span,
&format!(
"{} is forbidden as the type of a const generic parameter",
unsupported_type
),
)
.note("the only supported types are integers, `bool` and `char`")
.help("more complex types are supported with `#![feature(const_generics)]`")
.emit()
let mut err = tcx.sess.struct_span_err(
hir_ty.span,
&format!(
"{} is forbidden as the type of a const generic parameter",
unsupported_type
),
);
err.note("the only supported types are integers, `bool` and `char`");
if tcx.sess.is_nightly_build() {
err.help(
"more complex types are supported with `#![feature(const_generics)]`",
);
}
err.emit()
}
};

Expand Down
8 changes: 4 additions & 4 deletions library/alloc/src/collections/btree/node.rs
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ impl<K, V> LeafNode<K, V> {

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

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

impl<'a, K, V, NodeType, HandleType> Handle<NodeRef<marker::Mut<'a>, K, V, NodeType>, HandleType> {
/// Temporarily takes out another, mutable handle on the same location. Beware, as
/// Temporarily takes out another mutable handle on the same location. Beware, as
/// this method is very dangerous, doubly so since it may not immediately appear
/// dangerous.
///
Expand Down
1 change: 0 additions & 1 deletion library/core/src/iter/traits/iterator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2133,7 +2133,6 @@ pub trait Iterator {
/// ```
///
/// [`reduce()`]: Iterator::reduce
#[doc(alias = "reduce")]
#[doc(alias = "inject")]
#[inline]
#[stable(feature = "rust1", since = "1.0.0")]
Expand Down
13 changes: 11 additions & 2 deletions library/std/src/env.rs
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,10 @@ pub fn vars() -> Vars {
/// variables at the time of this invocation. Modifications to environment
/// variables afterwards will not be reflected in the returned iterator.
///
/// Note that the returned iterator will not check if the environment variables
/// are valid Unicode. If you want to panic on invalid UTF-8,
/// use the [`vars`] function instead.
///
/// # Examples
///
/// ```
Expand Down Expand Up @@ -180,8 +184,9 @@ impl fmt::Debug for VarsOs {
///
/// # Errors
///
/// * Environment variable is not present
/// * Environment variable is not valid unicode
/// Errors if the environment variable is not present.
/// Errors if the environment variable is not valid Unicode. If this is not desired, consider using
/// [`var_os`].
///
/// # Panics
///
Expand Down Expand Up @@ -221,6 +226,10 @@ fn _var(key: &OsStr) -> Result<String, VarError> {
/// `'='` or the NUL character `'\0'`, or when the value contains the NUL
/// character.
///
/// Note that the method will not check if the environment variable
/// is valid Unicode. If you want to have an error on invalid UTF-8,
/// use the [`var`] function instead.
///
/// # Examples
///
/// ```
Expand Down
49 changes: 47 additions & 2 deletions library/std/src/primitive_docs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -553,8 +553,10 @@ mod prim_pointer {}
/// # Editions
///
/// Prior to Rust 1.53, arrays did not implement `IntoIterator` by value, so the method call
/// `array.into_iter()` auto-referenced into a slice iterator. That behavior is preserved in the
/// 2015 and 2018 editions of Rust for compatability, ignoring `IntoIterator` by value.
/// `array.into_iter()` auto-referenced into a slice iterator. Right now, the old behavior
/// is preserved in the 2015 and 2018 editions of Rust for compatibility, ignoring
/// `IntoIterator` by value. In the future, the behavior on the 2015 and 2018 edition
/// might be made consistent to the behavior of later editions.
///
#[cfg_attr(bootstrap, doc = "```rust,edition2018,ignore")]
#[cfg_attr(not(bootstrap), doc = "```rust,edition2018")]
Expand Down Expand Up @@ -601,6 +603,49 @@ mod prim_pointer {}
/// }
/// ```
///
/// Future language versions might start treating the `array.into_iter()`
/// syntax on editions 2015 and 2018 the same as on edition 2021. So code using
/// those older editions should still be written with this change in mind, to
/// prevent breakage in the future. The safest way to accomplish this is to
/// avoid the `into_iter` syntax on those editions. If an edition update is not
/// viable/desired, there are multiple alternatives:
/// * use `iter`, equivalent to the old behavior, creating references
/// * use [`array::IntoIter`], equivalent to the post-2021 behavior (Rust 1.51+)
/// * replace `for ... in array.into_iter() {` with `for ... in array {`,
/// equivalent to the post-2021 behavior (Rust 1.53+)
///
#[cfg_attr(bootstrap, doc = "```rust,edition2018,ignore")]
#[cfg_attr(not(bootstrap), doc = "```rust,edition2018")]
/// use std::array::IntoIter;
///
/// let array: [i32; 3] = [0; 3];
///
/// // This iterates by reference:
/// for item in array.iter() {
/// let x: &i32 = item;
/// println!("{}", x);
/// }
///
/// // This iterates by value:
/// for item in IntoIter::new(array) {
/// let x: i32 = item;
/// println!("{}", x);
/// }
///
/// // This iterates by value:
/// for item in array {
/// let x: i32 = item;
/// println!("{}", x);
/// }
///
/// // IntoIter can also start a chain.
/// // This iterates by value:
/// for item in IntoIter::new(array).enumerate() {
/// let (i, x): (usize, i32) = item;
/// println!("array[{}] = {}", i, x);
/// }
/// ```
///
/// [slice]: prim@slice
/// [`Debug`]: fmt::Debug
/// [`Hash`]: hash::Hash
Expand Down
30 changes: 8 additions & 22 deletions src/librustdoc/html/static/rustdoc.css
Original file line number Diff line number Diff line change
Expand Up @@ -117,9 +117,12 @@ h4:not(.method):not(.type):not(.tymethod):not(.associatedconstant) {
}
h1.fqn {
display: flex;
width: 100%;
border-bottom: 1px dashed;
margin-top: 0;

/* workaround to keep flex from breaking below 700 px width due to the float: right on the nav
above the h1 */
padding-left: 1px;
}
h1.fqn > .in-band > a:hover {
text-decoration: underline;
Expand Down Expand Up @@ -385,17 +388,9 @@ nav.sub {
position: relative;
}

#results {
position: absolute;
right: 0;
left: 0;
overflow: auto;
}

#results > table {
width: 100%;
table-layout: fixed;
margin-bottom: 40px;
}

.content pre.line-numbers {
Expand Down Expand Up @@ -453,20 +448,14 @@ nav.sub {
}

.content .out-of-band {
float: right;
flex-grow: 0;
text-align: right;
font-size: 23px;
margin: 0px;
padding: 0px;
padding: 0 0 0 12px;
font-weight: normal;
}

h1.fqn > .out-of-band {
float: unset;
flex: 1;
text-align: right;
margin-left: 8px;
}

h3.impl > .out-of-band {
font-size: 21px;
}
Expand All @@ -486,6 +475,7 @@ h4 > code, h3 > code, .invisible > code {
}

.content .in-band {
flex-grow: 1;
margin: 0px;
padding: 0px;
}
Expand Down Expand Up @@ -1484,10 +1474,6 @@ h4 > .notable-traits {
display: none !important;
}

h1.fqn {
overflow: initial;
}

.theme-picker {
left: 10px;
top: 54px;
Expand Down
14 changes: 14 additions & 0 deletions src/test/ui/lifetimes/issue-83737-erasing-bound-vars.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
// build-pass
// compile-flags: --edition 2018
// compile-flags: --crate-type rlib

use std::future::Future;

async fn handle<F>(slf: &F)
where
F: Fn(&()) -> Box<dyn for<'a> Future<Output = ()> + Unpin>,
{
(slf)(&()).await;
}

fn main() {}
9 changes: 9 additions & 0 deletions src/test/ui/lifetimes/issue-84604.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
// run-pass
// compile-flags: -Zsymbol-mangling-version=v0

pub fn f<T: ?Sized>() {}
pub trait Frob<T: ?Sized> {}
fn main() {
f::<dyn Frob<str>>();
f::<dyn for<'a> Frob<str>>();
}