authorbors <bors@rust-lang.org> 2024-06-28 07:25:28 UTC
committerbors <bors@rust-lang.org> 2024-06-28 07:25:28 UTC
log99f77a2eda555b50b518f74823ab636a20efb87f
tree8dd11cc66cae04d768306ccb8e6c7e625e25104d
parent42add88d2275b95c98e512ab680436ede691e853
parent89a0cfe72afe047c699df3810e1ce5e4d9cb98b4

Auto merge of #127076 - matthiaskrgr:rollup-l01gm36, r=matthiaskrgr

Rollup of 6 pull requests Successful merges: - #124741 (patchable-function-entry: Add unstable compiler flag and attribute) - #126470 (make cargo submodule optional) - #126956 (core: avoid `extern type`s in formatting infrastructure) - #126970 (Simplify `str::clone_into`) - #127022 (Support fetching `Attribute` of items.) - #127058 (Tighten `fn_decl_span` for async blocks) r? `@ghost` `@rustbot` modify labels: rollup

80 files changed, 980 insertions(+), 308 deletions(-)

Cargo.lock+2
......@@ -4675,6 +4675,8 @@ name = "rustc_smir"
46754675version = "0.0.0"
46764676dependencies = [
46774677 "rustc_abi",
4678 "rustc_ast",
4679 "rustc_ast_pretty",
46784680 "rustc_data_structures",
46794681 "rustc_hir",
46804682 "rustc_middle",
compiler/rustc_ast/src/ast.rs+4-1
......@@ -1454,7 +1454,10 @@ pub enum ExprKind {
14541454 Block(P<Block>, Option<Label>),
14551455 /// An `async` block (`async move { ... }`),
14561456 /// or a `gen` block (`gen move { ... }`)
1457 Gen(CaptureBy, P<Block>, GenBlockKind),
1457 ///
1458 /// The span is the "decl", which is the header before the body `{ }`
1459 /// including the `asyng`/`gen` keywords and possibly `move`.
1460 Gen(CaptureBy, P<Block>, GenBlockKind, Span),
14581461 /// An await expression (`my_future.await`). Span is of await keyword.
14591462 Await(P<Expr>, Span),
14601463
compiler/rustc_ast/src/mut_visit.rs+2-1
......@@ -1528,8 +1528,9 @@ pub fn noop_visit_expr<T: MutVisitor>(
15281528 visit_opt(label, |label| vis.visit_label(label));
15291529 vis.visit_block(blk);
15301530 }
1531 ExprKind::Gen(_capture_by, body, _kind) => {
1531 ExprKind::Gen(_capture_by, body, _kind, decl_span) => {
15321532 vis.visit_block(body);
1533 vis.visit_span(decl_span);
15331534 }
15341535 ExprKind::Await(expr, await_kw_span) => {
15351536 vis.visit_expr(expr);
compiler/rustc_ast/src/visit.rs+1-1
......@@ -1122,7 +1122,7 @@ pub fn walk_expr<'a, V: Visitor<'a>>(visitor: &mut V, expression: &'a Expr) -> V
11221122 visit_opt!(visitor, visit_label, opt_label);
11231123 try_visit!(visitor.visit_block(block));
11241124 }
1125 ExprKind::Gen(_capt, body, _kind) => try_visit!(visitor.visit_block(body)),
1125 ExprKind::Gen(_capt, body, _kind, _decl_span) => try_visit!(visitor.visit_block(body)),
11261126 ExprKind::Await(expr, _span) => try_visit!(visitor.visit_expr(expr)),
11271127 ExprKind::Assign(lhs, rhs, _span) => {
11281128 try_visit!(visitor.visit_expr(lhs));
compiler/rustc_ast_lowering/src/expr.rs+5-2
......@@ -227,7 +227,7 @@ impl<'hir> LoweringContext<'_, 'hir> {
227227 *fn_arg_span,
228228 ),
229229 },
230 ExprKind::Gen(capture_clause, block, genblock_kind) => {
230 ExprKind::Gen(capture_clause, block, genblock_kind, decl_span) => {
231231 let desugaring_kind = match genblock_kind {
232232 GenBlockKind::Async => hir::CoroutineDesugaring::Async,
233233 GenBlockKind::Gen => hir::CoroutineDesugaring::Gen,
......@@ -237,6 +237,7 @@ impl<'hir> LoweringContext<'_, 'hir> {
237237 *capture_clause,
238238 e.id,
239239 None,
240 *decl_span,
240241 e.span,
241242 desugaring_kind,
242243 hir::CoroutineSource::Block,
......@@ -616,6 +617,7 @@ impl<'hir> LoweringContext<'_, 'hir> {
616617 capture_clause: CaptureBy,
617618 closure_node_id: NodeId,
618619 return_ty: Option<hir::FnRetTy<'hir>>,
620 fn_decl_span: Span,
619621 span: Span,
620622 desugaring_kind: hir::CoroutineDesugaring,
621623 coroutine_source: hir::CoroutineSource,
......@@ -692,7 +694,7 @@ impl<'hir> LoweringContext<'_, 'hir> {
692694 bound_generic_params: &[],
693695 fn_decl,
694696 body,
695 fn_decl_span: self.lower_span(span),
697 fn_decl_span: self.lower_span(fn_decl_span),
696698 fn_arg_span: None,
697699 kind: hir::ClosureKind::Coroutine(coroutine_kind),
698700 constness: hir::Constness::NotConst,
......@@ -1083,6 +1085,7 @@ impl<'hir> LoweringContext<'_, 'hir> {
10831085 let (parameters, expr) = this.lower_coroutine_body_with_moved_arguments(
10841086 &inner_decl,
10851087 |this| this.with_new_scopes(fn_decl_span, |this| this.lower_expr_mut(body)),
1088 fn_decl_span,
10861089 body.span,
10871090 coroutine_kind,
10881091 hir::CoroutineSource::Closure,
compiler/rustc_ast_lowering/src/item.rs+8-8
......@@ -211,6 +211,7 @@ impl<'hir> LoweringContext<'_, 'hir> {
211211 // declaration (decl), not the return types.
212212 let coroutine_kind = header.coroutine_kind;
213213 let body_id = this.lower_maybe_coroutine_body(
214 *fn_sig_span,
214215 span,
215216 hir_id,
216217 decl,
......@@ -799,6 +800,7 @@ impl<'hir> LoweringContext<'_, 'hir> {
799800 }
800801 AssocItemKind::Fn(box Fn { sig, generics, body: Some(body), .. }) => {
801802 let body_id = self.lower_maybe_coroutine_body(
803 sig.span,
802804 i.span,
803805 hir_id,
804806 &sig.decl,
......@@ -915,6 +917,7 @@ impl<'hir> LoweringContext<'_, 'hir> {
915917 ),
916918 AssocItemKind::Fn(box Fn { sig, generics, body, .. }) => {
917919 let body_id = self.lower_maybe_coroutine_body(
920 sig.span,
918921 i.span,
919922 hir_id,
920923 &sig.decl,
......@@ -1111,6 +1114,7 @@ impl<'hir> LoweringContext<'_, 'hir> {
11111114 /// `gen {}` block as appropriate.
11121115 fn lower_maybe_coroutine_body(
11131116 &mut self,
1117 fn_decl_span: Span,
11141118 span: Span,
11151119 fn_id: hir::HirId,
11161120 decl: &FnDecl,
......@@ -1124,6 +1128,7 @@ impl<'hir> LoweringContext<'_, 'hir> {
11241128 let (parameters, expr) = this.lower_coroutine_body_with_moved_arguments(
11251129 decl,
11261130 |this| this.lower_block_expr(body),
1131 fn_decl_span,
11271132 body.span,
11281133 coroutine_kind,
11291134 hir::CoroutineSource::Fn,
......@@ -1145,6 +1150,7 @@ impl<'hir> LoweringContext<'_, 'hir> {
11451150 &mut self,
11461151 decl: &FnDecl,
11471152 lower_body: impl FnOnce(&mut LoweringContext<'_, 'hir>) -> hir::Expr<'hir>,
1153 fn_decl_span: Span,
11481154 body_span: Span,
11491155 coroutine_kind: CoroutineKind,
11501156 coroutine_source: hir::CoroutineSource,
......@@ -1315,13 +1321,6 @@ impl<'hir> LoweringContext<'_, 'hir> {
13151321 };
13161322 let closure_id = coroutine_kind.closure_id();
13171323
1318 let span = if let FnRetTy::Default(span) = decl.output
1319 && matches!(coroutine_source, rustc_hir::CoroutineSource::Closure)
1320 {
1321 body_span.with_lo(span.lo())
1322 } else {
1323 body_span
1324 };
13251324 let coroutine_expr = self.make_desugared_coroutine_expr(
13261325 // The default capture mode here is by-ref. Later on during upvar analysis,
13271326 // we will force the captured arguments to by-move, but for async closures,
......@@ -1330,7 +1329,8 @@ impl<'hir> LoweringContext<'_, 'hir> {
13301329 CaptureBy::Ref,
13311330 closure_id,
13321331 None,
1333 span,
1332 fn_decl_span,
1333 body_span,
13341334 desugaring_kind,
13351335 coroutine_source,
13361336 mkbody,
compiler/rustc_ast_pretty/src/pprust/state/expr.rs+1-1
......@@ -540,7 +540,7 @@ impl<'a> State<'a> {
540540 self.ibox(0);
541541 self.print_block_with_attrs(blk, attrs);
542542 }
543 ast::ExprKind::Gen(capture_clause, blk, kind) => {
543 ast::ExprKind::Gen(capture_clause, blk, kind, _decl_span) => {
544544 self.word_nbsp(kind.modifier());
545545 self.print_capture_clause(*capture_clause);
546546 // cbox/ibox in analogy to the `ExprKind::Block` arm above
compiler/rustc_builtin_macros/src/assert/context.rs+1-1
......@@ -298,7 +298,7 @@ impl<'cx, 'a> Context<'cx, 'a> {
298298 // sync with the `rfc-2011-nicer-assert-messages/all-expr-kinds.rs` test.
299299 ExprKind::Assign(_, _, _)
300300 | ExprKind::AssignOp(_, _, _)
301 | ExprKind::Gen(_, _, _)
301 | ExprKind::Gen(_, _, _, _)
302302 | ExprKind::Await(_, _)
303303 | ExprKind::Block(_, _)
304304 | ExprKind::Break(_, _)
compiler/rustc_codegen_llvm/src/attributes.rs+30-1
......@@ -2,7 +2,7 @@
22
33use rustc_codegen_ssa::traits::*;
44use rustc_hir::def_id::DefId;
5use rustc_middle::middle::codegen_fn_attrs::CodegenFnAttrFlags;
5use rustc_middle::middle::codegen_fn_attrs::{CodegenFnAttrFlags, PatchableFunctionEntry};
66use rustc_middle::ty::{self, TyCtxt};
77use rustc_session::config::{FunctionReturn, OptLevel};
88use rustc_span::symbol::sym;
......@@ -53,6 +53,34 @@ fn inline_attr<'ll>(cx: &CodegenCx<'ll, '_>, inline: InlineAttr) -> Option<&'ll
5353 }
5454}
5555
56#[inline]
57fn patchable_function_entry_attrs<'ll>(
58 cx: &CodegenCx<'ll, '_>,
59 attr: Option<PatchableFunctionEntry>,
60) -> SmallVec<[&'ll Attribute; 2]> {
61 let mut attrs = SmallVec::new();
62 let patchable_spec = attr.unwrap_or_else(|| {
63 PatchableFunctionEntry::from_config(cx.tcx.sess.opts.unstable_opts.patchable_function_entry)
64 });
65 let entry = patchable_spec.entry();
66 let prefix = patchable_spec.prefix();
67 if entry > 0 {
68 attrs.push(llvm::CreateAttrStringValue(
69 cx.llcx,
70 "patchable-function-entry",
71 &format!("{}", entry),
72 ));
73 }
74 if prefix > 0 {
75 attrs.push(llvm::CreateAttrStringValue(
76 cx.llcx,
77 "patchable-function-prefix",
78 &format!("{}", prefix),
79 ));
80 }
81 attrs
82}
83
5684/// Get LLVM sanitize attributes.
5785#[inline]
5886pub fn sanitize_attrs<'ll>(
......@@ -421,6 +449,7 @@ pub fn from_fn_attrs<'ll, 'tcx>(
421449 llvm::set_alignment(llfn, align);
422450 }
423451 to_add.extend(sanitize_attrs(cx, codegen_fn_attrs.no_sanitize));
452 to_add.extend(patchable_function_entry_attrs(cx, codegen_fn_attrs.patchable_function_entry));
424453
425454 // Always annotate functions with the target-cpu they are compiled for.
426455 // Without this, ThinLTO won't inline Rust functions into Clang generated
compiler/rustc_codegen_ssa/src/codegen_attrs.rs+78-2
......@@ -1,11 +1,13 @@
11use rustc_ast::{ast, attr, MetaItemKind, NestedMetaItem};
22use rustc_attr::{list_contains_name, InlineAttr, InstructionSetAttr, OptimizeAttr};
3use rustc_errors::{codes::*, struct_span_code_err};
3use rustc_errors::{codes::*, struct_span_code_err, DiagMessage, SubdiagMessage};
44use rustc_hir as hir;
55use rustc_hir::def::DefKind;
66use rustc_hir::def_id::{DefId, LocalDefId, LOCAL_CRATE};
77use rustc_hir::{lang_items, weak_lang_items::WEAK_LANG_ITEMS, LangItem};
8use rustc_middle::middle::codegen_fn_attrs::{CodegenFnAttrFlags, CodegenFnAttrs};
8use rustc_middle::middle::codegen_fn_attrs::{
9 CodegenFnAttrFlags, CodegenFnAttrs, PatchableFunctionEntry,
10};
911use rustc_middle::mir::mono::Linkage;
1012use rustc_middle::query::Providers;
1113use rustc_middle::ty::{self as ty, TyCtxt};
......@@ -447,6 +449,80 @@ fn codegen_fn_attrs(tcx: TyCtxt<'_>, did: LocalDefId) -> CodegenFnAttrs {
447449 None
448450 };
449451 }
452 sym::patchable_function_entry => {
453 codegen_fn_attrs.patchable_function_entry = attr.meta_item_list().and_then(|l| {
454 let mut prefix = None;
455 let mut entry = None;
456 for item in l {
457 let Some(meta_item) = item.meta_item() else {
458 tcx.dcx().span_err(item.span(), "expected name value pair");
459 continue;
460 };
461
462 let Some(name_value_lit) = meta_item.name_value_literal() else {
463 tcx.dcx().span_err(item.span(), "expected name value pair");
464 continue;
465 };
466
467 fn emit_error_with_label(
468 tcx: TyCtxt<'_>,
469 span: Span,
470 error: impl Into<DiagMessage>,
471 label: impl Into<SubdiagMessage>,
472 ) {
473 let mut err: rustc_errors::Diag<'_, _> =
474 tcx.dcx().struct_span_err(span, error);
475 err.span_label(span, label);
476 err.emit();
477 }
478
479 let attrib_to_write = match meta_item.name_or_empty() {
480 sym::prefix_nops => &mut prefix,
481 sym::entry_nops => &mut entry,
482 _ => {
483 emit_error_with_label(
484 tcx,
485 item.span(),
486 "unexpected parameter name",
487 format!("expected {} or {}", sym::prefix_nops, sym::entry_nops),
488 );
489 continue;
490 }
491 };
492
493 let rustc_ast::LitKind::Int(val, _) = name_value_lit.kind else {
494 emit_error_with_label(
495 tcx,
496 name_value_lit.span,
497 "invalid literal value",
498 "value must be an integer between `0` and `255`",
499 );
500 continue;
501 };
502
503 let Ok(val) = val.get().try_into() else {
504 emit_error_with_label(
505 tcx,
506 name_value_lit.span,
507 "integer value out of range",
508 "value must be between `0` and `255`",
509 );
510 continue;
511 };
512
513 *attrib_to_write = Some(val);
514 }
515
516 if let (None, None) = (prefix, entry) {
517 tcx.dcx().span_err(attr.span, "must specify at least one parameter");
518 }
519
520 Some(PatchableFunctionEntry::from_prefix_and_entry(
521 prefix.unwrap_or(0),
522 entry.unwrap_or(0),
523 ))
524 })
525 }
450526 _ => {}
451527 }
452528 }
compiler/rustc_feature/src/builtin_attrs.rs+7
......@@ -585,6 +585,13 @@ pub const BUILTIN_ATTRIBUTES: &[BuiltinAttribute] = &[
585585 EncodeCrossCrate::No, derive_smart_pointer, experimental!(pointee)
586586 ),
587587
588 // RFC 3543
589 // `#[patchable_function_entry(prefix_nops = m, entry_nops = n)]`
590 gated!(
591 patchable_function_entry, Normal, template!(List: "prefix_nops = m, entry_nops = n"), ErrorPreceding,
592 EncodeCrossCrate::Yes, experimental!(patchable_function_entry)
593 ),
594
588595 // ==========================================================================
589596 // Internal attributes: Stability, deprecation, and unsafe:
590597 // ==========================================================================
compiler/rustc_feature/src/unstable.rs+2
......@@ -563,6 +563,8 @@ declare_features! (
563563 (unstable, offset_of_slice, "CURRENT_RUSTC_VERSION", Some(126151)),
564564 /// Allows using `#[optimize(X)]`.
565565 (unstable, optimize_attribute, "1.34.0", Some(54882)),
566 /// Allows specifying nop padding on functions for dynamic patching.
567 (unstable, patchable_function_entry, "CURRENT_RUSTC_VERSION", Some(123115)),
566568 /// Allows postfix match `expr.match { ... }`
567569 (unstable, postfix_match, "1.79.0", Some(121618)),
568570 /// Allows `use<'a, 'b, A, B>` in `impl Trait + use<...>` for precise capture of generic args.
compiler/rustc_interface/src/tests.rs+7-2
......@@ -8,8 +8,8 @@ use rustc_session::config::{
88 ErrorOutputType, ExternEntry, ExternLocation, Externs, FunctionReturn, InliningThreshold,
99 Input, InstrumentCoverage, InstrumentXRay, LinkSelfContained, LinkerPluginLto, LocationDetail,
1010 LtoCli, NextSolverConfig, OomStrategy, Options, OutFileName, OutputType, OutputTypes, PAuthKey,
11 PacRet, Passes, Polonius, ProcMacroExecutionStrategy, Strip, SwitchWithOptPath,
12 SymbolManglingVersion, WasiExecModel,
11 PacRet, Passes, PatchableFunctionEntry, Polonius, ProcMacroExecutionStrategy, Strip,
12 SwitchWithOptPath, SymbolManglingVersion, WasiExecModel,
1313};
1414use rustc_session::lint::Level;
1515use rustc_session::search_paths::SearchPath;
......@@ -813,6 +813,11 @@ fn test_unstable_options_tracking_hash() {
813813 tracked!(packed_bundled_libs, true);
814814 tracked!(panic_abort_tests, true);
815815 tracked!(panic_in_drop, PanicStrategy::Abort);
816 tracked!(
817 patchable_function_entry,
818 PatchableFunctionEntry::from_total_and_prefix_nops(10, 5)
819 .expect("total must be greater than or equal to prefix")
820 );
816821 tracked!(plt, Some(true));
817822 tracked!(polonius, Polonius::Legacy);
818823 tracked!(precise_enum_drop_elaboration, false);
compiler/rustc_middle/src/middle/codegen_fn_attrs.rs+27
......@@ -45,6 +45,32 @@ pub struct CodegenFnAttrs {
4545 /// The `#[repr(align(...))]` attribute. Indicates the value of which the function should be
4646 /// aligned to.
4747 pub alignment: Option<Align>,
48 /// The `#[patchable_function_entry(...)]` attribute. Indicates how many nops should be around
49 /// the function entry.
50 pub patchable_function_entry: Option<PatchableFunctionEntry>,
51}
52
53#[derive(Copy, Clone, Debug, TyEncodable, TyDecodable, HashStable)]
54pub struct PatchableFunctionEntry {
55 /// Nops to prepend to the function
56 prefix: u8,
57 /// Nops after entry, but before body
58 entry: u8,
59}
60
61impl PatchableFunctionEntry {
62 pub fn from_config(config: rustc_session::config::PatchableFunctionEntry) -> Self {
63 Self { prefix: config.prefix(), entry: config.entry() }
64 }
65 pub fn from_prefix_and_entry(prefix: u8, entry: u8) -> Self {
66 Self { prefix, entry }
67 }
68 pub fn prefix(&self) -> u8 {
69 self.prefix
70 }
71 pub fn entry(&self) -> u8 {
72 self.entry
73 }
4874}
4975
5076#[derive(Clone, Copy, PartialEq, Eq, TyEncodable, TyDecodable, HashStable)]
......@@ -121,6 +147,7 @@ impl CodegenFnAttrs {
121147 no_sanitize: SanitizerSet::empty(),
122148 instruction_set: None,
123149 alignment: None,
150 patchable_function_entry: None,
124151 }
125152 }
126153
compiler/rustc_parse/src/parser/expr.rs+3-2
......@@ -3432,8 +3432,9 @@ impl<'a> Parser<'a> {
34323432 }
34333433 }
34343434 let capture_clause = self.parse_capture_clause()?;
3435 let decl_span = lo.to(self.prev_token.span);
34353436 let (attrs, body) = self.parse_inner_attrs_and_block()?;
3436 let kind = ExprKind::Gen(capture_clause, body, kind);
3437 let kind = ExprKind::Gen(capture_clause, body, kind, decl_span);
34373438 Ok(self.mk_expr_with_attrs(lo.to(self.prev_token.span), kind, attrs))
34383439 }
34393440
......@@ -4022,7 +4023,7 @@ impl MutVisitor for CondChecker<'_> {
40224023 | ExprKind::Match(_, _, _)
40234024 | ExprKind::Closure(_)
40244025 | ExprKind::Block(_, _)
4025 | ExprKind::Gen(_, _, _)
4026 | ExprKind::Gen(_, _, _, _)
40264027 | ExprKind::TryBlock(_)
40274028 | ExprKind::Underscore
40284029 | ExprKind::Path(_, _)
compiler/rustc_resolve/src/def_collector.rs+1-1
......@@ -334,7 +334,7 @@ impl<'a, 'b, 'tcx> visit::Visitor<'a> for DefCollector<'a, 'b, 'tcx> {
334334 None => closure_def,
335335 }
336336 }
337 ExprKind::Gen(_, _, _) => {
337 ExprKind::Gen(_, _, _, _) => {
338338 self.create_def(expr.id, kw::Empty, DefKind::Closure, expr.span)
339339 }
340340 ExprKind::ConstBlock(ref constant) => {
compiler/rustc_session/src/config.rs+33-2
......@@ -2965,8 +2965,9 @@ pub(crate) mod dep_tracking {
29652965 CrateType, DebugInfo, DebugInfoCompression, ErrorOutputType, FunctionReturn,
29662966 InliningThreshold, InstrumentCoverage, InstrumentXRay, LinkerPluginLto, LocationDetail,
29672967 LtoCli, NextSolverConfig, OomStrategy, OptLevel, OutFileName, OutputType, OutputTypes,
2968 Polonius, RemapPathScopeComponents, ResolveDocLinks, SourceFileHashAlgorithm,
2969 SplitDwarfKind, SwitchWithOptPath, SymbolManglingVersion, WasiExecModel,
2968 PatchableFunctionEntry, Polonius, RemapPathScopeComponents, ResolveDocLinks,
2969 SourceFileHashAlgorithm, SplitDwarfKind, SwitchWithOptPath, SymbolManglingVersion,
2970 WasiExecModel,
29702971 };
29712972 use crate::lint;
29722973 use crate::utils::NativeLib;
......@@ -3073,6 +3074,7 @@ pub(crate) mod dep_tracking {
30733074 OomStrategy,
30743075 LanguageIdentifier,
30753076 NextSolverConfig,
3077 PatchableFunctionEntry,
30763078 Polonius,
30773079 InliningThreshold,
30783080 FunctionReturn,
......@@ -3250,6 +3252,35 @@ impl DumpMonoStatsFormat {
32503252 }
32513253}
32523254
3255/// `-Z patchable-function-entry` representation - how many nops to put before and after function
3256/// entry.
3257#[derive(Clone, Copy, PartialEq, Hash, Debug, Default)]
3258pub struct PatchableFunctionEntry {
3259 /// Nops before the entry
3260 prefix: u8,
3261 /// Nops after the entry
3262 entry: u8,
3263}
3264
3265impl PatchableFunctionEntry {
3266 pub fn from_total_and_prefix_nops(
3267 total_nops: u8,
3268 prefix_nops: u8,
3269 ) -> Option<PatchableFunctionEntry> {
3270 if total_nops < prefix_nops {
3271 None
3272 } else {
3273 Some(Self { prefix: prefix_nops, entry: total_nops - prefix_nops })
3274 }
3275 }
3276 pub fn prefix(&self) -> u8 {
3277 self.prefix
3278 }
3279 pub fn entry(&self) -> u8 {
3280 self.entry
3281 }
3282}
3283
32533284/// `-Zpolonius` values, enabling the borrow checker polonius analysis, and which version: legacy,
32543285/// or future prototype.
32553286#[derive(Clone, Copy, PartialEq, Hash, Debug, Default)]
compiler/rustc_session/src/options.rs+29
......@@ -379,6 +379,7 @@ mod desc {
379379 pub const parse_passes: &str = "a space-separated list of passes, or `all`";
380380 pub const parse_panic_strategy: &str = "either `unwind` or `abort`";
381381 pub const parse_on_broken_pipe: &str = "either `kill`, `error`, or `inherit`";
382 pub const parse_patchable_function_entry: &str = "either two comma separated integers (total_nops,prefix_nops), with prefix_nops <= total_nops, or one integer (total_nops)";
382383 pub const parse_opt_panic_strategy: &str = parse_panic_strategy;
383384 pub const parse_oom_strategy: &str = "either `panic` or `abort`";
384385 pub const parse_relro_level: &str = "one of: `full`, `partial`, or `off`";
......@@ -734,6 +735,32 @@ mod parse {
734735 true
735736 }
736737
738 pub(crate) fn parse_patchable_function_entry(
739 slot: &mut PatchableFunctionEntry,
740 v: Option<&str>,
741 ) -> bool {
742 let mut total_nops = 0;
743 let mut prefix_nops = 0;
744
745 if !parse_number(&mut total_nops, v) {
746 let parts = v.and_then(|v| v.split_once(',')).unzip();
747 if !parse_number(&mut total_nops, parts.0) {
748 return false;
749 }
750 if !parse_number(&mut prefix_nops, parts.1) {
751 return false;
752 }
753 }
754
755 if let Some(pfe) =
756 PatchableFunctionEntry::from_total_and_prefix_nops(total_nops, prefix_nops)
757 {
758 *slot = pfe;
759 return true;
760 }
761 false
762 }
763
737764 pub(crate) fn parse_oom_strategy(slot: &mut OomStrategy, v: Option<&str>) -> bool {
738765 match v {
739766 Some("panic") => *slot = OomStrategy::Panic,
......@@ -1859,6 +1886,8 @@ options! {
18591886 "panic strategy for panics in drops"),
18601887 parse_only: bool = (false, parse_bool, [UNTRACKED],
18611888 "parse only; do not compile, assemble, or link (default: no)"),
1889 patchable_function_entry: PatchableFunctionEntry = (PatchableFunctionEntry::default(), parse_patchable_function_entry, [TRACKED],
1890 "nop padding at function entry"),
18621891 plt: Option<bool> = (None, parse_opt_bool, [TRACKED],
18631892 "whether to use the PLT when calling into shared libraries;
18641893 only has effect for PIC code on systems with ELF binaries
compiler/rustc_smir/Cargo.toml+2
......@@ -6,6 +6,8 @@ edition = "2021"
66[dependencies]
77# tidy-alphabetical-start
88rustc_abi = { path = "../rustc_abi" }
9rustc_ast = { path = "../rustc_ast" }
10rustc_ast_pretty = { path = "../rustc_ast_pretty" }
911rustc_data_structures = { path = "../rustc_data_structures" }
1012rustc_hir = { path = "../rustc_hir" }
1113rustc_middle = { path = "../rustc_middle" }
compiler/rustc_smir/src/rustc_smir/context.rs+40
......@@ -228,6 +228,46 @@ impl<'tcx> Context for TablesWrapper<'tcx> {
228228 }
229229 }
230230
231 fn get_attrs_by_path(
232 &self,
233 def_id: stable_mir::DefId,
234 attr: &[stable_mir::Symbol],
235 ) -> Vec<stable_mir::crate_def::Attribute> {
236 let mut tables = self.0.borrow_mut();
237 let tcx = tables.tcx;
238 let did = tables[def_id];
239 let attr_name: Vec<_> =
240 attr.iter().map(|seg| rustc_span::symbol::Symbol::intern(&seg)).collect();
241 tcx.get_attrs_by_path(did, &attr_name)
242 .map(|attribute| {
243 let attr_str = rustc_ast_pretty::pprust::attribute_to_string(attribute);
244 let span = attribute.span;
245 stable_mir::crate_def::Attribute::new(attr_str, span.stable(&mut *tables))
246 })
247 .collect()
248 }
249
250 fn get_all_attrs(&self, def_id: stable_mir::DefId) -> Vec<stable_mir::crate_def::Attribute> {
251 let mut tables = self.0.borrow_mut();
252 let tcx = tables.tcx;
253 let did = tables[def_id];
254 let filter_fn = move |a: &&rustc_ast::ast::Attribute| {
255 matches!(a.kind, rustc_ast::ast::AttrKind::Normal(_))
256 };
257 let attrs_iter = if let Some(did) = did.as_local() {
258 tcx.hir().attrs(tcx.local_def_id_to_hir_id(did)).iter().filter(filter_fn)
259 } else {
260 tcx.item_attrs(did).iter().filter(filter_fn)
261 };
262 attrs_iter
263 .map(|attribute| {
264 let attr_str = rustc_ast_pretty::pprust::attribute_to_string(attribute);
265 let span = attribute.span;
266 stable_mir::crate_def::Attribute::new(attr_str, span.stable(&mut *tables))
267 })
268 .collect()
269 }
270
231271 fn span_to_string(&self, span: stable_mir::ty::Span) -> String {
232272 let tables = self.0.borrow();
233273 tables.tcx.sess.source_map().span_to_diagnostic_string(tables[span])
compiler/rustc_span/src/symbol.rs+3
......@@ -768,6 +768,7 @@ symbols! {
768768 enable,
769769 encode,
770770 end,
771 entry_nops,
771772 enumerate_method,
772773 env,
773774 env_CFG_RELEASE: env!("CFG_RELEASE"),
......@@ -1383,6 +1384,7 @@ symbols! {
13831384 passes,
13841385 pat,
13851386 pat_param,
1387 patchable_function_entry,
13861388 path,
13871389 pattern_complexity,
13881390 pattern_parentheses,
......@@ -1421,6 +1423,7 @@ symbols! {
14211423 prefetch_read_instruction,
14221424 prefetch_write_data,
14231425 prefetch_write_instruction,
1426 prefix_nops,
14241427 preg,
14251428 prelude,
14261429 prelude_import,
compiler/stable_mir/src/compiler_interface.rs+10
......@@ -6,6 +6,7 @@
66use std::cell::Cell;
77
88use crate::abi::{FnAbi, Layout, LayoutShape};
9use crate::crate_def::Attribute;
910use crate::mir::alloc::{AllocId, GlobalAlloc};
1011use crate::mir::mono::{Instance, InstanceDef, StaticDef};
1112use crate::mir::{BinOp, Body, Place, UnOp};
......@@ -55,6 +56,15 @@ pub trait Context {
5556 /// Returns the name of given `DefId`
5657 fn def_name(&self, def_id: DefId, trimmed: bool) -> Symbol;
5758
59 /// Return attributes with the given attribute name.
60 ///
61 /// Single segmented name like `#[inline]` is specified as `&["inline".to_string()]`.
62 /// Multi-segmented name like `#[rustfmt::skip]` is specified as `&["rustfmt".to_string(), "skip".to_string()]`.
63 fn get_attrs_by_path(&self, def_id: DefId, attr: &[Symbol]) -> Vec<Attribute>;
64
65 /// Get all attributes of a definition.
66 fn get_all_attrs(&self, def_id: DefId) -> Vec<Attribute>;
67
5868 /// Returns printable, human readable form of `Span`
5969 fn span_to_string(&self, span: Span) -> String;
6070
compiler/stable_mir/src/crate_def.rs+37
......@@ -50,6 +50,21 @@ pub trait CrateDef {
5050 let def_id = self.def_id();
5151 with(|cx| cx.span_of_an_item(def_id))
5252 }
53
54 /// Return attributes with the given attribute name.
55 ///
56 /// Single segmented name like `#[inline]` is specified as `&["inline".to_string()]`.
57 /// Multi-segmented name like `#[rustfmt::skip]` is specified as `&["rustfmt".to_string(), "skip".to_string()]`.
58 fn attrs_by_path(&self, attr: &[Symbol]) -> Vec<Attribute> {
59 let def_id = self.def_id();
60 with(|cx| cx.get_attrs_by_path(def_id, attr))
61 }
62
63 /// Return all attributes of this definition.
64 fn all_attrs(&self) -> Vec<Attribute> {
65 let def_id = self.def_id();
66 with(|cx| cx.get_all_attrs(def_id))
67 }
5368}
5469
5570/// A trait that can be used to retrieve a definition's type.
......@@ -69,6 +84,28 @@ pub trait CrateDefType: CrateDef {
6984 }
7085}
7186
87#[derive(Clone, Debug, PartialEq, Eq)]
88pub struct Attribute {
89 value: String,
90 span: Span,
91}
92
93impl Attribute {
94 pub fn new(value: String, span: Span) -> Attribute {
95 Attribute { value, span }
96 }
97
98 /// Get the span of this attribute.
99 pub fn span(&self) -> Span {
100 self.span
101 }
102
103 /// Get the string representation of this attribute.
104 pub fn as_str(&self) -> &str {
105 &self.value
106 }
107}
108
72109macro_rules! crate_def {
73110 ( $(#[$attr:meta])*
74111 $vis:vis $name:ident $(;)?
library/alloc/src/str.rs+4-3
......@@ -206,15 +206,16 @@ impl BorrowMut<str> for String {
206206#[stable(feature = "rust1", since = "1.0.0")]
207207impl ToOwned for str {
208208 type Owned = String;
209
209210 #[inline]
210211 fn to_owned(&self) -> String {
211212 unsafe { String::from_utf8_unchecked(self.as_bytes().to_owned()) }
212213 }
213214
215 #[inline]
214216 fn clone_into(&self, target: &mut String) {
215 let mut b = mem::take(target).into_bytes();
216 self.as_bytes().clone_into(&mut b);
217 *target = unsafe { String::from_utf8_unchecked(b) }
217 target.clear();
218 target.push_str(self);
218219 }
219220}
220221
library/core/src/fmt/mod.rs+6
......@@ -459,6 +459,12 @@ impl<'a> Arguments<'a> {
459459 }
460460}
461461
462// Manually implementing these results in better error messages.
463#[stable(feature = "rust1", since = "1.0.0")]
464impl !Send for Arguments<'_> {}
465#[stable(feature = "rust1", since = "1.0.0")]
466impl !Sync for Arguments<'_> {}
467
462468#[stable(feature = "rust1", since = "1.0.0")]
463469impl Debug for Arguments<'_> {
464470 fn fmt(&self, fmt: &mut Formatter<'_>) -> Result {
library/core/src/fmt/rt.rs+25-21
......@@ -5,6 +5,7 @@
55
66use super::*;
77use crate::hint::unreachable_unchecked;
8use crate::ptr::NonNull;
89
910#[lang = "format_placeholder"]
1011#[derive(Copy, Clone)]
......@@ -66,7 +67,13 @@ pub(super) enum Flag {
6667
6768#[derive(Copy, Clone)]
6869enum ArgumentType<'a> {
69 Placeholder { value: &'a Opaque, formatter: fn(&Opaque, &mut Formatter<'_>) -> Result },
70 Placeholder {
71 // INVARIANT: `formatter` has type `fn(&T, _) -> _` for some `T`, and `value`
72 // was derived from a `&'a T`.
73 value: NonNull<()>,
74 formatter: unsafe fn(NonNull<()>, &mut Formatter<'_>) -> Result,
75 _lifetime: PhantomData<&'a ()>,
76 },
7077 Count(usize),
7178}
7279
......@@ -90,21 +97,15 @@ pub struct Argument<'a> {
9097impl<'a> Argument<'a> {
9198 #[inline(always)]
9299 fn new<'b, T>(x: &'b T, f: fn(&T, &mut Formatter<'_>) -> Result) -> Argument<'b> {
93 // SAFETY: `mem::transmute(x)` is safe because
94 // 1. `&'b T` keeps the lifetime it originated with `'b`
95 // (so as to not have an unbounded lifetime)
96 // 2. `&'b T` and `&'b Opaque` have the same memory layout
97 // (when `T` is `Sized`, as it is here)
98 // `mem::transmute(f)` is safe since `fn(&T, &mut Formatter<'_>) -> Result`
99 // and `fn(&Opaque, &mut Formatter<'_>) -> Result` have the same ABI
100 // (as long as `T` is `Sized`)
101 unsafe {
102 Argument {
103 ty: ArgumentType::Placeholder {
104 formatter: mem::transmute(f),
105 value: mem::transmute(x),
106 },
107 }
100 Argument {
101 // INVARIANT: this creates an `ArgumentType<'b>` from a `&'b T` and
102 // a `fn(&T, ...)`, so the invariant is maintained.
103 ty: ArgumentType::Placeholder {
104 value: NonNull::from(x).cast(),
105 // SAFETY: function pointers always have the same layout.
106 formatter: unsafe { mem::transmute(f) },
107 _lifetime: PhantomData,
108 },
108109 }
109110 }
110111
......@@ -162,7 +163,14 @@ impl<'a> Argument<'a> {
162163 #[inline(always)]
163164 pub(super) unsafe fn fmt(&self, f: &mut Formatter<'_>) -> Result {
164165 match self.ty {
165 ArgumentType::Placeholder { formatter, value } => formatter(value, f),
166 // SAFETY:
167 // Because of the invariant that if `formatter` had the type
168 // `fn(&T, _) -> _` then `value` has type `&'b T` where `'b` is
169 // the lifetime of the `ArgumentType`, and because references
170 // and `NonNull` are ABI-compatible, this is completely equivalent
171 // to calling the original function passed to `new` with the
172 // original reference, which is sound.
173 ArgumentType::Placeholder { formatter, value, .. } => unsafe { formatter(value, f) },
166174 // SAFETY: the caller promised this.
167175 ArgumentType::Count(_) => unsafe { unreachable_unchecked() },
168176 }
......@@ -208,7 +216,3 @@ impl UnsafeArg {
208216 Self { _private: () }
209217 }
210218}
211
212extern "C" {
213 type Opaque;
214}
src/bootstrap/src/core/build_steps/doc.rs+18-24
......@@ -888,12 +888,11 @@ impl Step for Rustc {
888888macro_rules! tool_doc {
889889 (
890890 $tool: ident,
891 $should_run: literal,
892891 $path: literal,
893892 $(rustc_tool = $rustc_tool:literal, )?
894 $(in_tree = $in_tree:literal ,)?
895893 $(is_library = $is_library:expr,)?
896894 $(crates = $crates:expr)?
895 $(, submodule $(= $submodule:literal)? )?
897896 ) => {
898897 #[derive(Debug, Clone, Hash, PartialEq, Eq)]
899898 pub struct $tool {
......@@ -907,7 +906,7 @@ macro_rules! tool_doc {
907906
908907 fn should_run(run: ShouldRun<'_>) -> ShouldRun<'_> {
909908 let builder = run.builder;
910 run.crate_or_deps($should_run).default_condition(builder.config.compiler_docs)
909 run.path($path).default_condition(builder.config.compiler_docs)
911910 }
912911
913912 fn make_run(run: RunConfig<'_>) {
......@@ -921,6 +920,15 @@ macro_rules! tool_doc {
921920 /// we do not merge it with the other documentation from std, test and
922921 /// proc_macros. This is largely just a wrapper around `cargo doc`.
923922 fn run(self, builder: &Builder<'_>) {
923 let source_type = SourceType::InTree;
924 $(
925 let _ = source_type; // silence the "unused variable" warning
926 let source_type = SourceType::Submodule;
927
928 let path = Path::new(submodule_helper!( $path, submodule $( = $submodule )? ));
929 builder.update_submodule(&path);
930 )?
931
924932 let stage = builder.top_stage;
925933 let target = self.target;
926934
......@@ -941,12 +949,6 @@ macro_rules! tool_doc {
941949 builder.ensure(compile::Rustc::new(compiler, target));
942950 }
943951
944 let source_type = if true $(&& $in_tree)? {
945 SourceType::InTree
946 } else {
947 SourceType::Submodule
948 };
949
950952 // Build cargo command.
951953 let mut cargo = prepare_tool_cargo(
952954 builder,
......@@ -1008,21 +1010,14 @@ macro_rules! tool_doc {
10081010 }
10091011}
10101012
1011tool_doc!(Rustdoc, "rustdoc-tool", "src/tools/rustdoc", crates = ["rustdoc", "rustdoc-json-types"]);
1012tool_doc!(
1013 Rustfmt,
1014 "rustfmt-nightly",
1015 "src/tools/rustfmt",
1016 crates = ["rustfmt-nightly", "rustfmt-config_proc_macro"]
1017);
1018tool_doc!(Clippy, "clippy", "src/tools/clippy", crates = ["clippy_config", "clippy_utils"]);
1019tool_doc!(Miri, "miri", "src/tools/miri", crates = ["miri"]);
1013tool_doc!(Rustdoc, "src/tools/rustdoc", crates = ["rustdoc", "rustdoc-json-types"]);
1014tool_doc!(Rustfmt, "src/tools/rustfmt", crates = ["rustfmt-nightly", "rustfmt-config_proc_macro"]);
1015tool_doc!(Clippy, "src/tools/clippy", crates = ["clippy_config", "clippy_utils"]);
1016tool_doc!(Miri, "src/tools/miri", crates = ["miri"]);
10201017tool_doc!(
10211018 Cargo,
1022 "cargo",
10231019 "src/tools/cargo",
10241020 rustc_tool = false,
1025 in_tree = false,
10261021 crates = [
10271022 "cargo",
10281023 "cargo-credential",
......@@ -1034,12 +1029,12 @@ tool_doc!(
10341029 "crates-io",
10351030 "mdman",
10361031 "rustfix",
1037 ]
1032 ],
1033 submodule = "src/tools/cargo"
10381034);
1039tool_doc!(Tidy, "tidy", "src/tools/tidy", rustc_tool = false, crates = ["tidy"]);
1035tool_doc!(Tidy, "src/tools/tidy", rustc_tool = false, crates = ["tidy"]);
10401036tool_doc!(
10411037 Bootstrap,
1042 "bootstrap",
10431038 "src/bootstrap",
10441039 rustc_tool = false,
10451040 is_library = true,
......@@ -1047,7 +1042,6 @@ tool_doc!(
10471042);
10481043tool_doc!(
10491044 RunMakeSupport,
1050 "run_make_support",
10511045 "src/tools/run-make-support",
10521046 rustc_tool = false,
10531047 is_library = true,
src/bootstrap/src/core/build_steps/test.rs+3
......@@ -2983,6 +2983,9 @@ impl Step for Bootstrap {
29832983 let compiler = builder.compiler(0, host);
29842984 let _guard = builder.msg(Kind::Test, 0, "bootstrap", host, host);
29852985
2986 // Some tests require cargo submodule to be present.
2987 builder.build.update_submodule(Path::new("src/tools/cargo"));
2988
29862989 let mut check_bootstrap = Command::new(builder.python());
29872990 check_bootstrap
29882991 .args(["-m", "unittest", "bootstrap_test.py"])
src/bootstrap/src/core/build_steps/tool.rs+2
......@@ -656,6 +656,8 @@ impl Step for Cargo {
656656 }
657657
658658 fn run(self, builder: &Builder<'_>) -> PathBuf {
659 builder.build.update_submodule(Path::new("src/tools/cargo"));
660
659661 builder.ensure(ToolBuild {
660662 compiler: self.compiler,
661663 target: self.target,
src/bootstrap/src/core/build_steps/vendor.rs+4-1
......@@ -1,5 +1,5 @@
11use crate::core::builder::{Builder, RunConfig, ShouldRun, Step};
2use std::path::PathBuf;
2use std::path::{Path, PathBuf};
33use std::process::Command;
44
55#[derive(Debug, Clone, Hash, PartialEq, Eq)]
......@@ -34,6 +34,9 @@ impl Step for Vendor {
3434 cmd.arg("--versioned-dirs");
3535 }
3636
37 // cargo submodule must be present for `x vendor` to work.
38 builder.build.update_submodule(Path::new("src/tools/cargo"));
39
3740 // Sync these paths by default.
3841 for p in [
3942 "src/tools/cargo/Cargo.toml",
src/bootstrap/src/core/metadata.rs+4-12
......@@ -67,9 +67,9 @@ pub fn build(build: &mut Build) {
6767
6868/// Invokes `cargo metadata` to get package metadata of each workspace member.
6969///
70/// Note that `src/tools/cargo` is no longer a workspace member but we still
71/// treat it as one here, by invoking an additional `cargo metadata` command.
72fn workspace_members(build: &Build) -> impl Iterator<Item = Package> {
70/// This is used to resolve specific crate paths in `fn should_run` to compile
71/// particular crate (e.g., `x build sysroot` to build library/sysroot).
72fn workspace_members(build: &Build) -> Vec<Package> {
7373 let collect_metadata = |manifest_path| {
7474 let mut cargo = Command::new(&build.initial_cargo);
7575 cargo
......@@ -88,13 +88,5 @@ fn workspace_members(build: &Build) -> impl Iterator<Item = Package> {
8888 };
8989
9090 // Collects `metadata.packages` from all workspaces.
91 let packages = collect_metadata("Cargo.toml");
92 let cargo_packages = collect_metadata("src/tools/cargo/Cargo.toml");
93 let ra_packages = collect_metadata("src/tools/rust-analyzer/Cargo.toml");
94 let bootstrap_packages = collect_metadata("src/bootstrap/Cargo.toml");
95
96 // We only care about the root package from `src/tool/cargo` workspace.
97 let cargo_package = cargo_packages.into_iter().find(|pkg| pkg.name == "cargo").into_iter();
98
99 packages.into_iter().chain(cargo_package).chain(ra_packages).chain(bootstrap_packages)
91 collect_metadata("Cargo.toml")
10092}
src/bootstrap/src/lib.rs+1-2
......@@ -469,8 +469,7 @@ impl Build {
469469
470470 // Make sure we update these before gathering metadata so we don't get an error about missing
471471 // Cargo.toml files.
472 let rust_submodules =
473 ["src/tools/cargo", "src/doc/book", "library/backtrace", "library/stdarch"];
472 let rust_submodules = ["src/doc/book", "library/backtrace", "library/stdarch"];
474473 for s in rust_submodules {
475474 build.update_submodule(Path::new(s));
476475 }
src/doc/unstable-book/src/compiler-flags/patchable-function-entry.md created+24
......@@ -0,0 +1,24 @@
1# `patchable-function-entry`
2
3--------------------
4
5The `-Z patchable-function-entry=total_nops,prefix_nops` or `-Z patchable-function-entry=total_nops`
6compiler flag enables nop padding of function entries with 'total_nops' nops, with
7an offset for the entry of the function at 'prefix_nops' nops. In the second form,
8'prefix_nops' defaults to 0.
9
10As an illustrative example, `-Z patchable-function-entry=3,2` would produce:
11
12```text
13nop
14nop
15function_label:
16nop
17//Actual function code begins here
18```
19
20This flag is used for hotpatching, especially in the Linux kernel. The flag
21arguments are modeled after the `-fpatchable-function-entry` flag as defined
22for both [Clang](https://clang.llvm.org/docs/ClangCommandLineReference.html#cmdoption-clang-fpatchable-function-entry)
23and [gcc](https://gcc.gnu.org/onlinedocs/gcc/Instrumentation-Options.html#index-fpatchable-function-entry)
24and is intended to provide the same effect.
src/tools/clippy/clippy_lints/src/suspicious_operation_groupings.rs+1-1
......@@ -549,7 +549,7 @@ fn ident_difference_expr_with_base_location(
549549 | (Assign(_, _, _), Assign(_, _, _))
550550 | (TryBlock(_), TryBlock(_))
551551 | (Await(_, _), Await(_, _))
552 | (Gen(_, _, _), Gen(_, _, _))
552 | (Gen(_, _, _, _), Gen(_, _, _, _))
553553 | (Block(_, _), Block(_, _))
554554 | (Closure(_), Closure(_))
555555 | (Match(_, _, _), Match(_, _, _))
src/tools/clippy/clippy_utils/src/ast_utils.rs+1-1
......@@ -226,7 +226,7 @@ pub fn eq_expr(l: &Expr, r: &Expr) -> bool {
226226 && eq_fn_decl(lf, rf)
227227 && eq_expr(le, re)
228228 },
229 (Gen(lc, lb, lk), Gen(rc, rb, rk)) => lc == rc && eq_block(lb, rb) && lk == rk,
229 (Gen(lc, lb, lk, _), Gen(rc, rb, rk, _)) => lc == rc && eq_block(lb, rb) && lk == rk,
230230 (Range(lf, lt, ll), Range(rf, rt, rl)) => ll == rl && eq_expr_opt(lf, rf) && eq_expr_opt(lt, rt),
231231 (AddrOf(lbk, lm, le), AddrOf(rbk, rm, re)) => lbk == rbk && lm == rm && eq_expr(le, re),
232232 (Path(lq, lp), Path(rq, rp)) => both(lq, rq, eq_qself) && eq_path(lp, rp),
src/tools/rustfmt/src/expr.rs+1-1
......@@ -372,7 +372,7 @@ pub(crate) fn format_expr(
372372 ))
373373 }
374374 }
375 ast::ExprKind::Gen(capture_by, ref block, ref kind) => {
375 ast::ExprKind::Gen(capture_by, ref block, ref kind, _) => {
376376 let mover = if matches!(capture_by, ast::CaptureBy::Value { .. }) {
377377 "move "
378378 } else {
tests/codegen/patchable-function-entry/patchable-function-entry-both-flags.rs created+64
......@@ -0,0 +1,64 @@
1//@ compile-flags: -Z patchable-function-entry=15,10
2
3#![feature(patchable_function_entry)]
4#![crate_type = "lib"]
5
6// This should have the default, as set by the compile flags
7#[no_mangle]
8pub fn fun0() {}
9
10// The attribute should override the compile flags
11#[no_mangle]
12#[patchable_function_entry(prefix_nops = 1, entry_nops = 2)]
13pub fn fun1() {}
14
15// If we override an attribute to 0 or unset, the attribute should go away
16#[no_mangle]
17#[patchable_function_entry(entry_nops = 0)]
18pub fn fun2() {}
19
20// The attribute should override the compile flags
21#[no_mangle]
22#[patchable_function_entry(prefix_nops = 20, entry_nops = 1)]
23pub fn fun3() {}
24
25// The attribute should override the compile flags
26#[no_mangle]
27#[patchable_function_entry(prefix_nops = 2, entry_nops = 19)]
28pub fn fun4() {}
29
30// The attribute should override patchable-function-entry to 3 and
31// patchable-function-prefix to the default of 0, clearing it entirely
32#[no_mangle]
33#[patchable_function_entry(entry_nops = 3)]
34pub fn fun5() {}
35
36// The attribute should override patchable-function-prefix to 4
37// and patchable-function-entry to the default of 0, clearing it entirely
38#[no_mangle]
39#[patchable_function_entry(prefix_nops = 4)]
40pub fn fun6() {}
41
42// CHECK: @fun0() unnamed_addr #0
43// CHECK: @fun1() unnamed_addr #1
44// CHECK: @fun2() unnamed_addr #2
45// CHECK: @fun3() unnamed_addr #3
46// CHECK: @fun4() unnamed_addr #4
47// CHECK: @fun5() unnamed_addr #5
48// CHECK: @fun6() unnamed_addr #6
49
50// CHECK: attributes #0 = { {{.*}}"patchable-function-entry"="5"{{.*}}"patchable-function-prefix"="10" {{.*}} }
51// CHECK: attributes #1 = { {{.*}}"patchable-function-entry"="2"{{.*}}"patchable-function-prefix"="1" {{.*}} }
52
53// CHECK-NOT: attributes #2 = { {{.*}}patchable-function-entry{{.*}} }
54// CHECK-NOT: attributes #2 = { {{.*}}patchable-function-prefix{{.*}} }
55// CHECK: attributes #2 = { {{.*}} }
56
57// CHECK: attributes #3 = { {{.*}}"patchable-function-entry"="1"{{.*}}"patchable-function-prefix"="20" {{.*}} }
58// CHECK: attributes #4 = { {{.*}}"patchable-function-entry"="19"{{.*}}"patchable-function-prefix"="2" {{.*}} }
59
60// CHECK: attributes #5 = { {{.*}}"patchable-function-entry"="3"{{.*}} }
61// CHECK-NOT: attributes #5 = { {{.*}}patchable-function-prefix{{.*}} }
62
63// CHECK: attributes #6 = { {{.*}}"patchable-function-prefix"="4"{{.*}} }
64// CHECK-NOT: attributes #6 = { {{.*}}patchable-function-entry{{.*}} }
tests/codegen/patchable-function-entry/patchable-function-entry-no-flag.rs created+39
......@@ -0,0 +1,39 @@
1#![feature(patchable_function_entry)]
2#![crate_type = "lib"]
3
4// No patchable function entry should be set
5#[no_mangle]
6pub fn fun0() {}
7
8// The attribute should work even without compiler flags
9#[no_mangle]
10#[patchable_function_entry(prefix_nops = 1, entry_nops = 2)]
11pub fn fun1() {}
12
13// The attribute should work even without compiler flags
14// and only set patchable-function-entry to 3.
15#[no_mangle]
16#[patchable_function_entry(entry_nops = 3)]
17pub fn fun2() {}
18
19// The attribute should work even without compiler flags
20// and only set patchable-function-prefix to 4.
21#[no_mangle]
22#[patchable_function_entry(prefix_nops = 4)]
23pub fn fun3() {}
24
25// CHECK: @fun0() unnamed_addr #0
26// CHECK: @fun1() unnamed_addr #1
27// CHECK: @fun2() unnamed_addr #2
28// CHECK: @fun3() unnamed_addr #3
29
30// CHECK-NOT: attributes #0 = { {{.*}}patchable-function-entry{{.*}} }
31// CHECK-NOT: attributes #0 = { {{.*}}patchable-function-prefix{{.*}} }
32
33// CHECK: attributes #1 = { {{.*}}"patchable-function-entry"="2"{{.*}}"patchable-function-prefix"="1" {{.*}} }
34
35// CHECK: attributes #2 = { {{.*}}"patchable-function-entry"="3"{{.*}} }
36// CHECK-NOT: attributes #2 = { {{.*}}patchable-function-prefix{{.*}} }
37
38// CHECK: attributes #3 = { {{.*}}"patchable-function-prefix"="4"{{.*}} }
39// CHECK-NOT: attributes #3 = { {{.*}}patchable-function-entry{{.*}} }
tests/codegen/patchable-function-entry/patchable-function-entry-one-flag.rs created+66
......@@ -0,0 +1,66 @@
1//@ compile-flags: -Z patchable-function-entry=15
2
3#![feature(patchable_function_entry)]
4#![crate_type = "lib"]
5
6// This should have the default, as set by the compile flags
7#[no_mangle]
8pub fn fun0() {}
9
10// The attribute should override the compile flags
11#[no_mangle]
12#[patchable_function_entry(prefix_nops = 1, entry_nops = 2)]
13pub fn fun1() {}
14
15// If we override an attribute to 0 or unset, the attribute should go away
16#[no_mangle]
17#[patchable_function_entry(entry_nops = 0)]
18pub fn fun2() {}
19
20// The attribute should override the compile flags
21#[no_mangle]
22#[patchable_function_entry(prefix_nops = 20, entry_nops = 1)]
23pub fn fun3() {}
24
25// The attribute should override the compile flags
26#[no_mangle]
27#[patchable_function_entry(prefix_nops = 2, entry_nops = 19)]
28pub fn fun4() {}
29
30// The attribute should override patchable-function-entry to 3
31// and patchable-function-prefix to the default of 0, clearing it entirely
32#[no_mangle]
33#[patchable_function_entry(entry_nops = 3)]
34pub fn fun5() {}
35
36// The attribute should override patchable-function-prefix to 4
37// and patchable-function-entry to the default of 0, clearing it entirely
38#[no_mangle]
39#[patchable_function_entry(prefix_nops = 4)]
40pub fn fun6() {}
41
42// CHECK: @fun0() unnamed_addr #0
43// CHECK: @fun1() unnamed_addr #1
44// CHECK: @fun2() unnamed_addr #2
45// CHECK: @fun3() unnamed_addr #3
46// CHECK: @fun4() unnamed_addr #4
47// CHECK: @fun5() unnamed_addr #5
48// CHECK: @fun6() unnamed_addr #6
49
50// CHECK: attributes #0 = { {{.*}}"patchable-function-entry"="15" {{.*}} }
51// CHECK-NOT: attributes #0 = { {{.*}}patchable-function-prefix{{.*}} }
52
53// CHECK: attributes #1 = { {{.*}}"patchable-function-entry"="2"{{.*}}"patchable-function-prefix"="1" {{.*}} }
54
55// CHECK-NOT: attributes #2 = { {{.*}}patchable-function-entry{{.*}} }
56// CHECK-NOT: attributes #2 = { {{.*}}patchable-function-prefix{{.*}} }
57// CHECK: attributes #2 = { {{.*}} }
58
59// CHECK: attributes #3 = { {{.*}}"patchable-function-entry"="1"{{.*}}"patchable-function-prefix"="20" {{.*}} }
60// CHECK: attributes #4 = { {{.*}}"patchable-function-entry"="19"{{.*}}"patchable-function-prefix"="2" {{.*}} }
61
62// CHECK: attributes #5 = { {{.*}}"patchable-function-entry"="3"{{.*}} }
63// CHECK-NOT: attributes #5 = { {{.*}}patchable-function-prefix{{.*}} }
64
65// CHECK: attributes #6 = { {{.*}}"patchable-function-prefix"="4"{{.*}} }
66// CHECK-NOT: attributes #6 = { {{.*}}patchable-function-entry{{.*}} }
tests/coverage/issue-83601.cov-map+3-3
......@@ -1,12 +1,12 @@
11Function name: issue_83601::main
2Raw bytes (21): 0x[01, 01, 01, 05, 00, 03, 01, 06, 01, 02, 1c, 05, 03, 09, 01, 1c, 02, 02, 05, 03, 02]
2Raw bytes (21): 0x[01, 01, 01, 05, 09, 03, 01, 06, 01, 02, 1c, 05, 03, 09, 01, 1c, 02, 02, 05, 03, 02]
33Number of files: 1
44- file 0 => global file 1
55Number of expressions: 1
6- expression 0 operands: lhs = Counter(1), rhs = Zero
6- expression 0 operands: lhs = Counter(1), rhs = Counter(2)
77Number of file 0 mappings: 3
88- Code(Counter(0)) at (prev + 6, 1) to (start + 2, 28)
99- Code(Counter(1)) at (prev + 3, 9) to (start + 1, 28)
1010- Code(Expression(0, Sub)) at (prev + 2, 5) to (start + 3, 2)
11 = (c1 - Zero)
11 = (c1 - c2)
1212
tests/coverage/issue-84561.cov-map+7-7
......@@ -54,15 +54,15 @@ Number of file 0 mappings: 1
5454- Code(Counter(0)) at (prev + 167, 9) to (start + 2, 10)
5555
5656Function name: issue_84561::test3
57Raw bytes (375): 0x[01, 01, 31, 05, 00, 0d, 00, 15, 00, 12, 00, 15, 00, 21, 00, 1e, 00, 21, 00, 31, 00, 3d, 00, 2e, 45, 3d, 00, 42, 49, 45, 00, 3f, 51, 42, 49, 45, 00, 7a, 55, 51, 00, 7a, 55, 51, 00, 77, 5d, 7a, 55, 51, 00, 77, 61, 7a, 55, 51, 00, 72, 65, 77, 61, 7a, 55, 51, 00, 75, be, 01, c2, 01, 79, 69, 6d, 69, 6d, 69, 6d, c2, 01, 00, 69, 6d, c2, 01, 79, 69, 6d, bb, 01, 7d, 75, be, 01, c2, 01, 79, 69, 6d, b6, 01, 00, bb, 01, 7d, 75, be, 01, c2, 01, 79, 69, 6d, 33, 01, 08, 01, 03, 1c, 05, 04, 09, 01, 1c, 02, 02, 05, 04, 1f, 0d, 05, 05, 00, 1f, 06, 01, 05, 00, 1f, 15, 01, 09, 01, 1c, 12, 02, 05, 00, 1f, 0e, 01, 05, 00, 0f, 00, 00, 20, 00, 30, 21, 01, 05, 03, 0f, 00, 03, 20, 00, 30, 00, 00, 33, 00, 41, 00, 00, 4b, 00, 5a, 1e, 01, 05, 00, 0f, 00, 05, 09, 03, 10, 00, 05, 0d, 00, 1b, 00, 02, 0d, 00, 1c, 1a, 04, 09, 05, 06, 31, 06, 05, 03, 06, 22, 04, 05, 03, 06, 3d, 04, 09, 04, 06, 2e, 05, 08, 00, 0f, 45, 01, 09, 03, 0a, 2a, 05, 09, 03, 0a, 3f, 05, 08, 00, 0f, 51, 01, 09, 00, 13, 00, 03, 0d, 00, 1d, 3a, 03, 09, 00, 13, 00, 03, 0d, 00, 1d, 77, 03, 05, 00, 0f, 77, 01, 0c, 00, 13, 5d, 01, 0d, 00, 13, 56, 02, 0d, 00, 13, 72, 04, 05, 02, 13, 65, 03, 0d, 00, 13, 6e, 02, 0d, 00, 13, bb, 01, 03, 05, 00, 0f, 69, 01, 0c, 00, 13, 6d, 01, 0d, 03, 0e, 75, 04, 0d, 00, 13, c2, 01, 02, 0d, 00, 17, c2, 01, 01, 14, 00, 1b, 00, 01, 15, 00, 1b, 92, 01, 02, 15, 00, 1b, be, 01, 04, 0d, 00, 13, 7d, 03, 09, 00, 19, b6, 01, 02, 05, 00, 0f, b2, 01, 03, 09, 00, 22, 00, 02, 05, 00, 0f, 00, 03, 09, 00, 2c, 00, 02, 01, 00, 02]
57Raw bytes (375): 0x[01, 01, 31, 05, 09, 0d, 00, 15, 19, 12, 00, 15, 19, 21, 00, 1e, 00, 21, 00, 31, 00, 3d, 00, 2e, 45, 3d, 00, 42, 49, 45, 00, 3f, 51, 42, 49, 45, 00, 7a, 55, 51, 00, 7a, 55, 51, 00, 77, 5d, 7a, 55, 51, 00, 77, 61, 7a, 55, 51, 00, 72, 65, 77, 61, 7a, 55, 51, 00, 75, be, 01, c2, 01, 79, 69, 6d, 69, 6d, 69, 6d, c2, 01, 00, 69, 6d, c2, 01, 79, 69, 6d, bb, 01, 7d, 75, be, 01, c2, 01, 79, 69, 6d, b6, 01, 00, bb, 01, 7d, 75, be, 01, c2, 01, 79, 69, 6d, 33, 01, 08, 01, 03, 1c, 05, 04, 09, 01, 1c, 02, 02, 05, 04, 1f, 0d, 05, 05, 00, 1f, 06, 01, 05, 00, 1f, 15, 01, 09, 01, 1c, 12, 02, 05, 00, 1f, 0e, 01, 05, 00, 0f, 00, 00, 20, 00, 30, 21, 01, 05, 03, 0f, 00, 03, 20, 00, 30, 00, 00, 33, 00, 41, 00, 00, 4b, 00, 5a, 1e, 01, 05, 00, 0f, 00, 05, 09, 03, 10, 00, 05, 0d, 00, 1b, 00, 02, 0d, 00, 1c, 1a, 04, 09, 05, 06, 31, 06, 05, 03, 06, 22, 04, 05, 03, 06, 3d, 04, 09, 04, 06, 2e, 05, 08, 00, 0f, 45, 01, 09, 03, 0a, 2a, 05, 09, 03, 0a, 3f, 05, 08, 00, 0f, 51, 01, 09, 00, 13, 00, 03, 0d, 00, 1d, 3a, 03, 09, 00, 13, 00, 03, 0d, 00, 1d, 77, 03, 05, 00, 0f, 77, 01, 0c, 00, 13, 5d, 01, 0d, 00, 13, 56, 02, 0d, 00, 13, 72, 04, 05, 02, 13, 65, 03, 0d, 00, 13, 6e, 02, 0d, 00, 13, bb, 01, 03, 05, 00, 0f, 69, 01, 0c, 00, 13, 6d, 01, 0d, 03, 0e, 75, 04, 0d, 00, 13, c2, 01, 02, 0d, 00, 17, c2, 01, 01, 14, 00, 1b, 00, 01, 15, 00, 1b, 92, 01, 02, 15, 00, 1b, be, 01, 04, 0d, 00, 13, 7d, 03, 09, 00, 19, b6, 01, 02, 05, 00, 0f, b2, 01, 03, 09, 00, 22, 00, 02, 05, 00, 0f, 00, 03, 09, 00, 2c, 00, 02, 01, 00, 02]
5858Number of files: 1
5959- file 0 => global file 1
6060Number of expressions: 49
61- expression 0 operands: lhs = Counter(1), rhs = Zero
61- expression 0 operands: lhs = Counter(1), rhs = Counter(2)
6262- expression 1 operands: lhs = Counter(3), rhs = Zero
63- expression 2 operands: lhs = Counter(5), rhs = Zero
63- expression 2 operands: lhs = Counter(5), rhs = Counter(6)
6464- expression 3 operands: lhs = Expression(4, Sub), rhs = Zero
65- expression 4 operands: lhs = Counter(5), rhs = Zero
65- expression 4 operands: lhs = Counter(5), rhs = Counter(6)
6666- expression 5 operands: lhs = Counter(8), rhs = Zero
6767- expression 6 operands: lhs = Expression(7, Sub), rhs = Zero
6868- expression 7 operands: lhs = Counter(8), rhs = Zero
......@@ -111,15 +111,15 @@ Number of file 0 mappings: 51
111111- Code(Counter(0)) at (prev + 8, 1) to (start + 3, 28)
112112- Code(Counter(1)) at (prev + 4, 9) to (start + 1, 28)
113113- Code(Expression(0, Sub)) at (prev + 2, 5) to (start + 4, 31)
114 = (c1 - Zero)
114 = (c1 - c2)
115115- Code(Counter(3)) at (prev + 5, 5) to (start + 0, 31)
116116- Code(Expression(1, Sub)) at (prev + 1, 5) to (start + 0, 31)
117117 = (c3 - Zero)
118118- Code(Counter(5)) at (prev + 1, 9) to (start + 1, 28)
119119- Code(Expression(4, Sub)) at (prev + 2, 5) to (start + 0, 31)
120 = (c5 - Zero)
120 = (c5 - c6)
121121- Code(Expression(3, Sub)) at (prev + 1, 5) to (start + 0, 15)
122 = ((c5 - Zero) - Zero)
122 = ((c5 - c6) - Zero)
123123- Code(Zero) at (prev + 0, 32) to (start + 0, 48)
124124- Code(Counter(8)) at (prev + 1, 5) to (start + 3, 15)
125125- Code(Zero) at (prev + 3, 32) to (start + 0, 48)
tests/ui-fulldeps/stable-mir/check_attribute.rs created+155
......@@ -0,0 +1,155 @@
1//@ run-pass
2//! Test information regarding type layout.
3
4//@ ignore-stage1
5//@ ignore-cross-compile
6//@ ignore-remote
7//@ ignore-windows-gnu mingw has troubles with linking https://github.com/rust-lang/rust/pull/116837
8
9#![feature(rustc_private)]
10#![feature(control_flow_enum)]
11
12extern crate rustc_hir;
13#[macro_use]
14extern crate rustc_smir;
15extern crate rustc_driver;
16extern crate rustc_interface;
17extern crate stable_mir;
18
19use rustc_smir::rustc_internal;
20use stable_mir::{CrateDef, CrateItems};
21use std::io::Write;
22use std::ops::ControlFlow;
23
24const CRATE_NAME: &str = "input";
25
26/// This function uses the Stable MIR APIs to get information about the test crate.
27fn test_stable_mir() -> ControlFlow<()> {
28 // Find items in the local crate.
29 let items = stable_mir::all_local_items();
30
31 test_builtins(&items);
32 test_derive(&items);
33 test_tool(&items);
34 test_all_attrs(&items);
35
36 ControlFlow::Continue(())
37}
38
39// Test built-in attributes.
40fn test_builtins(items: &CrateItems) {
41 let target_fn = *get_item(&items, "builtins_fn").unwrap();
42 let allow_attrs = target_fn.attrs_by_path(&["allow".to_string()]);
43 assert_eq!(allow_attrs[0].as_str(), "#![allow(unused_variables)]");
44
45 let inline_attrs = target_fn.attrs_by_path(&["inline".to_string()]);
46 assert_eq!(inline_attrs[0].as_str(), "#[inline]");
47
48 let deprecated_attrs = target_fn.attrs_by_path(&["deprecated".to_string()]);
49 assert_eq!(deprecated_attrs[0].as_str(), "#[deprecated(since = \"5.2.0\")]");
50}
51
52// Test derive attribute.
53fn test_derive(items: &CrateItems) {
54 let target_struct = *get_item(&items, "Foo").unwrap();
55 let attrs = target_struct.attrs_by_path(&["derive".to_string()]);
56 // No `derive` attribute since it's expanded before MIR.
57 assert_eq!(attrs.len(), 0);
58
59 // Check derived trait method's attributes.
60 let derived_fmt = *get_item(&items, "<Foo as std::fmt::Debug>::fmt").unwrap();
61 // The Rust reference lies about this attribute. It doesn't show up in `clone` or `fmt` impl.
62 let _fmt_attrs = derived_fmt.attrs_by_path(&["automatically_derived".to_string()]);
63}
64
65// Test tool attributes.
66fn test_tool(items: &CrateItems) {
67 let rustfmt_fn = *get_item(&items, "do_not_format").unwrap();
68 let rustfmt_attrs = rustfmt_fn.attrs_by_path(&["rustfmt".to_string(), "skip".to_string()]);
69 assert_eq!(rustfmt_attrs[0].as_str(), "#[rustfmt::skip]");
70
71 let clippy_fn = *get_item(&items, "complex_fn").unwrap();
72 let clippy_attrs = clippy_fn.attrs_by_path(&["clippy".to_string(),
73 "cyclomatic_complexity".to_string()]);
74 assert_eq!(clippy_attrs[0].as_str(), "#[clippy::cyclomatic_complexity = \"100\"]");
75}
76
77fn test_all_attrs(items: &CrateItems) {
78 let target_fn = *get_item(&items, "many_attrs").unwrap();
79 let all_attrs = target_fn.all_attrs();
80 assert_eq!(all_attrs[0].as_str(), "#[inline]");
81 assert_eq!(all_attrs[1].as_str(), "#[allow(unused_variables)]");
82 assert_eq!(all_attrs[2].as_str(), "#[allow(dead_code)]");
83 assert_eq!(all_attrs[3].as_str(), "#[allow(unused_imports)]");
84 assert_eq!(all_attrs[4].as_str(), "#![allow(clippy::filter_map)]");
85}
86
87
88fn get_item<'a>(
89 items: &'a CrateItems,
90 name: &str,
91) -> Option<&'a stable_mir::CrateItem> {
92 items.iter().find(|crate_item| crate_item.name() == name)
93}
94
95/// This test will generate and analyze a dummy crate using the stable mir.
96/// For that, it will first write the dummy crate into a file.
97/// Then it will create a `StableMir` using custom arguments and then
98/// it will run the compiler.
99fn main() {
100 let path = "attribute_input.rs";
101 generate_input(&path).unwrap();
102 let args = vec![
103 "rustc".to_string(),
104 "--crate-type=lib".to_string(),
105 "--crate-name".to_string(),
106 CRATE_NAME.to_string(),
107 path.to_string(),
108 ];
109 run!(args, test_stable_mir).unwrap();
110}
111
112fn generate_input(path: &str) -> std::io::Result<()> {
113 let mut file = std::fs::File::create(path)?;
114 write!(
115 file,
116 r#"
117 // General metadata applied to the enclosing module or crate.
118 #![crate_type = "lib"]
119
120 // Mixed inner and outer attributes.
121 #[inline]
122 #[deprecated(since = "5.2.0")]
123 fn builtins_fn() {{
124 #![allow(unused_variables)]
125
126 let x = ();
127 let y = ();
128 let z = ();
129 }}
130
131 // A derive attribute to automatically implement a trait.
132 #[derive(Debug, Clone, Copy)]
133 struct Foo(u32);
134
135 // A rustfmt tool attribute.
136 #[rustfmt::skip]
137 fn do_not_format() {{}}
138
139 // A clippy tool attribute.
140 #[clippy::cyclomatic_complexity = "100"]
141 pub fn complex_fn() {{}}
142
143 // A function with many attributes.
144 #[inline]
145 #[allow(unused_variables)]
146 #[allow(dead_code)]
147 #[allow(unused_imports)]
148 fn many_attrs() {{
149 #![allow(clippy::filter_map)]
150 todo!()
151 }}
152 "#
153 )?;
154 Ok(())
155}
tests/ui/async-await/async-block-control-flow-static-semantics.stderr+12-14
......@@ -1,20 +1,18 @@
11error[E0267]: `break` inside `async` block
22 --> $DIR/async-block-control-flow-static-semantics.rs:32:9
33 |
4LL | / async {
5LL | | break 0u8;
6 | | ^^^^^^^^^ cannot `break` inside `async` block
7LL | | };
8 | |_____- enclosing `async` block
4LL | async {
5 | ----- enclosing `async` block
6LL | break 0u8;
7 | ^^^^^^^^^ cannot `break` inside `async` block
98
109error[E0267]: `break` inside `async` block
1110 --> $DIR/async-block-control-flow-static-semantics.rs:39:13
1211 |
13LL | / async {
14LL | | break 0u8;
15 | | ^^^^^^^^^ cannot `break` inside `async` block
16LL | | };
17 | |_________- enclosing `async` block
12LL | async {
13 | ----- enclosing `async` block
14LL | break 0u8;
15 | ^^^^^^^^^ cannot `break` inside `async` block
1816
1917error[E0308]: mismatched types
2018 --> $DIR/async-block-control-flow-static-semantics.rs:21:58
......@@ -29,13 +27,13 @@ LL | |
2927LL | | }
3028 | |_^ expected `u8`, found `()`
3129
32error[E0271]: expected `{async block@$DIR/async-block-control-flow-static-semantics.rs:23:17: 25:6}` to be a future that resolves to `()`, but it resolves to `u8`
30error[E0271]: expected `{async block@$DIR/async-block-control-flow-static-semantics.rs:23:17: 23:22}` to be a future that resolves to `()`, but it resolves to `u8`
3331 --> $DIR/async-block-control-flow-static-semantics.rs:26:39
3432 |
3533LL | let _: &dyn Future<Output = ()> = &block;
3634 | ^^^^^^ expected `()`, found `u8`
3735 |
38 = note: required for the cast from `&{async block@$DIR/async-block-control-flow-static-semantics.rs:23:17: 25:6}` to `&dyn Future<Output = ()>`
36 = note: required for the cast from `&{async block@$DIR/async-block-control-flow-static-semantics.rs:23:17: 23:22}` to `&dyn Future<Output = ()>`
3937
4038error[E0308]: mismatched types
4139 --> $DIR/async-block-control-flow-static-semantics.rs:12:43
......@@ -45,13 +43,13 @@ LL | fn return_targets_async_block_not_fn() -> u8 {
4543 | |
4644 | implicitly returns `()` as its body has no tail or `return` expression
4745
48error[E0271]: expected `{async block@$DIR/async-block-control-flow-static-semantics.rs:14:17: 16:6}` to be a future that resolves to `()`, but it resolves to `u8`
46error[E0271]: expected `{async block@$DIR/async-block-control-flow-static-semantics.rs:14:17: 14:22}` to be a future that resolves to `()`, but it resolves to `u8`
4947 --> $DIR/async-block-control-flow-static-semantics.rs:17:39
5048 |
5149LL | let _: &dyn Future<Output = ()> = &block;
5250 | ^^^^^^ expected `()`, found `u8`
5351 |
54 = note: required for the cast from `&{async block@$DIR/async-block-control-flow-static-semantics.rs:14:17: 16:6}` to `&dyn Future<Output = ()>`
52 = note: required for the cast from `&{async block@$DIR/async-block-control-flow-static-semantics.rs:14:17: 14:22}` to `&dyn Future<Output = ()>`
5553
5654error[E0308]: mismatched types
5755 --> $DIR/async-block-control-flow-static-semantics.rs:49:44
tests/ui/async-await/async-borrowck-escaping-block-error.stderr+4-6
......@@ -2,9 +2,8 @@ error[E0373]: async block may outlive the current function, but it borrows `x`,
22 --> $DIR/async-borrowck-escaping-block-error.rs:6:14
33 |
44LL | Box::new(async { x } )
5 | ^^^^^^^^-^^
6 | | |
7 | | `x` is borrowed here
5 | ^^^^^ - `x` is borrowed here
6 | |
87 | may outlive borrowed value `x`
98 |
109note: async block is returned here
......@@ -21,9 +20,8 @@ error[E0373]: async block may outlive the current function, but it borrows `x`,
2120 --> $DIR/async-borrowck-escaping-block-error.rs:11:5
2221 |
2322LL | async { *x }
24 | ^^^^^^^^--^^
25 | | |
26 | | `x` is borrowed here
23 | ^^^^^ -- `x` is borrowed here
24 | |
2725 | may outlive borrowed value `x`
2826 |
2927note: async block is returned here
tests/ui/async-await/async-closures/wrong-fn-kind.stderr+11-13
......@@ -22,20 +22,18 @@ LL | fn needs_async_fn(_: impl async Fn()) {}
2222error[E0596]: cannot borrow `x` as mutable, as it is a captured variable in a `Fn` closure
2323 --> $DIR/wrong-fn-kind.rs:9:20
2424 |
25LL | fn needs_async_fn(_: impl async Fn()) {}
26 | --------------- change this to accept `FnMut` instead of `Fn`
25LL | fn needs_async_fn(_: impl async Fn()) {}
26 | --------------- change this to accept `FnMut` instead of `Fn`
2727...
28LL | needs_async_fn(async || {
29 | -------------- ^-------
30 | | |
31 | _____|______________in this closure
32 | | |
33 | | expects `Fn` instead of `FnMut`
34LL | |
35LL | | x += 1;
36 | | - mutable borrow occurs due to use of `x` in closure
37LL | | });
38 | |_____^ cannot borrow as mutable
28LL | needs_async_fn(async || {
29 | -------------- ^^^^^^^^
30 | | |
31 | | cannot borrow as mutable
32 | | in this closure
33 | expects `Fn` instead of `FnMut`
34LL |
35LL | x += 1;
36 | - mutable borrow occurs due to use of `x` in closure
3937
4038error: aborting due to 2 previous errors
4139
tests/ui/async-await/async-is-unwindsafe.stderr+12-13
......@@ -1,20 +1,19 @@
11error[E0277]: the type `&mut Context<'_>` may not be safely transferred across an unwind boundary
22 --> $DIR/async-is-unwindsafe.rs:12:5
33 |
4LL | is_unwindsafe(async {
5 | ______^ -
6 | | ___________________|
7LL | ||
8LL | || use std::ptr::null;
9LL | || use std::task::{Context, RawWaker, RawWakerVTable, Waker};
10... ||
11LL | || drop(cx_ref);
12LL | || });
13 | ||_____-^ `&mut Context<'_>` may not be safely transferred across an unwind boundary
14 | |_____|
15 | within this `{async block@$DIR/async-is-unwindsafe.rs:12:19: 29:6}`
4LL | is_unwindsafe(async {
5 | ^ ----- within this `{async block@$DIR/async-is-unwindsafe.rs:12:19: 12:24}`
6 | _____|
7 | |
8LL | |
9LL | | use std::ptr::null;
10LL | | use std::task::{Context, RawWaker, RawWakerVTable, Waker};
11... |
12LL | | drop(cx_ref);
13LL | | });
14 | |______^ `&mut Context<'_>` may not be safely transferred across an unwind boundary
1615 |
17 = help: within `{async block@$DIR/async-is-unwindsafe.rs:12:19: 29:6}`, the trait `UnwindSafe` is not implemented for `&mut Context<'_>`, which is required by `{async block@$DIR/async-is-unwindsafe.rs:12:19: 29:6}: UnwindSafe`
16 = help: within `{async block@$DIR/async-is-unwindsafe.rs:12:19: 12:24}`, the trait `UnwindSafe` is not implemented for `&mut Context<'_>`, which is required by `{async block@$DIR/async-is-unwindsafe.rs:12:19: 12:24}: UnwindSafe`
1817 = note: `UnwindSafe` is implemented for `&Context<'_>`, but not for `&mut Context<'_>`
1918note: future does not implement `UnwindSafe` as this value is used across an await
2019 --> $DIR/async-is-unwindsafe.rs:25:18
tests/ui/async-await/coroutine-desc.stderr+2-2
......@@ -8,8 +8,8 @@ LL | fun(async {}, async {});
88 | | expected all arguments to be this `async` block type because they need to match the type of this parameter
99 | arguments to this function are incorrect
1010 |
11 = note: expected `async` block `{async block@$DIR/coroutine-desc.rs:10:9: 10:17}`
12 found `async` block `{async block@$DIR/coroutine-desc.rs:10:19: 10:27}`
11 = note: expected `async` block `{async block@$DIR/coroutine-desc.rs:10:9: 10:14}`
12 found `async` block `{async block@$DIR/coroutine-desc.rs:10:19: 10:24}`
1313 = note: no two async blocks, even if identical, have the same type
1414 = help: consider pinning your async block and casting it to a trait object
1515note: function defined here
tests/ui/async-await/coroutine-not-future.stderr+2-2
......@@ -26,11 +26,11 @@ note: required by a bound in `takes_coroutine`
2626LL | fn takes_coroutine<ResumeTy>(_g: impl Coroutine<ResumeTy, Yield = (), Return = ()>) {}
2727 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `takes_coroutine`
2828
29error[E0277]: the trait bound `{async block@$DIR/coroutine-not-future.rs:39:21: 39:29}: Coroutine<_>` is not satisfied
29error[E0277]: the trait bound `{async block@$DIR/coroutine-not-future.rs:39:21: 39:26}: Coroutine<_>` is not satisfied
3030 --> $DIR/coroutine-not-future.rs:39:21
3131 |
3232LL | takes_coroutine(async {});
33 | --------------- ^^^^^^^^ the trait `Coroutine<_>` is not implemented for `{async block@$DIR/coroutine-not-future.rs:39:21: 39:29}`
33 | --------------- ^^^^^^^^ the trait `Coroutine<_>` is not implemented for `{async block@$DIR/coroutine-not-future.rs:39:21: 39:26}`
3434 | |
3535 | required by a bound introduced by this call
3636 |
tests/ui/async-await/issue-67252-unnamed-future.stderr+1-1
......@@ -8,7 +8,7 @@ LL | | let _a = a;
88LL | | });
99 | |______^ future created by async block is not `Send`
1010 |
11 = help: within `{async block@$DIR/issue-67252-unnamed-future.rs:18:11: 22:6}`, the trait `Send` is not implemented for `*mut ()`, which is required by `{async block@$DIR/issue-67252-unnamed-future.rs:18:11: 22:6}: Send`
11 = help: within `{async block@$DIR/issue-67252-unnamed-future.rs:18:11: 18:16}`, the trait `Send` is not implemented for `*mut ()`, which is required by `{async block@$DIR/issue-67252-unnamed-future.rs:18:11: 18:16}: Send`
1212note: future is not `Send` as this value is used across an await
1313 --> $DIR/issue-67252-unnamed-future.rs:20:17
1414 |
tests/ui/async-await/issue-68112.stderr+5-10
......@@ -4,7 +4,7 @@ error: future cannot be sent between threads safely
44LL | require_send(send_fut);
55 | ^^^^^^^^^^^^^^^^^^^^^^ future created by async block is not `Send`
66 |
7 = help: the trait `Sync` is not implemented for `RefCell<i32>`, which is required by `{async block@$DIR/issue-68112.rs:29:20: 33:6}: Send`
7 = help: the trait `Sync` is not implemented for `RefCell<i32>`, which is required by `{async block@$DIR/issue-68112.rs:29:20: 29:25}: Send`
88 = note: if you want to do aliasing and mutation between multiple threads, use `std::sync::RwLock` instead
99note: future is not `Send` as it awaits another future which is not `Send`
1010 --> $DIR/issue-68112.rs:31:17
......@@ -23,7 +23,7 @@ error: future cannot be sent between threads safely
2323LL | require_send(send_fut);
2424 | ^^^^^^^^^^^^^^^^^^^^^^ future created by async block is not `Send`
2525 |
26 = help: the trait `Sync` is not implemented for `RefCell<i32>`, which is required by `{async block@$DIR/issue-68112.rs:39:20: 42:6}: Send`
26 = help: the trait `Sync` is not implemented for `RefCell<i32>`, which is required by `{async block@$DIR/issue-68112.rs:39:20: 39:25}: Send`
2727 = note: if you want to do aliasing and mutation between multiple threads, use `std::sync::RwLock` instead
2828note: future is not `Send` as it awaits another future which is not `Send`
2929 --> $DIR/issue-68112.rs:40:17
......@@ -42,7 +42,7 @@ error[E0277]: `RefCell<i32>` cannot be shared between threads safely
4242LL | require_send(send_fut);
4343 | ^^^^^^^^^^^^^^^^^^^^^^ `RefCell<i32>` cannot be shared between threads safely
4444 |
45 = help: the trait `Sync` is not implemented for `RefCell<i32>`, which is required by `{async block@$DIR/issue-68112.rs:57:20: 61:6}: Send`
45 = help: the trait `Sync` is not implemented for `RefCell<i32>`, which is required by `{async block@$DIR/issue-68112.rs:57:20: 57:25}: Send`
4646 = note: if you want to do aliasing and mutation between multiple threads, use `std::sync::RwLock` instead
4747 = note: required for `Arc<RefCell<i32>>` to implement `Send`
4848note: required because it's used within this `async` fn body
......@@ -61,13 +61,8 @@ LL | fn make_non_send_future2() -> impl Future<Output = Arc<RefCell<i32>>> {
6161note: required because it's used within this `async` block
6262 --> $DIR/issue-68112.rs:57:20
6363 |
64LL | let send_fut = async {
65 | ____________________^
66LL | | let non_send_fut = make_non_send_future2();
67LL | | let _ = non_send_fut.await;
68LL | | ready(0).await;
69LL | | };
70 | |_____^
64LL | let send_fut = async {
65 | ^^^^^
7166note: required by a bound in `require_send`
7267 --> $DIR/issue-68112.rs:11:25
7368 |
tests/ui/async-await/issue-70935-complex-spans.stderr+6-14
......@@ -4,7 +4,7 @@ error[E0277]: `*mut ()` cannot be shared between threads safely
44LL | fn foo(x: NotSync) -> impl Future + Send {
55 | ^^^^^^^^^^^^^^^^^^ `*mut ()` cannot be shared between threads safely
66 |
7 = help: within `NotSync`, the trait `Sync` is not implemented for `*mut ()`, which is required by `{async block@$DIR/issue-70935-complex-spans.rs:18:5: 22:6}: Send`
7 = help: within `NotSync`, the trait `Sync` is not implemented for `*mut ()`, which is required by `{async block@$DIR/issue-70935-complex-spans.rs:18:5: 18:15}: Send`
88note: required because it appears within the type `PhantomData<*mut ()>`
99 --> $SRC_DIR/core/src/marker.rs:LL:COL
1010note: required because it appears within the type `NotSync`
......@@ -28,12 +28,8 @@ LL | | }
2828note: required because it's used within this `async` block
2929 --> $DIR/issue-70935-complex-spans.rs:18:5
3030 |
31LL | / async move {
32LL | | baz(|| async {
33LL | | foo(x.clone());
34LL | | }).await;
35LL | | }
36 | |_____^
31LL | async move {
32 | ^^^^^^^^^^
3733
3834error[E0277]: `*mut ()` cannot be shared between threads safely
3935 --> $DIR/issue-70935-complex-spans.rs:15:23
......@@ -41,7 +37,7 @@ error[E0277]: `*mut ()` cannot be shared between threads safely
4137LL | fn foo(x: NotSync) -> impl Future + Send {
4238 | ^^^^^^^^^^^^^^^^^^ `*mut ()` cannot be shared between threads safely
4339 |
44 = help: within `NotSync`, the trait `Sync` is not implemented for `*mut ()`, which is required by `{async block@$DIR/issue-70935-complex-spans.rs:18:5: 22:6}: Send`
40 = help: within `NotSync`, the trait `Sync` is not implemented for `*mut ()`, which is required by `{async block@$DIR/issue-70935-complex-spans.rs:18:5: 18:15}: Send`
4541note: required because it appears within the type `PhantomData<*mut ()>`
4642 --> $SRC_DIR/core/src/marker.rs:LL:COL
4743note: required because it appears within the type `NotSync`
......@@ -65,12 +61,8 @@ LL | | }
6561note: required because it's used within this `async` block
6662 --> $DIR/issue-70935-complex-spans.rs:18:5
6763 |
68LL | / async move {
69LL | | baz(|| async {
70LL | | foo(x.clone());
71LL | | }).await;
72LL | | }
73 | |_____^
64LL | async move {
65 | ^^^^^^^^^^
7466 = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
7567
7668error: aborting due to 2 previous errors
tests/ui/async-await/issue-74072-lifetime-name-annotations.stderr+8-6
......@@ -13,14 +13,15 @@ LL | y
1313error[E0506]: cannot assign to `*x` because it is borrowed
1414 --> $DIR/issue-74072-lifetime-name-annotations.rs:18:9
1515 |
16LL | (async move || {
17 | - return type of async closure is &'1 i32
18...
1619LL | let y = &*x;
1720 | --- `*x` is borrowed here
1821LL | *x += 1;
1922 | ^^^^^^^ `*x` is assigned to here but it was already borrowed
2023LL | y
2124 | - returning this value requires that `*x` is borrowed for `'1`
22LL | })()
23 | - return type of async closure is &'1 i32
2425
2526error: lifetime may not live long enough
2627 --> $DIR/issue-74072-lifetime-name-annotations.rs:14:20
......@@ -61,14 +62,15 @@ LL | }
6162error[E0506]: cannot assign to `*x` because it is borrowed
6263 --> $DIR/issue-74072-lifetime-name-annotations.rs:28:9
6364 |
65LL | (async move || -> &i32 {
66 | - return type of async closure is &'1 i32
67...
6468LL | let y = &*x;
6569 | --- `*x` is borrowed here
6670LL | *x += 1;
6771 | ^^^^^^^ `*x` is assigned to here but it was already borrowed
6872LL | y
6973 | - returning this value requires that `*x` is borrowed for `'1`
70LL | })()
71 | - return type of async closure is &'1 i32
7274
7375error: lifetime may not live long enough
7476 --> $DIR/issue-74072-lifetime-name-annotations.rs:24:28
......@@ -109,14 +111,14 @@ LL | }
109111error[E0506]: cannot assign to `*x` because it is borrowed
110112 --> $DIR/issue-74072-lifetime-name-annotations.rs:36:9
111113 |
114LL | async move {
115 | - return type of async block is &'1 i32
112116LL | let y = &*x;
113117 | --- `*x` is borrowed here
114118LL | *x += 1;
115119 | ^^^^^^^ `*x` is assigned to here but it was already borrowed
116120LL | y
117121 | - returning this value requires that `*x` is borrowed for `'1`
118LL | }
119 | - return type of async block is &'1 i32
120122
121123error: aborting due to 8 previous errors
122124
tests/ui/async-await/issue-86507.stderr+1-1
......@@ -13,7 +13,7 @@ note: captured value is not `Send` because `&` references cannot be sent unless
1313 |
1414LL | let x = x;
1515 | ^ has type `&T` which is not `Send`, because `T` is not `Sync`
16 = note: required for the cast from `Pin<Box<{async block@$DIR/issue-86507.rs:18:17: 20:18}>>` to `Pin<Box<(dyn Future<Output = ()> + Send + 'async_trait)>>`
16 = note: required for the cast from `Pin<Box<{async block@$DIR/issue-86507.rs:18:17: 18:27}>>` to `Pin<Box<(dyn Future<Output = ()> + Send + 'async_trait)>>`
1717help: consider further restricting this bound
1818 |
1919LL | fn bar<'me, 'async_trait, T: Send + std::marker::Sync>(x: &'me T)
tests/ui/async-await/issues/issue-78938-async-block.stderr+4-6
......@@ -1,12 +1,10 @@
11error[E0373]: async block may outlive the current function, but it borrows `room_ref`, which is owned by the current function
22 --> $DIR/issue-78938-async-block.rs:8:33
33 |
4LL | let gameloop_handle = spawn(async {
5 | _________________________________^
6LL | | game_loop(Arc::clone(&room_ref))
7 | | -------- `room_ref` is borrowed here
8LL | | });
9 | |_____^ may outlive borrowed value `room_ref`
4LL | let gameloop_handle = spawn(async {
5 | ^^^^^ may outlive borrowed value `room_ref`
6LL | game_loop(Arc::clone(&room_ref))
7 | -------- `room_ref` is borrowed here
108 |
119 = note: async blocks are not executed immediately and must either take a reference or ownership of outside variables they use
1210help: to force the async block to take ownership of `room_ref` (and any other referenced variables), use the `move` keyword
tests/ui/async-await/track-caller/async-closure-gate.afn.stderr+2-2
......@@ -72,7 +72,7 @@ LL | | }
7272 | |_____^ expected `()`, found `async` block
7373 |
7474 = note: expected unit type `()`
75 found `async` block `{async block@$DIR/async-closure-gate.rs:27:5: 32:6}`
75 found `async` block `{async block@$DIR/async-closure-gate.rs:27:5: 27:10}`
7676
7777error[E0308]: mismatched types
7878 --> $DIR/async-closure-gate.rs:44:5
......@@ -89,7 +89,7 @@ LL | | }
8989 | |_____^ expected `()`, found `async` block
9090 |
9191 = note: expected unit type `()`
92 found `async` block `{async block@$DIR/async-closure-gate.rs:44:5: 51:6}`
92 found `async` block `{async block@$DIR/async-closure-gate.rs:44:5: 44:10}`
9393
9494error: aborting due to 8 previous errors
9595
tests/ui/async-await/track-caller/async-closure-gate.nofeat.stderr+2-2
......@@ -72,7 +72,7 @@ LL | | }
7272 | |_____^ expected `()`, found `async` block
7373 |
7474 = note: expected unit type `()`
75 found `async` block `{async block@$DIR/async-closure-gate.rs:27:5: 32:6}`
75 found `async` block `{async block@$DIR/async-closure-gate.rs:27:5: 27:10}`
7676
7777error[E0308]: mismatched types
7878 --> $DIR/async-closure-gate.rs:44:5
......@@ -89,7 +89,7 @@ LL | | }
8989 | |_____^ expected `()`, found `async` block
9090 |
9191 = note: expected unit type `()`
92 found `async` block `{async block@$DIR/async-closure-gate.rs:44:5: 51:6}`
92 found `async` block `{async block@$DIR/async-closure-gate.rs:44:5: 44:10}`
9393
9494error: aborting due to 8 previous errors
9595
tests/ui/async-await/try-on-option-in-async.stderr+5-7
......@@ -1,13 +1,11 @@
11error[E0277]: the `?` operator can only be used in an async block that returns `Result` or `Option` (or another type that implements `FromResidual`)
22 --> $DIR/try-on-option-in-async.rs:8:10
33 |
4LL | / async {
5LL | | let x: Option<u32> = None;
6LL | | x?;
7 | | ^ cannot use the `?` operator in an async block that returns `{integer}`
8LL | | 22
9LL | | }
10 | |_____- this function should return `Result` or `Option` to accept `?`
4LL | async {
5 | ----- this function should return `Result` or `Option` to accept `?`
6LL | let x: Option<u32> = None;
7LL | x?;
8 | ^ cannot use the `?` operator in an async block that returns `{integer}`
119 |
1210 = help: the trait `FromResidual<Option<Infallible>>` is not implemented for `{integer}`
1311
tests/ui/borrowck/cloning-in-async-block-121547.stderr+8-10
......@@ -1,16 +1,14 @@
11error[E0382]: use of moved value: `value`
22 --> $DIR/cloning-in-async-block-121547.rs:5:9
33 |
4LL | async fn clone_async_block(value: String) {
5 | ----- move occurs because `value` has type `String`, which does not implement the `Copy` trait
6LL | for _ in 0..10 {
7 | -------------- inside of this loop
8LL | / async {
9LL | | drop(value);
10 | | ----- use occurs due to use in coroutine
11LL | |
12LL | | }.await
13 | |_________^ value moved here, in previous iteration of loop
4LL | async fn clone_async_block(value: String) {
5 | ----- move occurs because `value` has type `String`, which does not implement the `Copy` trait
6LL | for _ in 0..10 {
7 | -------------- inside of this loop
8LL | async {
9 | ^^^^^ value moved here, in previous iteration of loop
10LL | drop(value);
11 | ----- use occurs due to use in coroutine
1412 |
1513help: consider cloning the value if the performance cost is acceptable
1614 |
tests/ui/coroutine/break-inside-coroutine-issue-124495.stderr+20-30
......@@ -1,67 +1,57 @@
11error[E0267]: `break` inside `async` function
22 --> $DIR/break-inside-coroutine-issue-124495.rs:8:5
33 |
4LL | async fn async_fn() {
5 | _____________________-
6LL | | break;
7 | | ^^^^^ cannot `break` inside `async` function
8LL | | }
9 | |_- enclosing `async` function
4LL | async fn async_fn() {
5 | ------------------- enclosing `async` function
6LL | break;
7 | ^^^^^ cannot `break` inside `async` function
108
119error[E0267]: `break` inside `gen` function
1210 --> $DIR/break-inside-coroutine-issue-124495.rs:12:5
1311 |
14LL | gen fn gen_fn() {
15 | _________________-
16LL | | break;
17 | | ^^^^^ cannot `break` inside `gen` function
18LL | | }
19 | |_- enclosing `gen` function
12LL | gen fn gen_fn() {
13 | --------------- enclosing `gen` function
14LL | break;
15 | ^^^^^ cannot `break` inside `gen` function
2016
2117error[E0267]: `break` inside `async gen` function
2218 --> $DIR/break-inside-coroutine-issue-124495.rs:16:5
2319 |
24LL | async gen fn async_gen_fn() {
25 | _____________________________-
26LL | | break;
27 | | ^^^^^ cannot `break` inside `async gen` function
28LL | | }
29 | |_- enclosing `async gen` function
20LL | async gen fn async_gen_fn() {
21 | --------------------------- enclosing `async gen` function
22LL | break;
23 | ^^^^^ cannot `break` inside `async gen` function
3024
3125error[E0267]: `break` inside `async` block
3226 --> $DIR/break-inside-coroutine-issue-124495.rs:20:21
3327 |
3428LL | let _ = async { break; };
35 | --------^^^^^---
36 | | |
37 | | cannot `break` inside `async` block
29 | ----- ^^^^^ cannot `break` inside `async` block
30 | |
3831 | enclosing `async` block
3932
4033error[E0267]: `break` inside `async` closure
4134 --> $DIR/break-inside-coroutine-issue-124495.rs:22:24
4235 |
4336LL | let _ = async || { break; };
44 | -----------^^^^^---
45 | | |
46 | | cannot `break` inside `async` closure
37 | -------- ^^^^^ cannot `break` inside `async` closure
38 | |
4739 | enclosing `async` closure
4840
4941error[E0267]: `break` inside `gen` block
5042 --> $DIR/break-inside-coroutine-issue-124495.rs:24:19
5143 |
5244LL | let _ = gen { break; };
53 | ------^^^^^---
54 | | |
55 | | cannot `break` inside `gen` block
45 | --- ^^^^^ cannot `break` inside `gen` block
46 | |
5647 | enclosing `gen` block
5748
5849error[E0267]: `break` inside `async gen` block
5950 --> $DIR/break-inside-coroutine-issue-124495.rs:26:25
6051 |
6152LL | let _ = async gen { break; };
62 | ------------^^^^^---
63 | | |
64 | | cannot `break` inside `async gen` block
53 | --------- ^^^^^ cannot `break` inside `async gen` block
54 | |
6555 | enclosing `async gen` block
6656
6757error: aborting due to 7 previous errors
tests/ui/coroutine/clone-impl-async.stderr+12-12
......@@ -1,8 +1,8 @@
1error[E0277]: the trait bound `{async block@$DIR/clone-impl-async.rs:12:27: 16:6}: Copy` is not satisfied
1error[E0277]: the trait bound `{async block@$DIR/clone-impl-async.rs:12:27: 12:32}: Copy` is not satisfied
22 --> $DIR/clone-impl-async.rs:17:16
33 |
44LL | check_copy(&inner_non_clone);
5 | ---------- ^^^^^^^^^^^^^^^^ the trait `Copy` is not implemented for `{async block@$DIR/clone-impl-async.rs:12:27: 16:6}`
5 | ---------- ^^^^^^^^^^^^^^^^ the trait `Copy` is not implemented for `{async block@$DIR/clone-impl-async.rs:12:27: 12:32}`
66 | |
77 | required by a bound introduced by this call
88 |
......@@ -12,11 +12,11 @@ note: required by a bound in `check_copy`
1212LL | fn check_copy<T: Copy>(_x: &T) {}
1313 | ^^^^ required by this bound in `check_copy`
1414
15error[E0277]: the trait bound `{async block@$DIR/clone-impl-async.rs:12:27: 16:6}: Clone` is not satisfied
15error[E0277]: the trait bound `{async block@$DIR/clone-impl-async.rs:12:27: 12:32}: Clone` is not satisfied
1616 --> $DIR/clone-impl-async.rs:19:17
1717 |
1818LL | check_clone(&inner_non_clone);
19 | ----------- ^^^^^^^^^^^^^^^^ the trait `Clone` is not implemented for `{async block@$DIR/clone-impl-async.rs:12:27: 16:6}`
19 | ----------- ^^^^^^^^^^^^^^^^ the trait `Clone` is not implemented for `{async block@$DIR/clone-impl-async.rs:12:27: 12:32}`
2020 | |
2121 | required by a bound introduced by this call
2222 |
......@@ -26,11 +26,11 @@ note: required by a bound in `check_clone`
2626LL | fn check_clone<T: Clone>(_x: &T) {}
2727 | ^^^^^ required by this bound in `check_clone`
2828
29error[E0277]: the trait bound `{async block@$DIR/clone-impl-async.rs:23:27: 25:6}: Copy` is not satisfied
29error[E0277]: the trait bound `{async block@$DIR/clone-impl-async.rs:23:27: 23:37}: Copy` is not satisfied
3030 --> $DIR/clone-impl-async.rs:26:16
3131 |
3232LL | check_copy(&outer_non_clone);
33 | ---------- ^^^^^^^^^^^^^^^^ the trait `Copy` is not implemented for `{async block@$DIR/clone-impl-async.rs:23:27: 25:6}`
33 | ---------- ^^^^^^^^^^^^^^^^ the trait `Copy` is not implemented for `{async block@$DIR/clone-impl-async.rs:23:27: 23:37}`
3434 | |
3535 | required by a bound introduced by this call
3636 |
......@@ -40,11 +40,11 @@ note: required by a bound in `check_copy`
4040LL | fn check_copy<T: Copy>(_x: &T) {}
4141 | ^^^^ required by this bound in `check_copy`
4242
43error[E0277]: the trait bound `{async block@$DIR/clone-impl-async.rs:23:27: 25:6}: Clone` is not satisfied
43error[E0277]: the trait bound `{async block@$DIR/clone-impl-async.rs:23:27: 23:37}: Clone` is not satisfied
4444 --> $DIR/clone-impl-async.rs:28:17
4545 |
4646LL | check_clone(&outer_non_clone);
47 | ----------- ^^^^^^^^^^^^^^^^ the trait `Clone` is not implemented for `{async block@$DIR/clone-impl-async.rs:23:27: 25:6}`
47 | ----------- ^^^^^^^^^^^^^^^^ the trait `Clone` is not implemented for `{async block@$DIR/clone-impl-async.rs:23:27: 23:37}`
4848 | |
4949 | required by a bound introduced by this call
5050 |
......@@ -54,11 +54,11 @@ note: required by a bound in `check_clone`
5454LL | fn check_clone<T: Clone>(_x: &T) {}
5555 | ^^^^^ required by this bound in `check_clone`
5656
57error[E0277]: the trait bound `{async block@$DIR/clone-impl-async.rs:31:28: 31:41}: Copy` is not satisfied
57error[E0277]: the trait bound `{async block@$DIR/clone-impl-async.rs:31:28: 31:38}: Copy` is not satisfied
5858 --> $DIR/clone-impl-async.rs:32:16
5959 |
6060LL | check_copy(&maybe_copy_clone);
61 | ---------- ^^^^^^^^^^^^^^^^^ the trait `Copy` is not implemented for `{async block@$DIR/clone-impl-async.rs:31:28: 31:41}`
61 | ---------- ^^^^^^^^^^^^^^^^^ the trait `Copy` is not implemented for `{async block@$DIR/clone-impl-async.rs:31:28: 31:38}`
6262 | |
6363 | required by a bound introduced by this call
6464 |
......@@ -68,11 +68,11 @@ note: required by a bound in `check_copy`
6868LL | fn check_copy<T: Copy>(_x: &T) {}
6969 | ^^^^ required by this bound in `check_copy`
7070
71error[E0277]: the trait bound `{async block@$DIR/clone-impl-async.rs:31:28: 31:41}: Clone` is not satisfied
71error[E0277]: the trait bound `{async block@$DIR/clone-impl-async.rs:31:28: 31:38}: Clone` is not satisfied
7272 --> $DIR/clone-impl-async.rs:34:17
7373 |
7474LL | check_clone(&maybe_copy_clone);
75 | ----------- ^^^^^^^^^^^^^^^^^ the trait `Clone` is not implemented for `{async block@$DIR/clone-impl-async.rs:31:28: 31:41}`
75 | ----------- ^^^^^^^^^^^^^^^^^ the trait `Clone` is not implemented for `{async block@$DIR/clone-impl-async.rs:31:28: 31:38}`
7676 | |
7777 | required by a bound introduced by this call
7878 |
tests/ui/coroutine/gen_block_is_coro.stderr+6-6
......@@ -1,20 +1,20 @@
1error[E0277]: the trait bound `{gen block@$DIR/gen_block_is_coro.rs:7:5: 7:21}: Coroutine` is not satisfied
1error[E0277]: the trait bound `{gen block@$DIR/gen_block_is_coro.rs:7:5: 7:8}: Coroutine` is not satisfied
22 --> $DIR/gen_block_is_coro.rs:6:13
33 |
44LL | fn foo() -> impl Coroutine<Yield = u32, Return = ()> {
5 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Coroutine` is not implemented for `{gen block@$DIR/gen_block_is_coro.rs:7:5: 7:21}`
5 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Coroutine` is not implemented for `{gen block@$DIR/gen_block_is_coro.rs:7:5: 7:8}`
66
7error[E0277]: the trait bound `{gen block@$DIR/gen_block_is_coro.rs:11:5: 11:21}: Coroutine` is not satisfied
7error[E0277]: the trait bound `{gen block@$DIR/gen_block_is_coro.rs:11:5: 11:8}: Coroutine` is not satisfied
88 --> $DIR/gen_block_is_coro.rs:10:13
99 |
1010LL | fn bar() -> impl Coroutine<Yield = i64, Return = ()> {
11 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Coroutine` is not implemented for `{gen block@$DIR/gen_block_is_coro.rs:11:5: 11:21}`
11 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Coroutine` is not implemented for `{gen block@$DIR/gen_block_is_coro.rs:11:5: 11:8}`
1212
13error[E0277]: the trait bound `{gen block@$DIR/gen_block_is_coro.rs:15:5: 15:21}: Coroutine` is not satisfied
13error[E0277]: the trait bound `{gen block@$DIR/gen_block_is_coro.rs:15:5: 15:8}: Coroutine` is not satisfied
1414 --> $DIR/gen_block_is_coro.rs:14:13
1515 |
1616LL | fn baz() -> impl Coroutine<Yield = i32, Return = ()> {
17 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Coroutine` is not implemented for `{gen block@$DIR/gen_block_is_coro.rs:15:5: 15:21}`
17 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Coroutine` is not implemented for `{gen block@$DIR/gen_block_is_coro.rs:15:5: 15:8}`
1818
1919error: aborting due to 3 previous errors
2020
tests/ui/coroutine/gen_block_is_no_future.stderr+3-3
......@@ -1,10 +1,10 @@
1error[E0277]: `{gen block@$DIR/gen_block_is_no_future.rs:5:5: 5:21}` is not a future
1error[E0277]: `{gen block@$DIR/gen_block_is_no_future.rs:5:5: 5:8}` is not a future
22 --> $DIR/gen_block_is_no_future.rs:4:13
33 |
44LL | fn foo() -> impl std::future::Future {
5 | ^^^^^^^^^^^^^^^^^^^^^^^^ `{gen block@$DIR/gen_block_is_no_future.rs:5:5: 5:21}` is not a future
5 | ^^^^^^^^^^^^^^^^^^^^^^^^ `{gen block@$DIR/gen_block_is_no_future.rs:5:5: 5:8}` is not a future
66 |
7 = help: the trait `Future` is not implemented for `{gen block@$DIR/gen_block_is_no_future.rs:5:5: 5:21}`
7 = help: the trait `Future` is not implemented for `{gen block@$DIR/gen_block_is_no_future.rs:5:5: 5:8}`
88
99error: aborting due to 1 previous error
1010
tests/ui/coroutine/gen_block_move.stderr+5-8
......@@ -1,14 +1,11 @@
11error[E0373]: gen block may outlive the current function, but it borrows `x`, which is owned by the current function
22 --> $DIR/gen_block_move.rs:7:5
33 |
4LL | / gen {
5LL | | yield 42;
6LL | | if x == "foo" { return }
7LL | | x.clear();
8 | | - `x` is borrowed here
9LL | | for x in 3..6 { yield x }
10LL | | }
11 | |_____^ may outlive borrowed value `x`
4LL | gen {
5 | ^^^ may outlive borrowed value `x`
6...
7LL | x.clear();
8 | - `x` is borrowed here
129 |
1310note: gen block is returned here
1411 --> $DIR/gen_block_move.rs:7:5
tests/ui/feature-gates/feature-gate-patchable-function-entry.rs created+3
......@@ -0,0 +1,3 @@
1#[patchable_function_entry(prefix_nops = 1, entry_nops = 1)]
2//~^ ERROR: the `#[patchable_function_entry]` attribute is an experimental feature
3fn main() {}
tests/ui/feature-gates/feature-gate-patchable-function-entry.stderr created+13
......@@ -0,0 +1,13 @@
1error[E0658]: the `#[patchable_function_entry]` attribute is an experimental feature
2 --> $DIR/feature-gate-patchable-function-entry.rs:1:1
3 |
4LL | #[patchable_function_entry(prefix_nops = 1, entry_nops = 1)]
5 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
6 |
7 = note: see issue #123115 <https://github.com/rust-lang/rust/issues/123115> for more information
8 = help: add `#![feature(patchable_function_entry)]` to the crate attributes to enable
9 = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
10
11error: aborting due to 1 previous error
12
13For more information about this error, try `rustc --explain E0658`.
tests/ui/fmt/send-sync.stderr+6-24
......@@ -1,45 +1,27 @@
1error[E0277]: `core::fmt::rt::Opaque` cannot be shared between threads safely
1error[E0277]: `Arguments<'_>` cannot be sent between threads safely
22 --> $DIR/send-sync.rs:8:10
33 |
44LL | send(format_args!("{:?}", c));
5 | ---- ^^^^^^^^^^^^^^^^^^^^^^^ `core::fmt::rt::Opaque` cannot be shared between threads safely
5 | ---- ^^^^^^^^^^^^^^^^^^^^^^^ `Arguments<'_>` cannot be sent between threads safely
66 | |
77 | required by a bound introduced by this call
88 |
9 = help: within `[core::fmt::rt::Argument<'_>]`, the trait `Sync` is not implemented for `core::fmt::rt::Opaque`, which is required by `Arguments<'_>: Send`
10 = note: required because it appears within the type `&core::fmt::rt::Opaque`
11note: required because it appears within the type `core::fmt::rt::ArgumentType<'_>`
12 --> $SRC_DIR/core/src/fmt/rt.rs:LL:COL
13note: required because it appears within the type `core::fmt::rt::Argument<'_>`
14 --> $SRC_DIR/core/src/fmt/rt.rs:LL:COL
15 = note: required because it appears within the type `[core::fmt::rt::Argument<'_>]`
16 = note: required for `&[core::fmt::rt::Argument<'_>]` to implement `Send`
17note: required because it appears within the type `Arguments<'_>`
18 --> $SRC_DIR/core/src/fmt/mod.rs:LL:COL
9 = help: the trait `Send` is not implemented for `Arguments<'_>`
1910note: required by a bound in `send`
2011 --> $DIR/send-sync.rs:1:12
2112 |
2213LL | fn send<T: Send>(_: T) {}
2314 | ^^^^ required by this bound in `send`
2415
25error[E0277]: `core::fmt::rt::Opaque` cannot be shared between threads safely
16error[E0277]: `Arguments<'_>` cannot be shared between threads safely
2617 --> $DIR/send-sync.rs:9:10
2718 |
2819LL | sync(format_args!("{:?}", c));
29 | ---- ^^^^^^^^^^^^^^^^^^^^^^^ `core::fmt::rt::Opaque` cannot be shared between threads safely
20 | ---- ^^^^^^^^^^^^^^^^^^^^^^^ `Arguments<'_>` cannot be shared between threads safely
3021 | |
3122 | required by a bound introduced by this call
3223 |
33 = help: within `Arguments<'_>`, the trait `Sync` is not implemented for `core::fmt::rt::Opaque`, which is required by `Arguments<'_>: Sync`
34 = note: required because it appears within the type `&core::fmt::rt::Opaque`
35note: required because it appears within the type `core::fmt::rt::ArgumentType<'_>`
36 --> $SRC_DIR/core/src/fmt/rt.rs:LL:COL
37note: required because it appears within the type `core::fmt::rt::Argument<'_>`
38 --> $SRC_DIR/core/src/fmt/rt.rs:LL:COL
39 = note: required because it appears within the type `[core::fmt::rt::Argument<'_>]`
40 = note: required because it appears within the type `&[core::fmt::rt::Argument<'_>]`
41note: required because it appears within the type `Arguments<'_>`
42 --> $SRC_DIR/core/src/fmt/mod.rs:LL:COL
24 = help: the trait `Sync` is not implemented for `Arguments<'_>`
4325note: required by a bound in `sync`
4426 --> $DIR/send-sync.rs:2:12
4527 |
tests/ui/generic-associated-types/issue-90014-tait.stderr+1-1
......@@ -10,7 +10,7 @@ LL | async { () }
1010 | ^^^^^^^^^^^^ expected future, found `async` block
1111 |
1212 = note: expected opaque type `Foo<'_>::Fut<'a>`
13 found `async` block `{async block@$DIR/issue-90014-tait.rs:18:9: 18:21}`
13 found `async` block `{async block@$DIR/issue-90014-tait.rs:18:9: 18:14}`
1414note: this item must have the opaque type in its signature in order to be able to register hidden types
1515 --> $DIR/issue-90014-tait.rs:17:8
1616 |
tests/ui/impl-trait/issue-55872-3.stderr+2-2
......@@ -1,8 +1,8 @@
1error[E0277]: the trait bound `{async block@$DIR/issue-55872-3.rs:15:9: 15:17}: Copy` is not satisfied
1error[E0277]: the trait bound `{async block@$DIR/issue-55872-3.rs:15:9: 15:14}: Copy` is not satisfied
22 --> $DIR/issue-55872-3.rs:13:20
33 |
44LL | fn foo<T>() -> Self::E {
5 | ^^^^^^^ the trait `Copy` is not implemented for `{async block@$DIR/issue-55872-3.rs:15:9: 15:17}`
5 | ^^^^^^^ the trait `Copy` is not implemented for `{async block@$DIR/issue-55872-3.rs:15:9: 15:14}`
66
77error: aborting due to 1 previous error
88
tests/ui/impl-trait/issues/issue-78722-2.stderr+2-2
......@@ -1,4 +1,4 @@
1error[E0271]: expected `{async block@$DIR/issue-78722-2.rs:13:13: 13:21}` to be a future that resolves to `u8`, but it resolves to `()`
1error[E0271]: expected `{async block@$DIR/issue-78722-2.rs:13:13: 13:18}` to be a future that resolves to `u8`, but it resolves to `()`
22 --> $DIR/issue-78722-2.rs:11:30
33 |
44LL | fn concrete_use() -> F {
......@@ -16,7 +16,7 @@ LL | let f: F = async { 1 };
1616 | expected due to this
1717 |
1818 = note: expected opaque type `F`
19 found `async` block `{async block@$DIR/issue-78722-2.rs:16:20: 16:31}`
19 found `async` block `{async block@$DIR/issue-78722-2.rs:16:20: 16:25}`
2020
2121error: aborting due to 2 previous errors
2222
tests/ui/impl-trait/issues/issue-78722.stderr+1-1
......@@ -8,7 +8,7 @@ LL | let f: F = async { 1 };
88 = help: add `#![feature(const_async_blocks)]` to the crate attributes to enable
99 = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
1010
11error[E0271]: expected `{async block@$DIR/issue-78722.rs:10:13: 10:21}` to be a future that resolves to `u8`, but it resolves to `()`
11error[E0271]: expected `{async block@$DIR/issue-78722.rs:10:13: 10:18}` to be a future that resolves to `u8`, but it resolves to `()`
1212 --> $DIR/issue-78722.rs:8:30
1313 |
1414LL | fn concrete_use() -> F {
tests/ui/impl-trait/nested-return-type4.stderr+1-1
......@@ -4,7 +4,7 @@ error[E0700]: hidden type for `impl Future<Output = impl Sized>` captures lifeti
44LL | fn test<'s: 's>(s: &'s str) -> impl std::future::Future<Output = impl Sized> {
55 | -- --------------------------------------------- opaque type defined here
66 | |
7 | hidden type `{async block@$DIR/nested-return-type4.rs:4:5: 4:31}` captures the lifetime `'s` as defined here
7 | hidden type `{async block@$DIR/nested-return-type4.rs:4:5: 4:15}` captures the lifetime `'s` as defined here
88LL | async move { let _s = s; }
99 | ^^^^^^^^^^^^^^^^^^^^^^^^^^
1010 |
tests/ui/mismatched_types/mismatch-sugg-for-shorthand-field.stderr+2-2
......@@ -52,13 +52,13 @@ error[E0308]: mismatched types
5252 --> $DIR/mismatch-sugg-for-shorthand-field.rs:57:20
5353 |
5454LL | let a = async { 42 };
55 | ------------ the found `async` block
55 | ----- the found `async` block
5656...
5757LL | let s = Demo { a };
5858 | ^ expected `Pin<Box<...>>`, found `async` block
5959 |
6060 = note: expected struct `Pin<Box<(dyn Future<Output = i32> + Send + 'static)>>`
61 found `async` block `{async block@$DIR/mismatch-sugg-for-shorthand-field.rs:53:13: 53:25}`
61 found `async` block `{async block@$DIR/mismatch-sugg-for-shorthand-field.rs:53:13: 53:18}`
6262help: you need to pin and box this expression
6363 |
6464LL | let s = Demo { a: Box::pin(a) };
tests/ui/patchable-function-entry/patchable-function-entry-attribute.rs created+17
......@@ -0,0 +1,17 @@
1#![feature(patchable_function_entry)]
2fn main() {}
3
4#[patchable_function_entry(prefix_nops = 256, entry_nops = 0)]//~error: integer value out of range
5pub fn too_high_pnops() {}
6
7#[patchable_function_entry(prefix_nops = "stringvalue", entry_nops = 0)]//~error: invalid literal value
8pub fn non_int_nop() {}
9
10#[patchable_function_entry]//~error: malformed `patchable_function_entry` attribute input
11pub fn malformed_attribute() {}
12
13#[patchable_function_entry(prefix_nops = 10, something = 0)]//~error: unexpected parameter name
14pub fn unexpected_parameter_name() {}
15
16#[patchable_function_entry()]//~error: must specify at least one parameter
17pub fn no_parameters_given() {}
tests/ui/patchable-function-entry/patchable-function-entry-attribute.stderr created+32
......@@ -0,0 +1,32 @@
1error: malformed `patchable_function_entry` attribute input
2 --> $DIR/patchable-function-entry-attribute.rs:10:1
3 |
4LL | #[patchable_function_entry]
5 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: must be of the form: `#[patchable_function_entry(prefix_nops = m, entry_nops = n)]`
6
7error: integer value out of range
8 --> $DIR/patchable-function-entry-attribute.rs:4:42
9 |
10LL | #[patchable_function_entry(prefix_nops = 256, entry_nops = 0)]
11 | ^^^ value must be between `0` and `255`
12
13error: invalid literal value
14 --> $DIR/patchable-function-entry-attribute.rs:7:42
15 |
16LL | #[patchable_function_entry(prefix_nops = "stringvalue", entry_nops = 0)]
17 | ^^^^^^^^^^^^^ value must be an integer between `0` and `255`
18
19error: unexpected parameter name
20 --> $DIR/patchable-function-entry-attribute.rs:13:46
21 |
22LL | #[patchable_function_entry(prefix_nops = 10, something = 0)]
23 | ^^^^^^^^^^^^^ expected prefix_nops or entry_nops
24
25error: must specify at least one parameter
26 --> $DIR/patchable-function-entry-attribute.rs:16:1
27 |
28LL | #[patchable_function_entry()]
29 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
30
31error: aborting due to 5 previous errors
32
tests/ui/patchable-function-entry/patchable-function-entry-flags.rs created+2
......@@ -0,0 +1,2 @@
1//@ compile-flags: -Z patchable-function-entry=1,2
2fn main() {}
tests/ui/patchable-function-entry/patchable-function-entry-flags.stderr created+2
......@@ -0,0 +1,2 @@
1error: incorrect value `1,2` for unstable option `patchable-function-entry` - either two comma separated integers (total_nops,prefix_nops), with prefix_nops <= total_nops, or one integer (total_nops) was expected
2
tests/ui/pattern/non-structural-match-types.stderr+1-1
......@@ -4,7 +4,7 @@ error: `{closure@$DIR/non-structural-match-types.rs:9:17: 9:19}` cannot be used
44LL | const { || {} } => {}
55 | ^^^^^^^^^^^^^^^
66
7error: `{async block@$DIR/non-structural-match-types.rs:12:17: 12:25}` cannot be used in patterns
7error: `{async block@$DIR/non-structural-match-types.rs:12:17: 12:22}` cannot be used in patterns
88 --> $DIR/non-structural-match-types.rs:12:9
99 |
1010LL | const { async {} } => {}
tests/ui/suggestions/expected-boxed-future-isnt-pinned.stderr+1-1
......@@ -79,7 +79,7 @@ LL | | }
7979 | |_____^ expected `Pin<Box<...>>`, found `async` block
8080 |
8181 = note: expected struct `Pin<Box<(dyn Future<Output = i32> + Send + 'static)>>`
82 found `async` block `{async block@$DIR/expected-boxed-future-isnt-pinned.rs:28:5: 30:6}`
82 found `async` block `{async block@$DIR/expected-boxed-future-isnt-pinned.rs:28:5: 28:10}`
8383help: you need to pin and box this expression
8484 |
8585LL ~ Box::pin(async {
tests/ui/traits/next-solver/async.fail.stderr+1-1
......@@ -1,4 +1,4 @@
1error[E0271]: type mismatch resolving `<{async block@$DIR/async.rs:12:17: 12:25} as Future>::Output == i32`
1error[E0271]: type mismatch resolving `<{async block@$DIR/async.rs:12:17: 12:22} as Future>::Output == i32`
22 --> $DIR/async.rs:12:17
33 |
44LL | needs_async(async {});
tests/ui/type-alias-impl-trait/indirect-recursion-issue-112047.stderr+1-3
......@@ -2,9 +2,7 @@ error[E0733]: recursion in an async block requires boxing
22 --> $DIR/indirect-recursion-issue-112047.rs:22:9
33 |
44LL | async move { recur(self).await; }
5 | ^^^^^^^^^^^^^-----------------^^^
6 | |
7 | recursive call here
5 | ^^^^^^^^^^ ----------------- recursive call here
86 |
97note: which leads to this async fn
108 --> $DIR/indirect-recursion-issue-112047.rs:14:1