Auto merge of #103745 - matthiaskrgr:rollup-hipjva8, r=matthiaskrgr
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
This commit is contained in:
commit
4827ceecb9
23 changed files with 301 additions and 58 deletions
103
RELEASES.md
103
RELEASES.md
|
@ -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)
|
||||
===========================
|
||||
|
||||
|
|
|
@ -507,7 +507,7 @@ impl<'p, 'tcx> MatchVisitor<'_, 'p, 'tcx> {
|
|||
_ => "aren't",
|
||||
},
|
||||
),
|
||||
" else { todo!() }".to_string(),
|
||||
" else { todo!() }",
|
||||
Applicability::HasPlaceholders,
|
||||
);
|
||||
}
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
}
|
||||
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -2869,10 +2869,6 @@ fn render_call_locations(w: &mut Buffer, cx: &mut Context<'_>, item: &clean::Ite
|
|||
write!(w, r#"<span class="prev">≺</span> <span class="next">≻</span>"#);
|
||||
}
|
||||
|
||||
if needs_expansion {
|
||||
write!(w, r#"<span class="expand">↕</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();
|
||||
|
@ -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>");
|
||||
|
||||
|
|
|
@ -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
|
||||
|
@ -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">↕</span>"#) } else { None };
|
||||
for line in 1..=lines {
|
||||
writeln!(line_numbers, "<span>{0}</span>", line + offset)
|
||||
}
|
||||
|
@ -297,5 +301,6 @@ pub(crate) fn print_src(
|
|||
line_numbers,
|
||||
highlight::HrefContext { context, file_span, root_path, current_href },
|
||||
decoration_info,
|
||||
extra,
|
||||
);
|
||||
}
|
||||
|
|
|
@ -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 {
|
||||
|
@ -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 */
|
||||
|
@ -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;
|
||||
|
@ -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 {
|
||||
|
@ -2023,45 +2016,36 @@ in storage.js
|
|||
padding-bottom: 0;
|
||||
}
|
||||
|
||||
.scraped-example .code-wrapper .prev {
|
||||
position: absolute;
|
||||
top: 0.25em;
|
||||
right: 2.25em;
|
||||
z-index: 100;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.scraped-example .code-wrapper .next {
|
||||
position: absolute;
|
||||
top: 0.25em;
|
||||
right: 1.25em;
|
||||
z-index: 100;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.scraped-example .code-wrapper .next,
|
||||
.scraped-example .code-wrapper .prev,
|
||||
.scraped-example .code-wrapper .expand {
|
||||
position: absolute;
|
||||
top: 0.25em;
|
||||
right: 0.25em;
|
||||
z-index: 100;
|
||||
z-index: 1;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.scraped-example:not(.expanded) .code-wrapper:before {
|
||||
content: " ";
|
||||
width: 100%;
|
||||
height: 5px;
|
||||
position: absolute;
|
||||
z-index: 100;
|
||||
top: 0;
|
||||
.scraped-example .code-wrapper .prev {
|
||||
right: 2.25em;
|
||||
}
|
||||
.scraped-example .code-wrapper .next {
|
||||
right: 1.25em;
|
||||
}
|
||||
.scraped-example .code-wrapper .expand {
|
||||
right: 0.25em;
|
||||
}
|
||||
|
||||
.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 {
|
||||
bottom: 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -8,3 +8,7 @@ pub trait MaskedTrait {
|
|||
impl MaskedTrait for String {
|
||||
fn masked_method() {}
|
||||
}
|
||||
|
||||
pub trait MaskedBlanketTrait {}
|
||||
|
||||
impl<T> MaskedBlanketTrait for T {}
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
11
src/test/ui/coercion/coerce-block-tail-26978.rs
Normal file
11
src/test/ui/coercion/coerce-block-tail-26978.rs
Normal file
|
@ -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
src/test/ui/coercion/coerce-block-tail-26978.stderr
Normal file
16
src/test/ui/coercion/coerce-block-tail-26978.stderr
Normal file
|
@ -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`.
|
35
src/test/ui/coercion/coerce-block-tail-57749.rs
Normal file
35
src/test/ui/coercion/coerce-block-tail-57749.rs
Normal file
|
@ -0,0 +1,35 @@
|
|||
// check-fail
|
||||
use std::ops::Deref;
|
||||
|
||||
fn main() {
|
||||
fn save(who: &str) {
|
||||
println!("I'll save you, {}!", who);
|
||||
}
|
||||
|
||||
struct Madoka;
|
||||
|
||||
impl Deref for Madoka {
|
||||
type Target = str;
|
||||
fn deref(&self) -> &Self::Target {
|
||||
"Madoka"
|
||||
}
|
||||
}
|
||||
|
||||
save(&{ Madoka });
|
||||
|
||||
fn reset(how: &u32) {
|
||||
println!("Reset {} times", how);
|
||||
}
|
||||
|
||||
struct Homura;
|
||||
|
||||
impl Deref for Homura {
|
||||
type Target = u32;
|
||||
fn deref(&self) -> &Self::Target {
|
||||
&42
|
||||
}
|
||||
}
|
||||
|
||||
reset(&{ Homura });
|
||||
//~^ ERROR mismatched types
|
||||
}
|
14
src/test/ui/coercion/coerce-block-tail-57749.stderr
Normal file
14
src/test/ui/coercion/coerce-block-tail-57749.stderr
Normal file
|
@ -0,0 +1,14 @@
|
|||
error[E0308]: mismatched types
|
||||
--> $DIR/coerce-block-tail-57749.rs:33:14
|
||||
|
|
||||
LL | reset(&{ Homura });
|
||||
| ^^^^^^ expected `u32`, found struct `Homura`
|
||||
|
|
||||
help: consider dereferencing the type
|
||||
|
|
||||
LL | reset(&{ *Homura });
|
||||
| +
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
For more information about this error, try `rustc --explain E0308`.
|
13
src/test/ui/coercion/coerce-block-tail-83783.rs
Normal file
13
src/test/ui/coercion/coerce-block-tail-83783.rs
Normal file
|
@ -0,0 +1,13 @@
|
|||
// check-fail
|
||||
// edition:2018
|
||||
fn _consume_reference<T: ?Sized>(_: &T) {}
|
||||
|
||||
async fn _foo() {
|
||||
_consume_reference::<i32>(&Box::new(7_i32));
|
||||
_consume_reference::<i32>(&async { Box::new(7_i32) }.await);
|
||||
//~^ ERROR mismatched types
|
||||
_consume_reference::<[i32]>(&vec![7_i32]);
|
||||
_consume_reference::<[i32]>(&async { vec![7_i32] }.await);
|
||||
}
|
||||
|
||||
fn main() { }
|
12
src/test/ui/coercion/coerce-block-tail-83783.stderr
Normal file
12
src/test/ui/coercion/coerce-block-tail-83783.stderr
Normal file
|
@ -0,0 +1,12 @@
|
|||
error[E0308]: mismatched types
|
||||
--> $DIR/coerce-block-tail-83783.rs:7:32
|
||||
|
|
||||
LL | _consume_reference::<i32>(&async { Box::new(7_i32) }.await);
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `i32`, found struct `Box`
|
||||
|
|
||||
= note: expected type `i32`
|
||||
found struct `Box<i32>`
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
For more information about this error, try `rustc --explain E0308`.
|
7
src/test/ui/coercion/coerce-block-tail-83850.rs
Normal file
7
src/test/ui/coercion/coerce-block-tail-83850.rs
Normal file
|
@ -0,0 +1,7 @@
|
|||
// check-fail
|
||||
fn f(_: &[i32]) {}
|
||||
|
||||
fn main() {
|
||||
f(&Box::new([1, 2]));
|
||||
//~^ ERROR mismatched types
|
||||
}
|
19
src/test/ui/coercion/coerce-block-tail-83850.stderr
Normal file
19
src/test/ui/coercion/coerce-block-tail-83850.stderr
Normal file
|
@ -0,0 +1,19 @@
|
|||
error[E0308]: mismatched types
|
||||
--> $DIR/coerce-block-tail-83850.rs:5:7
|
||||
|
|
||||
LL | f(&Box::new([1, 2]));
|
||||
| - ^^^^^^^^^^^^^^^^^ expected slice `[i32]`, found struct `Box`
|
||||
| |
|
||||
| arguments to this function are incorrect
|
||||
|
|
||||
= note: expected reference `&[i32]`
|
||||
found reference `&Box<[{integer}; 2]>`
|
||||
note: function defined here
|
||||
--> $DIR/coerce-block-tail-83850.rs:2:4
|
||||
|
|
||||
LL | fn f(_: &[i32]) {}
|
||||
| ^ ---------
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
For more information about this error, try `rustc --explain E0308`.
|
6
src/test/ui/coercion/coerce-block-tail.rs
Normal file
6
src/test/ui/coercion/coerce-block-tail.rs
Normal file
|
@ -0,0 +1,6 @@
|
|||
// check-fail
|
||||
fn main() {
|
||||
let _: &str = & { String::from("hahah")};
|
||||
let _: &i32 = & { Box::new(1i32) };
|
||||
//~^ ERROR mismatched types
|
||||
}
|
16
src/test/ui/coercion/coerce-block-tail.stderr
Normal file
16
src/test/ui/coercion/coerce-block-tail.stderr
Normal file
|
@ -0,0 +1,16 @@
|
|||
error[E0308]: mismatched types
|
||||
--> $DIR/coerce-block-tail.rs:4:23
|
||||
|
|
||||
LL | let _: &i32 = & { Box::new(1i32) };
|
||||
| ^^^^^^^^^^^^^^ expected `i32`, found struct `Box`
|
||||
|
|
||||
= note: expected type `i32`
|
||||
found struct `Box<i32>`
|
||||
help: consider unboxing the value
|
||||
|
|
||||
LL | let _: &i32 = & { *Box::new(1i32) };
|
||||
| +
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
For more information about this error, try `rustc --explain E0308`.
|
Loading…
Add table
Reference in a new issue