Skip to content

Commit

Permalink
Auto merge of #103745 - matthiaskrgr:rollup-hipjva8, r=matthiaskrgr
Browse files Browse the repository at this point in the history
Rollup of 8 pull requests

Successful merges:

 - #100006 (Make `core::mem::copy` const)
 - #102659 (1.65.0 release notes)
 - #103124 (Add tests for autoderef on block tail)
 - #103253 (rustdoc: add test case for masked blanket impl)
 - #103715 (use consistent terminology)
 - #103722 (Fix z-indexes of code example feature and cleanup its CSS)
 - #103726 (Avoid unnecessary `&str` to `String` conversions)
 - #103737 (rustdoc: use CSS margin/padding shorthand when all are being set)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
  • Loading branch information
bors committed Oct 30, 2022
2 parents 15ee24a + 9c5e61c commit 4827cee
Show file tree
Hide file tree
Showing 23 changed files with 295 additions and 52 deletions.
103 changes: 103 additions & 0 deletions RELEASES.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,106 @@
Version 1.65.0 (2022-11-03)
==========================

Language
--------
- [Error on `as` casts of enums with `#[non_exhaustive]` variants](https://github.com/rust-lang/rust/pull/92744/)
- [Stabilize `let else`](https://github.com/rust-lang/rust/pull/93628/)
- [Stabilize generic associated types (GATs)](https://github.com/rust-lang/rust/pull/96709/)
- [Add lints `let_underscore_drop`, `let_underscore_lock`, and `let_underscore_must_use` from Clippy](https://github.com/rust-lang/rust/pull/97739/)
- [Stabilize `break`ing from arbitrary labeled blocks ("label-break-value")](https://github.com/rust-lang/rust/pull/99332/)
- [Uninitialized integers, floats, and raw pointers are now considered immediate UB](https://github.com/rust-lang/rust/pull/98919/).
Usage of `MaybeUninit` is the correct way to work with uninitialized memory.
- [Stabilize raw-dylib for Windows x86_64, aarch64, and thumbv7a](https://github.com/rust-lang/rust/pull/99916/)
- [Do not allow `Drop` impl on foreign ADTs](https://github.com/rust-lang/rust/pull/99576/)

Compiler
--------
- [Stabilize -Csplit-debuginfo on Linux](https://github.com/rust-lang/rust/pull/98051/)
- [Use niche-filling optimization even when multiple variants have data](https://github.com/rust-lang/rust/pull/94075/)
- [Associated type projections are now verified to be well-formed prior to resolving the underlying type](https://github.com/rust-lang/rust/pull/99217/#issuecomment-1209365630)
- [Stringify non-shorthand visibility correctly](https://github.com/rust-lang/rust/pull/100350/)
- [Normalize struct field types when unsizing](https://github.com/rust-lang/rust/pull/101831/)
- [Update to LLVM 15](https://github.com/rust-lang/rust/pull/99464/)
- [Fix aarch64 call abi to correctly zeroext when needed](https://github.com/rust-lang/rust/pull/97800/)
- [debuginfo: Generalize C++-like encoding for enums](https://github.com/rust-lang/rust/pull/98393/)
- [Add `special_module_name` lint](https://github.com/rust-lang/rust/pull/94467/)
- [Add support for generating unique profraw files by default when using `-C instrument-coverage`](https://github.com/rust-lang/rust/pull/100384/)
- [Allow dynamic linking for iOS/tvOS targets](https://github.com/rust-lang/rust/pull/100636/)

New targets:

- [Add armv4t-none-eabi as a tier 3 target](https://github.com/rust-lang/rust/pull/100244/)
- [Add powerpc64-unknown-openbsd and riscv64-unknown-openbsd as tier 3 targets](https://github.com/rust-lang/rust/pull/101025/)
- Refer to Rust's [platform support page][platform-support-doc] for more
information on Rust's tiered platform support.

Libraries
---------

- [Don't generate `PartialEq::ne` in derive(PartialEq)](https://github.com/rust-lang/rust/pull/98655/)
- [Windows RNG: Use `BCRYPT_RNG_ALG_HANDLE` by default](https://github.com/rust-lang/rust/pull/101325/)
- [Forbid mixing `System` with direct system allocator calls](https://github.com/rust-lang/rust/pull/101394/)
- [Document no support for writing to non-blocking stdio/stderr](https://github.com/rust-lang/rust/pull/101416/)
- [`std::layout::Layout` size must not overflow `isize::MAX` when rounded up to `align`](https://github.com/rust-lang/rust/pull/95295)
This also changes the safety conditions on `Layout::from_size_align_unchecked`.

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

- [`std::backtrace::Backtrace`](https://doc.rust-lang.org/stable/std/backtrace/struct.Backtrace.html)
- [`Bound::as_ref`](https://doc.rust-lang.org/stable/std/ops/enum.Bound.html#method.as_ref)
- [`std::io::read_to_string`](https://doc.rust-lang.org/stable/std/io/fn.read_to_string.html)
- [`<*const T>::cast_mut`](https://doc.rust-lang.org/stable/std/primitive.pointer.html#method.cast_mut)
- [`<*mut T>::cast_const`](https://doc.rust-lang.org/stable/std/primitive.pointer.html#method.cast_const)

These APIs are now stable in const contexts:

- [`<*const T>::offset_from`](https://doc.rust-lang.org/stable/std/primitive.pointer.html#method.offset_from)
- [`<*mut T>::offset_from`](https://doc.rust-lang.org/stable/std/primitive.pointer.html#method.offset_from)

Cargo
-----

- [Apply GitHub fast path even for partial hashes](https://github.com/rust-lang/cargo/pull/10807/)
- [Do not add home bin path to PATH if it's already there](https://github.com/rust-lang/cargo/pull/11023/)
- [Take priority into account within the pending queue](https://github.com/rust-lang/cargo/pull/11032/).
This slightly optimizes job scheduling by Cargo, with typically small improvements on larger crate graph builds.

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

- [`std::layout::Layout` size must not overflow `isize::MAX` when rounded up to `align`](https://github.com/rust-lang/rust/pull/95295).
This also changes the safety conditions on `Layout::from_size_align_unchecked`.
- [`PollFn` now only implements `Unpin` if the closure is `Unpin`](https://github.com/rust-lang/rust/pull/102737).
This is a possible breaking change if users were relying on the blanket unpin implementation.
See discussion on the PR for details of why this change was made.
- [Drop ExactSizeIterator impl from std::char::EscapeAscii](https://github.com/rust-lang/rust/pull/99880)
This is a backwards-incompatible change to the standard library's surface
area, but is unlikely to affect real world usage.
- [Do not consider a single repeated lifetime eligible for elision in the return type](https://github.com/rust-lang/rust/pull/103450)
This behavior was unintentionally changed in 1.64.0, and this release reverts that change by making this an error again.
- [Reenable disabled early syntax gates as future-incompatibility lints](https://github.com/rust-lang/rust/pull/99935/)
- [Update the minimum external LLVM to 13](https://github.com/rust-lang/rust/pull/100460/)
- [Don't duplicate file descriptors into stdio fds](https://github.com/rust-lang/rust/pull/101426/)
- [Sunset RLS](https://github.com/rust-lang/rust/pull/100863/)
- [Deny usage of `#![cfg_attr(..., crate_type = ...)]` to set the crate type](https://github.com/rust-lang/rust/pull/99784/)
This strengthens the forward compatibility lint deprecated_cfg_attr_crate_type_name to deny.
- [`llvm-has-rust-patches` allows setting the build system to treat the LLVM as having Rust-specific patches](https://github.com/rust-lang/rust/pull/101072)
This option may need to be set for distributions that are building Rust with a patched LLVM via `llvm-config`, not the built-in LLVM.

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.

- [Add `x.sh` and `x.ps1` shell scripts](https://github.com/rust-lang/rust/pull/99992/)
- [compiletest: use target cfg instead of hard-coded tables](https://github.com/rust-lang/rust/pull/100260/)
- [Use object instead of LLVM for reading bitcode from rlibs](https://github.com/rust-lang/rust/pull/98100/)
- [Enable MIR inlining for optimized compilations](https://github.com/rust-lang/rust/pull/91743)
This provides a 3-10% improvement in compiletimes for real world crates. See [perf results](https://perf.rust-lang.org/compare.html?start=aedf78e56b2279cc869962feac5153b6ba7001ed&end=0075bb4fad68e64b6d1be06bf2db366c30bc75e1&stat=instructions:u).

Version 1.64.0 (2022-09-22)
===========================

Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_mir_build/src/thir/pattern/check_match.rs
Original file line number Diff line number Diff line change
Expand Up @@ -507,7 +507,7 @@ impl<'p, 'tcx> MatchVisitor<'_, 'p, 'tcx> {
_ => "aren't",
},
),
" else { todo!() }".to_string(),
" else { todo!() }",
Applicability::HasPlaceholders,
);
}
Expand Down
5 changes: 1 addition & 4 deletions compiler/rustc_resolve/src/late/diagnostics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -784,10 +784,7 @@ impl<'a: 'ast, 'ast> LateResolutionVisitor<'a, '_, 'ast> {
return false;
}
err.code(rustc_errors::error_code!(E0411));
err.span_label(
span,
"`Self` is only available in impls, traits, and type definitions".to_string(),
);
err.span_label(span, "`Self` is only available in impls, traits, and type definitions");
if let Some(item_kind) = self.diagnostic_metadata.current_item {
err.span_label(
item_kind.ident.span,
Expand Down
12 changes: 6 additions & 6 deletions compiler/rustc_trait_selection/src/traits/const_evaluatable.rs
Original file line number Diff line number Diff line change
Expand Up @@ -192,12 +192,12 @@ pub fn is_const_evaluatable<'tcx>(
}
let concrete = infcx.const_eval_resolve(param_env, uv, Some(span));
match concrete {
Err(ErrorHandled::TooGeneric) => {
Err(NotConstEvaluatable::Error(infcx.tcx.sess.delay_span_bug(
span,
format!("Missing value for constant, but no error reported?"),
)))
}
Err(ErrorHandled::TooGeneric) => Err(NotConstEvaluatable::Error(
infcx
.tcx
.sess
.delay_span_bug(span, "Missing value for constant, but no error reported?"),
)),
Err(ErrorHandled::Linted) => {
let reported = infcx
.tcx
Expand Down
2 changes: 1 addition & 1 deletion library/core/src/async_iter/async_iter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use crate::ops::DerefMut;
use crate::pin::Pin;
use crate::task::{Context, Poll};

/// An interface for dealing with asynchronous iterators.
/// A trait for dealing with asynchronous iterators.
///
/// This is the main async iterator trait. For more about the concept of async iterators
/// generally, please see the [module-level documentation]. In particular, you
Expand Down
2 changes: 1 addition & 1 deletion library/core/src/iter/traits/iterator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ use super::super::{

fn _assert_is_object_safe(_: &dyn Iterator<Item = ()>) {}

/// An interface for dealing with iterators.
/// A trait for dealing with iterators.
///
/// This is the main iterator trait. For more about the concept of iterators
/// generally, please see the [module-level documentation]. In particular, you
Expand Down
2 changes: 1 addition & 1 deletion library/core/src/mem/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1004,7 +1004,7 @@ pub fn drop<T>(_x: T) {}
/// ```
#[inline]
#[unstable(feature = "mem_copy_fn", issue = "98262")]
pub fn copy<T: Copy>(x: &T) -> T {
pub const fn copy<T: Copy>(x: &T) -> T {
*x
}

Expand Down
4 changes: 4 additions & 0 deletions src/librustdoc/html/highlight.rs
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,12 @@ pub(crate) fn render_source_with_highlighting(
line_numbers: Buffer,
href_context: HrefContext<'_, '_, '_>,
decoration_info: DecorationInfo,
extra: Option<&str>,
) {
write_header(out, "", Some(line_numbers), Tooltip::None);
if let Some(extra) = extra {
out.push_str(extra);
}
write_code(out, src, Some(href_context), Some(decoration_info));
write_footer(out, None);
}
Expand Down
6 changes: 1 addition & 5 deletions src/librustdoc/html/render/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2869,10 +2869,6 @@ fn render_call_locations(w: &mut Buffer, cx: &mut Context<'_>, item: &clean::Ite
write!(w, r#"<span class="prev">&pr;</span> <span class="next">&sc;</span>"#);
}

if needs_expansion {
write!(w, r#"<span class="expand">&varr;</span>"#);
}

// Look for the example file in the source map if it exists, otherwise return a dummy span
let file_span = (|| {
let source_map = tcx.sess.source_map();
Expand Down Expand Up @@ -2906,7 +2902,7 @@ fn render_call_locations(w: &mut Buffer, cx: &mut Context<'_>, item: &clean::Ite
cx,
&root_path,
highlight::DecorationInfo(decoration_info),
sources::SourceContext::Embedded { offset: line_min },
sources::SourceContext::Embedded { offset: line_min, needs_expansion },
);
write!(w, "</div></div>");

Expand Down
9 changes: 7 additions & 2 deletions src/librustdoc/html/sources.rs
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,7 @@ where

pub(crate) enum SourceContext {
Standalone,
Embedded { offset: usize },
Embedded { offset: usize, needs_expansion: bool },
}

/// Wrapper struct to render the source code of a file. This will do things like
Expand All @@ -274,14 +274,18 @@ pub(crate) fn print_src(
) {
let lines = s.lines().count();
let mut line_numbers = Buffer::empty_from(buf);
let extra;
line_numbers.write_str("<pre class=\"src-line-numbers\">");
match source_context {
SourceContext::Standalone => {
extra = None;
for line in 1..=lines {
writeln!(line_numbers, "<span id=\"{0}\">{0}</span>", line)
}
}
SourceContext::Embedded { offset } => {
SourceContext::Embedded { offset, needs_expansion } => {
extra =
if needs_expansion { Some(r#"<span class="expand">&varr;</span>"#) } else { None };
for line in 1..=lines {
writeln!(line_numbers, "<span>{0}</span>", line + offset)
}
Expand All @@ -297,5 +301,6 @@ pub(crate) fn print_src(
line_numbers,
highlight::HrefContext { context, file_span, root_path, current_href },
decoration_info,
extra,
);
}
46 changes: 15 additions & 31 deletions src/librustdoc/html/static/css/rustdoc.css
Original file line number Diff line number Diff line change
Expand Up @@ -493,9 +493,7 @@ ul.block, .block li {
.sidebar h2 {
overflow-wrap: anywhere;
padding: 0;
margin: 0;
margin-top: 0.7rem;
margin-bottom: 0.7rem;
margin: 0.7rem 0;
}

.sidebar h3 {
Expand Down Expand Up @@ -803,10 +801,8 @@ table,
}
#crate-search {
min-width: 115px;
padding: 0;
/* keep these two in sync with "@-moz-document url-prefix()" below */
padding-left: 4px;
padding-right: 23px;
padding: 0 23px 0 4px;
/* prevents the <select> from overflowing the containing div in case it's shrunk */
max-width: 100%;
/* contents can overflow because of max-width limit, then show ellipsis */
Expand Down Expand Up @@ -1719,7 +1715,6 @@ in storage.js
/* Hide the sidebar offscreen while not in use. Doing this instead of display: none means
the sidebar stays visible for screen readers, which is useful for navigation. */
left: -1000px;
margin-left: 0;
margin: 0;
padding: 0;
z-index: 11;
Expand Down Expand Up @@ -1772,9 +1767,7 @@ in storage.js
.mobile-topbar .logo-container > img {
max-width: 35px;
max-height: 35px;
margin-left: 20px;
margin-top: 5px;
margin-bottom: 5px;
margin: 5px 0 5px 20px;
}

.mobile-topbar {
Expand Down Expand Up @@ -2023,45 +2016,36 @@ in storage.js
padding-bottom: 0;
}

.scraped-example .code-wrapper .prev {
.scraped-example .code-wrapper .next,
.scraped-example .code-wrapper .prev,
.scraped-example .code-wrapper .expand {
position: absolute;
top: 0.25em;
right: 2.25em;
z-index: 100;
z-index: 1;
cursor: pointer;
}

.scraped-example .code-wrapper .prev {
right: 2.25em;
}
.scraped-example .code-wrapper .next {
position: absolute;
top: 0.25em;
right: 1.25em;
z-index: 100;
cursor: pointer;
}

.scraped-example .code-wrapper .expand {
position: absolute;
top: 0.25em;
right: 0.25em;
z-index: 100;
cursor: pointer;
}

.scraped-example:not(.expanded) .code-wrapper:before {
.scraped-example:not(.expanded) .code-wrapper:before,
.scraped-example:not(.expanded) .code-wrapper:after {
content: " ";
width: 100%;
height: 5px;
position: absolute;
z-index: 100;
z-index: 1;
}
.scraped-example:not(.expanded) .code-wrapper:before {
top: 0;
}

.scraped-example:not(.expanded) .code-wrapper:after {
content: " ";
width: 100%;
height: 5px;
position: absolute;
z-index: 100;
bottom: 0;
}

Expand Down
4 changes: 4 additions & 0 deletions src/test/rustdoc/auxiliary/masked.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,7 @@ pub trait MaskedTrait {
impl MaskedTrait for String {
fn masked_method() {}
}

pub trait MaskedBlanketTrait {}

impl<T> MaskedBlanketTrait for T {}
1 change: 1 addition & 0 deletions src/test/rustdoc/masked.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ extern crate masked;
// @!hasraw 'search-index.js' 'masked_method'

// @!hasraw 'foo/struct.String.html' 'MaskedTrait'
// @!hasraw 'foo/struct.String.html' 'MaskedBlanketTrait'
// @!hasraw 'foo/struct.String.html' 'masked_method'
pub use std::string::String;

Expand Down
11 changes: 11 additions & 0 deletions src/test/ui/coercion/coerce-block-tail-26978.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
// check-fail
fn f(_: &i32) {}

fn main() {
let x = Box::new(1i32);

f(&x);
f(&(x));
f(&{x});
//~^ ERROR mismatched types
}
16 changes: 16 additions & 0 deletions src/test/ui/coercion/coerce-block-tail-26978.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
error[E0308]: mismatched types
--> $DIR/coerce-block-tail-26978.rs:9:9
|
LL | f(&{x});
| ^ expected `i32`, found struct `Box`
|
= note: expected type `i32`
found struct `Box<i32>`
help: consider unboxing the value
|
LL | f(&{*x});
| +

error: aborting due to previous error

For more information about this error, try `rustc --explain E0308`.
Loading

0 comments on commit 4827cee

Please sign in to comment.