authorbors <bors@rust-lang.org> 2024-07-19 11:08:02 UTC
committerbors <bors@rust-lang.org> 2024-07-19 11:08:02 UTC
log11e57241f166194a328438d9264b68c98a18d51f
treead833d5af0c81226f946303653d4840c58d01943
parent8c3a94a1c79c67924558a4adf7fb6d98f5f0f741
parent314cf1fc7aa13bc0b3a100691959b75f58fbcb4c

Auto merge of #127956 - tgross35:rollup-8ten7pk, r=tgross35

Rollup of 7 pull requests Successful merges: - #121533 (Handle .init_array link_section specially on wasm) - #127825 (Migrate `macos-fat-archive`, `manual-link` and `archive-duplicate-names` `run-make` tests to rmake) - #127891 (Tweak suggestions when using incorrect type of enum literal) - #127902 (`collect_tokens_trailing_token` cleanups) - #127928 (Migrate `lto-smoke-c` and `link-path-order` `run-make` tests to rmake) - #127935 (Change `binary_asm_labels` to only fire on x86 and x86_64) - #127953 ([compiletest] Search *.a when getting dynamic libraries on AIX) r? `@ghost` `@rustbot` modify labels: rollup

47 files changed, 1904 insertions(+), 281 deletions(-)

compiler/rustc_codegen_llvm/src/consts.rs+8-2
......@@ -495,8 +495,14 @@ impl<'ll> CodegenCx<'ll, '_> {
495495 }
496496
497497 // Wasm statics with custom link sections get special treatment as they
498 // go into custom sections of the wasm executable.
499 if self.tcx.sess.target.is_like_wasm {
498 // go into custom sections of the wasm executable. The exception to this
499 // is the `.init_array` section which are treated specially by the wasm linker.
500 if self.tcx.sess.target.is_like_wasm
501 && attrs
502 .link_section
503 .map(|link_section| !link_section.as_str().starts_with(".init_array"))
504 .unwrap_or(true)
505 {
500506 if let Some(section) = attrs.link_section {
501507 let section = llvm::LLVMMDStringInContext2(
502508 self.llcx,
compiler/rustc_hir_analysis/src/check/mod.rs+28-7
......@@ -166,21 +166,42 @@ fn maybe_check_static_with_link_section(tcx: TyCtxt<'_>, id: LocalDefId) {
166166 return;
167167 }
168168
169 // For the wasm32 target statics with `#[link_section]` are placed into custom
170 // sections of the final output file, but this isn't link custom sections of
171 // other executable formats. Namely we can only embed a list of bytes,
172 // nothing with provenance (pointers to anything else). If any provenance
173 // show up, reject it here.
169 // For the wasm32 target statics with `#[link_section]` other than `.init_array`
170 // are placed into custom sections of the final output file, but this isn't like
171 // custom sections of other executable formats. Namely we can only embed a list
172 // of bytes, nothing with provenance (pointers to anything else). If any
173 // provenance show up, reject it here.
174174 // `#[link_section]` may contain arbitrary, or even undefined bytes, but it is
175175 // the consumer's responsibility to ensure all bytes that have been read
176176 // have defined values.
177 //
178 // The `.init_array` section is left to go through the normal custom section code path.
179 // When dealing with `.init_array` wasm-ld currently has several limitations. This manifests
180 // in workarounds in user-code.
181 //
182 // * The linker fails to merge multiple items in a crate into the .init_array section.
183 // To work around this, a single array can be used placing multiple items in the array.
184 // #[link_section = ".init_array"]
185 // static FOO: [unsafe extern "C" fn(); 2] = [ctor, ctor];
186 // * Even symbols marked used get gc'd from dependant crates unless at least one symbol
187 // in the crate is marked with an `#[export_name]`
188 //
189 // Once `.init_array` support in wasm-ld is complete, the user code workarounds should
190 // continue to work, but would no longer be necessary.
191
177192 if let Ok(alloc) = tcx.eval_static_initializer(id.to_def_id())
178193 && alloc.inner().provenance().ptrs().len() != 0
179194 {
180 let msg = "statics with a custom `#[link_section]` must be a \
195 if attrs
196 .link_section
197 .map(|link_section| !link_section.as_str().starts_with(".init_array"))
198 .unwrap()
199 {
200 let msg = "statics with a custom `#[link_section]` must be a \
181201 simple list of bytes on the wasm target with no \
182202 extra levels of indirection such as references";
183 tcx.dcx().span_err(tcx.def_span(id), msg);
203 tcx.dcx().span_err(tcx.def_span(id), msg);
204 }
184205 }
185206}
186207
compiler/rustc_hir_analysis/src/hir_ty_lowering/mod.rs+60-6
......@@ -1087,7 +1087,7 @@ impl<'tcx> dyn HirTyLowerer<'tcx> + '_ {
10871087 );
10881088
10891089 let adt_def = qself_ty.ty_adt_def().expect("enum is not an ADT");
1090 if let Some(suggested_name) = find_best_match_for_name(
1090 if let Some(variant_name) = find_best_match_for_name(
10911091 &adt_def
10921092 .variants()
10931093 .iter()
......@@ -1095,12 +1095,66 @@ impl<'tcx> dyn HirTyLowerer<'tcx> + '_ {
10951095 .collect::<Vec<Symbol>>(),
10961096 assoc_ident.name,
10971097 None,
1098 ) {
1099 err.span_suggestion(
1100 assoc_ident.span,
1098 ) && let Some(variant) =
1099 adt_def.variants().iter().find(|s| s.name == variant_name)
1100 {
1101 let mut suggestion = vec![(assoc_ident.span, variant_name.to_string())];
1102 if let hir::Node::Stmt(hir::Stmt {
1103 kind: hir::StmtKind::Semi(ref expr),
1104 ..
1105 })
1106 | hir::Node::Expr(ref expr) = tcx.parent_hir_node(hir_ref_id)
1107 && let hir::ExprKind::Struct(..) = expr.kind
1108 {
1109 match variant.ctor {
1110 None => {
1111 // struct
1112 suggestion = vec![(
1113 assoc_ident.span.with_hi(expr.span.hi()),
1114 if variant.fields.is_empty() {
1115 format!("{variant_name} {{}}")
1116 } else {
1117 format!(
1118 "{variant_name} {{ {} }}",
1119 variant
1120 .fields
1121 .iter()
1122 .map(|f| format!("{}: /* value */", f.name))
1123 .collect::<Vec<_>>()
1124 .join(", ")
1125 )
1126 },
1127 )];
1128 }
1129 Some((hir::def::CtorKind::Fn, def_id)) => {
1130 // tuple
1131 let fn_sig = tcx.fn_sig(def_id).instantiate_identity();
1132 let inputs = fn_sig.inputs().skip_binder();
1133 suggestion = vec![(
1134 assoc_ident.span.with_hi(expr.span.hi()),
1135 format!(
1136 "{variant_name}({})",
1137 inputs
1138 .iter()
1139 .map(|i| format!("/* {i} */"))
1140 .collect::<Vec<_>>()
1141 .join(", ")
1142 ),
1143 )];
1144 }
1145 Some((hir::def::CtorKind::Const, _)) => {
1146 // unit
1147 suggestion = vec![(
1148 assoc_ident.span.with_hi(expr.span.hi()),
1149 variant_name.to_string(),
1150 )];
1151 }
1152 }
1153 }
1154 err.multipart_suggestion_verbose(
11011155 "there is a variant with a similar name",
1102 suggested_name,
1103 Applicability::MaybeIncorrect,
1156 suggestion,
1157 Applicability::HasPlaceholders,
11041158 );
11051159 } else {
11061160 err.span_label(
compiler/rustc_hir_typeck/src/expr.rs+34-10
......@@ -519,7 +519,15 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
519519 Ty::new_error(tcx, e)
520520 }
521521 Res::Def(DefKind::Variant, _) => {
522 let e = report_unexpected_variant_res(tcx, res, qpath, expr.span, E0533, "value");
522 let e = report_unexpected_variant_res(
523 tcx,
524 res,
525 Some(expr),
526 qpath,
527 expr.span,
528 E0533,
529 "value",
530 );
523531 Ty::new_error(tcx, e)
524532 }
525533 _ => {
......@@ -2210,8 +2218,8 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
22102218 );
22112219
22122220 let variant_ident_span = self.tcx.def_ident_span(variant.def_id).unwrap();
2213 match variant.ctor_kind() {
2214 Some(CtorKind::Fn) => match ty.kind() {
2221 match variant.ctor {
2222 Some((CtorKind::Fn, def_id)) => match ty.kind() {
22152223 ty::Adt(adt, ..) if adt.is_enum() => {
22162224 err.span_label(
22172225 variant_ident_span,
......@@ -2222,28 +2230,44 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
22222230 ),
22232231 );
22242232 err.span_label(field.ident.span, "field does not exist");
2233 let fn_sig = self.tcx.fn_sig(def_id).instantiate_identity();
2234 let inputs = fn_sig.inputs().skip_binder();
2235 let fields = format!(
2236 "({})",
2237 inputs.iter().map(|i| format!("/* {i} */")).collect::<Vec<_>>().join(", ")
2238 );
2239 let (replace_span, sugg) = match expr.kind {
2240 hir::ExprKind::Struct(qpath, ..) => {
2241 (qpath.span().shrink_to_hi().with_hi(expr.span.hi()), fields)
2242 }
2243 _ => {
2244 (expr.span, format!("{ty}::{variant}{fields}", variant = variant.name))
2245 }
2246 };
22252247 err.span_suggestion_verbose(
2226 expr.span,
2248 replace_span,
22272249 format!(
22282250 "`{adt}::{variant}` is a tuple {kind_name}, use the appropriate syntax",
22292251 adt = ty,
22302252 variant = variant.name,
22312253 ),
2232 format!(
2233 "{adt}::{variant}(/* fields */)",
2234 adt = ty,
2235 variant = variant.name,
2236 ),
2254 sugg,
22372255 Applicability::HasPlaceholders,
22382256 );
22392257 }
22402258 _ => {
22412259 err.span_label(variant_ident_span, format!("`{ty}` defined here"));
22422260 err.span_label(field.ident.span, "field does not exist");
2261 let fn_sig = self.tcx.fn_sig(def_id).instantiate_identity();
2262 let inputs = fn_sig.inputs().skip_binder();
2263 let fields = format!(
2264 "({})",
2265 inputs.iter().map(|i| format!("/* {i} */")).collect::<Vec<_>>().join(", ")
2266 );
22432267 err.span_suggestion_verbose(
22442268 expr.span,
22452269 format!("`{ty}` is a tuple {kind_name}, use the appropriate syntax",),
2246 format!("{ty}(/* fields */)"),
2270 format!("{ty}{fields}"),
22472271 Applicability::HasPlaceholders,
22482272 );
22492273 }
compiler/rustc_hir_typeck/src/lib.rs+58-2
......@@ -53,7 +53,7 @@ use crate::expectation::Expectation;
5353use crate::fn_ctxt::LoweredTy;
5454use crate::gather_locals::GatherLocalsVisitor;
5555use rustc_data_structures::unord::UnordSet;
56use rustc_errors::{codes::*, struct_span_code_err, ErrorGuaranteed};
56use rustc_errors::{codes::*, struct_span_code_err, Applicability, ErrorGuaranteed};
5757use rustc_hir as hir;
5858use rustc_hir::def::{DefKind, Res};
5959use rustc_hir::intravisit::Visitor;
......@@ -346,6 +346,7 @@ impl<'tcx> EnclosingBreakables<'tcx> {
346346fn report_unexpected_variant_res(
347347 tcx: TyCtxt<'_>,
348348 res: Res,
349 expr: Option<&hir::Expr<'_>>,
349350 qpath: &hir::QPath<'_>,
350351 span: Span,
351352 err_code: ErrCode,
......@@ -356,7 +357,7 @@ fn report_unexpected_variant_res(
356357 _ => res.descr(),
357358 };
358359 let path_str = rustc_hir_pretty::qpath_to_string(&tcx, qpath);
359 let err = tcx
360 let mut err = tcx
360361 .dcx()
361362 .struct_span_err(span, format!("expected {expected}, found {res_descr} `{path_str}`"))
362363 .with_code(err_code);
......@@ -366,6 +367,61 @@ fn report_unexpected_variant_res(
366367 err.with_span_label(span, "`fn` calls are not allowed in patterns")
367368 .with_help(format!("for more information, visit {patterns_url}"))
368369 }
370 Res::Def(DefKind::Variant, _) if let Some(expr) = expr => {
371 err.span_label(span, format!("not a {expected}"));
372 let variant = tcx.expect_variant_res(res);
373 let sugg = if variant.fields.is_empty() {
374 " {}".to_string()
375 } else {
376 format!(
377 " {{ {} }}",
378 variant
379 .fields
380 .iter()
381 .map(|f| format!("{}: /* value */", f.name))
382 .collect::<Vec<_>>()
383 .join(", ")
384 )
385 };
386 let descr = "you might have meant to create a new value of the struct";
387 let mut suggestion = vec![];
388 match tcx.parent_hir_node(expr.hir_id) {
389 hir::Node::Expr(hir::Expr {
390 kind: hir::ExprKind::Call(..),
391 span: call_span,
392 ..
393 }) => {
394 suggestion.push((span.shrink_to_hi().with_hi(call_span.hi()), sugg));
395 }
396 hir::Node::Expr(hir::Expr { kind: hir::ExprKind::Binary(..), hir_id, .. }) => {
397 suggestion.push((expr.span.shrink_to_lo(), "(".to_string()));
398 if let hir::Node::Expr(drop_temps) = tcx.parent_hir_node(*hir_id)
399 && let hir::ExprKind::DropTemps(_) = drop_temps.kind
400 && let hir::Node::Expr(parent) = tcx.parent_hir_node(drop_temps.hir_id)
401 && let hir::ExprKind::If(condition, block, None) = parent.kind
402 && condition.hir_id == drop_temps.hir_id
403 && let hir::ExprKind::Block(block, _) = block.kind
404 && block.stmts.is_empty()
405 && let Some(expr) = block.expr
406 && let hir::ExprKind::Path(..) = expr.kind
407 {
408 // Special case: you can incorrectly write an equality condition:
409 // if foo == Struct { field } { /* if body */ }
410 // which should have been written
411 // if foo == (Struct { field }) { /* if body */ }
412 suggestion.push((block.span.shrink_to_hi(), ")".to_string()));
413 } else {
414 suggestion.push((span.shrink_to_hi().with_hi(expr.span.hi()), sugg));
415 }
416 }
417 _ => {
418 suggestion.push((span.shrink_to_hi(), sugg));
419 }
420 }
421
422 err.multipart_suggestion_verbose(descr, suggestion, Applicability::MaybeIncorrect);
423 err
424 }
369425 _ => err.with_span_label(span, format!("not a {expected}")),
370426 }
371427 .emit()
compiler/rustc_hir_typeck/src/method/suggest.rs+116-5
......@@ -1596,16 +1596,127 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
15961596 // that had unsatisfied trait bounds
15971597 if unsatisfied_predicates.is_empty() && rcvr_ty.is_enum() {
15981598 let adt_def = rcvr_ty.ty_adt_def().expect("enum is not an ADT");
1599 if let Some(suggestion) = edit_distance::find_best_match_for_name(
1599 if let Some(var_name) = edit_distance::find_best_match_for_name(
16001600 &adt_def.variants().iter().map(|s| s.name).collect::<Vec<_>>(),
16011601 item_name.name,
16021602 None,
1603 ) {
1604 err.span_suggestion(
1605 span,
1603 ) && let Some(variant) = adt_def.variants().iter().find(|s| s.name == var_name)
1604 {
1605 let mut suggestion = vec![(span, var_name.to_string())];
1606 if let SelfSource::QPath(ty) = source
1607 && let hir::Node::Expr(ref path_expr) = self.tcx.parent_hir_node(ty.hir_id)
1608 && let hir::ExprKind::Path(_) = path_expr.kind
1609 && let hir::Node::Stmt(hir::Stmt {
1610 kind: hir::StmtKind::Semi(ref parent), ..
1611 })
1612 | hir::Node::Expr(ref parent) = self.tcx.parent_hir_node(path_expr.hir_id)
1613 {
1614 let replacement_span =
1615 if let hir::ExprKind::Call(..) | hir::ExprKind::Struct(..) = parent.kind {
1616 // We want to replace the parts that need to go, like `()` and `{}`.
1617 span.with_hi(parent.span.hi())
1618 } else {
1619 span
1620 };
1621 match (variant.ctor, parent.kind) {
1622 (None, hir::ExprKind::Struct(..)) => {
1623 // We want a struct and we have a struct. We won't suggest changing
1624 // the fields (at least for now).
1625 suggestion = vec![(span, var_name.to_string())];
1626 }
1627 (None, _) => {
1628 // struct
1629 suggestion = vec![(
1630 replacement_span,
1631 if variant.fields.is_empty() {
1632 format!("{var_name} {{}}")
1633 } else {
1634 format!(
1635 "{var_name} {{ {} }}",
1636 variant
1637 .fields
1638 .iter()
1639 .map(|f| format!("{}: /* value */", f.name))
1640 .collect::<Vec<_>>()
1641 .join(", ")
1642 )
1643 },
1644 )];
1645 }
1646 (Some((hir::def::CtorKind::Const, _)), _) => {
1647 // unit, remove the `()`.
1648 suggestion = vec![(replacement_span, var_name.to_string())];
1649 }
1650 (
1651 Some((hir::def::CtorKind::Fn, def_id)),
1652 hir::ExprKind::Call(rcvr, args),
1653 ) => {
1654 let fn_sig = self.tcx.fn_sig(def_id).instantiate_identity();
1655 let inputs = fn_sig.inputs().skip_binder();
1656 // FIXME: reuse the logic for "change args" suggestion to account for types
1657 // involved and detect things like substitution.
1658 match (inputs, args) {
1659 (inputs, []) => {
1660 // Add arguments.
1661 suggestion.push((
1662 rcvr.span.shrink_to_hi().with_hi(parent.span.hi()),
1663 format!(
1664 "({})",
1665 inputs
1666 .iter()
1667 .map(|i| format!("/* {i} */"))
1668 .collect::<Vec<String>>()
1669 .join(", ")
1670 ),
1671 ));
1672 }
1673 (_, [arg]) if inputs.len() != args.len() => {
1674 // Replace arguments.
1675 suggestion.push((
1676 arg.span,
1677 inputs
1678 .iter()
1679 .map(|i| format!("/* {i} */"))
1680 .collect::<Vec<String>>()
1681 .join(", "),
1682 ));
1683 }
1684 (_, [arg_start, .., arg_end]) if inputs.len() != args.len() => {
1685 // Replace arguments.
1686 suggestion.push((
1687 arg_start.span.to(arg_end.span),
1688 inputs
1689 .iter()
1690 .map(|i| format!("/* {i} */"))
1691 .collect::<Vec<String>>()
1692 .join(", "),
1693 ));
1694 }
1695 // Argument count is the same, keep as is.
1696 _ => {}
1697 }
1698 }
1699 (Some((hir::def::CtorKind::Fn, def_id)), _) => {
1700 let fn_sig = self.tcx.fn_sig(def_id).instantiate_identity();
1701 let inputs = fn_sig.inputs().skip_binder();
1702 suggestion = vec![(
1703 replacement_span,
1704 format!(
1705 "{var_name}({})",
1706 inputs
1707 .iter()
1708 .map(|i| format!("/* {i} */"))
1709 .collect::<Vec<String>>()
1710 .join(", ")
1711 ),
1712 )];
1713 }
1714 }
1715 }
1716 err.multipart_suggestion_verbose(
16061717 "there is a variant with a similar name",
16071718 suggestion,
1608 Applicability::MaybeIncorrect,
1719 Applicability::HasPlaceholders,
16091720 );
16101721 }
16111722 }
compiler/rustc_hir_typeck/src/pat.rs+4-2
......@@ -1023,7 +1023,8 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
10231023 }
10241024 Res::Def(DefKind::AssocFn | DefKind::Ctor(_, CtorKind::Fn) | DefKind::Variant, _) => {
10251025 let expected = "unit struct, unit variant or constant";
1026 let e = report_unexpected_variant_res(tcx, res, qpath, pat.span, E0533, expected);
1026 let e =
1027 report_unexpected_variant_res(tcx, res, None, qpath, pat.span, E0533, expected);
10271028 return Ty::new_error(tcx, e);
10281029 }
10291030 Res::SelfCtor(def_id) => {
......@@ -1036,6 +1037,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
10361037 let e = report_unexpected_variant_res(
10371038 tcx,
10381039 res,
1040 None,
10391041 qpath,
10401042 pat.span,
10411043 E0533,
......@@ -1189,7 +1191,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
11891191 };
11901192 let report_unexpected_res = |res: Res| {
11911193 let expected = "tuple struct or tuple variant";
1192 let e = report_unexpected_variant_res(tcx, res, qpath, pat.span, E0164, expected);
1194 let e = report_unexpected_variant_res(tcx, res, None, qpath, pat.span, E0164, expected);
11931195 on_error(e);
11941196 e
11951197 };
compiler/rustc_lint/messages.ftl+3-2
......@@ -403,8 +403,9 @@ lint_inner_macro_attribute_unstable = inner macro attributes are unstable
403403
404404lint_invalid_asm_label_binary = avoid using labels containing only the digits `0` and `1` in inline assembly
405405 .label = use a different label that doesn't start with `0` or `1`
406 .note = an LLVM bug makes these labels ambiguous with a binary literal number
407 .note = see <https://bugs.llvm.org/show_bug.cgi?id=36144> for more information
406 .help = start numbering with `2` instead
407 .note1 = an LLVM bug makes these labels ambiguous with a binary literal number on x86
408 .note2 = see <https://github.com/llvm/llvm-project/issues/99547> for more information
408409
409410lint_invalid_asm_label_format_arg = avoid using named labels in inline assembly
410411 .help = only local labels of the form `<number>:` should be used in inline asm
compiler/rustc_lint/src/builtin.rs+39-18
......@@ -66,6 +66,7 @@ use rustc_span::source_map::Spanned;
6666use rustc_span::symbol::{kw, sym, Ident, Symbol};
6767use rustc_span::{BytePos, InnerSpan, Span};
6868use rustc_target::abi::Abi;
69use rustc_target::asm::InlineAsmArch;
6970use rustc_trait_selection::infer::{InferCtxtExt, TyCtxtInferExt};
7071use rustc_trait_selection::traits::query::evaluate_obligation::InferCtxtExt as _;
7172use rustc_trait_selection::traits::{self, misc::type_allowed_to_implement_copy};
......@@ -2739,8 +2740,9 @@ declare_lint! {
27392740 ///
27402741 /// ### Example
27412742 ///
2742 /// ```rust,compile_fail
2743 /// # #![feature(asm_experimental_arch)]
2743 /// ```rust,ignore (fails on non-x86_64)
2744 /// #![cfg(target_arch = "x86_64")]
2745 ///
27442746 /// use std::arch::asm;
27452747 ///
27462748 /// fn main() {
......@@ -2750,19 +2752,32 @@ declare_lint! {
27502752 /// }
27512753 /// ```
27522754 ///
2753 /// {{produces}}
2755 /// This will produce:
2756 ///
2757 /// ```text
2758 /// error: avoid using labels containing only the digits `0` and `1` in inline assembly
2759 /// --> <source>:7:15
2760 /// |
2761 /// 7 | asm!("0: jmp 0b");
2762 /// | ^ use a different label that doesn't start with `0` or `1`
2763 /// |
2764 /// = help: start numbering with `2` instead
2765 /// = note: an LLVM bug makes these labels ambiguous with a binary literal number on x86
2766 /// = note: see <https://github.com/llvm/llvm-project/issues/99547> for more information
2767 /// = note: `#[deny(binary_asm_labels)]` on by default
2768 /// ```
27542769 ///
27552770 /// ### Explanation
27562771 ///
2757 /// A [LLVM bug] causes this code to fail to compile because it interprets the `0b` as a binary
2758 /// literal instead of a reference to the previous local label `0`. Note that even though the
2759 /// bug is marked as fixed, it only fixes a specific usage of intel syntax within standalone
2760 /// files, not inline assembly. To work around this bug, don't use labels that could be
2761 /// confused with a binary literal.
2772 /// An [LLVM bug] causes this code to fail to compile because it interprets the `0b` as a binary
2773 /// literal instead of a reference to the previous local label `0`. To work around this bug,
2774 /// don't use labels that could be confused with a binary literal.
2775 ///
2776 /// This behavior is platform-specific to x86 and x86-64.
27622777 ///
27632778 /// See the explanation in [Rust By Example] for more details.
27642779 ///
2765 /// [LLVM bug]: https://bugs.llvm.org/show_bug.cgi?id=36144
2780 /// [LLVM bug]: https://github.com/llvm/llvm-project/issues/99547
27662781 /// [Rust By Example]: https://doc.rust-lang.org/nightly/rust-by-example/unsafe/asm.html#labels
27672782 pub BINARY_ASM_LABELS,
27682783 Deny,
......@@ -2908,16 +2923,22 @@ impl<'tcx> LateLintPass<'tcx> for AsmLabels {
29082923 InvalidAsmLabel::FormatArg { missing_precise_span },
29092924 );
29102925 }
2911 AsmLabelKind::Binary => {
2912 // the binary asm issue only occurs when using intel syntax
2913 if !options.contains(InlineAsmOptions::ATT_SYNTAX) {
2914 cx.emit_span_lint(
2915 BINARY_ASM_LABELS,
2916 span,
2917 InvalidAsmLabel::Binary { missing_precise_span, span },
2918 )
2919 }
2926 // the binary asm issue only occurs when using intel syntax on x86 targets
2927 AsmLabelKind::Binary
2928 if !options.contains(InlineAsmOptions::ATT_SYNTAX)
2929 && matches!(
2930 cx.tcx.sess.asm_arch,
2931 Some(InlineAsmArch::X86 | InlineAsmArch::X86_64) | None
2932 ) =>
2933 {
2934 cx.emit_span_lint(
2935 BINARY_ASM_LABELS,
2936 span,
2937 InvalidAsmLabel::Binary { missing_precise_span, span },
2938 )
29202939 }
2940 // No lint on anything other than x86
2941 AsmLabelKind::Binary => (),
29212942 };
29222943 }
29232944 }
compiler/rustc_lint/src/lints.rs+3-1
......@@ -2074,7 +2074,9 @@ pub enum InvalidAsmLabel {
20742074 missing_precise_span: bool,
20752075 },
20762076 #[diag(lint_invalid_asm_label_binary)]
2077 #[note]
2077 #[help]
2078 #[note(lint_note1)]
2079 #[note(lint_note2)]
20782080 Binary {
20792081 #[note(lint_invalid_asm_label_no_span)]
20802082 missing_precise_span: bool,
compiler/rustc_parse/src/parser/attr.rs+8-11
......@@ -303,17 +303,13 @@ impl<'a> Parser<'a> {
303303 None
304304 };
305305 if let Some(attr) = attr {
306 let end_pos = self.num_bump_calls;
307 // If we are currently capturing tokens, mark the location of this inner attribute.
308 // If capturing ends up creating a `LazyAttrTokenStream`, we will include
309 // this replace range with it, removing the inner attribute from the final
310 // `AttrTokenStream`. Inner attributes are stored in the parsed AST note.
311 // During macro expansion, they are selectively inserted back into the
312 // token stream (the first inner attribute is removed each time we invoke the
313 // corresponding macro).
314 let range = start_pos..end_pos;
306 // If we are currently capturing tokens (i.e. we are within a call to
307 // `Parser::collect_tokens_trailing_tokens`) record the token positions of this
308 // inner attribute, for possible later processing in a `LazyAttrTokenStream`.
315309 if let Capturing::Yes = self.capture_state.capturing {
316 self.capture_state.inner_attr_ranges.insert(attr.id, (range, None));
310 let end_pos = self.num_bump_calls;
311 let range = start_pos..end_pos;
312 self.capture_state.inner_attr_ranges.insert(attr.id, range);
317313 }
318314 attrs.push(attr);
319315 } else {
......@@ -463,7 +459,8 @@ impl<'a> Parser<'a> {
463459 }
464460}
465461
466/// The attributes are complete if all attributes are either a doc comment or a builtin attribute other than `cfg_attr`
462/// The attributes are complete if all attributes are either a doc comment or a
463/// builtin attribute other than `cfg_attr`.
467464pub fn is_complete(attrs: &[ast::Attribute]) -> bool {
468465 attrs.iter().all(|attr| {
469466 attr.is_doc_comment()
compiler/rustc_parse/src/parser/attr_wrapper.rs+134-80
......@@ -17,12 +17,12 @@ use std::{iter, mem};
1717///
1818/// This wrapper prevents direct access to the underlying `ast::AttrVec`.
1919/// Parsing code can only get access to the underlying attributes
20/// by passing an `AttrWrapper` to `collect_tokens_trailing_tokens`.
20/// by passing an `AttrWrapper` to `collect_tokens_trailing_token`.
2121/// This makes it difficult to accidentally construct an AST node
2222/// (which stores an `ast::AttrVec`) without first collecting tokens.
2323///
2424/// This struct has its own module, to ensure that the parser code
25/// cannot directly access the `attrs` field
25/// cannot directly access the `attrs` field.
2626#[derive(Debug, Clone)]
2727pub struct AttrWrapper {
2828 attrs: AttrVec,
......@@ -76,14 +76,13 @@ fn has_cfg_or_cfg_attr(attrs: &[Attribute]) -> bool {
7676 })
7777}
7878
79// Produces a `TokenStream` on-demand. Using `cursor_snapshot`
80// and `num_calls`, we can reconstruct the `TokenStream` seen
81// by the callback. This allows us to avoid producing a `TokenStream`
82// if it is never needed - for example, a captured `macro_rules!`
83// argument that is never passed to a proc macro.
84// In practice token stream creation happens rarely compared to
85// calls to `collect_tokens` (see some statistics in #78736),
86// so we are doing as little up-front work as possible.
79// From a value of this type we can reconstruct the `TokenStream` seen by the
80// `f` callback passed to a call to `Parser::collect_tokens_trailing_token`, by
81// replaying the getting of the tokens. This saves us producing a `TokenStream`
82// if it is never needed, e.g. a captured `macro_rules!` argument that is never
83// passed to a proc macro. In practice, token stream creation happens rarely
84// compared to calls to `collect_tokens` (see some statistics in #78736) so we
85// are doing as little up-front work as possible.
8786//
8887// This also makes `Parser` very cheap to clone, since
8988// there is no intermediate collection buffer to clone.
......@@ -163,46 +162,55 @@ impl ToAttrTokenStream for LazyAttrTokenStreamImpl {
163162}
164163
165164impl<'a> Parser<'a> {
166 /// Records all tokens consumed by the provided callback,
167 /// including the current token. These tokens are collected
168 /// into a `LazyAttrTokenStream`, and returned along with the first part of
169 /// the callback's result. The second (bool) part of the callback's result
170 /// indicates if an extra token should be captured, e.g. a comma or
165 /// Parses code with `f`. If appropriate, it records the tokens (in
166 /// `LazyAttrTokenStream` form) that were parsed in the result, accessible
167 /// via the `HasTokens` trait. The second (bool) part of the callback's
168 /// result indicates if an extra token should be captured, e.g. a comma or
171169 /// semicolon.
172170 ///
173171 /// The `attrs` passed in are in `AttrWrapper` form, which is opaque. The
174172 /// `AttrVec` within is passed to `f`. See the comment on `AttrWrapper` for
175173 /// details.
176174 ///
177 /// Note: If your callback consumes an opening delimiter
178 /// (including the case where you call `collect_tokens`
179 /// when the current token is an opening delimiter),
180 /// you must also consume the corresponding closing delimiter.
175 /// Note: If your callback consumes an opening delimiter (including the
176 /// case where `self.token` is an opening delimiter on entry to this
177 /// function), you must also consume the corresponding closing delimiter.
178 /// E.g. you can consume `something ([{ }])` or `([{}])`, but not `([{}]`.
179 /// This restriction isn't a problem in practice, because parsed AST items
180 /// always have matching delimiters.
181181 ///
182 /// That is, you can consume
183 /// `something ([{ }])` or `([{}])`, but not `([{}]`
184 ///
185 /// This restriction shouldn't be an issue in practice,
186 /// since this function is used to record the tokens for
187 /// a parsed AST item, which always has matching delimiters.
182 /// The following example code will be used to explain things in comments
183 /// below. It has an outer attribute and an inner attribute. Parsing it
184 /// involves two calls to this method, one of which is indirectly
185 /// recursive.
186 /// ```ignore (fake attributes)
187 /// #[cfg_eval] // token pos
188 /// mod m { // 0.. 3
189 /// #[cfg_attr(cond1, attr1)] // 3..12
190 /// fn g() { // 12..17
191 /// #![cfg_attr(cond2, attr2)] // 17..27
192 /// let _x = 3; // 27..32
193 /// } // 32..33
194 /// } // 33..34
195 /// ```
188196 pub fn collect_tokens_trailing_token<R: HasAttrs + HasTokens>(
189197 &mut self,
190198 attrs: AttrWrapper,
191199 force_collect: ForceCollect,
192200 f: impl FnOnce(&mut Self, ast::AttrVec) -> PResult<'a, (R, bool)>,
193201 ) -> PResult<'a, R> {
194 // We only bail out when nothing could possibly observe the collected tokens:
195 // 1. We cannot be force collecting tokens (since force-collecting requires tokens
196 // by definition
202 // Skip collection when nothing could observe the collected tokens, i.e.
203 // all of the following conditions hold.
204 // - We are not force collecting tokens (because force collection
205 // requires tokens by definition).
197206 if matches!(force_collect, ForceCollect::No)
198 // None of our outer attributes can require tokens (e.g. a proc-macro)
207 // - None of our outer attributes require tokens.
199208 && attrs.is_complete()
200 // If our target supports custom inner attributes, then we cannot bail
201 // out early, since we may need to capture tokens for a custom inner attribute
202 // invocation.
209 // - Our target doesn't support custom inner attributes (custom
210 // inner attribute invocation might require token capturing).
203211 && !R::SUPPORTS_CUSTOM_INNER_ATTRS
204 // Never bail out early in `capture_cfg` mode, since there might be `#[cfg]`
205 // or `#[cfg_attr]` attributes.
212 // - We are not in `capture_cfg` mode (which requires tokens if
213 // the parsed node has `#[cfg]` or `#[cfg_attr]` attributes).
206214 && !self.capture_cfg
207215 {
208216 return Ok(f(self, attrs.attrs)?.0);
......@@ -214,6 +222,12 @@ impl<'a> Parser<'a> {
214222 let has_outer_attrs = !attrs.attrs.is_empty();
215223 let replace_ranges_start = self.capture_state.replace_ranges.len();
216224
225 // We set and restore `Capturing::Yes` on either side of the call to
226 // `f`, so we can distinguish the outermost call to
227 // `collect_tokens_trailing_token` (e.g. parsing `m` in the example
228 // above) from any inner (indirectly recursive) calls (e.g. parsing `g`
229 // in the example above). This distinction is used below and in
230 // `Parser::parse_inner_attributes`.
217231 let (mut ret, capture_trailing) = {
218232 let prev_capturing = mem::replace(&mut self.capture_state.capturing, Capturing::Yes);
219233 let ret_and_trailing = f(self, attrs.attrs);
......@@ -221,51 +235,46 @@ impl<'a> Parser<'a> {
221235 ret_and_trailing?
222236 };
223237
224 // When we're not in `capture-cfg` mode, then bail out early if:
225 // 1. Our target doesn't support tokens at all (e.g we're parsing an `NtIdent`)
226 // so there's nothing for us to do.
227 // 2. Our target already has tokens set (e.g. we've parsed something
228 // like `#[my_attr] $item`). The actual parsing code takes care of
229 // prepending any attributes to the nonterminal, so we don't need to
230 // modify the already captured tokens.
231 // Note that this check is independent of `force_collect`- if we already
232 // have tokens, or can't even store them, then there's never a need to
233 // force collection of new tokens.
238 // When we're not in `capture_cfg` mode, then skip collecting and
239 // return early if either of the following conditions hold.
240 // - `None`: Our target doesn't support tokens at all (e.g. `NtIdent`).
241 // - `Some(Some(_))`: Our target already has tokens set (e.g. we've
242 // parsed something like `#[my_attr] $item`). The actual parsing code
243 // takes care of prepending any attributes to the nonterminal, so we
244 // don't need to modify the already captured tokens.
245 //
246 // Note that this check is independent of `force_collect`. There's no
247 // need to collect tokens when we don't support tokens or already have
248 // tokens.
234249 if !self.capture_cfg && matches!(ret.tokens_mut(), None | Some(Some(_))) {
235250 return Ok(ret);
236251 }
237252
238 // This is very similar to the bail out check at the start of this function.
239 // Now that we've parsed an AST node, we have more information available.
253 // This is similar to the "skip collection" check at the start of this
254 // function, but now that we've parsed an AST node we have more
255 // information available. (If we return early here that means the
256 // setup, such as cloning the token cursor, was unnecessary. That's
257 // hard to avoid.)
258 //
259 // Skip collection when nothing could observe the collected tokens, i.e.
260 // all of the following conditions hold.
261 // - We are not force collecting tokens.
240262 if matches!(force_collect, ForceCollect::No)
241 // We now have inner attributes available, so this check is more precise
242 // than `attrs.is_complete()` at the start of the function.
243 // As a result, we don't need to check `R::SUPPORTS_CUSTOM_INNER_ATTRS`
263 // - None of our outer *or* inner attributes require tokens.
264 // (`attrs` was just outer attributes, but `ret.attrs()` is outer
265 // and inner attributes. That makes this check more precise than
266 // `attrs.is_complete()` at the start of the function, and we can
267 // skip the subsequent check on `R::SUPPORTS_CUSTOM_INNER_ATTRS`.
244268 && crate::parser::attr::is_complete(ret.attrs())
245 // Subtle: We call `has_cfg_or_cfg_attr` with the attrs from `ret`.
246 // This ensures that we consider inner attributes (e.g. `#![cfg]`),
247 // which require us to have tokens available
248 // We also call `has_cfg_or_cfg_attr` at the beginning of this function,
249 // but we only bail out if there's no possibility of inner attributes
250 // (!R::SUPPORTS_CUSTOM_INNER_ATTRS)
251 // We only capture about `#[cfg]` or `#[cfg_attr]` in `capture_cfg`
252 // mode - during normal parsing, we don't need any special capturing
253 // for those attributes, since they're builtin.
254 && !(self.capture_cfg && has_cfg_or_cfg_attr(ret.attrs()))
269 // - We are not in `capture_cfg` mode, or we are but there are no
270 // `#[cfg]` or `#[cfg_attr]` attributes. (During normal
271 // non-`capture_cfg` parsing, we don't need any special capturing
272 // for those attributes, because they're builtin.)
273 && (!self.capture_cfg || !has_cfg_or_cfg_attr(ret.attrs()))
255274 {
256275 return Ok(ret);
257276 }
258277
259 let mut inner_attr_replace_ranges = Vec::new();
260 // Take the captured ranges for any inner attributes that we parsed.
261 for inner_attr in ret.attrs().iter().filter(|a| a.style == ast::AttrStyle::Inner) {
262 if let Some(attr_range) = self.capture_state.inner_attr_ranges.remove(&inner_attr.id) {
263 inner_attr_replace_ranges.push(attr_range);
264 } else {
265 self.dcx().span_delayed_bug(inner_attr.span, "Missing token range for attribute");
266 }
267 }
268
269278 let replace_ranges_end = self.capture_state.replace_ranges.len();
270279
271280 assert!(
......@@ -283,15 +292,28 @@ impl<'a> Parser<'a> {
283292
284293 let num_calls = end_pos - start_pos;
285294
295 // Take the captured ranges for any inner attributes that we parsed in
296 // `Parser::parse_inner_attributes`, and pair them in a `ReplaceRange`
297 // with `None`, which means the relevant tokens will be removed. (More
298 // details below.)
299 let mut inner_attr_replace_ranges = Vec::new();
300 for inner_attr in ret.attrs().iter().filter(|a| a.style == ast::AttrStyle::Inner) {
301 if let Some(attr_range) = self.capture_state.inner_attr_ranges.remove(&inner_attr.id) {
302 inner_attr_replace_ranges.push((attr_range, None));
303 } else {
304 self.dcx().span_delayed_bug(inner_attr.span, "Missing token range for attribute");
305 }
306 }
307
286308 // This is hot enough for `deep-vector` that checking the conditions for an empty iterator
287309 // is measurably faster than actually executing the iterator.
288310 let replace_ranges: Box<[ReplaceRange]> =
289311 if replace_ranges_start == replace_ranges_end && inner_attr_replace_ranges.is_empty() {
290312 Box::new([])
291313 } else {
292 // Grab any replace ranges that occur *inside* the current AST node.
293 // We will perform the actual replacement when we convert the `LazyAttrTokenStream`
294 // to an `AttrTokenStream`.
314 // Grab any replace ranges that occur *inside* the current AST node. We will
315 // perform the actual replacement only when we convert the `LazyAttrTokenStream` to
316 // an `AttrTokenStream`.
295317 self.capture_state.replace_ranges[replace_ranges_start..replace_ranges_end]
296318 .iter()
297319 .cloned()
......@@ -300,6 +322,28 @@ impl<'a> Parser<'a> {
300322 .collect()
301323 };
302324
325 // What is the status here when parsing the example code at the top of this method?
326 //
327 // When parsing `g`:
328 // - `start_pos..end_pos` is `12..33` (`fn g { ... }`, excluding the outer attr).
329 // - `inner_attr_replace_ranges` has one entry (`5..15`, when counting from `fn`), to
330 // delete the inner attr's tokens.
331 // - This entry is put into the lazy tokens for `g`, i.e. deleting the inner attr from
332 // those tokens (if they get evaluated).
333 // - Those lazy tokens are also put into an `AttrsTarget` that is appended to `self`'s
334 // replace ranges at the bottom of this function, for processing when parsing `m`.
335 // - `replace_ranges_start..replace_ranges_end` is empty.
336 //
337 // When parsing `m`:
338 // - `start_pos..end_pos` is `0..34` (`mod m`, excluding the `#[cfg_eval]` attribute).
339 // - `inner_attr_replace_ranges` is empty.
340 // - `replace_range_start..replace_ranges_end` has two entries.
341 // - One to delete the inner attribute (`17..27`), obtained when parsing `g` (see above).
342 // - One `AttrsTarget` (added below when parsing `g`) to replace all of `g` (`3..33`,
343 // including its outer attribute), with:
344 // - `attrs`: includes the outer and the inner attr.
345 // - `tokens`: lazy tokens for `g` (with its inner attr deleted).
346
303347 let tokens = LazyAttrTokenStream::new(LazyAttrTokenStreamImpl {
304348 start_token,
305349 num_calls,
......@@ -313,27 +357,37 @@ impl<'a> Parser<'a> {
313357 *target_tokens = Some(tokens.clone());
314358 }
315359
316 let final_attrs = ret.attrs();
317
318360 // If `capture_cfg` is set and we're inside a recursive call to
319361 // `collect_tokens_trailing_token`, then we need to register a replace range
320362 // if we have `#[cfg]` or `#[cfg_attr]`. This allows us to run eager cfg-expansion
321363 // on the captured token stream.
322364 if self.capture_cfg
323365 && matches!(self.capture_state.capturing, Capturing::Yes)
324 && has_cfg_or_cfg_attr(final_attrs)
366 && has_cfg_or_cfg_attr(ret.attrs())
325367 {
326368 assert!(!self.break_last_token, "Should not have unglued last token with cfg attr");
327369
328 // Replace the entire AST node that we just parsed, including attributes, with
329 // `target`. If this AST node is inside an item that has `#[derive]`, then this will
330 // allow us to cfg-expand this AST node.
370 // What is the status here when parsing the example code at the top of this method?
371 //
372 // When parsing `g`, we add two entries:
373 // - The `start_pos..end_pos` (`3..33`) entry has a new `AttrsTarget` with:
374 // - `attrs`: includes the outer and the inner attr.
375 // - `tokens`: lazy tokens for `g` (with its inner attr deleted).
376 // - `inner_attr_replace_ranges` contains the one entry to delete the inner attr's
377 // tokens (`17..27`).
378 //
379 // When parsing `m`, we do nothing here.
380
381 // Set things up so that the entire AST node that we just parsed, including attributes,
382 // will be replaced with `target` in the lazy token stream. This will allow us to
383 // cfg-expand this AST node.
331384 let start_pos = if has_outer_attrs { attrs.start_pos } else { start_pos };
332 let target = AttrsTarget { attrs: final_attrs.iter().cloned().collect(), tokens };
385 let target = AttrsTarget { attrs: ret.attrs().iter().cloned().collect(), tokens };
333386 self.capture_state.replace_ranges.push((start_pos..end_pos, Some(target)));
334387 self.capture_state.replace_ranges.extend(inner_attr_replace_ranges);
335388 } else if matches!(self.capture_state.capturing, Capturing::No) {
336 // Only clear the ranges once we've finished capturing entirely.
389 // Only clear the ranges once we've finished capturing entirely, i.e. we've finished
390 // the outermost call to this method.
337391 self.capture_state.replace_ranges.clear();
338392 self.capture_state.inner_attr_ranges.clear();
339393 }
compiler/rustc_parse/src/parser/mod.rs+7-1
......@@ -221,11 +221,12 @@ enum Capturing {
221221 Yes,
222222}
223223
224// This state is used by `Parser::collect_tokens_trailing_token`.
224225#[derive(Clone, Debug)]
225226struct CaptureState {
226227 capturing: Capturing,
227228 replace_ranges: Vec<ReplaceRange>,
228 inner_attr_ranges: FxHashMap<AttrId, ReplaceRange>,
229 inner_attr_ranges: FxHashMap<AttrId, Range<u32>>,
229230}
230231
231232/// Iterator over a `TokenStream` that produces `Token`s. It's a bit odd that
......@@ -425,6 +426,11 @@ impl<'a> Parser<'a> {
425426 // Make parser point to the first token.
426427 parser.bump();
427428
429 // Change this from 1 back to 0 after the bump. This eases debugging of
430 // `Parser::collect_tokens_trailing_token` nicer because it makes the
431 // token positions 0-indexed which is nicer than 1-indexed.
432 parser.num_bump_calls = 0;
433
428434 parser
429435 }
430436
compiler/rustc_parse/src/parser/tests.rs+6-6
......@@ -1522,7 +1522,7 @@ fn debug_lookahead() {
15221522 },
15231523 },
15241524 tokens: [],
1525 approx_token_stream_pos: 1,
1525 approx_token_stream_pos: 0,
15261526 ..
15271527}"
15281528 );
......@@ -1566,7 +1566,7 @@ fn debug_lookahead() {
15661566 Parenthesis,
15671567 ),
15681568 ],
1569 approx_token_stream_pos: 1,
1569 approx_token_stream_pos: 0,
15701570 ..
15711571}"
15721572 );
......@@ -1631,7 +1631,7 @@ fn debug_lookahead() {
16311631 Semi,
16321632 Eof,
16331633 ],
1634 approx_token_stream_pos: 1,
1634 approx_token_stream_pos: 0,
16351635 ..
16361636}"
16371637 );
......@@ -1663,7 +1663,7 @@ fn debug_lookahead() {
16631663 No,
16641664 ),
16651665 ],
1666 approx_token_stream_pos: 9,
1666 approx_token_stream_pos: 8,
16671667 ..
16681668}"
16691669 );
......@@ -1701,7 +1701,7 @@ fn debug_lookahead() {
17011701 No,
17021702 ),
17031703 ],
1704 approx_token_stream_pos: 9,
1704 approx_token_stream_pos: 8,
17051705 ..
17061706}"
17071707 );
......@@ -1728,7 +1728,7 @@ fn debug_lookahead() {
17281728 tokens: [
17291729 Eof,
17301730 ],
1731 approx_token_stream_pos: 15,
1731 approx_token_stream_pos: 14,
17321732 ..
17331733}"
17341734 );
src/tools/compiletest/src/runtest.rs+2
......@@ -94,6 +94,8 @@ fn get_lib_name(lib: &str, aux_type: AuxType) -> Option<String> {
9494 format!("{}.dll", lib)
9595 } else if cfg!(target_vendor = "apple") {
9696 format!("lib{}.dylib", lib)
97 } else if cfg!(target_os = "aix") {
98 format!("lib{}.a", lib)
9799 } else {
98100 format!("lib{}.so", lib)
99101 }),
src/tools/tidy/src/allowed_run_make_makefiles.txt-5
......@@ -1,4 +1,3 @@
1run-make/archive-duplicate-names/Makefile
21run-make/branch-protection-check-IBT/Makefile
32run-make/c-dynamic-dylib/Makefile
43run-make/c-dynamic-rlib/Makefile
......@@ -56,16 +55,12 @@ run-make/libtest-junit/Makefile
5655run-make/libtest-thread-limit/Makefile
5756run-make/link-cfg/Makefile
5857run-make/link-framework/Makefile
59run-make/link-path-order/Makefile
6058run-make/linkage-attr-on-static/Makefile
6159run-make/long-linker-command-lines-cmd-exe/Makefile
6260run-make/long-linker-command-lines/Makefile
6361run-make/lto-linkage-used-attr/Makefile
6462run-make/lto-no-link-whole-rlib/Makefile
65run-make/lto-smoke-c/Makefile
6663run-make/macos-deployment-target/Makefile
67run-make/macos-fat-archive/Makefile
68run-make/manual-link/Makefile
6964run-make/min-global-align/Makefile
7065run-make/native-link-modifier-bundle/Makefile
7166run-make/native-link-modifier-whole-archive/Makefile
tests/run-make/archive-duplicate-names/Makefile deleted-16
......@@ -1,16 +0,0 @@
1# When two object archives with the same filename are present, an iterator is supposed to inspect each object, recognize the duplication and extract each one to a different directory.
2# This test checks that this duplicate handling behaviour has not been broken.
3# See https://github.com/rust-lang/rust/pull/24439
4
5# ignore-cross-compile
6include ../tools.mk
7
8all:
9 mkdir $(TMPDIR)/a
10 mkdir $(TMPDIR)/b
11 $(call COMPILE_OBJ,$(TMPDIR)/a/foo.o,foo.c)
12 $(call COMPILE_OBJ,$(TMPDIR)/b/foo.o,bar.c)
13 $(AR) crus $(TMPDIR)/libfoo.a $(TMPDIR)/a/foo.o $(TMPDIR)/b/foo.o
14 $(RUSTC) foo.rs
15 $(RUSTC) bar.rs
16 $(call RUN,bar)
tests/run-make/archive-duplicate-names/rmake.rs created+37
......@@ -0,0 +1,37 @@
1// When two object archives with the same filename are present, an iterator is supposed to
2// inspect each object, recognize the duplication and extract each one to a different directory.
3// This test checks that this duplicate handling behaviour has not been broken.
4// See https://github.com/rust-lang/rust/pull/24439
5
6//@ ignore-cross-compile
7// Reason: the compiled binary is executed
8
9use run_make_support::{cc, is_msvc, llvm_ar, rfs, run, rustc};
10
11fn main() {
12 rfs::create_dir("a");
13 rfs::create_dir("b");
14 compile_obj_force_foo("a", "foo");
15 compile_obj_force_foo("b", "bar");
16 let mut ar = llvm_ar();
17 ar.obj_to_ar().arg("libfoo.a");
18 if is_msvc() {
19 ar.arg("a/foo.obj").arg("b/foo.obj").run();
20 } else {
21 ar.arg("a/foo.o").arg("b/foo.o").run();
22 }
23 rustc().input("foo.rs").run();
24 rustc().input("bar.rs").run();
25 run("bar");
26}
27
28#[track_caller]
29pub fn compile_obj_force_foo(dir: &str, lib_name: &str) {
30 let obj_file = if is_msvc() { format!("{dir}/foo") } else { format!("{dir}/foo.o") };
31 let src = format!("{lib_name}.c");
32 if is_msvc() {
33 cc().arg("-c").out_exe(&obj_file).input(src).run();
34 } else {
35 cc().arg("-v").arg("-c").out_exe(&obj_file).input(src).run();
36 };
37}
tests/run-make/link-path-order/Makefile deleted-19
......@@ -1,19 +0,0 @@
1# ignore-cross-compile
2include ../tools.mk
3
4# Verifies that the -L arguments given to the linker is in the same order
5# as the -L arguments on the rustc command line.
6
7CORRECT_DIR=$(TMPDIR)/correct
8WRONG_DIR=$(TMPDIR)/wrong
9
10F := $(call NATIVE_STATICLIB_FILE,foo)
11
12all: $(call NATIVE_STATICLIB,correct) $(call NATIVE_STATICLIB,wrong)
13 mkdir -p $(CORRECT_DIR) $(WRONG_DIR)
14 mv $(call NATIVE_STATICLIB,correct) $(CORRECT_DIR)/$(F)
15 mv $(call NATIVE_STATICLIB,wrong) $(WRONG_DIR)/$(F)
16 $(RUSTC) main.rs -o $(TMPDIR)/should_succeed -L $(CORRECT_DIR) -L $(WRONG_DIR)
17 $(call RUN,should_succeed)
18 $(RUSTC) main.rs -o $(TMPDIR)/should_fail -L $(WRONG_DIR) -L $(CORRECT_DIR)
19 $(call FAIL,should_fail)
tests/run-make/link-path-order/rmake.rs created+33
......@@ -0,0 +1,33 @@
1// The order in which "library search path" `-L` arguments are given to the command line rustc
2// is important. These arguments must match the order of the linker's arguments. In this test,
3// fetching the Wrong library before the Correct one causes a function to return 0 instead of the
4// expected 1, causing a runtime panic, as expected.
5// See https://github.com/rust-lang/rust/pull/16904
6
7//@ ignore-cross-compile
8// Reason: the compiled binary is executed
9
10use run_make_support::{build_native_static_lib, path, rfs, run, run_fail, rustc, static_lib_name};
11
12fn main() {
13 build_native_static_lib("correct");
14 build_native_static_lib("wrong");
15 rfs::create_dir("correct");
16 rfs::create_dir("wrong");
17 rfs::rename(static_lib_name("correct"), path("correct").join(static_lib_name("foo")));
18 rfs::rename(static_lib_name("wrong"), path("wrong").join(static_lib_name("foo")));
19 rustc()
20 .input("main.rs")
21 .output("should_succeed")
22 .library_search_path("correct")
23 .library_search_path("wrong")
24 .run();
25 run("should_succeed");
26 rustc()
27 .input("main.rs")
28 .output("should_fail")
29 .library_search_path("wrong")
30 .library_search_path("correct")
31 .run();
32 run_fail("should_fail");
33}
tests/run-make/lto-smoke-c/Makefile deleted-12
......@@ -1,12 +0,0 @@
1# ignore-cross-compile
2include ../tools.mk
3
4# Apparently older versions of GCC segfault if -g is passed...
5CC := $(CC:-g=)
6
7all:
8 $(RUSTC) foo.rs -C lto
9 $(CC) bar.c $(call STATICLIB,foo) \
10 $(call OUT_EXE,bar) \
11 $(EXTRACFLAGS) $(EXTRACXXFLAGS)
12 $(call RUN,bar)
tests/run-make/lto-smoke-c/rmake.rs created+20
......@@ -0,0 +1,20 @@
1// LLVM's link-time-optimization (LTO) is a useful feature added to Rust in response
2// to #10741. This test uses this feature with `-C lto` alongside a native C library,
3// and checks that compilation and execution is successful.
4// See https://github.com/rust-lang/rust/issues/10741
5
6//@ ignore-cross-compile
7// Reason: the compiled binary is executed
8
9use run_make_support::{cc, extra_c_flags, extra_cxx_flags, run, rustc, static_lib_name};
10
11fn main() {
12 rustc().input("foo.rs").arg("-Clto").run();
13 cc().input("bar.c")
14 .arg(static_lib_name("foo"))
15 .out_exe("bar")
16 .args(extra_c_flags())
17 .args(extra_cxx_flags())
18 .run();
19 run("bar");
20}
tests/run-make/macos-fat-archive/Makefile deleted-10
......@@ -1,10 +0,0 @@
1# only-apple
2
3include ../tools.mk
4
5"$(TMPDIR)"/libnative-library.a: native-library.c
6 $(CC) -arch arm64 -arch x86_64 native-library.c -c -o "$(TMPDIR)"/native-library.o
7 $(AR) crs "$(TMPDIR)"/libnative-library.a "$(TMPDIR)"/native-library.o
8
9all: "$(TMPDIR)"/libnative-library.a
10 $(RUSTC) lib.rs --crate-type=lib -L "native=$(TMPDIR)" -l static=native-library
tests/run-make/macos-fat-archive/rmake.rs created+20
......@@ -0,0 +1,20 @@
1// macOS (and iOS) has a concept of universal (fat) binaries which contain code for multiple CPU
2// architectures in the same file. Apple is migrating from x86_64 to aarch64 CPUs,
3// so for the next few years it will be important for macOS developers to
4// build "fat" binaries (executables and cdylibs).
5
6// Rustc used to be unable to handle these special libraries, which was fixed in #98736. If
7// compilation in this test is successful, the native fat library was successfully linked to.
8// See https://github.com/rust-lang/rust/issues/55235
9
10//@ only-apple
11
12use run_make_support::{cc, llvm_ar, rustc};
13
14fn main() {
15 cc().args(&["-arch", "arm64", "-arch", "x86_64", "native-library.c", "-c"])
16 .out_exe("native-library.o")
17 .run();
18 llvm_ar().obj_to_ar().output_input("libnative-library.a", "native-library.o").run();
19 rustc().input("lib.rs").crate_type("lib").arg("-lstatic=native-library").run();
20}
tests/run-make/manual-link/Makefile deleted-7
......@@ -1,7 +0,0 @@
1# ignore-cross-compile
2include ../tools.mk
3
4all: $(TMPDIR)/libbar.a
5 $(RUSTC) foo.rs -lstatic=bar
6 $(RUSTC) main.rs
7 $(call RUN,main)
tests/run-make/manual-link/rmake.rs created+16
......@@ -0,0 +1,16 @@
1// A smoke test for the `-l` command line rustc flag, which manually links to the selected
2// library. Useful for native libraries, this is roughly equivalent to `#[link]` in Rust code.
3// If compilation succeeds, the flag successfully linked the native library.
4// See https://github.com/rust-lang/rust/pull/18470
5
6//@ ignore-cross-compile
7// Reason: the compiled binary is executed
8
9use run_make_support::{build_native_static_lib, run, rustc};
10
11fn main() {
12 build_native_static_lib("bar");
13 rustc().input("foo.rs").arg("-lstatic=bar").run();
14 rustc().input("main.rs").run();
15 run("main");
16}
tests/ui/asm/binary_asm_labels.stderr+15-5
......@@ -4,7 +4,9 @@ error: avoid using labels containing only the digits `0` and `1` in inline assem
44LL | asm!("0: jmp 0b");
55 | ^ use a different label that doesn't start with `0` or `1`
66 |
7 = note: an LLVM bug makes these labels ambiguous with a binary literal number
7 = help: start numbering with `2` instead
8 = note: an LLVM bug makes these labels ambiguous with a binary literal number on x86
9 = note: see <https://github.com/llvm/llvm-project/issues/99547> for more information
810 = note: `#[deny(binary_asm_labels)]` on by default
911
1012error: avoid using labels containing only the digits `0` and `1` in inline assembly
......@@ -13,7 +15,9 @@ error: avoid using labels containing only the digits `0` and `1` in inline assem
1315LL | asm!("1: jmp 1b");
1416 | ^ use a different label that doesn't start with `0` or `1`
1517 |
16 = note: an LLVM bug makes these labels ambiguous with a binary literal number
18 = help: start numbering with `2` instead
19 = note: an LLVM bug makes these labels ambiguous with a binary literal number on x86
20 = note: see <https://github.com/llvm/llvm-project/issues/99547> for more information
1721
1822error: avoid using labels containing only the digits `0` and `1` in inline assembly
1923 --> $DIR/binary_asm_labels.rs:13:15
......@@ -21,7 +25,9 @@ error: avoid using labels containing only the digits `0` and `1` in inline assem
2125LL | asm!("10: jmp 10b");
2226 | ^^ use a different label that doesn't start with `0` or `1`
2327 |
24 = note: an LLVM bug makes these labels ambiguous with a binary literal number
28 = help: start numbering with `2` instead
29 = note: an LLVM bug makes these labels ambiguous with a binary literal number on x86
30 = note: see <https://github.com/llvm/llvm-project/issues/99547> for more information
2531
2632error: avoid using labels containing only the digits `0` and `1` in inline assembly
2733 --> $DIR/binary_asm_labels.rs:14:15
......@@ -29,7 +35,9 @@ error: avoid using labels containing only the digits `0` and `1` in inline assem
2935LL | asm!("01: jmp 01b");
3036 | ^^ use a different label that doesn't start with `0` or `1`
3137 |
32 = note: an LLVM bug makes these labels ambiguous with a binary literal number
38 = help: start numbering with `2` instead
39 = note: an LLVM bug makes these labels ambiguous with a binary literal number on x86
40 = note: see <https://github.com/llvm/llvm-project/issues/99547> for more information
3341
3442error: avoid using labels containing only the digits `0` and `1` in inline assembly
3543 --> $DIR/binary_asm_labels.rs:15:15
......@@ -37,7 +45,9 @@ error: avoid using labels containing only the digits `0` and `1` in inline assem
3745LL | asm!("1001101: jmp 1001101b");
3846 | ^^^^^^^ use a different label that doesn't start with `0` or `1`
3947 |
40 = note: an LLVM bug makes these labels ambiguous with a binary literal number
48 = help: start numbering with `2` instead
49 = note: an LLVM bug makes these labels ambiguous with a binary literal number on x86
50 = note: see <https://github.com/llvm/llvm-project/issues/99547> for more information
4151
4252error: aborting due to 5 previous errors
4353
tests/ui/asm/binary_asm_labels_allowed.rs created+17
......@@ -0,0 +1,17 @@
1//@ build-pass
2//@ only-aarch64
3
4// The `binary_asm_labels` lint should only be raised on `x86`. Make sure it
5// doesn't get raised on other platforms.
6
7use std::arch::asm;
8
9fn main() {
10 unsafe {
11 asm!("0: bl 0b");
12 asm!("1: bl 1b");
13 asm!("10: bl 10b");
14 asm!("01: bl 01b");
15 asm!("1001101: bl 1001101b");
16 }
17}
tests/ui/empty/empty-struct-braces-expr.stderr+28-9
......@@ -71,12 +71,22 @@ error[E0533]: expected value, found struct variant `E::Empty3`
7171 |
7272LL | let e3 = E::Empty3;
7373 | ^^^^^^^^^ not a value
74 |
75help: you might have meant to create a new value of the struct
76 |
77LL | let e3 = E::Empty3 {};
78 | ++
7479
7580error[E0533]: expected value, found struct variant `E::Empty3`
7681 --> $DIR/empty-struct-braces-expr.rs:19:14
7782 |
7883LL | let e3 = E::Empty3();
7984 | ^^^^^^^^^ not a value
85 |
86help: you might have meant to create a new value of the struct
87 |
88LL | let e3 = E::Empty3 {};
89 | ~~
8090
8191error[E0423]: expected function, tuple struct or tuple variant, found struct `XEmpty1`
8292 --> $DIR/empty-struct-braces-expr.rs:23:15
......@@ -104,25 +114,34 @@ error[E0599]: no variant or associated item named `Empty3` found for enum `empty
104114 --> $DIR/empty-struct-braces-expr.rs:25:19
105115 |
106116LL | let xe3 = XE::Empty3;
107 | ^^^^^^
108 | |
109 | variant or associated item not found in `XE`
110 | help: there is a variant with a similar name: `XEmpty3`
117 | ^^^^^^ variant or associated item not found in `XE`
118 |
119help: there is a variant with a similar name
120 |
121LL | let xe3 = XE::XEmpty3;
122 | ~~~~~~~
111123
112124error[E0599]: no variant or associated item named `Empty3` found for enum `empty_struct::XE` in the current scope
113125 --> $DIR/empty-struct-braces-expr.rs:26:19
114126 |
115127LL | let xe3 = XE::Empty3();
116 | ^^^^^^
117 | |
118 | variant or associated item not found in `XE`
119 | help: there is a variant with a similar name: `XEmpty3`
128 | ^^^^^^ variant or associated item not found in `XE`
129 |
130help: there is a variant with a similar name
131 |
132LL | let xe3 = XE::XEmpty3 {};
133 | ~~~~~~~~~~
120134
121135error[E0599]: no variant named `Empty1` found for enum `empty_struct::XE`
122136 --> $DIR/empty-struct-braces-expr.rs:28:9
123137 |
124138LL | XE::Empty1 {};
125 | ^^^^^^ help: there is a variant with a similar name: `XEmpty3`
139 | ^^^^^^
140 |
141help: there is a variant with a similar name
142 |
143LL | XE::XEmpty3 {};
144 | ~~~~~~~~~~
126145
127146error: aborting due to 9 previous errors
128147
tests/ui/enum/error-variant-with-turbofishes.stderr+5
......@@ -3,6 +3,11 @@ error[E0533]: expected value, found struct variant `Struct<0>::Variant`
33 |
44LL | let x = Struct::<0>::Variant;
55 | ^^^^^^^^^^^^^^^^^^^^ not a value
6 |
7help: you might have meant to create a new value of the struct
8 |
9LL | let x = Struct::<0>::Variant { x: /* value */ };
10 | ++++++++++++++++++
611
712error: aborting due to 1 previous error
813
tests/ui/expr/issue-22933-2.stderr+6-4
......@@ -5,10 +5,12 @@ LL | enum Delicious {
55 | -------------- variant or associated item `PIE` not found for this enum
66...
77LL | ApplePie = Delicious::Apple as isize | Delicious::PIE as isize,
8 | ^^^
9 | |
10 | variant or associated item not found in `Delicious`
11 | help: there is a variant with a similar name: `Pie`
8 | ^^^ variant or associated item not found in `Delicious`
9 |
10help: there is a variant with a similar name
11 |
12LL | ApplePie = Delicious::Apple as isize | Delicious::Pie as isize,
13 | ~~~
1214
1315error: aborting due to 1 previous error
1416
tests/ui/issues/issue-23217.stderr+6-4
......@@ -4,10 +4,12 @@ error[E0599]: no variant or associated item named `A` found for enum `SomeEnum`
44LL | pub enum SomeEnum {
55 | ----------------- variant or associated item `A` not found for this enum
66LL | B = SomeEnum::A,
7 | ^
8 | |
9 | variant or associated item not found in `SomeEnum`
10 | help: there is a variant with a similar name: `B`
7 | ^ variant or associated item not found in `SomeEnum`
8 |
9help: there is a variant with a similar name
10 |
11LL | B = SomeEnum::B,
12 | ~
1113
1214error: aborting due to 1 previous error
1315
tests/ui/issues/issue-28971.stderr+6-4
......@@ -5,10 +5,12 @@ LL | enum Foo {
55 | -------- variant or associated item `Baz` not found for this enum
66...
77LL | Foo::Baz(..) => (),
8 | ^^^
9 | |
10 | variant or associated item not found in `Foo`
11 | help: there is a variant with a similar name: `Bar`
8 | ^^^ variant or associated item not found in `Foo`
9 |
10help: there is a variant with a similar name
11 |
12LL | Foo::Bar(..) => (),
13 | ~~~
1214
1315error[E0596]: cannot borrow `f` as mutable, as it is not declared as mutable
1416 --> $DIR/issue-28971.rs:15:5
tests/ui/issues/issue-34209.stderr+6-1
......@@ -5,7 +5,12 @@ LL | enum S {
55 | ------ variant `B` not found here
66...
77LL | S::B {} => {},
8 | ^ help: there is a variant with a similar name: `A`
8 | ^
9 |
10help: there is a variant with a similar name
11 |
12LL | S::A {} => {},
13 | ~
914
1015error: aborting due to 1 previous error
1116
tests/ui/issues/issue-4736.stderr+2-2
......@@ -9,8 +9,8 @@ LL | let z = NonCopyable{ p: () };
99 |
1010help: `NonCopyable` is a tuple struct, use the appropriate syntax
1111 |
12LL | let z = NonCopyable(/* fields */);
13 | ~~~~~~~~~~~~~~~~~~~~~~~~~
12LL | let z = NonCopyable(/* () */);
13 | ~~~~~~~~~~~~~~~~~~~~~
1414
1515error: aborting due to 1 previous error
1616
tests/ui/issues/issue-80607.stderr+2-2
......@@ -9,8 +9,8 @@ LL | Enum::V1 { x }
99 |
1010help: `Enum::V1` is a tuple variant, use the appropriate syntax
1111 |
12LL | Enum::V1(/* fields */)
13 | ~~~~~~~~~~~~~~~~~~~~~~
12LL | Enum::V1(/* i32 */)
13 | ~~~~~~~~~~~
1414
1515error: aborting due to 1 previous error
1616
tests/ui/numeric/numeric-fields.stderr+2-2
......@@ -9,8 +9,8 @@ LL | let s = S{0b1: 10, 0: 11};
99 |
1010help: `S` is a tuple struct, use the appropriate syntax
1111 |
12LL | let s = S(/* fields */);
13 | ~~~~~~~~~~~~~~~
12LL | let s = S(/* u8 */, /* u16 */);
13 | ~~~~~~~~~~~~~~~~~~~~~~
1414
1515error[E0026]: struct `S` does not have a field named `0x1`
1616 --> $DIR/numeric-fields.rs:7:17
tests/ui/parser/struct-literal-variant-in-if.stderr+5
......@@ -47,6 +47,11 @@ error[E0533]: expected value, found struct variant `E::V`
4747 |
4848LL | if x == E::V { field } {}
4949 | ^^^^ not a value
50 |
51help: you might have meant to create a new value of the struct
52 |
53LL | if x == (E::V { field }) {}
54 | + +
5055
5156error[E0308]: mismatched types
5257 --> $DIR/struct-literal-variant-in-if.rs:10:20
tests/ui/resolve/issue-18252.stderr+5
......@@ -3,6 +3,11 @@ error[E0533]: expected value, found struct variant `Foo::Variant`
33 |
44LL | let f = Foo::Variant(42);
55 | ^^^^^^^^^^^^ not a value
6 |
7help: you might have meant to create a new value of the struct
8 |
9LL | let f = Foo::Variant { x: /* value */ };
10 | ~~~~~~~~~~~~~~~~~~
611
712error: aborting due to 1 previous error
813
tests/ui/resolve/issue-19452.stderr+10
......@@ -3,12 +3,22 @@ error[E0533]: expected value, found struct variant `Homura::Madoka`
33 |
44LL | let homura = Homura::Madoka;
55 | ^^^^^^^^^^^^^^ not a value
6 |
7help: you might have meant to create a new value of the struct
8 |
9LL | let homura = Homura::Madoka { age: /* value */ };
10 | ++++++++++++++++++++
611
712error[E0533]: expected value, found struct variant `issue_19452_aux::Homura::Madoka`
813 --> $DIR/issue-19452.rs:13:18
914 |
1015LL | let homura = issue_19452_aux::Homura::Madoka;
1116 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ not a value
17 |
18help: you might have meant to create a new value of the struct
19 |
20LL | let homura = issue_19452_aux::Homura::Madoka { age: /* value */ };
21 | ++++++++++++++++++++
1222
1323error: aborting due to 2 previous errors
1424
tests/ui/resolve/privacy-enum-ctor.stderr+20
......@@ -295,6 +295,11 @@ error[E0533]: expected value, found struct variant `Z::Struct`
295295 |
296296LL | let _: Z = Z::Struct;
297297 | ^^^^^^^^^ not a value
298 |
299help: you might have meant to create a new value of the struct
300 |
301LL | let _: Z = Z::Struct { s: /* value */ };
302 | ++++++++++++++++++
298303
299304error[E0618]: expected function, found enum variant `Z::Unit`
300305 --> $DIR/privacy-enum-ctor.rs:31:17
......@@ -336,6 +341,11 @@ error[E0533]: expected value, found struct variant `m::E::Struct`
336341 |
337342LL | let _: E = m::E::Struct;
338343 | ^^^^^^^^^^^^ not a value
344 |
345help: you might have meant to create a new value of the struct
346 |
347LL | let _: E = m::E::Struct { s: /* value */ };
348 | ++++++++++++++++++
339349
340350error[E0618]: expected function, found enum variant `m::E::Unit`
341351 --> $DIR/privacy-enum-ctor.rs:47:16
......@@ -377,6 +387,11 @@ error[E0533]: expected value, found struct variant `E::Struct`
377387 |
378388LL | let _: E = E::Struct;
379389 | ^^^^^^^^^ not a value
390 |
391help: you might have meant to create a new value of the struct
392 |
393LL | let _: E = E::Struct { s: /* value */ };
394 | ++++++++++++++++++
380395
381396error[E0618]: expected function, found enum variant `E::Unit`
382397 --> $DIR/privacy-enum-ctor.rs:55:16
......@@ -400,6 +415,11 @@ error[E0533]: expected value, found struct variant `m::n::Z::Struct`
400415 |
401416LL | let _: Z = m::n::Z::Struct;
402417 | ^^^^^^^^^^^^^^^ not a value
418 |
419help: you might have meant to create a new value of the struct
420 |
421LL | let _: Z = m::n::Z::Struct { s: /* value */ };
422 | ++++++++++++++++++
403423
404424error: aborting due to 23 previous errors
405425
tests/ui/suggestions/fn-or-tuple-struct-without-args.stderr+5
......@@ -129,6 +129,11 @@ error[E0533]: expected value, found struct variant `E::B`
129129 |
130130LL | let _: E = E::B;
131131 | ^^^^ not a value
132 |
133help: you might have meant to create a new value of the struct
134 |
135LL | let _: E = E::B { a: /* value */ };
136 | ++++++++++++++++++
132137
133138error[E0308]: mismatched types
134139 --> $DIR/fn-or-tuple-struct-without-args.rs:37:20
tests/ui/suggestions/incorrect-variant-literal.rs created+55
......@@ -0,0 +1,55 @@
1//@ only-linux
2//@ compile-flags: --error-format=human --color=always
3
4enum Enum {
5 Unit,
6 Tuple(i32),
7 Struct { x: i32 },
8}
9
10fn main() {
11 Enum::Unit;
12 Enum::Tuple;
13 Enum::Struct;
14 Enum::Unit();
15 Enum::Tuple();
16 Enum::Struct();
17 Enum::Unit {};
18 Enum::Tuple {};
19 Enum::Struct {};
20 Enum::Unit(0);
21 Enum::Tuple(0);
22 Enum::Struct(0);
23 Enum::Unit { x: 0 };
24 Enum::Tuple { x: 0 };
25 Enum::Struct { x: 0 }; // ok
26 Enum::Unit(0, 0);
27 Enum::Tuple(0, 0);
28 Enum::Struct(0, 0);
29 Enum::Unit { x: 0, y: 0 };
30
31 Enum::Tuple { x: 0, y: 0 };
32
33 Enum::Struct { x: 0, y: 0 };
34 Enum::unit;
35 Enum::tuple;
36 Enum::r#struct;
37 Enum::unit();
38 Enum::tuple();
39 Enum::r#struct();
40 Enum::unit {};
41 Enum::tuple {};
42 Enum::r#struct {};
43 Enum::unit(0);
44 Enum::tuple(0);
45 Enum::r#struct(0);
46 Enum::unit { x: 0 };
47 Enum::tuple { x: 0 };
48 Enum::r#struct { x: 0 };
49 Enum::unit(0, 0);
50 Enum::tuple(0, 0);
51 Enum::r#struct(0, 0);
52 Enum::unit { x: 0, y: 0 };
53 Enum::tuple { x: 0, y: 0 };
54 Enum::r#struct { x: 0, y: 0 };
55}
tests/ui/suggestions/incorrect-variant-literal.svg created+1028
......@@ -0,0 +1,1028 @@
1<svg width="886px" height="9038px" xmlns="http://www.w3.org/2000/svg">
2 <style>
3 .fg { fill: #AAAAAA }
4 .bg { background: #000000 }
5 .fg-ansi256-009 { fill: #FF5555 }
6 .fg-ansi256-010 { fill: #55FF55 }
7 .fg-ansi256-012 { fill: #5555FF }
8 .fg-ansi256-014 { fill: #55FFFF }
9 .container {
10 padding: 0 10px;
11 line-height: 18px;
12 }
13 .bold { font-weight: bold; }
14 tspan {
15 font: 14px SFMono-Regular, Consolas, Liberation Mono, Menlo, monospace;
16 white-space: pre;
17 line-height: 18px;
18 }
19 </style>
20
21 <rect width="100%" height="100%" y="0" rx="4.5" class="bg" />
22
23 <text xml:space="preserve" class="container fg">
24 <tspan x="10px" y="28px"><tspan class="fg-ansi256-009 bold">error[E0533]</tspan><tspan class="bold">: expected value, found struct variant `Enum::Struct`</tspan>
25</tspan>
26 <tspan x="10px" y="46px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">--&gt; </tspan><tspan>$DIR/incorrect-variant-literal.rs:13:5</tspan>
27</tspan>
28 <tspan x="10px" y="64px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan>
29</tspan>
30 <tspan x="10px" y="82px"><tspan class="fg-ansi256-012 bold">LL</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan><tspan> Enum::Struct;</tspan>
31</tspan>
32 <tspan x="10px" y="100px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan><tspan> </tspan><tspan class="fg-ansi256-009 bold">^^^^^^^^^^^^</tspan><tspan> </tspan><tspan class="fg-ansi256-009 bold">not a value</tspan>
33</tspan>
34 <tspan x="10px" y="118px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan>
35</tspan>
36 <tspan x="10px" y="136px"><tspan class="fg-ansi256-014 bold">help</tspan><tspan>: you might have meant to create a new value of the struct</tspan>
37</tspan>
38 <tspan x="10px" y="154px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan>
39</tspan>
40 <tspan x="10px" y="172px"><tspan class="fg-ansi256-012 bold">LL</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">| </tspan><tspan> Enum::Struct</tspan><tspan class="fg-ansi256-010"> { x: /* value */ }</tspan><tspan>;</tspan>
41</tspan>
42 <tspan x="10px" y="190px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan><tspan> </tspan><tspan class="fg-ansi256-010">++++++++++++++++++</tspan>
43</tspan>
44 <tspan x="10px" y="208px">
45</tspan>
46 <tspan x="10px" y="226px"><tspan class="fg-ansi256-009 bold">error[E0618]</tspan><tspan class="bold">: expected function, found enum variant `Enum::Unit`</tspan>
47</tspan>
48 <tspan x="10px" y="244px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">--&gt; </tspan><tspan>$DIR/incorrect-variant-literal.rs:14:5</tspan>
49</tspan>
50 <tspan x="10px" y="262px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan>
51</tspan>
52 <tspan x="10px" y="280px"><tspan class="fg-ansi256-012 bold">LL</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan><tspan> Unit,</tspan>
53</tspan>
54 <tspan x="10px" y="298px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">----</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">enum variant `Enum::Unit` defined here</tspan>
55</tspan>
56 <tspan x="10px" y="316px"><tspan class="fg-ansi256-012 bold">...</tspan>
57</tspan>
58 <tspan x="10px" y="334px"><tspan class="fg-ansi256-012 bold">LL</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan><tspan> Enum::Unit();</tspan>
59</tspan>
60 <tspan x="10px" y="352px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan><tspan> </tspan><tspan class="fg-ansi256-009 bold">^^^^^^^^^^</tspan><tspan class="fg-ansi256-012 bold">--</tspan>
61</tspan>
62 <tspan x="10px" y="370px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan>
63</tspan>
64 <tspan x="10px" y="388px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">call expression requires function</tspan>
65</tspan>
66 <tspan x="10px" y="406px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan>
67</tspan>
68 <tspan x="10px" y="424px"><tspan class="fg-ansi256-014 bold">help</tspan><tspan>: `Enum::Unit` is a unit enum variant, and does not take parentheses to be constructed</tspan>
69</tspan>
70 <tspan x="10px" y="442px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan>
71</tspan>
72 <tspan x="10px" y="460px"><tspan class="fg-ansi256-012 bold">LL</tspan><tspan> </tspan><tspan class="fg-ansi256-009">- </tspan><tspan> Enum::Unit</tspan><tspan class="fg-ansi256-009">()</tspan><tspan>;</tspan>
73</tspan>
74 <tspan x="10px" y="478px"><tspan class="fg-ansi256-012 bold">LL</tspan><tspan> </tspan><tspan class="fg-ansi256-010">+ </tspan><tspan> Enum::Unit;</tspan>
75</tspan>
76 <tspan x="10px" y="496px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan>
77</tspan>
78 <tspan x="10px" y="514px">
79</tspan>
80 <tspan x="10px" y="532px"><tspan class="fg-ansi256-009 bold">error[E0061]</tspan><tspan class="bold">: this enum variant takes 1 argument but 0 arguments were supplied</tspan>
81</tspan>
82 <tspan x="10px" y="550px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">--&gt; </tspan><tspan>$DIR/incorrect-variant-literal.rs:15:5</tspan>
83</tspan>
84 <tspan x="10px" y="568px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan>
85</tspan>
86 <tspan x="10px" y="586px"><tspan class="fg-ansi256-012 bold">LL</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan><tspan> Enum::Tuple();</tspan>
87</tspan>
88 <tspan x="10px" y="604px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan><tspan> </tspan><tspan class="fg-ansi256-009 bold">^^^^^^^^^^^</tspan><tspan class="fg-ansi256-012 bold">--</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">argument #1 of type `i32` is missing</tspan>
89</tspan>
90 <tspan x="10px" y="622px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan>
91</tspan>
92 <tspan x="10px" y="640px"><tspan class="fg-ansi256-010 bold">note</tspan><tspan>: tuple variant defined here</tspan>
93</tspan>
94 <tspan x="10px" y="658px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">--&gt; </tspan><tspan>$DIR/incorrect-variant-literal.rs:6:5</tspan>
95</tspan>
96 <tspan x="10px" y="676px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan>
97</tspan>
98 <tspan x="10px" y="694px"><tspan class="fg-ansi256-012 bold">LL</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan><tspan> Tuple(i32),</tspan>
99</tspan>
100 <tspan x="10px" y="712px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan><tspan> </tspan><tspan class="fg-ansi256-010 bold">^^^^^</tspan>
101</tspan>
102 <tspan x="10px" y="730px"><tspan class="fg-ansi256-014 bold">help</tspan><tspan>: provide the argument</tspan>
103</tspan>
104 <tspan x="10px" y="748px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan>
105</tspan>
106 <tspan x="10px" y="766px"><tspan class="fg-ansi256-012 bold">LL</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">| </tspan><tspan> Enum::Tuple</tspan><tspan class="fg-ansi256-010">(/* i32 */)</tspan><tspan>;</tspan>
107</tspan>
108 <tspan x="10px" y="784px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan><tspan> </tspan><tspan class="fg-ansi256-010">~~~~~~~~~~~</tspan>
109</tspan>
110 <tspan x="10px" y="802px">
111</tspan>
112 <tspan x="10px" y="820px"><tspan class="fg-ansi256-009 bold">error[E0533]</tspan><tspan class="bold">: expected value, found struct variant `Enum::Struct`</tspan>
113</tspan>
114 <tspan x="10px" y="838px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">--&gt; </tspan><tspan>$DIR/incorrect-variant-literal.rs:16:5</tspan>
115</tspan>
116 <tspan x="10px" y="856px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan>
117</tspan>
118 <tspan x="10px" y="874px"><tspan class="fg-ansi256-012 bold">LL</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan><tspan> Enum::Struct();</tspan>
119</tspan>
120 <tspan x="10px" y="892px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan><tspan> </tspan><tspan class="fg-ansi256-009 bold">^^^^^^^^^^^^</tspan><tspan> </tspan><tspan class="fg-ansi256-009 bold">not a value</tspan>
121</tspan>
122 <tspan x="10px" y="910px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan>
123</tspan>
124 <tspan x="10px" y="928px"><tspan class="fg-ansi256-014 bold">help</tspan><tspan>: you might have meant to create a new value of the struct</tspan>
125</tspan>
126 <tspan x="10px" y="946px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan>
127</tspan>
128 <tspan x="10px" y="964px"><tspan class="fg-ansi256-012 bold">LL</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">| </tspan><tspan> Enum::Struct</tspan><tspan class="fg-ansi256-010"> { x: /* value */ }</tspan><tspan>;</tspan>
129</tspan>
130 <tspan x="10px" y="982px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan><tspan> </tspan><tspan class="fg-ansi256-010">~~~~~~~~~~~~~~~~~~</tspan>
131</tspan>
132 <tspan x="10px" y="1000px">
133</tspan>
134 <tspan x="10px" y="1018px"><tspan class="fg-ansi256-009 bold">error[E0063]</tspan><tspan class="bold">: missing field `0` in initializer of `Enum`</tspan>
135</tspan>
136 <tspan x="10px" y="1036px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">--&gt; </tspan><tspan>$DIR/incorrect-variant-literal.rs:18:5</tspan>
137</tspan>
138 <tspan x="10px" y="1054px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan>
139</tspan>
140 <tspan x="10px" y="1072px"><tspan class="fg-ansi256-012 bold">LL</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan><tspan> Enum::Tuple {};</tspan>
141</tspan>
142 <tspan x="10px" y="1090px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan><tspan> </tspan><tspan class="fg-ansi256-009 bold">^^^^^^^^^^^</tspan><tspan> </tspan><tspan class="fg-ansi256-009 bold">missing `0`</tspan>
143</tspan>
144 <tspan x="10px" y="1108px">
145</tspan>
146 <tspan x="10px" y="1126px"><tspan class="fg-ansi256-009 bold">error[E0063]</tspan><tspan class="bold">: missing field `x` in initializer of `Enum`</tspan>
147</tspan>
148 <tspan x="10px" y="1144px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">--&gt; </tspan><tspan>$DIR/incorrect-variant-literal.rs:19:5</tspan>
149</tspan>
150 <tspan x="10px" y="1162px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan>
151</tspan>
152 <tspan x="10px" y="1180px"><tspan class="fg-ansi256-012 bold">LL</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan><tspan> Enum::Struct {};</tspan>
153</tspan>
154 <tspan x="10px" y="1198px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan><tspan> </tspan><tspan class="fg-ansi256-009 bold">^^^^^^^^^^^^</tspan><tspan> </tspan><tspan class="fg-ansi256-009 bold">missing `x`</tspan>
155</tspan>
156 <tspan x="10px" y="1216px">
157</tspan>
158 <tspan x="10px" y="1234px"><tspan class="fg-ansi256-009 bold">error[E0618]</tspan><tspan class="bold">: expected function, found `Enum`</tspan>
159</tspan>
160 <tspan x="10px" y="1252px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">--&gt; </tspan><tspan>$DIR/incorrect-variant-literal.rs:20:5</tspan>
161</tspan>
162 <tspan x="10px" y="1270px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan>
163</tspan>
164 <tspan x="10px" y="1288px"><tspan class="fg-ansi256-012 bold">LL</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan><tspan> Unit,</tspan>
165</tspan>
166 <tspan x="10px" y="1306px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">----</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">`Enum::Unit` defined here</tspan>
167</tspan>
168 <tspan x="10px" y="1324px"><tspan class="fg-ansi256-012 bold">...</tspan>
169</tspan>
170 <tspan x="10px" y="1342px"><tspan class="fg-ansi256-012 bold">LL</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan><tspan> Enum::Unit(0);</tspan>
171</tspan>
172 <tspan x="10px" y="1360px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan><tspan> </tspan><tspan class="fg-ansi256-009 bold">^^^^^^^^^^</tspan><tspan class="fg-ansi256-012 bold">---</tspan>
173</tspan>
174 <tspan x="10px" y="1378px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan>
175</tspan>
176 <tspan x="10px" y="1396px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">call expression requires function</tspan>
177</tspan>
178 <tspan x="10px" y="1414px">
179</tspan>
180 <tspan x="10px" y="1432px"><tspan class="fg-ansi256-009 bold">error[E0533]</tspan><tspan class="bold">: expected value, found struct variant `Enum::Struct`</tspan>
181</tspan>
182 <tspan x="10px" y="1450px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">--&gt; </tspan><tspan>$DIR/incorrect-variant-literal.rs:22:5</tspan>
183</tspan>
184 <tspan x="10px" y="1468px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan>
185</tspan>
186 <tspan x="10px" y="1486px"><tspan class="fg-ansi256-012 bold">LL</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan><tspan> Enum::Struct(0);</tspan>
187</tspan>
188 <tspan x="10px" y="1504px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan><tspan> </tspan><tspan class="fg-ansi256-009 bold">^^^^^^^^^^^^</tspan><tspan> </tspan><tspan class="fg-ansi256-009 bold">not a value</tspan>
189</tspan>
190 <tspan x="10px" y="1522px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan>
191</tspan>
192 <tspan x="10px" y="1540px"><tspan class="fg-ansi256-014 bold">help</tspan><tspan>: you might have meant to create a new value of the struct</tspan>
193</tspan>
194 <tspan x="10px" y="1558px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan>
195</tspan>
196 <tspan x="10px" y="1576px"><tspan class="fg-ansi256-012 bold">LL</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">| </tspan><tspan> Enum::Struct</tspan><tspan class="fg-ansi256-010"> { x: /* value */ }</tspan><tspan>;</tspan>
197</tspan>
198 <tspan x="10px" y="1594px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan><tspan> </tspan><tspan class="fg-ansi256-010">~~~~~~~~~~~~~~~~~~</tspan>
199</tspan>
200 <tspan x="10px" y="1612px">
201</tspan>
202 <tspan x="10px" y="1630px"><tspan class="fg-ansi256-009 bold">error[E0559]</tspan><tspan class="bold">: variant `Enum::Unit` has no field named `x`</tspan>
203</tspan>
204 <tspan x="10px" y="1648px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">--&gt; </tspan><tspan>$DIR/incorrect-variant-literal.rs:23:18</tspan>
205</tspan>
206 <tspan x="10px" y="1666px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan>
207</tspan>
208 <tspan x="10px" y="1684px"><tspan class="fg-ansi256-012 bold">LL</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan><tspan> Enum::Unit { x: 0 };</tspan>
209</tspan>
210 <tspan x="10px" y="1702px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan><tspan> </tspan><tspan class="fg-ansi256-009 bold">^</tspan><tspan> </tspan><tspan class="fg-ansi256-009 bold">`Enum::Unit` does not have this field</tspan>
211</tspan>
212 <tspan x="10px" y="1720px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan>
213</tspan>
214 <tspan x="10px" y="1738px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">= </tspan><tspan class="bold">note</tspan><tspan>: all struct fields are already assigned</tspan>
215</tspan>
216 <tspan x="10px" y="1756px">
217</tspan>
218 <tspan x="10px" y="1774px"><tspan class="fg-ansi256-009 bold">error[E0559]</tspan><tspan class="bold">: variant `Enum::Tuple` has no field named `x`</tspan>
219</tspan>
220 <tspan x="10px" y="1792px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">--&gt; </tspan><tspan>$DIR/incorrect-variant-literal.rs:24:19</tspan>
221</tspan>
222 <tspan x="10px" y="1810px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan>
223</tspan>
224 <tspan x="10px" y="1828px"><tspan class="fg-ansi256-012 bold">LL</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan><tspan> Tuple(i32),</tspan>
225</tspan>
226 <tspan x="10px" y="1846px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">-----</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">`Enum::Tuple` defined here</tspan>
227</tspan>
228 <tspan x="10px" y="1864px"><tspan class="fg-ansi256-012 bold">...</tspan>
229</tspan>
230 <tspan x="10px" y="1882px"><tspan class="fg-ansi256-012 bold">LL</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan><tspan> Enum::Tuple { x: 0 };</tspan>
231</tspan>
232 <tspan x="10px" y="1900px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan><tspan> </tspan><tspan class="fg-ansi256-009 bold">^</tspan><tspan> </tspan><tspan class="fg-ansi256-009 bold">field does not exist</tspan>
233</tspan>
234 <tspan x="10px" y="1918px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan>
235</tspan>
236 <tspan x="10px" y="1936px"><tspan class="fg-ansi256-014 bold">help</tspan><tspan>: `Enum::Tuple` is a tuple variant, use the appropriate syntax</tspan>
237</tspan>
238 <tspan x="10px" y="1954px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan>
239</tspan>
240 <tspan x="10px" y="1972px"><tspan class="fg-ansi256-012 bold">LL</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">| </tspan><tspan> Enum::Tuple</tspan><tspan class="fg-ansi256-010">(/* i32 */)</tspan><tspan>;</tspan>
241</tspan>
242 <tspan x="10px" y="1990px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan><tspan> </tspan><tspan class="fg-ansi256-010">~~~~~~~~~~~</tspan>
243</tspan>
244 <tspan x="10px" y="2008px">
245</tspan>
246 <tspan x="10px" y="2026px"><tspan class="fg-ansi256-009 bold">error[E0618]</tspan><tspan class="bold">: expected function, found `Enum`</tspan>
247</tspan>
248 <tspan x="10px" y="2044px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">--&gt; </tspan><tspan>$DIR/incorrect-variant-literal.rs:26:5</tspan>
249</tspan>
250 <tspan x="10px" y="2062px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan>
251</tspan>
252 <tspan x="10px" y="2080px"><tspan class="fg-ansi256-012 bold">LL</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan><tspan> Unit,</tspan>
253</tspan>
254 <tspan x="10px" y="2098px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">----</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">`Enum::Unit` defined here</tspan>
255</tspan>
256 <tspan x="10px" y="2116px"><tspan class="fg-ansi256-012 bold">...</tspan>
257</tspan>
258 <tspan x="10px" y="2134px"><tspan class="fg-ansi256-012 bold">LL</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan><tspan> Enum::Unit(0, 0);</tspan>
259</tspan>
260 <tspan x="10px" y="2152px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan><tspan> </tspan><tspan class="fg-ansi256-009 bold">^^^^^^^^^^</tspan><tspan class="fg-ansi256-012 bold">------</tspan>
261</tspan>
262 <tspan x="10px" y="2170px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan>
263</tspan>
264 <tspan x="10px" y="2188px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">call expression requires function</tspan>
265</tspan>
266 <tspan x="10px" y="2206px">
267</tspan>
268 <tspan x="10px" y="2224px"><tspan class="fg-ansi256-009 bold">error[E0061]</tspan><tspan class="bold">: this enum variant takes 1 argument but 2 arguments were supplied</tspan>
269</tspan>
270 <tspan x="10px" y="2242px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">--&gt; </tspan><tspan>$DIR/incorrect-variant-literal.rs:27:5</tspan>
271</tspan>
272 <tspan x="10px" y="2260px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan>
273</tspan>
274 <tspan x="10px" y="2278px"><tspan class="fg-ansi256-012 bold">LL</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan><tspan> Enum::Tuple(0, 0);</tspan>
275</tspan>
276 <tspan x="10px" y="2296px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan><tspan> </tspan><tspan class="fg-ansi256-009 bold">^^^^^^^^^^^</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">-</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">unexpected argument #2 of type `{integer}`</tspan>
277</tspan>
278 <tspan x="10px" y="2314px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan>
279</tspan>
280 <tspan x="10px" y="2332px"><tspan class="fg-ansi256-010 bold">note</tspan><tspan>: tuple variant defined here</tspan>
281</tspan>
282 <tspan x="10px" y="2350px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">--&gt; </tspan><tspan>$DIR/incorrect-variant-literal.rs:6:5</tspan>
283</tspan>
284 <tspan x="10px" y="2368px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan>
285</tspan>
286 <tspan x="10px" y="2386px"><tspan class="fg-ansi256-012 bold">LL</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan><tspan> Tuple(i32),</tspan>
287</tspan>
288 <tspan x="10px" y="2404px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan><tspan> </tspan><tspan class="fg-ansi256-010 bold">^^^^^</tspan>
289</tspan>
290 <tspan x="10px" y="2422px"><tspan class="fg-ansi256-014 bold">help</tspan><tspan>: remove the extra argument</tspan>
291</tspan>
292 <tspan x="10px" y="2440px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan>
293</tspan>
294 <tspan x="10px" y="2458px"><tspan class="fg-ansi256-012 bold">LL</tspan><tspan> </tspan><tspan class="fg-ansi256-009">- </tspan><tspan> Enum::Tuple(0</tspan><tspan class="fg-ansi256-009">, 0</tspan><tspan>);</tspan>
295</tspan>
296 <tspan x="10px" y="2476px"><tspan class="fg-ansi256-012 bold">LL</tspan><tspan> </tspan><tspan class="fg-ansi256-010">+ </tspan><tspan> Enum::Tuple(0);</tspan>
297</tspan>
298 <tspan x="10px" y="2494px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan>
299</tspan>
300 <tspan x="10px" y="2512px">
301</tspan>
302 <tspan x="10px" y="2530px"><tspan class="fg-ansi256-009 bold">error[E0533]</tspan><tspan class="bold">: expected value, found struct variant `Enum::Struct`</tspan>
303</tspan>
304 <tspan x="10px" y="2548px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">--&gt; </tspan><tspan>$DIR/incorrect-variant-literal.rs:28:5</tspan>
305</tspan>
306 <tspan x="10px" y="2566px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan>
307</tspan>
308 <tspan x="10px" y="2584px"><tspan class="fg-ansi256-012 bold">LL</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan><tspan> Enum::Struct(0, 0);</tspan>
309</tspan>
310 <tspan x="10px" y="2602px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan><tspan> </tspan><tspan class="fg-ansi256-009 bold">^^^^^^^^^^^^</tspan><tspan> </tspan><tspan class="fg-ansi256-009 bold">not a value</tspan>
311</tspan>
312 <tspan x="10px" y="2620px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan>
313</tspan>
314 <tspan x="10px" y="2638px"><tspan class="fg-ansi256-014 bold">help</tspan><tspan>: you might have meant to create a new value of the struct</tspan>
315</tspan>
316 <tspan x="10px" y="2656px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan>
317</tspan>
318 <tspan x="10px" y="2674px"><tspan class="fg-ansi256-012 bold">LL</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">| </tspan><tspan> Enum::Struct</tspan><tspan class="fg-ansi256-010"> { x: /* value */ }</tspan><tspan>;</tspan>
319</tspan>
320 <tspan x="10px" y="2692px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan><tspan> </tspan><tspan class="fg-ansi256-010">~~~~~~~~~~~~~~~~~~</tspan>
321</tspan>
322 <tspan x="10px" y="2710px">
323</tspan>
324 <tspan x="10px" y="2728px"><tspan class="fg-ansi256-009 bold">error[E0559]</tspan><tspan class="bold">: variant `Enum::Unit` has no field named `x`</tspan>
325</tspan>
326 <tspan x="10px" y="2746px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">--&gt; </tspan><tspan>$DIR/incorrect-variant-literal.rs:29:18</tspan>
327</tspan>
328 <tspan x="10px" y="2764px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan>
329</tspan>
330 <tspan x="10px" y="2782px"><tspan class="fg-ansi256-012 bold">LL</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan><tspan> Enum::Unit { x: 0, y: 0 };</tspan>
331</tspan>
332 <tspan x="10px" y="2800px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan><tspan> </tspan><tspan class="fg-ansi256-009 bold">^</tspan><tspan> </tspan><tspan class="fg-ansi256-009 bold">`Enum::Unit` does not have this field</tspan>
333</tspan>
334 <tspan x="10px" y="2818px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan>
335</tspan>
336 <tspan x="10px" y="2836px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">= </tspan><tspan class="bold">note</tspan><tspan>: all struct fields are already assigned</tspan>
337</tspan>
338 <tspan x="10px" y="2854px">
339</tspan>
340 <tspan x="10px" y="2872px"><tspan class="fg-ansi256-009 bold">error[E0559]</tspan><tspan class="bold">: variant `Enum::Unit` has no field named `y`</tspan>
341</tspan>
342 <tspan x="10px" y="2890px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">--&gt; </tspan><tspan>$DIR/incorrect-variant-literal.rs:29:24</tspan>
343</tspan>
344 <tspan x="10px" y="2908px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan>
345</tspan>
346 <tspan x="10px" y="2926px"><tspan class="fg-ansi256-012 bold">LL</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan><tspan> Enum::Unit { x: 0, y: 0 };</tspan>
347</tspan>
348 <tspan x="10px" y="2944px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan><tspan> </tspan><tspan class="fg-ansi256-009 bold">^</tspan><tspan> </tspan><tspan class="fg-ansi256-009 bold">`Enum::Unit` does not have this field</tspan>
349</tspan>
350 <tspan x="10px" y="2962px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan>
351</tspan>
352 <tspan x="10px" y="2980px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">= </tspan><tspan class="bold">note</tspan><tspan>: all struct fields are already assigned</tspan>
353</tspan>
354 <tspan x="10px" y="2998px">
355</tspan>
356 <tspan x="10px" y="3016px"><tspan class="fg-ansi256-009 bold">error[E0559]</tspan><tspan class="bold">: variant `Enum::Tuple` has no field named `x`</tspan>
357</tspan>
358 <tspan x="10px" y="3034px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">--&gt; </tspan><tspan>$DIR/incorrect-variant-literal.rs:31:19</tspan>
359</tspan>
360 <tspan x="10px" y="3052px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan>
361</tspan>
362 <tspan x="10px" y="3070px"><tspan class="fg-ansi256-012 bold">LL</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan><tspan> Tuple(i32),</tspan>
363</tspan>
364 <tspan x="10px" y="3088px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">-----</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">`Enum::Tuple` defined here</tspan>
365</tspan>
366 <tspan x="10px" y="3106px"><tspan class="fg-ansi256-012 bold">...</tspan>
367</tspan>
368 <tspan x="10px" y="3124px"><tspan class="fg-ansi256-012 bold">LL</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan><tspan> Enum::Tuple { x: 0, y: 0 };</tspan>
369</tspan>
370 <tspan x="10px" y="3142px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan><tspan> </tspan><tspan class="fg-ansi256-009 bold">^</tspan><tspan> </tspan><tspan class="fg-ansi256-009 bold">field does not exist</tspan>
371</tspan>
372 <tspan x="10px" y="3160px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan>
373</tspan>
374 <tspan x="10px" y="3178px"><tspan class="fg-ansi256-014 bold">help</tspan><tspan>: `Enum::Tuple` is a tuple variant, use the appropriate syntax</tspan>
375</tspan>
376 <tspan x="10px" y="3196px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan>
377</tspan>
378 <tspan x="10px" y="3214px"><tspan class="fg-ansi256-012 bold">LL</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">| </tspan><tspan> Enum::Tuple</tspan><tspan class="fg-ansi256-010">(/* i32 */)</tspan><tspan>;</tspan>
379</tspan>
380 <tspan x="10px" y="3232px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan><tspan> </tspan><tspan class="fg-ansi256-010">~~~~~~~~~~~</tspan>
381</tspan>
382 <tspan x="10px" y="3250px">
383</tspan>
384 <tspan x="10px" y="3268px"><tspan class="fg-ansi256-009 bold">error[E0559]</tspan><tspan class="bold">: variant `Enum::Tuple` has no field named `y`</tspan>
385</tspan>
386 <tspan x="10px" y="3286px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">--&gt; </tspan><tspan>$DIR/incorrect-variant-literal.rs:31:25</tspan>
387</tspan>
388 <tspan x="10px" y="3304px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan>
389</tspan>
390 <tspan x="10px" y="3322px"><tspan class="fg-ansi256-012 bold">LL</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan><tspan> Tuple(i32),</tspan>
391</tspan>
392 <tspan x="10px" y="3340px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">-----</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">`Enum::Tuple` defined here</tspan>
393</tspan>
394 <tspan x="10px" y="3358px"><tspan class="fg-ansi256-012 bold">...</tspan>
395</tspan>
396 <tspan x="10px" y="3376px"><tspan class="fg-ansi256-012 bold">LL</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan><tspan> Enum::Tuple { x: 0, y: 0 };</tspan>
397</tspan>
398 <tspan x="10px" y="3394px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan><tspan> </tspan><tspan class="fg-ansi256-009 bold">^</tspan><tspan> </tspan><tspan class="fg-ansi256-009 bold">field does not exist</tspan>
399</tspan>
400 <tspan x="10px" y="3412px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan>
401</tspan>
402 <tspan x="10px" y="3430px"><tspan class="fg-ansi256-014 bold">help</tspan><tspan>: `Enum::Tuple` is a tuple variant, use the appropriate syntax</tspan>
403</tspan>
404 <tspan x="10px" y="3448px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan>
405</tspan>
406 <tspan x="10px" y="3466px"><tspan class="fg-ansi256-012 bold">LL</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">| </tspan><tspan> Enum::Tuple</tspan><tspan class="fg-ansi256-010">(/* i32 */)</tspan><tspan>;</tspan>
407</tspan>
408 <tspan x="10px" y="3484px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan><tspan> </tspan><tspan class="fg-ansi256-010">~~~~~~~~~~~</tspan>
409</tspan>
410 <tspan x="10px" y="3502px">
411</tspan>
412 <tspan x="10px" y="3520px"><tspan class="fg-ansi256-009 bold">error[E0559]</tspan><tspan class="bold">: variant `Enum::Struct` has no field named `y`</tspan>
413</tspan>
414 <tspan x="10px" y="3538px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">--&gt; </tspan><tspan>$DIR/incorrect-variant-literal.rs:33:26</tspan>
415</tspan>
416 <tspan x="10px" y="3556px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan>
417</tspan>
418 <tspan x="10px" y="3574px"><tspan class="fg-ansi256-012 bold">LL</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan><tspan> Enum::Struct { x: 0, y: 0 };</tspan>
419</tspan>
420 <tspan x="10px" y="3592px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan><tspan> </tspan><tspan class="fg-ansi256-009 bold">^</tspan><tspan> </tspan><tspan class="fg-ansi256-009 bold">`Enum::Struct` does not have this field</tspan>
421</tspan>
422 <tspan x="10px" y="3610px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan>
423</tspan>
424 <tspan x="10px" y="3628px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">= </tspan><tspan class="bold">note</tspan><tspan>: all struct fields are already assigned</tspan>
425</tspan>
426 <tspan x="10px" y="3646px">
427</tspan>
428 <tspan x="10px" y="3664px"><tspan class="fg-ansi256-009 bold">error[E0599]</tspan><tspan class="bold">: no variant or associated item named `unit` found for enum `Enum` in the current scope</tspan>
429</tspan>
430 <tspan x="10px" y="3682px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">--&gt; </tspan><tspan>$DIR/incorrect-variant-literal.rs:34:11</tspan>
431</tspan>
432 <tspan x="10px" y="3700px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan>
433</tspan>
434 <tspan x="10px" y="3718px"><tspan class="fg-ansi256-012 bold">LL</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan><tspan> enum Enum {</tspan>
435</tspan>
436 <tspan x="10px" y="3736px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">---------</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">variant or associated item `unit` not found for this enum</tspan>
437</tspan>
438 <tspan x="10px" y="3754px"><tspan class="fg-ansi256-012 bold">...</tspan>
439</tspan>
440 <tspan x="10px" y="3772px"><tspan class="fg-ansi256-012 bold">LL</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan><tspan> Enum::unit;</tspan>
441</tspan>
442 <tspan x="10px" y="3790px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan><tspan> </tspan><tspan class="fg-ansi256-009 bold">^^^^</tspan><tspan> </tspan><tspan class="fg-ansi256-009 bold">variant or associated item not found in `Enum`</tspan>
443</tspan>
444 <tspan x="10px" y="3808px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan>
445</tspan>
446 <tspan x="10px" y="3826px"><tspan class="fg-ansi256-014 bold">help</tspan><tspan>: there is a variant with a similar name (notice the capitalization difference)</tspan>
447</tspan>
448 <tspan x="10px" y="3844px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan>
449</tspan>
450 <tspan x="10px" y="3862px"><tspan class="fg-ansi256-012 bold">LL</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">| </tspan><tspan> Enum::</tspan><tspan class="fg-ansi256-010">Unit</tspan><tspan>;</tspan>
451</tspan>
452 <tspan x="10px" y="3880px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan><tspan> </tspan><tspan class="fg-ansi256-010">~~~~</tspan>
453</tspan>
454 <tspan x="10px" y="3898px">
455</tspan>
456 <tspan x="10px" y="3916px"><tspan class="fg-ansi256-009 bold">error[E0599]</tspan><tspan class="bold">: no variant or associated item named `tuple` found for enum `Enum` in the current scope</tspan>
457</tspan>
458 <tspan x="10px" y="3934px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">--&gt; </tspan><tspan>$DIR/incorrect-variant-literal.rs:35:11</tspan>
459</tspan>
460 <tspan x="10px" y="3952px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan>
461</tspan>
462 <tspan x="10px" y="3970px"><tspan class="fg-ansi256-012 bold">LL</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan><tspan> enum Enum {</tspan>
463</tspan>
464 <tspan x="10px" y="3988px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">---------</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">variant or associated item `tuple` not found for this enum</tspan>
465</tspan>
466 <tspan x="10px" y="4006px"><tspan class="fg-ansi256-012 bold">...</tspan>
467</tspan>
468 <tspan x="10px" y="4024px"><tspan class="fg-ansi256-012 bold">LL</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan><tspan> Enum::tuple;</tspan>
469</tspan>
470 <tspan x="10px" y="4042px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan><tspan> </tspan><tspan class="fg-ansi256-009 bold">^^^^^</tspan><tspan> </tspan><tspan class="fg-ansi256-009 bold">variant or associated item not found in `Enum`</tspan>
471</tspan>
472 <tspan x="10px" y="4060px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan>
473</tspan>
474 <tspan x="10px" y="4078px"><tspan class="fg-ansi256-014 bold">help</tspan><tspan>: there is a variant with a similar name</tspan>
475</tspan>
476 <tspan x="10px" y="4096px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan>
477</tspan>
478 <tspan x="10px" y="4114px"><tspan class="fg-ansi256-012 bold">LL</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">| </tspan><tspan> Enum::</tspan><tspan class="fg-ansi256-010">Tuple(/* i32 */)</tspan><tspan>;</tspan>
479</tspan>
480 <tspan x="10px" y="4132px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan><tspan> </tspan><tspan class="fg-ansi256-010">~~~~~~~~~~~~~~~~</tspan>
481</tspan>
482 <tspan x="10px" y="4150px">
483</tspan>
484 <tspan x="10px" y="4168px"><tspan class="fg-ansi256-009 bold">error[E0599]</tspan><tspan class="bold">: no variant or associated item named `r#struct` found for enum `Enum` in the current scope</tspan>
485</tspan>
486 <tspan x="10px" y="4186px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">--&gt; </tspan><tspan>$DIR/incorrect-variant-literal.rs:36:11</tspan>
487</tspan>
488 <tspan x="10px" y="4204px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan>
489</tspan>
490 <tspan x="10px" y="4222px"><tspan class="fg-ansi256-012 bold">LL</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan><tspan> enum Enum {</tspan>
491</tspan>
492 <tspan x="10px" y="4240px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">---------</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">variant or associated item `r#struct` not found for this enum</tspan>
493</tspan>
494 <tspan x="10px" y="4258px"><tspan class="fg-ansi256-012 bold">...</tspan>
495</tspan>
496 <tspan x="10px" y="4276px"><tspan class="fg-ansi256-012 bold">LL</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan><tspan> Enum::r#struct;</tspan>
497</tspan>
498 <tspan x="10px" y="4294px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan><tspan> </tspan><tspan class="fg-ansi256-009 bold">^^^^^^^^</tspan><tspan> </tspan><tspan class="fg-ansi256-009 bold">variant or associated item not found in `Enum`</tspan>
499</tspan>
500 <tspan x="10px" y="4312px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan>
501</tspan>
502 <tspan x="10px" y="4330px"><tspan class="fg-ansi256-014 bold">help</tspan><tspan>: there is a variant with a similar name</tspan>
503</tspan>
504 <tspan x="10px" y="4348px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan>
505</tspan>
506 <tspan x="10px" y="4366px"><tspan class="fg-ansi256-012 bold">LL</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">| </tspan><tspan> Enum::</tspan><tspan class="fg-ansi256-010">Struct { x: /* value */ }</tspan><tspan>;</tspan>
507</tspan>
508 <tspan x="10px" y="4384px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan><tspan> </tspan><tspan class="fg-ansi256-010">~~~~~~~~~~~~~~~~~~~~~~~~~</tspan>
509</tspan>
510 <tspan x="10px" y="4402px">
511</tspan>
512 <tspan x="10px" y="4420px"><tspan class="fg-ansi256-009 bold">error[E0599]</tspan><tspan class="bold">: no variant or associated item named `unit` found for enum `Enum` in the current scope</tspan>
513</tspan>
514 <tspan x="10px" y="4438px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">--&gt; </tspan><tspan>$DIR/incorrect-variant-literal.rs:37:11</tspan>
515</tspan>
516 <tspan x="10px" y="4456px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan>
517</tspan>
518 <tspan x="10px" y="4474px"><tspan class="fg-ansi256-012 bold">LL</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan><tspan> enum Enum {</tspan>
519</tspan>
520 <tspan x="10px" y="4492px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">---------</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">variant or associated item `unit` not found for this enum</tspan>
521</tspan>
522 <tspan x="10px" y="4510px"><tspan class="fg-ansi256-012 bold">...</tspan>
523</tspan>
524 <tspan x="10px" y="4528px"><tspan class="fg-ansi256-012 bold">LL</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan><tspan> Enum::unit();</tspan>
525</tspan>
526 <tspan x="10px" y="4546px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan><tspan> </tspan><tspan class="fg-ansi256-009 bold">^^^^</tspan><tspan> </tspan><tspan class="fg-ansi256-009 bold">variant or associated item not found in `Enum`</tspan>
527</tspan>
528 <tspan x="10px" y="4564px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan>
529</tspan>
530 <tspan x="10px" y="4582px"><tspan class="fg-ansi256-014 bold">help</tspan><tspan>: there is a variant with a similar name</tspan>
531</tspan>
532 <tspan x="10px" y="4600px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan>
533</tspan>
534 <tspan x="10px" y="4618px"><tspan class="fg-ansi256-012 bold">LL</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">| </tspan><tspan> Enum::</tspan><tspan class="fg-ansi256-010">Unit</tspan><tspan>;</tspan>
535</tspan>
536 <tspan x="10px" y="4636px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan><tspan> </tspan><tspan class="fg-ansi256-010">~~~~</tspan>
537</tspan>
538 <tspan x="10px" y="4654px">
539</tspan>
540 <tspan x="10px" y="4672px"><tspan class="fg-ansi256-009 bold">error[E0599]</tspan><tspan class="bold">: no variant or associated item named `tuple` found for enum `Enum` in the current scope</tspan>
541</tspan>
542 <tspan x="10px" y="4690px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">--&gt; </tspan><tspan>$DIR/incorrect-variant-literal.rs:38:11</tspan>
543</tspan>
544 <tspan x="10px" y="4708px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan>
545</tspan>
546 <tspan x="10px" y="4726px"><tspan class="fg-ansi256-012 bold">LL</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan><tspan> enum Enum {</tspan>
547</tspan>
548 <tspan x="10px" y="4744px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">---------</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">variant or associated item `tuple` not found for this enum</tspan>
549</tspan>
550 <tspan x="10px" y="4762px"><tspan class="fg-ansi256-012 bold">...</tspan>
551</tspan>
552 <tspan x="10px" y="4780px"><tspan class="fg-ansi256-012 bold">LL</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan><tspan> Enum::tuple();</tspan>
553</tspan>
554 <tspan x="10px" y="4798px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan><tspan> </tspan><tspan class="fg-ansi256-009 bold">^^^^^</tspan><tspan> </tspan><tspan class="fg-ansi256-009 bold">variant or associated item not found in `Enum`</tspan>
555</tspan>
556 <tspan x="10px" y="4816px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan>
557</tspan>
558 <tspan x="10px" y="4834px"><tspan class="fg-ansi256-014 bold">help</tspan><tspan>: there is a variant with a similar name</tspan>
559</tspan>
560 <tspan x="10px" y="4852px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan>
561</tspan>
562 <tspan x="10px" y="4870px"><tspan class="fg-ansi256-012 bold">LL</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">| </tspan><tspan> Enum::</tspan><tspan class="fg-ansi256-010">Tuple(/* i32 */)</tspan><tspan>;</tspan>
563</tspan>
564 <tspan x="10px" y="4888px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan><tspan> </tspan><tspan class="fg-ansi256-010">~~~~~~~~~~~~~~~~</tspan>
565</tspan>
566 <tspan x="10px" y="4906px">
567</tspan>
568 <tspan x="10px" y="4924px"><tspan class="fg-ansi256-009 bold">error[E0599]</tspan><tspan class="bold">: no variant or associated item named `r#struct` found for enum `Enum` in the current scope</tspan>
569</tspan>
570 <tspan x="10px" y="4942px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">--&gt; </tspan><tspan>$DIR/incorrect-variant-literal.rs:39:11</tspan>
571</tspan>
572 <tspan x="10px" y="4960px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan>
573</tspan>
574 <tspan x="10px" y="4978px"><tspan class="fg-ansi256-012 bold">LL</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan><tspan> enum Enum {</tspan>
575</tspan>
576 <tspan x="10px" y="4996px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">---------</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">variant or associated item `r#struct` not found for this enum</tspan>
577</tspan>
578 <tspan x="10px" y="5014px"><tspan class="fg-ansi256-012 bold">...</tspan>
579</tspan>
580 <tspan x="10px" y="5032px"><tspan class="fg-ansi256-012 bold">LL</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan><tspan> Enum::r#struct();</tspan>
581</tspan>
582 <tspan x="10px" y="5050px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan><tspan> </tspan><tspan class="fg-ansi256-009 bold">^^^^^^^^</tspan><tspan> </tspan><tspan class="fg-ansi256-009 bold">variant or associated item not found in `Enum`</tspan>
583</tspan>
584 <tspan x="10px" y="5068px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan>
585</tspan>
586 <tspan x="10px" y="5086px"><tspan class="fg-ansi256-014 bold">help</tspan><tspan>: there is a variant with a similar name</tspan>
587</tspan>
588 <tspan x="10px" y="5104px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan>
589</tspan>
590 <tspan x="10px" y="5122px"><tspan class="fg-ansi256-012 bold">LL</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">| </tspan><tspan> Enum::</tspan><tspan class="fg-ansi256-010">Struct { x: /* value */ }</tspan><tspan>;</tspan>
591</tspan>
592 <tspan x="10px" y="5140px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan><tspan> </tspan><tspan class="fg-ansi256-010">~~~~~~~~~~~~~~~~~~~~~~~~~</tspan>
593</tspan>
594 <tspan x="10px" y="5158px">
595</tspan>
596 <tspan x="10px" y="5176px"><tspan class="fg-ansi256-009 bold">error[E0599]</tspan><tspan class="bold">: no variant named `unit` found for enum `Enum`</tspan>
597</tspan>
598 <tspan x="10px" y="5194px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">--&gt; </tspan><tspan>$DIR/incorrect-variant-literal.rs:40:11</tspan>
599</tspan>
600 <tspan x="10px" y="5212px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan>
601</tspan>
602 <tspan x="10px" y="5230px"><tspan class="fg-ansi256-012 bold">LL</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan><tspan> enum Enum {</tspan>
603</tspan>
604 <tspan x="10px" y="5248px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">---------</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">variant `unit` not found here</tspan>
605</tspan>
606 <tspan x="10px" y="5266px"><tspan class="fg-ansi256-012 bold">...</tspan>
607</tspan>
608 <tspan x="10px" y="5284px"><tspan class="fg-ansi256-012 bold">LL</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan><tspan> Enum::unit {};</tspan>
609</tspan>
610 <tspan x="10px" y="5302px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan><tspan> </tspan><tspan class="fg-ansi256-009 bold">^^^^</tspan>
611</tspan>
612 <tspan x="10px" y="5320px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan>
613</tspan>
614 <tspan x="10px" y="5338px"><tspan class="fg-ansi256-014 bold">help</tspan><tspan>: there is a variant with a similar name</tspan>
615</tspan>
616 <tspan x="10px" y="5356px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan>
617</tspan>
618 <tspan x="10px" y="5374px"><tspan class="fg-ansi256-012 bold">LL</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">| </tspan><tspan> Enum::</tspan><tspan class="fg-ansi256-010">Unit</tspan><tspan>;</tspan>
619</tspan>
620 <tspan x="10px" y="5392px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan><tspan> </tspan><tspan class="fg-ansi256-010">~~~~</tspan>
621</tspan>
622 <tspan x="10px" y="5410px">
623</tspan>
624 <tspan x="10px" y="5428px"><tspan class="fg-ansi256-009 bold">error[E0599]</tspan><tspan class="bold">: no variant named `tuple` found for enum `Enum`</tspan>
625</tspan>
626 <tspan x="10px" y="5446px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">--&gt; </tspan><tspan>$DIR/incorrect-variant-literal.rs:41:11</tspan>
627</tspan>
628 <tspan x="10px" y="5464px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan>
629</tspan>
630 <tspan x="10px" y="5482px"><tspan class="fg-ansi256-012 bold">LL</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan><tspan> enum Enum {</tspan>
631</tspan>
632 <tspan x="10px" y="5500px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">---------</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">variant `tuple` not found here</tspan>
633</tspan>
634 <tspan x="10px" y="5518px"><tspan class="fg-ansi256-012 bold">...</tspan>
635</tspan>
636 <tspan x="10px" y="5536px"><tspan class="fg-ansi256-012 bold">LL</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan><tspan> Enum::tuple {};</tspan>
637</tspan>
638 <tspan x="10px" y="5554px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan><tspan> </tspan><tspan class="fg-ansi256-009 bold">^^^^^</tspan>
639</tspan>
640 <tspan x="10px" y="5572px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan>
641</tspan>
642 <tspan x="10px" y="5590px"><tspan class="fg-ansi256-014 bold">help</tspan><tspan>: there is a variant with a similar name</tspan>
643</tspan>
644 <tspan x="10px" y="5608px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan>
645</tspan>
646 <tspan x="10px" y="5626px"><tspan class="fg-ansi256-012 bold">LL</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">| </tspan><tspan> Enum::</tspan><tspan class="fg-ansi256-010">Tuple(/* i32 */)</tspan><tspan>;</tspan>
647</tspan>
648 <tspan x="10px" y="5644px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan><tspan> </tspan><tspan class="fg-ansi256-010">~~~~~~~~~~~~~~~~</tspan>
649</tspan>
650 <tspan x="10px" y="5662px">
651</tspan>
652 <tspan x="10px" y="5680px"><tspan class="fg-ansi256-009 bold">error[E0599]</tspan><tspan class="bold">: no variant named `r#struct` found for enum `Enum`</tspan>
653</tspan>
654 <tspan x="10px" y="5698px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">--&gt; </tspan><tspan>$DIR/incorrect-variant-literal.rs:42:11</tspan>
655</tspan>
656 <tspan x="10px" y="5716px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan>
657</tspan>
658 <tspan x="10px" y="5734px"><tspan class="fg-ansi256-012 bold">LL</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan><tspan> enum Enum {</tspan>
659</tspan>
660 <tspan x="10px" y="5752px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">---------</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">variant `r#struct` not found here</tspan>
661</tspan>
662 <tspan x="10px" y="5770px"><tspan class="fg-ansi256-012 bold">...</tspan>
663</tspan>
664 <tspan x="10px" y="5788px"><tspan class="fg-ansi256-012 bold">LL</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan><tspan> Enum::r#struct {};</tspan>
665</tspan>
666 <tspan x="10px" y="5806px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan><tspan> </tspan><tspan class="fg-ansi256-009 bold">^^^^^^^^</tspan>
667</tspan>
668 <tspan x="10px" y="5824px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan>
669</tspan>
670 <tspan x="10px" y="5842px"><tspan class="fg-ansi256-014 bold">help</tspan><tspan>: there is a variant with a similar name</tspan>
671</tspan>
672 <tspan x="10px" y="5860px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan>
673</tspan>
674 <tspan x="10px" y="5878px"><tspan class="fg-ansi256-012 bold">LL</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">| </tspan><tspan> Enum::</tspan><tspan class="fg-ansi256-010">Struct { x: /* value */ }</tspan><tspan>;</tspan>
675</tspan>
676 <tspan x="10px" y="5896px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan><tspan> </tspan><tspan class="fg-ansi256-010">~~~~~~~~~~~~~~~~~~~~~~~~~</tspan>
677</tspan>
678 <tspan x="10px" y="5914px">
679</tspan>
680 <tspan x="10px" y="5932px"><tspan class="fg-ansi256-009 bold">error[E0599]</tspan><tspan class="bold">: no variant or associated item named `unit` found for enum `Enum` in the current scope</tspan>
681</tspan>
682 <tspan x="10px" y="5950px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">--&gt; </tspan><tspan>$DIR/incorrect-variant-literal.rs:43:11</tspan>
683</tspan>
684 <tspan x="10px" y="5968px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan>
685</tspan>
686 <tspan x="10px" y="5986px"><tspan class="fg-ansi256-012 bold">LL</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan><tspan> enum Enum {</tspan>
687</tspan>
688 <tspan x="10px" y="6004px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">---------</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">variant or associated item `unit` not found for this enum</tspan>
689</tspan>
690 <tspan x="10px" y="6022px"><tspan class="fg-ansi256-012 bold">...</tspan>
691</tspan>
692 <tspan x="10px" y="6040px"><tspan class="fg-ansi256-012 bold">LL</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan><tspan> Enum::unit(0);</tspan>
693</tspan>
694 <tspan x="10px" y="6058px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan><tspan> </tspan><tspan class="fg-ansi256-009 bold">^^^^</tspan><tspan> </tspan><tspan class="fg-ansi256-009 bold">variant or associated item not found in `Enum`</tspan>
695</tspan>
696 <tspan x="10px" y="6076px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan>
697</tspan>
698 <tspan x="10px" y="6094px"><tspan class="fg-ansi256-014 bold">help</tspan><tspan>: there is a variant with a similar name</tspan>
699</tspan>
700 <tspan x="10px" y="6112px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan>
701</tspan>
702 <tspan x="10px" y="6130px"><tspan class="fg-ansi256-012 bold">LL</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">| </tspan><tspan> Enum::</tspan><tspan class="fg-ansi256-010">Unit</tspan><tspan>;</tspan>
703</tspan>
704 <tspan x="10px" y="6148px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan><tspan> </tspan><tspan class="fg-ansi256-010">~~~~</tspan>
705</tspan>
706 <tspan x="10px" y="6166px">
707</tspan>
708 <tspan x="10px" y="6184px"><tspan class="fg-ansi256-009 bold">error[E0599]</tspan><tspan class="bold">: no variant or associated item named `tuple` found for enum `Enum` in the current scope</tspan>
709</tspan>
710 <tspan x="10px" y="6202px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">--&gt; </tspan><tspan>$DIR/incorrect-variant-literal.rs:44:11</tspan>
711</tspan>
712 <tspan x="10px" y="6220px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan>
713</tspan>
714 <tspan x="10px" y="6238px"><tspan class="fg-ansi256-012 bold">LL</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan><tspan> enum Enum {</tspan>
715</tspan>
716 <tspan x="10px" y="6256px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">---------</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">variant or associated item `tuple` not found for this enum</tspan>
717</tspan>
718 <tspan x="10px" y="6274px"><tspan class="fg-ansi256-012 bold">...</tspan>
719</tspan>
720 <tspan x="10px" y="6292px"><tspan class="fg-ansi256-012 bold">LL</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan><tspan> Enum::tuple(0);</tspan>
721</tspan>
722 <tspan x="10px" y="6310px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan><tspan> </tspan><tspan class="fg-ansi256-009 bold">^^^^^</tspan><tspan> </tspan><tspan class="fg-ansi256-009 bold">variant or associated item not found in `Enum`</tspan>
723</tspan>
724 <tspan x="10px" y="6328px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan>
725</tspan>
726 <tspan x="10px" y="6346px"><tspan class="fg-ansi256-014 bold">help</tspan><tspan>: there is a variant with a similar name</tspan>
727</tspan>
728 <tspan x="10px" y="6364px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan>
729</tspan>
730 <tspan x="10px" y="6382px"><tspan class="fg-ansi256-012 bold">LL</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">| </tspan><tspan> Enum::</tspan><tspan class="fg-ansi256-010">Tuple</tspan><tspan>(0);</tspan>
731</tspan>
732 <tspan x="10px" y="6400px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan><tspan> </tspan><tspan class="fg-ansi256-010">~~~~~</tspan>
733</tspan>
734 <tspan x="10px" y="6418px">
735</tspan>
736 <tspan x="10px" y="6436px"><tspan class="fg-ansi256-009 bold">error[E0599]</tspan><tspan class="bold">: no variant or associated item named `r#struct` found for enum `Enum` in the current scope</tspan>
737</tspan>
738 <tspan x="10px" y="6454px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">--&gt; </tspan><tspan>$DIR/incorrect-variant-literal.rs:45:11</tspan>
739</tspan>
740 <tspan x="10px" y="6472px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan>
741</tspan>
742 <tspan x="10px" y="6490px"><tspan class="fg-ansi256-012 bold">LL</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan><tspan> enum Enum {</tspan>
743</tspan>
744 <tspan x="10px" y="6508px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">---------</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">variant or associated item `r#struct` not found for this enum</tspan>
745</tspan>
746 <tspan x="10px" y="6526px"><tspan class="fg-ansi256-012 bold">...</tspan>
747</tspan>
748 <tspan x="10px" y="6544px"><tspan class="fg-ansi256-012 bold">LL</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan><tspan> Enum::r#struct(0);</tspan>
749</tspan>
750 <tspan x="10px" y="6562px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan><tspan> </tspan><tspan class="fg-ansi256-009 bold">^^^^^^^^</tspan><tspan> </tspan><tspan class="fg-ansi256-009 bold">variant or associated item not found in `Enum`</tspan>
751</tspan>
752 <tspan x="10px" y="6580px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan>
753</tspan>
754 <tspan x="10px" y="6598px"><tspan class="fg-ansi256-014 bold">help</tspan><tspan>: there is a variant with a similar name</tspan>
755</tspan>
756 <tspan x="10px" y="6616px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan>
757</tspan>
758 <tspan x="10px" y="6634px"><tspan class="fg-ansi256-012 bold">LL</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">| </tspan><tspan> Enum::</tspan><tspan class="fg-ansi256-010">Struct { x: /* value */ }</tspan><tspan>;</tspan>
759</tspan>
760 <tspan x="10px" y="6652px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan><tspan> </tspan><tspan class="fg-ansi256-010">~~~~~~~~~~~~~~~~~~~~~~~~~</tspan>
761</tspan>
762 <tspan x="10px" y="6670px">
763</tspan>
764 <tspan x="10px" y="6688px"><tspan class="fg-ansi256-009 bold">error[E0599]</tspan><tspan class="bold">: no variant named `unit` found for enum `Enum`</tspan>
765</tspan>
766 <tspan x="10px" y="6706px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">--&gt; </tspan><tspan>$DIR/incorrect-variant-literal.rs:46:11</tspan>
767</tspan>
768 <tspan x="10px" y="6724px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan>
769</tspan>
770 <tspan x="10px" y="6742px"><tspan class="fg-ansi256-012 bold">LL</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan><tspan> enum Enum {</tspan>
771</tspan>
772 <tspan x="10px" y="6760px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">---------</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">variant `unit` not found here</tspan>
773</tspan>
774 <tspan x="10px" y="6778px"><tspan class="fg-ansi256-012 bold">...</tspan>
775</tspan>
776 <tspan x="10px" y="6796px"><tspan class="fg-ansi256-012 bold">LL</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan><tspan> Enum::unit { x: 0 };</tspan>
777</tspan>
778 <tspan x="10px" y="6814px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan><tspan> </tspan><tspan class="fg-ansi256-009 bold">^^^^</tspan>
779</tspan>
780 <tspan x="10px" y="6832px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan>
781</tspan>
782 <tspan x="10px" y="6850px"><tspan class="fg-ansi256-014 bold">help</tspan><tspan>: there is a variant with a similar name</tspan>
783</tspan>
784 <tspan x="10px" y="6868px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan>
785</tspan>
786 <tspan x="10px" y="6886px"><tspan class="fg-ansi256-012 bold">LL</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">| </tspan><tspan> Enum::</tspan><tspan class="fg-ansi256-010">Unit</tspan><tspan>;</tspan>
787</tspan>
788 <tspan x="10px" y="6904px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan><tspan> </tspan><tspan class="fg-ansi256-010">~~~~</tspan>
789</tspan>
790 <tspan x="10px" y="6922px">
791</tspan>
792 <tspan x="10px" y="6940px"><tspan class="fg-ansi256-009 bold">error[E0599]</tspan><tspan class="bold">: no variant named `tuple` found for enum `Enum`</tspan>
793</tspan>
794 <tspan x="10px" y="6958px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">--&gt; </tspan><tspan>$DIR/incorrect-variant-literal.rs:47:11</tspan>
795</tspan>
796 <tspan x="10px" y="6976px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan>
797</tspan>
798 <tspan x="10px" y="6994px"><tspan class="fg-ansi256-012 bold">LL</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan><tspan> enum Enum {</tspan>
799</tspan>
800 <tspan x="10px" y="7012px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">---------</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">variant `tuple` not found here</tspan>
801</tspan>
802 <tspan x="10px" y="7030px"><tspan class="fg-ansi256-012 bold">...</tspan>
803</tspan>
804 <tspan x="10px" y="7048px"><tspan class="fg-ansi256-012 bold">LL</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan><tspan> Enum::tuple { x: 0 };</tspan>
805</tspan>
806 <tspan x="10px" y="7066px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan><tspan> </tspan><tspan class="fg-ansi256-009 bold">^^^^^</tspan>
807</tspan>
808 <tspan x="10px" y="7084px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan>
809</tspan>
810 <tspan x="10px" y="7102px"><tspan class="fg-ansi256-014 bold">help</tspan><tspan>: there is a variant with a similar name</tspan>
811</tspan>
812 <tspan x="10px" y="7120px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan>
813</tspan>
814 <tspan x="10px" y="7138px"><tspan class="fg-ansi256-012 bold">LL</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">| </tspan><tspan> Enum::</tspan><tspan class="fg-ansi256-010">Tuple(/* i32 */)</tspan><tspan>;</tspan>
815</tspan>
816 <tspan x="10px" y="7156px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan><tspan> </tspan><tspan class="fg-ansi256-010">~~~~~~~~~~~~~~~~</tspan>
817</tspan>
818 <tspan x="10px" y="7174px">
819</tspan>
820 <tspan x="10px" y="7192px"><tspan class="fg-ansi256-009 bold">error[E0599]</tspan><tspan class="bold">: no variant named `r#struct` found for enum `Enum`</tspan>
821</tspan>
822 <tspan x="10px" y="7210px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">--&gt; </tspan><tspan>$DIR/incorrect-variant-literal.rs:48:11</tspan>
823</tspan>
824 <tspan x="10px" y="7228px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan>
825</tspan>
826 <tspan x="10px" y="7246px"><tspan class="fg-ansi256-012 bold">LL</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan><tspan> enum Enum {</tspan>
827</tspan>
828 <tspan x="10px" y="7264px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">---------</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">variant `r#struct` not found here</tspan>
829</tspan>
830 <tspan x="10px" y="7282px"><tspan class="fg-ansi256-012 bold">...</tspan>
831</tspan>
832 <tspan x="10px" y="7300px"><tspan class="fg-ansi256-012 bold">LL</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan><tspan> Enum::r#struct { x: 0 };</tspan>
833</tspan>
834 <tspan x="10px" y="7318px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan><tspan> </tspan><tspan class="fg-ansi256-009 bold">^^^^^^^^</tspan>
835</tspan>
836 <tspan x="10px" y="7336px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan>
837</tspan>
838 <tspan x="10px" y="7354px"><tspan class="fg-ansi256-014 bold">help</tspan><tspan>: there is a variant with a similar name</tspan>
839</tspan>
840 <tspan x="10px" y="7372px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan>
841</tspan>
842 <tspan x="10px" y="7390px"><tspan class="fg-ansi256-012 bold">LL</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">| </tspan><tspan> Enum::</tspan><tspan class="fg-ansi256-010">Struct { x: /* value */ }</tspan><tspan>;</tspan>
843</tspan>
844 <tspan x="10px" y="7408px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan><tspan> </tspan><tspan class="fg-ansi256-010">~~~~~~~~~~~~~~~~~~~~~~~~~</tspan>
845</tspan>
846 <tspan x="10px" y="7426px">
847</tspan>
848 <tspan x="10px" y="7444px"><tspan class="fg-ansi256-009 bold">error[E0599]</tspan><tspan class="bold">: no variant or associated item named `unit` found for enum `Enum` in the current scope</tspan>
849</tspan>
850 <tspan x="10px" y="7462px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">--&gt; </tspan><tspan>$DIR/incorrect-variant-literal.rs:49:11</tspan>
851</tspan>
852 <tspan x="10px" y="7480px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan>
853</tspan>
854 <tspan x="10px" y="7498px"><tspan class="fg-ansi256-012 bold">LL</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan><tspan> enum Enum {</tspan>
855</tspan>
856 <tspan x="10px" y="7516px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">---------</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">variant or associated item `unit` not found for this enum</tspan>
857</tspan>
858 <tspan x="10px" y="7534px"><tspan class="fg-ansi256-012 bold">...</tspan>
859</tspan>
860 <tspan x="10px" y="7552px"><tspan class="fg-ansi256-012 bold">LL</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan><tspan> Enum::unit(0, 0);</tspan>
861</tspan>
862 <tspan x="10px" y="7570px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan><tspan> </tspan><tspan class="fg-ansi256-009 bold">^^^^</tspan><tspan> </tspan><tspan class="fg-ansi256-009 bold">variant or associated item not found in `Enum`</tspan>
863</tspan>
864 <tspan x="10px" y="7588px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan>
865</tspan>
866 <tspan x="10px" y="7606px"><tspan class="fg-ansi256-014 bold">help</tspan><tspan>: there is a variant with a similar name</tspan>
867</tspan>
868 <tspan x="10px" y="7624px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan>
869</tspan>
870 <tspan x="10px" y="7642px"><tspan class="fg-ansi256-012 bold">LL</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">| </tspan><tspan> Enum::</tspan><tspan class="fg-ansi256-010">Unit</tspan><tspan>;</tspan>
871</tspan>
872 <tspan x="10px" y="7660px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan><tspan> </tspan><tspan class="fg-ansi256-010">~~~~</tspan>
873</tspan>
874 <tspan x="10px" y="7678px">
875</tspan>
876 <tspan x="10px" y="7696px"><tspan class="fg-ansi256-009 bold">error[E0599]</tspan><tspan class="bold">: no variant or associated item named `tuple` found for enum `Enum` in the current scope</tspan>
877</tspan>
878 <tspan x="10px" y="7714px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">--&gt; </tspan><tspan>$DIR/incorrect-variant-literal.rs:50:11</tspan>
879</tspan>
880 <tspan x="10px" y="7732px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan>
881</tspan>
882 <tspan x="10px" y="7750px"><tspan class="fg-ansi256-012 bold">LL</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan><tspan> enum Enum {</tspan>
883</tspan>
884 <tspan x="10px" y="7768px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">---------</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">variant or associated item `tuple` not found for this enum</tspan>
885</tspan>
886 <tspan x="10px" y="7786px"><tspan class="fg-ansi256-012 bold">...</tspan>
887</tspan>
888 <tspan x="10px" y="7804px"><tspan class="fg-ansi256-012 bold">LL</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan><tspan> Enum::tuple(0, 0);</tspan>
889</tspan>
890 <tspan x="10px" y="7822px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan><tspan> </tspan><tspan class="fg-ansi256-009 bold">^^^^^</tspan><tspan> </tspan><tspan class="fg-ansi256-009 bold">variant or associated item not found in `Enum`</tspan>
891</tspan>
892 <tspan x="10px" y="7840px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan>
893</tspan>
894 <tspan x="10px" y="7858px"><tspan class="fg-ansi256-014 bold">help</tspan><tspan>: there is a variant with a similar name</tspan>
895</tspan>
896 <tspan x="10px" y="7876px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan>
897</tspan>
898 <tspan x="10px" y="7894px"><tspan class="fg-ansi256-012 bold">LL</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">| </tspan><tspan> Enum::</tspan><tspan class="fg-ansi256-010">Tuple</tspan><tspan>(</tspan><tspan class="fg-ansi256-010">/* i32 */</tspan><tspan>);</tspan>
899</tspan>
900 <tspan x="10px" y="7912px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan><tspan> </tspan><tspan class="fg-ansi256-010">~~~~~</tspan><tspan> </tspan><tspan class="fg-ansi256-010">~~~~~~~~~</tspan>
901</tspan>
902 <tspan x="10px" y="7930px">
903</tspan>
904 <tspan x="10px" y="7948px"><tspan class="fg-ansi256-009 bold">error[E0599]</tspan><tspan class="bold">: no variant or associated item named `r#struct` found for enum `Enum` in the current scope</tspan>
905</tspan>
906 <tspan x="10px" y="7966px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">--&gt; </tspan><tspan>$DIR/incorrect-variant-literal.rs:51:11</tspan>
907</tspan>
908 <tspan x="10px" y="7984px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan>
909</tspan>
910 <tspan x="10px" y="8002px"><tspan class="fg-ansi256-012 bold">LL</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan><tspan> enum Enum {</tspan>
911</tspan>
912 <tspan x="10px" y="8020px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">---------</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">variant or associated item `r#struct` not found for this enum</tspan>
913</tspan>
914 <tspan x="10px" y="8038px"><tspan class="fg-ansi256-012 bold">...</tspan>
915</tspan>
916 <tspan x="10px" y="8056px"><tspan class="fg-ansi256-012 bold">LL</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan><tspan> Enum::r#struct(0, 0);</tspan>
917</tspan>
918 <tspan x="10px" y="8074px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan><tspan> </tspan><tspan class="fg-ansi256-009 bold">^^^^^^^^</tspan><tspan> </tspan><tspan class="fg-ansi256-009 bold">variant or associated item not found in `Enum`</tspan>
919</tspan>
920 <tspan x="10px" y="8092px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan>
921</tspan>
922 <tspan x="10px" y="8110px"><tspan class="fg-ansi256-014 bold">help</tspan><tspan>: there is a variant with a similar name</tspan>
923</tspan>
924 <tspan x="10px" y="8128px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan>
925</tspan>
926 <tspan x="10px" y="8146px"><tspan class="fg-ansi256-012 bold">LL</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">| </tspan><tspan> Enum::</tspan><tspan class="fg-ansi256-010">Struct { x: /* value */ }</tspan><tspan>;</tspan>
927</tspan>
928 <tspan x="10px" y="8164px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan><tspan> </tspan><tspan class="fg-ansi256-010">~~~~~~~~~~~~~~~~~~~~~~~~~</tspan>
929</tspan>
930 <tspan x="10px" y="8182px">
931</tspan>
932 <tspan x="10px" y="8200px"><tspan class="fg-ansi256-009 bold">error[E0599]</tspan><tspan class="bold">: no variant named `unit` found for enum `Enum`</tspan>
933</tspan>
934 <tspan x="10px" y="8218px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">--&gt; </tspan><tspan>$DIR/incorrect-variant-literal.rs:52:11</tspan>
935</tspan>
936 <tspan x="10px" y="8236px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan>
937</tspan>
938 <tspan x="10px" y="8254px"><tspan class="fg-ansi256-012 bold">LL</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan><tspan> enum Enum {</tspan>
939</tspan>
940 <tspan x="10px" y="8272px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">---------</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">variant `unit` not found here</tspan>
941</tspan>
942 <tspan x="10px" y="8290px"><tspan class="fg-ansi256-012 bold">...</tspan>
943</tspan>
944 <tspan x="10px" y="8308px"><tspan class="fg-ansi256-012 bold">LL</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan><tspan> Enum::unit { x: 0, y: 0 };</tspan>
945</tspan>
946 <tspan x="10px" y="8326px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan><tspan> </tspan><tspan class="fg-ansi256-009 bold">^^^^</tspan>
947</tspan>
948 <tspan x="10px" y="8344px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan>
949</tspan>
950 <tspan x="10px" y="8362px"><tspan class="fg-ansi256-014 bold">help</tspan><tspan>: there is a variant with a similar name</tspan>
951</tspan>
952 <tspan x="10px" y="8380px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan>
953</tspan>
954 <tspan x="10px" y="8398px"><tspan class="fg-ansi256-012 bold">LL</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">| </tspan><tspan> Enum::</tspan><tspan class="fg-ansi256-010">Unit</tspan><tspan>;</tspan>
955</tspan>
956 <tspan x="10px" y="8416px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan><tspan> </tspan><tspan class="fg-ansi256-010">~~~~</tspan>
957</tspan>
958 <tspan x="10px" y="8434px">
959</tspan>
960 <tspan x="10px" y="8452px"><tspan class="fg-ansi256-009 bold">error[E0599]</tspan><tspan class="bold">: no variant named `tuple` found for enum `Enum`</tspan>
961</tspan>
962 <tspan x="10px" y="8470px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">--&gt; </tspan><tspan>$DIR/incorrect-variant-literal.rs:53:11</tspan>
963</tspan>
964 <tspan x="10px" y="8488px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan>
965</tspan>
966 <tspan x="10px" y="8506px"><tspan class="fg-ansi256-012 bold">LL</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan><tspan> enum Enum {</tspan>
967</tspan>
968 <tspan x="10px" y="8524px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">---------</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">variant `tuple` not found here</tspan>
969</tspan>
970 <tspan x="10px" y="8542px"><tspan class="fg-ansi256-012 bold">...</tspan>
971</tspan>
972 <tspan x="10px" y="8560px"><tspan class="fg-ansi256-012 bold">LL</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan><tspan> Enum::tuple { x: 0, y: 0 };</tspan>
973</tspan>
974 <tspan x="10px" y="8578px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan><tspan> </tspan><tspan class="fg-ansi256-009 bold">^^^^^</tspan>
975</tspan>
976 <tspan x="10px" y="8596px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan>
977</tspan>
978 <tspan x="10px" y="8614px"><tspan class="fg-ansi256-014 bold">help</tspan><tspan>: there is a variant with a similar name</tspan>
979</tspan>
980 <tspan x="10px" y="8632px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan>
981</tspan>
982 <tspan x="10px" y="8650px"><tspan class="fg-ansi256-012 bold">LL</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">| </tspan><tspan> Enum::</tspan><tspan class="fg-ansi256-010">Tuple(/* i32 */)</tspan><tspan>;</tspan>
983</tspan>
984 <tspan x="10px" y="8668px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan><tspan> </tspan><tspan class="fg-ansi256-010">~~~~~~~~~~~~~~~~</tspan>
985</tspan>
986 <tspan x="10px" y="8686px">
987</tspan>
988 <tspan x="10px" y="8704px"><tspan class="fg-ansi256-009 bold">error[E0599]</tspan><tspan class="bold">: no variant named `r#struct` found for enum `Enum`</tspan>
989</tspan>
990 <tspan x="10px" y="8722px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">--&gt; </tspan><tspan>$DIR/incorrect-variant-literal.rs:54:11</tspan>
991</tspan>
992 <tspan x="10px" y="8740px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan>
993</tspan>
994 <tspan x="10px" y="8758px"><tspan class="fg-ansi256-012 bold">LL</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan><tspan> enum Enum {</tspan>
995</tspan>
996 <tspan x="10px" y="8776px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">---------</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">variant `r#struct` not found here</tspan>
997</tspan>
998 <tspan x="10px" y="8794px"><tspan class="fg-ansi256-012 bold">...</tspan>
999</tspan>
1000 <tspan x="10px" y="8812px"><tspan class="fg-ansi256-012 bold">LL</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan><tspan> Enum::r#struct { x: 0, y: 0 };</tspan>
1001</tspan>
1002 <tspan x="10px" y="8830px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan><tspan> </tspan><tspan class="fg-ansi256-009 bold">^^^^^^^^</tspan>
1003</tspan>
1004 <tspan x="10px" y="8848px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan>
1005</tspan>
1006 <tspan x="10px" y="8866px"><tspan class="fg-ansi256-014 bold">help</tspan><tspan>: there is a variant with a similar name</tspan>
1007</tspan>
1008 <tspan x="10px" y="8884px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan>
1009</tspan>
1010 <tspan x="10px" y="8902px"><tspan class="fg-ansi256-012 bold">LL</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">| </tspan><tspan> Enum::</tspan><tspan class="fg-ansi256-010">Struct { x: /* value */ }</tspan><tspan>;</tspan>
1011</tspan>
1012 <tspan x="10px" y="8920px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan><tspan> </tspan><tspan class="fg-ansi256-010">~~~~~~~~~~~~~~~~~~~~~~~~~</tspan>
1013</tspan>
1014 <tspan x="10px" y="8938px">
1015</tspan>
1016 <tspan x="10px" y="8956px"><tspan class="fg-ansi256-009 bold">error</tspan><tspan class="bold">: aborting due to 39 previous errors</tspan>
1017</tspan>
1018 <tspan x="10px" y="8974px">
1019</tspan>
1020 <tspan x="10px" y="8992px"><tspan class="bold">Some errors have detailed explanations: E0061, E0063, E0533, E0559, E0599, E0618.</tspan>
1021</tspan>
1022 <tspan x="10px" y="9010px"><tspan class="bold">For more information about an error, try `rustc --explain E0061`.</tspan>
1023</tspan>
1024 <tspan x="10px" y="9028px">
1025</tspan>
1026 </text>
1027
1028</svg>
tests/ui/suggestions/nested-non-tuple-tuple-struct.stderr+16-16
......@@ -9,8 +9,8 @@ LL | let _x = (S { x: 1.0, y: 2.0 }, S { x: 3.0, y: 4.0 });
99 |
1010help: `S` is a tuple struct, use the appropriate syntax
1111 |
12LL | let _x = (S(/* fields */), S { x: 3.0, y: 4.0 });
13 | ~~~~~~~~~~~~~~~
12LL | let _x = (S(/* f32 */, /* f32 */), S { x: 3.0, y: 4.0 });
13 | ~~~~~~~~~~~~~~~~~~~~~~~
1414
1515error[E0560]: struct `S` has no field named `y`
1616 --> $DIR/nested-non-tuple-tuple-struct.rs:8:27
......@@ -23,8 +23,8 @@ LL | let _x = (S { x: 1.0, y: 2.0 }, S { x: 3.0, y: 4.0 });
2323 |
2424help: `S` is a tuple struct, use the appropriate syntax
2525 |
26LL | let _x = (S(/* fields */), S { x: 3.0, y: 4.0 });
27 | ~~~~~~~~~~~~~~~
26LL | let _x = (S(/* f32 */, /* f32 */), S { x: 3.0, y: 4.0 });
27 | ~~~~~~~~~~~~~~~~~~~~~~~
2828
2929error[E0560]: struct `S` has no field named `x`
3030 --> $DIR/nested-non-tuple-tuple-struct.rs:8:41
......@@ -37,8 +37,8 @@ LL | let _x = (S { x: 1.0, y: 2.0 }, S { x: 3.0, y: 4.0 });
3737 |
3838help: `S` is a tuple struct, use the appropriate syntax
3939 |
40LL | let _x = (S { x: 1.0, y: 2.0 }, S(/* fields */));
41 | ~~~~~~~~~~~~~~~
40LL | let _x = (S { x: 1.0, y: 2.0 }, S(/* f32 */, /* f32 */));
41 | ~~~~~~~~~~~~~~~~~~~~~~~
4242
4343error[E0560]: struct `S` has no field named `y`
4444 --> $DIR/nested-non-tuple-tuple-struct.rs:8:49
......@@ -51,8 +51,8 @@ LL | let _x = (S { x: 1.0, y: 2.0 }, S { x: 3.0, y: 4.0 });
5151 |
5252help: `S` is a tuple struct, use the appropriate syntax
5353 |
54LL | let _x = (S { x: 1.0, y: 2.0 }, S(/* fields */));
55 | ~~~~~~~~~~~~~~~
54LL | let _x = (S { x: 1.0, y: 2.0 }, S(/* f32 */, /* f32 */));
55 | ~~~~~~~~~~~~~~~~~~~~~~~
5656
5757error[E0559]: variant `E::V` has no field named `x`
5858 --> $DIR/nested-non-tuple-tuple-struct.rs:13:22
......@@ -65,8 +65,8 @@ LL | let _y = (E::V { x: 1.0, y: 2.0 }, E::V { x: 3.0, y: 4.0 });
6565 |
6666help: `E::V` is a tuple variant, use the appropriate syntax
6767 |
68LL | let _y = (E::V(/* fields */), E::V { x: 3.0, y: 4.0 });
69 | ~~~~~~~~~~~~~~~~~~
68LL | let _y = (E::V(/* f32 */, /* f32 */), E::V { x: 3.0, y: 4.0 });
69 | ~~~~~~~~~~~~~~~~~~~~~~
7070
7171error[E0559]: variant `E::V` has no field named `y`
7272 --> $DIR/nested-non-tuple-tuple-struct.rs:13:30
......@@ -79,8 +79,8 @@ LL | let _y = (E::V { x: 1.0, y: 2.0 }, E::V { x: 3.0, y: 4.0 });
7979 |
8080help: `E::V` is a tuple variant, use the appropriate syntax
8181 |
82LL | let _y = (E::V(/* fields */), E::V { x: 3.0, y: 4.0 });
83 | ~~~~~~~~~~~~~~~~~~
82LL | let _y = (E::V(/* f32 */, /* f32 */), E::V { x: 3.0, y: 4.0 });
83 | ~~~~~~~~~~~~~~~~~~~~~~
8484
8585error[E0559]: variant `E::V` has no field named `x`
8686 --> $DIR/nested-non-tuple-tuple-struct.rs:13:47
......@@ -93,8 +93,8 @@ LL | let _y = (E::V { x: 1.0, y: 2.0 }, E::V { x: 3.0, y: 4.0 });
9393 |
9494help: `E::V` is a tuple variant, use the appropriate syntax
9595 |
96LL | let _y = (E::V { x: 1.0, y: 2.0 }, E::V(/* fields */));
97 | ~~~~~~~~~~~~~~~~~~
96LL | let _y = (E::V { x: 1.0, y: 2.0 }, E::V(/* f32 */, /* f32 */));
97 | ~~~~~~~~~~~~~~~~~~~~~~
9898
9999error[E0559]: variant `E::V` has no field named `y`
100100 --> $DIR/nested-non-tuple-tuple-struct.rs:13:55
......@@ -107,8 +107,8 @@ LL | let _y = (E::V { x: 1.0, y: 2.0 }, E::V { x: 3.0, y: 4.0 });
107107 |
108108help: `E::V` is a tuple variant, use the appropriate syntax
109109 |
110LL | let _y = (E::V { x: 1.0, y: 2.0 }, E::V(/* fields */));
111 | ~~~~~~~~~~~~~~~~~~
110LL | let _y = (E::V { x: 1.0, y: 2.0 }, E::V(/* f32 */, /* f32 */));
111 | ~~~~~~~~~~~~~~~~~~~~~~
112112
113113error: aborting due to 8 previous errors
114114
tests/ui/suggestions/suggest-variants.stderr+24-10
......@@ -5,7 +5,12 @@ LL | enum Shape {
55 | ---------- variant `Squareee` not found here
66...
77LL | println!("My shape is {:?}", Shape::Squareee { size: 5});
8 | ^^^^^^^^ help: there is a variant with a similar name: `Square`
8 | ^^^^^^^^
9 |
10help: there is a variant with a similar name
11 |
12LL | println!("My shape is {:?}", Shape::Square { size: 5});
13 | ~~~~~~
914
1015error[E0599]: no variant named `Circl` found for enum `Shape`
1116 --> $DIR/suggest-variants.rs:13:41
......@@ -14,7 +19,12 @@ LL | enum Shape {
1419 | ---------- variant `Circl` not found here
1520...
1621LL | println!("My shape is {:?}", Shape::Circl { size: 5});
17 | ^^^^^ help: there is a variant with a similar name: `Circle`
22 | ^^^^^
23 |
24help: there is a variant with a similar name
25 |
26LL | println!("My shape is {:?}", Shape::Circle { size: 5});
27 | ~~~~~~
1828
1929error[E0599]: no variant named `Rombus` found for enum `Shape`
2030 --> $DIR/suggest-variants.rs:14:41
......@@ -32,10 +42,12 @@ LL | enum Shape {
3242 | ---------- variant or associated item `Squareee` not found for this enum
3343...
3444LL | Shape::Squareee;
35 | ^^^^^^^^
36 | |
37 | variant or associated item not found in `Shape`
38 | help: there is a variant with a similar name: `Square`
45 | ^^^^^^^^ variant or associated item not found in `Shape`
46 |
47help: there is a variant with a similar name
48 |
49LL | Shape::Square { size: /* value */ };
50 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
3951
4052error[E0599]: no variant or associated item named `Circl` found for enum `Shape` in the current scope
4153 --> $DIR/suggest-variants.rs:16:12
......@@ -44,10 +56,12 @@ LL | enum Shape {
4456 | ---------- variant or associated item `Circl` not found for this enum
4557...
4658LL | Shape::Circl;
47 | ^^^^^
48 | |
49 | variant or associated item not found in `Shape`
50 | help: there is a variant with a similar name: `Circle`
59 | ^^^^^ variant or associated item not found in `Shape`
60 |
61help: there is a variant with a similar name
62 |
63LL | Shape::Circle { radius: /* value */ };
64 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
5165
5266error[E0599]: no variant or associated item named `Rombus` found for enum `Shape` in the current scope
5367 --> $DIR/suggest-variants.rs:17:12
tests/ui/type-alias-enum-variants/incorrect-variant-form-through-alias-caught.stderr+5
......@@ -3,6 +3,11 @@ error[E0533]: expected value, found struct variant `Alias::Braced`
33 |
44LL | Alias::Braced;
55 | ^^^^^^^^^^^^^ not a value
6 |
7help: you might have meant to create a new value of the struct
8 |
9LL | Alias::Braced {};
10 | ++
611
712error[E0533]: expected unit struct, unit variant or constant, found struct variant `Alias::Braced`
813 --> $DIR/incorrect-variant-form-through-alias-caught.rs:10:9