Skip to content

Commit 32ec40c

Browse files
committedJan 19, 2024
Auto merge of #120121 - matthiaskrgr:rollup-razammh, r=matthiaskrgr
Rollup of 10 pull requests Successful merges: - #118665 (Consolidate all associated items on the NonZero integer types into a single impl block per type) - #118798 (Use AtomicU8 instead of AtomicUsize in backtrace.rs) - #119062 (Deny braced macro invocations in let-else) - #119138 (Docs: Use non-SeqCst in module example of atomics) - #119907 (Update `fn()` trait implementation docs) - #120083 (Warn when not having a profiler runtime means that coverage tests won't be run/blessed) - #120107 (dead_code treats #[repr(transparent)] the same as #[repr(C)]) - #120110 (Update documentation for Vec::into_boxed_slice to be more clear about excess capacity) - #120113 (Remove myself from review rotation) - #120118 (Fix typo in documentation in base.rs) r? `@ghost` `@rustbot` modify labels: rollup
·
1.88.01.77.0
2 parents 92d7277 + b4616f5 commit 32ec40c

File tree

23 files changed

+1376
-1326
lines changed

23 files changed

+1376
-1326
lines changed
 

‎compiler/rustc_ast/src/util/classify.rs

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
33
// Predicates on exprs and stmts that the pretty-printer and parser use
44

5-
use crate::ast;
5+
use crate::{ast, token::Delimiter};
66

77
/// Does this expression require a semicolon to be treated
88
/// as a statement? The negation of this: 'can this expression
@@ -59,8 +59,12 @@ pub fn expr_trailing_brace(mut expr: &ast::Expr) -> Option<&ast::Expr> {
5959
| While(..)
6060
| ConstBlock(_) => break Some(expr),
6161

62-
// FIXME: These can end in `}`, but changing these would break stable code.
63-
InlineAsm(_) | OffsetOf(_, _) | MacCall(_) | IncludedBytes(_) | FormatArgs(_) => {
62+
MacCall(mac) => {
63+
break (mac.args.delim == Delimiter::Brace).then_some(expr);
64+
}
65+
66+
InlineAsm(_) | OffsetOf(_, _) | IncludedBytes(_) | FormatArgs(_) => {
67+
// These should have been denied pre-expansion.
6468
break None;
6569
}
6670

‎compiler/rustc_expand/src/base.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -666,8 +666,8 @@ pub enum SyntaxExtensionKind {
666666
/// A token-based attribute macro.
667667
Attr(
668668
/// An expander with signature (TokenStream, TokenStream) -> TokenStream.
669-
/// The first TokenSteam is the attribute itself, the second is the annotated item.
670-
/// The produced TokenSteam replaces the input TokenSteam.
669+
/// The first TokenStream is the attribute itself, the second is the annotated item.
670+
/// The produced TokenStream replaces the input TokenStream.
671671
Box<dyn AttrProcMacro + sync::DynSync + sync::DynSend>,
672672
),
673673

@@ -687,7 +687,7 @@ pub enum SyntaxExtensionKind {
687687
/// A token-based derive macro.
688688
Derive(
689689
/// An expander with signature TokenStream -> TokenStream.
690-
/// The produced TokenSteam is appended to the input TokenSteam.
690+
/// The produced TokenStream is appended to the input TokenStream.
691691
///
692692
/// FIXME: The text above describes how this should work. Currently it
693693
/// is handled identically to `LegacyDerive`. It should be migrated to

‎compiler/rustc_parse/messages.ftl

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -724,6 +724,8 @@ parse_sugg_turbofish_syntax = use `::<...>` instead of `<...>` to specify lifeti
724724
725725
parse_sugg_wrap_expression_in_parentheses = wrap the expression in parentheses
726726
727+
parse_sugg_wrap_macro_in_parentheses = use parentheses instead of braces for this macro
728+
727729
parse_sugg_wrap_pattern_in_parens = wrap the pattern in parentheses
728730
729731
parse_switch_mut_let_order =

‎compiler/rustc_parse/src/errors.rs

Lines changed: 25 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -722,19 +722,32 @@ pub(crate) struct LabeledLoopInBreak {
722722
#[primary_span]
723723
pub span: Span,
724724
#[subdiagnostic]
725-
pub sub: WrapExpressionInParentheses,
725+
pub sub: WrapInParentheses,
726726
}
727727

728728
#[derive(Subdiagnostic)]
729-
#[multipart_suggestion(
730-
parse_sugg_wrap_expression_in_parentheses,
731-
applicability = "machine-applicable"
732-
)]
733-
pub(crate) struct WrapExpressionInParentheses {
734-
#[suggestion_part(code = "(")]
735-
pub left: Span,
736-
#[suggestion_part(code = ")")]
737-
pub right: Span,
729+
730+
pub(crate) enum WrapInParentheses {
731+
#[multipart_suggestion(
732+
parse_sugg_wrap_expression_in_parentheses,
733+
applicability = "machine-applicable"
734+
)]
735+
Expression {
736+
#[suggestion_part(code = "(")]
737+
left: Span,
738+
#[suggestion_part(code = ")")]
739+
right: Span,
740+
},
741+
#[multipart_suggestion(
742+
parse_sugg_wrap_macro_in_parentheses,
743+
applicability = "machine-applicable"
744+
)]
745+
MacroArgs {
746+
#[suggestion_part(code = "(")]
747+
left: Span,
748+
#[suggestion_part(code = ")")]
749+
right: Span,
750+
},
738751
}
739752

740753
#[derive(Diagnostic)]
@@ -936,7 +949,7 @@ pub(crate) struct InvalidExpressionInLetElse {
936949
pub span: Span,
937950
pub operator: &'static str,
938951
#[subdiagnostic]
939-
pub sugg: WrapExpressionInParentheses,
952+
pub sugg: WrapInParentheses,
940953
}
941954

942955
#[derive(Diagnostic)]
@@ -945,7 +958,7 @@ pub(crate) struct InvalidCurlyInLetElse {
945958
#[primary_span]
946959
pub span: Span,
947960
#[subdiagnostic]
948-
pub sugg: WrapExpressionInParentheses,
961+
pub sugg: WrapInParentheses,
949962
}
950963

951964
#[derive(Diagnostic)]

‎compiler/rustc_parse/src/parser/expr.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1844,7 +1844,7 @@ impl<'a> Parser<'a> {
18441844
let lexpr = self.parse_expr_labeled(label, true)?;
18451845
self.dcx().emit_err(errors::LabeledLoopInBreak {
18461846
span: lexpr.span,
1847-
sub: errors::WrapExpressionInParentheses {
1847+
sub: errors::WrapInParentheses::Expression {
18481848
left: lexpr.span.shrink_to_lo(),
18491849
right: lexpr.span.shrink_to_hi(),
18501850
},

‎compiler/rustc_parse/src/parser/stmt.rs

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -389,7 +389,7 @@ impl<'a> Parser<'a> {
389389
self.dcx().emit_err(errors::InvalidExpressionInLetElse {
390390
span: init.span,
391391
operator: op.node.as_str(),
392-
sugg: errors::WrapExpressionInParentheses {
392+
sugg: errors::WrapInParentheses::Expression {
393393
left: init.span.shrink_to_lo(),
394394
right: init.span.shrink_to_hi(),
395395
},
@@ -400,12 +400,19 @@ impl<'a> Parser<'a> {
400400

401401
fn check_let_else_init_trailing_brace(&self, init: &ast::Expr) {
402402
if let Some(trailing) = classify::expr_trailing_brace(init) {
403-
self.dcx().emit_err(errors::InvalidCurlyInLetElse {
404-
span: trailing.span.with_lo(trailing.span.hi() - BytePos(1)),
405-
sugg: errors::WrapExpressionInParentheses {
403+
let sugg = match &trailing.kind {
404+
ExprKind::MacCall(mac) => errors::WrapInParentheses::MacroArgs {
405+
left: mac.args.dspan.open,
406+
right: mac.args.dspan.close,
407+
},
408+
_ => errors::WrapInParentheses::Expression {
406409
left: trailing.span.shrink_to_lo(),
407410
right: trailing.span.shrink_to_hi(),
408411
},
412+
};
413+
self.dcx().emit_err(errors::InvalidCurlyInLetElse {
414+
span: trailing.span.with_lo(trailing.span.hi() - BytePos(1)),
415+
sugg,
409416
});
410417
}
411418
}

‎compiler/rustc_passes/src/dead.rs

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ struct MarkSymbolVisitor<'tcx> {
5757
tcx: TyCtxt<'tcx>,
5858
maybe_typeck_results: Option<&'tcx ty::TypeckResults<'tcx>>,
5959
live_symbols: LocalDefIdSet,
60-
repr_has_repr_c: bool,
60+
repr_unconditionally_treats_fields_as_live: bool,
6161
repr_has_repr_simd: bool,
6262
in_pat: bool,
6363
ignore_variant_stack: Vec<DefId>,
@@ -365,15 +365,17 @@ impl<'tcx> MarkSymbolVisitor<'tcx> {
365365
return;
366366
}
367367

368-
let had_repr_c = self.repr_has_repr_c;
368+
let unconditionally_treated_fields_as_live =
369+
self.repr_unconditionally_treats_fields_as_live;
369370
let had_repr_simd = self.repr_has_repr_simd;
370-
self.repr_has_repr_c = false;
371+
self.repr_unconditionally_treats_fields_as_live = false;
371372
self.repr_has_repr_simd = false;
372373
match node {
373374
Node::Item(item) => match item.kind {
374375
hir::ItemKind::Struct(..) | hir::ItemKind::Union(..) => {
375376
let def = self.tcx.adt_def(item.owner_id);
376-
self.repr_has_repr_c = def.repr().c();
377+
self.repr_unconditionally_treats_fields_as_live =
378+
def.repr().c() || def.repr().transparent();
377379
self.repr_has_repr_simd = def.repr().simd();
378380

379381
intravisit::walk_item(self, item)
@@ -411,7 +413,7 @@ impl<'tcx> MarkSymbolVisitor<'tcx> {
411413
_ => {}
412414
}
413415
self.repr_has_repr_simd = had_repr_simd;
414-
self.repr_has_repr_c = had_repr_c;
416+
self.repr_unconditionally_treats_fields_as_live = unconditionally_treated_fields_as_live;
415417
}
416418

417419
fn mark_as_used_if_union(&mut self, adt: ty::AdtDef<'tcx>, fields: &[hir::ExprField<'_>]) {
@@ -435,11 +437,11 @@ impl<'tcx> Visitor<'tcx> for MarkSymbolVisitor<'tcx> {
435437

436438
fn visit_variant_data(&mut self, def: &'tcx hir::VariantData<'tcx>) {
437439
let tcx = self.tcx;
438-
let has_repr_c = self.repr_has_repr_c;
440+
let unconditionally_treat_fields_as_live = self.repr_unconditionally_treats_fields_as_live;
439441
let has_repr_simd = self.repr_has_repr_simd;
440442
let live_fields = def.fields().iter().filter_map(|f| {
441443
let def_id = f.def_id;
442-
if has_repr_c || (f.is_positional() && has_repr_simd) {
444+
if unconditionally_treat_fields_as_live || (f.is_positional() && has_repr_simd) {
443445
return Some(def_id);
444446
}
445447
if !tcx.visibility(f.hir_id.owner.def_id).is_public() {
@@ -741,7 +743,7 @@ fn live_symbols_and_ignored_derived_traits(
741743
tcx,
742744
maybe_typeck_results: None,
743745
live_symbols: Default::default(),
744-
repr_has_repr_c: false,
746+
repr_unconditionally_treats_fields_as_live: false,
745747
repr_has_repr_simd: false,
746748
in_pat: false,
747749
ignore_variant_stack: vec![],

‎library/alloc/src/boxed/thin.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,6 @@ struct WithHeader<H>(NonNull<u8>, PhantomData<H>);
171171
/// An opaque representation of `WithHeader<H>` to avoid the
172172
/// projection invariance of `<T as Pointee>::Metadata`.
173173
#[repr(transparent)]
174-
#[allow(dead_code)] // Field only used through `WithHeader` type above.
175174
struct WithOpaqueHeader(NonNull<u8>);
176175

177176
impl WithOpaqueHeader {

‎library/alloc/src/vec/mod.rs

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -358,7 +358,7 @@ mod spec_extend;
358358
///
359359
/// `vec![x; n]`, `vec![a, b, c, d]`, and
360360
/// [`Vec::with_capacity(n)`][`Vec::with_capacity`], will all produce a `Vec`
361-
/// with exactly the requested capacity. If <code>[len] == [capacity]</code>,
361+
/// with at least the requested capacity. If <code>[len] == [capacity]</code>,
362362
/// (as is the case for the [`vec!`] macro), then a `Vec<T>` can be converted to
363363
/// and from a [`Box<[T]>`][owned slice] without reallocating or moving the elements.
364364
///
@@ -1023,8 +1023,11 @@ impl<T, A: Allocator> Vec<T, A> {
10231023

10241024
/// Shrinks the capacity of the vector as much as possible.
10251025
///
1026-
/// It will drop down as close as possible to the length but the allocator
1027-
/// may still inform the vector that there is space for a few more elements.
1026+
/// The behavior of this method depends on the allocator, which may either shrink the vector
1027+
/// in-place or reallocate. The resulting vector might still have some excess capacity, just as
1028+
/// is the case for [`with_capacity`]. See [`Allocator::shrink`] for more details.
1029+
///
1030+
/// [`with_capacity`]: Vec::with_capacity
10281031
///
10291032
/// # Examples
10301033
///
@@ -1074,10 +1077,10 @@ impl<T, A: Allocator> Vec<T, A> {
10741077

10751078
/// Converts the vector into [`Box<[T]>`][owned slice].
10761079
///
1077-
/// If the vector has excess capacity, its items will be moved into a
1078-
/// newly-allocated buffer with exactly the right capacity.
1080+
/// Before doing the conversion, this method discards excess capacity like [`shrink_to_fit`].
10791081
///
10801082
/// [owned slice]: Box
1083+
/// [`shrink_to_fit`]: Vec::shrink_to_fit
10811084
///
10821085
/// # Examples
10831086
///
@@ -3290,8 +3293,10 @@ impl<T, A: Allocator> From<Box<[T], A>> for Vec<T, A> {
32903293
impl<T, A: Allocator> From<Vec<T, A>> for Box<[T], A> {
32913294
/// Convert a vector into a boxed slice.
32923295
///
3293-
/// If `v` has excess capacity, its items will be moved into a
3294-
/// newly-allocated buffer with exactly the right capacity.
3296+
/// Before doing the conversion, this method discards excess capacity like [`Vec::shrink_to_fit`].
3297+
///
3298+
/// [owned slice]: Box
3299+
/// [`Vec::shrink_to_fit`]: Vec::shrink_to_fit
32953300
///
32963301
/// # Examples
32973302
///

‎library/core/src/num/nonzero.rs

Lines changed: 1211 additions & 1265 deletions
Large diffs are not rendered by default.

‎library/core/src/primitive_docs.rs

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1634,9 +1634,8 @@ mod prim_ref {}
16341634
/// function pointers of varying length. Note that this is a convenience notation to avoid
16351635
/// repetitive documentation, not valid Rust syntax.
16361636
///
1637-
/// Due to a temporary restriction in Rust's type system, these traits are only implemented on
1638-
/// functions that take 12 arguments or less, with the `"Rust"` and `"C"` ABIs. In the future, this
1639-
/// may change:
1637+
/// The following traits are implemented for function pointers with any number of arguments and
1638+
/// any ABI.
16401639
///
16411640
/// * [`PartialEq`]
16421641
/// * [`Eq`]
@@ -1645,11 +1644,6 @@ mod prim_ref {}
16451644
/// * [`Hash`]
16461645
/// * [`Pointer`]
16471646
/// * [`Debug`]
1648-
///
1649-
/// The following traits are implemented for function pointers with any number of arguments and
1650-
/// any ABI. These traits have implementations that are automatically generated by the compiler,
1651-
/// so are not limited by missing language features:
1652-
///
16531647
/// * [`Clone`]
16541648
/// * [`Copy`]
16551649
/// * [`Send`]

‎library/core/src/sync/atomic.rs

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@
138138
//!
139139
//! In general, *all* atomic accesses on read-only memory are Undefined Behavior. For instance, attempting
140140
//! to do a `compare_exchange` that will definitely fail (making it conceptually a read-only
141-
//! operation) can still cause a page fault if the underlying memory page is mapped read-only. Since
141+
//! operation) can still cause a segmentation fault if the underlying memory page is mapped read-only. Since
142142
//! atomic `load`s might be implemented using compare-exchange operations, even a `load` can fault
143143
//! on read-only memory.
144144
//!
@@ -181,12 +181,13 @@
181181
//! let spinlock = Arc::new(AtomicUsize::new(1));
182182
//!
183183
//! let spinlock_clone = Arc::clone(&spinlock);
184+
//!
184185
//! let thread = thread::spawn(move|| {
185-
//! spinlock_clone.store(0, Ordering::SeqCst);
186+
//! spinlock_clone.store(0, Ordering::Release);
186187
//! });
187188
//!
188189
//! // Wait for the other thread to release the lock
189-
//! while spinlock.load(Ordering::SeqCst) != 0 {
190+
//! while spinlock.load(Ordering::Acquire) != 0 {
190191
//! hint::spin_loop();
191192
//! }
192193
//!
@@ -203,7 +204,11 @@
203204
//!
204205
//! static GLOBAL_THREAD_COUNT: AtomicUsize = AtomicUsize::new(0);
205206
//!
206-
//! let old_thread_count = GLOBAL_THREAD_COUNT.fetch_add(1, Ordering::SeqCst);
207+
//! // Note that Relaxed ordering doesn't synchronize anything
208+
//! // except the global thread counter itself.
209+
//! let old_thread_count = GLOBAL_THREAD_COUNT.fetch_add(1, Ordering::Relaxed);
210+
//! // Note that this number may not be true at the moment of printing
211+
//! // because some other thread may have changed static value already.
207212
//! println!("live threads: {}", old_thread_count + 1);
208213
//! ```
209214

‎library/std/src/backtrace.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ use crate::env;
9393
use crate::ffi::c_void;
9494
use crate::fmt;
9595
use crate::panic::UnwindSafe;
96-
use crate::sync::atomic::{AtomicUsize, Ordering::Relaxed};
96+
use crate::sync::atomic::{AtomicU8, Ordering::Relaxed};
9797
use crate::sync::LazyLock;
9898
use crate::sys_common::backtrace::{lock, output_filename, set_image_base};
9999

@@ -254,7 +254,7 @@ impl Backtrace {
254254
// Cache the result of reading the environment variables to make
255255
// backtrace captures speedy, because otherwise reading environment
256256
// variables every time can be somewhat slow.
257-
static ENABLED: AtomicUsize = AtomicUsize::new(0);
257+
static ENABLED: AtomicU8 = AtomicU8::new(0);
258258
match ENABLED.load(Relaxed) {
259259
0 => {}
260260
1 => return false,
@@ -267,7 +267,7 @@ impl Backtrace {
267267
Err(_) => false,
268268
},
269269
};
270-
ENABLED.store(enabled as usize + 1, Relaxed);
270+
ENABLED.store(enabled as u8 + 1, Relaxed);
271271
enabled
272272
}
273273

‎src/tools/compiletest/src/main.rs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,15 @@ fn main() {
1515
eprintln!("warning: `tidy` is not installed; diffs will not be generated");
1616
}
1717

18+
if !config.profiler_support && config.mode == Mode::CoverageRun {
19+
let actioned = if config.bless { "blessed" } else { "checked" };
20+
eprintln!(
21+
r#"
22+
WARNING: profiler runtime is not available, so `.coverage` files won't be {actioned}
23+
help: try setting `profiler = true` in the `[build]` section of `config.toml`"#
24+
);
25+
}
26+
1827
log_config(&config);
1928
run_tests(config);
2029
}

‎src/tools/miri/tests/fail/issue-miri-1112.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
trait Empty {}
22

33
#[repr(transparent)]
4-
pub struct FunnyPointer(#[allow(dead_code)] dyn Empty);
4+
pub struct FunnyPointer(dyn Empty);
55

66
#[repr(C)]
77
pub struct Meta {

‎src/tools/miri/tests/fail/unaligned_pointers/drop_in_place.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
//@compile-flags: -Cdebug-assertions=no
22

33
#[repr(transparent)]
4-
struct HasDrop(#[allow(dead_code)] u8);
4+
struct HasDrop(u8);
55

66
impl Drop for HasDrop {
77
fn drop(&mut self) {}

‎tests/ui/consts/transmute-const.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
use std::mem;
44

55
#[repr(transparent)]
6-
struct Foo(#[allow(dead_code)] u32);
6+
struct Foo(u32);
77

88
const TRANSMUTED_U32: u32 = unsafe { mem::transmute(Foo(3)) };
99

‎tests/ui/layout/unsafe-cell-hides-niche.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ use std::sync::{Mutex, RwLock};
1717
struct Wrapper<T>(#[allow(dead_code)] T);
1818

1919
#[repr(transparent)]
20-
struct Transparent<T>(#[allow(dead_code)] T);
20+
struct Transparent<T>(T);
2121

2222
struct NoNiche<T>(UnsafeCell<T>);
2323

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
// Verify that we do not warn on fields that are part of transparent types.
2+
// check-pass
3+
#![deny(dead_code)]
4+
5+
#[repr(transparent)]
6+
struct NamedStruct { field: u8 }
7+
8+
#[repr(transparent)]
9+
struct TupleStruct(u8);
10+
11+
fn main() {
12+
let _ = NamedStruct { field: 1 };
13+
let _ = TupleStruct(1);
14+
}

‎tests/ui/packed/packed-struct-drop-aligned.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ impl<'a> Drop for Aligned<'a> {
2424
}
2525

2626
#[repr(transparent)]
27-
struct NotCopy(#[allow(dead_code)] u8);
27+
struct NotCopy(u8);
2828

2929
#[repr(packed)]
3030
struct Packed<'a>(NotCopy, Aligned<'a>);

‎tests/ui/parser/bad-let-else-statement.rs

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -161,4 +161,29 @@ fn q() {
161161
};
162162
}
163163

164+
fn r() {
165+
let ok = format_args!("") else { return; };
166+
167+
let bad = format_args! {""} else { return; };
168+
//~^ ERROR right curly brace `}` before `else` in a `let...else` statement not allowed
169+
}
170+
171+
fn s() {
172+
macro_rules! a {
173+
() => { {} }
174+
}
175+
176+
macro_rules! b {
177+
(1) => {
178+
let x = a!() else { return; };
179+
};
180+
(2) => {
181+
let x = a! {} else { return; };
182+
//~^ ERROR right curly brace `}` before `else` in a `let...else` statement not allowed
183+
};
184+
}
185+
186+
b!(1); b!(2);
187+
}
188+
164189
fn main() {}

‎tests/ui/parser/bad-let-else-statement.stderr

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -228,5 +228,31 @@ LL | x
228228
LL ~ }) else {
229229
|
230230

231-
error: aborting due to 17 previous errors
231+
error: right curly brace `}` before `else` in a `let...else` statement not allowed
232+
--> $DIR/bad-let-else-statement.rs:167:31
233+
|
234+
LL | let bad = format_args! {""} else { return; };
235+
| ^
236+
|
237+
help: use parentheses instead of braces for this macro
238+
|
239+
LL | let bad = format_args! ("") else { return; };
240+
| ~ ~
241+
242+
error: right curly brace `}` before `else` in a `let...else` statement not allowed
243+
--> $DIR/bad-let-else-statement.rs:181:25
244+
|
245+
LL | let x = a! {} else { return; };
246+
| ^
247+
...
248+
LL | b!(1); b!(2);
249+
| ----- in this macro invocation
250+
|
251+
= note: this error originates in the macro `b` (in Nightly builds, run with -Z macro-backtrace for more info)
252+
help: use parentheses instead of braces for this macro
253+
|
254+
LL | let x = a! () else { return; };
255+
| ~~
256+
257+
error: aborting due to 19 previous errors
232258

‎triagebot.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -644,7 +644,6 @@ compiler-team = [
644644
]
645645
compiler-team-contributors = [
646646
"@TaKO8Ki",
647-
"@WaffleLapkin",
648647
"@b-naber",
649648
]
650649
compiler = [

0 commit comments

Comments
 (0)
Please sign in to comment.