| author | bors <bors@rust-lang.org> 2025-04-17 11:21:54 UTC |
| committer | bors <bors@rust-lang.org> 2025-04-17 11:21:54 UTC |
| log | 883f9f72e87ccb6838d528d8158ea6323baacc65 |
| tree | 8252f01daf779855a606cff9433342feddac0004 |
| parent | 94015d3cd4b48d098abd0f3e44af97dab2b713b4 |
| parent | 7650fe95b1b2f4b030c0de9a06b5bea582f26480 |
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: rollup240 files changed, 1038 insertions(+), 978 deletions(-)
.git-blame-ignore-revs+2| ... | ... | @@ -31,3 +31,5 @@ ec2cc761bc7067712ecc7734502f703fe3b024c8 |
| 31 | 31 | c682aa162b0d41e21cc6748f4fecfe01efb69d1f |
| 32 | 32 | # reformat with updated edition 2024 |
| 33 | 33 | 1fcae03369abb4c2cc180cd5a49e1f4440a81300 |
| 34 | # Breaking up of compiletest runtest.rs | |
| 35 | 60600a6fa403216bfd66e04f948b1822f6450af7 |
compiler/rustc_ast_passes/src/errors.rs+3-11| ... | ... | @@ -2,7 +2,7 @@ |
| 2 | 2 | |
| 3 | 3 | use rustc_ast::ParamKindOrd; |
| 4 | 4 | use rustc_errors::codes::*; |
| 5 | use rustc_errors::{Applicability, Diag, EmissionGuarantee, SubdiagMessageOp, Subdiagnostic}; | |
| 5 | use rustc_errors::{Applicability, Diag, EmissionGuarantee, Subdiagnostic}; | |
| 6 | 6 | use rustc_macros::{Diagnostic, Subdiagnostic}; |
| 7 | 7 | use rustc_span::{Ident, Span, Symbol}; |
| 8 | 8 | |
| ... | ... | @@ -394,11 +394,7 @@ pub(crate) struct EmptyLabelManySpans(pub Vec<Span>); |
| 394 | 394 | |
| 395 | 395 | // The derive for `Vec<Span>` does multiple calls to `span_label`, adding commas between each |
| 396 | 396 | impl 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>) { | |
| 402 | 398 | diag.span_labels(self.0, ""); |
| 403 | 399 | } |
| 404 | 400 | } |
| ... | ... | @@ -749,11 +745,7 @@ pub(crate) struct StableFeature { |
| 749 | 745 | } |
| 750 | 746 | |
| 751 | 747 | impl 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>) { | |
| 757 | 749 | diag.arg("name", self.name); |
| 758 | 750 | diag.arg("since", self.since); |
| 759 | 751 | 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; |
| 7 | 7 | use rustc_session::lint::BuiltinLintDiag; |
| 8 | 8 | use rustc_session::lint::builtin::UNEXPECTED_CFGS; |
| 9 | 9 | use rustc_session::parse::feature_err; |
| 10 | use rustc_span::symbol::kw; | |
| 11 | 10 | use rustc_span::{Span, Symbol, sym}; |
| 12 | 11 | |
| 13 | 12 | use crate::session_diagnostics::{self, UnsupportedLiteralReason}; |
| ... | ... | @@ -89,20 +88,6 @@ pub fn eval_condition( |
| 89 | 88 | let cfg = match cfg { |
| 90 | 89 | MetaItemInner::MetaItem(meta_item) => meta_item, |
| 91 | 90 | 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 | } | |
| 106 | 91 | return *b; |
| 107 | 92 | } |
| 108 | 93 | _ => { |
compiler/rustc_builtin_macros/src/errors.rs+3-7| ... | ... | @@ -1,7 +1,7 @@ |
| 1 | 1 | use rustc_errors::codes::*; |
| 2 | 2 | use rustc_errors::{ |
| 3 | 3 | Diag, DiagCtxtHandle, Diagnostic, EmissionGuarantee, Level, MultiSpan, SingleLabelManySpans, |
| 4 | SubdiagMessageOp, Subdiagnostic, | |
| 4 | Subdiagnostic, | |
| 5 | 5 | }; |
| 6 | 6 | use rustc_macros::{Diagnostic, Subdiagnostic}; |
| 7 | 7 | use rustc_span::{Ident, Span, Symbol}; |
| ... | ... | @@ -684,13 +684,9 @@ pub(crate) struct FormatUnusedArg { |
| 684 | 684 | // Allow the singular form to be a subdiagnostic of the multiple-unused |
| 685 | 685 | // form of diagnostic. |
| 686 | 686 | impl 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>) { | |
| 692 | 688 | 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); | |
| 694 | 690 | diag.span_label(self.span, msg); |
| 695 | 691 | } |
| 696 | 692 | } |
compiler/rustc_const_eval/src/errors.rs+3-7| ... | ... | @@ -6,7 +6,7 @@ use rustc_abi::WrappingRange; |
| 6 | 6 | use rustc_errors::codes::*; |
| 7 | 7 | use rustc_errors::{ |
| 8 | 8 | Diag, DiagArgValue, DiagCtxtHandle, DiagMessage, Diagnostic, EmissionGuarantee, Level, |
| 9 | MultiSpan, SubdiagMessageOp, Subdiagnostic, | |
| 9 | MultiSpan, Subdiagnostic, | |
| 10 | 10 | }; |
| 11 | 11 | use rustc_hir::ConstContext; |
| 12 | 12 | use rustc_macros::{Diagnostic, LintDiagnostic, Subdiagnostic}; |
| ... | ... | @@ -290,11 +290,7 @@ pub struct FrameNote { |
| 290 | 290 | } |
| 291 | 291 | |
| 292 | 292 | impl 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>) { | |
| 298 | 294 | diag.arg("times", self.times); |
| 299 | 295 | diag.arg("where_", self.where_); |
| 300 | 296 | diag.arg("instance", self.instance); |
| ... | ... | @@ -302,7 +298,7 @@ impl Subdiagnostic for FrameNote { |
| 302 | 298 | if self.has_label && !self.span.is_dummy() { |
| 303 | 299 | span.push_span_label(self.span, fluent::const_eval_frame_note_last); |
| 304 | 300 | } |
| 305 | let msg = f(diag, fluent::const_eval_frame_note.into()); | |
| 301 | let msg = diag.eagerly_translate(fluent::const_eval_frame_note); | |
| 306 | 302 | diag.span_note(span, msg); |
| 307 | 303 | } |
| 308 | 304 | } |
compiler/rustc_errors/src/diagnostic.rs+13-20| ... | ... | @@ -181,22 +181,9 @@ where |
| 181 | 181 | Self: Sized, |
| 182 | 182 | { |
| 183 | 183 | /// 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>); | |
| 195 | 185 | } |
| 196 | 186 | |
| 197 | pub trait SubdiagMessageOp<G: EmissionGuarantee> = | |
| 198 | Fn(&mut Diag<'_, G>, SubdiagMessage) -> SubdiagMessage; | |
| 199 | ||
| 200 | 187 | /// Trait implemented by lint types. This should not be implemented manually. Instead, use |
| 201 | 188 | /// `#[derive(LintDiagnostic)]` -- see [rustc_macros::LintDiagnostic]. |
| 202 | 189 | #[rustc_diagnostic_item = "LintDiagnostic"] |
| ... | ... | @@ -1227,15 +1214,21 @@ impl<'a, G: EmissionGuarantee> Diag<'a, G> { |
| 1227 | 1214 | /// interpolated variables). |
| 1228 | 1215 | #[rustc_lint_diagnostics] |
| 1229 | 1216 | 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); | |
| 1236 | 1218 | self |
| 1237 | 1219 | } |
| 1238 | 1220 | |
| 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 | ||
| 1239 | 1232 | with_fn! { with_span, |
| 1240 | 1233 | /// Add a span. |
| 1241 | 1234 | #[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}; |
| 19 | 19 | use crate::diagnostic::DiagLocation; |
| 20 | 20 | use crate::{ |
| 21 | 21 | Diag, DiagArgValue, DiagCtxtHandle, Diagnostic, EmissionGuarantee, ErrCode, IntoDiagArg, Level, |
| 22 | SubdiagMessageOp, Subdiagnostic, fluent_generated as fluent, | |
| 22 | Subdiagnostic, fluent_generated as fluent, | |
| 23 | 23 | }; |
| 24 | 24 | |
| 25 | 25 | pub struct DiagArgFromDisplay<'a>(pub &'a dyn fmt::Display); |
| ... | ... | @@ -384,11 +384,7 @@ pub struct SingleLabelManySpans { |
| 384 | 384 | pub label: &'static str, |
| 385 | 385 | } |
| 386 | 386 | impl 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>) { | |
| 392 | 388 | diag.span_labels(self.spans, self.label); |
| 393 | 389 | } |
| 394 | 390 | } |
compiler/rustc_errors/src/lib.rs+1-1| ... | ... | @@ -47,7 +47,7 @@ pub use codes::*; |
| 47 | 47 | pub use diagnostic::{ |
| 48 | 48 | BugAbort, Diag, DiagArg, DiagArgMap, DiagArgName, DiagArgValue, DiagInner, DiagStyledString, |
| 49 | 49 | Diagnostic, EmissionGuarantee, FatalAbort, IntoDiagArg, LintDiagnostic, StringPart, Subdiag, |
| 50 | SubdiagMessageOp, Subdiagnostic, | |
| 50 | Subdiagnostic, | |
| 51 | 51 | }; |
| 52 | 52 | pub use diagnostic_impls::{ |
| 53 | 53 | DiagArgFromDisplay, DiagSymbolList, ElidedLifetimeInPathSubdiag, ExpectedLifetimeParameter, |
compiler/rustc_feature/src/accepted.rs+2| ... | ... | @@ -95,6 +95,8 @@ declare_features! ( |
| 95 | 95 | (accepted, c_unwind, "1.81.0", Some(74990)), |
| 96 | 96 | /// Allows `#[cfg_attr(predicate, multiple, attributes, here)]`. |
| 97 | 97 | (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)), | |
| 98 | 100 | /// Allows the use of `#[cfg(doctest)]`, set when rustdoc is collecting doctests. |
| 99 | 101 | (accepted, cfg_doctest, "1.40.0", Some(62210)), |
| 100 | 102 | /// Enables `#[cfg(panic = "...")]` config key. |
compiler/rustc_feature/src/unstable.rs-2| ... | ... | @@ -391,8 +391,6 @@ declare_features! ( |
| 391 | 391 | (unstable, async_trait_bounds, "1.85.0", Some(62290)), |
| 392 | 392 | /// Allows using C-variadics. |
| 393 | 393 | (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)), | |
| 396 | 394 | /// Allows the use of `#[cfg(contract_checks)` to check if contract checks are enabled. |
| 397 | 395 | (unstable, cfg_contract_checks, "1.86.0", Some(128044)), |
| 398 | 396 | /// 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; |
| 5 | 5 | use rustc_errors::codes::*; |
| 6 | 6 | use rustc_errors::{ |
| 7 | 7 | Applicability, Diag, DiagArgValue, DiagSymbolList, EmissionGuarantee, IntoDiagArg, MultiSpan, |
| 8 | SubdiagMessageOp, Subdiagnostic, | |
| 8 | Subdiagnostic, | |
| 9 | 9 | }; |
| 10 | 10 | use rustc_macros::{Diagnostic, LintDiagnostic, Subdiagnostic}; |
| 11 | 11 | use rustc_middle::ty::{self, Ty}; |
| ... | ... | @@ -270,11 +270,7 @@ pub(crate) struct SuggestAnnotations { |
| 270 | 270 | pub suggestions: Vec<SuggestAnnotation>, |
| 271 | 271 | } |
| 272 | 272 | impl 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>) { | |
| 278 | 274 | if self.suggestions.is_empty() { |
| 279 | 275 | return; |
| 280 | 276 | } |
| ... | ... | @@ -337,11 +333,7 @@ pub(crate) struct TypeMismatchFruTypo { |
| 337 | 333 | } |
| 338 | 334 | |
| 339 | 335 | impl 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>) { | |
| 345 | 337 | diag.arg("expr", self.expr.as_deref().unwrap_or("NONE")); |
| 346 | 338 | |
| 347 | 339 | // Only explain that `a ..b` is a range if it's split up |
| ... | ... | @@ -599,11 +591,7 @@ pub(crate) struct RemoveSemiForCoerce { |
| 599 | 591 | } |
| 600 | 592 | |
| 601 | 593 | impl 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>) { | |
| 607 | 595 | let mut multispan: MultiSpan = self.semi.into(); |
| 608 | 596 | multispan.push_span_label(self.expr, fluent::hir_typeck_remove_semi_for_coerce_expr); |
| 609 | 597 | multispan.push_span_label(self.ret, fluent::hir_typeck_remove_semi_for_coerce_ret); |
| ... | ... | @@ -778,20 +766,16 @@ pub(crate) enum CastUnknownPointerSub { |
| 778 | 766 | } |
| 779 | 767 | |
| 780 | 768 | impl 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>) { | |
| 786 | 770 | match self { |
| 787 | 771 | 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); | |
| 789 | 773 | 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); | |
| 791 | 775 | diag.note(msg); |
| 792 | 776 | } |
| 793 | 777 | 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); | |
| 795 | 779 | diag.span_label(span, msg); |
| 796 | 780 | } |
| 797 | 781 | } |
compiler/rustc_lint/src/errors.rs+2-6| ... | ... | @@ -1,5 +1,5 @@ |
| 1 | 1 | use rustc_errors::codes::*; |
| 2 | use rustc_errors::{Diag, EmissionGuarantee, SubdiagMessageOp, Subdiagnostic}; | |
| 2 | use rustc_errors::{Diag, EmissionGuarantee, Subdiagnostic}; | |
| 3 | 3 | use rustc_macros::{Diagnostic, Subdiagnostic}; |
| 4 | 4 | use rustc_session::lint::Level; |
| 5 | 5 | use rustc_span::{Span, Symbol}; |
| ... | ... | @@ -26,11 +26,7 @@ pub(crate) enum OverruledAttributeSub { |
| 26 | 26 | } |
| 27 | 27 | |
| 28 | 28 | impl 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>) { | |
| 34 | 30 | match self { |
| 35 | 31 | OverruledAttributeSub::DefaultSource { id } => { |
| 36 | 32 | diag.note(fluent::lint_default_source); |
compiler/rustc_lint/src/if_let_rescope.rs+3-9| ... | ... | @@ -3,9 +3,7 @@ use std::ops::ControlFlow; |
| 3 | 3 | |
| 4 | 4 | use hir::intravisit::{self, Visitor}; |
| 5 | 5 | use rustc_ast::Recovered; |
| 6 | use rustc_errors::{ | |
| 7 | Applicability, Diag, EmissionGuarantee, SubdiagMessageOp, Subdiagnostic, SuggestionStyle, | |
| 8 | }; | |
| 6 | use rustc_errors::{Applicability, Diag, EmissionGuarantee, Subdiagnostic, SuggestionStyle}; | |
| 9 | 7 | use rustc_hir::{self as hir, HirIdSet}; |
| 10 | 8 | use rustc_macros::{LintDiagnostic, Subdiagnostic}; |
| 11 | 9 | use rustc_middle::ty::adjustment::Adjust; |
| ... | ... | @@ -327,11 +325,7 @@ struct IfLetRescopeRewrite { |
| 327 | 325 | } |
| 328 | 326 | |
| 329 | 327 | impl 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>) { | |
| 335 | 329 | let mut suggestions = vec![]; |
| 336 | 330 | for match_head in self.match_heads { |
| 337 | 331 | match match_head { |
| ... | ... | @@ -360,7 +354,7 @@ impl Subdiagnostic for IfLetRescopeRewrite { |
| 360 | 354 | .chain(repeat('}').take(closing_brackets.count)) |
| 361 | 355 | .collect(), |
| 362 | 356 | )); |
| 363 | let msg = f(diag, crate::fluent_generated::lint_suggestion); | |
| 357 | let msg = diag.eagerly_translate(crate::fluent_generated::lint_suggestion); | |
| 364 | 358 | diag.multipart_suggestion_with_style( |
| 365 | 359 | msg, |
| 366 | 360 | suggestions, |
compiler/rustc_lint/src/lints.rs+8-36| ... | ... | @@ -6,7 +6,7 @@ use rustc_abi::ExternAbi; |
| 6 | 6 | use rustc_errors::codes::*; |
| 7 | 7 | use rustc_errors::{ |
| 8 | 8 | Applicability, Diag, DiagArgValue, DiagMessage, DiagStyledString, ElidedLifetimeInPathSubdiag, |
| 9 | EmissionGuarantee, LintDiagnostic, MultiSpan, SubdiagMessageOp, Subdiagnostic, SuggestionStyle, | |
| 9 | EmissionGuarantee, LintDiagnostic, MultiSpan, Subdiagnostic, SuggestionStyle, | |
| 10 | 10 | }; |
| 11 | 11 | use rustc_hir::def::Namespace; |
| 12 | 12 | use rustc_hir::def_id::DefId; |
| ... | ... | @@ -449,11 +449,7 @@ pub(crate) struct BuiltinUnpermittedTypeInitSub { |
| 449 | 449 | } |
| 450 | 450 | |
| 451 | 451 | impl 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>) { | |
| 457 | 453 | let mut err = self.err; |
| 458 | 454 | loop { |
| 459 | 455 | if let Some(span) = err.span { |
| ... | ... | @@ -504,11 +500,7 @@ pub(crate) struct BuiltinClashingExternSub<'a> { |
| 504 | 500 | } |
| 505 | 501 | |
| 506 | 502 | impl 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>) { | |
| 512 | 504 | let mut expected_str = DiagStyledString::new(); |
| 513 | 505 | expected_str.push(self.expected.fn_sig(self.tcx).to_string(), false); |
| 514 | 506 | let mut found_str = DiagStyledString::new(); |
| ... | ... | @@ -824,11 +816,7 @@ pub(crate) struct HiddenUnicodeCodepointsDiagLabels { |
| 824 | 816 | } |
| 825 | 817 | |
| 826 | 818 | impl 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>) { | |
| 832 | 820 | for (c, span) in self.spans { |
| 833 | 821 | diag.span_label(span, format!("{c:?}")); |
| 834 | 822 | } |
| ... | ... | @@ -842,11 +830,7 @@ pub(crate) enum HiddenUnicodeCodepointsDiagSub { |
| 842 | 830 | |
| 843 | 831 | // Used because of multiple multipart_suggestion and note |
| 844 | 832 | impl 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>) { | |
| 850 | 834 | match self { |
| 851 | 835 | HiddenUnicodeCodepointsDiagSub::Escape { spans } => { |
| 852 | 836 | diag.multipart_suggestion_with_style( |
| ... | ... | @@ -1015,11 +999,7 @@ pub(crate) struct NonBindingLetSub { |
| 1015 | 999 | } |
| 1016 | 1000 | |
| 1017 | 1001 | impl 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>) { | |
| 1023 | 1003 | let can_suggest_binding = self.drop_fn_start_end.is_some() || !self.is_assign_desugar; |
| 1024 | 1004 | |
| 1025 | 1005 | if can_suggest_binding { |
| ... | ... | @@ -1303,11 +1283,7 @@ pub(crate) enum NonSnakeCaseDiagSub { |
| 1303 | 1283 | } |
| 1304 | 1284 | |
| 1305 | 1285 | impl 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>) { | |
| 1311 | 1287 | match self { |
| 1312 | 1288 | NonSnakeCaseDiagSub::Label { span } => { |
| 1313 | 1289 | diag.span_label(span, fluent::lint_label); |
| ... | ... | @@ -1629,11 +1605,7 @@ pub(crate) enum OverflowingBinHexSign { |
| 1629 | 1605 | } |
| 1630 | 1606 | |
| 1631 | 1607 | impl 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>) { | |
| 1637 | 1609 | match self { |
| 1638 | 1610 | OverflowingBinHexSign::Positive => { |
| 1639 | 1611 | diag.note(fluent::lint_positive_note); |
compiler/rustc_macros/src/diagnostics/subdiagnostic.rs+4-11| ... | ... | @@ -20,14 +20,12 @@ use crate::diagnostics::utils::{ |
| 20 | 20 | /// The central struct for constructing the `add_to_diag` method from an annotated struct. |
| 21 | 21 | pub(crate) struct SubdiagnosticDerive { |
| 22 | 22 | diag: syn::Ident, |
| 23 | f: syn::Ident, | |
| 24 | 23 | } |
| 25 | 24 | |
| 26 | 25 | impl SubdiagnosticDerive { |
| 27 | 26 | pub(crate) fn new() -> Self { |
| 28 | 27 | let diag = format_ident!("diag"); |
| 29 | let f = format_ident!("f"); | |
| 30 | Self { diag, f } | |
| 28 | Self { diag } | |
| 31 | 29 | } |
| 32 | 30 | |
| 33 | 31 | pub(crate) fn into_tokens(self, mut structure: Structure<'_>) -> TokenStream { |
| ... | ... | @@ -86,19 +84,16 @@ impl SubdiagnosticDerive { |
| 86 | 84 | }; |
| 87 | 85 | |
| 88 | 86 | let diag = &self.diag; |
| 89 | let f = &self.f; | |
| 90 | 87 | |
| 91 | 88 | // FIXME(edition_2024): Fix the `keyword_idents_2024` lint to not trigger here? |
| 92 | 89 | #[allow(keyword_idents_2024)] |
| 93 | 90 | let ret = structure.gen_impl(quote! { |
| 94 | 91 | gen impl rustc_errors::Subdiagnostic for @Self { |
| 95 | fn add_to_diag_with<__G, __F>( | |
| 92 | fn add_to_diag<__G>( | |
| 96 | 93 | self, |
| 97 | 94 | #diag: &mut rustc_errors::Diag<'_, __G>, |
| 98 | #f: &__F | |
| 99 | 95 | ) where |
| 100 | 96 | __G: rustc_errors::EmissionGuarantee, |
| 101 | __F: rustc_errors::SubdiagMessageOp<__G>, | |
| 102 | 97 | { |
| 103 | 98 | #implementation |
| 104 | 99 | } |
| ... | ... | @@ -384,11 +379,10 @@ impl<'parent, 'a> SubdiagnosticDeriveVariantBuilder<'parent, 'a> { |
| 384 | 379 | Ok(quote! {}) |
| 385 | 380 | } |
| 386 | 381 | "subdiagnostic" => { |
| 387 | let f = &self.parent.f; | |
| 388 | 382 | let diag = &self.parent.diag; |
| 389 | 383 | let binding = &info.binding; |
| 390 | 384 | self.has_subdiagnostic = true; |
| 391 | Ok(quote! { #binding.add_to_diag_with(#diag, #f); }) | |
| 385 | Ok(quote! { #binding.add_to_diag(#diag); }) | |
| 392 | 386 | } |
| 393 | 387 | _ => { |
| 394 | 388 | let mut span_attrs = vec![]; |
| ... | ... | @@ -531,12 +525,11 @@ impl<'parent, 'a> SubdiagnosticDeriveVariantBuilder<'parent, 'a> { |
| 531 | 525 | let span_field = self.span_field.value_ref(); |
| 532 | 526 | |
| 533 | 527 | let diag = &self.parent.diag; |
| 534 | let f = &self.parent.f; | |
| 535 | 528 | let mut calls = TokenStream::new(); |
| 536 | 529 | for (kind, slug, no_span) in kind_slugs { |
| 537 | 530 | let message = format_ident!("__message"); |
| 538 | 531 | calls.extend( |
| 539 | quote! { let #message = #f(#diag, crate::fluent_generated::#slug.into()); }, | |
| 532 | quote! { let #message = #diag.eagerly_translate(crate::fluent_generated::#slug); }, | |
| 540 | 533 | ); |
| 541 | 534 | |
| 542 | 535 | let name = format_ident!( |
compiler/rustc_mir_build/src/errors.rs+4-16| ... | ... | @@ -2,7 +2,7 @@ use rustc_data_structures::fx::FxIndexMap; |
| 2 | 2 | use rustc_errors::codes::*; |
| 3 | 3 | use rustc_errors::{ |
| 4 | 4 | Applicability, Diag, DiagArgValue, DiagCtxtHandle, Diagnostic, EmissionGuarantee, Level, |
| 5 | MultiSpan, SubdiagMessageOp, Subdiagnostic, pluralize, | |
| 5 | MultiSpan, Subdiagnostic, pluralize, | |
| 6 | 6 | }; |
| 7 | 7 | use rustc_macros::{Diagnostic, LintDiagnostic, Subdiagnostic}; |
| 8 | 8 | use rustc_middle::ty::{self, Ty}; |
| ... | ... | @@ -546,11 +546,7 @@ pub(crate) struct UnsafeNotInheritedLintNote { |
| 546 | 546 | } |
| 547 | 547 | |
| 548 | 548 | impl 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>) { | |
| 554 | 550 | diag.span_note(self.signature_span, fluent::mir_build_unsafe_fn_safe_body); |
| 555 | 551 | let body_start = self.body_span.shrink_to_lo(); |
| 556 | 552 | let body_end = self.body_span.shrink_to_hi(); |
| ... | ... | @@ -1031,11 +1027,7 @@ pub(crate) struct Variant { |
| 1031 | 1027 | } |
| 1032 | 1028 | |
| 1033 | 1029 | impl<'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>) { | |
| 1039 | 1031 | diag.arg("ty", self.ty); |
| 1040 | 1032 | let mut spans = MultiSpan::from(self.adt_def_span); |
| 1041 | 1033 | |
| ... | ... | @@ -1117,11 +1109,7 @@ pub(crate) struct Rust2024IncompatiblePatSugg { |
| 1117 | 1109 | } |
| 1118 | 1110 | |
| 1119 | 1111 | impl 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>) { | |
| 1125 | 1113 | // Format and emit explanatory notes about default binding modes. Reversing the spans' order |
| 1126 | 1114 | // means if we have nested spans, the innermost ones will be visited first. |
| 1127 | 1115 | 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> { |
| 512 | 512 | |
| 513 | 513 | /// A custom `Subdiagnostic` implementation so that the notes are delivered in a specific order |
| 514 | 514 | impl 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>) { | |
| 523 | 516 | diag.arg("name", self.name); |
| 524 | 517 | diag.arg("is_generated_name", self.is_generated_name); |
| 525 | 518 | 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); | |
| 527 | 520 | diag.span_label(self.span, msg); |
| 528 | 521 | for dtor in self.destructors { |
| 529 | dtor.add_to_diag_with(diag, f); | |
| 522 | dtor.add_to_diag(diag); | |
| 530 | 523 | } |
| 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); | |
| 532 | 526 | diag.span_label(self.span, msg); |
| 533 | 527 | } |
| 534 | 528 | } |
compiler/rustc_parse/src/errors.rs+2-7| ... | ... | @@ -7,8 +7,7 @@ use rustc_ast::util::parser::ExprPrecedence; |
| 7 | 7 | use rustc_ast::{Path, Visibility}; |
| 8 | 8 | use rustc_errors::codes::*; |
| 9 | 9 | use rustc_errors::{ |
| 10 | Applicability, Diag, DiagCtxtHandle, Diagnostic, EmissionGuarantee, Level, SubdiagMessageOp, | |
| 11 | Subdiagnostic, | |
| 10 | Applicability, Diag, DiagCtxtHandle, Diagnostic, EmissionGuarantee, Level, Subdiagnostic, | |
| 12 | 11 | }; |
| 13 | 12 | use rustc_macros::{Diagnostic, Subdiagnostic}; |
| 14 | 13 | use rustc_session::errors::ExprParenthesesNeeded; |
| ... | ... | @@ -1550,11 +1549,7 @@ pub(crate) struct FnTraitMissingParen { |
| 1550 | 1549 | } |
| 1551 | 1550 | |
| 1552 | 1551 | impl 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>) { | |
| 1558 | 1553 | diag.span_label(self.span, crate::fluent_generated::parse_fn_trait_missing_paren); |
| 1559 | 1554 | diag.span_suggestion_short( |
| 1560 | 1555 | self.span.shrink_to_hi(), |
compiler/rustc_passes/src/errors.rs+2-6| ... | ... | @@ -5,7 +5,7 @@ use rustc_ast::Label; |
| 5 | 5 | use rustc_errors::codes::*; |
| 6 | 6 | use rustc_errors::{ |
| 7 | 7 | Applicability, Diag, DiagCtxtHandle, DiagSymbolList, Diagnostic, EmissionGuarantee, Level, |
| 8 | MultiSpan, SubdiagMessageOp, Subdiagnostic, | |
| 8 | MultiSpan, Subdiagnostic, | |
| 9 | 9 | }; |
| 10 | 10 | use rustc_hir::{self as hir, ExprKind, Target}; |
| 11 | 11 | use rustc_macros::{Diagnostic, LintDiagnostic, Subdiagnostic}; |
| ... | ... | @@ -1852,11 +1852,7 @@ pub(crate) struct UnusedVariableStringInterp { |
| 1852 | 1852 | } |
| 1853 | 1853 | |
| 1854 | 1854 | impl 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>) { | |
| 1860 | 1856 | diag.span_label(self.lit, crate::fluent_generated::passes_maybe_string_interpolation); |
| 1861 | 1857 | diag.multipart_suggestion( |
| 1862 | 1858 | 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> { |
| 1020 | 1020 | } |
| 1021 | 1021 | |
| 1022 | 1022 | 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 | ||
| 1024 | 1027 | let succ = self.propagate_through_exprs(args, succ); |
| 1025 | 1028 | self.propagate_through_expr(f, succ) |
| 1026 | 1029 | } |
compiler/rustc_pattern_analysis/src/errors.rs+3-11| ... | ... | @@ -1,4 +1,4 @@ |
| 1 | use rustc_errors::{Diag, EmissionGuarantee, SubdiagMessageOp, Subdiagnostic}; | |
| 1 | use rustc_errors::{Diag, EmissionGuarantee, Subdiagnostic}; | |
| 2 | 2 | use rustc_macros::{LintDiagnostic, Subdiagnostic}; |
| 3 | 3 | use rustc_middle::ty::Ty; |
| 4 | 4 | use rustc_span::Span; |
| ... | ... | @@ -55,11 +55,7 @@ pub struct Overlap { |
| 55 | 55 | } |
| 56 | 56 | |
| 57 | 57 | impl 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>) { | |
| 63 | 59 | let Overlap { span, range } = self; |
| 64 | 60 | |
| 65 | 61 | // FIXME(mejrs) unfortunately `#[derive(LintDiagnostic)]` |
| ... | ... | @@ -103,11 +99,7 @@ pub struct GappedRange { |
| 103 | 99 | } |
| 104 | 100 | |
| 105 | 101 | impl 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>) { | |
| 111 | 103 | let GappedRange { span, gap, first_range } = self; |
| 112 | 104 | |
| 113 | 105 | // 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}; |
| 4 | 4 | use rustc_errors::codes::*; |
| 5 | 5 | use rustc_errors::{ |
| 6 | 6 | Applicability, Diag, DiagCtxtHandle, DiagMessage, DiagStyledString, Diagnostic, |
| 7 | EmissionGuarantee, IntoDiagArg, Level, MultiSpan, SubdiagMessageOp, Subdiagnostic, | |
| 7 | EmissionGuarantee, IntoDiagArg, Level, MultiSpan, Subdiagnostic, | |
| 8 | 8 | }; |
| 9 | 9 | use rustc_hir::def::DefKind; |
| 10 | 10 | use rustc_hir::def_id::{DefId, LocalDefId}; |
| ... | ... | @@ -107,11 +107,7 @@ pub enum AdjustSignatureBorrow { |
| 107 | 107 | } |
| 108 | 108 | |
| 109 | 109 | impl 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>) { | |
| 115 | 111 | match self { |
| 116 | 112 | AdjustSignatureBorrow::Borrow { to_borrow } => { |
| 117 | 113 | diag.arg("len", to_borrow.len()); |
| ... | ... | @@ -381,11 +377,7 @@ pub enum RegionOriginNote<'a> { |
| 381 | 377 | } |
| 382 | 378 | |
| 383 | 379 | impl 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>) { | |
| 389 | 381 | let mut label_or_note = |span, msg: DiagMessage| { |
| 390 | 382 | let sub_count = diag.children.iter().filter(|d| d.span.is_dummy()).count(); |
| 391 | 383 | let expanded_sub_count = diag.children.iter().filter(|d| !d.span.is_dummy()).count(); |
| ... | ... | @@ -446,11 +438,7 @@ pub enum LifetimeMismatchLabels { |
| 446 | 438 | } |
| 447 | 439 | |
| 448 | 440 | impl 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>) { | |
| 454 | 442 | match self { |
| 455 | 443 | LifetimeMismatchLabels::InRet { param_span, ret_span, span, label_var1 } => { |
| 456 | 444 | diag.span_label(param_span, fluent::trait_selection_declared_different); |
| ... | ... | @@ -495,11 +483,7 @@ pub struct AddLifetimeParamsSuggestion<'a> { |
| 495 | 483 | } |
| 496 | 484 | |
| 497 | 485 | impl 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>) { | |
| 503 | 487 | let mut mk_suggestion = || { |
| 504 | 488 | let Some(anon_reg) = self.tcx.is_suitable_region(self.generic_param_scope, self.sub) |
| 505 | 489 | else { |
| ... | ... | @@ -689,11 +673,7 @@ pub struct IntroducesStaticBecauseUnmetLifetimeReq { |
| 689 | 673 | } |
| 690 | 674 | |
| 691 | 675 | impl 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>) { | |
| 697 | 677 | self.unmet_requirements |
| 698 | 678 | .push_span_label(self.binding_span, fluent::trait_selection_msl_introduces_static); |
| 699 | 679 | diag.span_note(self.unmet_requirements, fluent::trait_selection_msl_unmet_req); |
| ... | ... | @@ -1008,17 +988,13 @@ pub struct ConsiderBorrowingParamHelp { |
| 1008 | 988 | } |
| 1009 | 989 | |
| 1010 | 990 | impl 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>) { | |
| 1016 | 992 | let mut type_param_span: MultiSpan = self.spans.clone().into(); |
| 1017 | 993 | for &span in &self.spans { |
| 1018 | 994 | // Seems like we can't call f() here as Into<DiagMessage> is required |
| 1019 | 995 | type_param_span.push_span_label(span, fluent::trait_selection_tid_consider_borrowing); |
| 1020 | 996 | } |
| 1021 | let msg = f(diag, fluent::trait_selection_tid_param_help.into()); | |
| 997 | let msg = diag.eagerly_translate(fluent::trait_selection_tid_param_help); | |
| 1022 | 998 | diag.span_help(type_param_span, msg); |
| 1023 | 999 | } |
| 1024 | 1000 | } |
| ... | ... | @@ -1053,18 +1029,14 @@ pub struct DynTraitConstraintSuggestion { |
| 1053 | 1029 | } |
| 1054 | 1030 | |
| 1055 | 1031 | impl 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>) { | |
| 1061 | 1033 | let mut multi_span: MultiSpan = vec![self.span].into(); |
| 1062 | 1034 | multi_span.push_span_label(self.span, fluent::trait_selection_dtcs_has_lifetime_req_label); |
| 1063 | 1035 | multi_span |
| 1064 | 1036 | .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); | |
| 1066 | 1038 | 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); | |
| 1068 | 1040 | diag.span_suggestion_verbose( |
| 1069 | 1041 | self.span.shrink_to_hi(), |
| 1070 | 1042 | msg, |
| ... | ... | @@ -1101,11 +1073,7 @@ pub struct ReqIntroducedLocations { |
| 1101 | 1073 | } |
| 1102 | 1074 | |
| 1103 | 1075 | impl 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>) { | |
| 1109 | 1077 | for sp in self.spans { |
| 1110 | 1078 | self.span.push_span_label(sp, fluent::trait_selection_ril_introduced_here); |
| 1111 | 1079 | } |
| ... | ... | @@ -1114,7 +1082,7 @@ impl Subdiagnostic for ReqIntroducedLocations { |
| 1114 | 1082 | self.span.push_span_label(self.fn_decl_span, fluent::trait_selection_ril_introduced_by); |
| 1115 | 1083 | } |
| 1116 | 1084 | 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); | |
| 1118 | 1086 | diag.span_note(self.span, msg); |
| 1119 | 1087 | } |
| 1120 | 1088 | } |
| ... | ... | @@ -1513,13 +1481,9 @@ pub struct SuggestTuplePatternMany { |
| 1513 | 1481 | } |
| 1514 | 1482 | |
| 1515 | 1483 | impl 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>) { | |
| 1521 | 1485 | 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); | |
| 1523 | 1487 | diag.multipart_suggestions( |
| 1524 | 1488 | message, |
| 1525 | 1489 | self.compatible_variants.into_iter().map(|variant| { |
| ... | ... | @@ -1752,11 +1716,7 @@ pub struct AddPreciseCapturingAndParams { |
| 1752 | 1716 | } |
| 1753 | 1717 | |
| 1754 | 1718 | impl 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>) { | |
| 1760 | 1720 | diag.arg("new_lifetime", self.new_lifetime); |
| 1761 | 1721 | diag.multipart_suggestion_verbose( |
| 1762 | 1722 | fluent::trait_selection_precise_capturing_new_but_apit, |
| ... | ... | @@ -1896,11 +1856,7 @@ pub struct AddPreciseCapturingForOvercapture { |
| 1896 | 1856 | } |
| 1897 | 1857 | |
| 1898 | 1858 | impl 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>) { | |
| 1904 | 1860 | let applicability = if self.apit_spans.is_empty() { |
| 1905 | 1861 | Applicability::MachineApplicable |
| 1906 | 1862 | } else { |
compiler/rustc_trait_selection/src/errors/note_and_explain.rs+3-7| ... | ... | @@ -1,4 +1,4 @@ |
| 1 | use rustc_errors::{Diag, EmissionGuarantee, IntoDiagArg, SubdiagMessageOp, Subdiagnostic}; | |
| 1 | use rustc_errors::{Diag, EmissionGuarantee, IntoDiagArg, Subdiagnostic}; | |
| 2 | 2 | use rustc_hir::def_id::LocalDefId; |
| 3 | 3 | use rustc_middle::bug; |
| 4 | 4 | use rustc_middle::ty::{self, TyCtxt}; |
| ... | ... | @@ -162,17 +162,13 @@ impl RegionExplanation<'_> { |
| 162 | 162 | } |
| 163 | 163 | |
| 164 | 164 | impl 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>) { | |
| 170 | 166 | diag.arg("pref_kind", self.prefix); |
| 171 | 167 | diag.arg("suff_kind", self.suffix); |
| 172 | 168 | diag.arg("desc_kind", self.desc.kind); |
| 173 | 169 | diag.arg("desc_arg", self.desc.arg); |
| 174 | 170 | |
| 175 | let msg = f(diag, fluent::trait_selection_region_explanation.into()); | |
| 171 | let msg = diag.eagerly_translate(fluent::trait_selection_region_explanation); | |
| 176 | 172 | if let Some(span) = self.desc.span { |
| 177 | 173 | diag.span_note(span, msg); |
| 178 | 174 | } else { |
compiler/rustc_transmute/src/maybe_transmutable/tests.rs+74-66| ... | ... | @@ -1,93 +1,115 @@ |
| 1 | 1 | use itertools::Itertools; |
| 2 | 2 | |
| 3 | 3 | use super::query_context::test::{Def, UltraMinimal}; |
| 4 | use crate::maybe_transmutable::MaybeTransmutableQuery; | |
| 5 | use crate::{Reason, layout}; | |
| 4 | use crate::{Answer, Assume, Reason, layout}; | |
| 6 | 5 | |
| 7 | mod safety { | |
| 8 | use super::*; | |
| 9 | use crate::Answer; | |
| 6 | type Tree = layout::Tree<Def, !>; | |
| 7 | type Dfa = layout::Dfa<!>; | |
| 10 | 8 | |
| 11 | type Tree = layout::Tree<Def, !>; | |
| 9 | trait Representation { | |
| 10 | fn is_transmutable(src: Self, dst: Self, assume: Assume) -> Answer<!>; | |
| 11 | } | |
| 12 | 12 | |
| 13 | const DST_HAS_SAFETY_INVARIANTS: Answer<!> = | |
| 14 | Answer::No(crate::Reason::DstMayHaveSafetyInvariants); | |
| 13 | impl 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 | } | |
| 15 | 19 | |
| 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 | }; | |
| 20 | impl Representation for Dfa { | |
| 21 | fn is_transmutable(src: Self, dst: Self, assume: Assume) -> Answer<!> { | |
| 28 | 22 | crate::maybe_transmutable::MaybeTransmutableQuery::new(src, dst, assume, UltraMinimal) |
| 29 | 23 | .answer() |
| 30 | 24 | } |
| 25 | } | |
| 26 | ||
| 27 | fn 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 | ||
| 40 | mod safety { | |
| 41 | use super::*; | |
| 42 | use crate::Answer; | |
| 43 | ||
| 44 | const DST_HAS_SAFETY_INVARIANTS: Answer<!> = | |
| 45 | Answer::No(crate::Reason::DstMayHaveSafetyInvariants); | |
| 31 | 46 | |
| 32 | 47 | #[test] |
| 33 | 48 | fn src_safe_dst_safe() { |
| 34 | 49 | let src = Tree::Def(Def::NoSafetyInvariants).then(Tree::u8()); |
| 35 | 50 | 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 | ); | |
| 38 | 56 | } |
| 39 | 57 | |
| 40 | 58 | #[test] |
| 41 | 59 | fn src_safe_dst_unsafe() { |
| 42 | 60 | let src = Tree::Def(Def::NoSafetyInvariants).then(Tree::u8()); |
| 43 | 61 | 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 | ); | |
| 46 | 67 | } |
| 47 | 68 | |
| 48 | 69 | #[test] |
| 49 | 70 | fn src_unsafe_dst_safe() { |
| 50 | 71 | let src = Tree::Def(Def::HasSafetyInvariants).then(Tree::u8()); |
| 51 | 72 | 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 | ); | |
| 54 | 78 | } |
| 55 | 79 | |
| 56 | 80 | #[test] |
| 57 | 81 | fn src_unsafe_dst_unsafe() { |
| 58 | 82 | let src = Tree::Def(Def::HasSafetyInvariants).then(Tree::u8()); |
| 59 | 83 | 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 | ); | |
| 62 | 89 | } |
| 63 | 90 | } |
| 64 | 91 | |
| 65 | 92 | mod bool { |
| 66 | 93 | use super::*; |
| 67 | use crate::Answer; | |
| 68 | 94 | |
| 69 | 95 | #[test] |
| 70 | 96 | 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 | ); | |
| 79 | 103 | } |
| 80 | 104 | |
| 81 | 105 | #[test] |
| 82 | 106 | 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 | ); | |
| 91 | 113 | } |
| 92 | 114 | |
| 93 | 115 | #[test] |
| ... | ... | @@ -122,13 +144,7 @@ mod bool { |
| 122 | 144 | if src_set.is_subset(&dst_set) { |
| 123 | 145 | assert_eq!( |
| 124 | 146 | 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()), | |
| 132 | 148 | "{:?} SHOULD be transmutable into {:?}", |
| 133 | 149 | src_layout, |
| 134 | 150 | dst_layout |
| ... | ... | @@ -136,13 +152,11 @@ mod bool { |
| 136 | 152 | } else if !src_set.is_disjoint(&dst_set) { |
| 137 | 153 | assert_eq!( |
| 138 | 154 | 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 | ), | |
| 146 | 160 | "{:?} SHOULD be transmutable (assuming validity) into {:?}", |
| 147 | 161 | src_layout, |
| 148 | 162 | dst_layout |
| ... | ... | @@ -150,13 +164,7 @@ mod bool { |
| 150 | 164 | } else { |
| 151 | 165 | assert_eq!( |
| 152 | 166 | 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()), | |
| 160 | 168 | "{:?} should NOT be transmutable into {:?}", |
| 161 | 169 | src_layout, |
| 162 | 170 | dst_layout |
diffsrc/doc/unstable-book/src/compiler-flags/allow-features.md created+14| ... | ... | @@ -0,0 +1,14 @@ |
| 1 | # `allow-features` | |
| 2 | ||
| 3 | This feature is perma-unstable and has no tracking issue. | |
| 4 | ||
| 5 | ---- | |
| 6 | ||
| 7 | This flag allows limiting the features which can be enabled with `#![feature(...)]` attributes. | |
| 8 | By default, all features are allowed on nightly and no features are allowed on stable or beta (but see [`RUSTC_BOOTSTRAP`]). | |
| 9 | ||
| 10 | Features are comma-separated, for example `-Z allow-features=ffi_pure,f16`. | |
| 11 | If the flag is present, any feature listed will be allowed and any feature not listed will be disallowed. | |
| 12 | Any 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 | ||
| 3 | This feature is perma-unstable and has no tracking issue. | |
| 4 | ||
| 5 | ---- | |
| 6 | ||
| 7 | The `RUSTC_BOOTSTRAP` environment variable tells rustc to act as if it is a nightly compiler; | |
| 8 | in particular, it allows `#![feature(...)]` attributes and `-Z` flags even on the stable release channel. | |
| 9 | ||
| 10 | Setting `RUSTC_BOOTSTRAP=1` instructs rustc to enable this for all crates. | |
| 11 | Setting `RUSTC_BOOTSTRAP=crate_name` instructs rustc to only apply this to crates named `crate_name`. | |
| 12 | Setting `RUSTC_BOOTSTRAP=-1` instructs rustc to act as if it is a stable compiler, even on the nightly release channel. | |
| 13 | Cargo disallows setting `cargo::rustc-env=RUSTC_BOOTSTRAP` in build scripts. | |
| 14 | Build systems can limit the features they enable with [`-Z allow-features=feature1,feature2`][Z-allow-features]. | |
| 15 | Crates 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. | |
| 23 | In particular, nightly is built with beta, and beta is built with stable. | |
| 24 | Since 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 | ||
| 28 | Originally, `RUSTC_BOOTSTRAP` required passing in a hash of the previous compiler version, to discourage using it for any purpose other than bootstrapping. | |
| 29 | That constraint was later relaxed; see <https://github.com/rust-lang/rust/issues/36548> for the discussion that happened at that time. | |
| 30 | ||
| 31 | People have at various times proposed re-adding the technical constraints. | |
| 32 | However, 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. | |
| 33 | We 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 | ||
| 37 | Despite being usable on stable, this is an unstable feature. | |
| 38 | Like 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. | |
| 39 | Using this feature opts you out of the normal stability/backwards compatibility guarantee of stable. | |
| 40 | ||
| 41 | Although we do not take technical measures to prevent it from being used, we strongly discourage using this feature. | |
| 42 | If at all possible, please contribute to stabilizing the features you care about instead of bypassing the Rust project's stability policy. | |
| 43 | ||
| 44 | For library crates, we especially discourage the use of this feature. | |
| 45 | The 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 | ||
| 47 | For 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. | |
| 48 | If 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. | |
| 49 | This 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 | ||
| 3 | This feature is perma-unstable and has no tracking issue. | |
| 4 | ||
| 5 | ---- | |
| 6 | ||
| 7 | The `RUSTC_OVERRIDE_VERSION_STRING` environment variable overrides the version reported by `rustc --version`. For example: | |
| 8 | ||
| 9 | ```console | |
| 10 | $ rustc --version | |
| 11 | rustc 1.87.0-nightly (43f0014ef 2025-03-25) | |
| 12 | $ env RUSTC_OVERRIDE_VERSION_STRING=1.81.0-nightly rustc --version | |
| 13 | rustc 1.81.0-nightly | |
| 14 | ``` | |
| 15 | ||
| 16 | Note 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 | |
| 19 | rustc 1.81.0-nightly (aaaaaaaaa 2025-03-22) | |
| 20 | binary: rustc | |
| 21 | commit-hash: 43f0014ef0f242418674f49052ed39b70f73bc1c | |
| 22 | commit-date: 2025-03-25 | |
| 23 | host: x86_64-unknown-linux-gnu | |
| 24 | release: 1.81.0-nightly (aaaaaaaaa 2025-03-22) | |
| 25 | LLVM version: 20.1.1 | |
| 26 | ``` | |
| 27 | ||
| 28 | Note here that `commit-hash` and `commit-date` do not match the values in the string, and `release` includes the fake hash and date. | |
| 29 | ||
| 30 | This 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 | ||
| 34 | Various library crates have incomplete or incorrect feature detection. | |
| 35 | This environment variable allows bisecting crates that do incorrect detection with `version_check::supports_feature`. | |
| 36 | ||
| 37 | This is not intended to be used for any other case (and, except for bisection, is not particularly useful). | |
| 38 | ||
| 39 | See <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 | ||
| 3 | The tracking issue for this feature is: [#131204] | |
| 4 | ||
| 5 | [#131204]: https://github.com/rust-lang/rust/issues/131204 | |
| 6 | ||
| 7 | ------------------------ | |
| 8 | ||
| 9 | The `cfg_boolean_literals` feature makes it possible to use the `true`/`false` | |
| 10 | literal 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)] | |
| 18 | const A: i32 = 5; | |
| 19 | ||
| 20 | #[cfg(all(false))] | |
| 21 | const 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 | ||
| 3 | The tracking issue for this feature is: [#124225] | |
| 4 | ||
| 5 | ------------------------ | |
| 6 | ||
| 7 | In 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 | ||
| 23 | macro_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 | ||
| 31 | create_some_structs!(Thing); | |
| 32 | ``` | |
| 33 | ||
| 34 | This macro invocation expands to: | |
| 35 | ||
| 36 | ```rust | |
| 37 | pub struct FirstThing; | |
| 38 | pub struct SecondThing; | |
| 39 | pub struct ThirdThing; | |
| 40 | ``` | |
| 41 | ||
| 42 | ### Syntax | |
| 43 | ||
| 44 | This 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 | ||
| 54 | macro_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 | ||
| 64 | pub struct Thing { | |
| 65 | description: String, | |
| 66 | } | |
| 67 | ||
| 68 | make_getter!(Thing, description, String); | |
| 69 | ``` | |
| 70 | ||
| 71 | This expands to: | |
| 72 | ||
| 73 | ```rust | |
| 74 | pub struct Thing { | |
| 75 | description: String, | |
| 76 | } | |
| 77 | ||
| 78 | impl 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 | ||
| 90 | macro_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 | ||
| 108 | test_math!(i32); | |
| 109 | test_math!(u64); | |
| 110 | test_math!(u128); | |
| 111 | ``` | |
| 112 | ||
| 113 | Running this returns the following output: | |
| 114 | ||
| 115 | ```text | |
| 116 | running 6 tests | |
| 117 | test test_i32_subtraction ... ok | |
| 118 | test test_i32_addition ... ok | |
| 119 | test test_u128_addition ... ok | |
| 120 | test test_u128_subtraction ... ok | |
| 121 | test test_u64_addition ... ok | |
| 122 | test test_u64_subtraction ... ok | |
| 123 | ||
| 124 | test 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 | ||
| 3 | The 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] |
| 6 | 6 | |
| 7 | 7 | ------------------------ |
| 8 | 8 | |
| 9 | > This feature is expected to be superseded by [`macro_metavar_expr_concat`](../language-features/macro-metavar-expr-concat.md). | |
| 10 | ||
| 9 | 11 | The `concat_idents` feature adds a macro for concatenating multiple identifiers |
| 10 | 12 | into one identifier. |
| 11 | 13 |
src/tools/rust-analyzer/crates/ide-db/src/generated/lints.rs-29| ... | ... | @@ -3789,35 +3789,6 @@ The tracking issue for this feature is: [#64797] |
| 3789 | 3789 | [#64797]: https://github.com/rust-lang/rust/issues/64797 |
| 3790 | 3790 | |
| 3791 | 3791 | ------------------------ |
| 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 | ||
| 3801 | The tracking issue for this feature is: [#131204] | |
| 3802 | ||
| 3803 | [#131204]: https://github.com/rust-lang/rust/issues/131204 | |
| 3804 | ||
| 3805 | ------------------------ | |
| 3806 | ||
| 3807 | The `cfg_boolean_literals` feature makes it possible to use the `true`/`false` | |
| 3808 | literal 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)] | |
| 3816 | const A: i32 = 5; | |
| 3817 | ||
| 3818 | #[cfg(all(false))] | |
| 3819 | const A: i32 = 58 * 89; | |
| 3820 | ``` | |
| 3821 | 3792 | "##, |
| 3822 | 3793 | default_severity: Severity::Allow, |
| 3823 | 3794 | warn_since: None, |
tests/pretty/ast-stmt-expr-attr.rs+1-1| ... | ... | @@ -2,7 +2,7 @@ |
| 2 | 2 | |
| 3 | 3 | fn main() {} |
| 4 | 4 | |
| 5 | #[cfg(FALSE)] | |
| 5 | #[cfg(false)] | |
| 6 | 6 | fn syntax() { |
| 7 | 7 | let _ = #[attr] []; |
| 8 | 8 | let _ = #[attr] [0]; |
tests/pretty/enum-variant-vis.rs+1-1| ... | ... | @@ -4,5 +4,5 @@ |
| 4 | 4 | |
| 5 | 5 | fn main() {} |
| 6 | 6 | |
| 7 | #[cfg(FALSE)] | |
| 7 | #[cfg(false)] | |
| 8 | 8 | enum Foo { pub V, } |
tests/pretty/if-attr.rs+4-4| ... | ... | @@ -1,6 +1,6 @@ |
| 1 | 1 | //@ pp-exact |
| 2 | 2 | |
| 3 | #[cfg(FALSE)] | |
| 3 | #[cfg(false)] | |
| 4 | 4 | fn simple_attr() { |
| 5 | 5 | |
| 6 | 6 | #[attr] |
| ... | ... | @@ -10,21 +10,21 @@ fn simple_attr() { |
| 10 | 10 | if true {} |
| 11 | 11 | } |
| 12 | 12 | |
| 13 | #[cfg(FALSE)] | |
| 13 | #[cfg(false)] | |
| 14 | 14 | fn if_else_chain() { |
| 15 | 15 | |
| 16 | 16 | #[first_attr] |
| 17 | 17 | if true {} else if false {} else {} |
| 18 | 18 | } |
| 19 | 19 | |
| 20 | #[cfg(FALSE)] | |
| 20 | #[cfg(false)] | |
| 21 | 21 | fn if_let() { |
| 22 | 22 | |
| 23 | 23 | #[attr] |
| 24 | 24 | if let Some(_) = Some(true) {} |
| 25 | 25 | } |
| 26 | 26 | |
| 27 | #[cfg(FALSE)] | |
| 27 | #[cfg(false)] | |
| 28 | 28 | fn let_attr_if() { |
| 29 | 29 | let _ = #[attr] if let _ = 0 {}; |
| 30 | 30 | let _ = #[attr] if true {}; |
tests/pretty/nested-item-vis-defaultness.rs+3-3| ... | ... | @@ -4,7 +4,7 @@ |
| 4 | 4 | |
| 5 | 5 | fn main() {} |
| 6 | 6 | |
| 7 | #[cfg(FALSE)] | |
| 7 | #[cfg(false)] | |
| 8 | 8 | extern "C" { |
| 9 | 9 | static X: u8; |
| 10 | 10 | type X; |
| ... | ... | @@ -14,7 +14,7 @@ extern "C" { |
| 14 | 14 | pub fn foo(); |
| 15 | 15 | } |
| 16 | 16 | |
| 17 | #[cfg(FALSE)] | |
| 17 | #[cfg(false)] | |
| 18 | 18 | trait T { |
| 19 | 19 | const X: u8; |
| 20 | 20 | type X; |
| ... | ... | @@ -30,7 +30,7 @@ trait T { |
| 30 | 30 | pub default fn foo(); |
| 31 | 31 | } |
| 32 | 32 | |
| 33 | #[cfg(FALSE)] | |
| 33 | #[cfg(false)] | |
| 34 | 34 | impl T for S { |
| 35 | 35 | const X: u8; |
| 36 | 36 | type X; |
tests/rustdoc-ui/cfg-boolean-literal.rs-1| ... | ... | @@ -1,6 +1,5 @@ |
| 1 | 1 | //@ check-pass |
| 2 | 2 | |
| 3 | #![feature(cfg_boolean_literals)] | |
| 4 | 3 | #![feature(doc_cfg)] |
| 5 | 4 | |
| 6 | 5 | #[doc(cfg(false))] |
tests/rustdoc-ui/doc-cfg-unstable.rs-4| ... | ... | @@ -1,10 +1,6 @@ |
| 1 | 1 | // #138113: rustdoc didn't gate unstable predicates inside `doc(cfg(..))` |
| 2 | 2 | #![feature(doc_cfg)] |
| 3 | 3 | |
| 4 | // `cfg_boolean_literals` | |
| 5 | #[doc(cfg(false))] //~ ERROR `cfg(false)` is experimental and subject to change | |
| 6 | pub fn cfg_boolean_literals() {} | |
| 7 | ||
| 8 | 4 | // `cfg_version` |
| 9 | 5 | #[doc(cfg(sanitize = "thread"))] //~ ERROR `cfg(sanitize)` is experimental and subject to change |
| 10 | 6 | pub fn cfg_sanitize() {} |
tests/rustdoc-ui/doc-cfg-unstable.stderr+2-12| ... | ... | @@ -1,15 +1,5 @@ |
| 1 | error[E0658]: `cfg(false)` is experimental and subject to change | |
| 2 | --> $DIR/doc-cfg-unstable.rs:5:11 | |
| 3 | | | |
| 4 | LL | #[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 | ||
| 11 | 1 | error[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 | |
| 13 | 3 | | |
| 14 | 4 | LL | #[doc(cfg(sanitize = "thread"))] |
| 15 | 5 | | ^^^^^^^^^^^^^^^^^^^ |
| ... | ... | @@ -18,6 +8,6 @@ LL | #[doc(cfg(sanitize = "thread"))] |
| 18 | 8 | = help: add `#![feature(cfg_sanitize)]` to the crate attributes to enable |
| 19 | 9 | = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date |
| 20 | 10 | |
| 21 | error: aborting due to 2 previous errors | |
| 11 | error: aborting due to 1 previous error | |
| 22 | 12 | |
| 23 | 13 | For 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; |
| 15 | 15 | |
| 16 | 16 | use rustc_errors::{ |
| 17 | 17 | Diag, DiagCtxtHandle, DiagInner, DiagMessage, Diagnostic, EmissionGuarantee, Level, |
| 18 | LintDiagnostic, SubdiagMessage, SubdiagMessageOp, Subdiagnostic, | |
| 18 | LintDiagnostic, SubdiagMessage, Subdiagnostic, | |
| 19 | 19 | }; |
| 20 | 20 | use rustc_macros::{Diagnostic, Subdiagnostic}; |
| 21 | 21 | use rustc_span::Span; |
| ... | ... | @@ -56,10 +56,9 @@ impl<'a, G: EmissionGuarantee> Diagnostic<'a, G> for TranslatableInDiagnostic { |
| 56 | 56 | pub struct UntranslatableInAddtoDiag; |
| 57 | 57 | |
| 58 | 58 | impl Subdiagnostic for UntranslatableInAddtoDiag { |
| 59 | fn add_to_diag_with<G: EmissionGuarantee, F: SubdiagMessageOp<G>>( | |
| 59 | fn add_to_diag<G: EmissionGuarantee>( | |
| 60 | 60 | self, |
| 61 | 61 | diag: &mut Diag<'_, G>, |
| 62 | f: &F, | |
| 63 | 62 | ) { |
| 64 | 63 | diag.note("untranslatable diagnostic"); |
| 65 | 64 | //~^ ERROR diagnostics should be created using translatable messages |
| ... | ... | @@ -69,10 +68,9 @@ impl Subdiagnostic for UntranslatableInAddtoDiag { |
| 69 | 68 | pub struct TranslatableInAddtoDiag; |
| 70 | 69 | |
| 71 | 70 | impl Subdiagnostic for TranslatableInAddtoDiag { |
| 72 | fn add_to_diag_with<G: EmissionGuarantee, F: SubdiagMessageOp<G>>( | |
| 71 | fn add_to_diag<G: EmissionGuarantee>( | |
| 73 | 72 | self, |
| 74 | 73 | diag: &mut Diag<'_, G>, |
| 75 | f: &F, | |
| 76 | 74 | ) { |
| 77 | 75 | diag.note(crate::fluent_generated::no_crate_note); |
| 78 | 76 | } |
tests/ui-fulldeps/internal-lints/diagnostics.stderr+9-9| ... | ... | @@ -11,19 +11,19 @@ LL | #![deny(rustc::untranslatable_diagnostic)] |
| 11 | 11 | | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ |
| 12 | 12 | |
| 13 | 13 | error: diagnostics should be created using translatable messages |
| 14 | --> $DIR/diagnostics.rs:64:19 | |
| 14 | --> $DIR/diagnostics.rs:63:19 | |
| 15 | 15 | | |
| 16 | 16 | LL | diag.note("untranslatable diagnostic"); |
| 17 | 17 | | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ |
| 18 | 18 | |
| 19 | 19 | error: diagnostics should be created using translatable messages |
| 20 | --> $DIR/diagnostics.rs:85:19 | |
| 20 | --> $DIR/diagnostics.rs:83:19 | |
| 21 | 21 | | |
| 22 | 22 | LL | diag.note("untranslatable diagnostic"); |
| 23 | 23 | | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ |
| 24 | 24 | |
| 25 | 25 | error: diagnostics should only be created in `Diagnostic`/`Subdiagnostic`/`LintDiagnostic` impls |
| 26 | --> $DIR/diagnostics.rs:99:21 | |
| 26 | --> $DIR/diagnostics.rs:97:21 | |
| 27 | 27 | | |
| 28 | 28 | LL | let _diag = dcx.struct_err(crate::fluent_generated::no_crate_example); |
| 29 | 29 | | ^^^^^^^^^^ |
| ... | ... | @@ -35,37 +35,37 @@ LL | #![deny(rustc::diagnostic_outside_of_impl)] |
| 35 | 35 | | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ |
| 36 | 36 | |
| 37 | 37 | error: diagnostics should only be created in `Diagnostic`/`Subdiagnostic`/`LintDiagnostic` impls |
| 38 | --> $DIR/diagnostics.rs:102:21 | |
| 38 | --> $DIR/diagnostics.rs:100:21 | |
| 39 | 39 | | |
| 40 | 40 | LL | let _diag = dcx.struct_err("untranslatable diagnostic"); |
| 41 | 41 | | ^^^^^^^^^^ |
| 42 | 42 | |
| 43 | 43 | error: diagnostics should be created using translatable messages |
| 44 | --> $DIR/diagnostics.rs:102:32 | |
| 44 | --> $DIR/diagnostics.rs:100:32 | |
| 45 | 45 | | |
| 46 | 46 | LL | let _diag = dcx.struct_err("untranslatable diagnostic"); |
| 47 | 47 | | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ |
| 48 | 48 | |
| 49 | 49 | error: diagnostics should be created using translatable messages |
| 50 | --> $DIR/diagnostics.rs:120:7 | |
| 50 | --> $DIR/diagnostics.rs:118:7 | |
| 51 | 51 | | |
| 52 | 52 | LL | f("untranslatable diagnostic", crate::fluent_generated::no_crate_example); |
| 53 | 53 | | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ |
| 54 | 54 | |
| 55 | 55 | error: diagnostics should be created using translatable messages |
| 56 | --> $DIR/diagnostics.rs:122:50 | |
| 56 | --> $DIR/diagnostics.rs:120:50 | |
| 57 | 57 | | |
| 58 | 58 | LL | f(crate::fluent_generated::no_crate_example, "untranslatable diagnostic"); |
| 59 | 59 | | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ |
| 60 | 60 | |
| 61 | 61 | error: diagnostics should be created using translatable messages |
| 62 | --> $DIR/diagnostics.rs:124:7 | |
| 62 | --> $DIR/diagnostics.rs:122:7 | |
| 63 | 63 | | |
| 64 | 64 | LL | f("untranslatable diagnostic", "untranslatable diagnostic"); |
| 65 | 65 | | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ |
| 66 | 66 | |
| 67 | 67 | error: diagnostics should be created using translatable messages |
| 68 | --> $DIR/diagnostics.rs:124:36 | |
| 68 | --> $DIR/diagnostics.rs:122:36 | |
| 69 | 69 | | |
| 70 | 70 | LL | f("untranslatable diagnostic", "untranslatable diagnostic"); |
| 71 | 71 | | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ |
tests/ui/asm/unpretty-expanded.rs+1| ... | ... | @@ -1,4 +1,5 @@ |
| 1 | 1 | //@ needs-asm-support |
| 2 | 2 | //@ check-pass |
| 3 | 3 | //@ compile-flags: -Zunpretty=expanded |
| 4 | //@ edition: 2015 | |
| 4 | 5 | core::arch::global_asm!("x: .byte 42"); |
tests/ui/asm/unpretty-expanded.stdout+1| ... | ... | @@ -7,4 +7,5 @@ extern crate std; |
| 7 | 7 | //@ needs-asm-support |
| 8 | 8 | //@ check-pass |
| 9 | 9 | //@ compile-flags: -Zunpretty=expanded |
| 10 | //@ edition: 2015 | |
| 10 | 11 | global_asm! ("x: .byte 42"); |
tests/ui/associated-types/associated-type-macro.rs+1-1| ... | ... | @@ -1,4 +1,4 @@ |
| 1 | 1 | fn main() { |
| 2 | #[cfg(FALSE)] | |
| 2 | #[cfg(false)] | |
| 3 | 3 | <() as module>::mac!(); //~ ERROR macros cannot use qualified paths |
| 4 | 4 | } |
tests/ui/async-await/feature-async-for-loop.rs+1-1| ... | ... | @@ -11,7 +11,7 @@ fn f() { |
| 11 | 11 | }; |
| 12 | 12 | } |
| 13 | 13 | |
| 14 | #[cfg(FALSE)] | |
| 14 | #[cfg(false)] | |
| 15 | 15 | fn g() { |
| 16 | 16 | let _ = async { |
| 17 | 17 | 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 @@ |
| 3 | 3 | struct S; |
| 4 | 4 | |
| 5 | 5 | impl S { |
| 6 | #[cfg(FALSE)] | |
| 6 | #[cfg(false)] | |
| 7 | 7 | unsafe async fn g() {} //~ ERROR expected one of `extern` or `fn`, found keyword `async` |
| 8 | 8 | } |
| 9 | 9 | |
| 10 | #[cfg(FALSE)] | |
| 10 | #[cfg(false)] | |
| 11 | 11 | unsafe async fn f() {} //~ ERROR expected one of `extern` or `fn`, found keyword `async` |
| 12 | 12 | |
| 13 | 13 | fn 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) | |
| 3 | 3 | //@ check-pass |
| 4 | 4 | |
| 5 | 5 | // NOTE: duplicate items are load-bearing |
tests/ui/auto-traits/pre-cfg.rs+1-1| ... | ... | @@ -1,6 +1,6 @@ |
| 1 | 1 | //@ check-pass |
| 2 | 2 | |
| 3 | #[cfg(FALSE)] | |
| 3 | #[cfg(false)] | |
| 4 | 4 | auto trait Foo {} |
| 5 | 5 | //~^ WARN `auto` traits are unstable |
| 6 | 6 | //~| 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)`. | |
| 2 | 2 | // This crate has no such attribute, therefore this crate does link to libstd. |
| 3 | 3 | |
| 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)`. | |
| 2 | 2 | // Therefore this crate does link to libstd. |
| 3 | 3 | |
| 4 | #![cfg(FALSE)] | |
| 4 | #![cfg(false)] | |
| 5 | 5 | #![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)`. | |
| 2 | 2 | // Therefore this crate doesn't link to libstd. |
| 3 | 3 | |
| 4 | 4 | //@ no-prefer-dynamic |
| 5 | 5 | |
| 6 | 6 | #![no_std] |
| 7 | 7 | #![crate_type = "lib"] |
| 8 | #![cfg(FALSE)] | |
| 8 | #![cfg(false)] |
tests/ui/cfg/auxiliary/cfged_out.rs+2-2| ... | ... | @@ -1,8 +1,8 @@ |
| 1 | 1 | pub mod inner { |
| 2 | #[cfg(FALSE)] | |
| 2 | #[cfg(false)] | |
| 3 | 3 | pub fn uwu() {} |
| 4 | 4 | |
| 5 | #[cfg(FALSE)] | |
| 5 | #[cfg(false)] | |
| 6 | 6 | pub mod doesnt_exist { |
| 7 | 7 | pub fn hello() {} |
| 8 | 8 | } |
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)] | |
| 6 | fn foo() {} | |
| 7 | ||
| 8 | #[cfg(true)] | |
| 9 | #[cfg(false)] | |
| 10 | fn foo() {} | |
| 11 | ||
| 12 | fn 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 @@ |
| 1 | error[E0425]: cannot find function `foo` in this scope | |
| 2 | --> $DIR/both-true-false.rs:13:5 | |
| 3 | | | |
| 4 | LL | foo(); | |
| 5 | | ^^^ not found in this scope | |
| 6 | ||
| 7 | error: aborting due to 1 previous error | |
| 8 | ||
| 9 | For 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). | |
| 2 | 2 | |
| 3 | 3 | //@ check-pass |
| 4 | 4 | //@ compile-flags: --crate-type lib |
| 5 | 5 | |
| 6 | 6 | #![feature(decl_macro)] |
| 7 | #![cfg(FALSE)] | |
| 7 | #![cfg(false)] | |
| 8 | 8 | #![feature(box_patterns)] |
| 9 | 9 | |
| 10 | 10 | macro mac() {} // OK |
tests/ui/cfg/cfg-macros-notfoo.rs+1-1| ... | ... | @@ -3,7 +3,7 @@ |
| 3 | 3 | // check that cfg correctly chooses between the macro impls (see also |
| 4 | 4 | // cfg-macros-foo.rs) |
| 5 | 5 | |
| 6 | #[cfg(FALSE)] | |
| 6 | #[cfg(false)] | |
| 7 | 7 | #[macro_use] |
| 8 | 8 | mod foo { |
| 9 | 9 | macro_rules! bar { |
tests/ui/cfg/cfg-match-arm.rs+1-1| ... | ... | @@ -11,7 +11,7 @@ fn foo(f: Foo) { |
| 11 | 11 | Foo::Bar => {}, |
| 12 | 12 | #[cfg(not(FALSE))] |
| 13 | 13 | Foo::Baz => {}, |
| 14 | #[cfg(FALSE)] | |
| 14 | #[cfg(false)] | |
| 15 | 15 | Basdfwe => {} |
| 16 | 16 | } |
| 17 | 17 | } |
tests/ui/cfg/cfg-stmt-recovery.rs+1-1| ... | ... | @@ -6,7 +6,7 @@ |
| 6 | 6 | #[cfg_eval] |
| 7 | 7 | fn main() { |
| 8 | 8 | #[cfg_eval] |
| 9 | let _ = #[cfg(FALSE)] 0; | |
| 9 | let _ = #[cfg(false)] 0; | |
| 10 | 10 | //~^ ERROR removing an expression is not supported in this position |
| 11 | 11 | //~| ERROR expected expression, found `;` |
| 12 | 12 | //~| ERROR removing an expression is not supported in this position |
tests/ui/cfg/cfg-stmt-recovery.stderr+3-3| ... | ... | @@ -1,19 +1,19 @@ |
| 1 | 1 | error: removing an expression is not supported in this position |
| 2 | 2 | --> $DIR/cfg-stmt-recovery.rs:9:13 |
| 3 | 3 | | |
| 4 | LL | let _ = #[cfg(FALSE)] 0; | |
| 4 | LL | let _ = #[cfg(false)] 0; | |
| 5 | 5 | | ^^^^^^^^^^^^^ |
| 6 | 6 | |
| 7 | 7 | error: expected expression, found `;` |
| 8 | 8 | --> $DIR/cfg-stmt-recovery.rs:9:28 |
| 9 | 9 | | |
| 10 | LL | let _ = #[cfg(FALSE)] 0; | |
| 10 | LL | let _ = #[cfg(false)] 0; | |
| 11 | 11 | | ^ expected expression |
| 12 | 12 | |
| 13 | 13 | error: removing an expression is not supported in this position |
| 14 | 14 | --> $DIR/cfg-stmt-recovery.rs:9:13 |
| 15 | 15 | | |
| 16 | LL | let _ = #[cfg(FALSE)] 0; | |
| 16 | LL | let _ = #[cfg(false)] 0; | |
| 17 | 17 | | ^^^^^^^^^^^^^ |
| 18 | 18 | |
| 19 | 19 | error: aborting due to 3 previous errors |
tests/ui/cfg/cfg_stmt_expr.rs+15-15| ... | ... | @@ -7,47 +7,47 @@ |
| 7 | 7 | |
| 8 | 8 | fn main() { |
| 9 | 9 | let a = 413; |
| 10 | #[cfg(FALSE)] | |
| 10 | #[cfg(false)] | |
| 11 | 11 | let a = (); |
| 12 | 12 | assert_eq!(a, 413); |
| 13 | 13 | |
| 14 | 14 | let mut b = 612; |
| 15 | #[cfg(FALSE)] | |
| 15 | #[cfg(false)] | |
| 16 | 16 | { |
| 17 | 17 | b = 1111; |
| 18 | 18 | } |
| 19 | 19 | assert_eq!(b, 612); |
| 20 | 20 | |
| 21 | #[cfg(FALSE)] | |
| 21 | #[cfg(false)] | |
| 22 | 22 | undefined_fn(); |
| 23 | 23 | |
| 24 | #[cfg(FALSE)] | |
| 24 | #[cfg(false)] | |
| 25 | 25 | undefined_macro!(); |
| 26 | #[cfg(FALSE)] | |
| 26 | #[cfg(false)] | |
| 27 | 27 | undefined_macro![]; |
| 28 | #[cfg(FALSE)] | |
| 28 | #[cfg(false)] | |
| 29 | 29 | undefined_macro!{}; |
| 30 | 30 | |
| 31 | 31 | // pretty printer bug... |
| 32 | // #[cfg(FALSE)] | |
| 32 | // #[cfg(false)] | |
| 33 | 33 | // undefined_macro!{} |
| 34 | 34 | |
| 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); | |
| 37 | 37 | assert_eq!(t, (1, 4)); |
| 38 | 38 | |
| 39 | 39 | let f = |_: u32, _: u32| (); |
| 40 | f(2, 1, #[cfg(FALSE)] 6); | |
| 40 | f(2, 1, #[cfg(false)] 6); | |
| 41 | 41 | |
| 42 | let _: u32 = a.clone(#[cfg(FALSE)] undefined); | |
| 42 | let _: u32 = a.clone(#[cfg(false)] undefined); | |
| 43 | 43 | |
| 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]; | |
| 46 | 46 | assert_eq!(t, [2, 6]); |
| 47 | 47 | |
| 48 | 48 | { |
| 49 | 49 | let r; |
| 50 | #[cfg(FALSE)] | |
| 50 | #[cfg(false)] | |
| 51 | 51 | (r = 5); |
| 52 | 52 | #[cfg(not(FALSE))] |
| 53 | 53 | (r = 10); |
| ... | ... | @@ -75,7 +75,7 @@ fn main() { |
| 75 | 75 | 612 |
| 76 | 76 | }); |
| 77 | 77 | |
| 78 | assert_eq!((#[cfg(FALSE)] 1, #[cfg(not(FALSE))] 2), (2,)); | |
| 78 | assert_eq!((#[cfg(false)] 1, #[cfg(not(FALSE))] 2), (2,)); | |
| 79 | 79 | assert_eq!(n, 612); |
| 80 | 80 | |
| 81 | 81 | // 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)] | |
| 5 | fn foo() {} | |
| 6 | ||
| 7 | fn main() { | |
| 8 | foo(); //~ ERROR cannot find function `foo` in this scope | |
| 9 | } |
tests/ui/cfg/cmdline-false.stderr created+9| ... | ... | @@ -0,0 +1,9 @@ |
| 1 | error[E0425]: cannot find function `foo` in this scope | |
| 2 | --> $DIR/cmdline-false.rs:8:5 | |
| 3 | | | |
| 4 | LL | foo(); | |
| 5 | | ^^^ not found in this scope | |
| 6 | ||
| 7 | error: aborting due to 1 previous error | |
| 8 | ||
| 9 | For more information about this error, try `rustc --explain E0425`. |
tests/ui/cfg/conditional-compile.rs+18-18| ... | ... | @@ -6,16 +6,16 @@ |
| 6 | 6 | |
| 7 | 7 | // Crate use statements |
| 8 | 8 | |
| 9 | #[cfg(FALSE)] | |
| 9 | #[cfg(false)] | |
| 10 | 10 | use flippity; |
| 11 | 11 | |
| 12 | #[cfg(FALSE)] | |
| 12 | #[cfg(false)] | |
| 13 | 13 | static b: bool = false; |
| 14 | 14 | |
| 15 | 15 | static b: bool = true; |
| 16 | 16 | |
| 17 | 17 | mod rustrt { |
| 18 | #[cfg(FALSE)] | |
| 18 | #[cfg(false)] | |
| 19 | 19 | extern "C" { |
| 20 | 20 | // This symbol doesn't exist and would be a link error if this |
| 21 | 21 | // module was codegened |
| ... | ... | @@ -25,12 +25,12 @@ mod rustrt { |
| 25 | 25 | extern "C" {} |
| 26 | 26 | } |
| 27 | 27 | |
| 28 | #[cfg(FALSE)] | |
| 28 | #[cfg(false)] | |
| 29 | 29 | type t = isize; |
| 30 | 30 | |
| 31 | 31 | type t = bool; |
| 32 | 32 | |
| 33 | #[cfg(FALSE)] | |
| 33 | #[cfg(false)] | |
| 34 | 34 | enum tg { |
| 35 | 35 | foo, |
| 36 | 36 | } |
| ... | ... | @@ -39,12 +39,12 @@ enum tg { |
| 39 | 39 | bar, |
| 40 | 40 | } |
| 41 | 41 | |
| 42 | #[cfg(FALSE)] | |
| 42 | #[cfg(false)] | |
| 43 | 43 | struct r { |
| 44 | 44 | i: isize, |
| 45 | 45 | } |
| 46 | 46 | |
| 47 | #[cfg(FALSE)] | |
| 47 | #[cfg(false)] | |
| 48 | 48 | fn r(i: isize) -> r { |
| 49 | 49 | r { i: i } |
| 50 | 50 | } |
| ... | ... | @@ -57,7 +57,7 @@ fn r(i: isize) -> r { |
| 57 | 57 | r { i: i } |
| 58 | 58 | } |
| 59 | 59 | |
| 60 | #[cfg(FALSE)] | |
| 60 | #[cfg(false)] | |
| 61 | 61 | mod m { |
| 62 | 62 | // This needs to parse but would fail in typeck. Since it's not in |
| 63 | 63 | // the current config it should not be typechecked. |
| ... | ... | @@ -69,7 +69,7 @@ mod m { |
| 69 | 69 | mod m { |
| 70 | 70 | // Submodules have slightly different code paths than the top-level |
| 71 | 71 | // module, so let's make sure this jazz works here as well |
| 72 | #[cfg(FALSE)] | |
| 72 | #[cfg(false)] | |
| 73 | 73 | pub fn f() {} |
| 74 | 74 | |
| 75 | 75 | pub fn f() {} |
| ... | ... | @@ -77,7 +77,7 @@ mod m { |
| 77 | 77 | |
| 78 | 78 | // Since the FALSE configuration isn't defined main will just be |
| 79 | 79 | // parsed, but nothing further will be done with it |
| 80 | #[cfg(FALSE)] | |
| 80 | #[cfg(false)] | |
| 81 | 81 | pub fn main() { |
| 82 | 82 | panic!() |
| 83 | 83 | } |
| ... | ... | @@ -93,14 +93,14 @@ pub fn main() { |
| 93 | 93 | } |
| 94 | 94 | |
| 95 | 95 | fn test_in_fn_ctxt() { |
| 96 | #[cfg(FALSE)] | |
| 96 | #[cfg(false)] | |
| 97 | 97 | fn f() { |
| 98 | 98 | panic!() |
| 99 | 99 | } |
| 100 | 100 | fn f() {} |
| 101 | 101 | f(); |
| 102 | 102 | |
| 103 | #[cfg(FALSE)] | |
| 103 | #[cfg(false)] | |
| 104 | 104 | static i: isize = 0; |
| 105 | 105 | static i: isize = 1; |
| 106 | 106 | assert_eq!(i, 1); |
| ... | ... | @@ -109,7 +109,7 @@ fn test_in_fn_ctxt() { |
| 109 | 109 | mod test_foreign_items { |
| 110 | 110 | pub mod rustrt { |
| 111 | 111 | extern "C" { |
| 112 | #[cfg(FALSE)] | |
| 112 | #[cfg(false)] | |
| 113 | 113 | pub fn write() -> String; |
| 114 | 114 | pub fn write() -> String; |
| 115 | 115 | } |
| ... | ... | @@ -117,7 +117,7 @@ mod test_foreign_items { |
| 117 | 117 | } |
| 118 | 118 | |
| 119 | 119 | mod test_use_statements { |
| 120 | #[cfg(FALSE)] | |
| 120 | #[cfg(false)] | |
| 121 | 121 | use flippity_foo; |
| 122 | 122 | } |
| 123 | 123 | |
| ... | ... | @@ -127,24 +127,24 @@ mod test_methods { |
| 127 | 127 | } |
| 128 | 128 | |
| 129 | 129 | impl Fooable for Foo { |
| 130 | #[cfg(FALSE)] | |
| 130 | #[cfg(false)] | |
| 131 | 131 | fn what(&self) {} |
| 132 | 132 | |
| 133 | 133 | fn what(&self) {} |
| 134 | 134 | |
| 135 | #[cfg(FALSE)] | |
| 135 | #[cfg(false)] | |
| 136 | 136 | fn the(&self) {} |
| 137 | 137 | |
| 138 | 138 | fn the(&self) {} |
| 139 | 139 | } |
| 140 | 140 | |
| 141 | 141 | trait Fooable { |
| 142 | #[cfg(FALSE)] | |
| 142 | #[cfg(false)] | |
| 143 | 143 | fn what(&self); |
| 144 | 144 | |
| 145 | 145 | fn what(&self); |
| 146 | 146 | |
| 147 | #[cfg(FALSE)] | |
| 147 | #[cfg(false)] | |
| 148 | 148 | fn the(&self); |
| 149 | 149 | |
| 150 | 150 | fn the(&self); |
tests/ui/cfg/diagnostics-cross-crate.stderr+2-2| ... | ... | @@ -12,7 +12,7 @@ LL | pub mod doesnt_exist { |
| 12 | 12 | note: the item is gated here |
| 13 | 13 | --> $DIR/auxiliary/cfged_out.rs:5:5 |
| 14 | 14 | | |
| 15 | LL | #[cfg(FALSE)] | |
| 15 | LL | #[cfg(false)] | |
| 16 | 16 | | ^^^^^^^^^^^^^ |
| 17 | 17 | |
| 18 | 18 | error[E0425]: cannot find function `uwu` in crate `cfged_out` |
| ... | ... | @@ -35,7 +35,7 @@ LL | pub fn uwu() {} |
| 35 | 35 | note: the item is gated here |
| 36 | 36 | --> $DIR/auxiliary/cfged_out.rs:2:5 |
| 37 | 37 | | |
| 38 | LL | #[cfg(FALSE)] | |
| 38 | LL | #[cfg(false)] | |
| 39 | 39 | | ^^^^^^^^^^^^^ |
| 40 | 40 | |
| 41 | 41 | error[E0425]: cannot find function `meow` in module `cfged_out::inner::right` |
tests/ui/cfg/diagnostics-reexport.rs+5-5| ... | ... | @@ -1,10 +1,10 @@ |
| 1 | 1 | pub mod inner { |
| 2 | #[cfg(FALSE)] | |
| 2 | #[cfg(false)] | |
| 3 | 3 | mod gone { |
| 4 | 4 | pub fn uwu() {} |
| 5 | 5 | } |
| 6 | 6 | |
| 7 | #[cfg(FALSE)] //~ NOTE the item is gated here | |
| 7 | #[cfg(false)] //~ NOTE the item is gated here | |
| 8 | 8 | pub use super::uwu; |
| 9 | 9 | //~^ NOTE found an item that was configured out |
| 10 | 10 | } |
| ... | ... | @@ -14,7 +14,7 @@ pub use a::x; |
| 14 | 14 | //~| NOTE no `x` in `a` |
| 15 | 15 | |
| 16 | 16 | mod a { |
| 17 | #[cfg(FALSE)] //~ NOTE the item is gated here | |
| 17 | #[cfg(false)] //~ NOTE the item is gated here | |
| 18 | 18 | pub fn x() {} |
| 19 | 19 | //~^ NOTE found an item that was configured out |
| 20 | 20 | } |
| ... | ... | @@ -25,10 +25,10 @@ pub use b::{x, y}; |
| 25 | 25 | //~| NOTE no `y` in `b` |
| 26 | 26 | |
| 27 | 27 | mod b { |
| 28 | #[cfg(FALSE)] //~ NOTE the item is gated here | |
| 28 | #[cfg(false)] //~ NOTE the item is gated here | |
| 29 | 29 | pub fn x() {} |
| 30 | 30 | //~^ 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 | |
| 32 | 32 | pub fn y() {} |
| 33 | 33 | //~^ NOTE found an item that was configured out |
| 34 | 34 | } |
tests/ui/cfg/diagnostics-reexport.stderr+4-4| ... | ... | @@ -12,7 +12,7 @@ LL | pub fn x() {} |
| 12 | 12 | note: the item is gated here |
| 13 | 13 | --> $DIR/diagnostics-reexport.rs:17:5 |
| 14 | 14 | | |
| 15 | LL | #[cfg(FALSE)] | |
| 15 | LL | #[cfg(false)] | |
| 16 | 16 | | ^^^^^^^^^^^^^ |
| 17 | 17 | |
| 18 | 18 | error[E0432]: unresolved imports `b::x`, `b::y` |
| ... | ... | @@ -31,7 +31,7 @@ LL | pub fn x() {} |
| 31 | 31 | note: the item is gated here |
| 32 | 32 | --> $DIR/diagnostics-reexport.rs:28:5 |
| 33 | 33 | | |
| 34 | LL | #[cfg(FALSE)] | |
| 34 | LL | #[cfg(false)] | |
| 35 | 35 | | ^^^^^^^^^^^^^ |
| 36 | 36 | note: found an item that was configured out |
| 37 | 37 | --> $DIR/diagnostics-reexport.rs:32:12 |
| ... | ... | @@ -41,7 +41,7 @@ LL | pub fn y() {} |
| 41 | 41 | note: the item is gated here |
| 42 | 42 | --> $DIR/diagnostics-reexport.rs:31:5 |
| 43 | 43 | | |
| 44 | LL | #[cfg(FALSE)] | |
| 44 | LL | #[cfg(false)] | |
| 45 | 45 | | ^^^^^^^^^^^^^ |
| 46 | 46 | |
| 47 | 47 | error[E0425]: cannot find function `uwu` in module `inner` |
| ... | ... | @@ -58,7 +58,7 @@ LL | pub use super::uwu; |
| 58 | 58 | note: the item is gated here |
| 59 | 59 | --> $DIR/diagnostics-reexport.rs:7:5 |
| 60 | 60 | | |
| 61 | LL | #[cfg(FALSE)] | |
| 61 | LL | #[cfg(false)] | |
| 62 | 62 | | ^^^^^^^^^^^^^ |
| 63 | 63 | |
| 64 | 64 | error: aborting due to 3 previous errors |
tests/ui/cfg/diagnostics-same-crate.rs+2-2| ... | ... | @@ -1,11 +1,11 @@ |
| 1 | 1 | #![allow(unexpected_cfgs)] // since we want to recognize them as unexpected |
| 2 | 2 | |
| 3 | 3 | pub mod inner { |
| 4 | #[cfg(FALSE)] //~ NOTE the item is gated here | |
| 4 | #[cfg(false)] //~ NOTE the item is gated here | |
| 5 | 5 | pub fn uwu() {} |
| 6 | 6 | //~^ NOTE found an item that was configured out |
| 7 | 7 | |
| 8 | #[cfg(FALSE)] //~ NOTE the item is gated here | |
| 8 | #[cfg(false)] //~ NOTE the item is gated here | |
| 9 | 9 | //~^ NOTE the item is gated here |
| 10 | 10 | //~| NOTE the item is gated here |
| 11 | 11 | pub mod doesnt_exist { |
tests/ui/cfg/diagnostics-same-crate.stderr+4-4| ... | ... | @@ -12,7 +12,7 @@ LL | pub mod doesnt_exist { |
| 12 | 12 | note: the item is gated here |
| 13 | 13 | --> $DIR/diagnostics-same-crate.rs:8:5 |
| 14 | 14 | | |
| 15 | LL | #[cfg(FALSE)] | |
| 15 | LL | #[cfg(false)] | |
| 16 | 16 | | ^^^^^^^^^^^^^ |
| 17 | 17 | |
| 18 | 18 | error[E0432]: unresolved import `super::inner::doesnt_exist` |
| ... | ... | @@ -29,7 +29,7 @@ LL | pub mod doesnt_exist { |
| 29 | 29 | note: the item is gated here |
| 30 | 30 | --> $DIR/diagnostics-same-crate.rs:8:5 |
| 31 | 31 | | |
| 32 | LL | #[cfg(FALSE)] | |
| 32 | LL | #[cfg(false)] | |
| 33 | 33 | | ^^^^^^^^^^^^^ |
| 34 | 34 | |
| 35 | 35 | error[E0433]: failed to resolve: could not find `doesnt_exist` in `inner` |
| ... | ... | @@ -46,7 +46,7 @@ LL | pub mod doesnt_exist { |
| 46 | 46 | note: the item is gated here |
| 47 | 47 | --> $DIR/diagnostics-same-crate.rs:8:5 |
| 48 | 48 | | |
| 49 | LL | #[cfg(FALSE)] | |
| 49 | LL | #[cfg(false)] | |
| 50 | 50 | | ^^^^^^^^^^^^^ |
| 51 | 51 | |
| 52 | 52 | error[E0425]: cannot find function `uwu` in module `inner` |
| ... | ... | @@ -63,7 +63,7 @@ LL | pub fn uwu() {} |
| 63 | 63 | note: the item is gated here |
| 64 | 64 | --> $DIR/diagnostics-same-crate.rs:4:5 |
| 65 | 65 | | |
| 66 | LL | #[cfg(FALSE)] | |
| 66 | LL | #[cfg(false)] | |
| 67 | 67 | | ^^^^^^^^^^^^^ |
| 68 | 68 | |
| 69 | 69 | error[E0425]: cannot find function `meow` in module `inner::right` |
tests/ui/cfg/true-false.rs-1| ... | ... | @@ -1,7 +1,6 @@ |
| 1 | 1 | //@ run-pass |
| 2 | 2 | |
| 3 | 3 | #![feature(link_cfg)] |
| 4 | #![feature(cfg_boolean_literals)] | |
| 5 | 4 | |
| 6 | 5 | #[cfg(true)] |
| 7 | 6 | fn foo() -> bool { |
tests/ui/check-cfg/allow-same-level.rs+1-1| ... | ... | @@ -12,7 +12,7 @@ |
| 12 | 12 | //@ compile-flags: --check-cfg=cfg() --cfg=unknown_but_active_cfg |
| 13 | 13 | |
| 14 | 14 | #[allow(unexpected_cfgs)] |
| 15 | #[cfg(FALSE)] | |
| 15 | #[cfg(unknown_and_inactive_cfg)] | |
| 16 | 16 | //~^ WARNING unexpected `cfg` condition name |
| 17 | 17 | fn bar() {} |
| 18 | 18 |
tests/ui/check-cfg/allow-same-level.stderr+4-4| ... | ... | @@ -1,10 +1,10 @@ |
| 1 | warning: unexpected `cfg` condition name: `FALSE` | |
| 1 | warning: unexpected `cfg` condition name: `unknown_and_inactive_cfg` | |
| 2 | 2 | --> $DIR/allow-same-level.rs:15:7 |
| 3 | 3 | | |
| 4 | LL | #[cfg(FALSE)] | |
| 5 | | ^^^^^ | |
| 4 | LL | #[cfg(unknown_and_inactive_cfg)] | |
| 5 | | ^^^^^^^^^^^^^^^^^^^^^^^^ | |
| 6 | 6 | | |
| 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)` | |
| 8 | 8 | = note: see <https://doc.rust-lang.org/nightly/rustc/check-cfg.html> for more information about checking conditional configuration |
| 9 | 9 | = note: `#[warn(unexpected_cfgs)]` on by default |
| 10 | 10 |
tests/ui/check-cfg/allow-top-level.rs+1-1| ... | ... | @@ -6,7 +6,7 @@ |
| 6 | 6 | |
| 7 | 7 | #![allow(unexpected_cfgs)] |
| 8 | 8 | |
| 9 | #[cfg(FALSE)] | |
| 9 | #[cfg(false)] | |
| 10 | 10 | fn bar() {} |
| 11 | 11 | |
| 12 | 12 | fn foo() { |
tests/ui/check-cfg/allow-upper-level.rs+1-1| ... | ... | @@ -6,7 +6,7 @@ |
| 6 | 6 | |
| 7 | 7 | #[allow(unexpected_cfgs)] |
| 8 | 8 | mod aa { |
| 9 | #[cfg(FALSE)] | |
| 9 | #[cfg(false)] | |
| 10 | 10 | fn bar() {} |
| 11 | 11 | } |
| 12 | 12 |
tests/ui/codemap_tests/unicode.expanded.stdout+1| ... | ... | @@ -7,6 +7,7 @@ extern crate std; |
| 7 | 7 | //@ revisions: normal expanded |
| 8 | 8 | //@[expanded] check-pass |
| 9 | 9 | //@[expanded]compile-flags: -Zunpretty=expanded |
| 10 | //@ edition: 2015 | |
| 10 | 11 | |
| 11 | 12 | extern "路濫狼á́́" fn foo() {} |
| 12 | 13 |
tests/ui/codemap_tests/unicode.normal.stderr+1-1| ... | ... | @@ -1,5 +1,5 @@ |
| 1 | 1 | error[E0703]: invalid ABI: found `路濫狼á́́` |
| 2 | --> $DIR/unicode.rs:5:8 | |
| 2 | --> $DIR/unicode.rs:6:8 | |
| 3 | 3 | | |
| 4 | 4 | LL | extern "路濫狼á́́" fn foo() {} |
| 5 | 5 | | ^^^^^^^^^ invalid ABI |
tests/ui/codemap_tests/unicode.rs+1| ... | ... | @@ -1,6 +1,7 @@ |
| 1 | 1 | //@ revisions: normal expanded |
| 2 | 2 | //@[expanded] check-pass |
| 3 | 3 | //@[expanded]compile-flags: -Zunpretty=expanded |
| 4 | //@ edition: 2015 | |
| 4 | 5 | |
| 5 | 6 | extern "路濫狼á́́" fn foo() {} //[normal]~ ERROR invalid ABI |
| 6 | 7 |
tests/ui/conditional-compilation/cfg-generic-params.rs+8-8| ... | ... | @@ -1,18 +1,18 @@ |
| 1 | 1 | //@ compile-flags:--cfg yes --check-cfg=cfg(yes,no) |
| 2 | 2 | |
| 3 | fn f_lt<#[cfg(yes)] 'a: 'a, #[cfg(FALSE)] T>() {} | |
| 4 | fn f_ty<#[cfg(FALSE)] 'a: 'a, #[cfg(yes)] T>() {} | |
| 3 | fn f_lt<#[cfg(yes)] 'a: 'a, #[cfg(false)] T>() {} | |
| 4 | fn f_ty<#[cfg(false)] 'a: 'a, #[cfg(yes)] T>() {} | |
| 5 | 5 | |
| 6 | type FnGood = for<#[cfg(yes)] 'a, #[cfg(FALSE)] T> fn(); // OK | |
| 7 | type FnBad = for<#[cfg(FALSE)] 'a, #[cfg(yes)] T> fn(); | |
| 6 | type FnGood = for<#[cfg(yes)] 'a, #[cfg(false)] T> fn(); // OK | |
| 7 | type FnBad = for<#[cfg(false)] 'a, #[cfg(yes)] T> fn(); | |
| 8 | 8 | //~^ ERROR only lifetime parameters can be used in this context |
| 9 | 9 | |
| 10 | type PolyGood = dyn for<#[cfg(yes)] 'a, #[cfg(FALSE)] T> Copy; // OK | |
| 11 | type PolyBad = dyn for<#[cfg(FALSE)] 'a, #[cfg(yes)] T> Copy; | |
| 10 | type PolyGood = dyn for<#[cfg(yes)] 'a, #[cfg(false)] T> Copy; // OK | |
| 11 | type PolyBad = dyn for<#[cfg(false)] 'a, #[cfg(yes)] T> Copy; | |
| 12 | 12 | //~^ ERROR only lifetime parameters can be used in this context |
| 13 | 13 | |
| 14 | struct WhereGood where for<#[cfg(yes)] 'a, #[cfg(FALSE)] T> u8: Copy; // OK | |
| 15 | struct WhereBad where for<#[cfg(FALSE)] 'a, #[cfg(yes)] T> u8: Copy; | |
| 14 | struct WhereGood where for<#[cfg(yes)] 'a, #[cfg(false)] T> u8: Copy; // OK | |
| 15 | struct WhereBad where for<#[cfg(false)] 'a, #[cfg(yes)] T> u8: Copy; | |
| 16 | 16 | //~^ ERROR only lifetime parameters can be used in this context |
| 17 | 17 | |
| 18 | 18 | fn 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; |
| 31 | 31 | error[E0658]: only lifetime parameters can be used in this context |
| 32 | 32 | --> $DIR/cfg-generic-params.rs:7:48 |
| 33 | 33 | | |
| 34 | LL | type FnBad = for<#[cfg(FALSE)] 'a, #[cfg(yes)] T> fn(); | |
| 34 | LL | type FnBad = for<#[cfg(false)] 'a, #[cfg(yes)] T> fn(); | |
| 35 | 35 | | ^ |
| 36 | 36 | | |
| 37 | 37 | = 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(); |
| 41 | 41 | error[E0658]: only lifetime parameters can be used in this context |
| 42 | 42 | --> $DIR/cfg-generic-params.rs:11:54 |
| 43 | 43 | | |
| 44 | LL | type PolyBad = dyn for<#[cfg(FALSE)] 'a, #[cfg(yes)] T> Copy; | |
| 44 | LL | type PolyBad = dyn for<#[cfg(false)] 'a, #[cfg(yes)] T> Copy; | |
| 45 | 45 | | ^ |
| 46 | 46 | | |
| 47 | 47 | = 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; |
| 51 | 51 | error[E0658]: only lifetime parameters can be used in this context |
| 52 | 52 | --> $DIR/cfg-generic-params.rs:15:57 |
| 53 | 53 | | |
| 54 | LL | struct WhereBad where for<#[cfg(FALSE)] 'a, #[cfg(yes)] T> u8: Copy; | |
| 54 | LL | struct WhereBad where for<#[cfg(false)] 'a, #[cfg(yes)] T> u8: Copy; | |
| 55 | 55 | | ^ |
| 56 | 56 | | |
| 57 | 57 | = 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 @@ |
| 1 | 1 | error[E0601]: `main` function not found in crate `cfg_in_crate_1` |
| 2 | 2 | --> $DIR/cfg-in-crate-1.rs:1:15 |
| 3 | 3 | | |
| 4 | LL | #![cfg(FALSE)] | |
| 4 | LL | #![cfg(false)] | |
| 5 | 5 | | ^ consider adding a `main` function to `$DIR/cfg-in-crate-1.rs` |
| 6 | 6 | |
| 7 | 7 | error: aborting due to 1 previous error |
tests/ui/conditional-compilation/cfg-non-opt-expr.rs+3-3| ... | ... | @@ -2,10 +2,10 @@ |
| 2 | 2 | #![feature(custom_test_frameworks)] |
| 3 | 3 | |
| 4 | 4 | fn main() { |
| 5 | let _ = #[cfg(FALSE)] (); | |
| 5 | let _ = #[cfg(false)] (); | |
| 6 | 6 | //~^ ERROR removing an expression is not supported in this position |
| 7 | let _ = 1 + 2 + #[cfg(FALSE)] 3; | |
| 7 | let _ = 1 + 2 + #[cfg(false)] 3; | |
| 8 | 8 | //~^ 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]; | |
| 10 | 10 | //~^ ERROR removing an expression is not supported in this position |
| 11 | 11 | } |
tests/ui/conditional-compilation/cfg-non-opt-expr.stderr+3-3| ... | ... | @@ -1,19 +1,19 @@ |
| 1 | 1 | error: removing an expression is not supported in this position |
| 2 | 2 | --> $DIR/cfg-non-opt-expr.rs:5:13 |
| 3 | 3 | | |
| 4 | LL | let _ = #[cfg(FALSE)] (); | |
| 4 | LL | let _ = #[cfg(false)] (); | |
| 5 | 5 | | ^^^^^^^^^^^^^ |
| 6 | 6 | |
| 7 | 7 | error: removing an expression is not supported in this position |
| 8 | 8 | --> $DIR/cfg-non-opt-expr.rs:7:21 |
| 9 | 9 | | |
| 10 | LL | let _ = 1 + 2 + #[cfg(FALSE)] 3; | |
| 10 | LL | let _ = 1 + 2 + #[cfg(false)] 3; | |
| 11 | 11 | | ^^^^^^^^^^^^^ |
| 12 | 12 | |
| 13 | 13 | error: removing an expression is not supported in this position |
| 14 | 14 | --> $DIR/cfg-non-opt-expr.rs:9:23 |
| 15 | 15 | | |
| 16 | LL | let _ = [1, 2, 3][#[cfg(FALSE)] 1]; | |
| 16 | LL | let _ = [1, 2, 3][#[cfg(false)] 1]; | |
| 17 | 17 | | ^^^^^^^^^^^^^ |
| 18 | 18 | |
| 19 | 19 | error: aborting due to 3 previous errors |
tests/ui/conditional-compilation/module_with_cfg.rs+1-1| ... | ... | @@ -1,3 +1,3 @@ |
| 1 | 1 | //@ ignore-test (auxiliary, used by other tests) |
| 2 | 2 | |
| 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 @@ |
| 1 | 1 | // Test the AST pretty printer correctly handles default values for const generics |
| 2 | 2 | //@ check-pass |
| 3 | 3 | //@ compile-flags: -Z unpretty=expanded |
| 4 | //@ edition: 2015 | |
| 4 | 5 | |
| 5 | 6 | #![crate_type = "lib"] |
| 6 | 7 |
tests/ui/const-generics/defaults/pretty-printing-ast.stdout+1| ... | ... | @@ -3,6 +3,7 @@ |
| 3 | 3 | // Test the AST pretty printer correctly handles default values for const generics |
| 4 | 4 | //@ check-pass |
| 5 | 5 | //@ compile-flags: -Z unpretty=expanded |
| 6 | //@ edition: 2015 | |
| 6 | 7 | |
| 7 | 8 | #![crate_type = "lib"] |
| 8 | 9 | #[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 @@ |
| 1 | 1 | fn main() {} |
| 2 | 2 | |
| 3 | #[cfg(FALSE)] | |
| 3 | #[cfg(false)] | |
| 4 | 4 | fn container() { |
| 5 | 5 | const unsafe WhereIsFerris Now() {} |
| 6 | 6 | //~^ 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 @@ |
| 1 | 1 | fn main() {} |
| 2 | 2 | |
| 3 | #[cfg(FALSE)] | |
| 3 | #[cfg(false)] | |
| 4 | 4 | fn container() { |
| 5 | 5 | const extern "Rust" PUT_ANYTHING_YOU_WANT_HERE bug() -> usize { 1 } |
| 6 | 6 | //~^ ERROR expected `fn` |
tests/ui/delegation/explicit-paths-signature-pass.rs+1-1| ... | ... | @@ -6,7 +6,7 @@ |
| 6 | 6 | mod to_reuse { |
| 7 | 7 | use crate::S; |
| 8 | 8 | |
| 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 { | |
| 10 | 10 | 1 |
| 11 | 11 | } |
| 12 | 12 | } |
tests/ui/deriving/built-in-proc-macro-scope.rs+1| ... | ... | @@ -1,6 +1,7 @@ |
| 1 | 1 | //@ check-pass |
| 2 | 2 | //@ proc-macro: another-proc-macro.rs |
| 3 | 3 | //@ compile-flags: -Zunpretty=expanded |
| 4 | //@ edition:2015 | |
| 4 | 5 | |
| 5 | 6 | #![feature(derive_coerce_pointee)] |
| 6 | 7 |
tests/ui/deriving/built-in-proc-macro-scope.stdout+1| ... | ... | @@ -3,6 +3,7 @@ |
| 3 | 3 | //@ check-pass |
| 4 | 4 | //@ proc-macro: another-proc-macro.rs |
| 5 | 5 | //@ compile-flags: -Zunpretty=expanded |
| 6 | //@ edition:2015 | |
| 6 | 7 | |
| 7 | 8 | #![feature(derive_coerce_pointee)] |
| 8 | 9 | #[prelude_import] |
tests/ui/deriving/deriving-coerce-pointee-expanded.rs+1| ... | ... | @@ -1,5 +1,6 @@ |
| 1 | 1 | //@ check-pass |
| 2 | 2 | //@ compile-flags: -Zunpretty=expanded |
| 3 | //@ edition: 2015 | |
| 3 | 4 | #![feature(derive_coerce_pointee)] |
| 4 | 5 | use std::marker::CoercePointee; |
| 5 | 6 |
tests/ui/deriving/deriving-coerce-pointee-expanded.stdout+1| ... | ... | @@ -2,6 +2,7 @@ |
| 2 | 2 | #![no_std] |
| 3 | 3 | //@ check-pass |
| 4 | 4 | //@ compile-flags: -Zunpretty=expanded |
| 5 | //@ edition: 2015 | |
| 5 | 6 | #![feature(derive_coerce_pointee)] |
| 6 | 7 | #[prelude_import] |
| 7 | 8 | use ::std::prelude::rust_2015::*; |
tests/ui/deriving/proc-macro-attribute-mixing.rs+1| ... | ... | @@ -7,6 +7,7 @@ |
| 7 | 7 | //@ check-pass |
| 8 | 8 | //@ proc-macro: another-proc-macro.rs |
| 9 | 9 | //@ compile-flags: -Zunpretty=expanded |
| 10 | //@ edition: 2015 | |
| 10 | 11 | |
| 11 | 12 | #![feature(derive_coerce_pointee)] |
| 12 | 13 |
tests/ui/deriving/proc-macro-attribute-mixing.stdout+1| ... | ... | @@ -9,6 +9,7 @@ |
| 9 | 9 | //@ check-pass |
| 10 | 10 | //@ proc-macro: another-proc-macro.rs |
| 11 | 11 | //@ compile-flags: -Zunpretty=expanded |
| 12 | //@ edition: 2015 | |
| 12 | 13 | |
| 13 | 14 | #![feature(derive_coerce_pointee)] |
| 14 | 15 | #[prelude_import] |
tests/ui/expr/if/attrs/bad-cfg.rs+1-1| ... | ... | @@ -1,5 +1,5 @@ |
| 1 | 1 | #![feature(stmt_expr_attributes)] |
| 2 | 2 | |
| 3 | 3 | fn main() { |
| 4 | let _ = #[cfg(FALSE)] if true {}; //~ ERROR removing an expression | |
| 4 | let _ = #[cfg(false)] if true {}; //~ ERROR removing an expression | |
| 5 | 5 | } |
tests/ui/expr/if/attrs/bad-cfg.stderr+1-1| ... | ... | @@ -1,7 +1,7 @@ |
| 1 | 1 | error: removing an expression is not supported in this position |
| 2 | 2 | --> $DIR/bad-cfg.rs:4:13 |
| 3 | 3 | | |
| 4 | LL | let _ = #[cfg(FALSE)] if true {}; | |
| 4 | LL | let _ = #[cfg(false)] if true {}; | |
| 5 | 5 | | ^^^^^^^^^^^^^ |
| 6 | 6 | |
| 7 | 7 | error: aborting due to 1 previous error |
tests/ui/expr/if/attrs/cfg-false-if-attr.rs+7-7| ... | ... | @@ -1,12 +1,12 @@ |
| 1 | 1 | //@ check-pass |
| 2 | 2 | |
| 3 | #[cfg(FALSE)] | |
| 3 | #[cfg(false)] | |
| 4 | 4 | fn simple_attr() { |
| 5 | 5 | #[attr] if true {} |
| 6 | 6 | #[allow_warnings] if true {} |
| 7 | 7 | } |
| 8 | 8 | |
| 9 | #[cfg(FALSE)] | |
| 9 | #[cfg(false)] | |
| 10 | 10 | fn if_else_chain() { |
| 11 | 11 | #[first_attr] if true { |
| 12 | 12 | } else if false { |
| ... | ... | @@ -14,20 +14,20 @@ fn if_else_chain() { |
| 14 | 14 | } |
| 15 | 15 | } |
| 16 | 16 | |
| 17 | #[cfg(FALSE)] | |
| 17 | #[cfg(false)] | |
| 18 | 18 | fn if_let() { |
| 19 | 19 | #[attr] if let Some(_) = Some(true) {} |
| 20 | 20 | } |
| 21 | 21 | |
| 22 | 22 | fn bar() { |
| 23 | #[cfg(FALSE)] | |
| 23 | #[cfg(false)] | |
| 24 | 24 | 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)] | |
| 26 | 26 | } |
| 27 | 27 | |
| 28 | #[cfg_attr(not(FALSE), cfg(FALSE))] | |
| 28 | #[cfg_attr(not(FALSE), cfg(false))] | |
| 29 | 29 | 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)] | |
| 31 | 31 | } |
| 32 | 32 | } |
| 33 | 33 |
tests/ui/expr/if/attrs/else-attrs.rs+3-3| ... | ... | @@ -1,11 +1,11 @@ |
| 1 | #[cfg(FALSE)] | |
| 1 | #[cfg(false)] | |
| 2 | 2 | fn if_else_parse_error() { |
| 3 | 3 | if true { |
| 4 | 4 | } #[attr] else if false { //~ ERROR expected |
| 5 | 5 | } |
| 6 | 6 | } |
| 7 | 7 | |
| 8 | #[cfg(FALSE)] | |
| 8 | #[cfg(false)] | |
| 9 | 9 | fn else_attr_ifparse_error() { |
| 10 | 10 | if true { |
| 11 | 11 | } else #[attr] if false { //~ ERROR outer attributes are not allowed |
| ... | ... | @@ -13,7 +13,7 @@ fn else_attr_ifparse_error() { |
| 13 | 13 | } |
| 14 | 14 | } |
| 15 | 15 | |
| 16 | #[cfg(FALSE)] | |
| 16 | #[cfg(false)] | |
| 17 | 17 | fn else_parse_error() { |
| 18 | 18 | if true { |
| 19 | 19 | } else if false { |
tests/ui/expr/if/attrs/gate-whole-expr.rs+1-1| ... | ... | @@ -3,7 +3,7 @@ |
| 3 | 3 | fn main() { |
| 4 | 4 | let x = 1; |
| 5 | 5 | |
| 6 | #[cfg(FALSE)] | |
| 6 | #[cfg(false)] | |
| 7 | 7 | if false { |
| 8 | 8 | x = 2; |
| 9 | 9 | } else if true { |
tests/ui/expr/if/attrs/let-chains-attr.rs+1-1| ... | ... | @@ -2,7 +2,7 @@ |
| 2 | 2 | |
| 3 | 3 | #![feature(let_chains)] |
| 4 | 4 | |
| 5 | #[cfg(FALSE)] | |
| 5 | #[cfg(false)] | |
| 6 | 6 | fn foo() { |
| 7 | 7 | #[attr] |
| 8 | 8 | 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 | |
| 2 | fn foo() {} | |
| 3 | ||
| 4 | #[cfg_attr(true, cfg(false))] //~ ERROR `cfg(true)` is experimental | |
| 5 | //~^ ERROR `cfg(false)` is experimental | |
| 6 | fn foo() {} | |
| 7 | ||
| 8 | fn 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 @@ |
| 1 | error[E0658]: `cfg(true)` is experimental and subject to change | |
| 2 | --> $DIR/feature-gate-cfg-boolean-literals.rs:1:7 | |
| 3 | | | |
| 4 | LL | #[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 | ||
| 11 | error[E0658]: `cfg(true)` is experimental and subject to change | |
| 12 | --> $DIR/feature-gate-cfg-boolean-literals.rs:4:12 | |
| 13 | | | |
| 14 | LL | #[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 | ||
| 21 | error[E0658]: `cfg(false)` is experimental and subject to change | |
| 22 | --> $DIR/feature-gate-cfg-boolean-literals.rs:4:22 | |
| 23 | | | |
| 24 | LL | #[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 | ||
| 31 | error[E0658]: `cfg(false)` is experimental and subject to change | |
| 32 | --> $DIR/feature-gate-cfg-boolean-literals.rs:9:10 | |
| 33 | | | |
| 34 | LL | 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 | ||
| 41 | error: aborting due to 4 previous errors | |
| 42 | ||
| 43 | For 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() { |
| 12 | 12 | //~^^ ERROR `yield` can only be used |
| 13 | 13 | } |
| 14 | 14 | |
| 15 | #[cfg(FALSE)] | |
| 15 | #[cfg(false)] | |
| 16 | 16 | fn foo() { |
| 17 | 17 | // Ok in 2024 edition |
| 18 | 18 | yield; //~ ERROR yield syntax is experimental |
tests/ui/feature-gates/feature-gate-deref_patterns.rs+1-1| ... | ... | @@ -4,6 +4,6 @@ fn main() { |
| 4 | 4 | println!("x: {}", x); |
| 5 | 5 | |
| 6 | 6 | // `box` syntax is allowed to be cfg-ed out for historical reasons (#65742). |
| 7 | #[cfg(FALSE)] | |
| 7 | #[cfg(false)] | |
| 8 | 8 | let box _x = Box::new('c'); |
| 9 | 9 | } |
tests/ui/feature-gates/feature-gate-gen_blocks.rs+1-1| ... | ... | @@ -17,7 +17,7 @@ fn test_async_gen() { |
| 17 | 17 | |
| 18 | 18 | fn main() {} |
| 19 | 19 | |
| 20 | #[cfg(FALSE)] | |
| 20 | #[cfg(false)] | |
| 21 | 21 | fn foo() { |
| 22 | 22 | gen {}; |
| 23 | 23 | //[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() { |
| 30 | 30 | while let (x if guard(x)) = 0 {} |
| 31 | 31 | //~^ ERROR: guard patterns are experimental |
| 32 | 32 | |
| 33 | #[cfg(FALSE)] | |
| 33 | #[cfg(false)] | |
| 34 | 34 | while let (x if guard(x)) = 0 {} |
| 35 | 35 | //~^ ERROR: guard patterns are experimental |
| 36 | 36 | } |
tests/ui/feature-gates/feature-gate-mut-ref.rs+2-2| ... | ... | @@ -6,8 +6,8 @@ fn main() { |
| 6 | 6 | let mut ref mut z = 14; //~ ERROR [E0658] |
| 7 | 7 | z = &mut 15; |
| 8 | 8 | |
| 9 | #[cfg(FALSE)] | |
| 9 | #[cfg(false)] | |
| 10 | 10 | let mut ref x = 10; //~ ERROR [E0658] |
| 11 | #[cfg(FALSE)] | |
| 11 | #[cfg(false)] | |
| 12 | 12 | let mut ref mut y = 10; //~ ERROR [E0658] |
| 13 | 13 | } |
tests/ui/feature-gates/feature-gate-never_patterns.rs+4-4| ... | ... | @@ -15,12 +15,12 @@ fn main() { |
| 15 | 15 | //~^ ERROR `!` patterns are experimental |
| 16 | 16 | } |
| 17 | 17 | // Check that the gate operates even behind `cfg`. |
| 18 | #[cfg(FALSE)] | |
| 18 | #[cfg(false)] | |
| 19 | 19 | match *ptr { |
| 20 | 20 | ! |
| 21 | 21 | //~^ ERROR `!` patterns are experimental |
| 22 | 22 | } |
| 23 | #[cfg(FALSE)] | |
| 23 | #[cfg(false)] | |
| 24 | 24 | match *ptr { |
| 25 | 25 | ! => {} |
| 26 | 26 | //~^ ERROR `!` patterns are experimental |
| ... | ... | @@ -60,13 +60,13 @@ fn main() { |
| 60 | 60 | // Check that the gate operates even behind `cfg`. |
| 61 | 61 | match Some(0) { |
| 62 | 62 | None => {} |
| 63 | #[cfg(FALSE)] | |
| 63 | #[cfg(false)] | |
| 64 | 64 | Some(_) |
| 65 | 65 | //~^ ERROR `match` arm with no body |
| 66 | 66 | } |
| 67 | 67 | match Some(0) { |
| 68 | 68 | _ => {} |
| 69 | #[cfg(FALSE)] | |
| 69 | #[cfg(false)] | |
| 70 | 70 | Some(_) if false |
| 71 | 71 | //~^ ERROR `match` arm with no body |
| 72 | 72 | } |
tests/ui/feature-gates/feature-gate-postfix_match.rs+1-1| ... | ... | @@ -9,7 +9,7 @@ fn main() { |
| 9 | 9 | }; |
| 10 | 10 | |
| 11 | 11 | // Test that the gate works behind a cfg |
| 12 | #[cfg(FALSE)] | |
| 12 | #[cfg(false)] | |
| 13 | 13 | val.match { //~ ERROR postfix match is experimental |
| 14 | 14 | Some(42) => "the answer to life, the universe, and everything", |
| 15 | 15 | _ => "might be the answer to something" |
tests/ui/feature-gates/feature-gate-yeet_expr-in-cfg.rs+2-2| ... | ... | @@ -1,7 +1,7 @@ |
| 1 | 1 | //@ edition: 2021 |
| 2 | 2 | |
| 3 | 3 | pub fn demo() -> Option<i32> { |
| 4 | #[cfg(FALSE)] | |
| 4 | #[cfg(false)] | |
| 5 | 5 | { |
| 6 | 6 | do yeet //~ ERROR `do yeet` expression is experimental |
| 7 | 7 | } |
| ... | ... | @@ -9,7 +9,7 @@ pub fn demo() -> Option<i32> { |
| 9 | 9 | Some(1) |
| 10 | 10 | } |
| 11 | 11 | |
| 12 | #[cfg(FALSE)] | |
| 12 | #[cfg(false)] | |
| 13 | 13 | pub fn alternative() -> Result<(), String> { |
| 14 | 14 | do yeet "hello"; //~ ERROR `do yeet` expression is experimental |
| 15 | 15 | } |
tests/ui/feature-gates/soft-syntax-gates-with-errors.rs+3-3| ... | ... | @@ -5,7 +5,7 @@ |
| 5 | 5 | macro a() {} |
| 6 | 6 | //~^ ERROR: `macro` is experimental |
| 7 | 7 | |
| 8 | #[cfg(FALSE)] | |
| 8 | #[cfg(false)] | |
| 9 | 9 | macro b() {} |
| 10 | 10 | |
| 11 | 11 | macro_rules! identity { |
| ... | ... | @@ -17,13 +17,13 @@ identity! { |
| 17 | 17 | //~^ ERROR: `macro` is experimental |
| 18 | 18 | } |
| 19 | 19 | |
| 20 | #[cfg(FALSE)] | |
| 20 | #[cfg(false)] | |
| 21 | 21 | identity! { |
| 22 | 22 | macro d() {} // No error |
| 23 | 23 | } |
| 24 | 24 | |
| 25 | 25 | identity! { |
| 26 | #[cfg(FALSE)] | |
| 26 | #[cfg(false)] | |
| 27 | 27 | macro e() {} |
| 28 | 28 | } |
| 29 | 29 |
tests/ui/feature-gates/soft-syntax-gates-without-errors.rs+3-3| ... | ... | @@ -2,7 +2,7 @@ |
| 2 | 2 | // This file is used to test the behavior of the early-pass syntax warnings. |
| 3 | 3 | // If macro syntax is stabilized, replace with a different unstable syntax. |
| 4 | 4 | |
| 5 | #[cfg(FALSE)] | |
| 5 | #[cfg(false)] | |
| 6 | 6 | macro b() {} |
| 7 | 7 | //~^ WARN: `macro` is experimental |
| 8 | 8 | //~| WARN: unstable syntax |
| ... | ... | @@ -11,13 +11,13 @@ macro_rules! identity { |
| 11 | 11 | ($($x:tt)*) => ($($x)*); |
| 12 | 12 | } |
| 13 | 13 | |
| 14 | #[cfg(FALSE)] | |
| 14 | #[cfg(false)] | |
| 15 | 15 | identity! { |
| 16 | 16 | macro d() {} // No error |
| 17 | 17 | } |
| 18 | 18 | |
| 19 | 19 | identity! { |
| 20 | #[cfg(FALSE)] | |
| 20 | #[cfg(false)] | |
| 21 | 21 | macro e() {} |
| 22 | 22 | //~^ WARN: `macro` is experimental |
| 23 | 23 | //~| WARN: unstable syntax |
tests/ui/feature-gates/stmt_expr_attrs_no_feature.rs+12-12| ... | ... | @@ -25,7 +25,7 @@ fn main() { |
| 25 | 25 | |
| 26 | 26 | // Check that cfg works right |
| 27 | 27 | |
| 28 | #[cfg(FALSE)] | |
| 28 | #[cfg(false)] | |
| 29 | 29 | fn c() { |
| 30 | 30 | #[rustc_dummy] |
| 31 | 31 | 5; |
| ... | ... | @@ -37,7 +37,7 @@ fn j() { |
| 37 | 37 | 5; |
| 38 | 38 | } |
| 39 | 39 | |
| 40 | #[cfg_attr(not(FALSE), cfg(FALSE))] | |
| 40 | #[cfg_attr(not(FALSE), cfg(false))] | |
| 41 | 41 | fn d() { |
| 42 | 42 | #[rustc_dummy] |
| 43 | 43 | 8; |
| ... | ... | @@ -57,7 +57,7 @@ macro_rules! item_mac { |
| 57 | 57 | #[rustc_dummy] |
| 58 | 58 | 42; |
| 59 | 59 | |
| 60 | #[cfg(FALSE)] | |
| 60 | #[cfg(false)] | |
| 61 | 61 | fn f() { |
| 62 | 62 | #[rustc_dummy] |
| 63 | 63 | 5; |
| ... | ... | @@ -69,7 +69,7 @@ macro_rules! item_mac { |
| 69 | 69 | 5; |
| 70 | 70 | } |
| 71 | 71 | |
| 72 | #[cfg_attr(not(FALSE), cfg(FALSE))] | |
| 72 | #[cfg_attr(not(FALSE), cfg(false))] | |
| 73 | 73 | fn g() { |
| 74 | 74 | #[rustc_dummy] |
| 75 | 75 | 8; |
| ... | ... | @@ -90,42 +90,42 @@ item_mac!(e); |
| 90 | 90 | // check that the gate visitor works right: |
| 91 | 91 | |
| 92 | 92 | extern "C" { |
| 93 | #[cfg(FALSE)] | |
| 93 | #[cfg(false)] | |
| 94 | 94 | fn x(a: [u8; #[rustc_dummy] 5]); |
| 95 | 95 | fn y(a: [u8; #[rustc_dummy] 5]); //~ ERROR attributes on expressions are experimental |
| 96 | 96 | } |
| 97 | 97 | |
| 98 | 98 | struct Foo; |
| 99 | 99 | impl Foo { |
| 100 | #[cfg(FALSE)] | |
| 100 | #[cfg(false)] | |
| 101 | 101 | const X: u8 = #[rustc_dummy] 5; |
| 102 | 102 | const Y: u8 = #[rustc_dummy] 5; //~ ERROR attributes on expressions are experimental |
| 103 | 103 | } |
| 104 | 104 | |
| 105 | 105 | trait Bar { |
| 106 | #[cfg(FALSE)] | |
| 106 | #[cfg(false)] | |
| 107 | 107 | const X: [u8; #[rustc_dummy] 5]; |
| 108 | 108 | const Y: [u8; #[rustc_dummy] 5]; //~ ERROR attributes on expressions are experimental |
| 109 | 109 | } |
| 110 | 110 | |
| 111 | 111 | struct Joyce { |
| 112 | #[cfg(FALSE)] | |
| 112 | #[cfg(false)] | |
| 113 | 113 | field: [u8; #[rustc_dummy] 5], |
| 114 | 114 | field2: [u8; #[rustc_dummy] 5] //~ ERROR attributes on expressions are experimental |
| 115 | 115 | } |
| 116 | 116 | |
| 117 | 117 | struct Walky( |
| 118 | #[cfg(FALSE)] [u8; #[rustc_dummy] 5], | |
| 118 | #[cfg(false)] [u8; #[rustc_dummy] 5], | |
| 119 | 119 | [u8; #[rustc_dummy] 5] //~ ERROR attributes on expressions are experimental |
| 120 | 120 | ); |
| 121 | 121 | |
| 122 | 122 | enum Mike { |
| 123 | 123 | Happy( |
| 124 | #[cfg(FALSE)] [u8; #[rustc_dummy] 5], | |
| 124 | #[cfg(false)] [u8; #[rustc_dummy] 5], | |
| 125 | 125 | [u8; #[rustc_dummy] 5] //~ ERROR attributes on expressions are experimental |
| 126 | 126 | ), |
| 127 | 127 | Angry { |
| 128 | #[cfg(FALSE)] | |
| 128 | #[cfg(false)] | |
| 129 | 129 | field: [u8; #[rustc_dummy] 5], |
| 130 | 130 | field2: [u8; #[rustc_dummy] 5] //~ ERROR attributes on expressions are experimental |
| 131 | 131 | } |
| ... | ... | @@ -133,7 +133,7 @@ enum Mike { |
| 133 | 133 | |
| 134 | 134 | fn pat() { |
| 135 | 135 | match 5 { |
| 136 | #[cfg(FALSE)] | |
| 136 | #[cfg(false)] | |
| 137 | 137 | 5 => #[rustc_dummy] (), |
| 138 | 138 | 6 => #[rustc_dummy] (), //~ ERROR attributes on expressions are experimental |
| 139 | 139 | _ => (), |
tests/ui/filter-block-view-items.rs+1-1| ... | ... | @@ -3,5 +3,5 @@ |
| 3 | 3 | pub fn main() { |
| 4 | 4 | // Make sure that this view item is filtered out because otherwise it would |
| 5 | 5 | // trigger a compilation error |
| 6 | #[cfg(FALSE)] use bar as foo; | |
| 6 | #[cfg(false)] use bar as foo; | |
| 7 | 7 | } |
tests/ui/half-open-range-patterns/half-open-range-pats-inclusive-dotdotdot-bad-syntax.rs+1-1| ... | ... | @@ -9,7 +9,7 @@ |
| 9 | 9 | |
| 10 | 10 | fn main() {} |
| 11 | 11 | |
| 12 | #[cfg(FALSE)] | |
| 12 | #[cfg(false)] | |
| 13 | 13 | fn syntax() { |
| 14 | 14 | match scrutinee { |
| 15 | 15 | ...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 @@ |
| 3 | 3 | |
| 4 | 4 | fn main() {} |
| 5 | 5 | |
| 6 | #[cfg(FALSE)] | |
| 6 | #[cfg(false)] | |
| 7 | 7 | fn foo() { |
| 8 | 8 | if let 0... = 1 {} //~ ERROR inclusive range with no end |
| 9 | 9 | 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 @@ |
| 1 | 1 | fn main() {} |
| 2 | 2 | |
| 3 | #[cfg(FALSE)] | |
| 3 | #[cfg(false)] | |
| 4 | 4 | fn syntax() { |
| 5 | 5 | match &0 { |
| 6 | 6 | &0.. | _ => {} |
tests/ui/half-open-range-patterns/half-open-range-pats-syntactic-pass.rs+1-1| ... | ... | @@ -4,7 +4,7 @@ |
| 4 | 4 | |
| 5 | 5 | fn main() {} |
| 6 | 6 | |
| 7 | #[cfg(FALSE)] | |
| 7 | #[cfg(false)] | |
| 8 | 8 | fn syntax() { |
| 9 | 9 | match scrutinee { |
| 10 | 10 | X.. | 0.. | 'a'.. | 0.0f32.. => {} |
tests/ui/inner-attrs-on-impl.rs+2-2| ... | ... | @@ -3,7 +3,7 @@ |
| 3 | 3 | struct Foo; |
| 4 | 4 | |
| 5 | 5 | impl Foo { |
| 6 | #![cfg(FALSE)] | |
| 6 | #![cfg(false)] | |
| 7 | 7 | |
| 8 | 8 | fn method(&self) -> bool { false } |
| 9 | 9 | } |
| ... | ... | @@ -12,7 +12,7 @@ impl Foo { |
| 12 | 12 | #![cfg(not(FALSE))] |
| 13 | 13 | |
| 14 | 14 | // check that we don't eat attributes too eagerly. |
| 15 | #[cfg(FALSE)] | |
| 15 | #[cfg(false)] | |
| 16 | 16 | fn method(&self) -> bool { false } |
| 17 | 17 | |
| 18 | 18 | 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) { |
| 9 | 9 | (x, y) |
| 10 | 10 | } |
| 11 | 11 | |
| 12 | #[cfg(FALSE)] | |
| 12 | #[cfg(false)] | |
| 13 | 13 | unsafe fn access(n:*mut A) -> (i32, f64) { |
| 14 | 14 | let x : i32 = (*n).x; |
| 15 | 15 | let y : f64 = (*n).y; |
tests/ui/issues/issue-11085.rs+4-4| ... | ... | @@ -3,7 +3,7 @@ |
| 3 | 3 | #![allow(dead_code)] |
| 4 | 4 | |
| 5 | 5 | struct Foo { |
| 6 | #[cfg(FALSE)] | |
| 6 | #[cfg(false)] | |
| 7 | 7 | bar: baz, |
| 8 | 8 | foo: isize, |
| 9 | 9 | } |
| ... | ... | @@ -15,18 +15,18 @@ struct Foo2 { |
| 15 | 15 | |
| 16 | 16 | enum Bar1 { |
| 17 | 17 | Bar1_1, |
| 18 | #[cfg(FALSE)] | |
| 18 | #[cfg(false)] | |
| 19 | 19 | Bar1_2(NotAType), |
| 20 | 20 | } |
| 21 | 21 | |
| 22 | 22 | enum Bar2 { |
| 23 | #[cfg(FALSE)] | |
| 23 | #[cfg(false)] | |
| 24 | 24 | Bar2_1(NotAType), |
| 25 | 25 | } |
| 26 | 26 | |
| 27 | 27 | enum Bar3 { |
| 28 | 28 | Bar3_1 { |
| 29 | #[cfg(FALSE)] | |
| 29 | #[cfg(false)] | |
| 30 | 30 | foo: isize, |
| 31 | 31 | bar: isize, |
| 32 | 32 | } |
tests/ui/issues/issue-16819.rs+1-1| ... | ... | @@ -3,7 +3,7 @@ |
| 3 | 3 | // `#[cfg]` on struct field permits empty unusable struct |
| 4 | 4 | |
| 5 | 5 | struct S { |
| 6 | #[cfg(FALSE)] | |
| 6 | #[cfg(false)] | |
| 7 | 7 | a: int, |
| 8 | 8 | } |
| 9 | 9 |
tests/ui/lexer/error-stage.rs+1-1| ... | ... | @@ -59,7 +59,7 @@ const _: () = sink! { |
| 59 | 59 | |
| 60 | 60 | // The invalid literals used to cause errors, but this was changed by #102944. |
| 61 | 61 | // Except for `0b010.0f32`, because it's a lexer error. |
| 62 | #[cfg(FALSE)] | |
| 62 | #[cfg(false)] | |
| 63 | 63 | fn configured_out() { |
| 64 | 64 | "string"any_suffix; // OK |
| 65 | 65 | 10u123; // OK |
tests/ui/link-native-libs/link-attr-validation-late.rs+1-1| ... | ... | @@ -9,7 +9,7 @@ extern "C" {} |
| 9 | 9 | #[link(name = "foo", name = "bar")] //~ ERROR multiple `name` arguments |
| 10 | 10 | #[link(name = "...", kind = "dylib", kind = "bar")] //~ ERROR multiple `kind` arguments |
| 11 | 11 | #[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 | |
| 13 | 13 | #[link(wasm_import_module = "foo", wasm_import_module = "bar")] //~ ERROR multiple `wasm_import_module` arguments |
| 14 | 14 | extern "C" {} |
| 15 | 15 |
tests/ui/link-native-libs/link-attr-validation-late.stderr+1-1| ... | ... | @@ -31,7 +31,7 @@ LL | #[link(name = "...", modifiers = "+verbatim", modifiers = "bar")] |
| 31 | 31 | error: multiple `cfg` arguments in a single `#[link]` attribute |
| 32 | 32 | --> $DIR/link-attr-validation-late.rs:12:34 |
| 33 | 33 | | |
| 34 | LL | #[link(name = "...", cfg(FALSE), cfg(FALSE))] | |
| 34 | LL | #[link(name = "...", cfg(false), cfg(false))] | |
| 35 | 35 | | ^^^^^^^^^^ |
| 36 | 36 | |
| 37 | 37 | error: multiple `wasm_import_module` arguments in a single `#[link]` attribute |
tests/ui/lint/inert-attr-macro.rs-1| ... | ... | @@ -1,6 +1,5 @@ |
| 1 | 1 | //@ check-pass |
| 2 | 2 | |
| 3 | #![feature(cfg_boolean_literals)] | |
| 4 | 3 | #![warn(unused)] |
| 5 | 4 | |
| 6 | 5 | macro_rules! foo { |
tests/ui/lint/inert-attr-macro.stderr+7-7| ... | ... | @@ -1,41 +1,41 @@ |
| 1 | 1 | warning: unused attribute `inline` |
| 2 | --> $DIR/inert-attr-macro.rs:11:5 | |
| 2 | --> $DIR/inert-attr-macro.rs:10:5 | |
| 3 | 3 | | |
| 4 | 4 | LL | #[inline] foo!(); |
| 5 | 5 | | ^^^^^^^^^ |
| 6 | 6 | | |
| 7 | 7 | note: 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 | |
| 9 | 9 | | |
| 10 | 10 | LL | #[inline] foo!(); |
| 11 | 11 | | ^^^ |
| 12 | 12 | note: the lint level is defined here |
| 13 | --> $DIR/inert-attr-macro.rs:4:9 | |
| 13 | --> $DIR/inert-attr-macro.rs:3:9 | |
| 14 | 14 | | |
| 15 | 15 | LL | #![warn(unused)] |
| 16 | 16 | | ^^^^^^ |
| 17 | 17 | = note: `#[warn(unused_attributes)]` implied by `#[warn(unused)]` |
| 18 | 18 | |
| 19 | 19 | warning: unused attribute `allow` |
| 20 | --> $DIR/inert-attr-macro.rs:15:5 | |
| 20 | --> $DIR/inert-attr-macro.rs:14:5 | |
| 21 | 21 | | |
| 22 | 22 | LL | #[allow(warnings)] #[inline] foo!(); |
| 23 | 23 | | ^^^^^^^^^^^^^^^^^^ |
| 24 | 24 | | |
| 25 | 25 | note: 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 | |
| 27 | 27 | | |
| 28 | 28 | LL | #[allow(warnings)] #[inline] foo!(); |
| 29 | 29 | | ^^^ |
| 30 | 30 | |
| 31 | 31 | warning: unused attribute `inline` |
| 32 | --> $DIR/inert-attr-macro.rs:15:24 | |
| 32 | --> $DIR/inert-attr-macro.rs:14:24 | |
| 33 | 33 | | |
| 34 | 34 | LL | #[allow(warnings)] #[inline] foo!(); |
| 35 | 35 | | ^^^^^^^^^ |
| 36 | 36 | | |
| 37 | 37 | note: 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 | |
| 39 | 39 | | |
| 40 | 40 | LL | #[allow(warnings)] #[inline] foo!(); |
| 41 | 41 | | ^^^ |
tests/ui/lint/rfc-2383-lint-reason/no_ice_for_partial_compiler_runs.rs+1| ... | ... | @@ -1,6 +1,7 @@ |
| 1 | 1 | // This ensures that ICEs like rust#94953 don't happen |
| 2 | 2 | //@ check-pass |
| 3 | 3 | //@ compile-flags: -Z unpretty=expanded |
| 4 | //@ edition: 2015 | |
| 4 | 5 | |
| 5 | 6 | // This `expect` will create an expectation with an unstable expectation id |
| 6 | 7 | #[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; |
| 7 | 7 | // This ensures that ICEs like rust#94953 don't happen |
| 8 | 8 | //@ check-pass |
| 9 | 9 | //@ compile-flags: -Z unpretty=expanded |
| 10 | //@ edition: 2015 | |
| 10 | 11 | |
| 11 | 12 | // This `expect` will create an expectation with an unstable expectation id |
| 12 | 13 | #[expect(while_true)] |
tests/ui/lint/unused/unused-attr-macro-rules.rs+1-1| ... | ... | @@ -17,7 +17,7 @@ macro_rules! foo2 { |
| 17 | 17 | () => {}; |
| 18 | 18 | } |
| 19 | 19 | |
| 20 | #[cfg(FALSE)] | |
| 20 | #[cfg(false)] | |
| 21 | 21 | macro_rules! foo { |
| 22 | 22 | () => {}; |
| 23 | 23 | } |
tests/ui/macros/genercs-in-path-with-prettry-hir.rs+1| ... | ... | @@ -1,4 +1,5 @@ |
| 1 | 1 | //@ compile-flags: -Zunpretty=hir |
| 2 | //@ edition: 2015 | |
| 2 | 3 | |
| 3 | 4 | // issue#97006 |
| 4 | 5 |
tests/ui/macros/genercs-in-path-with-prettry-hir.stderr+1-1| ... | ... | @@ -1,5 +1,5 @@ |
| 1 | 1 | error: 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 | |
| 3 | 3 | | |
| 4 | 4 | LL | m!(inline<u8>); |
| 5 | 5 | | ^^^^ |
tests/ui/macros/genercs-in-path-with-prettry-hir.stdout+1| ... | ... | @@ -3,6 +3,7 @@ use ::std::prelude::rust_2015::*; |
| 3 | 3 | #[macro_use] |
| 4 | 4 | extern crate std; |
| 5 | 5 | //@ compile-flags: -Zunpretty=hir |
| 6 | //@ edition: 2015 | |
| 6 | 7 | |
| 7 | 8 | // issue#97006 |
| 8 | 9 |
tests/ui/macros/lint-trailing-macro-call.rs+1-1| ... | ... | @@ -6,7 +6,7 @@ |
| 6 | 6 | |
| 7 | 7 | macro_rules! expand_it { |
| 8 | 8 | () => { |
| 9 | #[cfg(FALSE)] 25; //~ WARN trailing semicolon in macro | |
| 9 | #[cfg(false)] 25; //~ WARN trailing semicolon in macro | |
| 10 | 10 | //~| WARN this was previously |
| 11 | 11 | } |
| 12 | 12 | } |
tests/ui/macros/lint-trailing-macro-call.stderr+2-2| ... | ... | @@ -1,7 +1,7 @@ |
| 1 | 1 | warning: trailing semicolon in macro used in expression position |
| 2 | 2 | --> $DIR/lint-trailing-macro-call.rs:9:25 |
| 3 | 3 | | |
| 4 | LL | #[cfg(FALSE)] 25; | |
| 4 | LL | #[cfg(false)] 25; | |
| 5 | 5 | | ^ |
| 6 | 6 | ... |
| 7 | 7 | LL | expand_it!() |
| ... | ... | @@ -20,7 +20,7 @@ Future incompatibility report: Future breakage diagnostic: |
| 20 | 20 | warning: trailing semicolon in macro used in expression position |
| 21 | 21 | --> $DIR/lint-trailing-macro-call.rs:9:25 |
| 22 | 22 | | |
| 23 | LL | #[cfg(FALSE)] 25; | |
| 23 | LL | #[cfg(false)] 25; | |
| 24 | 24 | | ^ |
| 25 | 25 | ... |
| 26 | 26 | LL | expand_it!() |
tests/ui/macros/macro-attributes.rs+1-1| ... | ... | @@ -9,7 +9,7 @@ macro_rules! compiles_fine { |
| 9 | 9 | |
| 10 | 10 | // check that the attributes are recognised by requiring this |
| 11 | 11 | // to be removed to avoid a compile error |
| 12 | #[cfg(FALSE)] | |
| 12 | #[cfg(false)] | |
| 13 | 13 | static MISTYPED: () = "foo"; |
| 14 | 14 | } |
| 15 | 15 | } |
tests/ui/macros/macro-inner-attributes.rs+1-1| ... | ... | @@ -5,7 +5,7 @@ macro_rules! test { ($nm:ident, |
| 5 | 5 | $i:item) => (mod $nm { #![$a] $i }); } |
| 6 | 6 | |
| 7 | 7 | test!(a, |
| 8 | #[cfg(FALSE)], | |
| 8 | #[cfg(false)], | |
| 9 | 9 | pub fn bar() { }); |
| 10 | 10 | |
| 11 | 11 | test!(b, |
tests/ui/macros/macro-outer-attributes.rs+1-1| ... | ... | @@ -5,7 +5,7 @@ macro_rules! test { ($nm:ident, |
| 5 | 5 | $i:item) => (mod $nm { #[$a] $i }); } |
| 6 | 6 | |
| 7 | 7 | test!(a, |
| 8 | #[cfg(FALSE)], | |
| 8 | #[cfg(false)], | |
| 9 | 9 | pub fn bar() { }); |
| 10 | 10 | |
| 11 | 11 | test!(b, |
tests/ui/macros/macro-outer-attributes.stderr+1-1| ... | ... | @@ -16,7 +16,7 @@ LL | $i:item) => (mod $nm { #[$a] $i }); } |
| 16 | 16 | | ^^^^^ |
| 17 | 17 | LL | |
| 18 | 18 | LL | / test!(a, |
| 19 | LL | | #[cfg(FALSE)], | |
| 19 | LL | | #[cfg(false)], | |
| 20 | 20 | LL | | pub fn bar() { }); |
| 21 | 21 | | |_______________________- in this macro invocation |
| 22 | 22 | = 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 @@ |
| 1 | 1 | //@ run-pass |
| 2 | 2 | |
| 3 | #[cfg(FALSE)] | |
| 3 | #[cfg(false)] | |
| 4 | 4 | macro_rules! foo { () => (1) } |
| 5 | 5 | |
| 6 | 6 | #[cfg(not(FALSE))] |
tests/ui/macros/rfc-2011-nicer-assert-messages/non-consuming-methods-have-optimized-codegen.rs+1| ... | ... | @@ -1,5 +1,6 @@ |
| 1 | 1 | //@ check-pass |
| 2 | 2 | //@ compile-flags: -Z unpretty=expanded |
| 3 | //@ edition: 2015 | |
| 3 | 4 | |
| 4 | 5 | #![feature(core_intrinsics, generic_assert)] |
| 5 | 6 |
tests/ui/macros/rfc-2011-nicer-assert-messages/non-consuming-methods-have-optimized-codegen.stdout+1| ... | ... | @@ -2,6 +2,7 @@ |
| 2 | 2 | #![no_std] |
| 3 | 3 | //@ check-pass |
| 4 | 4 | //@ compile-flags: -Z unpretty=expanded |
| 5 | //@ edition: 2015 | |
| 5 | 6 | |
| 6 | 7 | #![feature(core_intrinsics, generic_assert)] |
| 7 | 8 | #[prelude_import] |
tests/ui/match/issue-82392.rs+1| ... | ... | @@ -1,6 +1,7 @@ |
| 1 | 1 | // https://github.com/rust-lang/rust/issues/82329 |
| 2 | 2 | //@ compile-flags: -Zunpretty=hir,typed |
| 3 | 3 | //@ check-pass |
| 4 | //@ edition:2015 | |
| 4 | 5 | |
| 5 | 6 | pub fn main() { |
| 6 | 7 | if true { |
tests/ui/match/issue-82392.stdout+1| ... | ... | @@ -5,6 +5,7 @@ extern crate std; |
| 5 | 5 | // https://github.com/rust-lang/rust/issues/82329 |
| 6 | 6 | //@ compile-flags: -Zunpretty=hir,typed |
| 7 | 7 | //@ check-pass |
| 8 | //@ edition:2015 | |
| 8 | 9 | |
| 9 | 10 | fn main() ({ |
| 10 | 11 | (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)))] | |
| 2 | 2 | fn f() {} |
| 3 | 3 | |
| 4 | 4 | fn 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() {} |
| 9 | 9 | enum E { A, B } |
| 10 | 10 | use E::*; |
| 11 | 11 | |
| 12 | #[cfg(FALSE)] | |
| 12 | #[cfg(false)] | |
| 13 | 13 | fn 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() {} |
| 9 | 9 | enum E { A, B } |
| 10 | 10 | use E::*; |
| 11 | 11 | |
| 12 | #[cfg(FALSE)] | |
| 12 | #[cfg(false)] | |
| 13 | 13 | fn 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]); |
| 18 | 18 | |
| 19 | 19 | // Non-macro tests: |
| 20 | 20 | |
| 21 | #[cfg(FALSE)] | |
| 21 | #[cfg(false)] | |
| 22 | 22 | fn or_patterns() { |
| 23 | 23 | // Top level of `let`: |
| 24 | 24 | let (| A | B); |
tests/ui/or-patterns/remove-leading-vert.fixed+2-2| ... | ... | @@ -6,7 +6,7 @@ |
| 6 | 6 | |
| 7 | 7 | fn main() {} |
| 8 | 8 | |
| 9 | #[cfg(FALSE)] | |
| 9 | #[cfg(false)] | |
| 10 | 10 | fn leading() { |
| 11 | 11 | fn fun1( A: E) {} //~ ERROR top-level or-patterns are not allowed |
| 12 | 12 | fn fun2( A: E) {} //~ ERROR unexpected `||` before function parameter |
| ... | ... | @@ -21,7 +21,7 @@ fn leading() { |
| 21 | 21 | let NS { f: | A }: NS; //~ ERROR unexpected token `||` in pattern |
| 22 | 22 | } |
| 23 | 23 | |
| 24 | #[cfg(FALSE)] | |
| 24 | #[cfg(false)] | |
| 25 | 25 | fn trailing() { |
| 26 | 26 | let ( A ): E; //~ ERROR a trailing `|` is not allowed in an or-pattern |
| 27 | 27 | 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 @@ |
| 6 | 6 | |
| 7 | 7 | fn main() {} |
| 8 | 8 | |
| 9 | #[cfg(FALSE)] | |
| 9 | #[cfg(false)] | |
| 10 | 10 | fn leading() { |
| 11 | 11 | fn fun1( | A: E) {} //~ ERROR top-level or-patterns are not allowed |
| 12 | 12 | fn fun2( || A: E) {} //~ ERROR unexpected `||` before function parameter |
| ... | ... | @@ -21,7 +21,7 @@ fn leading() { |
| 21 | 21 | let NS { f: || A }: NS; //~ ERROR unexpected token `||` in pattern |
| 22 | 22 | } |
| 23 | 23 | |
| 24 | #[cfg(FALSE)] | |
| 24 | #[cfg(false)] | |
| 25 | 25 | fn trailing() { |
| 26 | 26 | let ( A | ): E; //~ ERROR a trailing `|` is not allowed in an or-pattern |
| 27 | 27 | 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 @@ |
| 4 | 4 | |
| 5 | 5 | fn main() {} |
| 6 | 6 | |
| 7 | #[cfg(FALSE)] | |
| 7 | #[cfg(false)] | |
| 8 | 8 | const _: () = { |
| 9 | 9 | pub trait A { |
| 10 | 10 | const _: () = (); |
tests/ui/parser/assoc/assoc-static-syntactic-fail.rs+3-3| ... | ... | @@ -2,7 +2,7 @@ |
| 2 | 2 | |
| 3 | 3 | fn main() {} |
| 4 | 4 | |
| 5 | #[cfg(FALSE)] | |
| 5 | #[cfg(false)] | |
| 6 | 6 | impl S { |
| 7 | 7 | static IA: u8 = 0; //~ ERROR associated `static` items are not allowed |
| 8 | 8 | static IB: u8; //~ ERROR associated `static` items are not allowed |
| ... | ... | @@ -12,7 +12,7 @@ impl S { |
| 12 | 12 | //~^ ERROR a static item cannot be `default` |
| 13 | 13 | } |
| 14 | 14 | |
| 15 | #[cfg(FALSE)] | |
| 15 | #[cfg(false)] | |
| 16 | 16 | trait T { |
| 17 | 17 | static TA: u8 = 0; //~ ERROR associated `static` items are not allowed |
| 18 | 18 | static TB: u8; //~ ERROR associated `static` items are not allowed |
| ... | ... | @@ -22,7 +22,7 @@ trait T { |
| 22 | 22 | //~^ ERROR a static item cannot be `default` |
| 23 | 23 | } |
| 24 | 24 | |
| 25 | #[cfg(FALSE)] | |
| 25 | #[cfg(false)] | |
| 26 | 26 | impl T for S { |
| 27 | 27 | static TA: u8 = 0; //~ ERROR associated `static` items are not allowed |
| 28 | 28 | 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 @@ |
| 1 | 1 | fn main() {} |
| 2 | 2 | |
| 3 | #[cfg(FALSE)] fn e() { let _ = [#[attr]]; } | |
| 3 | #[cfg(false)] fn e() { let _ = [#[attr]]; } | |
| 4 | 4 | //~^ ERROR expected expression, found `]` |
| 5 | #[cfg(FALSE)] fn e() { let _ = foo#[attr](); } | |
| 5 | #[cfg(false)] fn e() { let _ = foo#[attr](); } | |
| 6 | 6 | //~^ ERROR expected one of |
| 7 | #[cfg(FALSE)] fn e() { let _ = foo(#![attr]); } | |
| 7 | #[cfg(false)] fn e() { let _ = foo(#![attr]); } | |
| 8 | 8 | //~^ ERROR an inner attribute is not permitted in this context |
| 9 | 9 | //~| ERROR an inner attribute is not permitted in this context |
| 10 | 10 | //~| ERROR expected expression, found `)` |
| 11 | #[cfg(FALSE)] fn e() { let _ = x.foo(#![attr]); } | |
| 11 | #[cfg(false)] fn e() { let _ = x.foo(#![attr]); } | |
| 12 | 12 | //~^ ERROR an inner attribute is not permitted in this context |
| 13 | 13 | //~| ERROR expected expression, found `)` |
| 14 | #[cfg(FALSE)] fn e() { let _ = 0 + #![attr] 0; } | |
| 14 | #[cfg(false)] fn e() { let _ = 0 + #![attr] 0; } | |
| 15 | 15 | //~^ 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; } | |
| 17 | 17 | //~^ 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; } | |
| 19 | 19 | //~^ 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; } | |
| 21 | 21 | //~^ ERROR expected one of |
| 22 | #[cfg(FALSE)] fn e() { let _ = || #![attr] foo; } | |
| 22 | #[cfg(false)] fn e() { let _ = || #![attr] foo; } | |
| 23 | 23 | //~^ 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; } | |
| 25 | 25 | //~^ 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}; } | |
| 27 | 27 | //~^ 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}; } | |
| 29 | 29 | //~^ 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; } | |
| 31 | 31 | //~^ ERROR attributes are not allowed on range expressions starting with `..` |
| 32 | #[cfg(FALSE)] fn e() { let _ = #[attr] ..; } | |
| 32 | #[cfg(false)] fn e() { let _ = #[attr] ..; } | |
| 33 | 33 | //~^ 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; } | |
| 35 | 35 | //~^ 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; } | |
| 37 | 37 | //~^ 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] {}; } | |
| 39 | 39 | //~^ 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]}; } | |
| 41 | 41 | //~^ 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 {}; } | |
| 43 | 43 | //~^ ERROR expected one of |
| 44 | #[cfg(FALSE)] fn e() { let _ = if 0 {} else #[attr] {}; } | |
| 44 | #[cfg(false)] fn e() { let _ = if 0 {} else #[attr] {}; } | |
| 45 | 45 | //~^ 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]}; } | |
| 47 | 47 | //~^ 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 {}; } | |
| 49 | 49 | //~^ 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] {}; } | |
| 51 | 51 | //~^ 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]}; } | |
| 53 | 53 | //~^ 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] {}; } | |
| 55 | 55 | //~^ 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]}; } | |
| 57 | 57 | //~^ 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 {}; } | |
| 59 | 59 | //~^ 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] {}; } | |
| 61 | 61 | //~^ 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]}; } | |
| 63 | 63 | //~^ 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 {}; } | |
| 65 | 65 | //~^ 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] {}; } | |
| 67 | 67 | //~^ 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]}; } | |
| 69 | 69 | //~^ ERROR an inner attribute is not permitted in this context |
| 70 | 70 | |
| 71 | #[cfg(FALSE)] fn s() { #[attr] #![attr] let _ = 0; } | |
| 71 | #[cfg(false)] fn s() { #[attr] #![attr] let _ = 0; } | |
| 72 | 72 | //~^ 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; } | |
| 74 | 74 | //~^ 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!(); } | |
| 76 | 76 | //~^ 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![]; } | |
| 78 | 78 | //~^ 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!{}; } | |
| 80 | 80 | //~^ ERROR an inner attribute is not permitted following an outer attribute |
| 81 | 81 | |
| 82 | 82 | // FIXME: Allow attributes in pattern constexprs? |
| 83 | 83 | // note: requires parens in patterns to allow disambiguation |
| 84 | 84 | |
| 85 | #[cfg(FALSE)] fn e() { match 0 { 0..=#[attr] 10 => () } } | |
| 85 | #[cfg(false)] fn e() { match 0 { 0..=#[attr] 10 => () } } | |
| 86 | 86 | //~^ ERROR inclusive range with no end |
| 87 | 87 | //~| 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 => () } } | |
| 89 | 89 | //~^ ERROR inclusive range with no end |
| 90 | 90 | //~| 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 => () } } | |
| 92 | 92 | //~^ ERROR unexpected token: `#` |
| 93 | #[cfg(FALSE)] fn e() { match 0 { 0..=#[attr] FOO => () } } | |
| 93 | #[cfg(false)] fn e() { match 0 { 0..=#[attr] FOO => () } } | |
| 94 | 94 | //~^ ERROR inclusive range with no end |
| 95 | 95 | //~| ERROR expected one of `=>`, `if`, or `|`, found `#` |
| 96 | 96 | |
| 97 | #[cfg(FALSE)] fn e() { let _ = x.#![attr]foo(); } | |
| 97 | #[cfg(false)] fn e() { let _ = x.#![attr]foo(); } | |
| 98 | 98 | //~^ ERROR unexpected token: `#` |
| 99 | 99 | //~| ERROR expected one of `.` |
| 100 | #[cfg(FALSE)] fn e() { let _ = x.#[attr]foo(); } | |
| 100 | #[cfg(false)] fn e() { let _ = x.#[attr]foo(); } | |
| 101 | 101 | //~^ ERROR unexpected token: `#` |
| 102 | 102 | //~| ERROR expected one of `.` |
| 103 | 103 | |
| 104 | 104 | // 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]; } } } | |
| 106 | 106 | //~^ ERROR expected statement after outer attribute |
| 107 | #[cfg(FALSE)] fn e() { { fn foo() { #[attr] } } } | |
| 107 | #[cfg(false)] fn e() { { fn foo() { #[attr] } } } | |
| 108 | 108 | //~^ ERROR expected statement after outer attribute |
tests/ui/parser/attribute/attr-stmt-expr-attr-bad.stderr+75-75| ... | ... | @@ -1,19 +1,19 @@ |
| 1 | 1 | error: expected expression, found `]` |
| 2 | 2 | --> $DIR/attr-stmt-expr-attr-bad.rs:3:40 |
| 3 | 3 | | |
| 4 | LL | #[cfg(FALSE)] fn e() { let _ = [#[attr]]; } | |
| 4 | LL | #[cfg(false)] fn e() { let _ = [#[attr]]; } | |
| 5 | 5 | | ^ expected expression |
| 6 | 6 | |
| 7 | 7 | error: expected one of `!`, `.`, `::`, `;`, `?`, `else`, `{`, or an operator, found `#` |
| 8 | 8 | --> $DIR/attr-stmt-expr-attr-bad.rs:5:35 |
| 9 | 9 | | |
| 10 | LL | #[cfg(FALSE)] fn e() { let _ = foo#[attr](); } | |
| 10 | LL | #[cfg(false)] fn e() { let _ = foo#[attr](); } | |
| 11 | 11 | | ^ expected one of 8 possible tokens |
| 12 | 12 | |
| 13 | 13 | error: an inner attribute is not permitted in this context |
| 14 | 14 | --> $DIR/attr-stmt-expr-attr-bad.rs:7:36 |
| 15 | 15 | | |
| 16 | LL | #[cfg(FALSE)] fn e() { let _ = foo(#![attr]); } | |
| 16 | LL | #[cfg(false)] fn e() { let _ = foo(#![attr]); } | |
| 17 | 17 | | ^^^^^^^^ |
| 18 | 18 | | |
| 19 | 19 | = 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]); } |
| 22 | 22 | error: an inner attribute is not permitted in this context |
| 23 | 23 | --> $DIR/attr-stmt-expr-attr-bad.rs:7:36 |
| 24 | 24 | | |
| 25 | LL | #[cfg(FALSE)] fn e() { let _ = foo(#![attr]); } | |
| 25 | LL | #[cfg(false)] fn e() { let _ = foo(#![attr]); } | |
| 26 | 26 | | ^^^^^^^^ |
| 27 | 27 | | |
| 28 | 28 | = 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]); } |
| 32 | 32 | error: expected expression, found `)` |
| 33 | 33 | --> $DIR/attr-stmt-expr-attr-bad.rs:7:44 |
| 34 | 34 | | |
| 35 | LL | #[cfg(FALSE)] fn e() { let _ = foo(#![attr]); } | |
| 35 | LL | #[cfg(false)] fn e() { let _ = foo(#![attr]); } | |
| 36 | 36 | | ^ expected expression |
| 37 | 37 | |
| 38 | 38 | error: an inner attribute is not permitted in this context |
| 39 | 39 | --> $DIR/attr-stmt-expr-attr-bad.rs:11:38 |
| 40 | 40 | | |
| 41 | LL | #[cfg(FALSE)] fn e() { let _ = x.foo(#![attr]); } | |
| 41 | LL | #[cfg(false)] fn e() { let _ = x.foo(#![attr]); } | |
| 42 | 42 | | ^^^^^^^^ |
| 43 | 43 | | |
| 44 | 44 | = 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]); } |
| 47 | 47 | error: expected expression, found `)` |
| 48 | 48 | --> $DIR/attr-stmt-expr-attr-bad.rs:11:46 |
| 49 | 49 | | |
| 50 | LL | #[cfg(FALSE)] fn e() { let _ = x.foo(#![attr]); } | |
| 50 | LL | #[cfg(false)] fn e() { let _ = x.foo(#![attr]); } | |
| 51 | 51 | | ^ expected expression |
| 52 | 52 | |
| 53 | 53 | error: an inner attribute is not permitted in this context |
| 54 | 54 | --> $DIR/attr-stmt-expr-attr-bad.rs:14:36 |
| 55 | 55 | | |
| 56 | LL | #[cfg(FALSE)] fn e() { let _ = 0 + #![attr] 0; } | |
| 56 | LL | #[cfg(false)] fn e() { let _ = 0 + #![attr] 0; } | |
| 57 | 57 | | ^^^^^^^^ |
| 58 | 58 | | |
| 59 | 59 | = 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; } |
| 62 | 62 | error: an inner attribute is not permitted in this context |
| 63 | 63 | --> $DIR/attr-stmt-expr-attr-bad.rs:16:33 |
| 64 | 64 | | |
| 65 | LL | #[cfg(FALSE)] fn e() { let _ = !#![attr] 0; } | |
| 65 | LL | #[cfg(false)] fn e() { let _ = !#![attr] 0; } | |
| 66 | 66 | | ^^^^^^^^ |
| 67 | 67 | | |
| 68 | 68 | = 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; } |
| 71 | 71 | error: an inner attribute is not permitted in this context |
| 72 | 72 | --> $DIR/attr-stmt-expr-attr-bad.rs:18:33 |
| 73 | 73 | | |
| 74 | LL | #[cfg(FALSE)] fn e() { let _ = -#![attr] 0; } | |
| 74 | LL | #[cfg(false)] fn e() { let _ = -#![attr] 0; } | |
| 75 | 75 | | ^^^^^^^^ |
| 76 | 76 | | |
| 77 | 77 | = 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; } |
| 80 | 80 | error: expected one of `!`, `.`, `::`, `;`, `?`, `else`, `{`, or an operator, found `#` |
| 81 | 81 | --> $DIR/attr-stmt-expr-attr-bad.rs:20:34 |
| 82 | 82 | | |
| 83 | LL | #[cfg(FALSE)] fn e() { let _ = x #![attr] as Y; } | |
| 83 | LL | #[cfg(false)] fn e() { let _ = x #![attr] as Y; } | |
| 84 | 84 | | ^ expected one of 8 possible tokens |
| 85 | 85 | |
| 86 | 86 | error: an inner attribute is not permitted in this context |
| 87 | 87 | --> $DIR/attr-stmt-expr-attr-bad.rs:22:35 |
| 88 | 88 | | |
| 89 | LL | #[cfg(FALSE)] fn e() { let _ = || #![attr] foo; } | |
| 89 | LL | #[cfg(false)] fn e() { let _ = || #![attr] foo; } | |
| 90 | 90 | | ^^^^^^^^ |
| 91 | 91 | | |
| 92 | 92 | = 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; } |
| 95 | 95 | error: an inner attribute is not permitted in this context |
| 96 | 96 | --> $DIR/attr-stmt-expr-attr-bad.rs:24:40 |
| 97 | 97 | | |
| 98 | LL | #[cfg(FALSE)] fn e() { let _ = move || #![attr] foo; } | |
| 98 | LL | #[cfg(false)] fn e() { let _ = move || #![attr] foo; } | |
| 99 | 99 | | ^^^^^^^^ |
| 100 | 100 | | |
| 101 | 101 | = 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; } |
| 104 | 104 | error: an inner attribute is not permitted in this context |
| 105 | 105 | --> $DIR/attr-stmt-expr-attr-bad.rs:26:35 |
| 106 | 106 | | |
| 107 | LL | #[cfg(FALSE)] fn e() { let _ = || #![attr] {foo}; } | |
| 107 | LL | #[cfg(false)] fn e() { let _ = || #![attr] {foo}; } | |
| 108 | 108 | | ^^^^^^^^ |
| 109 | 109 | | |
| 110 | 110 | = 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}; } |
| 113 | 113 | error: an inner attribute is not permitted in this context |
| 114 | 114 | --> $DIR/attr-stmt-expr-attr-bad.rs:28:40 |
| 115 | 115 | | |
| 116 | LL | #[cfg(FALSE)] fn e() { let _ = move || #![attr] {foo}; } | |
| 116 | LL | #[cfg(false)] fn e() { let _ = move || #![attr] {foo}; } | |
| 117 | 117 | | ^^^^^^^^ |
| 118 | 118 | | |
| 119 | 119 | = 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}; } |
| 122 | 122 | error: attributes are not allowed on range expressions starting with `..` |
| 123 | 123 | --> $DIR/attr-stmt-expr-attr-bad.rs:30:40 |
| 124 | 124 | | |
| 125 | LL | #[cfg(FALSE)] fn e() { let _ = #[attr] ..#[attr] 0; } | |
| 125 | LL | #[cfg(false)] fn e() { let _ = #[attr] ..#[attr] 0; } | |
| 126 | 126 | | ^^ |
| 127 | 127 | |
| 128 | 128 | error: attributes are not allowed on range expressions starting with `..` |
| 129 | 129 | --> $DIR/attr-stmt-expr-attr-bad.rs:32:40 |
| 130 | 130 | | |
| 131 | LL | #[cfg(FALSE)] fn e() { let _ = #[attr] ..; } | |
| 131 | LL | #[cfg(false)] fn e() { let _ = #[attr] ..; } | |
| 132 | 132 | | ^^ |
| 133 | 133 | |
| 134 | 134 | error: an inner attribute is not permitted in this context |
| 135 | 135 | --> $DIR/attr-stmt-expr-attr-bad.rs:34:41 |
| 136 | 136 | | |
| 137 | LL | #[cfg(FALSE)] fn e() { let _ = #[attr] &#![attr] 0; } | |
| 137 | LL | #[cfg(false)] fn e() { let _ = #[attr] &#![attr] 0; } | |
| 138 | 138 | | ^^^^^^^^ |
| 139 | 139 | | |
| 140 | 140 | = 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; } |
| 143 | 143 | error: an inner attribute is not permitted in this context |
| 144 | 144 | --> $DIR/attr-stmt-expr-attr-bad.rs:36:45 |
| 145 | 145 | | |
| 146 | LL | #[cfg(FALSE)] fn e() { let _ = #[attr] &mut #![attr] 0; } | |
| 146 | LL | #[cfg(false)] fn e() { let _ = #[attr] &mut #![attr] 0; } | |
| 147 | 147 | | ^^^^^^^^ |
| 148 | 148 | | |
| 149 | 149 | = 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; } |
| 152 | 152 | error: outer attributes are not allowed on `if` and `else` branches |
| 153 | 153 | --> $DIR/attr-stmt-expr-attr-bad.rs:38:37 |
| 154 | 154 | | |
| 155 | LL | #[cfg(FALSE)] fn e() { let _ = if 0 #[attr] {}; } | |
| 155 | LL | #[cfg(false)] fn e() { let _ = if 0 #[attr] {}; } | |
| 156 | 156 | | -- ^^^^^^^ -- the attributes are attached to this branch |
| 157 | 157 | | | |
| 158 | 158 | | the branch belongs to this `if` |
| 159 | 159 | | |
| 160 | 160 | help: remove the attributes |
| 161 | 161 | | |
| 162 | LL - #[cfg(FALSE)] fn e() { let _ = if 0 #[attr] {}; } | |
| 163 | LL + #[cfg(FALSE)] fn e() { let _ = if 0 {}; } | |
| 162 | LL - #[cfg(false)] fn e() { let _ = if 0 #[attr] {}; } | |
| 163 | LL + #[cfg(false)] fn e() { let _ = if 0 {}; } | |
| 164 | 164 | | |
| 165 | 165 | |
| 166 | 166 | error: an inner attribute is not permitted in this context |
| 167 | 167 | --> $DIR/attr-stmt-expr-attr-bad.rs:40:38 |
| 168 | 168 | | |
| 169 | LL | #[cfg(FALSE)] fn e() { let _ = if 0 {#![attr]}; } | |
| 169 | LL | #[cfg(false)] fn e() { let _ = if 0 {#![attr]}; } | |
| 170 | 170 | | ^^^^^^^^ |
| 171 | 171 | | |
| 172 | 172 | = 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]}; } |
| 175 | 175 | error: expected one of `.`, `;`, `?`, `else`, or an operator, found `#` |
| 176 | 176 | --> $DIR/attr-stmt-expr-attr-bad.rs:42:40 |
| 177 | 177 | | |
| 178 | LL | #[cfg(FALSE)] fn e() { let _ = if 0 {} #[attr] else {}; } | |
| 178 | LL | #[cfg(false)] fn e() { let _ = if 0 {} #[attr] else {}; } | |
| 179 | 179 | | ^ expected one of `.`, `;`, `?`, `else`, or an operator |
| 180 | 180 | |
| 181 | 181 | error: outer attributes are not allowed on `if` and `else` branches |
| 182 | 182 | --> $DIR/attr-stmt-expr-attr-bad.rs:44:45 |
| 183 | 183 | | |
| 184 | LL | #[cfg(FALSE)] fn e() { let _ = if 0 {} else #[attr] {}; } | |
| 184 | LL | #[cfg(false)] fn e() { let _ = if 0 {} else #[attr] {}; } | |
| 185 | 185 | | ---- ^^^^^^^ -- the attributes are attached to this branch |
| 186 | 186 | | | |
| 187 | 187 | | the branch belongs to this `else` |
| 188 | 188 | | |
| 189 | 189 | help: remove the attributes |
| 190 | 190 | | |
| 191 | LL - #[cfg(FALSE)] fn e() { let _ = if 0 {} else #[attr] {}; } | |
| 192 | LL + #[cfg(FALSE)] fn e() { let _ = if 0 {} else {}; } | |
| 191 | LL - #[cfg(false)] fn e() { let _ = if 0 {} else #[attr] {}; } | |
| 192 | LL + #[cfg(false)] fn e() { let _ = if 0 {} else {}; } | |
| 193 | 193 | | |
| 194 | 194 | |
| 195 | 195 | error: an inner attribute is not permitted in this context |
| 196 | 196 | --> $DIR/attr-stmt-expr-attr-bad.rs:46:46 |
| 197 | 197 | | |
| 198 | LL | #[cfg(FALSE)] fn e() { let _ = if 0 {} else {#![attr]}; } | |
| 198 | LL | #[cfg(false)] fn e() { let _ = if 0 {} else {#![attr]}; } | |
| 199 | 199 | | ^^^^^^^^ |
| 200 | 200 | | |
| 201 | 201 | = 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]}; } |
| 204 | 204 | error: outer attributes are not allowed on `if` and `else` branches |
| 205 | 205 | --> $DIR/attr-stmt-expr-attr-bad.rs:48:45 |
| 206 | 206 | | |
| 207 | LL | #[cfg(FALSE)] fn e() { let _ = if 0 {} else #[attr] if 0 {}; } | |
| 207 | LL | #[cfg(false)] fn e() { let _ = if 0 {} else #[attr] if 0 {}; } | |
| 208 | 208 | | ---- ^^^^^^^ ------- the attributes are attached to this branch |
| 209 | 209 | | | |
| 210 | 210 | | the branch belongs to this `else` |
| 211 | 211 | | |
| 212 | 212 | help: remove the attributes |
| 213 | 213 | | |
| 214 | LL - #[cfg(FALSE)] fn e() { let _ = if 0 {} else #[attr] if 0 {}; } | |
| 215 | LL + #[cfg(FALSE)] fn e() { let _ = if 0 {} else if 0 {}; } | |
| 214 | LL - #[cfg(false)] fn e() { let _ = if 0 {} else #[attr] if 0 {}; } | |
| 215 | LL + #[cfg(false)] fn e() { let _ = if 0 {} else if 0 {}; } | |
| 216 | 216 | | |
| 217 | 217 | |
| 218 | 218 | error: outer attributes are not allowed on `if` and `else` branches |
| 219 | 219 | --> $DIR/attr-stmt-expr-attr-bad.rs:50:50 |
| 220 | 220 | | |
| 221 | LL | #[cfg(FALSE)] fn e() { let _ = if 0 {} else if 0 #[attr] {}; } | |
| 221 | LL | #[cfg(false)] fn e() { let _ = if 0 {} else if 0 #[attr] {}; } | |
| 222 | 222 | | -- ^^^^^^^ -- the attributes are attached to this branch |
| 223 | 223 | | | |
| 224 | 224 | | the branch belongs to this `if` |
| 225 | 225 | | |
| 226 | 226 | help: remove the attributes |
| 227 | 227 | | |
| 228 | LL - #[cfg(FALSE)] fn e() { let _ = if 0 {} else if 0 #[attr] {}; } | |
| 229 | LL + #[cfg(FALSE)] fn e() { let _ = if 0 {} else if 0 {}; } | |
| 228 | LL - #[cfg(false)] fn e() { let _ = if 0 {} else if 0 #[attr] {}; } | |
| 229 | LL + #[cfg(false)] fn e() { let _ = if 0 {} else if 0 {}; } | |
| 230 | 230 | | |
| 231 | 231 | |
| 232 | 232 | error: an inner attribute is not permitted in this context |
| 233 | 233 | --> $DIR/attr-stmt-expr-attr-bad.rs:52:51 |
| 234 | 234 | | |
| 235 | LL | #[cfg(FALSE)] fn e() { let _ = if 0 {} else if 0 {#![attr]}; } | |
| 235 | LL | #[cfg(false)] fn e() { let _ = if 0 {} else if 0 {#![attr]}; } | |
| 236 | 236 | | ^^^^^^^^ |
| 237 | 237 | | |
| 238 | 238 | = 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]}; } |
| 241 | 241 | error: outer attributes are not allowed on `if` and `else` branches |
| 242 | 242 | --> $DIR/attr-stmt-expr-attr-bad.rs:54:45 |
| 243 | 243 | | |
| 244 | LL | #[cfg(FALSE)] fn e() { let _ = if let _ = 0 #[attr] {}; } | |
| 244 | LL | #[cfg(false)] fn e() { let _ = if let _ = 0 #[attr] {}; } | |
| 245 | 245 | | -- ^^^^^^^ -- the attributes are attached to this branch |
| 246 | 246 | | | |
| 247 | 247 | | the branch belongs to this `if` |
| 248 | 248 | | |
| 249 | 249 | help: remove the attributes |
| 250 | 250 | | |
| 251 | LL - #[cfg(FALSE)] fn e() { let _ = if let _ = 0 #[attr] {}; } | |
| 252 | LL + #[cfg(FALSE)] fn e() { let _ = if let _ = 0 {}; } | |
| 251 | LL - #[cfg(false)] fn e() { let _ = if let _ = 0 #[attr] {}; } | |
| 252 | LL + #[cfg(false)] fn e() { let _ = if let _ = 0 {}; } | |
| 253 | 253 | | |
| 254 | 254 | |
| 255 | 255 | error: an inner attribute is not permitted in this context |
| 256 | 256 | --> $DIR/attr-stmt-expr-attr-bad.rs:56:46 |
| 257 | 257 | | |
| 258 | LL | #[cfg(FALSE)] fn e() { let _ = if let _ = 0 {#![attr]}; } | |
| 258 | LL | #[cfg(false)] fn e() { let _ = if let _ = 0 {#![attr]}; } | |
| 259 | 259 | | ^^^^^^^^ |
| 260 | 260 | | |
| 261 | 261 | = 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]}; } |
| 264 | 264 | error: expected one of `.`, `;`, `?`, `else`, or an operator, found `#` |
| 265 | 265 | --> $DIR/attr-stmt-expr-attr-bad.rs:58:48 |
| 266 | 266 | | |
| 267 | LL | #[cfg(FALSE)] fn e() { let _ = if let _ = 0 {} #[attr] else {}; } | |
| 267 | LL | #[cfg(false)] fn e() { let _ = if let _ = 0 {} #[attr] else {}; } | |
| 268 | 268 | | ^ expected one of `.`, `;`, `?`, `else`, or an operator |
| 269 | 269 | |
| 270 | 270 | error: outer attributes are not allowed on `if` and `else` branches |
| 271 | 271 | --> $DIR/attr-stmt-expr-attr-bad.rs:60:53 |
| 272 | 272 | | |
| 273 | LL | #[cfg(FALSE)] fn e() { let _ = if let _ = 0 {} else #[attr] {}; } | |
| 273 | LL | #[cfg(false)] fn e() { let _ = if let _ = 0 {} else #[attr] {}; } | |
| 274 | 274 | | ---- ^^^^^^^ -- the attributes are attached to this branch |
| 275 | 275 | | | |
| 276 | 276 | | the branch belongs to this `else` |
| 277 | 277 | | |
| 278 | 278 | help: remove the attributes |
| 279 | 279 | | |
| 280 | LL - #[cfg(FALSE)] fn e() { let _ = if let _ = 0 {} else #[attr] {}; } | |
| 281 | LL + #[cfg(FALSE)] fn e() { let _ = if let _ = 0 {} else {}; } | |
| 280 | LL - #[cfg(false)] fn e() { let _ = if let _ = 0 {} else #[attr] {}; } | |
| 281 | LL + #[cfg(false)] fn e() { let _ = if let _ = 0 {} else {}; } | |
| 282 | 282 | | |
| 283 | 283 | |
| 284 | 284 | error: an inner attribute is not permitted in this context |
| 285 | 285 | --> $DIR/attr-stmt-expr-attr-bad.rs:62:54 |
| 286 | 286 | | |
| 287 | LL | #[cfg(FALSE)] fn e() { let _ = if let _ = 0 {} else {#![attr]}; } | |
| 287 | LL | #[cfg(false)] fn e() { let _ = if let _ = 0 {} else {#![attr]}; } | |
| 288 | 288 | | ^^^^^^^^ |
| 289 | 289 | | |
| 290 | 290 | = 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]}; } |
| 293 | 293 | error: outer attributes are not allowed on `if` and `else` branches |
| 294 | 294 | --> $DIR/attr-stmt-expr-attr-bad.rs:64:53 |
| 295 | 295 | | |
| 296 | LL | #[cfg(FALSE)] fn e() { let _ = if let _ = 0 {} else #[attr] if let _ = 0 {}; } | |
| 296 | LL | #[cfg(false)] fn e() { let _ = if let _ = 0 {} else #[attr] if let _ = 0 {}; } | |
| 297 | 297 | | ---- ^^^^^^^ --------------- the attributes are attached to this branch |
| 298 | 298 | | | |
| 299 | 299 | | the branch belongs to this `else` |
| 300 | 300 | | |
| 301 | 301 | help: remove the attributes |
| 302 | 302 | | |
| 303 | LL - #[cfg(FALSE)] fn e() { let _ = if let _ = 0 {} else #[attr] if let _ = 0 {}; } | |
| 304 | LL + #[cfg(FALSE)] fn e() { let _ = if let _ = 0 {} else if let _ = 0 {}; } | |
| 303 | LL - #[cfg(false)] fn e() { let _ = if let _ = 0 {} else #[attr] if let _ = 0 {}; } | |
| 304 | LL + #[cfg(false)] fn e() { let _ = if let _ = 0 {} else if let _ = 0 {}; } | |
| 305 | 305 | | |
| 306 | 306 | |
| 307 | 307 | error: outer attributes are not allowed on `if` and `else` branches |
| 308 | 308 | --> $DIR/attr-stmt-expr-attr-bad.rs:66:66 |
| 309 | 309 | | |
| 310 | LL | #[cfg(FALSE)] fn e() { let _ = if let _ = 0 {} else if let _ = 0 #[attr] {}; } | |
| 310 | LL | #[cfg(false)] fn e() { let _ = if let _ = 0 {} else if let _ = 0 #[attr] {}; } | |
| 311 | 311 | | -- ^^^^^^^ -- the attributes are attached to this branch |
| 312 | 312 | | | |
| 313 | 313 | | the branch belongs to this `if` |
| 314 | 314 | | |
| 315 | 315 | help: remove the attributes |
| 316 | 316 | | |
| 317 | LL - #[cfg(FALSE)] fn e() { let _ = if let _ = 0 {} else if let _ = 0 #[attr] {}; } | |
| 318 | LL + #[cfg(FALSE)] fn e() { let _ = if let _ = 0 {} else if let _ = 0 {}; } | |
| 317 | LL - #[cfg(false)] fn e() { let _ = if let _ = 0 {} else if let _ = 0 #[attr] {}; } | |
| 318 | LL + #[cfg(false)] fn e() { let _ = if let _ = 0 {} else if let _ = 0 {}; } | |
| 319 | 319 | | |
| 320 | 320 | |
| 321 | 321 | error: an inner attribute is not permitted in this context |
| 322 | 322 | --> $DIR/attr-stmt-expr-attr-bad.rs:68:67 |
| 323 | 323 | | |
| 324 | LL | #[cfg(FALSE)] fn e() { let _ = if let _ = 0 {} else if let _ = 0 {#![attr]}; } | |
| 324 | LL | #[cfg(false)] fn e() { let _ = if let _ = 0 {} else if let _ = 0 {#![attr]}; } | |
| 325 | 325 | | ^^^^^^^^ |
| 326 | 326 | | |
| 327 | 327 | = 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]} |
| 330 | 330 | error: an inner attribute is not permitted following an outer attribute |
| 331 | 331 | --> $DIR/attr-stmt-expr-attr-bad.rs:71:32 |
| 332 | 332 | | |
| 333 | LL | #[cfg(FALSE)] fn s() { #[attr] #![attr] let _ = 0; } | |
| 333 | LL | #[cfg(false)] fn s() { #[attr] #![attr] let _ = 0; } | |
| 334 | 334 | | ------- ^^^^^^^^ not permitted following an outer attribute |
| 335 | 335 | | | |
| 336 | 336 | | previous outer attribute |
| ... | ... | @@ -341,7 +341,7 @@ LL | #[cfg(FALSE)] fn s() { #[attr] #![attr] let _ = 0; } |
| 341 | 341 | error: an inner attribute is not permitted following an outer attribute |
| 342 | 342 | --> $DIR/attr-stmt-expr-attr-bad.rs:73:32 |
| 343 | 343 | | |
| 344 | LL | #[cfg(FALSE)] fn s() { #[attr] #![attr] 0; } | |
| 344 | LL | #[cfg(false)] fn s() { #[attr] #![attr] 0; } | |
| 345 | 345 | | ------- ^^^^^^^^ not permitted following an outer attribute |
| 346 | 346 | | | |
| 347 | 347 | | previous outer attribute |
| ... | ... | @@ -352,7 +352,7 @@ LL | #[cfg(FALSE)] fn s() { #[attr] #![attr] 0; } |
| 352 | 352 | error: an inner attribute is not permitted following an outer attribute |
| 353 | 353 | --> $DIR/attr-stmt-expr-attr-bad.rs:75:32 |
| 354 | 354 | | |
| 355 | LL | #[cfg(FALSE)] fn s() { #[attr] #![attr] foo!(); } | |
| 355 | LL | #[cfg(false)] fn s() { #[attr] #![attr] foo!(); } | |
| 356 | 356 | | ------- ^^^^^^^^ ------- the inner attribute doesn't annotate this item macro invocation |
| 357 | 357 | | | | |
| 358 | 358 | | | not permitted following an outer attribute |
| ... | ... | @@ -363,7 +363,7 @@ LL | #[cfg(FALSE)] fn s() { #[attr] #![attr] foo!(); } |
| 363 | 363 | error: an inner attribute is not permitted following an outer attribute |
| 364 | 364 | --> $DIR/attr-stmt-expr-attr-bad.rs:77:32 |
| 365 | 365 | | |
| 366 | LL | #[cfg(FALSE)] fn s() { #[attr] #![attr] foo![]; } | |
| 366 | LL | #[cfg(false)] fn s() { #[attr] #![attr] foo![]; } | |
| 367 | 367 | | ------- ^^^^^^^^ ------- the inner attribute doesn't annotate this item macro invocation |
| 368 | 368 | | | | |
| 369 | 369 | | | not permitted following an outer attribute |
| ... | ... | @@ -374,7 +374,7 @@ LL | #[cfg(FALSE)] fn s() { #[attr] #![attr] foo![]; } |
| 374 | 374 | error: an inner attribute is not permitted following an outer attribute |
| 375 | 375 | --> $DIR/attr-stmt-expr-attr-bad.rs:79:32 |
| 376 | 376 | | |
| 377 | LL | #[cfg(FALSE)] fn s() { #[attr] #![attr] foo!{}; } | |
| 377 | LL | #[cfg(false)] fn s() { #[attr] #![attr] foo!{}; } | |
| 378 | 378 | | ------- ^^^^^^^^ ------ the inner attribute doesn't annotate this item macro invocation |
| 379 | 379 | | | | |
| 380 | 380 | | | not permitted following an outer attribute |
| ... | ... | @@ -385,100 +385,100 @@ LL | #[cfg(FALSE)] fn s() { #[attr] #![attr] foo!{}; } |
| 385 | 385 | error[E0586]: inclusive range with no end |
| 386 | 386 | --> $DIR/attr-stmt-expr-attr-bad.rs:85:35 |
| 387 | 387 | | |
| 388 | LL | #[cfg(FALSE)] fn e() { match 0 { 0..=#[attr] 10 => () } } | |
| 388 | LL | #[cfg(false)] fn e() { match 0 { 0..=#[attr] 10 => () } } | |
| 389 | 389 | | ^^^ |
| 390 | 390 | | |
| 391 | 391 | = note: inclusive ranges must be bounded at the end (`..=b` or `a..=b`) |
| 392 | 392 | help: use `..` instead |
| 393 | 393 | | |
| 394 | LL - #[cfg(FALSE)] fn e() { match 0 { 0..=#[attr] 10 => () } } | |
| 395 | LL + #[cfg(FALSE)] fn e() { match 0 { 0..#[attr] 10 => () } } | |
| 394 | LL - #[cfg(false)] fn e() { match 0 { 0..=#[attr] 10 => () } } | |
| 395 | LL + #[cfg(false)] fn e() { match 0 { 0..#[attr] 10 => () } } | |
| 396 | 396 | | |
| 397 | 397 | |
| 398 | 398 | error: expected one of `=>`, `if`, or `|`, found `#` |
| 399 | 399 | --> $DIR/attr-stmt-expr-attr-bad.rs:85:38 |
| 400 | 400 | | |
| 401 | LL | #[cfg(FALSE)] fn e() { match 0 { 0..=#[attr] 10 => () } } | |
| 401 | LL | #[cfg(false)] fn e() { match 0 { 0..=#[attr] 10 => () } } | |
| 402 | 402 | | ^ expected one of `=>`, `if`, or `|` |
| 403 | 403 | |
| 404 | 404 | error[E0586]: inclusive range with no end |
| 405 | 405 | --> $DIR/attr-stmt-expr-attr-bad.rs:88:35 |
| 406 | 406 | | |
| 407 | LL | #[cfg(FALSE)] fn e() { match 0 { 0..=#[attr] -10 => () } } | |
| 407 | LL | #[cfg(false)] fn e() { match 0 { 0..=#[attr] -10 => () } } | |
| 408 | 408 | | ^^^ |
| 409 | 409 | | |
| 410 | 410 | = note: inclusive ranges must be bounded at the end (`..=b` or `a..=b`) |
| 411 | 411 | help: use `..` instead |
| 412 | 412 | | |
| 413 | LL - #[cfg(FALSE)] fn e() { match 0 { 0..=#[attr] -10 => () } } | |
| 414 | LL + #[cfg(FALSE)] fn e() { match 0 { 0..#[attr] -10 => () } } | |
| 413 | LL - #[cfg(false)] fn e() { match 0 { 0..=#[attr] -10 => () } } | |
| 414 | LL + #[cfg(false)] fn e() { match 0 { 0..#[attr] -10 => () } } | |
| 415 | 415 | | |
| 416 | 416 | |
| 417 | 417 | error: expected one of `=>`, `if`, or `|`, found `#` |
| 418 | 418 | --> $DIR/attr-stmt-expr-attr-bad.rs:88:38 |
| 419 | 419 | | |
| 420 | LL | #[cfg(FALSE)] fn e() { match 0 { 0..=#[attr] -10 => () } } | |
| 420 | LL | #[cfg(false)] fn e() { match 0 { 0..=#[attr] -10 => () } } | |
| 421 | 421 | | ^ expected one of `=>`, `if`, or `|` |
| 422 | 422 | |
| 423 | 423 | error: unexpected token: `#` |
| 424 | 424 | --> $DIR/attr-stmt-expr-attr-bad.rs:91:39 |
| 425 | 425 | | |
| 426 | LL | #[cfg(FALSE)] fn e() { match 0 { 0..=-#[attr] 10 => () } } | |
| 426 | LL | #[cfg(false)] fn e() { match 0 { 0..=-#[attr] 10 => () } } | |
| 427 | 427 | | ^ |
| 428 | 428 | |
| 429 | 429 | error[E0586]: inclusive range with no end |
| 430 | 430 | --> $DIR/attr-stmt-expr-attr-bad.rs:93:35 |
| 431 | 431 | | |
| 432 | LL | #[cfg(FALSE)] fn e() { match 0 { 0..=#[attr] FOO => () } } | |
| 432 | LL | #[cfg(false)] fn e() { match 0 { 0..=#[attr] FOO => () } } | |
| 433 | 433 | | ^^^ |
| 434 | 434 | | |
| 435 | 435 | = note: inclusive ranges must be bounded at the end (`..=b` or `a..=b`) |
| 436 | 436 | help: use `..` instead |
| 437 | 437 | | |
| 438 | LL - #[cfg(FALSE)] fn e() { match 0 { 0..=#[attr] FOO => () } } | |
| 439 | LL + #[cfg(FALSE)] fn e() { match 0 { 0..#[attr] FOO => () } } | |
| 438 | LL - #[cfg(false)] fn e() { match 0 { 0..=#[attr] FOO => () } } | |
| 439 | LL + #[cfg(false)] fn e() { match 0 { 0..#[attr] FOO => () } } | |
| 440 | 440 | | |
| 441 | 441 | |
| 442 | 442 | error: expected one of `=>`, `if`, or `|`, found `#` |
| 443 | 443 | --> $DIR/attr-stmt-expr-attr-bad.rs:93:38 |
| 444 | 444 | | |
| 445 | LL | #[cfg(FALSE)] fn e() { match 0 { 0..=#[attr] FOO => () } } | |
| 445 | LL | #[cfg(false)] fn e() { match 0 { 0..=#[attr] FOO => () } } | |
| 446 | 446 | | ^ expected one of `=>`, `if`, or `|` |
| 447 | 447 | |
| 448 | 448 | error: unexpected token: `#` |
| 449 | 449 | --> $DIR/attr-stmt-expr-attr-bad.rs:97:34 |
| 450 | 450 | | |
| 451 | LL | #[cfg(FALSE)] fn e() { let _ = x.#![attr]foo(); } | |
| 451 | LL | #[cfg(false)] fn e() { let _ = x.#![attr]foo(); } | |
| 452 | 452 | | ^ |
| 453 | 453 | |
| 454 | 454 | error: expected one of `.`, `;`, `?`, `else`, or an operator, found `#` |
| 455 | 455 | --> $DIR/attr-stmt-expr-attr-bad.rs:97:34 |
| 456 | 456 | | |
| 457 | LL | #[cfg(FALSE)] fn e() { let _ = x.#![attr]foo(); } | |
| 457 | LL | #[cfg(false)] fn e() { let _ = x.#![attr]foo(); } | |
| 458 | 458 | | ^ expected one of `.`, `;`, `?`, `else`, or an operator |
| 459 | 459 | |
| 460 | 460 | error: unexpected token: `#` |
| 461 | 461 | --> $DIR/attr-stmt-expr-attr-bad.rs:100:34 |
| 462 | 462 | | |
| 463 | LL | #[cfg(FALSE)] fn e() { let _ = x.#[attr]foo(); } | |
| 463 | LL | #[cfg(false)] fn e() { let _ = x.#[attr]foo(); } | |
| 464 | 464 | | ^ |
| 465 | 465 | |
| 466 | 466 | error: expected one of `.`, `;`, `?`, `else`, or an operator, found `#` |
| 467 | 467 | --> $DIR/attr-stmt-expr-attr-bad.rs:100:34 |
| 468 | 468 | | |
| 469 | LL | #[cfg(FALSE)] fn e() { let _ = x.#[attr]foo(); } | |
| 469 | LL | #[cfg(false)] fn e() { let _ = x.#[attr]foo(); } | |
| 470 | 470 | | ^ expected one of `.`, `;`, `?`, `else`, or an operator |
| 471 | 471 | |
| 472 | 472 | error: expected statement after outer attribute |
| 473 | 473 | --> $DIR/attr-stmt-expr-attr-bad.rs:105:37 |
| 474 | 474 | | |
| 475 | LL | #[cfg(FALSE)] fn e() { { fn foo() { #[attr]; } } } | |
| 475 | LL | #[cfg(false)] fn e() { { fn foo() { #[attr]; } } } | |
| 476 | 476 | | ^^^^^^^ |
| 477 | 477 | |
| 478 | 478 | error: expected statement after outer attribute |
| 479 | 479 | --> $DIR/attr-stmt-expr-attr-bad.rs:107:37 |
| 480 | 480 | | |
| 481 | LL | #[cfg(FALSE)] fn e() { { fn foo() { #[attr] } } } | |
| 481 | LL | #[cfg(false)] fn e() { { fn foo() { #[attr] } } } | |
| 482 | 482 | | ^^^^^^^ |
| 483 | 483 | |
| 484 | 484 | error: aborting due to 53 previous errors |
tests/ui/parser/attribute/multiple-tail-expr-behind-cfg.rs+1-1| ... | ... | @@ -1,7 +1,7 @@ |
| 1 | 1 | #![feature(stmt_expr_attributes)] |
| 2 | 2 | |
| 3 | 3 | fn foo() -> String { |
| 4 | #[cfg(FALSE)] | |
| 4 | #[cfg(false)] | |
| 5 | 5 | [1, 2, 3].iter().map(|c| c.to_string()).collect::<String>() //~ ERROR expected `;`, found `#` |
| 6 | 6 | #[cfg(not(FALSE))] |
| 7 | 7 | String::new() |
tests/ui/parser/attribute/multiple-tail-expr-behind-cfg.stderr+2-2| ... | ... | @@ -1,7 +1,7 @@ |
| 1 | 1 | error: expected `;`, found `#` |
| 2 | 2 | --> $DIR/multiple-tail-expr-behind-cfg.rs:5:64 |
| 3 | 3 | | |
| 4 | LL | #[cfg(FALSE)] | |
| 4 | LL | #[cfg(false)] | |
| 5 | 5 | | ------------- only `;` terminated statements or tail expressions are allowed after this attribute |
| 6 | 6 | LL | [1, 2, 3].iter().map(|c| c.to_string()).collect::<String>() |
| 7 | 7 | | ^ expected `;` here |
| ... | ... | @@ -18,7 +18,7 @@ LL | { [1, 2, 3].iter().map(|c| c.to_string()).collect::<String>() } |
| 18 | 18 | | + + |
| 19 | 19 | help: it seems like you are trying to provide different expressions depending on `cfg`, consider using `if cfg!(..)` |
| 20 | 20 | | |
| 21 | LL ~ if cfg!(FALSE) { | |
| 21 | LL ~ if cfg!(false) { | |
| 22 | 22 | LL ~ [1, 2, 3].iter().map(|c| c.to_string()).collect::<String>() |
| 23 | 23 | LL ~ } else if cfg!(not(FALSE)) { |
| 24 | 24 | LL ~ 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 { |
| 5 | 5 | #[cfg()] |
| 6 | 6 | $foo //~ ERROR expected `;`, found `#` |
| 7 | 7 | |
| 8 | #[cfg(FALSE)] | |
| 8 | #[cfg(false)] | |
| 9 | 9 | $bar |
| 10 | 10 | }; |
| 11 | 11 | } |
tests/ui/parser/attribute/properly-recover-from-trailing-outer-attribute-in-body-2.stderr+1-1| ... | ... | @@ -6,7 +6,7 @@ LL | #[cfg()] |
| 6 | 6 | LL | $foo |
| 7 | 7 | | ^ expected `;` here |
| 8 | 8 | LL | |
| 9 | LL | #[cfg(FALSE)] | |
| 9 | LL | #[cfg(false)] | |
| 10 | 10 | | - unexpected token |
| 11 | 11 | ... |
| 12 | 12 | LL | the_macro!( (); (); ); |
tests/ui/parser/constraints-before-generic-args-syntactic-pass.rs+1-1| ... | ... | @@ -1,6 +1,6 @@ |
| 1 | 1 | //@ check-pass |
| 2 | 2 | |
| 3 | #[cfg(FALSE)] | |
| 3 | #[cfg(false)] | |
| 4 | 4 | fn syntax() { |
| 5 | 5 | foo::<T = u8, T: Ord, String>(); |
| 6 | 6 | foo::<T = u8, 'a, T: Ord>(); |
tests/ui/parser/default-on-wrong-item-kind.rs+4-4| ... | ... | @@ -4,7 +4,7 @@ |
| 4 | 4 | |
| 5 | 5 | fn main() {} |
| 6 | 6 | |
| 7 | #[cfg(FALSE)] | |
| 7 | #[cfg(false)] | |
| 8 | 8 | mod free_items { |
| 9 | 9 | default extern crate foo; //~ ERROR an extern crate cannot be `default` |
| 10 | 10 | default use foo; //~ ERROR a `use` import cannot be `default` |
| ... | ... | @@ -28,7 +28,7 @@ mod free_items { |
| 28 | 28 | default macro_rules! foo {} //~ ERROR a macro definition cannot be `default` |
| 29 | 29 | } |
| 30 | 30 | |
| 31 | #[cfg(FALSE)] | |
| 31 | #[cfg(false)] | |
| 32 | 32 | extern "C" { |
| 33 | 33 | default extern crate foo; //~ ERROR an extern crate cannot be `default` |
| 34 | 34 | //~^ ERROR extern crate is not supported in `extern` blocks |
| ... | ... | @@ -65,7 +65,7 @@ extern "C" { |
| 65 | 65 | //~^ ERROR macro definition is not supported in `extern` blocks |
| 66 | 66 | } |
| 67 | 67 | |
| 68 | #[cfg(FALSE)] | |
| 68 | #[cfg(false)] | |
| 69 | 69 | impl S { |
| 70 | 70 | default extern crate foo; //~ ERROR an extern crate cannot be `default` |
| 71 | 71 | //~^ ERROR extern crate is not supported in `trait`s or `impl`s |
| ... | ... | @@ -102,7 +102,7 @@ impl S { |
| 102 | 102 | //~^ ERROR macro definition is not supported in `trait`s or `impl`s |
| 103 | 103 | } |
| 104 | 104 | |
| 105 | #[cfg(FALSE)] | |
| 105 | #[cfg(false)] | |
| 106 | 106 | trait T { |
| 107 | 107 | default extern crate foo; //~ ERROR an extern crate cannot be `default` |
| 108 | 108 | //~^ 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 @@ |
| 5 | 5 | |
| 6 | 6 | fn main() {} |
| 7 | 7 | |
| 8 | #[cfg(FALSE)] | |
| 8 | #[cfg(false)] | |
| 9 | 9 | extern "some_abi_that_we_are_sure_does_not_exist_semantically" fn foo() {} |
| 10 | 10 | |
| 11 | #[cfg(FALSE)] | |
| 11 | #[cfg(false)] | |
| 12 | 12 | extern "some_abi_that_we_are_sure_does_not_exist_semantically" { |
| 13 | 13 | fn foo(); |
| 14 | 14 | } |
| 15 | 15 | |
| 16 | #[cfg(FALSE)] | |
| 16 | #[cfg(false)] | |
| 17 | 17 | type 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 @@ |
| 5 | 5 | |
| 6 | 6 | fn main() {} |
| 7 | 7 | |
| 8 | #[cfg(FALSE)] | |
| 8 | #[cfg(false)] | |
| 9 | 9 | extern crate async; |
| 10 | 10 | |
| 11 | #[cfg(FALSE)] | |
| 11 | #[cfg(false)] | |
| 12 | 12 | extern crate async as something_else; |
tests/ui/parser/fn-body-optional-syntactic-pass.rs+1-1| ... | ... | @@ -4,7 +4,7 @@ |
| 4 | 4 | |
| 5 | 5 | fn main() {} |
| 6 | 6 | |
| 7 | #[cfg(FALSE)] | |
| 7 | #[cfg(false)] | |
| 8 | 8 | fn syntax() { |
| 9 | 9 | fn f(); |
| 10 | 10 | fn f() {} |
tests/ui/parser/fn-header-syntactic-pass.rs+1-1| ... | ... | @@ -5,7 +5,7 @@ |
| 5 | 5 | |
| 6 | 6 | fn main() {} |
| 7 | 7 | |
| 8 | #[cfg(FALSE)] | |
| 8 | #[cfg(false)] | |
| 9 | 9 | fn syntax() { |
| 10 | 10 | async fn f(); |
| 11 | 11 | unsafe fn f(); |
tests/ui/parser/foreign-const-syntactic-fail.rs+1-1| ... | ... | @@ -2,7 +2,7 @@ |
| 2 | 2 | |
| 3 | 3 | fn main() {} |
| 4 | 4 | |
| 5 | #[cfg(FALSE)] | |
| 5 | #[cfg(false)] | |
| 6 | 6 | extern "C" { |
| 7 | 7 | const A: isize; //~ ERROR extern items cannot be `const` |
| 8 | 8 | const B: isize = 42; //~ ERROR extern items cannot be `const` |
tests/ui/parser/foreign-static-syntactic-pass.rs+1-1| ... | ... | @@ -4,7 +4,7 @@ |
| 4 | 4 | |
| 5 | 5 | fn main() {} |
| 6 | 6 | |
| 7 | #[cfg(FALSE)] | |
| 7 | #[cfg(false)] | |
| 8 | 8 | extern "C" { |
| 9 | 9 | static X: u8; |
| 10 | 10 | static mut Y: u8; |
tests/ui/parser/foreign-ty-syntactic-pass.rs+1-1| ... | ... | @@ -2,7 +2,7 @@ |
| 2 | 2 | |
| 3 | 3 | fn main() {} |
| 4 | 4 | |
| 5 | #[cfg(FALSE)] | |
| 5 | #[cfg(false)] | |
| 6 | 6 | extern "C" { |
| 7 | 7 | type A: Ord; |
| 8 | 8 | type A<'a> where 'a: 'static; |
tests/ui/parser/impl-item-const-pass.rs+1-1| ... | ... | @@ -2,7 +2,7 @@ |
| 2 | 2 | |
| 3 | 3 | fn main() {} |
| 4 | 4 | |
| 5 | #[cfg(FALSE)] | |
| 5 | #[cfg(false)] | |
| 6 | 6 | impl X { |
| 7 | 7 | const Y: u8; |
| 8 | 8 | } |
tests/ui/parser/impl-item-fn-no-body-pass.rs+1-1| ... | ... | @@ -2,7 +2,7 @@ |
| 2 | 2 | |
| 3 | 3 | fn main() {} |
| 4 | 4 | |
| 5 | #[cfg(FALSE)] | |
| 5 | #[cfg(false)] | |
| 6 | 6 | impl X { |
| 7 | 7 | fn f(); |
| 8 | 8 | } |
tests/ui/parser/impl-item-type-no-body-pass.rs+1-1| ... | ... | @@ -2,7 +2,7 @@ |
| 2 | 2 | |
| 3 | 3 | fn main() {} |
| 4 | 4 | |
| 5 | #[cfg(FALSE)] | |
| 5 | #[cfg(false)] | |
| 6 | 6 | impl X { |
| 7 | 7 | type Y; |
| 8 | 8 | 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 { |
| 20 | 20 | mac_variant!(MARKER); |
| 21 | 21 | |
| 22 | 22 | // We also accept visibilities on variants syntactically but not semantically. |
| 23 | #[cfg(FALSE)] | |
| 23 | #[cfg(false)] | |
| 24 | 24 | enum E { |
| 25 | 25 | pub U, |
| 26 | 26 | pub(crate) T(u8), |
tests/ui/parser/issues/issue-65041-empty-vis-matcher-in-trait.rs+1-1| ... | ... | @@ -20,7 +20,7 @@ trait Alpha { |
| 20 | 20 | } |
| 21 | 21 | |
| 22 | 22 | // We also accept visibilities on items in traits syntactically but not semantically. |
| 23 | #[cfg(FALSE)] | |
| 23 | #[cfg(false)] | |
| 24 | 24 | trait Foo { |
| 25 | 25 | pub fn bar(); |
| 26 | 26 | pub(crate) type baz; |
tests/ui/parser/item-free-const-no-body-syntactic-pass.rs+1-1| ... | ... | @@ -4,5 +4,5 @@ |
| 4 | 4 | |
| 5 | 5 | fn main() {} |
| 6 | 6 | |
| 7 | #[cfg(FALSE)] | |
| 7 | #[cfg(false)] | |
| 8 | 8 | const X: u8; |
tests/ui/parser/item-free-static-no-body-syntactic-pass.rs+1-1| ... | ... | @@ -4,5 +4,5 @@ |
| 4 | 4 | |
| 5 | 5 | fn main() {} |
| 6 | 6 | |
| 7 | #[cfg(FALSE)] | |
| 7 | #[cfg(false)] | |
| 8 | 8 | static X: u8; |
tests/ui/parser/item-free-type-bounds-syntactic-pass.rs+1-1| ... | ... | @@ -2,7 +2,7 @@ |
| 2 | 2 | |
| 3 | 3 | fn main() {} |
| 4 | 4 | |
| 5 | #[cfg(FALSE)] | |
| 5 | #[cfg(false)] | |
| 6 | 6 | fn syntax() { |
| 7 | 7 | type A: Ord; |
| 8 | 8 | 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)] | |
| 2 | 2 | fn syntax() { |
| 3 | 3 | bar::<Item = 42>(); |
| 4 | 4 | //~^ 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)] | |
| 2 | 2 | fn syntax() { |
| 3 | 3 | bar::<Item = >(); //~ ERROR missing type to the right of `=` |
| 4 | 4 | } |
tests/ui/parser/recover/recover-assoc-lifetime-constraint.rs+1-1| ... | ... | @@ -1,4 +1,4 @@ |
| 1 | #[cfg(FALSE)] | |
| 1 | #[cfg(false)] | |
| 2 | 2 | fn syntax() { |
| 3 | 3 | bar::<Item = 'a>(); //~ ERROR lifetimes are not permitted in this context |
| 4 | 4 | } |
tests/ui/parser/self-param-syntactic-pass.rs+5-5| ... | ... | @@ -5,7 +5,7 @@ |
| 5 | 5 | |
| 6 | 6 | fn main() {} |
| 7 | 7 | |
| 8 | #[cfg(FALSE)] | |
| 8 | #[cfg(false)] | |
| 9 | 9 | fn free() { |
| 10 | 10 | fn f(self) {} |
| 11 | 11 | fn f(mut self) {} |
| ... | ... | @@ -17,7 +17,7 @@ fn free() { |
| 17 | 17 | fn f(mut self: u8) {} |
| 18 | 18 | } |
| 19 | 19 | |
| 20 | #[cfg(FALSE)] | |
| 20 | #[cfg(false)] | |
| 21 | 21 | extern "C" { |
| 22 | 22 | fn f(self); |
| 23 | 23 | fn f(mut self); |
| ... | ... | @@ -29,7 +29,7 @@ extern "C" { |
| 29 | 29 | fn f(mut self: u8); |
| 30 | 30 | } |
| 31 | 31 | |
| 32 | #[cfg(FALSE)] | |
| 32 | #[cfg(false)] | |
| 33 | 33 | trait X { |
| 34 | 34 | fn f(self) {} |
| 35 | 35 | fn f(mut self) {} |
| ... | ... | @@ -41,7 +41,7 @@ trait X { |
| 41 | 41 | fn f(mut self: u8) {} |
| 42 | 42 | } |
| 43 | 43 | |
| 44 | #[cfg(FALSE)] | |
| 44 | #[cfg(false)] | |
| 45 | 45 | impl X for Y { |
| 46 | 46 | fn f(self) {} |
| 47 | 47 | fn f(mut self) {} |
| ... | ... | @@ -53,7 +53,7 @@ impl X for Y { |
| 53 | 53 | fn f(mut self: u8) {} |
| 54 | 54 | } |
| 55 | 55 | |
| 56 | #[cfg(FALSE)] | |
| 56 | #[cfg(false)] | |
| 57 | 57 | impl X for Y { |
| 58 | 58 | type X = fn(self); |
| 59 | 59 | type X = fn(mut self); |
tests/ui/parser/stripped-nested-outline-mod-pass.rs+1-1| ... | ... | @@ -5,7 +5,7 @@ |
| 5 | 5 | |
| 6 | 6 | fn main() {} |
| 7 | 7 | |
| 8 | #[cfg(FALSE)] | |
| 8 | #[cfg(false)] | |
| 9 | 9 | mod foo { |
| 10 | 10 | mod bar { |
| 11 | 11 | mod baz; // This was an error before. |
tests/ui/parser/trait-item-with-defaultness-pass.rs+1-1| ... | ... | @@ -2,7 +2,7 @@ |
| 2 | 2 | |
| 3 | 3 | fn main() {} |
| 4 | 4 | |
| 5 | #[cfg(FALSE)] | |
| 5 | #[cfg(false)] | |
| 6 | 6 | trait X { |
| 7 | 7 | default const A: u8; |
| 8 | 8 | default const B: u8 = 0; |
tests/ui/parser/variadic-ffi-syntactic-pass.rs+11-11| ... | ... | @@ -2,31 +2,31 @@ |
| 2 | 2 | |
| 3 | 3 | fn main() {} |
| 4 | 4 | |
| 5 | #[cfg(FALSE)] | |
| 5 | #[cfg(false)] | |
| 6 | 6 | fn f1_1(x: isize, ...) {} |
| 7 | 7 | |
| 8 | #[cfg(FALSE)] | |
| 8 | #[cfg(false)] | |
| 9 | 9 | fn f1_2(...) {} |
| 10 | 10 | |
| 11 | #[cfg(FALSE)] | |
| 11 | #[cfg(false)] | |
| 12 | 12 | extern "C" fn f2_1(x: isize, ...) {} |
| 13 | 13 | |
| 14 | #[cfg(FALSE)] | |
| 14 | #[cfg(false)] | |
| 15 | 15 | extern "C" fn f2_2(...) {} |
| 16 | 16 | |
| 17 | #[cfg(FALSE)] | |
| 17 | #[cfg(false)] | |
| 18 | 18 | extern "C" fn f2_3(..., x: isize) {} |
| 19 | 19 | |
| 20 | #[cfg(FALSE)] | |
| 20 | #[cfg(false)] | |
| 21 | 21 | extern fn f3_1(x: isize, ...) {} |
| 22 | 22 | |
| 23 | #[cfg(FALSE)] | |
| 23 | #[cfg(false)] | |
| 24 | 24 | extern fn f3_2(...) {} |
| 25 | 25 | |
| 26 | #[cfg(FALSE)] | |
| 26 | #[cfg(false)] | |
| 27 | 27 | extern fn f3_3(..., x: isize) {} |
| 28 | 28 | |
| 29 | #[cfg(FALSE)] | |
| 29 | #[cfg(false)] | |
| 30 | 30 | extern { |
| 31 | 31 | fn e_f1(...); |
| 32 | 32 | fn e_f2(..., x: isize); |
| ... | ... | @@ -34,7 +34,7 @@ extern { |
| 34 | 34 | |
| 35 | 35 | struct X; |
| 36 | 36 | |
| 37 | #[cfg(FALSE)] | |
| 37 | #[cfg(false)] | |
| 38 | 38 | impl X { |
| 39 | 39 | fn i_f1(x: isize, ...) {} |
| 40 | 40 | fn i_f2(...) {} |
| ... | ... | @@ -42,7 +42,7 @@ impl X { |
| 42 | 42 | fn i_f4(..., x: isize, ...) {} |
| 43 | 43 | } |
| 44 | 44 | |
| 45 | #[cfg(FALSE)] | |
| 45 | #[cfg(false)] | |
| 46 | 46 | trait T { |
| 47 | 47 | fn t_f1(x: isize, ...) {} |
| 48 | 48 | 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() { |
| 13 | 13 | fn _f(_a @ _b: u8) {} // OK. |
| 14 | 14 | } |
| 15 | 15 | |
| 16 | #[cfg(FALSE)] | |
| 16 | #[cfg(false)] | |
| 17 | 17 | fn case_1() { |
| 18 | 18 | let a: u8 @ b = 0; |
| 19 | 19 | //~^ ERROR expected one of `!` |
| 20 | 20 | } |
| 21 | 21 | |
| 22 | #[cfg(FALSE)] | |
| 22 | #[cfg(false)] | |
| 23 | 23 | fn case_2() { |
| 24 | 24 | let a @ (b: u8); |
| 25 | 25 | //~^ ERROR expected one of `)` |
| 26 | 26 | } |
| 27 | 27 | |
| 28 | #[cfg(FALSE)] | |
| 28 | #[cfg(false)] | |
| 29 | 29 | fn case_3() { |
| 30 | 30 | let a: T1 @ Outer(b: T2); |
| 31 | 31 | //~^ ERROR expected one of `!` |
tests/ui/pattern/bindings-after-at/wild-before-at-syntactically-rejected.rs+1-1| ... | ... | @@ -3,7 +3,7 @@ |
| 3 | 3 | |
| 4 | 4 | fn main() {} |
| 5 | 5 | |
| 6 | #[cfg(FALSE)] | |
| 6 | #[cfg(false)] | |
| 7 | 7 | fn wild_before_at_is_bad_syntax() { |
| 8 | 8 | let _ @ a = 0; |
| 9 | 9 | //~^ ERROR pattern on wrong side of `@` |
tests/ui/pattern/rest-pat-syntactic.rs+1-1| ... | ... | @@ -11,7 +11,7 @@ macro_rules! accept_pat { |
| 11 | 11 | |
| 12 | 12 | accept_pat!(..); |
| 13 | 13 | |
| 14 | #[cfg(FALSE)] | |
| 14 | #[cfg(false)] | |
| 15 | 15 | fn rest_patterns() { |
| 16 | 16 | // Top level: |
| 17 | 17 | fn foo(..: u8) {} |
tests/ui/proc-macro/attribute-after-derive.rs+2-2| ... | ... | @@ -14,14 +14,14 @@ extern crate test_macros; |
| 14 | 14 | #[print_attr] |
| 15 | 15 | #[derive(Print)] |
| 16 | 16 | struct AttributeDerive { |
| 17 | #[cfg(FALSE)] | |
| 17 | #[cfg(false)] | |
| 18 | 18 | field: u8, |
| 19 | 19 | } |
| 20 | 20 | |
| 21 | 21 | #[derive(Print)] |
| 22 | 22 | #[print_attr] |
| 23 | 23 | struct DeriveAttribute { |
| 24 | #[cfg(FALSE)] | |
| 24 | #[cfg(false)] | |
| 25 | 25 | field: u8, |
| 26 | 26 | } |
| 27 | 27 |
tests/ui/proc-macro/attribute-after-derive.stdout+6-6| ... | ... | @@ -1,5 +1,5 @@ |
| 1 | PRINT-ATTR INPUT (DISPLAY): #[derive(Print)] struct AttributeDerive { #[cfg(FALSE)] field: u8, } | |
| 2 | PRINT-ATTR DEEP-RE-COLLECTED (DISPLAY): #[derive(Print)] struct AttributeDerive { #[cfg(FALSE)] field : u8, } | |
| 1 | PRINT-ATTR INPUT (DISPLAY): #[derive(Print)] struct AttributeDerive { #[cfg(false)] field: u8, } | |
| 2 | PRINT-ATTR DEEP-RE-COLLECTED (DISPLAY): #[derive(Print)] struct AttributeDerive { #[cfg(false)] field : u8, } | |
| 3 | 3 | PRINT-ATTR INPUT (DEBUG): TokenStream [ |
| 4 | 4 | Punct { |
| 5 | 5 | ch: '#', |
| ... | ... | @@ -53,7 +53,7 @@ PRINT-ATTR INPUT (DEBUG): TokenStream [ |
| 53 | 53 | delimiter: Parenthesis, |
| 54 | 54 | stream: TokenStream [ |
| 55 | 55 | Ident { |
| 56 | ident: "FALSE", | |
| 56 | ident: "false", | |
| 57 | 57 | span: $DIR/attribute-after-derive.rs:17:11: 17:16 (#0), |
| 58 | 58 | }, |
| 59 | 59 | ], |
| ... | ... | @@ -131,8 +131,8 @@ PRINT-DERIVE INPUT (DEBUG): TokenStream [ |
| 131 | 131 | span: $DIR/attribute-after-derive.rs:23:24: 26:2 (#0), |
| 132 | 132 | }, |
| 133 | 133 | ] |
| 134 | PRINT-ATTR INPUT (DISPLAY): struct DeriveAttribute { #[cfg(FALSE)] field: u8, } | |
| 135 | PRINT-ATTR DEEP-RE-COLLECTED (DISPLAY): struct DeriveAttribute { #[cfg(FALSE)] field : u8, } | |
| 134 | PRINT-ATTR INPUT (DISPLAY): struct DeriveAttribute { #[cfg(false)] field: u8, } | |
| 135 | PRINT-ATTR DEEP-RE-COLLECTED (DISPLAY): struct DeriveAttribute { #[cfg(false)] field : u8, } | |
| 136 | 136 | PRINT-ATTR INPUT (DEBUG): TokenStream [ |
| 137 | 137 | Ident { |
| 138 | 138 | ident: "struct", |
| ... | ... | @@ -161,7 +161,7 @@ PRINT-ATTR INPUT (DEBUG): TokenStream [ |
| 161 | 161 | delimiter: Parenthesis, |
| 162 | 162 | stream: TokenStream [ |
| 163 | 163 | Ident { |
| 164 | ident: "FALSE", | |
| 164 | ident: "false", | |
| 165 | 165 | span: $DIR/attribute-after-derive.rs:24:11: 24:16 (#0), |
| 166 | 166 | }, |
| 167 | 167 | ], |
tests/ui/proc-macro/cfg-attr-trace.rs-1| ... | ... | @@ -3,7 +3,6 @@ |
| 3 | 3 | //@ check-pass |
| 4 | 4 | //@ proc-macro: test-macros.rs |
| 5 | 5 | |
| 6 | #![feature(cfg_boolean_literals)] | |
| 7 | 6 | #![feature(cfg_eval)] |
| 8 | 7 | |
| 9 | 8 | #[macro_use] |
tests/ui/proc-macro/cfg-attr-trace.stdout+15-15| ... | ... | @@ -4,75 +4,75 @@ PRINT-ATTR INPUT (DEBUG): TokenStream [ |
| 4 | 4 | Punct { |
| 5 | 5 | ch: '#', |
| 6 | 6 | spacing: Alone, |
| 7 | span: #0 bytes(305..306), | |
| 7 | span: #0 bytes(271..272), | |
| 8 | 8 | }, |
| 9 | 9 | Group { |
| 10 | 10 | delimiter: Bracket, |
| 11 | 11 | stream: TokenStream [ |
| 12 | 12 | Ident { |
| 13 | 13 | ident: "test_macros", |
| 14 | span: #0 bytes(322..333), | |
| 14 | span: #0 bytes(288..299), | |
| 15 | 15 | }, |
| 16 | 16 | Punct { |
| 17 | 17 | ch: ':', |
| 18 | 18 | spacing: Joint, |
| 19 | span: #0 bytes(333..334), | |
| 19 | span: #0 bytes(299..300), | |
| 20 | 20 | }, |
| 21 | 21 | Punct { |
| 22 | 22 | ch: ':', |
| 23 | 23 | spacing: Alone, |
| 24 | span: #0 bytes(334..335), | |
| 24 | span: #0 bytes(300..301), | |
| 25 | 25 | }, |
| 26 | 26 | Ident { |
| 27 | 27 | ident: "print_attr", |
| 28 | span: #0 bytes(335..345), | |
| 28 | span: #0 bytes(301..311), | |
| 29 | 29 | }, |
| 30 | 30 | ], |
| 31 | span: #0 bytes(306..347), | |
| 31 | span: #0 bytes(272..313), | |
| 32 | 32 | }, |
| 33 | 33 | Ident { |
| 34 | 34 | ident: "struct", |
| 35 | span: #0 bytes(348..354), | |
| 35 | span: #0 bytes(314..320), | |
| 36 | 36 | }, |
| 37 | 37 | Ident { |
| 38 | 38 | ident: "S", |
| 39 | span: #0 bytes(355..356), | |
| 39 | span: #0 bytes(321..322), | |
| 40 | 40 | }, |
| 41 | 41 | Punct { |
| 42 | 42 | ch: ';', |
| 43 | 43 | spacing: Alone, |
| 44 | span: #0 bytes(356..357), | |
| 44 | span: #0 bytes(322..323), | |
| 45 | 45 | }, |
| 46 | 46 | ] |
| 47 | 47 | PRINT-ATTR INPUT (DISPLAY): struct S; |
| 48 | 48 | PRINT-ATTR INPUT (DEBUG): TokenStream [ |
| 49 | 49 | Ident { |
| 50 | 50 | ident: "struct", |
| 51 | span: #0 bytes(348..354), | |
| 51 | span: #0 bytes(314..320), | |
| 52 | 52 | }, |
| 53 | 53 | Ident { |
| 54 | 54 | ident: "S", |
| 55 | span: #0 bytes(355..356), | |
| 55 | span: #0 bytes(321..322), | |
| 56 | 56 | }, |
| 57 | 57 | Punct { |
| 58 | 58 | ch: ';', |
| 59 | 59 | spacing: Alone, |
| 60 | span: #0 bytes(356..357), | |
| 60 | span: #0 bytes(322..323), | |
| 61 | 61 | }, |
| 62 | 62 | ] |
| 63 | 63 | PRINT-ATTR INPUT (DISPLAY): struct Z; |
| 64 | 64 | PRINT-ATTR INPUT (DEBUG): TokenStream [ |
| 65 | 65 | Ident { |
| 66 | 66 | ident: "struct", |
| 67 | span: #0 bytes(411..417), | |
| 67 | span: #0 bytes(377..383), | |
| 68 | 68 | }, |
| 69 | 69 | Ident { |
| 70 | 70 | ident: "Z", |
| 71 | span: #0 bytes(418..419), | |
| 71 | span: #0 bytes(384..385), | |
| 72 | 72 | }, |
| 73 | 73 | Punct { |
| 74 | 74 | ch: ';', |
| 75 | 75 | spacing: Alone, |
| 76 | span: #0 bytes(419..420), | |
| 76 | span: #0 bytes(385..386), | |
| 77 | 77 | }, |
| 78 | 78 | ] |
tests/ui/proc-macro/cfg-eval-fail.rs+1-1| ... | ... | @@ -2,6 +2,6 @@ |
| 2 | 2 | #![feature(stmt_expr_attributes)] |
| 3 | 3 | |
| 4 | 4 | fn main() { |
| 5 | let _ = #[cfg_eval] #[cfg(FALSE)] 0; | |
| 5 | let _ = #[cfg_eval] #[cfg(false)] 0; | |
| 6 | 6 | //~^ ERROR removing an expression is not supported in this position |
| 7 | 7 | } |
tests/ui/proc-macro/cfg-eval-fail.stderr+1-1| ... | ... | @@ -1,7 +1,7 @@ |
| 1 | 1 | error: removing an expression is not supported in this position |
| 2 | 2 | --> $DIR/cfg-eval-fail.rs:5:25 |
| 3 | 3 | | |
| 4 | LL | let _ = #[cfg_eval] #[cfg(FALSE)] 0; | |
| 4 | LL | let _ = #[cfg_eval] #[cfg(false)] 0; | |
| 5 | 5 | | ^^^^^^^^^^^^^ |
| 6 | 6 | |
| 7 | 7 | error: aborting due to 1 previous error |
tests/ui/proc-macro/cfg-eval-inner.rs+1-1| ... | ... | @@ -32,7 +32,7 @@ impl Foo<[u8; { |
| 32 | 32 | #![cfg_attr(not(FALSE), rustc_dummy(evaluated_attr))] |
| 33 | 33 | |
| 34 | 34 | fn bar() { |
| 35 | #[cfg(FALSE)] let a = 1; | |
| 35 | #[cfg(false)] let a = 1; | |
| 36 | 36 | } |
| 37 | 37 | } |
| 38 | 38 |
tests/ui/proc-macro/cfg-eval.rs+3-3| ... | ... | @@ -15,7 +15,7 @@ extern crate test_macros; |
| 15 | 15 | #[cfg_eval] |
| 16 | 16 | #[print_attr] |
| 17 | 17 | struct S1 { |
| 18 | #[cfg(FALSE)] | |
| 18 | #[cfg(false)] | |
| 19 | 19 | field_false: u8, |
| 20 | 20 | #[cfg(all(/*true*/))] |
| 21 | 21 | #[cfg_attr(FALSE, unknown_attr)] |
| ... | ... | @@ -24,7 +24,7 @@ struct S1 { |
| 24 | 24 | } |
| 25 | 25 | |
| 26 | 26 | #[cfg_eval] |
| 27 | #[cfg(FALSE)] | |
| 27 | #[cfg(false)] | |
| 28 | 28 | struct S2 {} |
| 29 | 29 | |
| 30 | 30 | fn main() { |
| ... | ... | @@ -33,5 +33,5 @@ fn main() { |
| 33 | 33 | // expression. `#[cfg]` is not supported inside parenthesized expressions, so this will |
| 34 | 34 | // produce an error when attribute collection runs. |
| 35 | 35 | 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,); | |
| 37 | 37 | } |
tests/ui/proc-macro/derive-cfg-nested-tokens.rs+1-1| ... | ... | @@ -15,7 +15,7 @@ struct S { |
| 15 | 15 | // - on eagerly configured `S` (from `impl Copy`), only 11 should be printed |
| 16 | 16 | // - on non-configured `S` (from `struct S`), both 10 and 11 should be printed |
| 17 | 17 | field: [u8; #[print_attr] { |
| 18 | #[cfg(FALSE)] { 10 } | |
| 18 | #[cfg(false)] { 10 } | |
| 19 | 19 | #[cfg(not(FALSE))] { 11 } |
| 20 | 20 | }], |
| 21 | 21 | } |
tests/ui/proc-macro/derive-cfg-nested-tokens.stdout+2-2| ... | ... | @@ -54,7 +54,7 @@ PRINT-ATTR INPUT (DEBUG): TokenStream [ |
| 54 | 54 | span: #0 bytes(452..523), |
| 55 | 55 | }, |
| 56 | 56 | ] |
| 57 | PRINT-ATTR INPUT (DISPLAY): { #[cfg(FALSE)] { 10 } #[cfg(not(FALSE))] { 11 } } | |
| 57 | PRINT-ATTR INPUT (DISPLAY): { #[cfg(false)] { 10 } #[cfg(not(FALSE))] { 11 } } | |
| 58 | 58 | PRINT-ATTR INPUT (DEBUG): TokenStream [ |
| 59 | 59 | Group { |
| 60 | 60 | delimiter: Brace, |
| ... | ... | @@ -75,7 +75,7 @@ PRINT-ATTR INPUT (DEBUG): TokenStream [ |
| 75 | 75 | delimiter: Parenthesis, |
| 76 | 76 | stream: TokenStream [ |
| 77 | 77 | Ident { |
| 78 | ident: "FALSE", | |
| 78 | ident: "false", | |
| 79 | 79 | span: #0 bytes(468..473), |
| 80 | 80 | }, |
| 81 | 81 | ], |
tests/ui/proc-macro/expand-to-derive.rs+2-2| ... | ... | @@ -14,7 +14,7 @@ macro_rules! expand_to_derive { |
| 14 | 14 | ($item:item) => { |
| 15 | 15 | #[derive(Print)] |
| 16 | 16 | struct Foo { |
| 17 | #[cfg(FALSE)] removed: bool, | |
| 17 | #[cfg(false)] removed: bool, | |
| 18 | 18 | field: [bool; { |
| 19 | 19 | $item |
| 20 | 20 | 0 |
| ... | ... | @@ -26,7 +26,7 @@ macro_rules! expand_to_derive { |
| 26 | 26 | expand_to_derive! { |
| 27 | 27 | #[cfg_attr(not(FALSE), rustc_dummy)] |
| 28 | 28 | struct Inner { |
| 29 | #[cfg(FALSE)] removed_inner_field: bool, | |
| 29 | #[cfg(false)] removed_inner_field: bool, | |
| 30 | 30 | other_inner_field: u8, |
| 31 | 31 | } |
| 32 | 32 | } |
tests/ui/proc-macro/issue-75930-derive-cfg.rs+13-13| ... | ... | @@ -31,7 +31,7 @@ extern crate test_macros; |
| 31 | 31 | // |
| 32 | 32 | // It is because of this code from below: |
| 33 | 33 | // ``` |
| 34 | // struct Foo<#[cfg(FALSE)] A, B> | |
| 34 | // struct Foo<#[cfg(false)] A, B> | |
| 35 | 35 | // ``` |
| 36 | 36 | // When the token stream is formed during parsing, `<` is followed immediately |
| 37 | 37 | // by `#`, which is punctuation, so it is marked `Joint`. But before being |
| ... | ... | @@ -51,22 +51,22 @@ extern crate test_macros; |
| 51 | 51 | #[print_attr] |
| 52 | 52 | #[derive(Print)] |
| 53 | 53 | #[print_helper(b)] |
| 54 | struct Foo<#[cfg(FALSE)] A, B> { | |
| 55 | #[cfg(FALSE)] first: String, | |
| 54 | struct Foo<#[cfg(false)] A, B> { | |
| 55 | #[cfg(false)] first: String, | |
| 56 | 56 | #[cfg_attr(FALSE, deny(warnings))] second: bool, |
| 57 | 57 | third: [u8; { |
| 58 | #[cfg(FALSE)] struct Bar; | |
| 58 | #[cfg(false)] struct Bar; | |
| 59 | 59 | #[cfg(not(FALSE))] struct Inner; |
| 60 | #[cfg(FALSE)] let a = 25; | |
| 60 | #[cfg(false)] let a = 25; | |
| 61 | 61 | match true { |
| 62 | #[cfg(FALSE)] true => {}, | |
| 62 | #[cfg(false)] true => {}, | |
| 63 | 63 | #[cfg_attr(not(FALSE), allow(warnings))] false => {}, |
| 64 | 64 | _ => {} |
| 65 | 65 | }; |
| 66 | 66 | |
| 67 | 67 | #[print_helper(should_be_removed)] |
| 68 | 68 | fn removed_fn() { |
| 69 | #![cfg(FALSE)] | |
| 69 | #![cfg(false)] | |
| 70 | 70 | } |
| 71 | 71 | |
| 72 | 72 | #[print_helper(c)] #[cfg(not(FALSE))] fn kept_fn() { |
| ... | ... | @@ -76,22 +76,22 @@ struct Foo<#[cfg(FALSE)] A, B> { |
| 76 | 76 | |
| 77 | 77 | enum TupleEnum { |
| 78 | 78 | Foo( |
| 79 | #[cfg(FALSE)] u8, | |
| 80 | #[cfg(FALSE)] bool, | |
| 79 | #[cfg(false)] u8, | |
| 80 | #[cfg(false)] bool, | |
| 81 | 81 | #[cfg(not(FALSE))] i32, |
| 82 | #[cfg(FALSE)] String, u8 | |
| 82 | #[cfg(false)] String, u8 | |
| 83 | 83 | ) |
| 84 | 84 | } |
| 85 | 85 | |
| 86 | 86 | struct TupleStruct( |
| 87 | #[cfg(FALSE)] String, | |
| 87 | #[cfg(false)] String, | |
| 88 | 88 | #[cfg(not(FALSE))] i32, |
| 89 | #[cfg(FALSE)] bool, | |
| 89 | #[cfg(false)] bool, | |
| 90 | 90 | u8 |
| 91 | 91 | ); |
| 92 | 92 | |
| 93 | 93 | fn plain_removed_fn() { |
| 94 | #![cfg_attr(not(FALSE), cfg(FALSE))] | |
| 94 | #![cfg_attr(not(FALSE), cfg(false))] | |
| 95 | 95 | } |
| 96 | 96 | |
| 97 | 97 | 0 |
tests/ui/proc-macro/issue-75930-derive-cfg.stdout+45-45| ... | ... | @@ -1,73 +1,73 @@ |
| 1 | 1 | PRINT-ATTR INPUT (DISPLAY): #[print_helper(a)] #[allow(dead_code)] #[derive(Print)] #[print_helper(b)] |
| 2 | struct Foo<#[cfg(FALSE)] A, B> | |
| 2 | struct Foo<#[cfg(false)] A, B> | |
| 3 | 3 | { |
| 4 | #[cfg(FALSE)] first: String, #[cfg_attr(FALSE, deny(warnings))] second: | |
| 4 | #[cfg(false)] first: String, #[cfg_attr(FALSE, deny(warnings))] second: | |
| 5 | 5 | bool, third: |
| 6 | 6 | [u8; |
| 7 | 7 | { |
| 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 | |
| 10 | 10 | { |
| 11 | #[cfg(FALSE)] true => {}, #[cfg_attr(not(FALSE), allow(warnings))] | |
| 11 | #[cfg(false)] true => {}, #[cfg_attr(not(FALSE), allow(warnings))] | |
| 12 | 12 | false => {}, _ => {} |
| 13 | 13 | }; #[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() | |
| 15 | 15 | { #![cfg(not(FALSE))] let my_val = true; } enum TupleEnum |
| 16 | 16 | { |
| 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) | |
| 19 | 19 | } 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 | |
| 23 | 23 | }], #[print_helper(d)] fourth: B |
| 24 | 24 | } |
| 25 | 25 | PRINT-ATTR RE-COLLECTED (DISPLAY): #[print_helper(a)] #[allow(dead_code)] #[derive(Print)] #[print_helper(b)] |
| 26 | struct Foo <#[cfg(FALSE)] A, B > | |
| 26 | struct Foo <#[cfg(false)] A, B > | |
| 27 | 27 | { |
| 28 | #[cfg(FALSE)] first: String, #[cfg_attr(FALSE, deny(warnings))] second: | |
| 28 | #[cfg(false)] first: String, #[cfg_attr(FALSE, deny(warnings))] second: | |
| 29 | 29 | bool, third: |
| 30 | 30 | [u8; |
| 31 | 31 | { |
| 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 | |
| 34 | 34 | { |
| 35 | #[cfg(FALSE)] true => {}, #[cfg_attr(not(FALSE), allow(warnings))] | |
| 35 | #[cfg(false)] true => {}, #[cfg_attr(not(FALSE), allow(warnings))] | |
| 36 | 36 | false => {}, _ => {} |
| 37 | 37 | }; #[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() | |
| 39 | 39 | { #![cfg(not(FALSE))] let my_val = true; } enum TupleEnum |
| 40 | 40 | { |
| 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) | |
| 43 | 43 | } 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 | |
| 47 | 47 | }], #[print_helper(d)] fourth: B |
| 48 | 48 | } |
| 49 | 49 | PRINT-ATTR DEEP-RE-COLLECTED (DISPLAY): #[print_helper(a)] #[allow(dead_code)] #[derive(Print)] #[print_helper(b)] |
| 50 | struct Foo <#[cfg(FALSE)] A, B > | |
| 50 | struct Foo <#[cfg(false)] A, B > | |
| 51 | 51 | { |
| 52 | #[cfg(FALSE)] first : String, #[cfg_attr(FALSE, deny(warnings))] second : | |
| 52 | #[cfg(false)] first : String, #[cfg_attr(FALSE, deny(warnings))] second : | |
| 53 | 53 | bool, third : |
| 54 | 54 | [u8; |
| 55 | 55 | { |
| 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 | |
| 58 | 58 | { |
| 59 | #[cfg(FALSE)] true => {}, #[cfg_attr(not(FALSE), allow(warnings))] | |
| 59 | #[cfg(false)] true => {}, #[cfg_attr(not(FALSE), allow(warnings))] | |
| 60 | 60 | false => {}, _ => {} |
| 61 | 61 | }; #[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() | |
| 63 | 63 | { #! [cfg(not(FALSE))] let my_val = true; } enum TupleEnum |
| 64 | 64 | { |
| 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) | |
| 67 | 67 | } 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 | |
| 71 | 71 | }], #[print_helper(d)] fourth : B |
| 72 | 72 | } |
| 73 | 73 | PRINT-ATTR INPUT (DEBUG): TokenStream [ |
| ... | ... | @@ -200,7 +200,7 @@ PRINT-ATTR INPUT (DEBUG): TokenStream [ |
| 200 | 200 | delimiter: Parenthesis, |
| 201 | 201 | stream: TokenStream [ |
| 202 | 202 | Ident { |
| 203 | ident: "FALSE", | |
| 203 | ident: "false", | |
| 204 | 204 | span: $DIR/issue-75930-derive-cfg.rs:54:18: 54:23 (#0), |
| 205 | 205 | }, |
| 206 | 206 | ], |
| ... | ... | @@ -246,7 +246,7 @@ PRINT-ATTR INPUT (DEBUG): TokenStream [ |
| 246 | 246 | delimiter: Parenthesis, |
| 247 | 247 | stream: TokenStream [ |
| 248 | 248 | Ident { |
| 249 | ident: "FALSE", | |
| 249 | ident: "false", | |
| 250 | 250 | span: $DIR/issue-75930-derive-cfg.rs:55:11: 55:16 (#0), |
| 251 | 251 | }, |
| 252 | 252 | ], |
| ... | ... | @@ -375,7 +375,7 @@ PRINT-ATTR INPUT (DEBUG): TokenStream [ |
| 375 | 375 | delimiter: Parenthesis, |
| 376 | 376 | stream: TokenStream [ |
| 377 | 377 | Ident { |
| 378 | ident: "FALSE", | |
| 378 | ident: "false", | |
| 379 | 379 | span: $DIR/issue-75930-derive-cfg.rs:58:15: 58:20 (#0), |
| 380 | 380 | }, |
| 381 | 381 | ], |
| ... | ... | @@ -461,7 +461,7 @@ PRINT-ATTR INPUT (DEBUG): TokenStream [ |
| 461 | 461 | delimiter: Parenthesis, |
| 462 | 462 | stream: TokenStream [ |
| 463 | 463 | Ident { |
| 464 | ident: "FALSE", | |
| 464 | ident: "false", | |
| 465 | 465 | span: $DIR/issue-75930-derive-cfg.rs:60:15: 60:20 (#0), |
| 466 | 466 | }, |
| 467 | 467 | ], |
| ... | ... | @@ -521,7 +521,7 @@ PRINT-ATTR INPUT (DEBUG): TokenStream [ |
| 521 | 521 | delimiter: Parenthesis, |
| 522 | 522 | stream: TokenStream [ |
| 523 | 523 | Ident { |
| 524 | ident: "FALSE", | |
| 524 | ident: "false", | |
| 525 | 525 | span: $DIR/issue-75930-derive-cfg.rs:62:19: 62:24 (#0), |
| 526 | 526 | }, |
| 527 | 527 | ], |
| ... | ... | @@ -721,7 +721,7 @@ PRINT-ATTR INPUT (DEBUG): TokenStream [ |
| 721 | 721 | delimiter: Parenthesis, |
| 722 | 722 | stream: TokenStream [ |
| 723 | 723 | Ident { |
| 724 | ident: "FALSE", | |
| 724 | ident: "false", | |
| 725 | 725 | span: $DIR/issue-75930-derive-cfg.rs:69:20: 69:25 (#0), |
| 726 | 726 | }, |
| 727 | 727 | ], |
| ... | ... | @@ -908,7 +908,7 @@ PRINT-ATTR INPUT (DEBUG): TokenStream [ |
| 908 | 908 | delimiter: Parenthesis, |
| 909 | 909 | stream: TokenStream [ |
| 910 | 910 | Ident { |
| 911 | ident: "FALSE", | |
| 911 | ident: "false", | |
| 912 | 912 | span: $DIR/issue-75930-derive-cfg.rs:79:23: 79:28 (#0), |
| 913 | 913 | }, |
| 914 | 914 | ], |
| ... | ... | @@ -942,7 +942,7 @@ PRINT-ATTR INPUT (DEBUG): TokenStream [ |
| 942 | 942 | delimiter: Parenthesis, |
| 943 | 943 | stream: TokenStream [ |
| 944 | 944 | Ident { |
| 945 | ident: "FALSE", | |
| 945 | ident: "false", | |
| 946 | 946 | span: $DIR/issue-75930-derive-cfg.rs:80:23: 80:28 (#0), |
| 947 | 947 | }, |
| 948 | 948 | ], |
| ... | ... | @@ -1020,7 +1020,7 @@ PRINT-ATTR INPUT (DEBUG): TokenStream [ |
| 1020 | 1020 | delimiter: Parenthesis, |
| 1021 | 1021 | stream: TokenStream [ |
| 1022 | 1022 | Ident { |
| 1023 | ident: "FALSE", | |
| 1023 | ident: "false", | |
| 1024 | 1024 | span: $DIR/issue-75930-derive-cfg.rs:82:23: 82:28 (#0), |
| 1025 | 1025 | }, |
| 1026 | 1026 | ], |
| ... | ... | @@ -1075,7 +1075,7 @@ PRINT-ATTR INPUT (DEBUG): TokenStream [ |
| 1075 | 1075 | delimiter: Parenthesis, |
| 1076 | 1076 | stream: TokenStream [ |
| 1077 | 1077 | Ident { |
| 1078 | ident: "FALSE", | |
| 1078 | ident: "false", | |
| 1079 | 1079 | span: $DIR/issue-75930-derive-cfg.rs:87:19: 87:24 (#0), |
| 1080 | 1080 | }, |
| 1081 | 1081 | ], |
| ... | ... | @@ -1153,7 +1153,7 @@ PRINT-ATTR INPUT (DEBUG): TokenStream [ |
| 1153 | 1153 | delimiter: Parenthesis, |
| 1154 | 1154 | stream: TokenStream [ |
| 1155 | 1155 | Ident { |
| 1156 | ident: "FALSE", | |
| 1156 | ident: "false", | |
| 1157 | 1157 | span: $DIR/issue-75930-derive-cfg.rs:89:19: 89:24 (#0), |
| 1158 | 1158 | }, |
| 1159 | 1159 | ], |
| ... | ... | @@ -1246,7 +1246,7 @@ PRINT-ATTR INPUT (DEBUG): TokenStream [ |
| 1246 | 1246 | delimiter: Parenthesis, |
| 1247 | 1247 | stream: TokenStream [ |
| 1248 | 1248 | Ident { |
| 1249 | ident: "FALSE", | |
| 1249 | ident: "false", | |
| 1250 | 1250 | span: $DIR/issue-75930-derive-cfg.rs:94:41: 94:46 (#0), |
| 1251 | 1251 | }, |
| 1252 | 1252 | ], |
tests/ui/proc-macro/nested-derive-cfg.rs+2-2| ... | ... | @@ -10,10 +10,10 @@ extern crate test_macros; |
| 10 | 10 | |
| 11 | 11 | #[derive(Print)] |
| 12 | 12 | struct Foo { |
| 13 | #[cfg(FALSE)] removed: bool, | |
| 13 | #[cfg(false)] removed: bool, | |
| 14 | 14 | my_array: [bool; { |
| 15 | 15 | struct Inner { |
| 16 | #[cfg(FALSE)] removed_inner_field: u8, | |
| 16 | #[cfg(false)] removed_inner_field: u8, | |
| 17 | 17 | non_removed_inner_field: usize |
| 18 | 18 | } |
| 19 | 19 | 0 |
tests/ui/proc-macro/nonterminal-token-hygiene.rs+1| ... | ... | @@ -8,6 +8,7 @@ |
| 8 | 8 | //@ normalize-stdout: "expn\d{3,}" -> "expnNNN" |
| 9 | 9 | //@ normalize-stdout: "extern crate compiler_builtins /\* \d+ \*/" -> "extern crate compiler_builtins /* NNN */" |
| 10 | 10 | //@ proc-macro: test-macros.rs |
| 11 | //@ edition: 2015 | |
| 11 | 12 | |
| 12 | 13 | #![feature(decl_macro)] |
| 13 | 14 | #![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 [ |
| 5 | 5 | stream: TokenStream [ |
| 6 | 6 | Ident { |
| 7 | 7 | 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), | |
| 9 | 9 | }, |
| 10 | 10 | Ident { |
| 11 | 11 | 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), | |
| 13 | 13 | }, |
| 14 | 14 | Punct { |
| 15 | 15 | ch: ';', |
| 16 | 16 | 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), | |
| 18 | 18 | }, |
| 19 | 19 | ], |
| 20 | span: $DIR/nonterminal-token-hygiene.rs:22:27: 22:32 (#4), | |
| 20 | span: $DIR/nonterminal-token-hygiene.rs:23:27: 23:32 (#4), | |
| 21 | 21 | }, |
| 22 | 22 | ] |
| 23 | 23 | #![feature /* 0#0 */(prelude_import)] |
| ... | ... | @@ -32,6 +32,7 @@ PRINT-BANG INPUT (DEBUG): TokenStream [ |
| 32 | 32 | //@ normalize-stdout: "expn\d{3,}" -> "expnNNN" |
| 33 | 33 | //@ normalize-stdout: "extern crate compiler_builtins /\* \d+ \*/" -> "extern crate compiler_builtins /* NNN */" |
| 34 | 34 | //@ proc-macro: test-macros.rs |
| 35 | //@ edition: 2015 | |
| 35 | 36 | |
| 36 | 37 | #![feature /* 0#0 */(decl_macro)] |
| 37 | 38 | #![no_std /* 0#0 */] |
tests/ui/proc-macro/quote/debug.rs+1| ... | ... | @@ -3,6 +3,7 @@ |
| 3 | 3 | //@ no-prefer-dynamic |
| 4 | 4 | //@ compile-flags: -Z unpretty=expanded |
| 5 | 5 | //@ needs-unwind compiling proc macros with panic=abort causes a warning |
| 6 | //@ edition: 2015 | |
| 6 | 7 | // |
| 7 | 8 | // This file is not actually used as a proc-macro - instead, |
| 8 | 9 | // it's just used to show the output of the `quote!` macro |
tests/ui/proc-macro/quote/debug.stdout+1| ... | ... | @@ -5,6 +5,7 @@ |
| 5 | 5 | //@ no-prefer-dynamic |
| 6 | 6 | //@ compile-flags: -Z unpretty=expanded |
| 7 | 7 | //@ needs-unwind compiling proc macros with panic=abort causes a warning |
| 8 | //@ edition: 2015 | |
| 8 | 9 | // |
| 9 | 10 | // This file is not actually used as a proc-macro - instead, |
| 10 | 11 | // 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 | ||
| 5 | pub enum Void {} | |
| 6 | ||
| 7 | pub struct S<T>(T); | |
| 8 | ||
| 9 | pub 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 | ||
| 16 | fn main() {} |
tests/ui/rfcs/rfc-2294-if-let-guard/feature-gate.rs+1-1| ... | ... | @@ -64,7 +64,7 @@ fn _macros() { |
| 64 | 64 | //~^ ERROR expected expression, found `let` statement |
| 65 | 65 | //~| ERROR expected expression, found `let` statement |
| 66 | 66 | match () { |
| 67 | #[cfg(FALSE)] | |
| 67 | #[cfg(false)] | |
| 68 | 68 | () if let 0 = 1 => {} |
| 69 | 69 | //~^ ERROR `if let` guards are experimental |
| 70 | 70 | _ => {} |
tests/ui/rfcs/rfc-2294-if-let-guard/parens.rs+1-1| ... | ... | @@ -3,7 +3,7 @@ |
| 3 | 3 | #![feature(if_let_guard)] |
| 4 | 4 | #![feature(let_chains)] |
| 5 | 5 | |
| 6 | #[cfg(FALSE)] | |
| 6 | #[cfg(false)] | |
| 7 | 7 | fn un_cfged() { |
| 8 | 8 | match () { |
| 9 | 9 | () if let 0 = 1 => {} |
tests/ui/rfcs/rfc-2497-if-let-chains/ast-pretty-check.rs+1| ... | ... | @@ -1,5 +1,6 @@ |
| 1 | 1 | //@ check-pass |
| 2 | 2 | //@ compile-flags: -Z unpretty=expanded |
| 3 | //@ edition: 2015 | |
| 3 | 4 | |
| 4 | 5 | fn main() { |
| 5 | 6 | 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::*; |
| 6 | 6 | extern crate std; |
| 7 | 7 | //@ check-pass |
| 8 | 8 | //@ compile-flags: -Z unpretty=expanded |
| 9 | //@ edition: 2015 | |
| 9 | 10 | |
| 10 | 11 | fn 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() { |
| 340 | 340 | //~| ERROR expected expression, found `let` statement |
| 341 | 341 | |
| 342 | 342 | { |
| 343 | #[cfg(FALSE)] | |
| 343 | #[cfg(false)] | |
| 344 | 344 | let x = true && let y = 1; |
| 345 | 345 | //~^ ERROR expected expression, found `let` statement |
| 346 | 346 | } |
| 347 | 347 | |
| 348 | #[cfg(FALSE)] | |
| 348 | #[cfg(false)] | |
| 349 | 349 | { |
| 350 | 350 | [1, 2, 3][let _ = ()] |
| 351 | 351 | //~^ ERROR expected expression, found `let` statement |
| ... | ... | @@ -436,11 +436,11 @@ fn with_parenthesis() { |
| 436 | 436 | //[no_feature]~^ ERROR `let` expressions in this position are unstable |
| 437 | 437 | } |
| 438 | 438 | |
| 439 | #[cfg(FALSE)] | |
| 439 | #[cfg(false)] | |
| 440 | 440 | let x = (true && let y = 1); |
| 441 | 441 | //~^ ERROR expected expression, found `let` statement |
| 442 | 442 | |
| 443 | #[cfg(FALSE)] | |
| 443 | #[cfg(false)] | |
| 444 | 444 | { |
| 445 | 445 | ([1, 2, 3][let _ = ()]) |
| 446 | 446 | //~^ 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() { |
| 51 | 51 | while $e {} |
| 52 | 52 | } |
| 53 | 53 | } |
| 54 | #[cfg(FALSE)] (let 0 = 1); | |
| 54 | #[cfg(false)] (let 0 = 1); | |
| 55 | 55 | //~^ ERROR expected expression, found `let` statement |
| 56 | 56 | use_expr!(let 0 = 1); |
| 57 | 57 | //~^ ERROR no rules expected keyword `let` |
tests/ui/rfcs/rfc-2497-if-let-chains/feature-gate.stderr+1-1| ... | ... | @@ -1,7 +1,7 @@ |
| 1 | 1 | error: expected expression, found `let` statement |
| 2 | 2 | --> $DIR/feature-gate.rs:54:20 |
| 3 | 3 | | |
| 4 | LL | #[cfg(FALSE)] (let 0 = 1); | |
| 4 | LL | #[cfg(false)] (let 0 = 1); | |
| 5 | 5 | | ^^^ |
| 6 | 6 | | |
| 7 | 7 | = 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 @@ |
| 3 | 3 | fn main() { |
| 4 | 4 | let _opt = Some(1i32); |
| 5 | 5 | |
| 6 | #[cfg(FALSE)] | |
| 6 | #[cfg(false)] | |
| 7 | 7 | { |
| 8 | 8 | let _ = &&let Some(x) = Some(42); |
| 9 | 9 | //~^ ERROR expected expression, found `let` statement |
| 10 | 10 | } |
| 11 | #[cfg(FALSE)] | |
| 11 | #[cfg(false)] | |
| 12 | 12 | { |
| 13 | 13 | if let Some(elem) = _opt && [1, 2, 3][let _ = &&let Some(x) = Some(42)] = 1 { |
| 14 | 14 | //~^ ERROR expected expression, found `let` statement |
| ... | ... | @@ -18,7 +18,7 @@ fn main() { |
| 18 | 18 | } |
| 19 | 19 | } |
| 20 | 20 | |
| 21 | #[cfg(FALSE)] | |
| 21 | #[cfg(false)] | |
| 22 | 22 | { |
| 23 | 23 | if let Some(elem) = _opt && { |
| 24 | 24 | [1, 2, 3][let _ = ()]; |
| ... | ... | @@ -28,7 +28,7 @@ fn main() { |
| 28 | 28 | } |
| 29 | 29 | } |
| 30 | 30 | |
| 31 | #[cfg(FALSE)] | |
| 31 | #[cfg(false)] | |
| 32 | 32 | { |
| 33 | 33 | if let Some(elem) = _opt && [1, 2, 3][let _ = ()] = 1 { |
| 34 | 34 | //~^ ERROR expected expression, found `let` statement |
| ... | ... | @@ -36,7 +36,7 @@ fn main() { |
| 36 | 36 | true |
| 37 | 37 | } |
| 38 | 38 | } |
| 39 | #[cfg(FALSE)] | |
| 39 | #[cfg(false)] | |
| 40 | 40 | { |
| 41 | 41 | if let a = 1 && { |
| 42 | 42 | 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)] | |
| 2 | 2 | impl S { |
| 3 | 3 | fn f(#[attr]) {} //~ ERROR expected parameter name, found `)` |
| 4 | 4 | } |
| 5 | 5 | |
| 6 | #[cfg(FALSE)] | |
| 6 | #[cfg(false)] | |
| 7 | 7 | impl T for S { |
| 8 | 8 | fn f(#[attr]) {} //~ ERROR expected parameter name, found `)` |
| 9 | 9 | } |
| 10 | 10 | |
| 11 | #[cfg(FALSE)] | |
| 11 | #[cfg(false)] | |
| 12 | 12 | trait T { |
| 13 | 13 | fn f(#[attr]); //~ ERROR expected argument name, found `)` |
| 14 | 14 | } |
tests/ui/specialization/issue-63716-parse-async.rs+1-1| ... | ... | @@ -8,7 +8,7 @@ |
| 8 | 8 | |
| 9 | 9 | fn main() {} |
| 10 | 10 | |
| 11 | #[cfg(FALSE)] | |
| 11 | #[cfg(false)] | |
| 12 | 12 | impl Foo for Bar { |
| 13 | 13 | default async fn baz() {} |
| 14 | 14 | } |
tests/ui/suggestions/const-no-type.rs+3-3| ... | ... | @@ -10,19 +10,19 @@ fn main() {} |
| 10 | 10 | |
| 11 | 11 | // These will not reach typeck: |
| 12 | 12 | |
| 13 | #[cfg(FALSE)] | |
| 13 | #[cfg(false)] | |
| 14 | 14 | const C2 = 42; |
| 15 | 15 | //~^ ERROR missing type for `const` item |
| 16 | 16 | //~| HELP provide a type for the item |
| 17 | 17 | //~| SUGGESTION : <type> |
| 18 | 18 | |
| 19 | #[cfg(FALSE)] | |
| 19 | #[cfg(false)] | |
| 20 | 20 | static S2 = "abc"; |
| 21 | 21 | //~^ ERROR missing type for `static` item |
| 22 | 22 | //~| HELP provide a type for the item |
| 23 | 23 | //~| SUGGESTION : <type> |
| 24 | 24 | |
| 25 | #[cfg(FALSE)] | |
| 25 | #[cfg(false)] | |
| 26 | 26 | static mut SM2 = "abc"; |
| 27 | 27 | //~^ ERROR missing type for `static mut` item |
| 28 | 28 | //~| HELP provide a type for the item |
tests/ui/suggestions/type-ascription-and-other-error.rs+1-1| ... | ... | @@ -1,6 +1,6 @@ |
| 1 | 1 | fn main() { |
| 2 | 2 | not rust; //~ ERROR |
| 3 | 3 | let _ = 0: i32; // (error hidden by existing error) |
| 4 | #[cfg(FALSE)] | |
| 4 | #[cfg(false)] | |
| 5 | 5 | let _ = 0: i32; // (warning hidden by existing error) |
| 6 | 6 | } |
tests/ui/type-alias-impl-trait/issue-60662.rs+1| ... | ... | @@ -1,5 +1,6 @@ |
| 1 | 1 | //@ check-pass |
| 2 | 2 | //@ compile-flags: -Z unpretty=hir |
| 3 | //@ edition: 2015 | |
| 3 | 4 | |
| 4 | 5 | #![feature(type_alias_impl_trait)] |
| 5 | 6 |
tests/ui/type-alias-impl-trait/issue-60662.stdout+1| ... | ... | @@ -1,5 +1,6 @@ |
| 1 | 1 | //@ check-pass |
| 2 | 2 | //@ compile-flags: -Z unpretty=hir |
| 3 | //@ edition: 2015 | |
| 3 | 4 | |
| 4 | 5 | #![feature(type_alias_impl_trait)] |
| 5 | 6 | #[prelude_import] |
tests/ui/unpretty/bad-literal.rs+1| ... | ... | @@ -1,5 +1,6 @@ |
| 1 | 1 | //@ compile-flags: -Zunpretty=hir |
| 2 | 2 | //@ check-fail |
| 3 | //@ edition: 2015 | |
| 3 | 4 | |
| 4 | 5 | // In #100948 this caused an ICE with -Zunpretty=hir. |
| 5 | 6 | fn main() { |
tests/ui/unpretty/bad-literal.stderr+1-1| ... | ... | @@ -1,5 +1,5 @@ |
| 1 | 1 | error: invalid suffix `u` for number literal |
| 2 | --> $DIR/bad-literal.rs:6:5 | |
| 2 | --> $DIR/bad-literal.rs:7:5 | |
| 3 | 3 | | |
| 4 | 4 | LL | 1u; |
| 5 | 5 | | ^^ invalid suffix `u` |
tests/ui/unpretty/bad-literal.stdout+1| ... | ... | @@ -4,6 +4,7 @@ use ::std::prelude::rust_2015::*; |
| 4 | 4 | extern crate std; |
| 5 | 5 | //@ compile-flags: -Zunpretty=hir |
| 6 | 6 | //@ check-fail |
| 7 | //@ edition: 2015 | |
| 7 | 8 | |
| 8 | 9 | // In #100948 this caused an ICE with -Zunpretty=hir. |
| 9 | 10 | fn main() { |
tests/ui/unpretty/debug-fmt-hir.rs+1| ... | ... | @@ -1,5 +1,6 @@ |
| 1 | 1 | //@ compile-flags: -Zunpretty=hir |
| 2 | 2 | //@ check-pass |
| 3 | //@ edition: 2015 | |
| 3 | 4 | |
| 4 | 5 | use std::fmt; |
| 5 | 6 |
tests/ui/unpretty/debug-fmt-hir.stdout+1| ... | ... | @@ -4,6 +4,7 @@ use ::std::prelude::rust_2015::*; |
| 4 | 4 | extern crate std; |
| 5 | 5 | //@ compile-flags: -Zunpretty=hir |
| 6 | 6 | //@ check-pass |
| 7 | //@ edition: 2015 | |
| 7 | 8 | |
| 8 | 9 | use std::fmt; |
| 9 | 10 |
tests/ui/unpretty/deprecated-attr.rs+1| ... | ... | @@ -1,5 +1,6 @@ |
| 1 | 1 | //@ compile-flags: -Zunpretty=hir |
| 2 | 2 | //@ check-pass |
| 3 | //@ edition: 2015 | |
| 3 | 4 | |
| 4 | 5 | #[deprecated] |
| 5 | 6 | pub struct PlainDeprecated; |
tests/ui/unpretty/deprecated-attr.stdout+1| ... | ... | @@ -4,6 +4,7 @@ use ::std::prelude::rust_2015::*; |
| 4 | 4 | extern crate std; |
| 5 | 5 | //@ compile-flags: -Zunpretty=hir |
| 6 | 6 | //@ check-pass |
| 7 | //@ edition: 2015 | |
| 7 | 8 | |
| 8 | 9 | #[attr = Deprecation {deprecation: Deprecation {since: Unspecified}}] |
| 9 | 10 | struct PlainDeprecated; |
tests/ui/unpretty/diagnostic-attr.rs+1| ... | ... | @@ -1,5 +1,6 @@ |
| 1 | 1 | //@ compile-flags: -Zunpretty=hir |
| 2 | 2 | //@ check-pass |
| 3 | //@ edition: 2015 | |
| 3 | 4 | |
| 4 | 5 | #[diagnostic::on_unimplemented( |
| 5 | 6 | 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::*; |
| 4 | 4 | extern crate std; |
| 5 | 5 | //@ compile-flags: -Zunpretty=hir |
| 6 | 6 | //@ check-pass |
| 7 | //@ edition: 2015 | |
| 7 | 8 | |
| 8 | 9 | #[diagnostic::on_unimplemented(message = |
| 9 | 10 | "My Message for `ImportantTrait<{A}>` implemented for `{Self}`", label = |
tests/ui/unpretty/expanded-interpolation.rs+1| ... | ... | @@ -1,5 +1,6 @@ |
| 1 | 1 | //@ compile-flags: -Zunpretty=expanded |
| 2 | 2 | //@ check-pass |
| 3 | //@ edition: 2015 | |
| 3 | 4 | |
| 4 | 5 | // This test covers the AST pretty-printer's insertion of parentheses in some |
| 5 | 6 | // macro metavariable edge cases. Synthetic parentheses (i.e. not appearing in |
tests/ui/unpretty/expanded-interpolation.stdout+1| ... | ... | @@ -2,6 +2,7 @@ |
| 2 | 2 | #![no_std] |
| 3 | 3 | //@ compile-flags: -Zunpretty=expanded |
| 4 | 4 | //@ check-pass |
| 5 | //@ edition: 2015 | |
| 5 | 6 | |
| 6 | 7 | // This test covers the AST pretty-printer's insertion of parentheses in some |
| 7 | 8 | // macro metavariable edge cases. Synthetic parentheses (i.e. not appearing in |
tests/ui/unpretty/flattened-format-args.rs+1| ... | ... | @@ -1,5 +1,6 @@ |
| 1 | 1 | //@ compile-flags: -Zunpretty=hir -Zflatten-format-args=yes |
| 2 | 2 | //@ check-pass |
| 3 | //@ edition: 2015 | |
| 3 | 4 | |
| 4 | 5 | fn main() { |
| 5 | 6 | let x = 1; |
tests/ui/unpretty/flattened-format-args.stdout+1| ... | ... | @@ -4,6 +4,7 @@ use ::std::prelude::rust_2015::*; |
| 4 | 4 | extern crate std; |
| 5 | 5 | //@ compile-flags: -Zunpretty=hir -Zflatten-format-args=yes |
| 6 | 6 | //@ check-pass |
| 7 | //@ edition: 2015 | |
| 7 | 8 | |
| 8 | 9 | fn main() { |
| 9 | 10 | let x = 1; |
tests/ui/unpretty/let-else-hir.rs+1| ... | ... | @@ -1,5 +1,6 @@ |
| 1 | 1 | //@ compile-flags: -Zunpretty=hir |
| 2 | 2 | //@ check-pass |
| 3 | //@ edition: 2015 | |
| 3 | 4 | |
| 4 | 5 | |
| 5 | 6 |
tests/ui/unpretty/let-else-hir.stdout+1| ... | ... | @@ -4,6 +4,7 @@ use ::std::prelude::rust_2015::*; |
| 4 | 4 | extern crate std; |
| 5 | 5 | //@ compile-flags: -Zunpretty=hir |
| 6 | 6 | //@ check-pass |
| 7 | //@ edition: 2015 | |
| 7 | 8 | |
| 8 | 9 | |
| 9 | 10 |
tests/ui/unpretty/self-hir.rs+1| ... | ... | @@ -1,5 +1,6 @@ |
| 1 | 1 | //@ compile-flags: -Zunpretty=hir |
| 2 | 2 | //@ check-pass |
| 3 | //@ edition: 2015 | |
| 3 | 4 | |
| 4 | 5 | pub struct Bar { |
| 5 | 6 | a: String, |
tests/ui/unpretty/self-hir.stdout+1| ... | ... | @@ -4,6 +4,7 @@ use ::std::prelude::rust_2015::*; |
| 4 | 4 | extern crate std; |
| 5 | 5 | //@ compile-flags: -Zunpretty=hir |
| 6 | 6 | //@ check-pass |
| 7 | //@ edition: 2015 | |
| 7 | 8 | |
| 8 | 9 | struct Bar { |
| 9 | 10 | a: String, |
tests/ui/unpretty/unpretty-expr-fn-arg.rs+1| ... | ... | @@ -6,6 +6,7 @@ |
| 6 | 6 | |
| 7 | 7 | //@ check-pass |
| 8 | 8 | //@ compile-flags: -Zunpretty=hir,typed |
| 9 | //@ edition: 2015 | |
| 9 | 10 | #![allow(dead_code)] |
| 10 | 11 | |
| 11 | 12 | fn main() {} |
tests/ui/unpretty/unpretty-expr-fn-arg.stdout+1| ... | ... | @@ -6,6 +6,7 @@ |
| 6 | 6 | |
| 7 | 7 | //@ check-pass |
| 8 | 8 | //@ compile-flags: -Zunpretty=hir,typed |
| 9 | //@ edition: 2015 | |
| 9 | 10 | #![allow(dead_code)] |
| 10 | 11 | #[prelude_import] |
| 11 | 12 | use ::std::prelude::rust_2015::*; |
tests/ui/wasm/wasm-import-module.rs+1-1| ... | ... | @@ -15,7 +15,7 @@ extern "C" {} |
| 15 | 15 | #[link(wasm_import_module = "foo", kind = "dylib")] //~ ERROR: `wasm_import_module` is incompatible with other arguments |
| 16 | 16 | extern "C" {} |
| 17 | 17 | |
| 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 | |
| 19 | 19 | extern "C" {} |
| 20 | 20 | |
| 21 | 21 | fn main() {} |
tests/ui/wasm/wasm-import-module.stderr+1-1| ... | ... | @@ -31,7 +31,7 @@ LL | #[link(wasm_import_module = "foo", kind = "dylib")] |
| 31 | 31 | error: `wasm_import_module` is incompatible with other arguments in `#[link]` attributes |
| 32 | 32 | --> $DIR/wasm-import-module.rs:18:8 |
| 33 | 33 | | |
| 34 | LL | #[link(wasm_import_module = "foo", cfg(FALSE))] | |
| 34 | LL | #[link(wasm_import_module = "foo", cfg(false))] | |
| 35 | 35 | | ^^^^^^^^^^^^^^^^^^^^^^^^^^ |
| 36 | 36 | |
| 37 | 37 | error: aborting due to 6 previous errors |