authorbors <bors@rust-lang.org> 2025-04-17 11:21:54 UTC
committerbors <bors@rust-lang.org> 2025-04-17 11:21:54 UTC
log883f9f72e87ccb6838d528d8158ea6323baacc65
tree8252f01daf779855a606cff9433342feddac0004
parent94015d3cd4b48d098abd0f3e44af97dab2b713b4
parent7650fe95b1b2f4b030c0de9a06b5bea582f26480

Auto merge of #139949 - matthiaskrgr:rollup-pxc5tsx, r=matthiaskrgr

Rollup of 8 pull requests Successful merges: - #138632 (Stabilize `cfg_boolean_literals`) - #139416 (unstable book; document `macro_metavar_expr_concat`) - #139782 (Consistent with treating Ctor Call as Struct in liveness analysis) - #139885 (document RUSTC_BOOTSTRAP, RUSTC_OVERRIDE_VERSION_STRING, and -Z allow-features in the unstable book) - #139904 (Explicitly annotate edition for `unpretty=expanded` and `unpretty=hir` tests) - #139932 (transmutability: Refactor tests for simplicity) - #139944 (Move eager translation to a method on Diag) - #139948 (git: ignore `60600a6fa403216bfd66e04f948b1822f6450af7` for blame purposes) r? `@ghost` `@rustbot` modify labels: rollup

240 files changed, 1038 insertions(+), 978 deletions(-)

.git-blame-ignore-revs+2
......@@ -31,3 +31,5 @@ ec2cc761bc7067712ecc7734502f703fe3b024c8
3131c682aa162b0d41e21cc6748f4fecfe01efb69d1f
3232# reformat with updated edition 2024
33331fcae03369abb4c2cc180cd5a49e1f4440a81300
34# Breaking up of compiletest runtest.rs
3560600a6fa403216bfd66e04f948b1822f6450af7
compiler/rustc_ast_passes/src/errors.rs+3-11
......@@ -2,7 +2,7 @@
22
33use rustc_ast::ParamKindOrd;
44use rustc_errors::codes::*;
5use rustc_errors::{Applicability, Diag, EmissionGuarantee, SubdiagMessageOp, Subdiagnostic};
5use rustc_errors::{Applicability, Diag, EmissionGuarantee, Subdiagnostic};
66use rustc_macros::{Diagnostic, Subdiagnostic};
77use rustc_span::{Ident, Span, Symbol};
88
......@@ -394,11 +394,7 @@ pub(crate) struct EmptyLabelManySpans(pub Vec<Span>);
394394
395395// The derive for `Vec<Span>` does multiple calls to `span_label`, adding commas between each
396396impl Subdiagnostic for EmptyLabelManySpans {
397 fn add_to_diag_with<G: EmissionGuarantee, F: SubdiagMessageOp<G>>(
398 self,
399 diag: &mut Diag<'_, G>,
400 _: &F,
401 ) {
397 fn add_to_diag<G: EmissionGuarantee>(self, diag: &mut Diag<'_, G>) {
402398 diag.span_labels(self.0, "");
403399 }
404400}
......@@ -749,11 +745,7 @@ pub(crate) struct StableFeature {
749745}
750746
751747impl Subdiagnostic for StableFeature {
752 fn add_to_diag_with<G: EmissionGuarantee, F: SubdiagMessageOp<G>>(
753 self,
754 diag: &mut Diag<'_, G>,
755 _: &F,
756 ) {
748 fn add_to_diag<G: EmissionGuarantee>(self, diag: &mut Diag<'_, G>) {
757749 diag.arg("name", self.name);
758750 diag.arg("since", self.since);
759751 diag.help(fluent::ast_passes_stable_since);
compiler/rustc_attr_parsing/src/attributes/cfg.rs-15
......@@ -7,7 +7,6 @@ use rustc_session::config::ExpectedValues;
77use rustc_session::lint::BuiltinLintDiag;
88use rustc_session::lint::builtin::UNEXPECTED_CFGS;
99use rustc_session::parse::feature_err;
10use rustc_span::symbol::kw;
1110use rustc_span::{Span, Symbol, sym};
1211
1312use crate::session_diagnostics::{self, UnsupportedLiteralReason};
......@@ -89,20 +88,6 @@ pub fn eval_condition(
8988 let cfg = match cfg {
9089 MetaItemInner::MetaItem(meta_item) => meta_item,
9190 MetaItemInner::Lit(MetaItemLit { kind: LitKind::Bool(b), .. }) => {
92 if let Some(features) = features {
93 // we can't use `try_gate_cfg` as symbols don't differentiate between `r#true`
94 // and `true`, and we want to keep the former working without feature gate
95 gate_cfg(
96 &(
97 if *b { kw::True } else { kw::False },
98 sym::cfg_boolean_literals,
99 |features: &Features| features.cfg_boolean_literals(),
100 ),
101 cfg.span(),
102 sess,
103 features,
104 );
105 }
10691 return *b;
10792 }
10893 _ => {
compiler/rustc_builtin_macros/src/errors.rs+3-7
......@@ -1,7 +1,7 @@
11use rustc_errors::codes::*;
22use rustc_errors::{
33 Diag, DiagCtxtHandle, Diagnostic, EmissionGuarantee, Level, MultiSpan, SingleLabelManySpans,
4 SubdiagMessageOp, Subdiagnostic,
4 Subdiagnostic,
55};
66use rustc_macros::{Diagnostic, Subdiagnostic};
77use rustc_span::{Ident, Span, Symbol};
......@@ -684,13 +684,9 @@ pub(crate) struct FormatUnusedArg {
684684// Allow the singular form to be a subdiagnostic of the multiple-unused
685685// form of diagnostic.
686686impl Subdiagnostic for FormatUnusedArg {
687 fn add_to_diag_with<G: EmissionGuarantee, F: SubdiagMessageOp<G>>(
688 self,
689 diag: &mut Diag<'_, G>,
690 f: &F,
691 ) {
687 fn add_to_diag<G: EmissionGuarantee>(self, diag: &mut Diag<'_, G>) {
692688 diag.arg("named", self.named);
693 let msg = f(diag, crate::fluent_generated::builtin_macros_format_unused_arg.into());
689 let msg = diag.eagerly_translate(crate::fluent_generated::builtin_macros_format_unused_arg);
694690 diag.span_label(self.span, msg);
695691 }
696692}
compiler/rustc_const_eval/src/errors.rs+3-7
......@@ -6,7 +6,7 @@ use rustc_abi::WrappingRange;
66use rustc_errors::codes::*;
77use rustc_errors::{
88 Diag, DiagArgValue, DiagCtxtHandle, DiagMessage, Diagnostic, EmissionGuarantee, Level,
9 MultiSpan, SubdiagMessageOp, Subdiagnostic,
9 MultiSpan, Subdiagnostic,
1010};
1111use rustc_hir::ConstContext;
1212use rustc_macros::{Diagnostic, LintDiagnostic, Subdiagnostic};
......@@ -290,11 +290,7 @@ pub struct FrameNote {
290290}
291291
292292impl Subdiagnostic for FrameNote {
293 fn add_to_diag_with<G: EmissionGuarantee, F: SubdiagMessageOp<G>>(
294 self,
295 diag: &mut Diag<'_, G>,
296 f: &F,
297 ) {
293 fn add_to_diag<G: EmissionGuarantee>(self, diag: &mut Diag<'_, G>) {
298294 diag.arg("times", self.times);
299295 diag.arg("where_", self.where_);
300296 diag.arg("instance", self.instance);
......@@ -302,7 +298,7 @@ impl Subdiagnostic for FrameNote {
302298 if self.has_label && !self.span.is_dummy() {
303299 span.push_span_label(self.span, fluent::const_eval_frame_note_last);
304300 }
305 let msg = f(diag, fluent::const_eval_frame_note.into());
301 let msg = diag.eagerly_translate(fluent::const_eval_frame_note);
306302 diag.span_note(span, msg);
307303 }
308304}
compiler/rustc_errors/src/diagnostic.rs+13-20
......@@ -181,22 +181,9 @@ where
181181 Self: Sized,
182182{
183183 /// Add a subdiagnostic to an existing diagnostic.
184 fn add_to_diag<G: EmissionGuarantee>(self, diag: &mut Diag<'_, G>) {
185 self.add_to_diag_with(diag, &|_, m| m);
186 }
187
188 /// Add a subdiagnostic to an existing diagnostic where `f` is invoked on every message used
189 /// (to optionally perform eager translation).
190 fn add_to_diag_with<G: EmissionGuarantee, F: SubdiagMessageOp<G>>(
191 self,
192 diag: &mut Diag<'_, G>,
193 f: &F,
194 );
184 fn add_to_diag<G: EmissionGuarantee>(self, diag: &mut Diag<'_, G>);
195185}
196186
197pub trait SubdiagMessageOp<G: EmissionGuarantee> =
198 Fn(&mut Diag<'_, G>, SubdiagMessage) -> SubdiagMessage;
199
200187/// Trait implemented by lint types. This should not be implemented manually. Instead, use
201188/// `#[derive(LintDiagnostic)]` -- see [rustc_macros::LintDiagnostic].
202189#[rustc_diagnostic_item = "LintDiagnostic"]
......@@ -1227,15 +1214,21 @@ impl<'a, G: EmissionGuarantee> Diag<'a, G> {
12271214 /// interpolated variables).
12281215 #[rustc_lint_diagnostics]
12291216 pub fn subdiagnostic(&mut self, subdiagnostic: impl Subdiagnostic) -> &mut Self {
1230 let dcx = self.dcx;
1231 subdiagnostic.add_to_diag_with(self, &|diag, msg| {
1232 let args = diag.args.iter();
1233 let msg = diag.subdiagnostic_message_to_diagnostic_message(msg);
1234 dcx.eagerly_translate(msg, args)
1235 });
1217 subdiagnostic.add_to_diag(self);
12361218 self
12371219 }
12381220
1221 /// Fluent variables are not namespaced from each other, so when
1222 /// `Diagnostic`s and `Subdiagnostic`s use the same variable name,
1223 /// one value will clobber the other. Eagerly translating the
1224 /// diagnostic uses the variables defined right then, before the
1225 /// clobbering occurs.
1226 pub fn eagerly_translate(&self, msg: impl Into<SubdiagMessage>) -> SubdiagMessage {
1227 let args = self.args.iter();
1228 let msg = self.subdiagnostic_message_to_diagnostic_message(msg.into());
1229 self.dcx.eagerly_translate(msg, args)
1230 }
1231
12391232 with_fn! { with_span,
12401233 /// Add a span.
12411234 #[rustc_lint_diagnostics]
compiler/rustc_errors/src/diagnostic_impls.rs+2-6
......@@ -19,7 +19,7 @@ use {rustc_ast as ast, rustc_hir as hir};
1919use crate::diagnostic::DiagLocation;
2020use crate::{
2121 Diag, DiagArgValue, DiagCtxtHandle, Diagnostic, EmissionGuarantee, ErrCode, IntoDiagArg, Level,
22 SubdiagMessageOp, Subdiagnostic, fluent_generated as fluent,
22 Subdiagnostic, fluent_generated as fluent,
2323};
2424
2525pub struct DiagArgFromDisplay<'a>(pub &'a dyn fmt::Display);
......@@ -384,11 +384,7 @@ pub struct SingleLabelManySpans {
384384 pub label: &'static str,
385385}
386386impl Subdiagnostic for SingleLabelManySpans {
387 fn add_to_diag_with<G: EmissionGuarantee, F: SubdiagMessageOp<G>>(
388 self,
389 diag: &mut Diag<'_, G>,
390 _: &F,
391 ) {
387 fn add_to_diag<G: EmissionGuarantee>(self, diag: &mut Diag<'_, G>) {
392388 diag.span_labels(self.spans, self.label);
393389 }
394390}
compiler/rustc_errors/src/lib.rs+1-1
......@@ -47,7 +47,7 @@ pub use codes::*;
4747pub use diagnostic::{
4848 BugAbort, Diag, DiagArg, DiagArgMap, DiagArgName, DiagArgValue, DiagInner, DiagStyledString,
4949 Diagnostic, EmissionGuarantee, FatalAbort, IntoDiagArg, LintDiagnostic, StringPart, Subdiag,
50 SubdiagMessageOp, Subdiagnostic,
50 Subdiagnostic,
5151};
5252pub use diagnostic_impls::{
5353 DiagArgFromDisplay, DiagSymbolList, ElidedLifetimeInPathSubdiag, ExpectedLifetimeParameter,
compiler/rustc_feature/src/accepted.rs+2
......@@ -95,6 +95,8 @@ declare_features! (
9595 (accepted, c_unwind, "1.81.0", Some(74990)),
9696 /// Allows `#[cfg_attr(predicate, multiple, attributes, here)]`.
9797 (accepted, cfg_attr_multi, "1.33.0", Some(54881)),
98 /// Allows the use of `#[cfg(<true/false>)]`.
99 (accepted, cfg_boolean_literals, "CURRENT_RUSTC_VERSION", Some(131204)),
98100 /// Allows the use of `#[cfg(doctest)]`, set when rustdoc is collecting doctests.
99101 (accepted, cfg_doctest, "1.40.0", Some(62210)),
100102 /// Enables `#[cfg(panic = "...")]` config key.
compiler/rustc_feature/src/unstable.rs-2
......@@ -391,8 +391,6 @@ declare_features! (
391391 (unstable, async_trait_bounds, "1.85.0", Some(62290)),
392392 /// Allows using C-variadics.
393393 (unstable, c_variadic, "1.34.0", Some(44930)),
394 /// Allows the use of `#[cfg(<true/false>)]`.
395 (unstable, cfg_boolean_literals, "1.83.0", Some(131204)),
396394 /// Allows the use of `#[cfg(contract_checks)` to check if contract checks are enabled.
397395 (unstable, cfg_contract_checks, "1.86.0", Some(128044)),
398396 /// Allows the use of `#[cfg(overflow_checks)` to check if integer overflow behaviour.
compiler/rustc_hir_typeck/src/errors.rs+8-24
......@@ -5,7 +5,7 @@ use std::borrow::Cow;
55use rustc_errors::codes::*;
66use rustc_errors::{
77 Applicability, Diag, DiagArgValue, DiagSymbolList, EmissionGuarantee, IntoDiagArg, MultiSpan,
8 SubdiagMessageOp, Subdiagnostic,
8 Subdiagnostic,
99};
1010use rustc_macros::{Diagnostic, LintDiagnostic, Subdiagnostic};
1111use rustc_middle::ty::{self, Ty};
......@@ -270,11 +270,7 @@ pub(crate) struct SuggestAnnotations {
270270 pub suggestions: Vec<SuggestAnnotation>,
271271}
272272impl Subdiagnostic for SuggestAnnotations {
273 fn add_to_diag_with<G: EmissionGuarantee, F: SubdiagMessageOp<G>>(
274 self,
275 diag: &mut Diag<'_, G>,
276 _: &F,
277 ) {
273 fn add_to_diag<G: EmissionGuarantee>(self, diag: &mut Diag<'_, G>) {
278274 if self.suggestions.is_empty() {
279275 return;
280276 }
......@@ -337,11 +333,7 @@ pub(crate) struct TypeMismatchFruTypo {
337333}
338334
339335impl Subdiagnostic for TypeMismatchFruTypo {
340 fn add_to_diag_with<G: EmissionGuarantee, F: SubdiagMessageOp<G>>(
341 self,
342 diag: &mut Diag<'_, G>,
343 _f: &F,
344 ) {
336 fn add_to_diag<G: EmissionGuarantee>(self, diag: &mut Diag<'_, G>) {
345337 diag.arg("expr", self.expr.as_deref().unwrap_or("NONE"));
346338
347339 // Only explain that `a ..b` is a range if it's split up
......@@ -599,11 +591,7 @@ pub(crate) struct RemoveSemiForCoerce {
599591}
600592
601593impl Subdiagnostic for RemoveSemiForCoerce {
602 fn add_to_diag_with<G: EmissionGuarantee, F: SubdiagMessageOp<G>>(
603 self,
604 diag: &mut Diag<'_, G>,
605 _f: &F,
606 ) {
594 fn add_to_diag<G: EmissionGuarantee>(self, diag: &mut Diag<'_, G>) {
607595 let mut multispan: MultiSpan = self.semi.into();
608596 multispan.push_span_label(self.expr, fluent::hir_typeck_remove_semi_for_coerce_expr);
609597 multispan.push_span_label(self.ret, fluent::hir_typeck_remove_semi_for_coerce_ret);
......@@ -778,20 +766,16 @@ pub(crate) enum CastUnknownPointerSub {
778766}
779767
780768impl rustc_errors::Subdiagnostic for CastUnknownPointerSub {
781 fn add_to_diag_with<G: EmissionGuarantee, F: SubdiagMessageOp<G>>(
782 self,
783 diag: &mut Diag<'_, G>,
784 f: &F,
785 ) {
769 fn add_to_diag<G: EmissionGuarantee>(self, diag: &mut Diag<'_, G>) {
786770 match self {
787771 CastUnknownPointerSub::To(span) => {
788 let msg = f(diag, crate::fluent_generated::hir_typeck_label_to);
772 let msg = diag.eagerly_translate(fluent::hir_typeck_label_to);
789773 diag.span_label(span, msg);
790 let msg = f(diag, crate::fluent_generated::hir_typeck_note);
774 let msg = diag.eagerly_translate(fluent::hir_typeck_note);
791775 diag.note(msg);
792776 }
793777 CastUnknownPointerSub::From(span) => {
794 let msg = f(diag, crate::fluent_generated::hir_typeck_label_from);
778 let msg = diag.eagerly_translate(fluent::hir_typeck_label_from);
795779 diag.span_label(span, msg);
796780 }
797781 }
compiler/rustc_lint/src/errors.rs+2-6
......@@ -1,5 +1,5 @@
11use rustc_errors::codes::*;
2use rustc_errors::{Diag, EmissionGuarantee, SubdiagMessageOp, Subdiagnostic};
2use rustc_errors::{Diag, EmissionGuarantee, Subdiagnostic};
33use rustc_macros::{Diagnostic, Subdiagnostic};
44use rustc_session::lint::Level;
55use rustc_span::{Span, Symbol};
......@@ -26,11 +26,7 @@ pub(crate) enum OverruledAttributeSub {
2626}
2727
2828impl Subdiagnostic for OverruledAttributeSub {
29 fn add_to_diag_with<G: EmissionGuarantee, F: SubdiagMessageOp<G>>(
30 self,
31 diag: &mut Diag<'_, G>,
32 _f: &F,
33 ) {
29 fn add_to_diag<G: EmissionGuarantee>(self, diag: &mut Diag<'_, G>) {
3430 match self {
3531 OverruledAttributeSub::DefaultSource { id } => {
3632 diag.note(fluent::lint_default_source);
compiler/rustc_lint/src/if_let_rescope.rs+3-9
......@@ -3,9 +3,7 @@ use std::ops::ControlFlow;
33
44use hir::intravisit::{self, Visitor};
55use rustc_ast::Recovered;
6use rustc_errors::{
7 Applicability, Diag, EmissionGuarantee, SubdiagMessageOp, Subdiagnostic, SuggestionStyle,
8};
6use rustc_errors::{Applicability, Diag, EmissionGuarantee, Subdiagnostic, SuggestionStyle};
97use rustc_hir::{self as hir, HirIdSet};
108use rustc_macros::{LintDiagnostic, Subdiagnostic};
119use rustc_middle::ty::adjustment::Adjust;
......@@ -327,11 +325,7 @@ struct IfLetRescopeRewrite {
327325}
328326
329327impl Subdiagnostic for IfLetRescopeRewrite {
330 fn add_to_diag_with<G: EmissionGuarantee, F: SubdiagMessageOp<G>>(
331 self,
332 diag: &mut Diag<'_, G>,
333 f: &F,
334 ) {
328 fn add_to_diag<G: EmissionGuarantee>(self, diag: &mut Diag<'_, G>) {
335329 let mut suggestions = vec![];
336330 for match_head in self.match_heads {
337331 match match_head {
......@@ -360,7 +354,7 @@ impl Subdiagnostic for IfLetRescopeRewrite {
360354 .chain(repeat('}').take(closing_brackets.count))
361355 .collect(),
362356 ));
363 let msg = f(diag, crate::fluent_generated::lint_suggestion);
357 let msg = diag.eagerly_translate(crate::fluent_generated::lint_suggestion);
364358 diag.multipart_suggestion_with_style(
365359 msg,
366360 suggestions,
compiler/rustc_lint/src/lints.rs+8-36
......@@ -6,7 +6,7 @@ use rustc_abi::ExternAbi;
66use rustc_errors::codes::*;
77use rustc_errors::{
88 Applicability, Diag, DiagArgValue, DiagMessage, DiagStyledString, ElidedLifetimeInPathSubdiag,
9 EmissionGuarantee, LintDiagnostic, MultiSpan, SubdiagMessageOp, Subdiagnostic, SuggestionStyle,
9 EmissionGuarantee, LintDiagnostic, MultiSpan, Subdiagnostic, SuggestionStyle,
1010};
1111use rustc_hir::def::Namespace;
1212use rustc_hir::def_id::DefId;
......@@ -449,11 +449,7 @@ pub(crate) struct BuiltinUnpermittedTypeInitSub {
449449}
450450
451451impl Subdiagnostic for BuiltinUnpermittedTypeInitSub {
452 fn add_to_diag_with<G: EmissionGuarantee, F: SubdiagMessageOp<G>>(
453 self,
454 diag: &mut Diag<'_, G>,
455 _f: &F,
456 ) {
452 fn add_to_diag<G: EmissionGuarantee>(self, diag: &mut Diag<'_, G>) {
457453 let mut err = self.err;
458454 loop {
459455 if let Some(span) = err.span {
......@@ -504,11 +500,7 @@ pub(crate) struct BuiltinClashingExternSub<'a> {
504500}
505501
506502impl Subdiagnostic for BuiltinClashingExternSub<'_> {
507 fn add_to_diag_with<G: EmissionGuarantee, F: SubdiagMessageOp<G>>(
508 self,
509 diag: &mut Diag<'_, G>,
510 _f: &F,
511 ) {
503 fn add_to_diag<G: EmissionGuarantee>(self, diag: &mut Diag<'_, G>) {
512504 let mut expected_str = DiagStyledString::new();
513505 expected_str.push(self.expected.fn_sig(self.tcx).to_string(), false);
514506 let mut found_str = DiagStyledString::new();
......@@ -824,11 +816,7 @@ pub(crate) struct HiddenUnicodeCodepointsDiagLabels {
824816}
825817
826818impl Subdiagnostic for HiddenUnicodeCodepointsDiagLabels {
827 fn add_to_diag_with<G: EmissionGuarantee, F: SubdiagMessageOp<G>>(
828 self,
829 diag: &mut Diag<'_, G>,
830 _f: &F,
831 ) {
819 fn add_to_diag<G: EmissionGuarantee>(self, diag: &mut Diag<'_, G>) {
832820 for (c, span) in self.spans {
833821 diag.span_label(span, format!("{c:?}"));
834822 }
......@@ -842,11 +830,7 @@ pub(crate) enum HiddenUnicodeCodepointsDiagSub {
842830
843831// Used because of multiple multipart_suggestion and note
844832impl Subdiagnostic for HiddenUnicodeCodepointsDiagSub {
845 fn add_to_diag_with<G: EmissionGuarantee, F: SubdiagMessageOp<G>>(
846 self,
847 diag: &mut Diag<'_, G>,
848 _f: &F,
849 ) {
833 fn add_to_diag<G: EmissionGuarantee>(self, diag: &mut Diag<'_, G>) {
850834 match self {
851835 HiddenUnicodeCodepointsDiagSub::Escape { spans } => {
852836 diag.multipart_suggestion_with_style(
......@@ -1015,11 +999,7 @@ pub(crate) struct NonBindingLetSub {
1015999}
10161000
10171001impl Subdiagnostic for NonBindingLetSub {
1018 fn add_to_diag_with<G: EmissionGuarantee, F: SubdiagMessageOp<G>>(
1019 self,
1020 diag: &mut Diag<'_, G>,
1021 _f: &F,
1022 ) {
1002 fn add_to_diag<G: EmissionGuarantee>(self, diag: &mut Diag<'_, G>) {
10231003 let can_suggest_binding = self.drop_fn_start_end.is_some() || !self.is_assign_desugar;
10241004
10251005 if can_suggest_binding {
......@@ -1303,11 +1283,7 @@ pub(crate) enum NonSnakeCaseDiagSub {
13031283}
13041284
13051285impl Subdiagnostic for NonSnakeCaseDiagSub {
1306 fn add_to_diag_with<G: EmissionGuarantee, F: SubdiagMessageOp<G>>(
1307 self,
1308 diag: &mut Diag<'_, G>,
1309 _f: &F,
1310 ) {
1286 fn add_to_diag<G: EmissionGuarantee>(self, diag: &mut Diag<'_, G>) {
13111287 match self {
13121288 NonSnakeCaseDiagSub::Label { span } => {
13131289 diag.span_label(span, fluent::lint_label);
......@@ -1629,11 +1605,7 @@ pub(crate) enum OverflowingBinHexSign {
16291605}
16301606
16311607impl Subdiagnostic for OverflowingBinHexSign {
1632 fn add_to_diag_with<G: EmissionGuarantee, F: SubdiagMessageOp<G>>(
1633 self,
1634 diag: &mut Diag<'_, G>,
1635 _f: &F,
1636 ) {
1608 fn add_to_diag<G: EmissionGuarantee>(self, diag: &mut Diag<'_, G>) {
16371609 match self {
16381610 OverflowingBinHexSign::Positive => {
16391611 diag.note(fluent::lint_positive_note);
compiler/rustc_macros/src/diagnostics/subdiagnostic.rs+4-11
......@@ -20,14 +20,12 @@ use crate::diagnostics::utils::{
2020/// The central struct for constructing the `add_to_diag` method from an annotated struct.
2121pub(crate) struct SubdiagnosticDerive {
2222 diag: syn::Ident,
23 f: syn::Ident,
2423}
2524
2625impl SubdiagnosticDerive {
2726 pub(crate) fn new() -> Self {
2827 let diag = format_ident!("diag");
29 let f = format_ident!("f");
30 Self { diag, f }
28 Self { diag }
3129 }
3230
3331 pub(crate) fn into_tokens(self, mut structure: Structure<'_>) -> TokenStream {
......@@ -86,19 +84,16 @@ impl SubdiagnosticDerive {
8684 };
8785
8886 let diag = &self.diag;
89 let f = &self.f;
9087
9188 // FIXME(edition_2024): Fix the `keyword_idents_2024` lint to not trigger here?
9289 #[allow(keyword_idents_2024)]
9390 let ret = structure.gen_impl(quote! {
9491 gen impl rustc_errors::Subdiagnostic for @Self {
95 fn add_to_diag_with<__G, __F>(
92 fn add_to_diag<__G>(
9693 self,
9794 #diag: &mut rustc_errors::Diag<'_, __G>,
98 #f: &__F
9995 ) where
10096 __G: rustc_errors::EmissionGuarantee,
101 __F: rustc_errors::SubdiagMessageOp<__G>,
10297 {
10398 #implementation
10499 }
......@@ -384,11 +379,10 @@ impl<'parent, 'a> SubdiagnosticDeriveVariantBuilder<'parent, 'a> {
384379 Ok(quote! {})
385380 }
386381 "subdiagnostic" => {
387 let f = &self.parent.f;
388382 let diag = &self.parent.diag;
389383 let binding = &info.binding;
390384 self.has_subdiagnostic = true;
391 Ok(quote! { #binding.add_to_diag_with(#diag, #f); })
385 Ok(quote! { #binding.add_to_diag(#diag); })
392386 }
393387 _ => {
394388 let mut span_attrs = vec![];
......@@ -531,12 +525,11 @@ impl<'parent, 'a> SubdiagnosticDeriveVariantBuilder<'parent, 'a> {
531525 let span_field = self.span_field.value_ref();
532526
533527 let diag = &self.parent.diag;
534 let f = &self.parent.f;
535528 let mut calls = TokenStream::new();
536529 for (kind, slug, no_span) in kind_slugs {
537530 let message = format_ident!("__message");
538531 calls.extend(
539 quote! { let #message = #f(#diag, crate::fluent_generated::#slug.into()); },
532 quote! { let #message = #diag.eagerly_translate(crate::fluent_generated::#slug); },
540533 );
541534
542535 let name = format_ident!(
compiler/rustc_mir_build/src/errors.rs+4-16
......@@ -2,7 +2,7 @@ use rustc_data_structures::fx::FxIndexMap;
22use rustc_errors::codes::*;
33use rustc_errors::{
44 Applicability, Diag, DiagArgValue, DiagCtxtHandle, Diagnostic, EmissionGuarantee, Level,
5 MultiSpan, SubdiagMessageOp, Subdiagnostic, pluralize,
5 MultiSpan, Subdiagnostic, pluralize,
66};
77use rustc_macros::{Diagnostic, LintDiagnostic, Subdiagnostic};
88use rustc_middle::ty::{self, Ty};
......@@ -546,11 +546,7 @@ pub(crate) struct UnsafeNotInheritedLintNote {
546546}
547547
548548impl Subdiagnostic for UnsafeNotInheritedLintNote {
549 fn add_to_diag_with<G: EmissionGuarantee, F: SubdiagMessageOp<G>>(
550 self,
551 diag: &mut Diag<'_, G>,
552 _f: &F,
553 ) {
549 fn add_to_diag<G: EmissionGuarantee>(self, diag: &mut Diag<'_, G>) {
554550 diag.span_note(self.signature_span, fluent::mir_build_unsafe_fn_safe_body);
555551 let body_start = self.body_span.shrink_to_lo();
556552 let body_end = self.body_span.shrink_to_hi();
......@@ -1031,11 +1027,7 @@ pub(crate) struct Variant {
10311027}
10321028
10331029impl<'tcx> Subdiagnostic for AdtDefinedHere<'tcx> {
1034 fn add_to_diag_with<G: EmissionGuarantee, F: SubdiagMessageOp<G>>(
1035 self,
1036 diag: &mut Diag<'_, G>,
1037 _f: &F,
1038 ) {
1030 fn add_to_diag<G: EmissionGuarantee>(self, diag: &mut Diag<'_, G>) {
10391031 diag.arg("ty", self.ty);
10401032 let mut spans = MultiSpan::from(self.adt_def_span);
10411033
......@@ -1117,11 +1109,7 @@ pub(crate) struct Rust2024IncompatiblePatSugg {
11171109}
11181110
11191111impl Subdiagnostic for Rust2024IncompatiblePatSugg {
1120 fn add_to_diag_with<G: EmissionGuarantee, F: SubdiagMessageOp<G>>(
1121 self,
1122 diag: &mut Diag<'_, G>,
1123 _f: &F,
1124 ) {
1112 fn add_to_diag<G: EmissionGuarantee>(self, diag: &mut Diag<'_, G>) {
11251113 // Format and emit explanatory notes about default binding modes. Reversing the spans' order
11261114 // means if we have nested spans, the innermost ones will be visited first.
11271115 for (span, def_br_mutbl) in self.default_mode_labels.into_iter().rev() {
compiler/rustc_mir_transform/src/lint_tail_expr_drop_order.rs+5-11
......@@ -512,23 +512,17 @@ struct LocalLabel<'a> {
512512
513513/// A custom `Subdiagnostic` implementation so that the notes are delivered in a specific order
514514impl Subdiagnostic for LocalLabel<'_> {
515 fn add_to_diag_with<
516 G: rustc_errors::EmissionGuarantee,
517 F: rustc_errors::SubdiagMessageOp<G>,
518 >(
519 self,
520 diag: &mut rustc_errors::Diag<'_, G>,
521 f: &F,
522 ) {
515 fn add_to_diag<G: rustc_errors::EmissionGuarantee>(self, diag: &mut rustc_errors::Diag<'_, G>) {
523516 diag.arg("name", self.name);
524517 diag.arg("is_generated_name", self.is_generated_name);
525518 diag.arg("is_dropped_first_edition_2024", self.is_dropped_first_edition_2024);
526 let msg = f(diag, crate::fluent_generated::mir_transform_tail_expr_local.into());
519 let msg = diag.eagerly_translate(crate::fluent_generated::mir_transform_tail_expr_local);
527520 diag.span_label(self.span, msg);
528521 for dtor in self.destructors {
529 dtor.add_to_diag_with(diag, f);
522 dtor.add_to_diag(diag);
530523 }
531 let msg = f(diag, crate::fluent_generated::mir_transform_label_local_epilogue);
524 let msg =
525 diag.eagerly_translate(crate::fluent_generated::mir_transform_label_local_epilogue);
532526 diag.span_label(self.span, msg);
533527 }
534528}
compiler/rustc_parse/src/errors.rs+2-7
......@@ -7,8 +7,7 @@ use rustc_ast::util::parser::ExprPrecedence;
77use rustc_ast::{Path, Visibility};
88use rustc_errors::codes::*;
99use rustc_errors::{
10 Applicability, Diag, DiagCtxtHandle, Diagnostic, EmissionGuarantee, Level, SubdiagMessageOp,
11 Subdiagnostic,
10 Applicability, Diag, DiagCtxtHandle, Diagnostic, EmissionGuarantee, Level, Subdiagnostic,
1211};
1312use rustc_macros::{Diagnostic, Subdiagnostic};
1413use rustc_session::errors::ExprParenthesesNeeded;
......@@ -1550,11 +1549,7 @@ pub(crate) struct FnTraitMissingParen {
15501549}
15511550
15521551impl Subdiagnostic for FnTraitMissingParen {
1553 fn add_to_diag_with<G: EmissionGuarantee, F: SubdiagMessageOp<G>>(
1554 self,
1555 diag: &mut Diag<'_, G>,
1556 _: &F,
1557 ) {
1552 fn add_to_diag<G: EmissionGuarantee>(self, diag: &mut Diag<'_, G>) {
15581553 diag.span_label(self.span, crate::fluent_generated::parse_fn_trait_missing_paren);
15591554 diag.span_suggestion_short(
15601555 self.span.shrink_to_hi(),
compiler/rustc_passes/src/errors.rs+2-6
......@@ -5,7 +5,7 @@ use rustc_ast::Label;
55use rustc_errors::codes::*;
66use rustc_errors::{
77 Applicability, Diag, DiagCtxtHandle, DiagSymbolList, Diagnostic, EmissionGuarantee, Level,
8 MultiSpan, SubdiagMessageOp, Subdiagnostic,
8 MultiSpan, Subdiagnostic,
99};
1010use rustc_hir::{self as hir, ExprKind, Target};
1111use rustc_macros::{Diagnostic, LintDiagnostic, Subdiagnostic};
......@@ -1852,11 +1852,7 @@ pub(crate) struct UnusedVariableStringInterp {
18521852}
18531853
18541854impl Subdiagnostic for UnusedVariableStringInterp {
1855 fn add_to_diag_with<G: EmissionGuarantee, F: SubdiagMessageOp<G>>(
1856 self,
1857 diag: &mut Diag<'_, G>,
1858 _f: &F,
1859 ) {
1855 fn add_to_diag<G: EmissionGuarantee>(self, diag: &mut Diag<'_, G>) {
18601856 diag.span_label(self.lit, crate::fluent_generated::passes_maybe_string_interpolation);
18611857 diag.multipart_suggestion(
18621858 crate::fluent_generated::passes_string_interpolation_only_works,
compiler/rustc_passes/src/liveness.rs+4-1
......@@ -1020,7 +1020,10 @@ impl<'a, 'tcx> Liveness<'a, 'tcx> {
10201020 }
10211021
10221022 hir::ExprKind::Call(ref f, args) => {
1023 let succ = self.check_is_ty_uninhabited(expr, succ);
1023 let is_ctor = |f: &Expr<'_>| matches!(f.kind, hir::ExprKind::Path(hir::QPath::Resolved(_, path)) if matches!(path.res, rustc_hir::def::Res::Def(rustc_hir::def::DefKind::Ctor(_, _), _)));
1024 let succ =
1025 if !is_ctor(f) { self.check_is_ty_uninhabited(expr, succ) } else { succ };
1026
10241027 let succ = self.propagate_through_exprs(args, succ);
10251028 self.propagate_through_expr(f, succ)
10261029 }
compiler/rustc_pattern_analysis/src/errors.rs+3-11
......@@ -1,4 +1,4 @@
1use rustc_errors::{Diag, EmissionGuarantee, SubdiagMessageOp, Subdiagnostic};
1use rustc_errors::{Diag, EmissionGuarantee, Subdiagnostic};
22use rustc_macros::{LintDiagnostic, Subdiagnostic};
33use rustc_middle::ty::Ty;
44use rustc_span::Span;
......@@ -55,11 +55,7 @@ pub struct Overlap {
5555}
5656
5757impl Subdiagnostic for Overlap {
58 fn add_to_diag_with<G: EmissionGuarantee, F: SubdiagMessageOp<G>>(
59 self,
60 diag: &mut Diag<'_, G>,
61 _: &F,
62 ) {
58 fn add_to_diag<G: EmissionGuarantee>(self, diag: &mut Diag<'_, G>) {
6359 let Overlap { span, range } = self;
6460
6561 // FIXME(mejrs) unfortunately `#[derive(LintDiagnostic)]`
......@@ -103,11 +99,7 @@ pub struct GappedRange {
10399}
104100
105101impl Subdiagnostic for GappedRange {
106 fn add_to_diag_with<G: EmissionGuarantee, F: SubdiagMessageOp<G>>(
107 self,
108 diag: &mut Diag<'_, G>,
109 _: &F,
110 ) {
102 fn add_to_diag<G: EmissionGuarantee>(self, diag: &mut Diag<'_, G>) {
111103 let GappedRange { span, gap, first_range } = self;
112104
113105 // FIXME(mejrs) unfortunately `#[derive(LintDiagnostic)]`
compiler/rustc_trait_selection/src/errors.rs+17-61
......@@ -4,7 +4,7 @@ use rustc_data_structures::fx::{FxHashSet, FxIndexSet};
44use rustc_errors::codes::*;
55use rustc_errors::{
66 Applicability, Diag, DiagCtxtHandle, DiagMessage, DiagStyledString, Diagnostic,
7 EmissionGuarantee, IntoDiagArg, Level, MultiSpan, SubdiagMessageOp, Subdiagnostic,
7 EmissionGuarantee, IntoDiagArg, Level, MultiSpan, Subdiagnostic,
88};
99use rustc_hir::def::DefKind;
1010use rustc_hir::def_id::{DefId, LocalDefId};
......@@ -107,11 +107,7 @@ pub enum AdjustSignatureBorrow {
107107}
108108
109109impl Subdiagnostic for AdjustSignatureBorrow {
110 fn add_to_diag_with<G: EmissionGuarantee, F: SubdiagMessageOp<G>>(
111 self,
112 diag: &mut Diag<'_, G>,
113 _f: &F,
114 ) {
110 fn add_to_diag<G: EmissionGuarantee>(self, diag: &mut Diag<'_, G>) {
115111 match self {
116112 AdjustSignatureBorrow::Borrow { to_borrow } => {
117113 diag.arg("len", to_borrow.len());
......@@ -381,11 +377,7 @@ pub enum RegionOriginNote<'a> {
381377}
382378
383379impl Subdiagnostic for RegionOriginNote<'_> {
384 fn add_to_diag_with<G: EmissionGuarantee, F: SubdiagMessageOp<G>>(
385 self,
386 diag: &mut Diag<'_, G>,
387 _f: &F,
388 ) {
380 fn add_to_diag<G: EmissionGuarantee>(self, diag: &mut Diag<'_, G>) {
389381 let mut label_or_note = |span, msg: DiagMessage| {
390382 let sub_count = diag.children.iter().filter(|d| d.span.is_dummy()).count();
391383 let expanded_sub_count = diag.children.iter().filter(|d| !d.span.is_dummy()).count();
......@@ -446,11 +438,7 @@ pub enum LifetimeMismatchLabels {
446438}
447439
448440impl Subdiagnostic for LifetimeMismatchLabels {
449 fn add_to_diag_with<G: EmissionGuarantee, F: SubdiagMessageOp<G>>(
450 self,
451 diag: &mut Diag<'_, G>,
452 _f: &F,
453 ) {
441 fn add_to_diag<G: EmissionGuarantee>(self, diag: &mut Diag<'_, G>) {
454442 match self {
455443 LifetimeMismatchLabels::InRet { param_span, ret_span, span, label_var1 } => {
456444 diag.span_label(param_span, fluent::trait_selection_declared_different);
......@@ -495,11 +483,7 @@ pub struct AddLifetimeParamsSuggestion<'a> {
495483}
496484
497485impl Subdiagnostic for AddLifetimeParamsSuggestion<'_> {
498 fn add_to_diag_with<G: EmissionGuarantee, F: SubdiagMessageOp<G>>(
499 self,
500 diag: &mut Diag<'_, G>,
501 _f: &F,
502 ) {
486 fn add_to_diag<G: EmissionGuarantee>(self, diag: &mut Diag<'_, G>) {
503487 let mut mk_suggestion = || {
504488 let Some(anon_reg) = self.tcx.is_suitable_region(self.generic_param_scope, self.sub)
505489 else {
......@@ -689,11 +673,7 @@ pub struct IntroducesStaticBecauseUnmetLifetimeReq {
689673}
690674
691675impl Subdiagnostic for IntroducesStaticBecauseUnmetLifetimeReq {
692 fn add_to_diag_with<G: EmissionGuarantee, F: SubdiagMessageOp<G>>(
693 mut self,
694 diag: &mut Diag<'_, G>,
695 _f: &F,
696 ) {
676 fn add_to_diag<G: EmissionGuarantee>(mut self, diag: &mut Diag<'_, G>) {
697677 self.unmet_requirements
698678 .push_span_label(self.binding_span, fluent::trait_selection_msl_introduces_static);
699679 diag.span_note(self.unmet_requirements, fluent::trait_selection_msl_unmet_req);
......@@ -1008,17 +988,13 @@ pub struct ConsiderBorrowingParamHelp {
1008988}
1009989
1010990impl Subdiagnostic for ConsiderBorrowingParamHelp {
1011 fn add_to_diag_with<G: EmissionGuarantee, F: SubdiagMessageOp<G>>(
1012 self,
1013 diag: &mut Diag<'_, G>,
1014 f: &F,
1015 ) {
991 fn add_to_diag<G: EmissionGuarantee>(self, diag: &mut Diag<'_, G>) {
1016992 let mut type_param_span: MultiSpan = self.spans.clone().into();
1017993 for &span in &self.spans {
1018994 // Seems like we can't call f() here as Into<DiagMessage> is required
1019995 type_param_span.push_span_label(span, fluent::trait_selection_tid_consider_borrowing);
1020996 }
1021 let msg = f(diag, fluent::trait_selection_tid_param_help.into());
997 let msg = diag.eagerly_translate(fluent::trait_selection_tid_param_help);
1022998 diag.span_help(type_param_span, msg);
1023999 }
10241000}
......@@ -1053,18 +1029,14 @@ pub struct DynTraitConstraintSuggestion {
10531029}
10541030
10551031impl Subdiagnostic for DynTraitConstraintSuggestion {
1056 fn add_to_diag_with<G: EmissionGuarantee, F: SubdiagMessageOp<G>>(
1057 self,
1058 diag: &mut Diag<'_, G>,
1059 f: &F,
1060 ) {
1032 fn add_to_diag<G: EmissionGuarantee>(self, diag: &mut Diag<'_, G>) {
10611033 let mut multi_span: MultiSpan = vec![self.span].into();
10621034 multi_span.push_span_label(self.span, fluent::trait_selection_dtcs_has_lifetime_req_label);
10631035 multi_span
10641036 .push_span_label(self.ident.span, fluent::trait_selection_dtcs_introduces_requirement);
1065 let msg = f(diag, fluent::trait_selection_dtcs_has_req_note.into());
1037 let msg = diag.eagerly_translate(fluent::trait_selection_dtcs_has_req_note);
10661038 diag.span_note(multi_span, msg);
1067 let msg = f(diag, fluent::trait_selection_dtcs_suggestion.into());
1039 let msg = diag.eagerly_translate(fluent::trait_selection_dtcs_suggestion);
10681040 diag.span_suggestion_verbose(
10691041 self.span.shrink_to_hi(),
10701042 msg,
......@@ -1101,11 +1073,7 @@ pub struct ReqIntroducedLocations {
11011073}
11021074
11031075impl Subdiagnostic for ReqIntroducedLocations {
1104 fn add_to_diag_with<G: EmissionGuarantee, F: SubdiagMessageOp<G>>(
1105 mut self,
1106 diag: &mut Diag<'_, G>,
1107 f: &F,
1108 ) {
1076 fn add_to_diag<G: EmissionGuarantee>(mut self, diag: &mut Diag<'_, G>) {
11091077 for sp in self.spans {
11101078 self.span.push_span_label(sp, fluent::trait_selection_ril_introduced_here);
11111079 }
......@@ -1114,7 +1082,7 @@ impl Subdiagnostic for ReqIntroducedLocations {
11141082 self.span.push_span_label(self.fn_decl_span, fluent::trait_selection_ril_introduced_by);
11151083 }
11161084 self.span.push_span_label(self.cause_span, fluent::trait_selection_ril_because_of);
1117 let msg = f(diag, fluent::trait_selection_ril_static_introduced_by.into());
1085 let msg = diag.eagerly_translate(fluent::trait_selection_ril_static_introduced_by);
11181086 diag.span_note(self.span, msg);
11191087 }
11201088}
......@@ -1513,13 +1481,9 @@ pub struct SuggestTuplePatternMany {
15131481}
15141482
15151483impl Subdiagnostic for SuggestTuplePatternMany {
1516 fn add_to_diag_with<G: EmissionGuarantee, F: SubdiagMessageOp<G>>(
1517 self,
1518 diag: &mut Diag<'_, G>,
1519 f: &F,
1520 ) {
1484 fn add_to_diag<G: EmissionGuarantee>(self, diag: &mut Diag<'_, G>) {
15211485 diag.arg("path", self.path);
1522 let message = f(diag, crate::fluent_generated::trait_selection_stp_wrap_many.into());
1486 let message = diag.eagerly_translate(fluent::trait_selection_stp_wrap_many);
15231487 diag.multipart_suggestions(
15241488 message,
15251489 self.compatible_variants.into_iter().map(|variant| {
......@@ -1752,11 +1716,7 @@ pub struct AddPreciseCapturingAndParams {
17521716}
17531717
17541718impl Subdiagnostic for AddPreciseCapturingAndParams {
1755 fn add_to_diag_with<G: EmissionGuarantee, F: SubdiagMessageOp<G>>(
1756 self,
1757 diag: &mut Diag<'_, G>,
1758 _f: &F,
1759 ) {
1719 fn add_to_diag<G: EmissionGuarantee>(self, diag: &mut Diag<'_, G>) {
17601720 diag.arg("new_lifetime", self.new_lifetime);
17611721 diag.multipart_suggestion_verbose(
17621722 fluent::trait_selection_precise_capturing_new_but_apit,
......@@ -1896,11 +1856,7 @@ pub struct AddPreciseCapturingForOvercapture {
18961856}
18971857
18981858impl Subdiagnostic for AddPreciseCapturingForOvercapture {
1899 fn add_to_diag_with<G: EmissionGuarantee, F: SubdiagMessageOp<G>>(
1900 self,
1901 diag: &mut Diag<'_, G>,
1902 _f: &F,
1903 ) {
1859 fn add_to_diag<G: EmissionGuarantee>(self, diag: &mut Diag<'_, G>) {
19041860 let applicability = if self.apit_spans.is_empty() {
19051861 Applicability::MachineApplicable
19061862 } else {
compiler/rustc_trait_selection/src/errors/note_and_explain.rs+3-7
......@@ -1,4 +1,4 @@
1use rustc_errors::{Diag, EmissionGuarantee, IntoDiagArg, SubdiagMessageOp, Subdiagnostic};
1use rustc_errors::{Diag, EmissionGuarantee, IntoDiagArg, Subdiagnostic};
22use rustc_hir::def_id::LocalDefId;
33use rustc_middle::bug;
44use rustc_middle::ty::{self, TyCtxt};
......@@ -162,17 +162,13 @@ impl RegionExplanation<'_> {
162162}
163163
164164impl Subdiagnostic for RegionExplanation<'_> {
165 fn add_to_diag_with<G: EmissionGuarantee, F: SubdiagMessageOp<G>>(
166 self,
167 diag: &mut Diag<'_, G>,
168 f: &F,
169 ) {
165 fn add_to_diag<G: EmissionGuarantee>(self, diag: &mut Diag<'_, G>) {
170166 diag.arg("pref_kind", self.prefix);
171167 diag.arg("suff_kind", self.suffix);
172168 diag.arg("desc_kind", self.desc.kind);
173169 diag.arg("desc_arg", self.desc.arg);
174170
175 let msg = f(diag, fluent::trait_selection_region_explanation.into());
171 let msg = diag.eagerly_translate(fluent::trait_selection_region_explanation);
176172 if let Some(span) = self.desc.span {
177173 diag.span_note(span, msg);
178174 } else {
compiler/rustc_transmute/src/maybe_transmutable/tests.rs+74-66
......@@ -1,93 +1,115 @@
11use itertools::Itertools;
22
33use super::query_context::test::{Def, UltraMinimal};
4use crate::maybe_transmutable::MaybeTransmutableQuery;
5use crate::{Reason, layout};
4use crate::{Answer, Assume, Reason, layout};
65
7mod safety {
8 use super::*;
9 use crate::Answer;
6type Tree = layout::Tree<Def, !>;
7type Dfa = layout::Dfa<!>;
108
11 type Tree = layout::Tree<Def, !>;
9trait Representation {
10 fn is_transmutable(src: Self, dst: Self, assume: Assume) -> Answer<!>;
11}
1212
13 const DST_HAS_SAFETY_INVARIANTS: Answer<!> =
14 Answer::No(crate::Reason::DstMayHaveSafetyInvariants);
13impl Representation for Tree {
14 fn is_transmutable(src: Self, dst: Self, assume: Assume) -> Answer<!> {
15 crate::maybe_transmutable::MaybeTransmutableQuery::new(src, dst, assume, UltraMinimal)
16 .answer()
17 }
18}
1519
16 fn is_transmutable(src: &Tree, dst: &Tree, assume_safety: bool) -> crate::Answer<!> {
17 let src = src.clone();
18 let dst = dst.clone();
19 // The only dimension of the transmutability analysis we want to test
20 // here is the safety analysis. To ensure this, we disable all other
21 // toggleable aspects of the transmutability analysis.
22 let assume = crate::Assume {
23 alignment: true,
24 lifetimes: true,
25 validity: true,
26 safety: assume_safety,
27 };
20impl Representation for Dfa {
21 fn is_transmutable(src: Self, dst: Self, assume: Assume) -> Answer<!> {
2822 crate::maybe_transmutable::MaybeTransmutableQuery::new(src, dst, assume, UltraMinimal)
2923 .answer()
3024 }
25}
26
27fn is_transmutable<R: Representation + Clone>(
28 src: &R,
29 dst: &R,
30 assume: Assume,
31) -> crate::Answer<!> {
32 let src = src.clone();
33 let dst = dst.clone();
34 // The only dimension of the transmutability analysis we want to test
35 // here is the safety analysis. To ensure this, we disable all other
36 // toggleable aspects of the transmutability analysis.
37 R::is_transmutable(src, dst, assume)
38}
39
40mod safety {
41 use super::*;
42 use crate::Answer;
43
44 const DST_HAS_SAFETY_INVARIANTS: Answer<!> =
45 Answer::No(crate::Reason::DstMayHaveSafetyInvariants);
3146
3247 #[test]
3348 fn src_safe_dst_safe() {
3449 let src = Tree::Def(Def::NoSafetyInvariants).then(Tree::u8());
3550 let dst = Tree::Def(Def::NoSafetyInvariants).then(Tree::u8());
36 assert_eq!(is_transmutable(&src, &dst, false), Answer::Yes);
37 assert_eq!(is_transmutable(&src, &dst, true), Answer::Yes);
51 assert_eq!(is_transmutable(&src, &dst, Assume::default()), Answer::Yes);
52 assert_eq!(
53 is_transmutable(&src, &dst, Assume { safety: true, ..Assume::default() }),
54 Answer::Yes
55 );
3856 }
3957
4058 #[test]
4159 fn src_safe_dst_unsafe() {
4260 let src = Tree::Def(Def::NoSafetyInvariants).then(Tree::u8());
4361 let dst = Tree::Def(Def::HasSafetyInvariants).then(Tree::u8());
44 assert_eq!(is_transmutable(&src, &dst, false), DST_HAS_SAFETY_INVARIANTS);
45 assert_eq!(is_transmutable(&src, &dst, true), Answer::Yes);
62 assert_eq!(is_transmutable(&src, &dst, Assume::default()), DST_HAS_SAFETY_INVARIANTS);
63 assert_eq!(
64 is_transmutable(&src, &dst, Assume { safety: true, ..Assume::default() }),
65 Answer::Yes
66 );
4667 }
4768
4869 #[test]
4970 fn src_unsafe_dst_safe() {
5071 let src = Tree::Def(Def::HasSafetyInvariants).then(Tree::u8());
5172 let dst = Tree::Def(Def::NoSafetyInvariants).then(Tree::u8());
52 assert_eq!(is_transmutable(&src, &dst, false), Answer::Yes);
53 assert_eq!(is_transmutable(&src, &dst, true), Answer::Yes);
73 assert_eq!(is_transmutable(&src, &dst, Assume::default()), Answer::Yes);
74 assert_eq!(
75 is_transmutable(&src, &dst, Assume { safety: true, ..Assume::default() }),
76 Answer::Yes
77 );
5478 }
5579
5680 #[test]
5781 fn src_unsafe_dst_unsafe() {
5882 let src = Tree::Def(Def::HasSafetyInvariants).then(Tree::u8());
5983 let dst = Tree::Def(Def::HasSafetyInvariants).then(Tree::u8());
60 assert_eq!(is_transmutable(&src, &dst, false), DST_HAS_SAFETY_INVARIANTS);
61 assert_eq!(is_transmutable(&src, &dst, true), Answer::Yes);
84 assert_eq!(is_transmutable(&src, &dst, Assume::default()), DST_HAS_SAFETY_INVARIANTS);
85 assert_eq!(
86 is_transmutable(&src, &dst, Assume { safety: true, ..Assume::default() }),
87 Answer::Yes
88 );
6289 }
6390}
6491
6592mod bool {
6693 use super::*;
67 use crate::Answer;
6894
6995 #[test]
7096 fn should_permit_identity_transmutation_tree() {
71 let answer = crate::maybe_transmutable::MaybeTransmutableQuery::new(
72 layout::Tree::<Def, !>::bool(),
73 layout::Tree::<Def, !>::bool(),
74 crate::Assume { alignment: false, lifetimes: false, validity: true, safety: false },
75 UltraMinimal,
76 )
77 .answer();
78 assert_eq!(answer, Answer::Yes);
97 let src = Tree::bool();
98 assert_eq!(is_transmutable(&src, &src, Assume::default()), Answer::Yes);
99 assert_eq!(
100 is_transmutable(&src, &src, Assume { validity: true, ..Assume::default() }),
101 Answer::Yes
102 );
79103 }
80104
81105 #[test]
82106 fn should_permit_identity_transmutation_dfa() {
83 let answer = crate::maybe_transmutable::MaybeTransmutableQuery::new(
84 layout::Dfa::<!>::bool(),
85 layout::Dfa::<!>::bool(),
86 crate::Assume { alignment: false, lifetimes: false, validity: true, safety: false },
87 UltraMinimal,
88 )
89 .answer();
90 assert_eq!(answer, Answer::Yes);
107 let src = Dfa::bool();
108 assert_eq!(is_transmutable(&src, &src, Assume::default()), Answer::Yes);
109 assert_eq!(
110 is_transmutable(&src, &src, Assume { validity: true, ..Assume::default() }),
111 Answer::Yes
112 );
91113 }
92114
93115 #[test]
......@@ -122,13 +144,7 @@ mod bool {
122144 if src_set.is_subset(&dst_set) {
123145 assert_eq!(
124146 Answer::Yes,
125 MaybeTransmutableQuery::new(
126 src_layout.clone(),
127 dst_layout.clone(),
128 crate::Assume { validity: false, ..crate::Assume::default() },
129 UltraMinimal,
130 )
131 .answer(),
147 is_transmutable(&src_layout, &dst_layout, Assume::default()),
132148 "{:?} SHOULD be transmutable into {:?}",
133149 src_layout,
134150 dst_layout
......@@ -136,13 +152,11 @@ mod bool {
136152 } else if !src_set.is_disjoint(&dst_set) {
137153 assert_eq!(
138154 Answer::Yes,
139 MaybeTransmutableQuery::new(
140 src_layout.clone(),
141 dst_layout.clone(),
142 crate::Assume { validity: true, ..crate::Assume::default() },
143 UltraMinimal,
144 )
145 .answer(),
155 is_transmutable(
156 &src_layout,
157 &dst_layout,
158 Assume { validity: true, ..Assume::default() }
159 ),
146160 "{:?} SHOULD be transmutable (assuming validity) into {:?}",
147161 src_layout,
148162 dst_layout
......@@ -150,13 +164,7 @@ mod bool {
150164 } else {
151165 assert_eq!(
152166 Answer::No(Reason::DstIsBitIncompatible),
153 MaybeTransmutableQuery::new(
154 src_layout.clone(),
155 dst_layout.clone(),
156 crate::Assume { validity: false, ..crate::Assume::default() },
157 UltraMinimal,
158 )
159 .answer(),
167 is_transmutable(&src_layout, &dst_layout, Assume::default()),
160168 "{:?} should NOT be transmutable into {:?}",
161169 src_layout,
162170 dst_layout
diff
src/doc/unstable-book/src/compiler-flags/allow-features.md created+14
......@@ -0,0 +1,14 @@
1# `allow-features`
2
3This feature is perma-unstable and has no tracking issue.
4
5----
6
7This flag allows limiting the features which can be enabled with `#![feature(...)]` attributes.
8By default, all features are allowed on nightly and no features are allowed on stable or beta (but see [`RUSTC_BOOTSTRAP`]).
9
10Features are comma-separated, for example `-Z allow-features=ffi_pure,f16`.
11If the flag is present, any feature listed will be allowed and any feature not listed will be disallowed.
12Any unrecognized feature is ignored.
13
14[`RUSTC_BOOTSTRAP`]: ./rustc-bootstrap.html
src/doc/unstable-book/src/compiler-flags/rustc-bootstrap.md created+56
......@@ -0,0 +1,56 @@
1# `RUSTC_BOOTSTRAP`
2
3This feature is perma-unstable and has no tracking issue.
4
5----
6
7The `RUSTC_BOOTSTRAP` environment variable tells rustc to act as if it is a nightly compiler;
8in particular, it allows `#![feature(...)]` attributes and `-Z` flags even on the stable release channel.
9
10Setting `RUSTC_BOOTSTRAP=1` instructs rustc to enable this for all crates.
11Setting `RUSTC_BOOTSTRAP=crate_name` instructs rustc to only apply this to crates named `crate_name`.
12Setting `RUSTC_BOOTSTRAP=-1` instructs rustc to act as if it is a stable compiler, even on the nightly release channel.
13Cargo disallows setting `cargo::rustc-env=RUSTC_BOOTSTRAP` in build scripts.
14Build systems can limit the features they enable with [`-Z allow-features=feature1,feature2`][Z-allow-features].
15Crates can fully opt out of unstable features by using [`#![forbid(unstable_features)]`][unstable-features] at the crate root (or any other way of enabling lints, such as `-F unstable-features`).
16
17[Z-allow-features]: ./allow-features.html
18[unstable-features]: ../../rustc/lints/listing/allowed-by-default.html#unstable-features
19
20## Why does this environment variable exist?
21
22`RUSTC_BOOTSTRAP`, as the name suggests, is used for bootstrapping the compiler from an earlier version.
23In particular, nightly is built with beta, and beta is built with stable.
24Since the standard library and compiler both use unstable features, `RUSTC_BOOTSTRAP` is required so that we can use the previous version to build them.
25
26## Why is this environment variable so easy to use for people not in the rust project?
27
28Originally, `RUSTC_BOOTSTRAP` required passing in a hash of the previous compiler version, to discourage using it for any purpose other than bootstrapping.
29That constraint was later relaxed; see <https://github.com/rust-lang/rust/issues/36548> for the discussion that happened at that time.
30
31People have at various times proposed re-adding the technical constraints.
32However, doing so is extremely disruptive for several major projects that we very much want to keep using the latest stable toolchain version, such as Firefox, Rust for Linux, and Chromium.
33We continue to allow `RUSTC_BOOTSTRAP` until we can come up with an alternative that does not disrupt our largest constituents.
34
35## Stability policy
36
37Despite being usable on stable, this is an unstable feature.
38Like any other unstable feature, we reserve the right to change or remove this feature in the future, as well as any other unstable feature that it enables.
39Using this feature opts you out of the normal stability/backwards compatibility guarantee of stable.
40
41Although we do not take technical measures to prevent it from being used, we strongly discourage using this feature.
42If at all possible, please contribute to stabilizing the features you care about instead of bypassing the Rust project's stability policy.
43
44For library crates, we especially discourage the use of this feature.
45The crates depending on you do not know that you use this feature, have little recourse if it breaks, and can be used in contexts that are hard to predict.
46
47For libraries that do use this feature, please document the versions you support (including a *maximum* as well as minimum version), and a mechanism to disable it.
48If you do not have a mechanism to disable the use of `RUSTC_BOOTSTRAP`, consider removing its use altogether, such that people can only use your library if they are already using a nightly toolchain.
49This leaves the choice of whether to opt-out of Rust's stability guarantees up to the end user building their code.
50
51## History
52
53- [Allowed without a hash](https://github.com/rust-lang/rust/pull/37265) ([discussion](https://github.com/rust-lang/rust/issues/36548))
54- [Extended to crate names](https://github.com/rust-lang/rust/pull/77802) ([discussion](https://github.com/rust-lang/cargo/issues/7088))
55- [Disallowed for build scripts](https://github.com/rust-lang/cargo/pull/9181) ([discussion](https://github.com/rust-lang/compiler-team/issues/350))
56- [Extended to emulate stable](https://github.com/rust-lang/rust/pull/132993) ([discussion](https://github.com/rust-lang/rust/issues/123404))
src/doc/unstable-book/src/compiler-flags/rustc-override-version-string.md created+39
......@@ -0,0 +1,39 @@
1# `RUSTC_OVERRIDE_VERSION_STRING`
2
3This feature is perma-unstable and has no tracking issue.
4
5----
6
7The `RUSTC_OVERRIDE_VERSION_STRING` environment variable overrides the version reported by `rustc --version`. For example:
8
9```console
10$ rustc --version
11rustc 1.87.0-nightly (43f0014ef 2025-03-25)
12$ env RUSTC_OVERRIDE_VERSION_STRING=1.81.0-nightly rustc --version
13rustc 1.81.0-nightly
14```
15
16Note that the version string is completely overwritten; i.e. rustc discards commit hash and commit date information unless it is explicitly included in the environment variable. The string only applies to the "release" part of the version; for example:
17```console
18$ RUSTC_OVERRIDE_VERSION_STRING="1.81.0-nightly (aaaaaaaaa 2025-03-22)" rustc -vV
19rustc 1.81.0-nightly (aaaaaaaaa 2025-03-22)
20binary: rustc
21commit-hash: 43f0014ef0f242418674f49052ed39b70f73bc1c
22commit-date: 2025-03-25
23host: x86_64-unknown-linux-gnu
24release: 1.81.0-nightly (aaaaaaaaa 2025-03-22)
25LLVM version: 20.1.1
26```
27
28Note here that `commit-hash` and `commit-date` do not match the values in the string, and `release` includes the fake hash and date.
29
30This variable has no effect on whether or not unstable features are allowed to be used. It only affects the output of `--version`.
31
32## Why does this environment variable exist?
33
34Various library crates have incomplete or incorrect feature detection.
35This environment variable allows bisecting crates that do incorrect detection with `version_check::supports_feature`.
36
37This is not intended to be used for any other case (and, except for bisection, is not particularly useful).
38
39See <https://github.com/rust-lang/rust/pull/124339> for further discussion.
src/doc/unstable-book/src/language-features/cfg-boolean-literals.md deleted-22
......@@ -1,22 +0,0 @@
1# `cfg_boolean_literals`
2
3The tracking issue for this feature is: [#131204]
4
5[#131204]: https://github.com/rust-lang/rust/issues/131204
6
7------------------------
8
9The `cfg_boolean_literals` feature makes it possible to use the `true`/`false`
10literal as cfg predicate. They always evaluate to true/false respectively.
11
12## Examples
13
14```rust
15#![feature(cfg_boolean_literals)]
16
17#[cfg(true)]
18const A: i32 = 5;
19
20#[cfg(all(false))]
21const A: i32 = 58 * 89;
22```
src/doc/unstable-book/src/language-features/macro-metavar-expr-concat.md created+133
......@@ -0,0 +1,133 @@
1# `macro_metavar_expr_concat`
2
3The tracking issue for this feature is: [#124225]
4
5------------------------
6
7In stable Rust, there is no way to create new identifiers by joining identifiers to literals or other identifiers without using procedural macros such as [`paste`].
8 `#![feature(macro_metavar_expr_concat)]` introduces a way to do this, using the concat metavariable expression.
9
10> This feature uses the syntax from [`macro_metavar_expr`] but is otherwise
11> independent. It replaces the old unstable feature [`concat_idents`].
12
13> This is an experimental feature; it and its syntax will require a RFC before stabilization.
14
15
16### Overview
17
18`#![feature(macro_metavar_expr_concat)]` provides the `concat` metavariable expression for creating new identifiers:
19
20```rust
21#![feature(macro_metavar_expr_concat)]
22
23macro_rules! create_some_structs {
24 ($name:ident) => {
25 pub struct ${ concat(First, $name) };
26 pub struct ${ concat(Second, $name) };
27 pub struct ${ concat(Third, $name) };
28 }
29}
30
31create_some_structs!(Thing);
32```
33
34This macro invocation expands to:
35
36```rust
37pub struct FirstThing;
38pub struct SecondThing;
39pub struct ThirdThing;
40```
41
42### Syntax
43
44This feature builds upon the metavariable expression syntax `${ .. }` as specified in [RFC 3086] ([`macro_metavar_expr`]).
45 `concat` is available like `${ concat(items) }`, where `items` is a comma separated sequence of idents and/or literals.
46
47### Examples
48
49#### Create a function or method with a concatenated name
50
51```rust
52#![feature(macro_metavar_expr_concat)]
53
54macro_rules! make_getter {
55 ($name:ident, $field: ident, $ret:ty) => {
56 impl $name {
57 pub fn ${ concat(get_, $field) }(&self) -> &$ret {
58 &self.$field
59 }
60 }
61 }
62}
63
64pub struct Thing {
65 description: String,
66}
67
68make_getter!(Thing, description, String);
69```
70
71This expands to:
72
73```rust
74pub struct Thing {
75 description: String,
76}
77
78impl Thing {
79 pub fn get_description(&self) -> &String {
80 &self.description
81 }
82}
83```
84
85#### Create names for macro generated tests
86
87```rust
88#![feature(macro_metavar_expr_concat)]
89
90macro_rules! test_math {
91 ($integer:ident) => {
92 #[test]
93 fn ${ concat(test_, $integer, _, addition) } () {
94 let a: $integer = 73;
95 let b: $integer = 42;
96 assert_eq!(a + b, 115)
97 }
98
99 #[test]
100 fn ${ concat(test_, $integer, _, subtraction) } () {
101 let a: $integer = 73;
102 let b: $integer = 42;
103 assert_eq!(a - b, 31)
104 }
105 }
106}
107
108test_math!(i32);
109test_math!(u64);
110test_math!(u128);
111```
112
113Running this returns the following output:
114
115```text
116running 6 tests
117test test_i32_subtraction ... ok
118test test_i32_addition ... ok
119test test_u128_addition ... ok
120test test_u128_subtraction ... ok
121test test_u64_addition ... ok
122test test_u64_subtraction ... ok
123
124test result: ok. 6 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s
125```
126
127[`paste`]: https://crates.io/crates/paste
128[RFC 3086]: https://rust-lang.github.io/rfcs/3086-macro-metavar-expr.html
129[`concat_idents!`]: https://doc.rust-lang.org/nightly/std/macro.concat_idents.html
130[`macro_metavar_expr`]: ../language-features/macro-metavar-expr.md
131[`concat_idents`]: ../library-features/concat-idents.md
132[#124225]: https://github.com/rust-lang/rust/issues/124225
133[declarative macros]: https://doc.rust-lang.org/stable/reference/macros-by-example.html
src/doc/unstable-book/src/language-features/macro-metavar-expr.md created+10
......@@ -0,0 +1,10 @@
1# `macro_metavar_expr`
2
3The tracking issue for this feature is: [#83527]
4
5------------------------
6
7> This feature is not to be confused with [`macro_metavar_expr_concat`].
8
9[`macro_metavar_expr_concat`]: ./macro-metavar-expr-concat.md
10[#83527]: https://github.com/rust-lang/rust/issues/83527
src/doc/unstable-book/src/library-features/concat-idents.md+2
......@@ -6,6 +6,8 @@ The tracking issue for this feature is: [#29599]
66
77------------------------
88
9> This feature is expected to be superseded by [`macro_metavar_expr_concat`](../language-features/macro-metavar-expr-concat.md).
10
911The `concat_idents` feature adds a macro for concatenating multiple identifiers
1012into one identifier.
1113
src/tools/rust-analyzer/crates/ide-db/src/generated/lints.rs-29
......@@ -3789,35 +3789,6 @@ The tracking issue for this feature is: [#64797]
37893789[#64797]: https://github.com/rust-lang/rust/issues/64797
37903790
37913791------------------------
3792"##,
3793 default_severity: Severity::Allow,
3794 warn_since: None,
3795 deny_since: None,
3796 },
3797 Lint {
3798 label: "cfg_boolean_literals",
3799 description: r##"# `cfg_boolean_literals`
3800
3801The tracking issue for this feature is: [#131204]
3802
3803[#131204]: https://github.com/rust-lang/rust/issues/131204
3804
3805------------------------
3806
3807The `cfg_boolean_literals` feature makes it possible to use the `true`/`false`
3808literal as cfg predicate. They always evaluate to true/false respectively.
3809
3810## Examples
3811
3812```rust
3813#![feature(cfg_boolean_literals)]
3814
3815#[cfg(true)]
3816const A: i32 = 5;
3817
3818#[cfg(all(false))]
3819const A: i32 = 58 * 89;
3820```
38213792"##,
38223793 default_severity: Severity::Allow,
38233794 warn_since: None,
tests/pretty/ast-stmt-expr-attr.rs+1-1
......@@ -2,7 +2,7 @@
22
33fn main() {}
44
5#[cfg(FALSE)]
5#[cfg(false)]
66fn syntax() {
77 let _ = #[attr] [];
88 let _ = #[attr] [0];
tests/pretty/enum-variant-vis.rs+1-1
......@@ -4,5 +4,5 @@
44
55fn main() {}
66
7#[cfg(FALSE)]
7#[cfg(false)]
88enum Foo { pub V, }
tests/pretty/if-attr.rs+4-4
......@@ -1,6 +1,6 @@
11//@ pp-exact
22
3#[cfg(FALSE)]
3#[cfg(false)]
44fn simple_attr() {
55
66 #[attr]
......@@ -10,21 +10,21 @@ fn simple_attr() {
1010 if true {}
1111}
1212
13#[cfg(FALSE)]
13#[cfg(false)]
1414fn if_else_chain() {
1515
1616 #[first_attr]
1717 if true {} else if false {} else {}
1818}
1919
20#[cfg(FALSE)]
20#[cfg(false)]
2121fn if_let() {
2222
2323 #[attr]
2424 if let Some(_) = Some(true) {}
2525}
2626
27#[cfg(FALSE)]
27#[cfg(false)]
2828fn let_attr_if() {
2929 let _ = #[attr] if let _ = 0 {};
3030 let _ = #[attr] if true {};
tests/pretty/nested-item-vis-defaultness.rs+3-3
......@@ -4,7 +4,7 @@
44
55fn main() {}
66
7#[cfg(FALSE)]
7#[cfg(false)]
88extern "C" {
99 static X: u8;
1010 type X;
......@@ -14,7 +14,7 @@ extern "C" {
1414 pub fn foo();
1515}
1616
17#[cfg(FALSE)]
17#[cfg(false)]
1818trait T {
1919 const X: u8;
2020 type X;
......@@ -30,7 +30,7 @@ trait T {
3030 pub default fn foo();
3131}
3232
33#[cfg(FALSE)]
33#[cfg(false)]
3434impl T for S {
3535 const X: u8;
3636 type X;
tests/rustdoc-ui/cfg-boolean-literal.rs-1
......@@ -1,6 +1,5 @@
11//@ check-pass
22
3#![feature(cfg_boolean_literals)]
43#![feature(doc_cfg)]
54
65#[doc(cfg(false))]
tests/rustdoc-ui/doc-cfg-unstable.rs-4
......@@ -1,10 +1,6 @@
11// #138113: rustdoc didn't gate unstable predicates inside `doc(cfg(..))`
22#![feature(doc_cfg)]
33
4// `cfg_boolean_literals`
5#[doc(cfg(false))] //~ ERROR `cfg(false)` is experimental and subject to change
6pub fn cfg_boolean_literals() {}
7
84// `cfg_version`
95#[doc(cfg(sanitize = "thread"))] //~ ERROR `cfg(sanitize)` is experimental and subject to change
106pub fn cfg_sanitize() {}
tests/rustdoc-ui/doc-cfg-unstable.stderr+2-12
......@@ -1,15 +1,5 @@
1error[E0658]: `cfg(false)` is experimental and subject to change
2 --> $DIR/doc-cfg-unstable.rs:5:11
3 |
4LL | #[doc(cfg(false))]
5 | ^^^^^
6 |
7 = note: see issue #131204 <https://github.com/rust-lang/rust/issues/131204> for more information
8 = help: add `#![feature(cfg_boolean_literals)]` to the crate attributes to enable
9 = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
10
111error[E0658]: `cfg(sanitize)` is experimental and subject to change
12 --> $DIR/doc-cfg-unstable.rs:9:11
2 --> $DIR/doc-cfg-unstable.rs:5:11
133 |
144LL | #[doc(cfg(sanitize = "thread"))]
155 | ^^^^^^^^^^^^^^^^^^^
......@@ -18,6 +8,6 @@ LL | #[doc(cfg(sanitize = "thread"))]
188 = help: add `#![feature(cfg_sanitize)]` to the crate attributes to enable
199 = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
2010
21error: aborting due to 2 previous errors
11error: aborting due to 1 previous error
2212
2313For more information about this error, try `rustc --explain E0658`.
tests/ui-fulldeps/internal-lints/diagnostics.rs+3-5
......@@ -15,7 +15,7 @@ extern crate rustc_span;
1515
1616use rustc_errors::{
1717 Diag, DiagCtxtHandle, DiagInner, DiagMessage, Diagnostic, EmissionGuarantee, Level,
18 LintDiagnostic, SubdiagMessage, SubdiagMessageOp, Subdiagnostic,
18 LintDiagnostic, SubdiagMessage, Subdiagnostic,
1919};
2020use rustc_macros::{Diagnostic, Subdiagnostic};
2121use rustc_span::Span;
......@@ -56,10 +56,9 @@ impl<'a, G: EmissionGuarantee> Diagnostic<'a, G> for TranslatableInDiagnostic {
5656pub struct UntranslatableInAddtoDiag;
5757
5858impl Subdiagnostic for UntranslatableInAddtoDiag {
59 fn add_to_diag_with<G: EmissionGuarantee, F: SubdiagMessageOp<G>>(
59 fn add_to_diag<G: EmissionGuarantee>(
6060 self,
6161 diag: &mut Diag<'_, G>,
62 f: &F,
6362 ) {
6463 diag.note("untranslatable diagnostic");
6564 //~^ ERROR diagnostics should be created using translatable messages
......@@ -69,10 +68,9 @@ impl Subdiagnostic for UntranslatableInAddtoDiag {
6968pub struct TranslatableInAddtoDiag;
7069
7170impl Subdiagnostic for TranslatableInAddtoDiag {
72 fn add_to_diag_with<G: EmissionGuarantee, F: SubdiagMessageOp<G>>(
71 fn add_to_diag<G: EmissionGuarantee>(
7372 self,
7473 diag: &mut Diag<'_, G>,
75 f: &F,
7674 ) {
7775 diag.note(crate::fluent_generated::no_crate_note);
7876 }
tests/ui-fulldeps/internal-lints/diagnostics.stderr+9-9
......@@ -11,19 +11,19 @@ LL | #![deny(rustc::untranslatable_diagnostic)]
1111 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
1212
1313error: diagnostics should be created using translatable messages
14 --> $DIR/diagnostics.rs:64:19
14 --> $DIR/diagnostics.rs:63:19
1515 |
1616LL | diag.note("untranslatable diagnostic");
1717 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^
1818
1919error: diagnostics should be created using translatable messages
20 --> $DIR/diagnostics.rs:85:19
20 --> $DIR/diagnostics.rs:83:19
2121 |
2222LL | diag.note("untranslatable diagnostic");
2323 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^
2424
2525error: diagnostics should only be created in `Diagnostic`/`Subdiagnostic`/`LintDiagnostic` impls
26 --> $DIR/diagnostics.rs:99:21
26 --> $DIR/diagnostics.rs:97:21
2727 |
2828LL | let _diag = dcx.struct_err(crate::fluent_generated::no_crate_example);
2929 | ^^^^^^^^^^
......@@ -35,37 +35,37 @@ LL | #![deny(rustc::diagnostic_outside_of_impl)]
3535 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
3636
3737error: diagnostics should only be created in `Diagnostic`/`Subdiagnostic`/`LintDiagnostic` impls
38 --> $DIR/diagnostics.rs:102:21
38 --> $DIR/diagnostics.rs:100:21
3939 |
4040LL | let _diag = dcx.struct_err("untranslatable diagnostic");
4141 | ^^^^^^^^^^
4242
4343error: diagnostics should be created using translatable messages
44 --> $DIR/diagnostics.rs:102:32
44 --> $DIR/diagnostics.rs:100:32
4545 |
4646LL | let _diag = dcx.struct_err("untranslatable diagnostic");
4747 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^
4848
4949error: diagnostics should be created using translatable messages
50 --> $DIR/diagnostics.rs:120:7
50 --> $DIR/diagnostics.rs:118:7
5151 |
5252LL | f("untranslatable diagnostic", crate::fluent_generated::no_crate_example);
5353 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^
5454
5555error: diagnostics should be created using translatable messages
56 --> $DIR/diagnostics.rs:122:50
56 --> $DIR/diagnostics.rs:120:50
5757 |
5858LL | f(crate::fluent_generated::no_crate_example, "untranslatable diagnostic");
5959 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^
6060
6161error: diagnostics should be created using translatable messages
62 --> $DIR/diagnostics.rs:124:7
62 --> $DIR/diagnostics.rs:122:7
6363 |
6464LL | f("untranslatable diagnostic", "untranslatable diagnostic");
6565 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^
6666
6767error: diagnostics should be created using translatable messages
68 --> $DIR/diagnostics.rs:124:36
68 --> $DIR/diagnostics.rs:122:36
6969 |
7070LL | f("untranslatable diagnostic", "untranslatable diagnostic");
7171 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^
tests/ui/asm/unpretty-expanded.rs+1
......@@ -1,4 +1,5 @@
11//@ needs-asm-support
22//@ check-pass
33//@ compile-flags: -Zunpretty=expanded
4//@ edition: 2015
45core::arch::global_asm!("x: .byte 42");
tests/ui/asm/unpretty-expanded.stdout+1
......@@ -7,4 +7,5 @@ extern crate std;
77//@ needs-asm-support
88//@ check-pass
99//@ compile-flags: -Zunpretty=expanded
10//@ edition: 2015
1011global_asm! ("x: .byte 42");
tests/ui/associated-types/associated-type-macro.rs+1-1
......@@ -1,4 +1,4 @@
11fn main() {
2 #[cfg(FALSE)]
2 #[cfg(false)]
33 <() as module>::mac!(); //~ ERROR macros cannot use qualified paths
44}
tests/ui/async-await/feature-async-for-loop.rs+1-1
......@@ -11,7 +11,7 @@ fn f() {
1111 };
1212}
1313
14#[cfg(FALSE)]
14#[cfg(false)]
1515fn g() {
1616 let _ = async {
1717 for await _i in core::async_iter::from_iter(0..3) {
tests/ui/async-await/no-unsafe-async.rs+2-2
......@@ -3,11 +3,11 @@
33struct S;
44
55impl S {
6 #[cfg(FALSE)]
6 #[cfg(false)]
77 unsafe async fn g() {} //~ ERROR expected one of `extern` or `fn`, found keyword `async`
88}
99
10#[cfg(FALSE)]
10#[cfg(false)]
1111unsafe async fn f() {} //~ ERROR expected one of `extern` or `fn`, found keyword `async`
1212
1313fn main() {}
tests/ui/attributes/z-crate-attr/cfg-false.rs+2-2
......@@ -1,5 +1,5 @@
1// Ensure that `-Z crate-attr=cfg(FALSE)` can comment out the whole crate
2//@ compile-flags: --crate-type=lib -Zcrate-attr=cfg(FALSE)
1// Ensure that `-Z crate-attr=cfg(false)` can comment out the whole crate
2//@ compile-flags: --crate-type=lib -Zcrate-attr=cfg(false)
33//@ check-pass
44
55// NOTE: duplicate items are load-bearing
tests/ui/auto-traits/pre-cfg.rs+1-1
......@@ -1,6 +1,6 @@
11//@ check-pass
22
3#[cfg(FALSE)]
3#[cfg(false)]
44auto trait Foo {}
55//~^ WARN `auto` traits are unstable
66//~| WARN unstable syntax can change at any point in the future, causing a hard error!
tests/ui/cfg/auxiliary/cfg_false_lib.rs+2-2
......@@ -1,4 +1,4 @@
1// `#![no_std]` on a fully unconfigured crate is respected if it's placed before `cfg(FALSE)`.
1// `#![no_std]` on a fully unconfigured crate is respected if it's placed before `cfg(false)`.
22// This crate has no such attribute, therefore this crate does link to libstd.
33
4#![cfg(FALSE)]
4#![cfg(false)]
tests/ui/cfg/auxiliary/cfg_false_lib_no_std_after.rs+2-2
......@@ -1,5 +1,5 @@
1// `#![no_std]` on a fully unconfigured crate is respected if it's placed before `cfg(FALSE)`.
1// `#![no_std]` on a fully unconfigured crate is respected if it's placed before `cfg(false)`.
22// Therefore this crate does link to libstd.
33
4#![cfg(FALSE)]
4#![cfg(false)]
55#![no_std]
tests/ui/cfg/auxiliary/cfg_false_lib_no_std_before.rs+2-2
......@@ -1,8 +1,8 @@
1// `#![no_std]` on a fully unconfigured crate is respected if it's placed before `cfg(FALSE)`.
1// `#![no_std]` on a fully unconfigured crate is respected if it's placed before `cfg(false)`.
22// Therefore this crate doesn't link to libstd.
33
44//@ no-prefer-dynamic
55
66#![no_std]
77#![crate_type = "lib"]
8#![cfg(FALSE)]
8#![cfg(false)]
tests/ui/cfg/auxiliary/cfged_out.rs+2-2
......@@ -1,8 +1,8 @@
11pub mod inner {
2 #[cfg(FALSE)]
2 #[cfg(false)]
33 pub fn uwu() {}
44
5 #[cfg(FALSE)]
5 #[cfg(false)]
66 pub mod doesnt_exist {
77 pub fn hello() {}
88 }
tests/ui/cfg/both-true-false.rs created+14
......@@ -0,0 +1,14 @@
1/// Test that placing a `cfg(true)` and `cfg(false)` on the same item result in
2//. it being disabled.`
3
4#[cfg(false)]
5#[cfg(true)]
6fn foo() {}
7
8#[cfg(true)]
9#[cfg(false)]
10fn foo() {}
11
12fn main() {
13 foo(); //~ ERROR cannot find function `foo` in this scope
14}
tests/ui/cfg/both-true-false.stderr created+9
......@@ -0,0 +1,9 @@
1error[E0425]: cannot find function `foo` in this scope
2 --> $DIR/both-true-false.rs:13:5
3 |
4LL | foo();
5 | ^^^ not found in this scope
6
7error: aborting due to 1 previous error
8
9For more information about this error, try `rustc --explain E0425`.
tests/ui/cfg/cfg-false-feature.rs+2-2
......@@ -1,10 +1,10 @@
1// Features above `cfg(FALSE)` are in effect in a fully unconfigured crate (issue #104633).
1// Features above `cfg(false)` are in effect in a fully unconfigured crate (issue #104633).
22
33//@ check-pass
44//@ compile-flags: --crate-type lib
55
66#![feature(decl_macro)]
7#![cfg(FALSE)]
7#![cfg(false)]
88#![feature(box_patterns)]
99
1010macro mac() {} // OK
tests/ui/cfg/cfg-macros-notfoo.rs+1-1
......@@ -3,7 +3,7 @@
33// check that cfg correctly chooses between the macro impls (see also
44// cfg-macros-foo.rs)
55
6#[cfg(FALSE)]
6#[cfg(false)]
77#[macro_use]
88mod foo {
99 macro_rules! bar {
tests/ui/cfg/cfg-match-arm.rs+1-1
......@@ -11,7 +11,7 @@ fn foo(f: Foo) {
1111 Foo::Bar => {},
1212 #[cfg(not(FALSE))]
1313 Foo::Baz => {},
14 #[cfg(FALSE)]
14 #[cfg(false)]
1515 Basdfwe => {}
1616 }
1717}
tests/ui/cfg/cfg-stmt-recovery.rs+1-1
......@@ -6,7 +6,7 @@
66#[cfg_eval]
77fn main() {
88 #[cfg_eval]
9 let _ = #[cfg(FALSE)] 0;
9 let _ = #[cfg(false)] 0;
1010 //~^ ERROR removing an expression is not supported in this position
1111 //~| ERROR expected expression, found `;`
1212 //~| ERROR removing an expression is not supported in this position
tests/ui/cfg/cfg-stmt-recovery.stderr+3-3
......@@ -1,19 +1,19 @@
11error: removing an expression is not supported in this position
22 --> $DIR/cfg-stmt-recovery.rs:9:13
33 |
4LL | let _ = #[cfg(FALSE)] 0;
4LL | let _ = #[cfg(false)] 0;
55 | ^^^^^^^^^^^^^
66
77error: expected expression, found `;`
88 --> $DIR/cfg-stmt-recovery.rs:9:28
99 |
10LL | let _ = #[cfg(FALSE)] 0;
10LL | let _ = #[cfg(false)] 0;
1111 | ^ expected expression
1212
1313error: removing an expression is not supported in this position
1414 --> $DIR/cfg-stmt-recovery.rs:9:13
1515 |
16LL | let _ = #[cfg(FALSE)] 0;
16LL | let _ = #[cfg(false)] 0;
1717 | ^^^^^^^^^^^^^
1818
1919error: aborting due to 3 previous errors
tests/ui/cfg/cfg_stmt_expr.rs+15-15
......@@ -7,47 +7,47 @@
77
88fn main() {
99 let a = 413;
10 #[cfg(FALSE)]
10 #[cfg(false)]
1111 let a = ();
1212 assert_eq!(a, 413);
1313
1414 let mut b = 612;
15 #[cfg(FALSE)]
15 #[cfg(false)]
1616 {
1717 b = 1111;
1818 }
1919 assert_eq!(b, 612);
2020
21 #[cfg(FALSE)]
21 #[cfg(false)]
2222 undefined_fn();
2323
24 #[cfg(FALSE)]
24 #[cfg(false)]
2525 undefined_macro!();
26 #[cfg(FALSE)]
26 #[cfg(false)]
2727 undefined_macro![];
28 #[cfg(FALSE)]
28 #[cfg(false)]
2929 undefined_macro!{};
3030
3131 // pretty printer bug...
32 // #[cfg(FALSE)]
32 // #[cfg(false)]
3333 // undefined_macro!{}
3434
35 let () = (#[cfg(FALSE)] 341,); // Should this also work on parens?
36 let t = (1, #[cfg(FALSE)] 3, 4);
35 let () = (#[cfg(false)] 341,); // Should this also work on parens?
36 let t = (1, #[cfg(false)] 3, 4);
3737 assert_eq!(t, (1, 4));
3838
3939 let f = |_: u32, _: u32| ();
40 f(2, 1, #[cfg(FALSE)] 6);
40 f(2, 1, #[cfg(false)] 6);
4141
42 let _: u32 = a.clone(#[cfg(FALSE)] undefined);
42 let _: u32 = a.clone(#[cfg(false)] undefined);
4343
44 let _: [(); 0] = [#[cfg(FALSE)] 126];
45 let t = [#[cfg(FALSE)] 1, 2, 6];
44 let _: [(); 0] = [#[cfg(false)] 126];
45 let t = [#[cfg(false)] 1, 2, 6];
4646 assert_eq!(t, [2, 6]);
4747
4848 {
4949 let r;
50 #[cfg(FALSE)]
50 #[cfg(false)]
5151 (r = 5);
5252 #[cfg(not(FALSE))]
5353 (r = 10);
......@@ -75,7 +75,7 @@ fn main() {
7575 612
7676 });
7777
78 assert_eq!((#[cfg(FALSE)] 1, #[cfg(not(FALSE))] 2), (2,));
78 assert_eq!((#[cfg(false)] 1, #[cfg(not(FALSE))] 2), (2,));
7979 assert_eq!(n, 612);
8080
8181 // check that lints work
tests/ui/cfg/cmdline-false.rs created+9
......@@ -0,0 +1,9 @@
1/// Test that `--cfg false` doesn't cause `cfg(false)` to evaluate to `true`
2//@ compile-flags: --cfg false
3
4#[cfg(false)]
5fn foo() {}
6
7fn main() {
8 foo(); //~ ERROR cannot find function `foo` in this scope
9}
tests/ui/cfg/cmdline-false.stderr created+9
......@@ -0,0 +1,9 @@
1error[E0425]: cannot find function `foo` in this scope
2 --> $DIR/cmdline-false.rs:8:5
3 |
4LL | foo();
5 | ^^^ not found in this scope
6
7error: aborting due to 1 previous error
8
9For more information about this error, try `rustc --explain E0425`.
tests/ui/cfg/conditional-compile.rs+18-18
......@@ -6,16 +6,16 @@
66
77// Crate use statements
88
9#[cfg(FALSE)]
9#[cfg(false)]
1010use flippity;
1111
12#[cfg(FALSE)]
12#[cfg(false)]
1313static b: bool = false;
1414
1515static b: bool = true;
1616
1717mod rustrt {
18 #[cfg(FALSE)]
18 #[cfg(false)]
1919 extern "C" {
2020 // This symbol doesn't exist and would be a link error if this
2121 // module was codegened
......@@ -25,12 +25,12 @@ mod rustrt {
2525 extern "C" {}
2626}
2727
28#[cfg(FALSE)]
28#[cfg(false)]
2929type t = isize;
3030
3131type t = bool;
3232
33#[cfg(FALSE)]
33#[cfg(false)]
3434enum tg {
3535 foo,
3636}
......@@ -39,12 +39,12 @@ enum tg {
3939 bar,
4040}
4141
42#[cfg(FALSE)]
42#[cfg(false)]
4343struct r {
4444 i: isize,
4545}
4646
47#[cfg(FALSE)]
47#[cfg(false)]
4848fn r(i: isize) -> r {
4949 r { i: i }
5050}
......@@ -57,7 +57,7 @@ fn r(i: isize) -> r {
5757 r { i: i }
5858}
5959
60#[cfg(FALSE)]
60#[cfg(false)]
6161mod m {
6262 // This needs to parse but would fail in typeck. Since it's not in
6363 // the current config it should not be typechecked.
......@@ -69,7 +69,7 @@ mod m {
6969mod m {
7070 // Submodules have slightly different code paths than the top-level
7171 // module, so let's make sure this jazz works here as well
72 #[cfg(FALSE)]
72 #[cfg(false)]
7373 pub fn f() {}
7474
7575 pub fn f() {}
......@@ -77,7 +77,7 @@ mod m {
7777
7878// Since the FALSE configuration isn't defined main will just be
7979// parsed, but nothing further will be done with it
80#[cfg(FALSE)]
80#[cfg(false)]
8181pub fn main() {
8282 panic!()
8383}
......@@ -93,14 +93,14 @@ pub fn main() {
9393}
9494
9595fn test_in_fn_ctxt() {
96 #[cfg(FALSE)]
96 #[cfg(false)]
9797 fn f() {
9898 panic!()
9999 }
100100 fn f() {}
101101 f();
102102
103 #[cfg(FALSE)]
103 #[cfg(false)]
104104 static i: isize = 0;
105105 static i: isize = 1;
106106 assert_eq!(i, 1);
......@@ -109,7 +109,7 @@ fn test_in_fn_ctxt() {
109109mod test_foreign_items {
110110 pub mod rustrt {
111111 extern "C" {
112 #[cfg(FALSE)]
112 #[cfg(false)]
113113 pub fn write() -> String;
114114 pub fn write() -> String;
115115 }
......@@ -117,7 +117,7 @@ mod test_foreign_items {
117117}
118118
119119mod test_use_statements {
120 #[cfg(FALSE)]
120 #[cfg(false)]
121121 use flippity_foo;
122122}
123123
......@@ -127,24 +127,24 @@ mod test_methods {
127127 }
128128
129129 impl Fooable for Foo {
130 #[cfg(FALSE)]
130 #[cfg(false)]
131131 fn what(&self) {}
132132
133133 fn what(&self) {}
134134
135 #[cfg(FALSE)]
135 #[cfg(false)]
136136 fn the(&self) {}
137137
138138 fn the(&self) {}
139139 }
140140
141141 trait Fooable {
142 #[cfg(FALSE)]
142 #[cfg(false)]
143143 fn what(&self);
144144
145145 fn what(&self);
146146
147 #[cfg(FALSE)]
147 #[cfg(false)]
148148 fn the(&self);
149149
150150 fn the(&self);
tests/ui/cfg/diagnostics-cross-crate.stderr+2-2
......@@ -12,7 +12,7 @@ LL | pub mod doesnt_exist {
1212note: the item is gated here
1313 --> $DIR/auxiliary/cfged_out.rs:5:5
1414 |
15LL | #[cfg(FALSE)]
15LL | #[cfg(false)]
1616 | ^^^^^^^^^^^^^
1717
1818error[E0425]: cannot find function `uwu` in crate `cfged_out`
......@@ -35,7 +35,7 @@ LL | pub fn uwu() {}
3535note: the item is gated here
3636 --> $DIR/auxiliary/cfged_out.rs:2:5
3737 |
38LL | #[cfg(FALSE)]
38LL | #[cfg(false)]
3939 | ^^^^^^^^^^^^^
4040
4141error[E0425]: cannot find function `meow` in module `cfged_out::inner::right`
tests/ui/cfg/diagnostics-reexport.rs+5-5
......@@ -1,10 +1,10 @@
11pub mod inner {
2 #[cfg(FALSE)]
2 #[cfg(false)]
33 mod gone {
44 pub fn uwu() {}
55 }
66
7 #[cfg(FALSE)] //~ NOTE the item is gated here
7 #[cfg(false)] //~ NOTE the item is gated here
88 pub use super::uwu;
99 //~^ NOTE found an item that was configured out
1010}
......@@ -14,7 +14,7 @@ pub use a::x;
1414//~| NOTE no `x` in `a`
1515
1616mod a {
17 #[cfg(FALSE)] //~ NOTE the item is gated here
17 #[cfg(false)] //~ NOTE the item is gated here
1818 pub fn x() {}
1919 //~^ NOTE found an item that was configured out
2020}
......@@ -25,10 +25,10 @@ pub use b::{x, y};
2525//~| NOTE no `y` in `b`
2626
2727mod b {
28 #[cfg(FALSE)] //~ NOTE the item is gated here
28 #[cfg(false)] //~ NOTE the item is gated here
2929 pub fn x() {}
3030 //~^ NOTE found an item that was configured out
31 #[cfg(FALSE)] //~ NOTE the item is gated here
31 #[cfg(false)] //~ NOTE the item is gated here
3232 pub fn y() {}
3333 //~^ NOTE found an item that was configured out
3434}
tests/ui/cfg/diagnostics-reexport.stderr+4-4
......@@ -12,7 +12,7 @@ LL | pub fn x() {}
1212note: the item is gated here
1313 --> $DIR/diagnostics-reexport.rs:17:5
1414 |
15LL | #[cfg(FALSE)]
15LL | #[cfg(false)]
1616 | ^^^^^^^^^^^^^
1717
1818error[E0432]: unresolved imports `b::x`, `b::y`
......@@ -31,7 +31,7 @@ LL | pub fn x() {}
3131note: the item is gated here
3232 --> $DIR/diagnostics-reexport.rs:28:5
3333 |
34LL | #[cfg(FALSE)]
34LL | #[cfg(false)]
3535 | ^^^^^^^^^^^^^
3636note: found an item that was configured out
3737 --> $DIR/diagnostics-reexport.rs:32:12
......@@ -41,7 +41,7 @@ LL | pub fn y() {}
4141note: the item is gated here
4242 --> $DIR/diagnostics-reexport.rs:31:5
4343 |
44LL | #[cfg(FALSE)]
44LL | #[cfg(false)]
4545 | ^^^^^^^^^^^^^
4646
4747error[E0425]: cannot find function `uwu` in module `inner`
......@@ -58,7 +58,7 @@ LL | pub use super::uwu;
5858note: the item is gated here
5959 --> $DIR/diagnostics-reexport.rs:7:5
6060 |
61LL | #[cfg(FALSE)]
61LL | #[cfg(false)]
6262 | ^^^^^^^^^^^^^
6363
6464error: aborting due to 3 previous errors
tests/ui/cfg/diagnostics-same-crate.rs+2-2
......@@ -1,11 +1,11 @@
11#![allow(unexpected_cfgs)] // since we want to recognize them as unexpected
22
33pub mod inner {
4 #[cfg(FALSE)] //~ NOTE the item is gated here
4 #[cfg(false)] //~ NOTE the item is gated here
55 pub fn uwu() {}
66 //~^ NOTE found an item that was configured out
77
8 #[cfg(FALSE)] //~ NOTE the item is gated here
8 #[cfg(false)] //~ NOTE the item is gated here
99 //~^ NOTE the item is gated here
1010 //~| NOTE the item is gated here
1111 pub mod doesnt_exist {
tests/ui/cfg/diagnostics-same-crate.stderr+4-4
......@@ -12,7 +12,7 @@ LL | pub mod doesnt_exist {
1212note: the item is gated here
1313 --> $DIR/diagnostics-same-crate.rs:8:5
1414 |
15LL | #[cfg(FALSE)]
15LL | #[cfg(false)]
1616 | ^^^^^^^^^^^^^
1717
1818error[E0432]: unresolved import `super::inner::doesnt_exist`
......@@ -29,7 +29,7 @@ LL | pub mod doesnt_exist {
2929note: the item is gated here
3030 --> $DIR/diagnostics-same-crate.rs:8:5
3131 |
32LL | #[cfg(FALSE)]
32LL | #[cfg(false)]
3333 | ^^^^^^^^^^^^^
3434
3535error[E0433]: failed to resolve: could not find `doesnt_exist` in `inner`
......@@ -46,7 +46,7 @@ LL | pub mod doesnt_exist {
4646note: the item is gated here
4747 --> $DIR/diagnostics-same-crate.rs:8:5
4848 |
49LL | #[cfg(FALSE)]
49LL | #[cfg(false)]
5050 | ^^^^^^^^^^^^^
5151
5252error[E0425]: cannot find function `uwu` in module `inner`
......@@ -63,7 +63,7 @@ LL | pub fn uwu() {}
6363note: the item is gated here
6464 --> $DIR/diagnostics-same-crate.rs:4:5
6565 |
66LL | #[cfg(FALSE)]
66LL | #[cfg(false)]
6767 | ^^^^^^^^^^^^^
6868
6969error[E0425]: cannot find function `meow` in module `inner::right`
tests/ui/cfg/true-false.rs-1
......@@ -1,7 +1,6 @@
11//@ run-pass
22
33#![feature(link_cfg)]
4#![feature(cfg_boolean_literals)]
54
65#[cfg(true)]
76fn foo() -> bool {
tests/ui/check-cfg/allow-same-level.rs+1-1
......@@ -12,7 +12,7 @@
1212//@ compile-flags: --check-cfg=cfg() --cfg=unknown_but_active_cfg
1313
1414#[allow(unexpected_cfgs)]
15#[cfg(FALSE)]
15#[cfg(unknown_and_inactive_cfg)]
1616//~^ WARNING unexpected `cfg` condition name
1717fn bar() {}
1818
tests/ui/check-cfg/allow-same-level.stderr+4-4
......@@ -1,10 +1,10 @@
1warning: unexpected `cfg` condition name: `FALSE`
1warning: unexpected `cfg` condition name: `unknown_and_inactive_cfg`
22 --> $DIR/allow-same-level.rs:15:7
33 |
4LL | #[cfg(FALSE)]
5 | ^^^^^
4LL | #[cfg(unknown_and_inactive_cfg)]
5 | ^^^^^^^^^^^^^^^^^^^^^^^^
66 |
7 = help: to expect this configuration use `--check-cfg=cfg(FALSE)`
7 = help: to expect this configuration use `--check-cfg=cfg(unknown_and_inactive_cfg)`
88 = note: see <https://doc.rust-lang.org/nightly/rustc/check-cfg.html> for more information about checking conditional configuration
99 = note: `#[warn(unexpected_cfgs)]` on by default
1010
tests/ui/check-cfg/allow-top-level.rs+1-1
......@@ -6,7 +6,7 @@
66
77#![allow(unexpected_cfgs)]
88
9#[cfg(FALSE)]
9#[cfg(false)]
1010fn bar() {}
1111
1212fn foo() {
tests/ui/check-cfg/allow-upper-level.rs+1-1
......@@ -6,7 +6,7 @@
66
77#[allow(unexpected_cfgs)]
88mod aa {
9 #[cfg(FALSE)]
9 #[cfg(false)]
1010 fn bar() {}
1111}
1212
tests/ui/codemap_tests/unicode.expanded.stdout+1
......@@ -7,6 +7,7 @@ extern crate std;
77//@ revisions: normal expanded
88//@[expanded] check-pass
99//@[expanded]compile-flags: -Zunpretty=expanded
10//@ edition: 2015
1011
1112extern "路濫狼á́́" fn foo() {}
1213
tests/ui/codemap_tests/unicode.normal.stderr+1-1
......@@ -1,5 +1,5 @@
11error[E0703]: invalid ABI: found `路濫狼á́́`
2 --> $DIR/unicode.rs:5:8
2 --> $DIR/unicode.rs:6:8
33 |
44LL | extern "路濫狼á́́" fn foo() {}
55 | ^^^^^^^^^ invalid ABI
tests/ui/codemap_tests/unicode.rs+1
......@@ -1,6 +1,7 @@
11//@ revisions: normal expanded
22//@[expanded] check-pass
33//@[expanded]compile-flags: -Zunpretty=expanded
4//@ edition: 2015
45
56extern "路濫狼á́́" fn foo() {} //[normal]~ ERROR invalid ABI
67
tests/ui/conditional-compilation/cfg-generic-params.rs+8-8
......@@ -1,18 +1,18 @@
11//@ compile-flags:--cfg yes --check-cfg=cfg(yes,no)
22
3fn f_lt<#[cfg(yes)] 'a: 'a, #[cfg(FALSE)] T>() {}
4fn f_ty<#[cfg(FALSE)] 'a: 'a, #[cfg(yes)] T>() {}
3fn f_lt<#[cfg(yes)] 'a: 'a, #[cfg(false)] T>() {}
4fn f_ty<#[cfg(false)] 'a: 'a, #[cfg(yes)] T>() {}
55
6type FnGood = for<#[cfg(yes)] 'a, #[cfg(FALSE)] T> fn(); // OK
7type FnBad = for<#[cfg(FALSE)] 'a, #[cfg(yes)] T> fn();
6type FnGood = for<#[cfg(yes)] 'a, #[cfg(false)] T> fn(); // OK
7type FnBad = for<#[cfg(false)] 'a, #[cfg(yes)] T> fn();
88//~^ ERROR only lifetime parameters can be used in this context
99
10type PolyGood = dyn for<#[cfg(yes)] 'a, #[cfg(FALSE)] T> Copy; // OK
11type PolyBad = dyn for<#[cfg(FALSE)] 'a, #[cfg(yes)] T> Copy;
10type PolyGood = dyn for<#[cfg(yes)] 'a, #[cfg(false)] T> Copy; // OK
11type PolyBad = dyn for<#[cfg(false)] 'a, #[cfg(yes)] T> Copy;
1212//~^ ERROR only lifetime parameters can be used in this context
1313
14struct WhereGood where for<#[cfg(yes)] 'a, #[cfg(FALSE)] T> u8: Copy; // OK
15struct WhereBad where for<#[cfg(FALSE)] 'a, #[cfg(yes)] T> u8: Copy;
14struct WhereGood where for<#[cfg(yes)] 'a, #[cfg(false)] T> u8: Copy; // OK
15struct WhereBad where for<#[cfg(false)] 'a, #[cfg(yes)] T> u8: Copy;
1616//~^ ERROR only lifetime parameters can be used in this context
1717
1818fn f_lt_no<#[cfg_attr(FALSE, unknown)] 'a>() {} // OK
tests/ui/conditional-compilation/cfg-generic-params.stderr+3-3
......@@ -31,7 +31,7 @@ LL | struct WhereYes where for<#[cfg_attr(yes, unknown)] 'a> u8: Copy;
3131error[E0658]: only lifetime parameters can be used in this context
3232 --> $DIR/cfg-generic-params.rs:7:48
3333 |
34LL | type FnBad = for<#[cfg(FALSE)] 'a, #[cfg(yes)] T> fn();
34LL | type FnBad = for<#[cfg(false)] 'a, #[cfg(yes)] T> fn();
3535 | ^
3636 |
3737 = note: see issue #108185 <https://github.com/rust-lang/rust/issues/108185> for more information
......@@ -41,7 +41,7 @@ LL | type FnBad = for<#[cfg(FALSE)] 'a, #[cfg(yes)] T> fn();
4141error[E0658]: only lifetime parameters can be used in this context
4242 --> $DIR/cfg-generic-params.rs:11:54
4343 |
44LL | type PolyBad = dyn for<#[cfg(FALSE)] 'a, #[cfg(yes)] T> Copy;
44LL | type PolyBad = dyn for<#[cfg(false)] 'a, #[cfg(yes)] T> Copy;
4545 | ^
4646 |
4747 = note: see issue #108185 <https://github.com/rust-lang/rust/issues/108185> for more information
......@@ -51,7 +51,7 @@ LL | type PolyBad = dyn for<#[cfg(FALSE)] 'a, #[cfg(yes)] T> Copy;
5151error[E0658]: only lifetime parameters can be used in this context
5252 --> $DIR/cfg-generic-params.rs:15:57
5353 |
54LL | struct WhereBad where for<#[cfg(FALSE)] 'a, #[cfg(yes)] T> u8: Copy;
54LL | struct WhereBad where for<#[cfg(false)] 'a, #[cfg(yes)] T> u8: Copy;
5555 | ^
5656 |
5757 = note: see issue #108185 <https://github.com/rust-lang/rust/issues/108185> for more information
tests/ui/conditional-compilation/cfg-in-crate-1.rs+1-1
......@@ -1 +1 @@
1#![cfg(FALSE)] //~ ERROR `main` function not found in crate `cfg_in_crate_1`
1#![cfg(false)] //~ ERROR `main` function not found in crate `cfg_in_crate_1`
tests/ui/conditional-compilation/cfg-in-crate-1.stderr+1-1
......@@ -1,7 +1,7 @@
11error[E0601]: `main` function not found in crate `cfg_in_crate_1`
22 --> $DIR/cfg-in-crate-1.rs:1:15
33 |
4LL | #![cfg(FALSE)]
4LL | #![cfg(false)]
55 | ^ consider adding a `main` function to `$DIR/cfg-in-crate-1.rs`
66
77error: aborting due to 1 previous error
tests/ui/conditional-compilation/cfg-non-opt-expr.rs+3-3
......@@ -2,10 +2,10 @@
22#![feature(custom_test_frameworks)]
33
44fn main() {
5 let _ = #[cfg(FALSE)] ();
5 let _ = #[cfg(false)] ();
66 //~^ ERROR removing an expression is not supported in this position
7 let _ = 1 + 2 + #[cfg(FALSE)] 3;
7 let _ = 1 + 2 + #[cfg(false)] 3;
88 //~^ ERROR removing an expression is not supported in this position
9 let _ = [1, 2, 3][#[cfg(FALSE)] 1];
9 let _ = [1, 2, 3][#[cfg(false)] 1];
1010 //~^ ERROR removing an expression is not supported in this position
1111}
tests/ui/conditional-compilation/cfg-non-opt-expr.stderr+3-3
......@@ -1,19 +1,19 @@
11error: removing an expression is not supported in this position
22 --> $DIR/cfg-non-opt-expr.rs:5:13
33 |
4LL | let _ = #[cfg(FALSE)] ();
4LL | let _ = #[cfg(false)] ();
55 | ^^^^^^^^^^^^^
66
77error: removing an expression is not supported in this position
88 --> $DIR/cfg-non-opt-expr.rs:7:21
99 |
10LL | let _ = 1 + 2 + #[cfg(FALSE)] 3;
10LL | let _ = 1 + 2 + #[cfg(false)] 3;
1111 | ^^^^^^^^^^^^^
1212
1313error: removing an expression is not supported in this position
1414 --> $DIR/cfg-non-opt-expr.rs:9:23
1515 |
16LL | let _ = [1, 2, 3][#[cfg(FALSE)] 1];
16LL | let _ = [1, 2, 3][#[cfg(false)] 1];
1717 | ^^^^^^^^^^^^^
1818
1919error: aborting due to 3 previous errors
tests/ui/conditional-compilation/module_with_cfg.rs+1-1
......@@ -1,3 +1,3 @@
11//@ ignore-test (auxiliary, used by other tests)
22
3#![cfg_attr(all(), cfg(FALSE))]
3#![cfg_attr(all(), cfg(false))]
tests/ui/const-generics/defaults/pretty-printing-ast.rs+1
......@@ -1,6 +1,7 @@
11// Test the AST pretty printer correctly handles default values for const generics
22//@ check-pass
33//@ compile-flags: -Z unpretty=expanded
4//@ edition: 2015
45
56#![crate_type = "lib"]
67
tests/ui/const-generics/defaults/pretty-printing-ast.stdout+1
......@@ -3,6 +3,7 @@
33// Test the AST pretty printer correctly handles default values for const generics
44//@ check-pass
55//@ compile-flags: -Z unpretty=expanded
6//@ edition: 2015
67
78#![crate_type = "lib"]
89#[prelude_import]
tests/ui/consts/const-extern-fn/issue-68062-const-extern-fns-dont-need-fn-specifier-2.rs+1-1
......@@ -1,6 +1,6 @@
11fn main() {}
22
3#[cfg(FALSE)]
3#[cfg(false)]
44fn container() {
55 const unsafe WhereIsFerris Now() {}
66 //~^ ERROR expected one of `extern` or `fn`
tests/ui/consts/const-extern-fn/issue-68062-const-extern-fns-dont-need-fn-specifier.rs+1-1
......@@ -1,6 +1,6 @@
11fn main() {}
22
3#[cfg(FALSE)]
3#[cfg(false)]
44fn container() {
55 const extern "Rust" PUT_ANYTHING_YOU_WANT_HERE bug() -> usize { 1 }
66 //~^ ERROR expected `fn`
tests/ui/delegation/explicit-paths-signature-pass.rs+1-1
......@@ -6,7 +6,7 @@
66mod to_reuse {
77 use crate::S;
88
9 pub fn foo<'a>(#[cfg(FALSE)] a: u8, _b: &'a S) -> u32 {
9 pub fn foo<'a>(#[cfg(false)] a: u8, _b: &'a S) -> u32 {
1010 1
1111 }
1212}
tests/ui/deriving/built-in-proc-macro-scope.rs+1
......@@ -1,6 +1,7 @@
11//@ check-pass
22//@ proc-macro: another-proc-macro.rs
33//@ compile-flags: -Zunpretty=expanded
4//@ edition:2015
45
56#![feature(derive_coerce_pointee)]
67
tests/ui/deriving/built-in-proc-macro-scope.stdout+1
......@@ -3,6 +3,7 @@
33//@ check-pass
44//@ proc-macro: another-proc-macro.rs
55//@ compile-flags: -Zunpretty=expanded
6//@ edition:2015
67
78#![feature(derive_coerce_pointee)]
89#[prelude_import]
tests/ui/deriving/deriving-coerce-pointee-expanded.rs+1
......@@ -1,5 +1,6 @@
11//@ check-pass
22//@ compile-flags: -Zunpretty=expanded
3//@ edition: 2015
34#![feature(derive_coerce_pointee)]
45use std::marker::CoercePointee;
56
tests/ui/deriving/deriving-coerce-pointee-expanded.stdout+1
......@@ -2,6 +2,7 @@
22#![no_std]
33//@ check-pass
44//@ compile-flags: -Zunpretty=expanded
5//@ edition: 2015
56#![feature(derive_coerce_pointee)]
67#[prelude_import]
78use ::std::prelude::rust_2015::*;
tests/ui/deriving/proc-macro-attribute-mixing.rs+1
......@@ -7,6 +7,7 @@
77//@ check-pass
88//@ proc-macro: another-proc-macro.rs
99//@ compile-flags: -Zunpretty=expanded
10//@ edition: 2015
1011
1112#![feature(derive_coerce_pointee)]
1213
tests/ui/deriving/proc-macro-attribute-mixing.stdout+1
......@@ -9,6 +9,7 @@
99//@ check-pass
1010//@ proc-macro: another-proc-macro.rs
1111//@ compile-flags: -Zunpretty=expanded
12//@ edition: 2015
1213
1314#![feature(derive_coerce_pointee)]
1415#[prelude_import]
tests/ui/expr/if/attrs/bad-cfg.rs+1-1
......@@ -1,5 +1,5 @@
11#![feature(stmt_expr_attributes)]
22
33fn main() {
4 let _ = #[cfg(FALSE)] if true {}; //~ ERROR removing an expression
4 let _ = #[cfg(false)] if true {}; //~ ERROR removing an expression
55}
tests/ui/expr/if/attrs/bad-cfg.stderr+1-1
......@@ -1,7 +1,7 @@
11error: removing an expression is not supported in this position
22 --> $DIR/bad-cfg.rs:4:13
33 |
4LL | let _ = #[cfg(FALSE)] if true {};
4LL | let _ = #[cfg(false)] if true {};
55 | ^^^^^^^^^^^^^
66
77error: aborting due to 1 previous error
tests/ui/expr/if/attrs/cfg-false-if-attr.rs+7-7
......@@ -1,12 +1,12 @@
11//@ check-pass
22
3#[cfg(FALSE)]
3#[cfg(false)]
44fn simple_attr() {
55 #[attr] if true {}
66 #[allow_warnings] if true {}
77}
88
9#[cfg(FALSE)]
9#[cfg(false)]
1010fn if_else_chain() {
1111 #[first_attr] if true {
1212 } else if false {
......@@ -14,20 +14,20 @@ fn if_else_chain() {
1414 }
1515}
1616
17#[cfg(FALSE)]
17#[cfg(false)]
1818fn if_let() {
1919 #[attr] if let Some(_) = Some(true) {}
2020}
2121
2222fn bar() {
23 #[cfg(FALSE)]
23 #[cfg(false)]
2424 if true {
25 let x: () = true; // Should not error due to the #[cfg(FALSE)]
25 let x: () = true; // Should not error due to the #[cfg(false)]
2626 }
2727
28 #[cfg_attr(not(FALSE), cfg(FALSE))]
28 #[cfg_attr(not(FALSE), cfg(false))]
2929 if true {
30 let a: () = true; // Should not error due to the applied #[cfg(FALSE)]
30 let a: () = true; // Should not error due to the applied #[cfg(false)]
3131 }
3232}
3333
tests/ui/expr/if/attrs/else-attrs.rs+3-3
......@@ -1,11 +1,11 @@
1#[cfg(FALSE)]
1#[cfg(false)]
22fn if_else_parse_error() {
33 if true {
44 } #[attr] else if false { //~ ERROR expected
55 }
66}
77
8#[cfg(FALSE)]
8#[cfg(false)]
99fn else_attr_ifparse_error() {
1010 if true {
1111 } else #[attr] if false { //~ ERROR outer attributes are not allowed
......@@ -13,7 +13,7 @@ fn else_attr_ifparse_error() {
1313 }
1414}
1515
16#[cfg(FALSE)]
16#[cfg(false)]
1717fn else_parse_error() {
1818 if true {
1919 } else if false {
tests/ui/expr/if/attrs/gate-whole-expr.rs+1-1
......@@ -3,7 +3,7 @@
33fn main() {
44 let x = 1;
55
6 #[cfg(FALSE)]
6 #[cfg(false)]
77 if false {
88 x = 2;
99 } else if true {
tests/ui/expr/if/attrs/let-chains-attr.rs+1-1
......@@ -2,7 +2,7 @@
22
33#![feature(let_chains)]
44
5#[cfg(FALSE)]
5#[cfg(false)]
66fn foo() {
77 #[attr]
88 if let Some(_) = Some(true) && let Ok(_) = Ok(1) {
tests/ui/feature-gates/feature-gate-cfg-boolean-literals.rs deleted-10
......@@ -1,10 +0,0 @@
1#[cfg(true)] //~ ERROR `cfg(true)` is experimental
2fn foo() {}
3
4#[cfg_attr(true, cfg(false))] //~ ERROR `cfg(true)` is experimental
5//~^ ERROR `cfg(false)` is experimental
6fn foo() {}
7
8fn main() {
9 cfg!(false); //~ ERROR `cfg(false)` is experimental
10}
tests/ui/feature-gates/feature-gate-cfg-boolean-literals.stderr deleted-43
......@@ -1,43 +0,0 @@
1error[E0658]: `cfg(true)` is experimental and subject to change
2 --> $DIR/feature-gate-cfg-boolean-literals.rs:1:7
3 |
4LL | #[cfg(true)]
5 | ^^^^
6 |
7 = note: see issue #131204 <https://github.com/rust-lang/rust/issues/131204> for more information
8 = help: add `#![feature(cfg_boolean_literals)]` to the crate attributes to enable
9 = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
10
11error[E0658]: `cfg(true)` is experimental and subject to change
12 --> $DIR/feature-gate-cfg-boolean-literals.rs:4:12
13 |
14LL | #[cfg_attr(true, cfg(false))]
15 | ^^^^
16 |
17 = note: see issue #131204 <https://github.com/rust-lang/rust/issues/131204> for more information
18 = help: add `#![feature(cfg_boolean_literals)]` to the crate attributes to enable
19 = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
20
21error[E0658]: `cfg(false)` is experimental and subject to change
22 --> $DIR/feature-gate-cfg-boolean-literals.rs:4:22
23 |
24LL | #[cfg_attr(true, cfg(false))]
25 | ^^^^^
26 |
27 = note: see issue #131204 <https://github.com/rust-lang/rust/issues/131204> for more information
28 = help: add `#![feature(cfg_boolean_literals)]` to the crate attributes to enable
29 = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
30
31error[E0658]: `cfg(false)` is experimental and subject to change
32 --> $DIR/feature-gate-cfg-boolean-literals.rs:9:10
33 |
34LL | cfg!(false);
35 | ^^^^^
36 |
37 = note: see issue #131204 <https://github.com/rust-lang/rust/issues/131204> for more information
38 = help: add `#![feature(cfg_boolean_literals)]` to the crate attributes to enable
39 = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
40
41error: aborting due to 4 previous errors
42
43For more information about this error, try `rustc --explain E0658`.
tests/ui/feature-gates/feature-gate-coroutines.rs+1-1
......@@ -12,7 +12,7 @@ fn main() {
1212 //~^^ ERROR `yield` can only be used
1313}
1414
15#[cfg(FALSE)]
15#[cfg(false)]
1616fn foo() {
1717 // Ok in 2024 edition
1818 yield; //~ ERROR yield syntax is experimental
tests/ui/feature-gates/feature-gate-deref_patterns.rs+1-1
......@@ -4,6 +4,6 @@ fn main() {
44 println!("x: {}", x);
55
66 // `box` syntax is allowed to be cfg-ed out for historical reasons (#65742).
7 #[cfg(FALSE)]
7 #[cfg(false)]
88 let box _x = Box::new('c');
99}
tests/ui/feature-gates/feature-gate-gen_blocks.rs+1-1
......@@ -17,7 +17,7 @@ fn test_async_gen() {
1717
1818fn main() {}
1919
20#[cfg(FALSE)]
20#[cfg(false)]
2121fn foo() {
2222 gen {};
2323 //[e2024]~^ ERROR: gen blocks are experimental
tests/ui/feature-gates/feature-gate-guard-patterns.rs+1-1
......@@ -30,7 +30,7 @@ fn other_guards_dont() {
3030 while let (x if guard(x)) = 0 {}
3131 //~^ ERROR: guard patterns are experimental
3232
33 #[cfg(FALSE)]
33 #[cfg(false)]
3434 while let (x if guard(x)) = 0 {}
3535 //~^ ERROR: guard patterns are experimental
3636}
tests/ui/feature-gates/feature-gate-mut-ref.rs+2-2
......@@ -6,8 +6,8 @@ fn main() {
66 let mut ref mut z = 14; //~ ERROR [E0658]
77 z = &mut 15;
88
9 #[cfg(FALSE)]
9 #[cfg(false)]
1010 let mut ref x = 10; //~ ERROR [E0658]
11 #[cfg(FALSE)]
11 #[cfg(false)]
1212 let mut ref mut y = 10; //~ ERROR [E0658]
1313}
tests/ui/feature-gates/feature-gate-never_patterns.rs+4-4
......@@ -15,12 +15,12 @@ fn main() {
1515 //~^ ERROR `!` patterns are experimental
1616 }
1717 // Check that the gate operates even behind `cfg`.
18 #[cfg(FALSE)]
18 #[cfg(false)]
1919 match *ptr {
2020 !
2121 //~^ ERROR `!` patterns are experimental
2222 }
23 #[cfg(FALSE)]
23 #[cfg(false)]
2424 match *ptr {
2525 ! => {}
2626 //~^ ERROR `!` patterns are experimental
......@@ -60,13 +60,13 @@ fn main() {
6060 // Check that the gate operates even behind `cfg`.
6161 match Some(0) {
6262 None => {}
63 #[cfg(FALSE)]
63 #[cfg(false)]
6464 Some(_)
6565 //~^ ERROR `match` arm with no body
6666 }
6767 match Some(0) {
6868 _ => {}
69 #[cfg(FALSE)]
69 #[cfg(false)]
7070 Some(_) if false
7171 //~^ ERROR `match` arm with no body
7272 }
tests/ui/feature-gates/feature-gate-postfix_match.rs+1-1
......@@ -9,7 +9,7 @@ fn main() {
99 };
1010
1111 // Test that the gate works behind a cfg
12 #[cfg(FALSE)]
12 #[cfg(false)]
1313 val.match { //~ ERROR postfix match is experimental
1414 Some(42) => "the answer to life, the universe, and everything",
1515 _ => "might be the answer to something"
tests/ui/feature-gates/feature-gate-yeet_expr-in-cfg.rs+2-2
......@@ -1,7 +1,7 @@
11//@ edition: 2021
22
33pub fn demo() -> Option<i32> {
4 #[cfg(FALSE)]
4 #[cfg(false)]
55 {
66 do yeet //~ ERROR `do yeet` expression is experimental
77 }
......@@ -9,7 +9,7 @@ pub fn demo() -> Option<i32> {
99 Some(1)
1010}
1111
12#[cfg(FALSE)]
12#[cfg(false)]
1313pub fn alternative() -> Result<(), String> {
1414 do yeet "hello"; //~ ERROR `do yeet` expression is experimental
1515}
tests/ui/feature-gates/soft-syntax-gates-with-errors.rs+3-3
......@@ -5,7 +5,7 @@
55macro a() {}
66//~^ ERROR: `macro` is experimental
77
8#[cfg(FALSE)]
8#[cfg(false)]
99macro b() {}
1010
1111macro_rules! identity {
......@@ -17,13 +17,13 @@ identity! {
1717 //~^ ERROR: `macro` is experimental
1818}
1919
20#[cfg(FALSE)]
20#[cfg(false)]
2121identity! {
2222 macro d() {} // No error
2323}
2424
2525identity! {
26 #[cfg(FALSE)]
26 #[cfg(false)]
2727 macro e() {}
2828}
2929
tests/ui/feature-gates/soft-syntax-gates-without-errors.rs+3-3
......@@ -2,7 +2,7 @@
22// This file is used to test the behavior of the early-pass syntax warnings.
33// If macro syntax is stabilized, replace with a different unstable syntax.
44
5#[cfg(FALSE)]
5#[cfg(false)]
66macro b() {}
77//~^ WARN: `macro` is experimental
88//~| WARN: unstable syntax
......@@ -11,13 +11,13 @@ macro_rules! identity {
1111 ($($x:tt)*) => ($($x)*);
1212}
1313
14#[cfg(FALSE)]
14#[cfg(false)]
1515identity! {
1616 macro d() {} // No error
1717}
1818
1919identity! {
20 #[cfg(FALSE)]
20 #[cfg(false)]
2121 macro e() {}
2222 //~^ WARN: `macro` is experimental
2323 //~| WARN: unstable syntax
tests/ui/feature-gates/stmt_expr_attrs_no_feature.rs+12-12
......@@ -25,7 +25,7 @@ fn main() {
2525
2626// Check that cfg works right
2727
28#[cfg(FALSE)]
28#[cfg(false)]
2929fn c() {
3030 #[rustc_dummy]
3131 5;
......@@ -37,7 +37,7 @@ fn j() {
3737 5;
3838}
3939
40#[cfg_attr(not(FALSE), cfg(FALSE))]
40#[cfg_attr(not(FALSE), cfg(false))]
4141fn d() {
4242 #[rustc_dummy]
4343 8;
......@@ -57,7 +57,7 @@ macro_rules! item_mac {
5757 #[rustc_dummy]
5858 42;
5959
60 #[cfg(FALSE)]
60 #[cfg(false)]
6161 fn f() {
6262 #[rustc_dummy]
6363 5;
......@@ -69,7 +69,7 @@ macro_rules! item_mac {
6969 5;
7070 }
7171
72 #[cfg_attr(not(FALSE), cfg(FALSE))]
72 #[cfg_attr(not(FALSE), cfg(false))]
7373 fn g() {
7474 #[rustc_dummy]
7575 8;
......@@ -90,42 +90,42 @@ item_mac!(e);
9090// check that the gate visitor works right:
9191
9292extern "C" {
93 #[cfg(FALSE)]
93 #[cfg(false)]
9494 fn x(a: [u8; #[rustc_dummy] 5]);
9595 fn y(a: [u8; #[rustc_dummy] 5]); //~ ERROR attributes on expressions are experimental
9696}
9797
9898struct Foo;
9999impl Foo {
100 #[cfg(FALSE)]
100 #[cfg(false)]
101101 const X: u8 = #[rustc_dummy] 5;
102102 const Y: u8 = #[rustc_dummy] 5; //~ ERROR attributes on expressions are experimental
103103}
104104
105105trait Bar {
106 #[cfg(FALSE)]
106 #[cfg(false)]
107107 const X: [u8; #[rustc_dummy] 5];
108108 const Y: [u8; #[rustc_dummy] 5]; //~ ERROR attributes on expressions are experimental
109109}
110110
111111struct Joyce {
112 #[cfg(FALSE)]
112 #[cfg(false)]
113113 field: [u8; #[rustc_dummy] 5],
114114 field2: [u8; #[rustc_dummy] 5] //~ ERROR attributes on expressions are experimental
115115}
116116
117117struct Walky(
118 #[cfg(FALSE)] [u8; #[rustc_dummy] 5],
118 #[cfg(false)] [u8; #[rustc_dummy] 5],
119119 [u8; #[rustc_dummy] 5] //~ ERROR attributes on expressions are experimental
120120);
121121
122122enum Mike {
123123 Happy(
124 #[cfg(FALSE)] [u8; #[rustc_dummy] 5],
124 #[cfg(false)] [u8; #[rustc_dummy] 5],
125125 [u8; #[rustc_dummy] 5] //~ ERROR attributes on expressions are experimental
126126 ),
127127 Angry {
128 #[cfg(FALSE)]
128 #[cfg(false)]
129129 field: [u8; #[rustc_dummy] 5],
130130 field2: [u8; #[rustc_dummy] 5] //~ ERROR attributes on expressions are experimental
131131 }
......@@ -133,7 +133,7 @@ enum Mike {
133133
134134fn pat() {
135135 match 5 {
136 #[cfg(FALSE)]
136 #[cfg(false)]
137137 5 => #[rustc_dummy] (),
138138 6 => #[rustc_dummy] (), //~ ERROR attributes on expressions are experimental
139139 _ => (),
tests/ui/filter-block-view-items.rs+1-1
......@@ -3,5 +3,5 @@
33pub fn main() {
44 // Make sure that this view item is filtered out because otherwise it would
55 // trigger a compilation error
6 #[cfg(FALSE)] use bar as foo;
6 #[cfg(false)] use bar as foo;
77}
tests/ui/half-open-range-patterns/half-open-range-pats-inclusive-dotdotdot-bad-syntax.rs+1-1
......@@ -9,7 +9,7 @@
99
1010fn main() {}
1111
12#[cfg(FALSE)]
12#[cfg(false)]
1313fn syntax() {
1414 match scrutinee {
1515 ...X => {} //~ ERROR range-to patterns with `...` are not allowed
tests/ui/half-open-range-patterns/half-open-range-pats-inclusive-no-end.rs+1-1
......@@ -3,7 +3,7 @@
33
44fn main() {}
55
6#[cfg(FALSE)]
6#[cfg(false)]
77fn foo() {
88 if let 0... = 1 {} //~ ERROR inclusive range with no end
99 if let 0..= = 1 {} //~ ERROR inclusive range with no end
tests/ui/half-open-range-patterns/half-open-range-pats-ref-ambiguous-interp.rs+1-1
......@@ -1,6 +1,6 @@
11fn main() {}
22
3#[cfg(FALSE)]
3#[cfg(false)]
44fn syntax() {
55 match &0 {
66 &0.. | _ => {}
tests/ui/half-open-range-patterns/half-open-range-pats-syntactic-pass.rs+1-1
......@@ -4,7 +4,7 @@
44
55fn main() {}
66
7#[cfg(FALSE)]
7#[cfg(false)]
88fn syntax() {
99 match scrutinee {
1010 X.. | 0.. | 'a'.. | 0.0f32.. => {}
tests/ui/inner-attrs-on-impl.rs+2-2
......@@ -3,7 +3,7 @@
33struct Foo;
44
55impl Foo {
6 #![cfg(FALSE)]
6 #![cfg(false)]
77
88 fn method(&self) -> bool { false }
99}
......@@ -12,7 +12,7 @@ impl Foo {
1212 #![cfg(not(FALSE))]
1313
1414 // check that we don't eat attributes too eagerly.
15 #[cfg(FALSE)]
15 #[cfg(false)]
1616 fn method(&self) -> bool { false }
1717
1818 fn method(&self) -> bool { true }
tests/ui/issues/issue-11004.rs+1-1
......@@ -9,7 +9,7 @@ unsafe fn access(n:*mut A) -> (i32, f64) {
99 (x, y)
1010}
1111
12#[cfg(FALSE)]
12#[cfg(false)]
1313unsafe fn access(n:*mut A) -> (i32, f64) {
1414 let x : i32 = (*n).x;
1515 let y : f64 = (*n).y;
tests/ui/issues/issue-11085.rs+4-4
......@@ -3,7 +3,7 @@
33#![allow(dead_code)]
44
55struct Foo {
6 #[cfg(FALSE)]
6 #[cfg(false)]
77 bar: baz,
88 foo: isize,
99}
......@@ -15,18 +15,18 @@ struct Foo2 {
1515
1616enum Bar1 {
1717 Bar1_1,
18 #[cfg(FALSE)]
18 #[cfg(false)]
1919 Bar1_2(NotAType),
2020}
2121
2222enum Bar2 {
23 #[cfg(FALSE)]
23 #[cfg(false)]
2424 Bar2_1(NotAType),
2525}
2626
2727enum Bar3 {
2828 Bar3_1 {
29 #[cfg(FALSE)]
29 #[cfg(false)]
3030 foo: isize,
3131 bar: isize,
3232 }
tests/ui/issues/issue-16819.rs+1-1
......@@ -3,7 +3,7 @@
33// `#[cfg]` on struct field permits empty unusable struct
44
55struct S {
6 #[cfg(FALSE)]
6 #[cfg(false)]
77 a: int,
88}
99
tests/ui/lexer/error-stage.rs+1-1
......@@ -59,7 +59,7 @@ const _: () = sink! {
5959
6060// The invalid literals used to cause errors, but this was changed by #102944.
6161// Except for `0b010.0f32`, because it's a lexer error.
62#[cfg(FALSE)]
62#[cfg(false)]
6363fn configured_out() {
6464 "string"any_suffix; // OK
6565 10u123; // OK
tests/ui/link-native-libs/link-attr-validation-late.rs+1-1
......@@ -9,7 +9,7 @@ extern "C" {}
99#[link(name = "foo", name = "bar")] //~ ERROR multiple `name` arguments
1010#[link(name = "...", kind = "dylib", kind = "bar")] //~ ERROR multiple `kind` arguments
1111#[link(name = "...", modifiers = "+verbatim", modifiers = "bar")] //~ ERROR multiple `modifiers` arguments
12#[link(name = "...", cfg(FALSE), cfg(FALSE))] //~ ERROR multiple `cfg` arguments
12#[link(name = "...", cfg(false), cfg(false))] //~ ERROR multiple `cfg` arguments
1313#[link(wasm_import_module = "foo", wasm_import_module = "bar")] //~ ERROR multiple `wasm_import_module` arguments
1414extern "C" {}
1515
tests/ui/link-native-libs/link-attr-validation-late.stderr+1-1
......@@ -31,7 +31,7 @@ LL | #[link(name = "...", modifiers = "+verbatim", modifiers = "bar")]
3131error: multiple `cfg` arguments in a single `#[link]` attribute
3232 --> $DIR/link-attr-validation-late.rs:12:34
3333 |
34LL | #[link(name = "...", cfg(FALSE), cfg(FALSE))]
34LL | #[link(name = "...", cfg(false), cfg(false))]
3535 | ^^^^^^^^^^
3636
3737error: multiple `wasm_import_module` arguments in a single `#[link]` attribute
tests/ui/lint/inert-attr-macro.rs-1
......@@ -1,6 +1,5 @@
11//@ check-pass
22
3#![feature(cfg_boolean_literals)]
43#![warn(unused)]
54
65macro_rules! foo {
tests/ui/lint/inert-attr-macro.stderr+7-7
......@@ -1,41 +1,41 @@
11warning: unused attribute `inline`
2 --> $DIR/inert-attr-macro.rs:11:5
2 --> $DIR/inert-attr-macro.rs:10:5
33 |
44LL | #[inline] foo!();
55 | ^^^^^^^^^
66 |
77note: the built-in attribute `inline` will be ignored, since it's applied to the macro invocation `foo`
8 --> $DIR/inert-attr-macro.rs:11:15
8 --> $DIR/inert-attr-macro.rs:10:15
99 |
1010LL | #[inline] foo!();
1111 | ^^^
1212note: the lint level is defined here
13 --> $DIR/inert-attr-macro.rs:4:9
13 --> $DIR/inert-attr-macro.rs:3:9
1414 |
1515LL | #![warn(unused)]
1616 | ^^^^^^
1717 = note: `#[warn(unused_attributes)]` implied by `#[warn(unused)]`
1818
1919warning: unused attribute `allow`
20 --> $DIR/inert-attr-macro.rs:15:5
20 --> $DIR/inert-attr-macro.rs:14:5
2121 |
2222LL | #[allow(warnings)] #[inline] foo!();
2323 | ^^^^^^^^^^^^^^^^^^
2424 |
2525note: the built-in attribute `allow` will be ignored, since it's applied to the macro invocation `foo`
26 --> $DIR/inert-attr-macro.rs:15:34
26 --> $DIR/inert-attr-macro.rs:14:34
2727 |
2828LL | #[allow(warnings)] #[inline] foo!();
2929 | ^^^
3030
3131warning: unused attribute `inline`
32 --> $DIR/inert-attr-macro.rs:15:24
32 --> $DIR/inert-attr-macro.rs:14:24
3333 |
3434LL | #[allow(warnings)] #[inline] foo!();
3535 | ^^^^^^^^^
3636 |
3737note: the built-in attribute `inline` will be ignored, since it's applied to the macro invocation `foo`
38 --> $DIR/inert-attr-macro.rs:15:34
38 --> $DIR/inert-attr-macro.rs:14:34
3939 |
4040LL | #[allow(warnings)] #[inline] foo!();
4141 | ^^^
tests/ui/lint/rfc-2383-lint-reason/no_ice_for_partial_compiler_runs.rs+1
......@@ -1,6 +1,7 @@
11// This ensures that ICEs like rust#94953 don't happen
22//@ check-pass
33//@ compile-flags: -Z unpretty=expanded
4//@ edition: 2015
45
56// This `expect` will create an expectation with an unstable expectation id
67#[expect(while_true)]
tests/ui/lint/rfc-2383-lint-reason/no_ice_for_partial_compiler_runs.stdout+1
......@@ -7,6 +7,7 @@ extern crate std;
77// This ensures that ICEs like rust#94953 don't happen
88//@ check-pass
99//@ compile-flags: -Z unpretty=expanded
10//@ edition: 2015
1011
1112// This `expect` will create an expectation with an unstable expectation id
1213#[expect(while_true)]
tests/ui/lint/unused/unused-attr-macro-rules.rs+1-1
......@@ -17,7 +17,7 @@ macro_rules! foo2 {
1717 () => {};
1818}
1919
20#[cfg(FALSE)]
20#[cfg(false)]
2121macro_rules! foo {
2222 () => {};
2323}
tests/ui/macros/genercs-in-path-with-prettry-hir.rs+1
......@@ -1,4 +1,5 @@
11//@ compile-flags: -Zunpretty=hir
2//@ edition: 2015
23
34// issue#97006
45
tests/ui/macros/genercs-in-path-with-prettry-hir.stderr+1-1
......@@ -1,5 +1,5 @@
11error: unexpected generic arguments in path
2 --> $DIR/genercs-in-path-with-prettry-hir.rs:12:10
2 --> $DIR/genercs-in-path-with-prettry-hir.rs:13:10
33 |
44LL | m!(inline<u8>);
55 | ^^^^
tests/ui/macros/genercs-in-path-with-prettry-hir.stdout+1
......@@ -3,6 +3,7 @@ use ::std::prelude::rust_2015::*;
33#[macro_use]
44extern crate std;
55//@ compile-flags: -Zunpretty=hir
6//@ edition: 2015
67
78// issue#97006
89
tests/ui/macros/lint-trailing-macro-call.rs+1-1
......@@ -6,7 +6,7 @@
66
77macro_rules! expand_it {
88 () => {
9 #[cfg(FALSE)] 25; //~ WARN trailing semicolon in macro
9 #[cfg(false)] 25; //~ WARN trailing semicolon in macro
1010 //~| WARN this was previously
1111 }
1212}
tests/ui/macros/lint-trailing-macro-call.stderr+2-2
......@@ -1,7 +1,7 @@
11warning: trailing semicolon in macro used in expression position
22 --> $DIR/lint-trailing-macro-call.rs:9:25
33 |
4LL | #[cfg(FALSE)] 25;
4LL | #[cfg(false)] 25;
55 | ^
66...
77LL | expand_it!()
......@@ -20,7 +20,7 @@ Future incompatibility report: Future breakage diagnostic:
2020warning: trailing semicolon in macro used in expression position
2121 --> $DIR/lint-trailing-macro-call.rs:9:25
2222 |
23LL | #[cfg(FALSE)] 25;
23LL | #[cfg(false)] 25;
2424 | ^
2525...
2626LL | expand_it!()
tests/ui/macros/macro-attributes.rs+1-1
......@@ -9,7 +9,7 @@ macro_rules! compiles_fine {
99
1010 // check that the attributes are recognised by requiring this
1111 // to be removed to avoid a compile error
12 #[cfg(FALSE)]
12 #[cfg(false)]
1313 static MISTYPED: () = "foo";
1414 }
1515}
tests/ui/macros/macro-inner-attributes.rs+1-1
......@@ -5,7 +5,7 @@ macro_rules! test { ($nm:ident,
55 $i:item) => (mod $nm { #![$a] $i }); }
66
77test!(a,
8 #[cfg(FALSE)],
8 #[cfg(false)],
99 pub fn bar() { });
1010
1111test!(b,
tests/ui/macros/macro-outer-attributes.rs+1-1
......@@ -5,7 +5,7 @@ macro_rules! test { ($nm:ident,
55 $i:item) => (mod $nm { #[$a] $i }); }
66
77test!(a,
8 #[cfg(FALSE)],
8 #[cfg(false)],
99 pub fn bar() { });
1010
1111test!(b,
tests/ui/macros/macro-outer-attributes.stderr+1-1
......@@ -16,7 +16,7 @@ LL | $i:item) => (mod $nm { #[$a] $i }); }
1616 | ^^^^^
1717LL |
1818LL | / test!(a,
19LL | | #[cfg(FALSE)],
19LL | | #[cfg(false)],
2020LL | | pub fn bar() { });
2121 | |_______________________- in this macro invocation
2222 = note: this error originates in the macro `test` (in Nightly builds, run with -Z macro-backtrace for more info)
tests/ui/macros/macro-with-attrs2.rs+1-1
......@@ -1,6 +1,6 @@
11//@ run-pass
22
3#[cfg(FALSE)]
3#[cfg(false)]
44macro_rules! foo { () => (1) }
55
66#[cfg(not(FALSE))]
tests/ui/macros/rfc-2011-nicer-assert-messages/non-consuming-methods-have-optimized-codegen.rs+1
......@@ -1,5 +1,6 @@
11//@ check-pass
22//@ compile-flags: -Z unpretty=expanded
3//@ edition: 2015
34
45#![feature(core_intrinsics, generic_assert)]
56
tests/ui/macros/rfc-2011-nicer-assert-messages/non-consuming-methods-have-optimized-codegen.stdout+1
......@@ -2,6 +2,7 @@
22#![no_std]
33//@ check-pass
44//@ compile-flags: -Z unpretty=expanded
5//@ edition: 2015
56
67#![feature(core_intrinsics, generic_assert)]
78#[prelude_import]
tests/ui/match/issue-82392.rs+1
......@@ -1,6 +1,7 @@
11// https://github.com/rust-lang/rust/issues/82329
22//@ compile-flags: -Zunpretty=hir,typed
33//@ check-pass
4//@ edition:2015
45
56pub fn main() {
67 if true {
tests/ui/match/issue-82392.stdout+1
......@@ -5,6 +5,7 @@ extern crate std;
55// https://github.com/rust-lang/rust/issues/82329
66//@ compile-flags: -Zunpretty=hir,typed
77//@ check-pass
8//@ edition:2015
89
910fn main() ({
1011 (if (true as bool)
tests/ui/nested-cfg-attrs.rs+1-1
......@@ -1,4 +1,4 @@
1#[cfg_attr(all(), cfg_attr(all(), cfg(FALSE)))]
1#[cfg_attr(all(), cfg_attr(all(), cfg(false)))]
22fn f() {}
33
44fn main() { f() } //~ ERROR cannot find function `f` in this scope
tests/ui/or-patterns/fn-param-wrap-parens.fixed+1-1
......@@ -9,5 +9,5 @@ fn main() {}
99enum E { A, B }
1010use E::*;
1111
12#[cfg(FALSE)]
12#[cfg(false)]
1313fn fun1((A | B): E) {} //~ ERROR top-level or-patterns are not allowed
tests/ui/or-patterns/fn-param-wrap-parens.rs+1-1
......@@ -9,5 +9,5 @@ fn main() {}
99enum E { A, B }
1010use E::*;
1111
12#[cfg(FALSE)]
12#[cfg(false)]
1313fn fun1(A | B: E) {} //~ ERROR top-level or-patterns are not allowed
tests/ui/or-patterns/or-patterns-syntactic-pass.rs+1-1
......@@ -18,7 +18,7 @@ accept_pat!([p | q]);
1818
1919// Non-macro tests:
2020
21#[cfg(FALSE)]
21#[cfg(false)]
2222fn or_patterns() {
2323 // Top level of `let`:
2424 let (| A | B);
tests/ui/or-patterns/remove-leading-vert.fixed+2-2
......@@ -6,7 +6,7 @@
66
77fn main() {}
88
9#[cfg(FALSE)]
9#[cfg(false)]
1010fn leading() {
1111 fn fun1( A: E) {} //~ ERROR top-level or-patterns are not allowed
1212 fn fun2( A: E) {} //~ ERROR unexpected `||` before function parameter
......@@ -21,7 +21,7 @@ fn leading() {
2121 let NS { f: | A }: NS; //~ ERROR unexpected token `||` in pattern
2222}
2323
24#[cfg(FALSE)]
24#[cfg(false)]
2525fn trailing() {
2626 let ( A ): E; //~ ERROR a trailing `|` is not allowed in an or-pattern
2727 let (a ,): (E,); //~ ERROR a trailing `|` is not allowed in an or-pattern
tests/ui/or-patterns/remove-leading-vert.rs+2-2
......@@ -6,7 +6,7 @@
66
77fn main() {}
88
9#[cfg(FALSE)]
9#[cfg(false)]
1010fn leading() {
1111 fn fun1( | A: E) {} //~ ERROR top-level or-patterns are not allowed
1212 fn fun2( || A: E) {} //~ ERROR unexpected `||` before function parameter
......@@ -21,7 +21,7 @@ fn leading() {
2121 let NS { f: || A }: NS; //~ ERROR unexpected token `||` in pattern
2222}
2323
24#[cfg(FALSE)]
24#[cfg(false)]
2525fn trailing() {
2626 let ( A | ): E; //~ ERROR a trailing `|` is not allowed in an or-pattern
2727 let (a |,): (E,); //~ ERROR a trailing `|` is not allowed in an or-pattern
tests/ui/parser/assoc/assoc-const-underscore-syntactic-pass.rs+1-1
......@@ -4,7 +4,7 @@
44
55fn main() {}
66
7#[cfg(FALSE)]
7#[cfg(false)]
88const _: () = {
99 pub trait A {
1010 const _: () = ();
tests/ui/parser/assoc/assoc-static-syntactic-fail.rs+3-3
......@@ -2,7 +2,7 @@
22
33fn main() {}
44
5#[cfg(FALSE)]
5#[cfg(false)]
66impl S {
77 static IA: u8 = 0; //~ ERROR associated `static` items are not allowed
88 static IB: u8; //~ ERROR associated `static` items are not allowed
......@@ -12,7 +12,7 @@ impl S {
1212 //~^ ERROR a static item cannot be `default`
1313}
1414
15#[cfg(FALSE)]
15#[cfg(false)]
1616trait T {
1717 static TA: u8 = 0; //~ ERROR associated `static` items are not allowed
1818 static TB: u8; //~ ERROR associated `static` items are not allowed
......@@ -22,7 +22,7 @@ trait T {
2222 //~^ ERROR a static item cannot be `default`
2323}
2424
25#[cfg(FALSE)]
25#[cfg(false)]
2626impl T for S {
2727 static TA: u8 = 0; //~ ERROR associated `static` items are not allowed
2828 static TB: u8; //~ ERROR associated `static` items are not allowed
tests/ui/parser/attribute/attr-stmt-expr-attr-bad.rs+45-45
......@@ -1,108 +1,108 @@
11fn main() {}
22
3#[cfg(FALSE)] fn e() { let _ = [#[attr]]; }
3#[cfg(false)] fn e() { let _ = [#[attr]]; }
44//~^ ERROR expected expression, found `]`
5#[cfg(FALSE)] fn e() { let _ = foo#[attr](); }
5#[cfg(false)] fn e() { let _ = foo#[attr](); }
66//~^ ERROR expected one of
7#[cfg(FALSE)] fn e() { let _ = foo(#![attr]); }
7#[cfg(false)] fn e() { let _ = foo(#![attr]); }
88//~^ ERROR an inner attribute is not permitted in this context
99//~| ERROR an inner attribute is not permitted in this context
1010//~| ERROR expected expression, found `)`
11#[cfg(FALSE)] fn e() { let _ = x.foo(#![attr]); }
11#[cfg(false)] fn e() { let _ = x.foo(#![attr]); }
1212//~^ ERROR an inner attribute is not permitted in this context
1313//~| ERROR expected expression, found `)`
14#[cfg(FALSE)] fn e() { let _ = 0 + #![attr] 0; }
14#[cfg(false)] fn e() { let _ = 0 + #![attr] 0; }
1515//~^ ERROR an inner attribute is not permitted in this context
16#[cfg(FALSE)] fn e() { let _ = !#![attr] 0; }
16#[cfg(false)] fn e() { let _ = !#![attr] 0; }
1717//~^ ERROR an inner attribute is not permitted in this context
18#[cfg(FALSE)] fn e() { let _ = -#![attr] 0; }
18#[cfg(false)] fn e() { let _ = -#![attr] 0; }
1919//~^ ERROR an inner attribute is not permitted in this context
20#[cfg(FALSE)] fn e() { let _ = x #![attr] as Y; }
20#[cfg(false)] fn e() { let _ = x #![attr] as Y; }
2121//~^ ERROR expected one of
22#[cfg(FALSE)] fn e() { let _ = || #![attr] foo; }
22#[cfg(false)] fn e() { let _ = || #![attr] foo; }
2323//~^ ERROR an inner attribute is not permitted in this context
24#[cfg(FALSE)] fn e() { let _ = move || #![attr] foo; }
24#[cfg(false)] fn e() { let _ = move || #![attr] foo; }
2525//~^ ERROR an inner attribute is not permitted in this context
26#[cfg(FALSE)] fn e() { let _ = || #![attr] {foo}; }
26#[cfg(false)] fn e() { let _ = || #![attr] {foo}; }
2727//~^ ERROR an inner attribute is not permitted in this context
28#[cfg(FALSE)] fn e() { let _ = move || #![attr] {foo}; }
28#[cfg(false)] fn e() { let _ = move || #![attr] {foo}; }
2929//~^ ERROR an inner attribute is not permitted in this context
30#[cfg(FALSE)] fn e() { let _ = #[attr] ..#[attr] 0; }
30#[cfg(false)] fn e() { let _ = #[attr] ..#[attr] 0; }
3131//~^ ERROR attributes are not allowed on range expressions starting with `..`
32#[cfg(FALSE)] fn e() { let _ = #[attr] ..; }
32#[cfg(false)] fn e() { let _ = #[attr] ..; }
3333//~^ ERROR attributes are not allowed on range expressions starting with `..`
34#[cfg(FALSE)] fn e() { let _ = #[attr] &#![attr] 0; }
34#[cfg(false)] fn e() { let _ = #[attr] &#![attr] 0; }
3535//~^ ERROR an inner attribute is not permitted in this context
36#[cfg(FALSE)] fn e() { let _ = #[attr] &mut #![attr] 0; }
36#[cfg(false)] fn e() { let _ = #[attr] &mut #![attr] 0; }
3737//~^ ERROR an inner attribute is not permitted in this context
38#[cfg(FALSE)] fn e() { let _ = if 0 #[attr] {}; }
38#[cfg(false)] fn e() { let _ = if 0 #[attr] {}; }
3939//~^ ERROR outer attributes are not allowed on `if`
40#[cfg(FALSE)] fn e() { let _ = if 0 {#![attr]}; }
40#[cfg(false)] fn e() { let _ = if 0 {#![attr]}; }
4141//~^ ERROR an inner attribute is not permitted in this context
42#[cfg(FALSE)] fn e() { let _ = if 0 {} #[attr] else {}; }
42#[cfg(false)] fn e() { let _ = if 0 {} #[attr] else {}; }
4343//~^ ERROR expected one of
44#[cfg(FALSE)] fn e() { let _ = if 0 {} else #[attr] {}; }
44#[cfg(false)] fn e() { let _ = if 0 {} else #[attr] {}; }
4545//~^ ERROR outer attributes are not allowed on `if`
46#[cfg(FALSE)] fn e() { let _ = if 0 {} else {#![attr]}; }
46#[cfg(false)] fn e() { let _ = if 0 {} else {#![attr]}; }
4747//~^ ERROR an inner attribute is not permitted in this context
48#[cfg(FALSE)] fn e() { let _ = if 0 {} else #[attr] if 0 {}; }
48#[cfg(false)] fn e() { let _ = if 0 {} else #[attr] if 0 {}; }
4949//~^ ERROR outer attributes are not allowed on `if`
50#[cfg(FALSE)] fn e() { let _ = if 0 {} else if 0 #[attr] {}; }
50#[cfg(false)] fn e() { let _ = if 0 {} else if 0 #[attr] {}; }
5151//~^ ERROR outer attributes are not allowed on `if`
52#[cfg(FALSE)] fn e() { let _ = if 0 {} else if 0 {#![attr]}; }
52#[cfg(false)] fn e() { let _ = if 0 {} else if 0 {#![attr]}; }
5353//~^ ERROR an inner attribute is not permitted in this context
54#[cfg(FALSE)] fn e() { let _ = if let _ = 0 #[attr] {}; }
54#[cfg(false)] fn e() { let _ = if let _ = 0 #[attr] {}; }
5555//~^ ERROR outer attributes are not allowed on `if`
56#[cfg(FALSE)] fn e() { let _ = if let _ = 0 {#![attr]}; }
56#[cfg(false)] fn e() { let _ = if let _ = 0 {#![attr]}; }
5757//~^ ERROR an inner attribute is not permitted in this context
58#[cfg(FALSE)] fn e() { let _ = if let _ = 0 {} #[attr] else {}; }
58#[cfg(false)] fn e() { let _ = if let _ = 0 {} #[attr] else {}; }
5959//~^ ERROR expected one of
60#[cfg(FALSE)] fn e() { let _ = if let _ = 0 {} else #[attr] {}; }
60#[cfg(false)] fn e() { let _ = if let _ = 0 {} else #[attr] {}; }
6161//~^ ERROR outer attributes are not allowed on `if`
62#[cfg(FALSE)] fn e() { let _ = if let _ = 0 {} else {#![attr]}; }
62#[cfg(false)] fn e() { let _ = if let _ = 0 {} else {#![attr]}; }
6363//~^ ERROR an inner attribute is not permitted in this context
64#[cfg(FALSE)] fn e() { let _ = if let _ = 0 {} else #[attr] if let _ = 0 {}; }
64#[cfg(false)] fn e() { let _ = if let _ = 0 {} else #[attr] if let _ = 0 {}; }
6565//~^ ERROR outer attributes are not allowed on `if`
66#[cfg(FALSE)] fn e() { let _ = if let _ = 0 {} else if let _ = 0 #[attr] {}; }
66#[cfg(false)] fn e() { let _ = if let _ = 0 {} else if let _ = 0 #[attr] {}; }
6767//~^ ERROR outer attributes are not allowed on `if`
68#[cfg(FALSE)] fn e() { let _ = if let _ = 0 {} else if let _ = 0 {#![attr]}; }
68#[cfg(false)] fn e() { let _ = if let _ = 0 {} else if let _ = 0 {#![attr]}; }
6969//~^ ERROR an inner attribute is not permitted in this context
7070
71#[cfg(FALSE)] fn s() { #[attr] #![attr] let _ = 0; }
71#[cfg(false)] fn s() { #[attr] #![attr] let _ = 0; }
7272//~^ ERROR an inner attribute is not permitted following an outer attribute
73#[cfg(FALSE)] fn s() { #[attr] #![attr] 0; }
73#[cfg(false)] fn s() { #[attr] #![attr] 0; }
7474//~^ ERROR an inner attribute is not permitted following an outer attribute
75#[cfg(FALSE)] fn s() { #[attr] #![attr] foo!(); }
75#[cfg(false)] fn s() { #[attr] #![attr] foo!(); }
7676//~^ ERROR an inner attribute is not permitted following an outer attribute
77#[cfg(FALSE)] fn s() { #[attr] #![attr] foo![]; }
77#[cfg(false)] fn s() { #[attr] #![attr] foo![]; }
7878//~^ ERROR an inner attribute is not permitted following an outer attribute
79#[cfg(FALSE)] fn s() { #[attr] #![attr] foo!{}; }
79#[cfg(false)] fn s() { #[attr] #![attr] foo!{}; }
8080//~^ ERROR an inner attribute is not permitted following an outer attribute
8181
8282// FIXME: Allow attributes in pattern constexprs?
8383// note: requires parens in patterns to allow disambiguation
8484
85#[cfg(FALSE)] fn e() { match 0 { 0..=#[attr] 10 => () } }
85#[cfg(false)] fn e() { match 0 { 0..=#[attr] 10 => () } }
8686//~^ ERROR inclusive range with no end
8787//~| ERROR expected one of `=>`, `if`, or `|`, found `#`
88#[cfg(FALSE)] fn e() { match 0 { 0..=#[attr] -10 => () } }
88#[cfg(false)] fn e() { match 0 { 0..=#[attr] -10 => () } }
8989//~^ ERROR inclusive range with no end
9090//~| ERROR expected one of `=>`, `if`, or `|`, found `#`
91#[cfg(FALSE)] fn e() { match 0 { 0..=-#[attr] 10 => () } }
91#[cfg(false)] fn e() { match 0 { 0..=-#[attr] 10 => () } }
9292//~^ ERROR unexpected token: `#`
93#[cfg(FALSE)] fn e() { match 0 { 0..=#[attr] FOO => () } }
93#[cfg(false)] fn e() { match 0 { 0..=#[attr] FOO => () } }
9494//~^ ERROR inclusive range with no end
9595//~| ERROR expected one of `=>`, `if`, or `|`, found `#`
9696
97#[cfg(FALSE)] fn e() { let _ = x.#![attr]foo(); }
97#[cfg(false)] fn e() { let _ = x.#![attr]foo(); }
9898//~^ ERROR unexpected token: `#`
9999//~| ERROR expected one of `.`
100#[cfg(FALSE)] fn e() { let _ = x.#[attr]foo(); }
100#[cfg(false)] fn e() { let _ = x.#[attr]foo(); }
101101//~^ ERROR unexpected token: `#`
102102//~| ERROR expected one of `.`
103103
104104// make sure we don't catch this bug again...
105#[cfg(FALSE)] fn e() { { fn foo() { #[attr]; } } }
105#[cfg(false)] fn e() { { fn foo() { #[attr]; } } }
106106//~^ ERROR expected statement after outer attribute
107#[cfg(FALSE)] fn e() { { fn foo() { #[attr] } } }
107#[cfg(false)] fn e() { { fn foo() { #[attr] } } }
108108//~^ ERROR expected statement after outer attribute
tests/ui/parser/attribute/attr-stmt-expr-attr-bad.stderr+75-75
......@@ -1,19 +1,19 @@
11error: expected expression, found `]`
22 --> $DIR/attr-stmt-expr-attr-bad.rs:3:40
33 |
4LL | #[cfg(FALSE)] fn e() { let _ = [#[attr]]; }
4LL | #[cfg(false)] fn e() { let _ = [#[attr]]; }
55 | ^ expected expression
66
77error: expected one of `!`, `.`, `::`, `;`, `?`, `else`, `{`, or an operator, found `#`
88 --> $DIR/attr-stmt-expr-attr-bad.rs:5:35
99 |
10LL | #[cfg(FALSE)] fn e() { let _ = foo#[attr](); }
10LL | #[cfg(false)] fn e() { let _ = foo#[attr](); }
1111 | ^ expected one of 8 possible tokens
1212
1313error: an inner attribute is not permitted in this context
1414 --> $DIR/attr-stmt-expr-attr-bad.rs:7:36
1515 |
16LL | #[cfg(FALSE)] fn e() { let _ = foo(#![attr]); }
16LL | #[cfg(false)] fn e() { let _ = foo(#![attr]); }
1717 | ^^^^^^^^
1818 |
1919 = note: inner attributes, like `#![no_std]`, annotate the item enclosing them, and are usually found at the beginning of source files
......@@ -22,7 +22,7 @@ LL | #[cfg(FALSE)] fn e() { let _ = foo(#![attr]); }
2222error: an inner attribute is not permitted in this context
2323 --> $DIR/attr-stmt-expr-attr-bad.rs:7:36
2424 |
25LL | #[cfg(FALSE)] fn e() { let _ = foo(#![attr]); }
25LL | #[cfg(false)] fn e() { let _ = foo(#![attr]); }
2626 | ^^^^^^^^
2727 |
2828 = note: inner attributes, like `#![no_std]`, annotate the item enclosing them, and are usually found at the beginning of source files
......@@ -32,13 +32,13 @@ LL | #[cfg(FALSE)] fn e() { let _ = foo(#![attr]); }
3232error: expected expression, found `)`
3333 --> $DIR/attr-stmt-expr-attr-bad.rs:7:44
3434 |
35LL | #[cfg(FALSE)] fn e() { let _ = foo(#![attr]); }
35LL | #[cfg(false)] fn e() { let _ = foo(#![attr]); }
3636 | ^ expected expression
3737
3838error: an inner attribute is not permitted in this context
3939 --> $DIR/attr-stmt-expr-attr-bad.rs:11:38
4040 |
41LL | #[cfg(FALSE)] fn e() { let _ = x.foo(#![attr]); }
41LL | #[cfg(false)] fn e() { let _ = x.foo(#![attr]); }
4242 | ^^^^^^^^
4343 |
4444 = note: inner attributes, like `#![no_std]`, annotate the item enclosing them, and are usually found at the beginning of source files
......@@ -47,13 +47,13 @@ LL | #[cfg(FALSE)] fn e() { let _ = x.foo(#![attr]); }
4747error: expected expression, found `)`
4848 --> $DIR/attr-stmt-expr-attr-bad.rs:11:46
4949 |
50LL | #[cfg(FALSE)] fn e() { let _ = x.foo(#![attr]); }
50LL | #[cfg(false)] fn e() { let _ = x.foo(#![attr]); }
5151 | ^ expected expression
5252
5353error: an inner attribute is not permitted in this context
5454 --> $DIR/attr-stmt-expr-attr-bad.rs:14:36
5555 |
56LL | #[cfg(FALSE)] fn e() { let _ = 0 + #![attr] 0; }
56LL | #[cfg(false)] fn e() { let _ = 0 + #![attr] 0; }
5757 | ^^^^^^^^
5858 |
5959 = note: inner attributes, like `#![no_std]`, annotate the item enclosing them, and are usually found at the beginning of source files
......@@ -62,7 +62,7 @@ LL | #[cfg(FALSE)] fn e() { let _ = 0 + #![attr] 0; }
6262error: an inner attribute is not permitted in this context
6363 --> $DIR/attr-stmt-expr-attr-bad.rs:16:33
6464 |
65LL | #[cfg(FALSE)] fn e() { let _ = !#![attr] 0; }
65LL | #[cfg(false)] fn e() { let _ = !#![attr] 0; }
6666 | ^^^^^^^^
6767 |
6868 = note: inner attributes, like `#![no_std]`, annotate the item enclosing them, and are usually found at the beginning of source files
......@@ -71,7 +71,7 @@ LL | #[cfg(FALSE)] fn e() { let _ = !#![attr] 0; }
7171error: an inner attribute is not permitted in this context
7272 --> $DIR/attr-stmt-expr-attr-bad.rs:18:33
7373 |
74LL | #[cfg(FALSE)] fn e() { let _ = -#![attr] 0; }
74LL | #[cfg(false)] fn e() { let _ = -#![attr] 0; }
7575 | ^^^^^^^^
7676 |
7777 = note: inner attributes, like `#![no_std]`, annotate the item enclosing them, and are usually found at the beginning of source files
......@@ -80,13 +80,13 @@ LL | #[cfg(FALSE)] fn e() { let _ = -#![attr] 0; }
8080error: expected one of `!`, `.`, `::`, `;`, `?`, `else`, `{`, or an operator, found `#`
8181 --> $DIR/attr-stmt-expr-attr-bad.rs:20:34
8282 |
83LL | #[cfg(FALSE)] fn e() { let _ = x #![attr] as Y; }
83LL | #[cfg(false)] fn e() { let _ = x #![attr] as Y; }
8484 | ^ expected one of 8 possible tokens
8585
8686error: an inner attribute is not permitted in this context
8787 --> $DIR/attr-stmt-expr-attr-bad.rs:22:35
8888 |
89LL | #[cfg(FALSE)] fn e() { let _ = || #![attr] foo; }
89LL | #[cfg(false)] fn e() { let _ = || #![attr] foo; }
9090 | ^^^^^^^^
9191 |
9292 = note: inner attributes, like `#![no_std]`, annotate the item enclosing them, and are usually found at the beginning of source files
......@@ -95,7 +95,7 @@ LL | #[cfg(FALSE)] fn e() { let _ = || #![attr] foo; }
9595error: an inner attribute is not permitted in this context
9696 --> $DIR/attr-stmt-expr-attr-bad.rs:24:40
9797 |
98LL | #[cfg(FALSE)] fn e() { let _ = move || #![attr] foo; }
98LL | #[cfg(false)] fn e() { let _ = move || #![attr] foo; }
9999 | ^^^^^^^^
100100 |
101101 = note: inner attributes, like `#![no_std]`, annotate the item enclosing them, and are usually found at the beginning of source files
......@@ -104,7 +104,7 @@ LL | #[cfg(FALSE)] fn e() { let _ = move || #![attr] foo; }
104104error: an inner attribute is not permitted in this context
105105 --> $DIR/attr-stmt-expr-attr-bad.rs:26:35
106106 |
107LL | #[cfg(FALSE)] fn e() { let _ = || #![attr] {foo}; }
107LL | #[cfg(false)] fn e() { let _ = || #![attr] {foo}; }
108108 | ^^^^^^^^
109109 |
110110 = note: inner attributes, like `#![no_std]`, annotate the item enclosing them, and are usually found at the beginning of source files
......@@ -113,7 +113,7 @@ LL | #[cfg(FALSE)] fn e() { let _ = || #![attr] {foo}; }
113113error: an inner attribute is not permitted in this context
114114 --> $DIR/attr-stmt-expr-attr-bad.rs:28:40
115115 |
116LL | #[cfg(FALSE)] fn e() { let _ = move || #![attr] {foo}; }
116LL | #[cfg(false)] fn e() { let _ = move || #![attr] {foo}; }
117117 | ^^^^^^^^
118118 |
119119 = note: inner attributes, like `#![no_std]`, annotate the item enclosing them, and are usually found at the beginning of source files
......@@ -122,19 +122,19 @@ LL | #[cfg(FALSE)] fn e() { let _ = move || #![attr] {foo}; }
122122error: attributes are not allowed on range expressions starting with `..`
123123 --> $DIR/attr-stmt-expr-attr-bad.rs:30:40
124124 |
125LL | #[cfg(FALSE)] fn e() { let _ = #[attr] ..#[attr] 0; }
125LL | #[cfg(false)] fn e() { let _ = #[attr] ..#[attr] 0; }
126126 | ^^
127127
128128error: attributes are not allowed on range expressions starting with `..`
129129 --> $DIR/attr-stmt-expr-attr-bad.rs:32:40
130130 |
131LL | #[cfg(FALSE)] fn e() { let _ = #[attr] ..; }
131LL | #[cfg(false)] fn e() { let _ = #[attr] ..; }
132132 | ^^
133133
134134error: an inner attribute is not permitted in this context
135135 --> $DIR/attr-stmt-expr-attr-bad.rs:34:41
136136 |
137LL | #[cfg(FALSE)] fn e() { let _ = #[attr] &#![attr] 0; }
137LL | #[cfg(false)] fn e() { let _ = #[attr] &#![attr] 0; }
138138 | ^^^^^^^^
139139 |
140140 = note: inner attributes, like `#![no_std]`, annotate the item enclosing them, and are usually found at the beginning of source files
......@@ -143,7 +143,7 @@ LL | #[cfg(FALSE)] fn e() { let _ = #[attr] &#![attr] 0; }
143143error: an inner attribute is not permitted in this context
144144 --> $DIR/attr-stmt-expr-attr-bad.rs:36:45
145145 |
146LL | #[cfg(FALSE)] fn e() { let _ = #[attr] &mut #![attr] 0; }
146LL | #[cfg(false)] fn e() { let _ = #[attr] &mut #![attr] 0; }
147147 | ^^^^^^^^
148148 |
149149 = note: inner attributes, like `#![no_std]`, annotate the item enclosing them, and are usually found at the beginning of source files
......@@ -152,21 +152,21 @@ LL | #[cfg(FALSE)] fn e() { let _ = #[attr] &mut #![attr] 0; }
152152error: outer attributes are not allowed on `if` and `else` branches
153153 --> $DIR/attr-stmt-expr-attr-bad.rs:38:37
154154 |
155LL | #[cfg(FALSE)] fn e() { let _ = if 0 #[attr] {}; }
155LL | #[cfg(false)] fn e() { let _ = if 0 #[attr] {}; }
156156 | -- ^^^^^^^ -- the attributes are attached to this branch
157157 | |
158158 | the branch belongs to this `if`
159159 |
160160help: remove the attributes
161161 |
162LL - #[cfg(FALSE)] fn e() { let _ = if 0 #[attr] {}; }
163LL + #[cfg(FALSE)] fn e() { let _ = if 0 {}; }
162LL - #[cfg(false)] fn e() { let _ = if 0 #[attr] {}; }
163LL + #[cfg(false)] fn e() { let _ = if 0 {}; }
164164 |
165165
166166error: an inner attribute is not permitted in this context
167167 --> $DIR/attr-stmt-expr-attr-bad.rs:40:38
168168 |
169LL | #[cfg(FALSE)] fn e() { let _ = if 0 {#![attr]}; }
169LL | #[cfg(false)] fn e() { let _ = if 0 {#![attr]}; }
170170 | ^^^^^^^^
171171 |
172172 = note: inner attributes, like `#![no_std]`, annotate the item enclosing them, and are usually found at the beginning of source files
......@@ -175,27 +175,27 @@ LL | #[cfg(FALSE)] fn e() { let _ = if 0 {#![attr]}; }
175175error: expected one of `.`, `;`, `?`, `else`, or an operator, found `#`
176176 --> $DIR/attr-stmt-expr-attr-bad.rs:42:40
177177 |
178LL | #[cfg(FALSE)] fn e() { let _ = if 0 {} #[attr] else {}; }
178LL | #[cfg(false)] fn e() { let _ = if 0 {} #[attr] else {}; }
179179 | ^ expected one of `.`, `;`, `?`, `else`, or an operator
180180
181181error: outer attributes are not allowed on `if` and `else` branches
182182 --> $DIR/attr-stmt-expr-attr-bad.rs:44:45
183183 |
184LL | #[cfg(FALSE)] fn e() { let _ = if 0 {} else #[attr] {}; }
184LL | #[cfg(false)] fn e() { let _ = if 0 {} else #[attr] {}; }
185185 | ---- ^^^^^^^ -- the attributes are attached to this branch
186186 | |
187187 | the branch belongs to this `else`
188188 |
189189help: remove the attributes
190190 |
191LL - #[cfg(FALSE)] fn e() { let _ = if 0 {} else #[attr] {}; }
192LL + #[cfg(FALSE)] fn e() { let _ = if 0 {} else {}; }
191LL - #[cfg(false)] fn e() { let _ = if 0 {} else #[attr] {}; }
192LL + #[cfg(false)] fn e() { let _ = if 0 {} else {}; }
193193 |
194194
195195error: an inner attribute is not permitted in this context
196196 --> $DIR/attr-stmt-expr-attr-bad.rs:46:46
197197 |
198LL | #[cfg(FALSE)] fn e() { let _ = if 0 {} else {#![attr]}; }
198LL | #[cfg(false)] fn e() { let _ = if 0 {} else {#![attr]}; }
199199 | ^^^^^^^^
200200 |
201201 = note: inner attributes, like `#![no_std]`, annotate the item enclosing them, and are usually found at the beginning of source files
......@@ -204,35 +204,35 @@ LL | #[cfg(FALSE)] fn e() { let _ = if 0 {} else {#![attr]}; }
204204error: outer attributes are not allowed on `if` and `else` branches
205205 --> $DIR/attr-stmt-expr-attr-bad.rs:48:45
206206 |
207LL | #[cfg(FALSE)] fn e() { let _ = if 0 {} else #[attr] if 0 {}; }
207LL | #[cfg(false)] fn e() { let _ = if 0 {} else #[attr] if 0 {}; }
208208 | ---- ^^^^^^^ ------- the attributes are attached to this branch
209209 | |
210210 | the branch belongs to this `else`
211211 |
212212help: remove the attributes
213213 |
214LL - #[cfg(FALSE)] fn e() { let _ = if 0 {} else #[attr] if 0 {}; }
215LL + #[cfg(FALSE)] fn e() { let _ = if 0 {} else if 0 {}; }
214LL - #[cfg(false)] fn e() { let _ = if 0 {} else #[attr] if 0 {}; }
215LL + #[cfg(false)] fn e() { let _ = if 0 {} else if 0 {}; }
216216 |
217217
218218error: outer attributes are not allowed on `if` and `else` branches
219219 --> $DIR/attr-stmt-expr-attr-bad.rs:50:50
220220 |
221LL | #[cfg(FALSE)] fn e() { let _ = if 0 {} else if 0 #[attr] {}; }
221LL | #[cfg(false)] fn e() { let _ = if 0 {} else if 0 #[attr] {}; }
222222 | -- ^^^^^^^ -- the attributes are attached to this branch
223223 | |
224224 | the branch belongs to this `if`
225225 |
226226help: remove the attributes
227227 |
228LL - #[cfg(FALSE)] fn e() { let _ = if 0 {} else if 0 #[attr] {}; }
229LL + #[cfg(FALSE)] fn e() { let _ = if 0 {} else if 0 {}; }
228LL - #[cfg(false)] fn e() { let _ = if 0 {} else if 0 #[attr] {}; }
229LL + #[cfg(false)] fn e() { let _ = if 0 {} else if 0 {}; }
230230 |
231231
232232error: an inner attribute is not permitted in this context
233233 --> $DIR/attr-stmt-expr-attr-bad.rs:52:51
234234 |
235LL | #[cfg(FALSE)] fn e() { let _ = if 0 {} else if 0 {#![attr]}; }
235LL | #[cfg(false)] fn e() { let _ = if 0 {} else if 0 {#![attr]}; }
236236 | ^^^^^^^^
237237 |
238238 = note: inner attributes, like `#![no_std]`, annotate the item enclosing them, and are usually found at the beginning of source files
......@@ -241,21 +241,21 @@ LL | #[cfg(FALSE)] fn e() { let _ = if 0 {} else if 0 {#![attr]}; }
241241error: outer attributes are not allowed on `if` and `else` branches
242242 --> $DIR/attr-stmt-expr-attr-bad.rs:54:45
243243 |
244LL | #[cfg(FALSE)] fn e() { let _ = if let _ = 0 #[attr] {}; }
244LL | #[cfg(false)] fn e() { let _ = if let _ = 0 #[attr] {}; }
245245 | -- ^^^^^^^ -- the attributes are attached to this branch
246246 | |
247247 | the branch belongs to this `if`
248248 |
249249help: remove the attributes
250250 |
251LL - #[cfg(FALSE)] fn e() { let _ = if let _ = 0 #[attr] {}; }
252LL + #[cfg(FALSE)] fn e() { let _ = if let _ = 0 {}; }
251LL - #[cfg(false)] fn e() { let _ = if let _ = 0 #[attr] {}; }
252LL + #[cfg(false)] fn e() { let _ = if let _ = 0 {}; }
253253 |
254254
255255error: an inner attribute is not permitted in this context
256256 --> $DIR/attr-stmt-expr-attr-bad.rs:56:46
257257 |
258LL | #[cfg(FALSE)] fn e() { let _ = if let _ = 0 {#![attr]}; }
258LL | #[cfg(false)] fn e() { let _ = if let _ = 0 {#![attr]}; }
259259 | ^^^^^^^^
260260 |
261261 = note: inner attributes, like `#![no_std]`, annotate the item enclosing them, and are usually found at the beginning of source files
......@@ -264,27 +264,27 @@ LL | #[cfg(FALSE)] fn e() { let _ = if let _ = 0 {#![attr]}; }
264264error: expected one of `.`, `;`, `?`, `else`, or an operator, found `#`
265265 --> $DIR/attr-stmt-expr-attr-bad.rs:58:48
266266 |
267LL | #[cfg(FALSE)] fn e() { let _ = if let _ = 0 {} #[attr] else {}; }
267LL | #[cfg(false)] fn e() { let _ = if let _ = 0 {} #[attr] else {}; }
268268 | ^ expected one of `.`, `;`, `?`, `else`, or an operator
269269
270270error: outer attributes are not allowed on `if` and `else` branches
271271 --> $DIR/attr-stmt-expr-attr-bad.rs:60:53
272272 |
273LL | #[cfg(FALSE)] fn e() { let _ = if let _ = 0 {} else #[attr] {}; }
273LL | #[cfg(false)] fn e() { let _ = if let _ = 0 {} else #[attr] {}; }
274274 | ---- ^^^^^^^ -- the attributes are attached to this branch
275275 | |
276276 | the branch belongs to this `else`
277277 |
278278help: remove the attributes
279279 |
280LL - #[cfg(FALSE)] fn e() { let _ = if let _ = 0 {} else #[attr] {}; }
281LL + #[cfg(FALSE)] fn e() { let _ = if let _ = 0 {} else {}; }
280LL - #[cfg(false)] fn e() { let _ = if let _ = 0 {} else #[attr] {}; }
281LL + #[cfg(false)] fn e() { let _ = if let _ = 0 {} else {}; }
282282 |
283283
284284error: an inner attribute is not permitted in this context
285285 --> $DIR/attr-stmt-expr-attr-bad.rs:62:54
286286 |
287LL | #[cfg(FALSE)] fn e() { let _ = if let _ = 0 {} else {#![attr]}; }
287LL | #[cfg(false)] fn e() { let _ = if let _ = 0 {} else {#![attr]}; }
288288 | ^^^^^^^^
289289 |
290290 = note: inner attributes, like `#![no_std]`, annotate the item enclosing them, and are usually found at the beginning of source files
......@@ -293,35 +293,35 @@ LL | #[cfg(FALSE)] fn e() { let _ = if let _ = 0 {} else {#![attr]}; }
293293error: outer attributes are not allowed on `if` and `else` branches
294294 --> $DIR/attr-stmt-expr-attr-bad.rs:64:53
295295 |
296LL | #[cfg(FALSE)] fn e() { let _ = if let _ = 0 {} else #[attr] if let _ = 0 {}; }
296LL | #[cfg(false)] fn e() { let _ = if let _ = 0 {} else #[attr] if let _ = 0 {}; }
297297 | ---- ^^^^^^^ --------------- the attributes are attached to this branch
298298 | |
299299 | the branch belongs to this `else`
300300 |
301301help: remove the attributes
302302 |
303LL - #[cfg(FALSE)] fn e() { let _ = if let _ = 0 {} else #[attr] if let _ = 0 {}; }
304LL + #[cfg(FALSE)] fn e() { let _ = if let _ = 0 {} else if let _ = 0 {}; }
303LL - #[cfg(false)] fn e() { let _ = if let _ = 0 {} else #[attr] if let _ = 0 {}; }
304LL + #[cfg(false)] fn e() { let _ = if let _ = 0 {} else if let _ = 0 {}; }
305305 |
306306
307307error: outer attributes are not allowed on `if` and `else` branches
308308 --> $DIR/attr-stmt-expr-attr-bad.rs:66:66
309309 |
310LL | #[cfg(FALSE)] fn e() { let _ = if let _ = 0 {} else if let _ = 0 #[attr] {}; }
310LL | #[cfg(false)] fn e() { let _ = if let _ = 0 {} else if let _ = 0 #[attr] {}; }
311311 | -- ^^^^^^^ -- the attributes are attached to this branch
312312 | |
313313 | the branch belongs to this `if`
314314 |
315315help: remove the attributes
316316 |
317LL - #[cfg(FALSE)] fn e() { let _ = if let _ = 0 {} else if let _ = 0 #[attr] {}; }
318LL + #[cfg(FALSE)] fn e() { let _ = if let _ = 0 {} else if let _ = 0 {}; }
317LL - #[cfg(false)] fn e() { let _ = if let _ = 0 {} else if let _ = 0 #[attr] {}; }
318LL + #[cfg(false)] fn e() { let _ = if let _ = 0 {} else if let _ = 0 {}; }
319319 |
320320
321321error: an inner attribute is not permitted in this context
322322 --> $DIR/attr-stmt-expr-attr-bad.rs:68:67
323323 |
324LL | #[cfg(FALSE)] fn e() { let _ = if let _ = 0 {} else if let _ = 0 {#![attr]}; }
324LL | #[cfg(false)] fn e() { let _ = if let _ = 0 {} else if let _ = 0 {#![attr]}; }
325325 | ^^^^^^^^
326326 |
327327 = note: inner attributes, like `#![no_std]`, annotate the item enclosing them, and are usually found at the beginning of source files
......@@ -330,7 +330,7 @@ LL | #[cfg(FALSE)] fn e() { let _ = if let _ = 0 {} else if let _ = 0 {#![attr]}
330330error: an inner attribute is not permitted following an outer attribute
331331 --> $DIR/attr-stmt-expr-attr-bad.rs:71:32
332332 |
333LL | #[cfg(FALSE)] fn s() { #[attr] #![attr] let _ = 0; }
333LL | #[cfg(false)] fn s() { #[attr] #![attr] let _ = 0; }
334334 | ------- ^^^^^^^^ not permitted following an outer attribute
335335 | |
336336 | previous outer attribute
......@@ -341,7 +341,7 @@ LL | #[cfg(FALSE)] fn s() { #[attr] #![attr] let _ = 0; }
341341error: an inner attribute is not permitted following an outer attribute
342342 --> $DIR/attr-stmt-expr-attr-bad.rs:73:32
343343 |
344LL | #[cfg(FALSE)] fn s() { #[attr] #![attr] 0; }
344LL | #[cfg(false)] fn s() { #[attr] #![attr] 0; }
345345 | ------- ^^^^^^^^ not permitted following an outer attribute
346346 | |
347347 | previous outer attribute
......@@ -352,7 +352,7 @@ LL | #[cfg(FALSE)] fn s() { #[attr] #![attr] 0; }
352352error: an inner attribute is not permitted following an outer attribute
353353 --> $DIR/attr-stmt-expr-attr-bad.rs:75:32
354354 |
355LL | #[cfg(FALSE)] fn s() { #[attr] #![attr] foo!(); }
355LL | #[cfg(false)] fn s() { #[attr] #![attr] foo!(); }
356356 | ------- ^^^^^^^^ ------- the inner attribute doesn't annotate this item macro invocation
357357 | | |
358358 | | not permitted following an outer attribute
......@@ -363,7 +363,7 @@ LL | #[cfg(FALSE)] fn s() { #[attr] #![attr] foo!(); }
363363error: an inner attribute is not permitted following an outer attribute
364364 --> $DIR/attr-stmt-expr-attr-bad.rs:77:32
365365 |
366LL | #[cfg(FALSE)] fn s() { #[attr] #![attr] foo![]; }
366LL | #[cfg(false)] fn s() { #[attr] #![attr] foo![]; }
367367 | ------- ^^^^^^^^ ------- the inner attribute doesn't annotate this item macro invocation
368368 | | |
369369 | | not permitted following an outer attribute
......@@ -374,7 +374,7 @@ LL | #[cfg(FALSE)] fn s() { #[attr] #![attr] foo![]; }
374374error: an inner attribute is not permitted following an outer attribute
375375 --> $DIR/attr-stmt-expr-attr-bad.rs:79:32
376376 |
377LL | #[cfg(FALSE)] fn s() { #[attr] #![attr] foo!{}; }
377LL | #[cfg(false)] fn s() { #[attr] #![attr] foo!{}; }
378378 | ------- ^^^^^^^^ ------ the inner attribute doesn't annotate this item macro invocation
379379 | | |
380380 | | not permitted following an outer attribute
......@@ -385,100 +385,100 @@ LL | #[cfg(FALSE)] fn s() { #[attr] #![attr] foo!{}; }
385385error[E0586]: inclusive range with no end
386386 --> $DIR/attr-stmt-expr-attr-bad.rs:85:35
387387 |
388LL | #[cfg(FALSE)] fn e() { match 0 { 0..=#[attr] 10 => () } }
388LL | #[cfg(false)] fn e() { match 0 { 0..=#[attr] 10 => () } }
389389 | ^^^
390390 |
391391 = note: inclusive ranges must be bounded at the end (`..=b` or `a..=b`)
392392help: use `..` instead
393393 |
394LL - #[cfg(FALSE)] fn e() { match 0 { 0..=#[attr] 10 => () } }
395LL + #[cfg(FALSE)] fn e() { match 0 { 0..#[attr] 10 => () } }
394LL - #[cfg(false)] fn e() { match 0 { 0..=#[attr] 10 => () } }
395LL + #[cfg(false)] fn e() { match 0 { 0..#[attr] 10 => () } }
396396 |
397397
398398error: expected one of `=>`, `if`, or `|`, found `#`
399399 --> $DIR/attr-stmt-expr-attr-bad.rs:85:38
400400 |
401LL | #[cfg(FALSE)] fn e() { match 0 { 0..=#[attr] 10 => () } }
401LL | #[cfg(false)] fn e() { match 0 { 0..=#[attr] 10 => () } }
402402 | ^ expected one of `=>`, `if`, or `|`
403403
404404error[E0586]: inclusive range with no end
405405 --> $DIR/attr-stmt-expr-attr-bad.rs:88:35
406406 |
407LL | #[cfg(FALSE)] fn e() { match 0 { 0..=#[attr] -10 => () } }
407LL | #[cfg(false)] fn e() { match 0 { 0..=#[attr] -10 => () } }
408408 | ^^^
409409 |
410410 = note: inclusive ranges must be bounded at the end (`..=b` or `a..=b`)
411411help: use `..` instead
412412 |
413LL - #[cfg(FALSE)] fn e() { match 0 { 0..=#[attr] -10 => () } }
414LL + #[cfg(FALSE)] fn e() { match 0 { 0..#[attr] -10 => () } }
413LL - #[cfg(false)] fn e() { match 0 { 0..=#[attr] -10 => () } }
414LL + #[cfg(false)] fn e() { match 0 { 0..#[attr] -10 => () } }
415415 |
416416
417417error: expected one of `=>`, `if`, or `|`, found `#`
418418 --> $DIR/attr-stmt-expr-attr-bad.rs:88:38
419419 |
420LL | #[cfg(FALSE)] fn e() { match 0 { 0..=#[attr] -10 => () } }
420LL | #[cfg(false)] fn e() { match 0 { 0..=#[attr] -10 => () } }
421421 | ^ expected one of `=>`, `if`, or `|`
422422
423423error: unexpected token: `#`
424424 --> $DIR/attr-stmt-expr-attr-bad.rs:91:39
425425 |
426LL | #[cfg(FALSE)] fn e() { match 0 { 0..=-#[attr] 10 => () } }
426LL | #[cfg(false)] fn e() { match 0 { 0..=-#[attr] 10 => () } }
427427 | ^
428428
429429error[E0586]: inclusive range with no end
430430 --> $DIR/attr-stmt-expr-attr-bad.rs:93:35
431431 |
432LL | #[cfg(FALSE)] fn e() { match 0 { 0..=#[attr] FOO => () } }
432LL | #[cfg(false)] fn e() { match 0 { 0..=#[attr] FOO => () } }
433433 | ^^^
434434 |
435435 = note: inclusive ranges must be bounded at the end (`..=b` or `a..=b`)
436436help: use `..` instead
437437 |
438LL - #[cfg(FALSE)] fn e() { match 0 { 0..=#[attr] FOO => () } }
439LL + #[cfg(FALSE)] fn e() { match 0 { 0..#[attr] FOO => () } }
438LL - #[cfg(false)] fn e() { match 0 { 0..=#[attr] FOO => () } }
439LL + #[cfg(false)] fn e() { match 0 { 0..#[attr] FOO => () } }
440440 |
441441
442442error: expected one of `=>`, `if`, or `|`, found `#`
443443 --> $DIR/attr-stmt-expr-attr-bad.rs:93:38
444444 |
445LL | #[cfg(FALSE)] fn e() { match 0 { 0..=#[attr] FOO => () } }
445LL | #[cfg(false)] fn e() { match 0 { 0..=#[attr] FOO => () } }
446446 | ^ expected one of `=>`, `if`, or `|`
447447
448448error: unexpected token: `#`
449449 --> $DIR/attr-stmt-expr-attr-bad.rs:97:34
450450 |
451LL | #[cfg(FALSE)] fn e() { let _ = x.#![attr]foo(); }
451LL | #[cfg(false)] fn e() { let _ = x.#![attr]foo(); }
452452 | ^
453453
454454error: expected one of `.`, `;`, `?`, `else`, or an operator, found `#`
455455 --> $DIR/attr-stmt-expr-attr-bad.rs:97:34
456456 |
457LL | #[cfg(FALSE)] fn e() { let _ = x.#![attr]foo(); }
457LL | #[cfg(false)] fn e() { let _ = x.#![attr]foo(); }
458458 | ^ expected one of `.`, `;`, `?`, `else`, or an operator
459459
460460error: unexpected token: `#`
461461 --> $DIR/attr-stmt-expr-attr-bad.rs:100:34
462462 |
463LL | #[cfg(FALSE)] fn e() { let _ = x.#[attr]foo(); }
463LL | #[cfg(false)] fn e() { let _ = x.#[attr]foo(); }
464464 | ^
465465
466466error: expected one of `.`, `;`, `?`, `else`, or an operator, found `#`
467467 --> $DIR/attr-stmt-expr-attr-bad.rs:100:34
468468 |
469LL | #[cfg(FALSE)] fn e() { let _ = x.#[attr]foo(); }
469LL | #[cfg(false)] fn e() { let _ = x.#[attr]foo(); }
470470 | ^ expected one of `.`, `;`, `?`, `else`, or an operator
471471
472472error: expected statement after outer attribute
473473 --> $DIR/attr-stmt-expr-attr-bad.rs:105:37
474474 |
475LL | #[cfg(FALSE)] fn e() { { fn foo() { #[attr]; } } }
475LL | #[cfg(false)] fn e() { { fn foo() { #[attr]; } } }
476476 | ^^^^^^^
477477
478478error: expected statement after outer attribute
479479 --> $DIR/attr-stmt-expr-attr-bad.rs:107:37
480480 |
481LL | #[cfg(FALSE)] fn e() { { fn foo() { #[attr] } } }
481LL | #[cfg(false)] fn e() { { fn foo() { #[attr] } } }
482482 | ^^^^^^^
483483
484484error: aborting due to 53 previous errors
tests/ui/parser/attribute/multiple-tail-expr-behind-cfg.rs+1-1
......@@ -1,7 +1,7 @@
11#![feature(stmt_expr_attributes)]
22
33fn foo() -> String {
4 #[cfg(FALSE)]
4 #[cfg(false)]
55 [1, 2, 3].iter().map(|c| c.to_string()).collect::<String>() //~ ERROR expected `;`, found `#`
66 #[cfg(not(FALSE))]
77 String::new()
tests/ui/parser/attribute/multiple-tail-expr-behind-cfg.stderr+2-2
......@@ -1,7 +1,7 @@
11error: expected `;`, found `#`
22 --> $DIR/multiple-tail-expr-behind-cfg.rs:5:64
33 |
4LL | #[cfg(FALSE)]
4LL | #[cfg(false)]
55 | ------------- only `;` terminated statements or tail expressions are allowed after this attribute
66LL | [1, 2, 3].iter().map(|c| c.to_string()).collect::<String>()
77 | ^ expected `;` here
......@@ -18,7 +18,7 @@ LL | { [1, 2, 3].iter().map(|c| c.to_string()).collect::<String>() }
1818 | + +
1919help: it seems like you are trying to provide different expressions depending on `cfg`, consider using `if cfg!(..)`
2020 |
21LL ~ if cfg!(FALSE) {
21LL ~ if cfg!(false) {
2222LL ~ [1, 2, 3].iter().map(|c| c.to_string()).collect::<String>()
2323LL ~ } else if cfg!(not(FALSE)) {
2424LL ~ String::new()
tests/ui/parser/attribute/properly-recover-from-trailing-outer-attribute-in-body-2.rs+1-1
......@@ -5,7 +5,7 @@ macro_rules! the_macro {
55 #[cfg()]
66 $foo //~ ERROR expected `;`, found `#`
77
8 #[cfg(FALSE)]
8 #[cfg(false)]
99 $bar
1010 };
1111}
tests/ui/parser/attribute/properly-recover-from-trailing-outer-attribute-in-body-2.stderr+1-1
......@@ -6,7 +6,7 @@ LL | #[cfg()]
66LL | $foo
77 | ^ expected `;` here
88LL |
9LL | #[cfg(FALSE)]
9LL | #[cfg(false)]
1010 | - unexpected token
1111...
1212LL | the_macro!( (); (); );
tests/ui/parser/constraints-before-generic-args-syntactic-pass.rs+1-1
......@@ -1,6 +1,6 @@
11//@ check-pass
22
3#[cfg(FALSE)]
3#[cfg(false)]
44fn syntax() {
55 foo::<T = u8, T: Ord, String>();
66 foo::<T = u8, 'a, T: Ord>();
tests/ui/parser/default-on-wrong-item-kind.rs+4-4
......@@ -4,7 +4,7 @@
44
55fn main() {}
66
7#[cfg(FALSE)]
7#[cfg(false)]
88mod free_items {
99 default extern crate foo; //~ ERROR an extern crate cannot be `default`
1010 default use foo; //~ ERROR a `use` import cannot be `default`
......@@ -28,7 +28,7 @@ mod free_items {
2828 default macro_rules! foo {} //~ ERROR a macro definition cannot be `default`
2929}
3030
31#[cfg(FALSE)]
31#[cfg(false)]
3232extern "C" {
3333 default extern crate foo; //~ ERROR an extern crate cannot be `default`
3434 //~^ ERROR extern crate is not supported in `extern` blocks
......@@ -65,7 +65,7 @@ extern "C" {
6565 //~^ ERROR macro definition is not supported in `extern` blocks
6666}
6767
68#[cfg(FALSE)]
68#[cfg(false)]
6969impl S {
7070 default extern crate foo; //~ ERROR an extern crate cannot be `default`
7171 //~^ ERROR extern crate is not supported in `trait`s or `impl`s
......@@ -102,7 +102,7 @@ impl S {
102102 //~^ ERROR macro definition is not supported in `trait`s or `impl`s
103103}
104104
105#[cfg(FALSE)]
105#[cfg(false)]
106106trait T {
107107 default extern crate foo; //~ ERROR an extern crate cannot be `default`
108108 //~^ ERROR extern crate is not supported in `trait`s or `impl`s
tests/ui/parser/extern-abi-syntactic.rs+3-3
......@@ -5,13 +5,13 @@
55
66fn main() {}
77
8#[cfg(FALSE)]
8#[cfg(false)]
99extern "some_abi_that_we_are_sure_does_not_exist_semantically" fn foo() {}
1010
11#[cfg(FALSE)]
11#[cfg(false)]
1212extern "some_abi_that_we_are_sure_does_not_exist_semantically" {
1313 fn foo();
1414}
1515
16#[cfg(FALSE)]
16#[cfg(false)]
1717type T = extern "some_abi_that_we_are_sure_does_not_exist_semantically" fn();
tests/ui/parser/extern-crate-async.rs+2-2
......@@ -5,8 +5,8 @@
55
66fn main() {}
77
8#[cfg(FALSE)]
8#[cfg(false)]
99extern crate async;
1010
11#[cfg(FALSE)]
11#[cfg(false)]
1212extern crate async as something_else;
tests/ui/parser/fn-body-optional-syntactic-pass.rs+1-1
......@@ -4,7 +4,7 @@
44
55fn main() {}
66
7#[cfg(FALSE)]
7#[cfg(false)]
88fn syntax() {
99 fn f();
1010 fn f() {}
tests/ui/parser/fn-header-syntactic-pass.rs+1-1
......@@ -5,7 +5,7 @@
55
66fn main() {}
77
8#[cfg(FALSE)]
8#[cfg(false)]
99fn syntax() {
1010 async fn f();
1111 unsafe fn f();
tests/ui/parser/foreign-const-syntactic-fail.rs+1-1
......@@ -2,7 +2,7 @@
22
33fn main() {}
44
5#[cfg(FALSE)]
5#[cfg(false)]
66extern "C" {
77 const A: isize; //~ ERROR extern items cannot be `const`
88 const B: isize = 42; //~ ERROR extern items cannot be `const`
tests/ui/parser/foreign-static-syntactic-pass.rs+1-1
......@@ -4,7 +4,7 @@
44
55fn main() {}
66
7#[cfg(FALSE)]
7#[cfg(false)]
88extern "C" {
99 static X: u8;
1010 static mut Y: u8;
tests/ui/parser/foreign-ty-syntactic-pass.rs+1-1
......@@ -2,7 +2,7 @@
22
33fn main() {}
44
5#[cfg(FALSE)]
5#[cfg(false)]
66extern "C" {
77 type A: Ord;
88 type A<'a> where 'a: 'static;
tests/ui/parser/impl-item-const-pass.rs+1-1
......@@ -2,7 +2,7 @@
22
33fn main() {}
44
5#[cfg(FALSE)]
5#[cfg(false)]
66impl X {
77 const Y: u8;
88}
tests/ui/parser/impl-item-fn-no-body-pass.rs+1-1
......@@ -2,7 +2,7 @@
22
33fn main() {}
44
5#[cfg(FALSE)]
5#[cfg(false)]
66impl X {
77 fn f();
88}
tests/ui/parser/impl-item-type-no-body-pass.rs+1-1
......@@ -2,7 +2,7 @@
22
33fn main() {}
44
5#[cfg(FALSE)]
5#[cfg(false)]
66impl X {
77 type Y;
88 type Z: Ord;
tests/ui/parser/issues/issue-65041-empty-vis-matcher-in-enum.rs+1-1
......@@ -20,7 +20,7 @@ macro_rules! mac_variant {
2020mac_variant!(MARKER);
2121
2222// We also accept visibilities on variants syntactically but not semantically.
23#[cfg(FALSE)]
23#[cfg(false)]
2424enum E {
2525 pub U,
2626 pub(crate) T(u8),
tests/ui/parser/issues/issue-65041-empty-vis-matcher-in-trait.rs+1-1
......@@ -20,7 +20,7 @@ trait Alpha {
2020}
2121
2222// We also accept visibilities on items in traits syntactically but not semantically.
23#[cfg(FALSE)]
23#[cfg(false)]
2424trait Foo {
2525 pub fn bar();
2626 pub(crate) type baz;
tests/ui/parser/item-free-const-no-body-syntactic-pass.rs+1-1
......@@ -4,5 +4,5 @@
44
55fn main() {}
66
7#[cfg(FALSE)]
7#[cfg(false)]
88const X: u8;
tests/ui/parser/item-free-static-no-body-syntactic-pass.rs+1-1
......@@ -4,5 +4,5 @@
44
55fn main() {}
66
7#[cfg(FALSE)]
7#[cfg(false)]
88static X: u8;
tests/ui/parser/item-free-type-bounds-syntactic-pass.rs+1-1
......@@ -2,7 +2,7 @@
22
33fn main() {}
44
5#[cfg(FALSE)]
5#[cfg(false)]
66fn syntax() {
77 type A: Ord;
88 type B: Ord = u8;
tests/ui/parser/recover/recover-assoc-const-constraint.rs+1-1
......@@ -1,4 +1,4 @@
1#[cfg(FALSE)]
1#[cfg(false)]
22fn syntax() {
33 bar::<Item = 42>();
44 //~^ ERROR associated const equality is incomplete
tests/ui/parser/recover/recover-assoc-eq-missing-term.rs+1-1
......@@ -1,4 +1,4 @@
1#[cfg(FALSE)]
1#[cfg(false)]
22fn syntax() {
33 bar::<Item = >(); //~ ERROR missing type to the right of `=`
44}
tests/ui/parser/recover/recover-assoc-lifetime-constraint.rs+1-1
......@@ -1,4 +1,4 @@
1#[cfg(FALSE)]
1#[cfg(false)]
22fn syntax() {
33 bar::<Item = 'a>(); //~ ERROR lifetimes are not permitted in this context
44}
tests/ui/parser/self-param-syntactic-pass.rs+5-5
......@@ -5,7 +5,7 @@
55
66fn main() {}
77
8#[cfg(FALSE)]
8#[cfg(false)]
99fn free() {
1010 fn f(self) {}
1111 fn f(mut self) {}
......@@ -17,7 +17,7 @@ fn free() {
1717 fn f(mut self: u8) {}
1818}
1919
20#[cfg(FALSE)]
20#[cfg(false)]
2121extern "C" {
2222 fn f(self);
2323 fn f(mut self);
......@@ -29,7 +29,7 @@ extern "C" {
2929 fn f(mut self: u8);
3030}
3131
32#[cfg(FALSE)]
32#[cfg(false)]
3333trait X {
3434 fn f(self) {}
3535 fn f(mut self) {}
......@@ -41,7 +41,7 @@ trait X {
4141 fn f(mut self: u8) {}
4242}
4343
44#[cfg(FALSE)]
44#[cfg(false)]
4545impl X for Y {
4646 fn f(self) {}
4747 fn f(mut self) {}
......@@ -53,7 +53,7 @@ impl X for Y {
5353 fn f(mut self: u8) {}
5454}
5555
56#[cfg(FALSE)]
56#[cfg(false)]
5757impl X for Y {
5858 type X = fn(self);
5959 type X = fn(mut self);
tests/ui/parser/stripped-nested-outline-mod-pass.rs+1-1
......@@ -5,7 +5,7 @@
55
66fn main() {}
77
8#[cfg(FALSE)]
8#[cfg(false)]
99mod foo {
1010 mod bar {
1111 mod baz; // This was an error before.
tests/ui/parser/trait-item-with-defaultness-pass.rs+1-1
......@@ -2,7 +2,7 @@
22
33fn main() {}
44
5#[cfg(FALSE)]
5#[cfg(false)]
66trait X {
77 default const A: u8;
88 default const B: u8 = 0;
tests/ui/parser/variadic-ffi-syntactic-pass.rs+11-11
......@@ -2,31 +2,31 @@
22
33fn main() {}
44
5#[cfg(FALSE)]
5#[cfg(false)]
66fn f1_1(x: isize, ...) {}
77
8#[cfg(FALSE)]
8#[cfg(false)]
99fn f1_2(...) {}
1010
11#[cfg(FALSE)]
11#[cfg(false)]
1212extern "C" fn f2_1(x: isize, ...) {}
1313
14#[cfg(FALSE)]
14#[cfg(false)]
1515extern "C" fn f2_2(...) {}
1616
17#[cfg(FALSE)]
17#[cfg(false)]
1818extern "C" fn f2_3(..., x: isize) {}
1919
20#[cfg(FALSE)]
20#[cfg(false)]
2121extern fn f3_1(x: isize, ...) {}
2222
23#[cfg(FALSE)]
23#[cfg(false)]
2424extern fn f3_2(...) {}
2525
26#[cfg(FALSE)]
26#[cfg(false)]
2727extern fn f3_3(..., x: isize) {}
2828
29#[cfg(FALSE)]
29#[cfg(false)]
3030extern {
3131 fn e_f1(...);
3232 fn e_f2(..., x: isize);
......@@ -34,7 +34,7 @@ extern {
3434
3535struct X;
3636
37#[cfg(FALSE)]
37#[cfg(false)]
3838impl X {
3939 fn i_f1(x: isize, ...) {}
4040 fn i_f2(...) {}
......@@ -42,7 +42,7 @@ impl X {
4242 fn i_f4(..., x: isize, ...) {}
4343}
4444
45#[cfg(FALSE)]
45#[cfg(false)]
4646trait T {
4747 fn t_f1(x: isize, ...) {}
4848 fn t_f2(x: isize, ...);
tests/ui/pattern/bindings-after-at/nested-type-ascription-syntactically-invalid.rs+3-3
......@@ -13,19 +13,19 @@ fn _ok() {
1313 fn _f(_a @ _b: u8) {} // OK.
1414}
1515
16#[cfg(FALSE)]
16#[cfg(false)]
1717fn case_1() {
1818 let a: u8 @ b = 0;
1919 //~^ ERROR expected one of `!`
2020}
2121
22#[cfg(FALSE)]
22#[cfg(false)]
2323fn case_2() {
2424 let a @ (b: u8);
2525 //~^ ERROR expected one of `)`
2626}
2727
28#[cfg(FALSE)]
28#[cfg(false)]
2929fn case_3() {
3030 let a: T1 @ Outer(b: T2);
3131 //~^ ERROR expected one of `!`
tests/ui/pattern/bindings-after-at/wild-before-at-syntactically-rejected.rs+1-1
......@@ -3,7 +3,7 @@
33
44fn main() {}
55
6#[cfg(FALSE)]
6#[cfg(false)]
77fn wild_before_at_is_bad_syntax() {
88 let _ @ a = 0;
99 //~^ ERROR pattern on wrong side of `@`
tests/ui/pattern/rest-pat-syntactic.rs+1-1
......@@ -11,7 +11,7 @@ macro_rules! accept_pat {
1111
1212accept_pat!(..);
1313
14#[cfg(FALSE)]
14#[cfg(false)]
1515fn rest_patterns() {
1616 // Top level:
1717 fn foo(..: u8) {}
tests/ui/proc-macro/attribute-after-derive.rs+2-2
......@@ -14,14 +14,14 @@ extern crate test_macros;
1414#[print_attr]
1515#[derive(Print)]
1616struct AttributeDerive {
17 #[cfg(FALSE)]
17 #[cfg(false)]
1818 field: u8,
1919}
2020
2121#[derive(Print)]
2222#[print_attr]
2323struct DeriveAttribute {
24 #[cfg(FALSE)]
24 #[cfg(false)]
2525 field: u8,
2626}
2727
tests/ui/proc-macro/attribute-after-derive.stdout+6-6
......@@ -1,5 +1,5 @@
1PRINT-ATTR INPUT (DISPLAY): #[derive(Print)] struct AttributeDerive { #[cfg(FALSE)] field: u8, }
2PRINT-ATTR DEEP-RE-COLLECTED (DISPLAY): #[derive(Print)] struct AttributeDerive { #[cfg(FALSE)] field : u8, }
1PRINT-ATTR INPUT (DISPLAY): #[derive(Print)] struct AttributeDerive { #[cfg(false)] field: u8, }
2PRINT-ATTR DEEP-RE-COLLECTED (DISPLAY): #[derive(Print)] struct AttributeDerive { #[cfg(false)] field : u8, }
33PRINT-ATTR INPUT (DEBUG): TokenStream [
44 Punct {
55 ch: '#',
......@@ -53,7 +53,7 @@ PRINT-ATTR INPUT (DEBUG): TokenStream [
5353 delimiter: Parenthesis,
5454 stream: TokenStream [
5555 Ident {
56 ident: "FALSE",
56 ident: "false",
5757 span: $DIR/attribute-after-derive.rs:17:11: 17:16 (#0),
5858 },
5959 ],
......@@ -131,8 +131,8 @@ PRINT-DERIVE INPUT (DEBUG): TokenStream [
131131 span: $DIR/attribute-after-derive.rs:23:24: 26:2 (#0),
132132 },
133133]
134PRINT-ATTR INPUT (DISPLAY): struct DeriveAttribute { #[cfg(FALSE)] field: u8, }
135PRINT-ATTR DEEP-RE-COLLECTED (DISPLAY): struct DeriveAttribute { #[cfg(FALSE)] field : u8, }
134PRINT-ATTR INPUT (DISPLAY): struct DeriveAttribute { #[cfg(false)] field: u8, }
135PRINT-ATTR DEEP-RE-COLLECTED (DISPLAY): struct DeriveAttribute { #[cfg(false)] field : u8, }
136136PRINT-ATTR INPUT (DEBUG): TokenStream [
137137 Ident {
138138 ident: "struct",
......@@ -161,7 +161,7 @@ PRINT-ATTR INPUT (DEBUG): TokenStream [
161161 delimiter: Parenthesis,
162162 stream: TokenStream [
163163 Ident {
164 ident: "FALSE",
164 ident: "false",
165165 span: $DIR/attribute-after-derive.rs:24:11: 24:16 (#0),
166166 },
167167 ],
tests/ui/proc-macro/cfg-attr-trace.rs-1
......@@ -3,7 +3,6 @@
33//@ check-pass
44//@ proc-macro: test-macros.rs
55
6#![feature(cfg_boolean_literals)]
76#![feature(cfg_eval)]
87
98#[macro_use]
tests/ui/proc-macro/cfg-attr-trace.stdout+15-15
......@@ -4,75 +4,75 @@ PRINT-ATTR INPUT (DEBUG): TokenStream [
44 Punct {
55 ch: '#',
66 spacing: Alone,
7 span: #0 bytes(305..306),
7 span: #0 bytes(271..272),
88 },
99 Group {
1010 delimiter: Bracket,
1111 stream: TokenStream [
1212 Ident {
1313 ident: "test_macros",
14 span: #0 bytes(322..333),
14 span: #0 bytes(288..299),
1515 },
1616 Punct {
1717 ch: ':',
1818 spacing: Joint,
19 span: #0 bytes(333..334),
19 span: #0 bytes(299..300),
2020 },
2121 Punct {
2222 ch: ':',
2323 spacing: Alone,
24 span: #0 bytes(334..335),
24 span: #0 bytes(300..301),
2525 },
2626 Ident {
2727 ident: "print_attr",
28 span: #0 bytes(335..345),
28 span: #0 bytes(301..311),
2929 },
3030 ],
31 span: #0 bytes(306..347),
31 span: #0 bytes(272..313),
3232 },
3333 Ident {
3434 ident: "struct",
35 span: #0 bytes(348..354),
35 span: #0 bytes(314..320),
3636 },
3737 Ident {
3838 ident: "S",
39 span: #0 bytes(355..356),
39 span: #0 bytes(321..322),
4040 },
4141 Punct {
4242 ch: ';',
4343 spacing: Alone,
44 span: #0 bytes(356..357),
44 span: #0 bytes(322..323),
4545 },
4646]
4747PRINT-ATTR INPUT (DISPLAY): struct S;
4848PRINT-ATTR INPUT (DEBUG): TokenStream [
4949 Ident {
5050 ident: "struct",
51 span: #0 bytes(348..354),
51 span: #0 bytes(314..320),
5252 },
5353 Ident {
5454 ident: "S",
55 span: #0 bytes(355..356),
55 span: #0 bytes(321..322),
5656 },
5757 Punct {
5858 ch: ';',
5959 spacing: Alone,
60 span: #0 bytes(356..357),
60 span: #0 bytes(322..323),
6161 },
6262]
6363PRINT-ATTR INPUT (DISPLAY): struct Z;
6464PRINT-ATTR INPUT (DEBUG): TokenStream [
6565 Ident {
6666 ident: "struct",
67 span: #0 bytes(411..417),
67 span: #0 bytes(377..383),
6868 },
6969 Ident {
7070 ident: "Z",
71 span: #0 bytes(418..419),
71 span: #0 bytes(384..385),
7272 },
7373 Punct {
7474 ch: ';',
7575 spacing: Alone,
76 span: #0 bytes(419..420),
76 span: #0 bytes(385..386),
7777 },
7878]
tests/ui/proc-macro/cfg-eval-fail.rs+1-1
......@@ -2,6 +2,6 @@
22#![feature(stmt_expr_attributes)]
33
44fn main() {
5 let _ = #[cfg_eval] #[cfg(FALSE)] 0;
5 let _ = #[cfg_eval] #[cfg(false)] 0;
66 //~^ ERROR removing an expression is not supported in this position
77}
tests/ui/proc-macro/cfg-eval-fail.stderr+1-1
......@@ -1,7 +1,7 @@
11error: removing an expression is not supported in this position
22 --> $DIR/cfg-eval-fail.rs:5:25
33 |
4LL | let _ = #[cfg_eval] #[cfg(FALSE)] 0;
4LL | let _ = #[cfg_eval] #[cfg(false)] 0;
55 | ^^^^^^^^^^^^^
66
77error: aborting due to 1 previous error
tests/ui/proc-macro/cfg-eval-inner.rs+1-1
......@@ -32,7 +32,7 @@ impl Foo<[u8; {
3232 #![cfg_attr(not(FALSE), rustc_dummy(evaluated_attr))]
3333
3434 fn bar() {
35 #[cfg(FALSE)] let a = 1;
35 #[cfg(false)] let a = 1;
3636 }
3737}
3838
tests/ui/proc-macro/cfg-eval.rs+3-3
......@@ -15,7 +15,7 @@ extern crate test_macros;
1515#[cfg_eval]
1616#[print_attr]
1717struct S1 {
18 #[cfg(FALSE)]
18 #[cfg(false)]
1919 field_false: u8,
2020 #[cfg(all(/*true*/))]
2121 #[cfg_attr(FALSE, unknown_attr)]
......@@ -24,7 +24,7 @@ struct S1 {
2424}
2525
2626#[cfg_eval]
27#[cfg(FALSE)]
27#[cfg(false)]
2828struct S2 {}
2929
3030fn main() {
......@@ -33,5 +33,5 @@ fn main() {
3333 // expression. `#[cfg]` is not supported inside parenthesized expressions, so this will
3434 // produce an error when attribute collection runs.
3535 let _ = #[cfg_eval] #[print_attr] #[cfg_attr(not(FALSE), rustc_dummy)]
36 (#[cfg(FALSE)] 0, #[cfg(all(/*true*/))] 1,);
36 (#[cfg(false)] 0, #[cfg(all(/*true*/))] 1,);
3737}
tests/ui/proc-macro/derive-cfg-nested-tokens.rs+1-1
......@@ -15,7 +15,7 @@ struct S {
1515 // - on eagerly configured `S` (from `impl Copy`), only 11 should be printed
1616 // - on non-configured `S` (from `struct S`), both 10 and 11 should be printed
1717 field: [u8; #[print_attr] {
18 #[cfg(FALSE)] { 10 }
18 #[cfg(false)] { 10 }
1919 #[cfg(not(FALSE))] { 11 }
2020 }],
2121}
tests/ui/proc-macro/derive-cfg-nested-tokens.stdout+2-2
......@@ -54,7 +54,7 @@ PRINT-ATTR INPUT (DEBUG): TokenStream [
5454 span: #0 bytes(452..523),
5555 },
5656]
57PRINT-ATTR INPUT (DISPLAY): { #[cfg(FALSE)] { 10 } #[cfg(not(FALSE))] { 11 } }
57PRINT-ATTR INPUT (DISPLAY): { #[cfg(false)] { 10 } #[cfg(not(FALSE))] { 11 } }
5858PRINT-ATTR INPUT (DEBUG): TokenStream [
5959 Group {
6060 delimiter: Brace,
......@@ -75,7 +75,7 @@ PRINT-ATTR INPUT (DEBUG): TokenStream [
7575 delimiter: Parenthesis,
7676 stream: TokenStream [
7777 Ident {
78 ident: "FALSE",
78 ident: "false",
7979 span: #0 bytes(468..473),
8080 },
8181 ],
tests/ui/proc-macro/expand-to-derive.rs+2-2
......@@ -14,7 +14,7 @@ macro_rules! expand_to_derive {
1414 ($item:item) => {
1515 #[derive(Print)]
1616 struct Foo {
17 #[cfg(FALSE)] removed: bool,
17 #[cfg(false)] removed: bool,
1818 field: [bool; {
1919 $item
2020 0
......@@ -26,7 +26,7 @@ macro_rules! expand_to_derive {
2626expand_to_derive! {
2727 #[cfg_attr(not(FALSE), rustc_dummy)]
2828 struct Inner {
29 #[cfg(FALSE)] removed_inner_field: bool,
29 #[cfg(false)] removed_inner_field: bool,
3030 other_inner_field: u8,
3131 }
3232}
tests/ui/proc-macro/issue-75930-derive-cfg.rs+13-13
......@@ -31,7 +31,7 @@ extern crate test_macros;
3131//
3232// It is because of this code from below:
3333// ```
34// struct Foo<#[cfg(FALSE)] A, B>
34// struct Foo<#[cfg(false)] A, B>
3535// ```
3636// When the token stream is formed during parsing, `<` is followed immediately
3737// by `#`, which is punctuation, so it is marked `Joint`. But before being
......@@ -51,22 +51,22 @@ extern crate test_macros;
5151#[print_attr]
5252#[derive(Print)]
5353#[print_helper(b)]
54struct Foo<#[cfg(FALSE)] A, B> {
55 #[cfg(FALSE)] first: String,
54struct Foo<#[cfg(false)] A, B> {
55 #[cfg(false)] first: String,
5656 #[cfg_attr(FALSE, deny(warnings))] second: bool,
5757 third: [u8; {
58 #[cfg(FALSE)] struct Bar;
58 #[cfg(false)] struct Bar;
5959 #[cfg(not(FALSE))] struct Inner;
60 #[cfg(FALSE)] let a = 25;
60 #[cfg(false)] let a = 25;
6161 match true {
62 #[cfg(FALSE)] true => {},
62 #[cfg(false)] true => {},
6363 #[cfg_attr(not(FALSE), allow(warnings))] false => {},
6464 _ => {}
6565 };
6666
6767 #[print_helper(should_be_removed)]
6868 fn removed_fn() {
69 #![cfg(FALSE)]
69 #![cfg(false)]
7070 }
7171
7272 #[print_helper(c)] #[cfg(not(FALSE))] fn kept_fn() {
......@@ -76,22 +76,22 @@ struct Foo<#[cfg(FALSE)] A, B> {
7676
7777 enum TupleEnum {
7878 Foo(
79 #[cfg(FALSE)] u8,
80 #[cfg(FALSE)] bool,
79 #[cfg(false)] u8,
80 #[cfg(false)] bool,
8181 #[cfg(not(FALSE))] i32,
82 #[cfg(FALSE)] String, u8
82 #[cfg(false)] String, u8
8383 )
8484 }
8585
8686 struct TupleStruct(
87 #[cfg(FALSE)] String,
87 #[cfg(false)] String,
8888 #[cfg(not(FALSE))] i32,
89 #[cfg(FALSE)] bool,
89 #[cfg(false)] bool,
9090 u8
9191 );
9292
9393 fn plain_removed_fn() {
94 #![cfg_attr(not(FALSE), cfg(FALSE))]
94 #![cfg_attr(not(FALSE), cfg(false))]
9595 }
9696
9797 0
tests/ui/proc-macro/issue-75930-derive-cfg.stdout+45-45
......@@ -1,73 +1,73 @@
11PRINT-ATTR INPUT (DISPLAY): #[print_helper(a)] #[allow(dead_code)] #[derive(Print)] #[print_helper(b)]
2struct Foo<#[cfg(FALSE)] A, B>
2struct Foo<#[cfg(false)] A, B>
33{
4 #[cfg(FALSE)] first: String, #[cfg_attr(FALSE, deny(warnings))] second:
4 #[cfg(false)] first: String, #[cfg_attr(FALSE, deny(warnings))] second:
55 bool, third:
66 [u8;
77 {
8 #[cfg(FALSE)] struct Bar; #[cfg(not(FALSE))] struct Inner;
9 #[cfg(FALSE)] let a = 25; match true
8 #[cfg(false)] struct Bar; #[cfg(not(FALSE))] struct Inner;
9 #[cfg(false)] let a = 25; match true
1010 {
11 #[cfg(FALSE)] true => {}, #[cfg_attr(not(FALSE), allow(warnings))]
11 #[cfg(false)] true => {}, #[cfg_attr(not(FALSE), allow(warnings))]
1212 false => {}, _ => {}
1313 }; #[print_helper(should_be_removed)] fn removed_fn()
14 { #![cfg(FALSE)] } #[print_helper(c)] #[cfg(not(FALSE))] fn kept_fn()
14 { #![cfg(false)] } #[print_helper(c)] #[cfg(not(FALSE))] fn kept_fn()
1515 { #![cfg(not(FALSE))] let my_val = true; } enum TupleEnum
1616 {
17 Foo(#[cfg(FALSE)] u8, #[cfg(FALSE)] bool, #[cfg(not(FALSE))] i32,
18 #[cfg(FALSE)] String, u8)
17 Foo(#[cfg(false)] u8, #[cfg(false)] bool, #[cfg(not(FALSE))] i32,
18 #[cfg(false)] String, u8)
1919 } struct
20 TupleStruct(#[cfg(FALSE)] String, #[cfg(not(FALSE))] i32,
21 #[cfg(FALSE)] bool, u8); fn plain_removed_fn()
22 { #![cfg_attr(not(FALSE), cfg(FALSE))] } 0
20 TupleStruct(#[cfg(false)] String, #[cfg(not(FALSE))] i32,
21 #[cfg(false)] bool, u8); fn plain_removed_fn()
22 { #![cfg_attr(not(FALSE), cfg(false))] } 0
2323 }], #[print_helper(d)] fourth: B
2424}
2525PRINT-ATTR RE-COLLECTED (DISPLAY): #[print_helper(a)] #[allow(dead_code)] #[derive(Print)] #[print_helper(b)]
26struct Foo <#[cfg(FALSE)] A, B >
26struct Foo <#[cfg(false)] A, B >
2727{
28 #[cfg(FALSE)] first: String, #[cfg_attr(FALSE, deny(warnings))] second:
28 #[cfg(false)] first: String, #[cfg_attr(FALSE, deny(warnings))] second:
2929 bool, third:
3030 [u8;
3131 {
32 #[cfg(FALSE)] struct Bar; #[cfg(not(FALSE))] struct Inner;
33 #[cfg(FALSE)] let a = 25; match true
32 #[cfg(false)] struct Bar; #[cfg(not(FALSE))] struct Inner;
33 #[cfg(false)] let a = 25; match true
3434 {
35 #[cfg(FALSE)] true => {}, #[cfg_attr(not(FALSE), allow(warnings))]
35 #[cfg(false)] true => {}, #[cfg_attr(not(FALSE), allow(warnings))]
3636 false => {}, _ => {}
3737 }; #[print_helper(should_be_removed)] fn removed_fn()
38 { #![cfg(FALSE)] } #[print_helper(c)] #[cfg(not(FALSE))] fn kept_fn()
38 { #![cfg(false)] } #[print_helper(c)] #[cfg(not(FALSE))] fn kept_fn()
3939 { #![cfg(not(FALSE))] let my_val = true; } enum TupleEnum
4040 {
41 Foo(#[cfg(FALSE)] u8, #[cfg(FALSE)] bool, #[cfg(not(FALSE))] i32,
42 #[cfg(FALSE)] String, u8)
41 Foo(#[cfg(false)] u8, #[cfg(false)] bool, #[cfg(not(FALSE))] i32,
42 #[cfg(false)] String, u8)
4343 } struct
44 TupleStruct(#[cfg(FALSE)] String, #[cfg(not(FALSE))] i32,
45 #[cfg(FALSE)] bool, u8); fn plain_removed_fn()
46 { #![cfg_attr(not(FALSE), cfg(FALSE))] } 0
44 TupleStruct(#[cfg(false)] String, #[cfg(not(FALSE))] i32,
45 #[cfg(false)] bool, u8); fn plain_removed_fn()
46 { #![cfg_attr(not(FALSE), cfg(false))] } 0
4747 }], #[print_helper(d)] fourth: B
4848}
4949PRINT-ATTR DEEP-RE-COLLECTED (DISPLAY): #[print_helper(a)] #[allow(dead_code)] #[derive(Print)] #[print_helper(b)]
50struct Foo <#[cfg(FALSE)] A, B >
50struct Foo <#[cfg(false)] A, B >
5151{
52 #[cfg(FALSE)] first : String, #[cfg_attr(FALSE, deny(warnings))] second :
52 #[cfg(false)] first : String, #[cfg_attr(FALSE, deny(warnings))] second :
5353 bool, third :
5454 [u8;
5555 {
56 #[cfg(FALSE)] struct Bar; #[cfg(not(FALSE))] struct Inner;
57 #[cfg(FALSE)] let a = 25; match true
56 #[cfg(false)] struct Bar; #[cfg(not(FALSE))] struct Inner;
57 #[cfg(false)] let a = 25; match true
5858 {
59 #[cfg(FALSE)] true => {}, #[cfg_attr(not(FALSE), allow(warnings))]
59 #[cfg(false)] true => {}, #[cfg_attr(not(FALSE), allow(warnings))]
6060 false => {}, _ => {}
6161 }; #[print_helper(should_be_removed)] fn removed_fn()
62 { #! [cfg(FALSE)] } #[print_helper(c)] #[cfg(not(FALSE))] fn kept_fn()
62 { #! [cfg(false)] } #[print_helper(c)] #[cfg(not(FALSE))] fn kept_fn()
6363 { #! [cfg(not(FALSE))] let my_val = true; } enum TupleEnum
6464 {
65 Foo(#[cfg(FALSE)] u8, #[cfg(FALSE)] bool, #[cfg(not(FALSE))] i32,
66 #[cfg(FALSE)] String, u8)
65 Foo(#[cfg(false)] u8, #[cfg(false)] bool, #[cfg(not(FALSE))] i32,
66 #[cfg(false)] String, u8)
6767 } struct
68 TupleStruct(#[cfg(FALSE)] String, #[cfg(not(FALSE))] i32,
69 #[cfg(FALSE)] bool, u8); fn plain_removed_fn()
70 { #! [cfg_attr(not(FALSE), cfg(FALSE))] } 0
68 TupleStruct(#[cfg(false)] String, #[cfg(not(FALSE))] i32,
69 #[cfg(false)] bool, u8); fn plain_removed_fn()
70 { #! [cfg_attr(not(FALSE), cfg(false))] } 0
7171 }], #[print_helper(d)] fourth : B
7272}
7373PRINT-ATTR INPUT (DEBUG): TokenStream [
......@@ -200,7 +200,7 @@ PRINT-ATTR INPUT (DEBUG): TokenStream [
200200 delimiter: Parenthesis,
201201 stream: TokenStream [
202202 Ident {
203 ident: "FALSE",
203 ident: "false",
204204 span: $DIR/issue-75930-derive-cfg.rs:54:18: 54:23 (#0),
205205 },
206206 ],
......@@ -246,7 +246,7 @@ PRINT-ATTR INPUT (DEBUG): TokenStream [
246246 delimiter: Parenthesis,
247247 stream: TokenStream [
248248 Ident {
249 ident: "FALSE",
249 ident: "false",
250250 span: $DIR/issue-75930-derive-cfg.rs:55:11: 55:16 (#0),
251251 },
252252 ],
......@@ -375,7 +375,7 @@ PRINT-ATTR INPUT (DEBUG): TokenStream [
375375 delimiter: Parenthesis,
376376 stream: TokenStream [
377377 Ident {
378 ident: "FALSE",
378 ident: "false",
379379 span: $DIR/issue-75930-derive-cfg.rs:58:15: 58:20 (#0),
380380 },
381381 ],
......@@ -461,7 +461,7 @@ PRINT-ATTR INPUT (DEBUG): TokenStream [
461461 delimiter: Parenthesis,
462462 stream: TokenStream [
463463 Ident {
464 ident: "FALSE",
464 ident: "false",
465465 span: $DIR/issue-75930-derive-cfg.rs:60:15: 60:20 (#0),
466466 },
467467 ],
......@@ -521,7 +521,7 @@ PRINT-ATTR INPUT (DEBUG): TokenStream [
521521 delimiter: Parenthesis,
522522 stream: TokenStream [
523523 Ident {
524 ident: "FALSE",
524 ident: "false",
525525 span: $DIR/issue-75930-derive-cfg.rs:62:19: 62:24 (#0),
526526 },
527527 ],
......@@ -721,7 +721,7 @@ PRINT-ATTR INPUT (DEBUG): TokenStream [
721721 delimiter: Parenthesis,
722722 stream: TokenStream [
723723 Ident {
724 ident: "FALSE",
724 ident: "false",
725725 span: $DIR/issue-75930-derive-cfg.rs:69:20: 69:25 (#0),
726726 },
727727 ],
......@@ -908,7 +908,7 @@ PRINT-ATTR INPUT (DEBUG): TokenStream [
908908 delimiter: Parenthesis,
909909 stream: TokenStream [
910910 Ident {
911 ident: "FALSE",
911 ident: "false",
912912 span: $DIR/issue-75930-derive-cfg.rs:79:23: 79:28 (#0),
913913 },
914914 ],
......@@ -942,7 +942,7 @@ PRINT-ATTR INPUT (DEBUG): TokenStream [
942942 delimiter: Parenthesis,
943943 stream: TokenStream [
944944 Ident {
945 ident: "FALSE",
945 ident: "false",
946946 span: $DIR/issue-75930-derive-cfg.rs:80:23: 80:28 (#0),
947947 },
948948 ],
......@@ -1020,7 +1020,7 @@ PRINT-ATTR INPUT (DEBUG): TokenStream [
10201020 delimiter: Parenthesis,
10211021 stream: TokenStream [
10221022 Ident {
1023 ident: "FALSE",
1023 ident: "false",
10241024 span: $DIR/issue-75930-derive-cfg.rs:82:23: 82:28 (#0),
10251025 },
10261026 ],
......@@ -1075,7 +1075,7 @@ PRINT-ATTR INPUT (DEBUG): TokenStream [
10751075 delimiter: Parenthesis,
10761076 stream: TokenStream [
10771077 Ident {
1078 ident: "FALSE",
1078 ident: "false",
10791079 span: $DIR/issue-75930-derive-cfg.rs:87:19: 87:24 (#0),
10801080 },
10811081 ],
......@@ -1153,7 +1153,7 @@ PRINT-ATTR INPUT (DEBUG): TokenStream [
11531153 delimiter: Parenthesis,
11541154 stream: TokenStream [
11551155 Ident {
1156 ident: "FALSE",
1156 ident: "false",
11571157 span: $DIR/issue-75930-derive-cfg.rs:89:19: 89:24 (#0),
11581158 },
11591159 ],
......@@ -1246,7 +1246,7 @@ PRINT-ATTR INPUT (DEBUG): TokenStream [
12461246 delimiter: Parenthesis,
12471247 stream: TokenStream [
12481248 Ident {
1249 ident: "FALSE",
1249 ident: "false",
12501250 span: $DIR/issue-75930-derive-cfg.rs:94:41: 94:46 (#0),
12511251 },
12521252 ],
tests/ui/proc-macro/nested-derive-cfg.rs+2-2
......@@ -10,10 +10,10 @@ extern crate test_macros;
1010
1111#[derive(Print)]
1212struct Foo {
13 #[cfg(FALSE)] removed: bool,
13 #[cfg(false)] removed: bool,
1414 my_array: [bool; {
1515 struct Inner {
16 #[cfg(FALSE)] removed_inner_field: u8,
16 #[cfg(false)] removed_inner_field: u8,
1717 non_removed_inner_field: usize
1818 }
1919 0
tests/ui/proc-macro/nonterminal-token-hygiene.rs+1
......@@ -8,6 +8,7 @@
88//@ normalize-stdout: "expn\d{3,}" -> "expnNNN"
99//@ normalize-stdout: "extern crate compiler_builtins /\* \d+ \*/" -> "extern crate compiler_builtins /* NNN */"
1010//@ proc-macro: test-macros.rs
11//@ edition: 2015
1112
1213#![feature(decl_macro)]
1314#![no_std] // Don't load unnecessary hygiene information from std
tests/ui/proc-macro/nonterminal-token-hygiene.stdout+5-4
......@@ -5,19 +5,19 @@ PRINT-BANG INPUT (DEBUG): TokenStream [
55 stream: TokenStream [
66 Ident {
77 ident: "struct",
8 span: $DIR/nonterminal-token-hygiene.rs:32:5: 32:11 (#5),
8 span: $DIR/nonterminal-token-hygiene.rs:33:5: 33:11 (#5),
99 },
1010 Ident {
1111 ident: "S",
12 span: $DIR/nonterminal-token-hygiene.rs:32:12: 32:13 (#5),
12 span: $DIR/nonterminal-token-hygiene.rs:33:12: 33:13 (#5),
1313 },
1414 Punct {
1515 ch: ';',
1616 spacing: Alone,
17 span: $DIR/nonterminal-token-hygiene.rs:32:13: 32:14 (#5),
17 span: $DIR/nonterminal-token-hygiene.rs:33:13: 33:14 (#5),
1818 },
1919 ],
20 span: $DIR/nonterminal-token-hygiene.rs:22:27: 22:32 (#4),
20 span: $DIR/nonterminal-token-hygiene.rs:23:27: 23:32 (#4),
2121 },
2222]
2323#![feature /* 0#0 */(prelude_import)]
......@@ -32,6 +32,7 @@ PRINT-BANG INPUT (DEBUG): TokenStream [
3232//@ normalize-stdout: "expn\d{3,}" -> "expnNNN"
3333//@ normalize-stdout: "extern crate compiler_builtins /\* \d+ \*/" -> "extern crate compiler_builtins /* NNN */"
3434//@ proc-macro: test-macros.rs
35//@ edition: 2015
3536
3637#![feature /* 0#0 */(decl_macro)]
3738#![no_std /* 0#0 */]
tests/ui/proc-macro/quote/debug.rs+1
......@@ -3,6 +3,7 @@
33//@ no-prefer-dynamic
44//@ compile-flags: -Z unpretty=expanded
55//@ needs-unwind compiling proc macros with panic=abort causes a warning
6//@ edition: 2015
67//
78// This file is not actually used as a proc-macro - instead,
89// it's just used to show the output of the `quote!` macro
tests/ui/proc-macro/quote/debug.stdout+1
......@@ -5,6 +5,7 @@
55//@ no-prefer-dynamic
66//@ compile-flags: -Z unpretty=expanded
77//@ needs-unwind compiling proc macros with panic=abort causes a warning
8//@ edition: 2015
89//
910// This file is not actually used as a proc-macro - instead,
1011// it's just used to show the output of the `quote!` macro
tests/ui/reachable/unreachable-by-call-arguments-issue-139627.rs created+16
......@@ -0,0 +1,16 @@
1//@ check-pass
2#![deny(unreachable_code)]
3#![deny(unused)]
4
5pub enum Void {}
6
7pub struct S<T>(T);
8
9pub fn foo(void: Void, void1: Void) {
10 let s = S(void);
11 drop(s);
12 let s1 = S { 0: void1 };
13 drop(s1);
14}
15
16fn main() {}
tests/ui/rfcs/rfc-2294-if-let-guard/feature-gate.rs+1-1
......@@ -64,7 +64,7 @@ fn _macros() {
6464 //~^ ERROR expected expression, found `let` statement
6565 //~| ERROR expected expression, found `let` statement
6666 match () {
67 #[cfg(FALSE)]
67 #[cfg(false)]
6868 () if let 0 = 1 => {}
6969 //~^ ERROR `if let` guards are experimental
7070 _ => {}
tests/ui/rfcs/rfc-2294-if-let-guard/parens.rs+1-1
......@@ -3,7 +3,7 @@
33#![feature(if_let_guard)]
44#![feature(let_chains)]
55
6#[cfg(FALSE)]
6#[cfg(false)]
77fn un_cfged() {
88 match () {
99 () if let 0 = 1 => {}
tests/ui/rfcs/rfc-2497-if-let-chains/ast-pretty-check.rs+1
......@@ -1,5 +1,6 @@
11//@ check-pass
22//@ compile-flags: -Z unpretty=expanded
3//@ edition: 2015
34
45fn main() {
56 if let 0 = 1 {}
tests/ui/rfcs/rfc-2497-if-let-chains/ast-pretty-check.stdout+1
......@@ -6,5 +6,6 @@ use ::std::prelude::rust_2015::*;
66extern crate std;
77//@ check-pass
88//@ compile-flags: -Z unpretty=expanded
9//@ edition: 2015
910
1011fn main() { if let 0 = 1 {} }
tests/ui/rfcs/rfc-2497-if-let-chains/disallowed-positions.rs+4-4
......@@ -340,12 +340,12 @@ fn outside_if_and_while_expr() {
340340 //~| ERROR expected expression, found `let` statement
341341
342342 {
343 #[cfg(FALSE)]
343 #[cfg(false)]
344344 let x = true && let y = 1;
345345 //~^ ERROR expected expression, found `let` statement
346346 }
347347
348 #[cfg(FALSE)]
348 #[cfg(false)]
349349 {
350350 [1, 2, 3][let _ = ()]
351351 //~^ ERROR expected expression, found `let` statement
......@@ -436,11 +436,11 @@ fn with_parenthesis() {
436436 //[no_feature]~^ ERROR `let` expressions in this position are unstable
437437 }
438438
439 #[cfg(FALSE)]
439 #[cfg(false)]
440440 let x = (true && let y = 1);
441441 //~^ ERROR expected expression, found `let` statement
442442
443 #[cfg(FALSE)]
443 #[cfg(false)]
444444 {
445445 ([1, 2, 3][let _ = ()])
446446 //~^ ERROR expected expression, found `let` statement
tests/ui/rfcs/rfc-2497-if-let-chains/feature-gate.rs+1-1
......@@ -51,7 +51,7 @@ fn _macros() {
5151 while $e {}
5252 }
5353 }
54 #[cfg(FALSE)] (let 0 = 1);
54 #[cfg(false)] (let 0 = 1);
5555 //~^ ERROR expected expression, found `let` statement
5656 use_expr!(let 0 = 1);
5757 //~^ ERROR no rules expected keyword `let`
tests/ui/rfcs/rfc-2497-if-let-chains/feature-gate.stderr+1-1
......@@ -1,7 +1,7 @@
11error: expected expression, found `let` statement
22 --> $DIR/feature-gate.rs:54:20
33 |
4LL | #[cfg(FALSE)] (let 0 = 1);
4LL | #[cfg(false)] (let 0 = 1);
55 | ^^^
66 |
77 = note: only supported directly in conditions of `if` and `while` expressions
tests/ui/rfcs/rfc-2497-if-let-chains/invalid-let-in-a-valid-let-context.rs+5-5
......@@ -3,12 +3,12 @@
33fn main() {
44 let _opt = Some(1i32);
55
6 #[cfg(FALSE)]
6 #[cfg(false)]
77 {
88 let _ = &&let Some(x) = Some(42);
99 //~^ ERROR expected expression, found `let` statement
1010 }
11 #[cfg(FALSE)]
11 #[cfg(false)]
1212 {
1313 if let Some(elem) = _opt && [1, 2, 3][let _ = &&let Some(x) = Some(42)] = 1 {
1414 //~^ ERROR expected expression, found `let` statement
......@@ -18,7 +18,7 @@ fn main() {
1818 }
1919 }
2020
21 #[cfg(FALSE)]
21 #[cfg(false)]
2222 {
2323 if let Some(elem) = _opt && {
2424 [1, 2, 3][let _ = ()];
......@@ -28,7 +28,7 @@ fn main() {
2828 }
2929 }
3030
31 #[cfg(FALSE)]
31 #[cfg(false)]
3232 {
3333 if let Some(elem) = _opt && [1, 2, 3][let _ = ()] = 1 {
3434 //~^ ERROR expected expression, found `let` statement
......@@ -36,7 +36,7 @@ fn main() {
3636 true
3737 }
3838 }
39 #[cfg(FALSE)]
39 #[cfg(false)]
4040 {
4141 if let a = 1 && {
4242 let x = let y = 1;
tests/ui/rfcs/rfc-2565-param-attrs/attr-without-param.rs+3-3
......@@ -1,14 +1,14 @@
1#[cfg(FALSE)]
1#[cfg(false)]
22impl S {
33 fn f(#[attr]) {} //~ ERROR expected parameter name, found `)`
44}
55
6#[cfg(FALSE)]
6#[cfg(false)]
77impl T for S {
88 fn f(#[attr]) {} //~ ERROR expected parameter name, found `)`
99}
1010
11#[cfg(FALSE)]
11#[cfg(false)]
1212trait T {
1313 fn f(#[attr]); //~ ERROR expected argument name, found `)`
1414}
tests/ui/specialization/issue-63716-parse-async.rs+1-1
......@@ -8,7 +8,7 @@
88
99fn main() {}
1010
11#[cfg(FALSE)]
11#[cfg(false)]
1212impl Foo for Bar {
1313 default async fn baz() {}
1414}
tests/ui/suggestions/const-no-type.rs+3-3
......@@ -10,19 +10,19 @@ fn main() {}
1010
1111// These will not reach typeck:
1212
13#[cfg(FALSE)]
13#[cfg(false)]
1414const C2 = 42;
1515//~^ ERROR missing type for `const` item
1616//~| HELP provide a type for the item
1717//~| SUGGESTION : <type>
1818
19#[cfg(FALSE)]
19#[cfg(false)]
2020static S2 = "abc";
2121//~^ ERROR missing type for `static` item
2222//~| HELP provide a type for the item
2323//~| SUGGESTION : <type>
2424
25#[cfg(FALSE)]
25#[cfg(false)]
2626static mut SM2 = "abc";
2727//~^ ERROR missing type for `static mut` item
2828//~| HELP provide a type for the item
tests/ui/suggestions/type-ascription-and-other-error.rs+1-1
......@@ -1,6 +1,6 @@
11fn main() {
22 not rust; //~ ERROR
33 let _ = 0: i32; // (error hidden by existing error)
4 #[cfg(FALSE)]
4 #[cfg(false)]
55 let _ = 0: i32; // (warning hidden by existing error)
66}
tests/ui/type-alias-impl-trait/issue-60662.rs+1
......@@ -1,5 +1,6 @@
11//@ check-pass
22//@ compile-flags: -Z unpretty=hir
3//@ edition: 2015
34
45#![feature(type_alias_impl_trait)]
56
tests/ui/type-alias-impl-trait/issue-60662.stdout+1
......@@ -1,5 +1,6 @@
11//@ check-pass
22//@ compile-flags: -Z unpretty=hir
3//@ edition: 2015
34
45#![feature(type_alias_impl_trait)]
56#[prelude_import]
tests/ui/unpretty/bad-literal.rs+1
......@@ -1,5 +1,6 @@
11//@ compile-flags: -Zunpretty=hir
22//@ check-fail
3//@ edition: 2015
34
45// In #100948 this caused an ICE with -Zunpretty=hir.
56fn main() {
tests/ui/unpretty/bad-literal.stderr+1-1
......@@ -1,5 +1,5 @@
11error: invalid suffix `u` for number literal
2 --> $DIR/bad-literal.rs:6:5
2 --> $DIR/bad-literal.rs:7:5
33 |
44LL | 1u;
55 | ^^ invalid suffix `u`
tests/ui/unpretty/bad-literal.stdout+1
......@@ -4,6 +4,7 @@ use ::std::prelude::rust_2015::*;
44extern crate std;
55//@ compile-flags: -Zunpretty=hir
66//@ check-fail
7//@ edition: 2015
78
89// In #100948 this caused an ICE with -Zunpretty=hir.
910fn main() {
tests/ui/unpretty/debug-fmt-hir.rs+1
......@@ -1,5 +1,6 @@
11//@ compile-flags: -Zunpretty=hir
22//@ check-pass
3//@ edition: 2015
34
45use std::fmt;
56
tests/ui/unpretty/debug-fmt-hir.stdout+1
......@@ -4,6 +4,7 @@ use ::std::prelude::rust_2015::*;
44extern crate std;
55//@ compile-flags: -Zunpretty=hir
66//@ check-pass
7//@ edition: 2015
78
89use std::fmt;
910
tests/ui/unpretty/deprecated-attr.rs+1
......@@ -1,5 +1,6 @@
11//@ compile-flags: -Zunpretty=hir
22//@ check-pass
3//@ edition: 2015
34
45#[deprecated]
56pub struct PlainDeprecated;
tests/ui/unpretty/deprecated-attr.stdout+1
......@@ -4,6 +4,7 @@ use ::std::prelude::rust_2015::*;
44extern crate std;
55//@ compile-flags: -Zunpretty=hir
66//@ check-pass
7//@ edition: 2015
78
89#[attr = Deprecation {deprecation: Deprecation {since: Unspecified}}]
910struct PlainDeprecated;
tests/ui/unpretty/diagnostic-attr.rs+1
......@@ -1,5 +1,6 @@
11//@ compile-flags: -Zunpretty=hir
22//@ check-pass
3//@ edition: 2015
34
45#[diagnostic::on_unimplemented(
56 message = "My Message for `ImportantTrait<{A}>` implemented for `{Self}`",
tests/ui/unpretty/diagnostic-attr.stdout+1
......@@ -4,6 +4,7 @@ use ::std::prelude::rust_2015::*;
44extern crate std;
55//@ compile-flags: -Zunpretty=hir
66//@ check-pass
7//@ edition: 2015
78
89#[diagnostic::on_unimplemented(message =
910"My Message for `ImportantTrait<{A}>` implemented for `{Self}`", label =
tests/ui/unpretty/expanded-interpolation.rs+1
......@@ -1,5 +1,6 @@
11//@ compile-flags: -Zunpretty=expanded
22//@ check-pass
3//@ edition: 2015
34
45// This test covers the AST pretty-printer's insertion of parentheses in some
56// macro metavariable edge cases. Synthetic parentheses (i.e. not appearing in
tests/ui/unpretty/expanded-interpolation.stdout+1
......@@ -2,6 +2,7 @@
22#![no_std]
33//@ compile-flags: -Zunpretty=expanded
44//@ check-pass
5//@ edition: 2015
56
67// This test covers the AST pretty-printer's insertion of parentheses in some
78// macro metavariable edge cases. Synthetic parentheses (i.e. not appearing in
tests/ui/unpretty/flattened-format-args.rs+1
......@@ -1,5 +1,6 @@
11//@ compile-flags: -Zunpretty=hir -Zflatten-format-args=yes
22//@ check-pass
3//@ edition: 2015
34
45fn main() {
56 let x = 1;
tests/ui/unpretty/flattened-format-args.stdout+1
......@@ -4,6 +4,7 @@ use ::std::prelude::rust_2015::*;
44extern crate std;
55//@ compile-flags: -Zunpretty=hir -Zflatten-format-args=yes
66//@ check-pass
7//@ edition: 2015
78
89fn main() {
910 let x = 1;
tests/ui/unpretty/let-else-hir.rs+1
......@@ -1,5 +1,6 @@
11//@ compile-flags: -Zunpretty=hir
22//@ check-pass
3//@ edition: 2015
34
45
56
tests/ui/unpretty/let-else-hir.stdout+1
......@@ -4,6 +4,7 @@ use ::std::prelude::rust_2015::*;
44extern crate std;
55//@ compile-flags: -Zunpretty=hir
66//@ check-pass
7//@ edition: 2015
78
89
910
tests/ui/unpretty/self-hir.rs+1
......@@ -1,5 +1,6 @@
11//@ compile-flags: -Zunpretty=hir
22//@ check-pass
3//@ edition: 2015
34
45pub struct Bar {
56 a: String,
tests/ui/unpretty/self-hir.stdout+1
......@@ -4,6 +4,7 @@ use ::std::prelude::rust_2015::*;
44extern crate std;
55//@ compile-flags: -Zunpretty=hir
66//@ check-pass
7//@ edition: 2015
78
89struct Bar {
910 a: String,
tests/ui/unpretty/unpretty-expr-fn-arg.rs+1
......@@ -6,6 +6,7 @@
66
77//@ check-pass
88//@ compile-flags: -Zunpretty=hir,typed
9//@ edition: 2015
910#![allow(dead_code)]
1011
1112fn main() {}
tests/ui/unpretty/unpretty-expr-fn-arg.stdout+1
......@@ -6,6 +6,7 @@
66
77//@ check-pass
88//@ compile-flags: -Zunpretty=hir,typed
9//@ edition: 2015
910#![allow(dead_code)]
1011#[prelude_import]
1112use ::std::prelude::rust_2015::*;
tests/ui/wasm/wasm-import-module.rs+1-1
......@@ -15,7 +15,7 @@ extern "C" {}
1515#[link(wasm_import_module = "foo", kind = "dylib")] //~ ERROR: `wasm_import_module` is incompatible with other arguments
1616extern "C" {}
1717
18#[link(wasm_import_module = "foo", cfg(FALSE))] //~ ERROR: `wasm_import_module` is incompatible with other arguments
18#[link(wasm_import_module = "foo", cfg(false))] //~ ERROR: `wasm_import_module` is incompatible with other arguments
1919extern "C" {}
2020
2121fn main() {}
tests/ui/wasm/wasm-import-module.stderr+1-1
......@@ -31,7 +31,7 @@ LL | #[link(wasm_import_module = "foo", kind = "dylib")]
3131error: `wasm_import_module` is incompatible with other arguments in `#[link]` attributes
3232 --> $DIR/wasm-import-module.rs:18:8
3333 |
34LL | #[link(wasm_import_module = "foo", cfg(FALSE))]
34LL | #[link(wasm_import_module = "foo", cfg(false))]
3535 | ^^^^^^^^^^^^^^^^^^^^^^^^^^
3636
3737error: aborting due to 6 previous errors