Auto merge of #88750 - jackh726:rollup-w57i9fp, r=jackh726
Rollup of 9 pull requests Successful merges: - #86263 (Rustdoc: Report Layout of enum variants) - #88541 (Add regression test for #74400) - #88553 (Improve diagnostics for unary plus operators (#88276)) - #88594 (More symbolic doc aliases) - #88648 (Correct “copies” to “moves” in `<Option<T> as From<T>>::from` doc, and other copyediting) - #88691 (Add a regression test for #88649) - #88694 (Drop 1.56 stabilizations from 1.55 release notes) - #88712 (Fix docs for `uX::checked_next_multiple_of`) - #88726 (Fix typo in `const_generics` replaced with `adt_const_params` note) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
This commit is contained in:
commit
47ae8deb8a
22 changed files with 260 additions and 45 deletions
16
RELEASES.md
16
RELEASES.md
|
|
@ -10,8 +10,7 @@ Language
|
|||
|
||||
Compiler
|
||||
--------
|
||||
- [Added tier 3\* support for `powerpc-unknown-freebsd`.][87370]
|
||||
- [Added tier 3 support for `powerpc64le-unknown-freebsd`.][83572]
|
||||
- [Added tier 3\* support for `powerpc64le-unknown-freebsd`.][83572]
|
||||
|
||||
\* Refer to Rust's [platform support page][platform-support-doc] for more
|
||||
information on Rust's tiered platform support.
|
||||
|
|
@ -24,17 +23,6 @@ Libraries
|
|||
no longer reject certain valid floating point values, and reduce
|
||||
the produced code size for non-stripped artifacts.
|
||||
- [`string::Drain` now implements `AsRef<str>` and `AsRef<[u8]>`.][86858]
|
||||
- [`collections::{BinaryHeap, BTreeSet, HashSet, LinkedList, VecDeque}` now
|
||||
implement `From<[T; N]>`.][84111]
|
||||
- [`collections::{BTreeMap, HashMap}` now implement `From<[(K, V); N]>`.][84111]
|
||||
This allows you to write the following;
|
||||
```rust
|
||||
let highscores = std::collections::HashMap::from([
|
||||
("Alice", 9000u32),
|
||||
("Bob", 7250),
|
||||
("Charlie", 5500),
|
||||
]);
|
||||
```
|
||||
|
||||
Stabilised APIs
|
||||
---------------
|
||||
|
|
@ -60,7 +48,6 @@ Stabilised APIs
|
|||
The following previously stable functions are now `const`.
|
||||
|
||||
- [`str::from_utf8_unchecked`]
|
||||
- [`mem::transmute`]
|
||||
|
||||
|
||||
Cargo
|
||||
|
|
@ -131,7 +118,6 @@ Compatibility Notes
|
|||
[`MaybeUninit::assume_init_ref`]: https://doc.rust-lang.org/stable/std/mem/union.MaybeUninit.html#method.assume_init_ref
|
||||
[`MaybeUninit::write`]: https://doc.rust-lang.org/stable/std/mem/union.MaybeUninit.html#method.write
|
||||
[`Seek::rewind`]: https://doc.rust-lang.org/stable/std/io/trait.Seek.html#method.rewind
|
||||
[`mem::transmute`]: https://doc.rust-lang.org/stable/std/mem/fn.transmute.html
|
||||
[`ops::ControlFlow`]: https://doc.rust-lang.org/stable/std/ops/enum.ControlFlow.html
|
||||
[`str::from_utf8_unchecked`]: https://doc.rust-lang.org/stable/std/str/fn.from_utf8_unchecked.html
|
||||
[`x86::_bittest`]: https://doc.rust-lang.org/stable/core/arch/x86/fn._bittest.html
|
||||
|
|
|
|||
|
|
@ -586,6 +586,13 @@ impl Token {
|
|||
self.is_non_raw_ident_where(|id| id.name.is_bool_lit())
|
||||
}
|
||||
|
||||
pub fn is_numeric_lit(&self) -> bool {
|
||||
matches!(
|
||||
self.kind,
|
||||
Literal(Lit { kind: LitKind::Integer, .. }) | Literal(Lit { kind: LitKind::Float, .. })
|
||||
)
|
||||
}
|
||||
|
||||
/// Returns `true` if the token is a non-raw identifier for which `pred` holds.
|
||||
pub fn is_non_raw_ident_where(&self, pred: impl FnOnce(Ident) -> bool) -> bool {
|
||||
match self.ident() {
|
||||
|
|
|
|||
|
|
@ -104,7 +104,7 @@ declare_features! (
|
|||
(removed, quote, "1.33.0", Some(29601), None, None),
|
||||
/// Allows const generic types (e.g. `struct Foo<const N: usize>(...);`).
|
||||
(removed, const_generics, "1.34.0", Some(44580), None,
|
||||
Some("removed in favor of `#![feature(adt_const_params]` and `#![feature(generic_const_exprs)]`")),
|
||||
Some("removed in favor of `#![feature(adt_const_params)]` and `#![feature(generic_const_exprs)]`")),
|
||||
/// Allows `[x; N]` where `x` is a constant (RFC 2203).
|
||||
(removed, const_in_array_repeat_expressions, "1.37.0", Some(49147), None,
|
||||
Some("removed due to causing promotable bugs")),
|
||||
|
|
|
|||
|
|
@ -516,6 +516,26 @@ impl<'a> Parser<'a> {
|
|||
token::BinOp(token::And) | token::AndAnd => {
|
||||
make_it!(this, attrs, |this, _| this.parse_borrow_expr(lo))
|
||||
}
|
||||
token::BinOp(token::Plus) if this.look_ahead(1, |tok| tok.is_numeric_lit()) => {
|
||||
let mut err = this.struct_span_err(lo, "leading `+` is not supported");
|
||||
err.span_label(lo, "unexpected `+`");
|
||||
|
||||
// a block on the LHS might have been intended to be an expression instead
|
||||
if let Some(sp) = this.sess.ambiguous_block_expr_parse.borrow().get(&lo) {
|
||||
this.sess.expr_parentheses_needed(&mut err, *sp);
|
||||
} else {
|
||||
err.span_suggestion_verbose(
|
||||
lo,
|
||||
"try removing the `+`",
|
||||
"".to_string(),
|
||||
Applicability::MachineApplicable,
|
||||
);
|
||||
}
|
||||
err.emit();
|
||||
|
||||
this.bump();
|
||||
this.parse_prefix_expr(None)
|
||||
} // `+expr`
|
||||
token::Ident(..) if this.token.is_keyword(kw::Box) => {
|
||||
make_it!(this, attrs, |this, _| this.parse_box_expr(lo))
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1924,7 +1924,8 @@ macro_rules! uint_impl {
|
|||
}
|
||||
|
||||
/// Calculates the smallest value greater than or equal to `self` that
|
||||
/// is a multiple of `rhs`. If `rhs` is negative,
|
||||
/// is a multiple of `rhs`. Returns `None` is `rhs` is zero or the
|
||||
/// operation would result in overflow.
|
||||
///
|
||||
/// # Examples
|
||||
///
|
||||
|
|
|
|||
|
|
@ -30,6 +30,7 @@
|
|||
/// ```
|
||||
#[lang = "not"]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
#[doc(alias = "!")]
|
||||
pub trait Not {
|
||||
/// The resulting type after applying the `!` operator.
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
|
|
|
|||
|
|
@ -1173,7 +1173,7 @@ impl<T> Option<T> {
|
|||
// Entry-like operations to insert a value and return a reference
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
|
||||
/// Inserts `value` into the option then returns a mutable reference to it.
|
||||
/// Inserts `value` into the option, then returns a mutable reference to it.
|
||||
///
|
||||
/// If the option already contains a value, the old value is dropped.
|
||||
///
|
||||
|
|
@ -1397,7 +1397,7 @@ impl<T> Option<T> {
|
|||
}
|
||||
|
||||
impl<T, U> Option<(T, U)> {
|
||||
/// Unzips an option containing a tuple of two options
|
||||
/// Unzips an option containing a tuple of two options.
|
||||
///
|
||||
/// If `self` is `Some((a, b))` this method returns `(Some(a), Some(b))`.
|
||||
/// Otherwise, `(None, None)` is returned.
|
||||
|
|
@ -1500,7 +1500,7 @@ impl<T: Clone> Option<&mut T> {
|
|||
}
|
||||
|
||||
impl<T: Default> Option<T> {
|
||||
/// Returns the contained [`Some`] value or a default
|
||||
/// Returns the contained [`Some`] value or a default.
|
||||
///
|
||||
/// Consumes the `self` argument then, if [`Some`], returns the contained
|
||||
/// value, otherwise if [`None`], returns the [default value] for that
|
||||
|
|
@ -1561,7 +1561,7 @@ impl<T: DerefMut> Option<T> {
|
|||
/// Converts from `Option<T>` (or `&mut Option<T>`) to `Option<&mut T::Target>`.
|
||||
///
|
||||
/// Leaves the original `Option` in-place, creating a new one containing a mutable reference to
|
||||
/// the inner type's `Deref::Target` type.
|
||||
/// the inner type's [`Deref::Target`] type.
|
||||
///
|
||||
/// # Examples
|
||||
///
|
||||
|
|
@ -1701,7 +1701,7 @@ impl<'a, T> IntoIterator for &'a mut Option<T> {
|
|||
|
||||
#[stable(since = "1.12.0", feature = "option_from")]
|
||||
impl<T> From<T> for Option<T> {
|
||||
/// Copies `val` into a new `Some`.
|
||||
/// Moves `val` into a new [`Some`].
|
||||
///
|
||||
/// # Examples
|
||||
///
|
||||
|
|
@ -1942,8 +1942,8 @@ unsafe impl<A> TrustedLen for IntoIter<A> {}
|
|||
impl<A, V: FromIterator<A>> FromIterator<Option<A>> for Option<V> {
|
||||
/// Takes each element in the [`Iterator`]: if it is [`None`][Option::None],
|
||||
/// no further elements are taken, and the [`None`][Option::None] is
|
||||
/// returned. Should no [`None`][Option::None] occur, a container with the
|
||||
/// values of each [`Option`] is returned.
|
||||
/// returned. Should no [`None`][Option::None] occur, a container of type
|
||||
/// `V` containing the values of each [`Option`] is returned.
|
||||
///
|
||||
/// # Examples
|
||||
///
|
||||
|
|
@ -2039,7 +2039,7 @@ impl<T> ops::FromResidual for Option<T> {
|
|||
}
|
||||
|
||||
impl<T> Option<Option<T>> {
|
||||
/// Converts from `Option<Option<T>>` to `Option<T>`
|
||||
/// Converts from `Option<Option<T>>` to `Option<T>`.
|
||||
///
|
||||
/// # Examples
|
||||
///
|
||||
|
|
|
|||
|
|
@ -119,7 +119,7 @@ mod break_keyword {}
|
|||
|
||||
#[doc(keyword = "const")]
|
||||
//
|
||||
/// Compile-time constants and compile-time evaluable functions.
|
||||
/// Compile-time constants, compile-time evaluable functions, and raw pointers.
|
||||
///
|
||||
/// ## Compile-time constants
|
||||
///
|
||||
|
|
|
|||
|
|
@ -388,8 +388,11 @@ mod prim_char {}
|
|||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
mod prim_unit {}
|
||||
|
||||
#[doc(alias = "ptr")]
|
||||
#[doc(primitive = "pointer")]
|
||||
#[doc(alias = "ptr")]
|
||||
#[doc(alias = "*")]
|
||||
#[doc(alias = "*const")]
|
||||
#[doc(alias = "*mut")]
|
||||
//
|
||||
/// Raw, unsafe pointers, `*const T`, and `*mut T`.
|
||||
///
|
||||
|
|
@ -502,10 +505,10 @@ mod prim_unit {}
|
|||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
mod prim_pointer {}
|
||||
|
||||
#[doc(primitive = "array")]
|
||||
#[doc(alias = "[]")]
|
||||
#[doc(alias = "[T;N]")] // unfortunately, rustdoc doesn't have fuzzy search for aliases
|
||||
#[doc(alias = "[T; N]")]
|
||||
#[doc(primitive = "array")]
|
||||
/// A fixed-size array, denoted `[T; N]`, for the element type, `T`, and the
|
||||
/// non-negative compile-time constant size, `N`.
|
||||
///
|
||||
|
|
|
|||
|
|
@ -8,10 +8,12 @@ use rustc_hir as hir;
|
|||
use rustc_hir::def::CtorKind;
|
||||
use rustc_hir::def_id::DefId;
|
||||
use rustc_middle::middle::stability;
|
||||
use rustc_middle::span_bug;
|
||||
use rustc_middle::ty::layout::LayoutError;
|
||||
use rustc_middle::ty::TyCtxt;
|
||||
use rustc_middle::ty::{Adt, TyCtxt};
|
||||
use rustc_span::hygiene::MacroKind;
|
||||
use rustc_span::symbol::{kw, sym, Symbol};
|
||||
use rustc_target::abi::{Layout, Primitive, TagEncoding, Variants};
|
||||
|
||||
use super::{
|
||||
collect_paths_for_type, document, ensure_trailing_slash, item_ty_to_strs, notable_traits_decl,
|
||||
|
|
@ -1621,6 +1623,15 @@ fn document_non_exhaustive(w: &mut Buffer, item: &clean::Item) {
|
|||
}
|
||||
|
||||
fn document_type_layout(w: &mut Buffer, cx: &Context<'_>, ty_def_id: DefId) {
|
||||
fn write_size_of_layout(w: &mut Buffer, layout: &Layout, tag_size: u64) {
|
||||
if layout.abi.is_unsized() {
|
||||
write!(w, "(unsized)");
|
||||
} else {
|
||||
let bytes = layout.size.bytes() - tag_size;
|
||||
write!(w, "{size} byte{pl}", size = bytes, pl = if bytes == 1 { "" } else { "s" },);
|
||||
}
|
||||
}
|
||||
|
||||
if !cx.shared.show_type_layout {
|
||||
return;
|
||||
}
|
||||
|
|
@ -1642,16 +1653,40 @@ fn document_type_layout(w: &mut Buffer, cx: &Context<'_>, ty_def_id: DefId) {
|
|||
<a href=\"https://doc.rust-lang.org/reference/type-layout.html\">“Type Layout”</a> \
|
||||
chapter for details on type layout guarantees.</p></div>"
|
||||
);
|
||||
if ty_layout.layout.abi.is_unsized() {
|
||||
writeln!(w, "<p><strong>Size:</strong> (unsized)</p>");
|
||||
} else {
|
||||
let bytes = ty_layout.layout.size.bytes();
|
||||
writeln!(
|
||||
w,
|
||||
"<p><strong>Size:</strong> {size} byte{pl}</p>",
|
||||
size = bytes,
|
||||
pl = if bytes == 1 { "" } else { "s" },
|
||||
);
|
||||
w.write_str("<p><strong>Size:</strong> ");
|
||||
write_size_of_layout(w, ty_layout.layout, 0);
|
||||
writeln!(w, "</p>");
|
||||
if let Variants::Multiple { variants, tag, tag_encoding, .. } =
|
||||
&ty_layout.layout.variants
|
||||
{
|
||||
if !variants.is_empty() {
|
||||
w.write_str(
|
||||
"<p><strong>Size for each variant:</strong></p>\
|
||||
<ul>",
|
||||
);
|
||||
|
||||
let adt = if let Adt(adt, _) = ty_layout.ty.kind() {
|
||||
adt
|
||||
} else {
|
||||
span_bug!(tcx.def_span(ty_def_id), "not an adt")
|
||||
};
|
||||
|
||||
let tag_size = if let TagEncoding::Niche { .. } = tag_encoding {
|
||||
0
|
||||
} else if let Primitive::Int(i, _) = tag.value {
|
||||
i.size().bytes()
|
||||
} else {
|
||||
span_bug!(tcx.def_span(ty_def_id), "tag is neither niche nor int")
|
||||
};
|
||||
|
||||
for (index, layout) in variants.iter_enumerated() {
|
||||
let ident = adt.variants[index].ident;
|
||||
write!(w, "<li><code>{name}</code>: ", name = ident);
|
||||
write_size_of_layout(w, layout, tag_size);
|
||||
writeln!(w, "</li>");
|
||||
}
|
||||
w.write_str("</ul>");
|
||||
}
|
||||
}
|
||||
}
|
||||
// This kind of layout error can occur with valid code, e.g. if you try to
|
||||
|
|
|
|||
|
|
@ -52,3 +52,21 @@ pub struct Unsized([u8]);
|
|||
|
||||
// @!has type_layout/trait.MyTrait.html 'Size: '
|
||||
pub trait MyTrait {}
|
||||
|
||||
// @has type_layout/enum.Variants.html 'Size: '
|
||||
// @has - '2 bytes'
|
||||
// @has - '<code>A</code>: 0 bytes'
|
||||
// @has - '<code>B</code>: 1 byte'
|
||||
pub enum Variants {
|
||||
A,
|
||||
B(u8),
|
||||
}
|
||||
|
||||
// @has type_layout/enum.WithNiche.html 'Size: '
|
||||
// @has - //p '4 bytes'
|
||||
// @has - '<code>None</code>: 0 bytes'
|
||||
// @has - '<code>Some</code>: 4 bytes'
|
||||
pub enum WithNiche {
|
||||
None,
|
||||
Some(std::num::NonZeroU32),
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,8 +1,14 @@
|
|||
error: expected expression, found `+`
|
||||
error: leading `+` is not supported
|
||||
--> $DIR/issue-36499.rs:4:9
|
||||
|
|
||||
LL | 2 + +2;
|
||||
| ^ expected expression
|
||||
| ^ unexpected `+`
|
||||
|
|
||||
help: try removing the `+`
|
||||
|
|
||||
LL - 2 + +2;
|
||||
LL + 2 + 2;
|
||||
|
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
|
|
|
|||
18
src/test/ui/consts/issue-88649.rs
Normal file
18
src/test/ui/consts/issue-88649.rs
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
// check-pass
|
||||
#![crate_type = "lib"]
|
||||
|
||||
enum Foo {
|
||||
Variant1(bool),
|
||||
Variant2(bool),
|
||||
}
|
||||
|
||||
const _: () = {
|
||||
let mut n = 0;
|
||||
while n < 2 {
|
||||
match Foo::Variant1(true) {
|
||||
Foo::Variant1(x) | Foo::Variant2(x) if x => {}
|
||||
_ => {}
|
||||
}
|
||||
n += 1;
|
||||
}
|
||||
};
|
||||
30
src/test/ui/lifetimes/lifetime-errors/issue_74400.nll.stderr
Normal file
30
src/test/ui/lifetimes/lifetime-errors/issue_74400.nll.stderr
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
error[E0310]: the parameter type `T` may not live long enough
|
||||
--> $DIR/issue_74400.rs:12:5
|
||||
|
|
||||
LL | f(data, identity)
|
||||
| ^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= help: consider adding an explicit lifetime bound `T: 'static`...
|
||||
|
||||
error[E0308]: mismatched types
|
||||
--> $DIR/issue_74400.rs:12:5
|
||||
|
|
||||
LL | f(data, identity)
|
||||
| ^^^^^^^^^^^^^^^^^ one type is more general than the other
|
||||
|
|
||||
= note: expected type `for<'r> Fn<(&'r T,)>`
|
||||
found type `Fn<(&T,)>`
|
||||
|
||||
error: implementation of `FnOnce` is not general enough
|
||||
--> $DIR/issue_74400.rs:12:5
|
||||
|
|
||||
LL | f(data, identity)
|
||||
| ^^^^^^^^^^^^^^^^^ implementation of `FnOnce` is not general enough
|
||||
|
|
||||
= note: `fn(&'2 T) -> &'2 T {identity::<&'2 T>}` must implement `FnOnce<(&'1 T,)>`, for any lifetime `'1`...
|
||||
= note: ...but it actually implements `FnOnce<(&'2 T,)>`, for some specific lifetime `'2`
|
||||
|
||||
error: aborting due to 3 previous errors
|
||||
|
||||
Some errors have detailed explanations: E0308, E0310.
|
||||
For more information about an error, try `rustc --explain E0308`.
|
||||
13
src/test/ui/lifetimes/lifetime-errors/issue_74400.rs
Normal file
13
src/test/ui/lifetimes/lifetime-errors/issue_74400.rs
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
//! Regression test for #74400: Type mismatch in function arguments E0631, E0271 are falsely
|
||||
//! recognized as E0308 mismatched types.
|
||||
|
||||
use std::convert::identity;
|
||||
|
||||
fn main() {}
|
||||
|
||||
fn f<T, S>(data: &[T], key: impl Fn(&T) -> S) {
|
||||
}
|
||||
|
||||
fn g<T>(data: &[T]) {
|
||||
f(data, identity) //~ ERROR implementation of `FnOnce` is not general
|
||||
}
|
||||
11
src/test/ui/lifetimes/lifetime-errors/issue_74400.stderr
Normal file
11
src/test/ui/lifetimes/lifetime-errors/issue_74400.stderr
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
error: implementation of `FnOnce` is not general enough
|
||||
--> $DIR/issue_74400.rs:12:5
|
||||
|
|
||||
LL | f(data, identity)
|
||||
| ^ implementation of `FnOnce` is not general enough
|
||||
|
|
||||
= note: `fn(&'2 T) -> &'2 T {identity::<&'2 T>}` must implement `FnOnce<(&'1 T,)>`, for any lifetime `'1`...
|
||||
= note: ...but it actually implements `FnOnce<(&'2 T,)>`, for some specific lifetime `'2`
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
|
|
@ -10,7 +10,7 @@ fn foo() -> i32 {
|
|||
}
|
||||
|
||||
fn bar() -> i32 {
|
||||
({2}) + 2 //~ ERROR expected expression, found `+`
|
||||
({2}) + 2 //~ ERROR leading `+` is not supported
|
||||
//~^ ERROR mismatched types
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ fn foo() -> i32 {
|
|||
}
|
||||
|
||||
fn bar() -> i32 {
|
||||
{2} + 2 //~ ERROR expected expression, found `+`
|
||||
{2} + 2 //~ ERROR leading `+` is not supported
|
||||
//~^ ERROR mismatched types
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -9,11 +9,11 @@ help: parentheses are required to parse this as an expression
|
|||
LL | ({2}) + {2}
|
||||
| + +
|
||||
|
||||
error: expected expression, found `+`
|
||||
error: leading `+` is not supported
|
||||
--> $DIR/expr-as-stmt.rs:13:9
|
||||
|
|
||||
LL | {2} + 2
|
||||
| ^ expected expression
|
||||
| ^ unexpected `+`
|
||||
|
|
||||
help: parentheses are required to parse this as an expression
|
||||
|
|
||||
|
|
|
|||
8
src/test/ui/parser/issue-88276-unary-plus.fixed
Normal file
8
src/test/ui/parser/issue-88276-unary-plus.fixed
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
// run-rustfix
|
||||
#[allow(unused_parens)]
|
||||
fn main() {
|
||||
let _ = 1; //~ ERROR leading `+` is not supported
|
||||
let _ = (1.0 + 2.0) * 3.0; //~ ERROR leading `+` is not supported
|
||||
//~| ERROR leading `+` is not supported
|
||||
let _ = [3, 4+6]; //~ ERROR leading `+` is not supported
|
||||
}
|
||||
8
src/test/ui/parser/issue-88276-unary-plus.rs
Normal file
8
src/test/ui/parser/issue-88276-unary-plus.rs
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
// run-rustfix
|
||||
#[allow(unused_parens)]
|
||||
fn main() {
|
||||
let _ = +1; //~ ERROR leading `+` is not supported
|
||||
let _ = (1.0 + +2.0) * +3.0; //~ ERROR leading `+` is not supported
|
||||
//~| ERROR leading `+` is not supported
|
||||
let _ = [+3, 4+6]; //~ ERROR leading `+` is not supported
|
||||
}
|
||||
50
src/test/ui/parser/issue-88276-unary-plus.stderr
Normal file
50
src/test/ui/parser/issue-88276-unary-plus.stderr
Normal file
|
|
@ -0,0 +1,50 @@
|
|||
error: leading `+` is not supported
|
||||
--> $DIR/issue-88276-unary-plus.rs:4:13
|
||||
|
|
||||
LL | let _ = +1;
|
||||
| ^ unexpected `+`
|
||||
|
|
||||
help: try removing the `+`
|
||||
|
|
||||
LL - let _ = +1;
|
||||
LL + let _ = 1;
|
||||
|
|
||||
|
||||
error: leading `+` is not supported
|
||||
--> $DIR/issue-88276-unary-plus.rs:5:20
|
||||
|
|
||||
LL | let _ = (1.0 + +2.0) * +3.0;
|
||||
| ^ unexpected `+`
|
||||
|
|
||||
help: try removing the `+`
|
||||
|
|
||||
LL - let _ = (1.0 + +2.0) * +3.0;
|
||||
LL + let _ = (1.0 + 2.0) * +3.0;
|
||||
|
|
||||
|
||||
error: leading `+` is not supported
|
||||
--> $DIR/issue-88276-unary-plus.rs:5:28
|
||||
|
|
||||
LL | let _ = (1.0 + +2.0) * +3.0;
|
||||
| ^ unexpected `+`
|
||||
|
|
||||
help: try removing the `+`
|
||||
|
|
||||
LL - let _ = (1.0 + +2.0) * +3.0;
|
||||
LL + let _ = (1.0 + +2.0) * 3.0;
|
||||
|
|
||||
|
||||
error: leading `+` is not supported
|
||||
--> $DIR/issue-88276-unary-plus.rs:7:14
|
||||
|
|
||||
LL | let _ = [+3, 4+6];
|
||||
| ^ unexpected `+`
|
||||
|
|
||||
help: try removing the `+`
|
||||
|
|
||||
LL - let _ = [+3, 4+6];
|
||||
LL + let _ = [3, 4+6];
|
||||
|
|
||||
|
||||
error: aborting due to 4 previous errors
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue