From 4f9fe856a25ab29345b90e7725509e9ee38a37be Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Wed, 17 Apr 2024 14:19:41 +0200 Subject: Adding upstream version 1.69.0+dfsg1. Signed-off-by: Daniel Baumann --- compiler/rustc_builtin_macros/src/assert/context.rs | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) (limited to 'compiler/rustc_builtin_macros/src/assert/context.rs') diff --git a/compiler/rustc_builtin_macros/src/assert/context.rs b/compiler/rustc_builtin_macros/src/assert/context.rs index 93b07801e..b0b4dda16 100644 --- a/compiler/rustc_builtin_macros/src/assert/context.rs +++ b/compiler/rustc_builtin_macros/src/assert/context.rs @@ -12,7 +12,7 @@ use rustc_span::{ symbol::{sym, Ident, Symbol}, Span, }; -use thin_vec::thin_vec; +use thin_vec::{thin_vec, ThinVec}; pub(super) struct Context<'cx, 'a> { // An optimization. @@ -83,12 +83,12 @@ impl<'cx, 'a> Context<'cx, 'a> { let Self { best_case_captures, capture_decls, cx, local_bind_decls, span, .. } = self; - let mut assert_then_stmts = Vec::with_capacity(2); + let mut assert_then_stmts = ThinVec::with_capacity(2); assert_then_stmts.extend(best_case_captures); assert_then_stmts.push(self.cx.stmt_expr(panic)); let assert_then = self.cx.block(span, assert_then_stmts); - let mut stmts = Vec::with_capacity(4); + let mut stmts = ThinVec::with_capacity(4); stmts.push(initial_imports); stmts.extend(capture_decls.into_iter().map(|c| c.decl)); stmts.extend(local_bind_decls); @@ -120,7 +120,7 @@ impl<'cx, 'a> Context<'cx, 'a> { thin_vec![self.cx.attr_nested_word(sym::allow, sym::unused_imports, self.span)], ItemKind::Use(UseTree { prefix: self.cx.path(self.span, self.cx.std_path(&[sym::asserting])), - kind: UseTreeKind::Nested(vec![ + kind: UseTreeKind::Nested(thin_vec![ nested_tree(self, sym::TryCaptureGeneric), nested_tree(self, sym::TryCapturePrintable), ]), @@ -136,7 +136,7 @@ impl<'cx, 'a> Context<'cx, 'a> { self.cx.expr_call( self.span, self.cx.expr_path(self.cx.path(self.span, unlikely_path)), - vec![self.cx.expr(self.span, ExprKind::Unary(UnOp::Not, cond_expr))], + thin_vec![self.cx.expr(self.span, ExprKind::Unary(UnOp::Not, cond_expr))], ) } @@ -297,6 +297,7 @@ impl<'cx, 'a> Context<'cx, 'a> { | ExprKind::Continue(_) | ExprKind::Err | ExprKind::Field(_, _) + | ExprKind::FormatArgs(_) | ExprKind::ForLoop(_, _, _, _) | ExprKind::If(_, _, _) | ExprKind::IncludedBytes(..) @@ -338,7 +339,7 @@ impl<'cx, 'a> Context<'cx, 'a> { let init = self.cx.expr_call( self.span, self.cx.expr_path(self.cx.path(self.span, init_std_path)), - vec![], + ThinVec::new(), ); let capture = Capture { decl: self.cx.stmt_let(self.span, true, ident, init), ident }; self.capture_decls.push(capture); @@ -365,7 +366,7 @@ impl<'cx, 'a> Context<'cx, 'a> { self.cx.expr_path( self.cx.path(self.span, self.cx.std_path(&[sym::asserting, sym::Wrapper])), ), - vec![self.cx.expr_path(Path::from_ident(local_bind))], + thin_vec![self.cx.expr_path(Path::from_ident(local_bind))], ); let try_capture_call = self .cx @@ -377,7 +378,7 @@ impl<'cx, 'a> Context<'cx, 'a> { ident: Ident::new(sym::try_capture, self.span), }, expr_paren(self.cx, self.span, self.cx.expr_addr_of(self.span, wrapper)), - vec![expr_addr_of_mut( + thin_vec![expr_addr_of_mut( self.cx, self.span, self.cx.expr_path(Path::from_ident(capture)), @@ -388,7 +389,7 @@ impl<'cx, 'a> Context<'cx, 'a> { let local_bind_path = self.cx.expr_path(Path::from_ident(local_bind)); let rslt = if self.is_consumed { let ret = self.cx.stmt_expr(local_bind_path); - self.cx.expr_block(self.cx.block(self.span, vec![try_capture_call, ret])) + self.cx.expr_block(self.cx.block(self.span, thin_vec![try_capture_call, ret])) } else { self.best_case_captures.push(try_capture_call); local_bind_path @@ -440,7 +441,7 @@ fn expr_method_call( cx: &ExtCtxt<'_>, seg: PathSegment, receiver: P, - args: Vec>, + args: ThinVec>, span: Span, ) -> P { cx.expr(span, ExprKind::MethodCall(Box::new(MethodCall { seg, receiver, args, span }))) -- cgit v1.2.3