diff --git a/compiler/rustc_interface/src/interface.rs b/compiler/rustc_interface/src/interface.rs index fa4d4588caab4..a20aa317e06a4 100644 --- a/compiler/rustc_interface/src/interface.rs +++ b/compiler/rustc_interface/src/interface.rs @@ -6,7 +6,6 @@ use rustc_ast::{LitKind, MetaItemKind, token}; use rustc_codegen_ssa::traits::CodegenBackend; use rustc_data_structures::fx::{FxHashMap, FxHashSet}; use rustc_data_structures::jobserver::{self, Proxy}; -use rustc_data_structures::stable_hasher::StableHasher; use rustc_errors::{DiagCtxtHandle, ErrorGuaranteed}; use rustc_lint::LintStore; use rustc_middle::ty; @@ -339,11 +338,7 @@ pub struct Config { /// This is a callback to track otherwise untracked state used by the caller. /// /// You can write to `sess.env_depinfo` and `sess.file_depinfo` to track env vars and files. - /// To track any other state you can write to the given hasher. If the hash changes between - /// runs the incremental cache will be cleared. - /// - /// The hashing functionality has no known user. FIXME should this be removed? - pub track_state: Option>, + pub track_state: Option>, /// This is a callback from the driver that is called when we're registering lints; /// it is called during lint loading when we have the LintStore in a non-shared state. @@ -468,9 +463,7 @@ pub fn run_compiler(config: Config, f: impl FnOnce(&Compiler) -> R + Se } if let Some(track_state) = config.track_state { - let mut hasher = StableHasher::new(); - track_state(&sess, &mut hasher); - sess.opts.untracked_state_hash = hasher.finish() + track_state(&sess); } // Even though the session holds the lint store, we can't build the diff --git a/compiler/rustc_session/src/config.rs b/compiler/rustc_session/src/config.rs index 81ccfcc434547..d84bfeb8fff86 100644 --- a/compiler/rustc_session/src/config.rs +++ b/compiler/rustc_session/src/config.rs @@ -1419,7 +1419,6 @@ impl Default for Options { target_triple: TargetTuple::from_tuple(host_tuple()), test: false, incremental: None, - untracked_state_hash: Default::default(), unstable_opts, prints: Vec::new(), cg: Default::default(), @@ -2770,7 +2769,6 @@ pub fn build_session_options(early_dcx: &mut EarlyDiagCtxt, matches: &getopts::M target_triple, test, incremental, - untracked_state_hash: Default::default(), unstable_opts, prints, cg, diff --git a/compiler/rustc_session/src/options.rs b/compiler/rustc_session/src/options.rs index ef3e061e78a5f..2a2d46615e2e7 100644 --- a/compiler/rustc_session/src/options.rs +++ b/compiler/rustc_session/src/options.rs @@ -332,10 +332,6 @@ top_level_options!( /// If `Some`, enable incremental compilation, using the given /// directory to store intermediate results. incremental: Option [UNTRACKED], - /// Set based on the result of the `Config::track_state` callback - /// for custom drivers to invalidate the incremental cache. - #[rustc_lint_opt_deny_field_access("should only be used via `Config::track_state`")] - untracked_state_hash: Hash64 [TRACKED_NO_CRATE_HASH], unstable_opts: UnstableOptions [SUBSTRUCT] { TARGET_MODIFIER: UnstableOptions(UnstableOptionsTargetModifiers) }, prints: Vec [UNTRACKED], diff --git a/library/std/src/fs.rs b/library/std/src/fs.rs index c75f005f18021..5192343ea4300 100644 --- a/library/std/src/fs.rs +++ b/library/std/src/fs.rs @@ -132,6 +132,7 @@ use crate::{error, fmt}; /// [`read`]: File::read #[stable(feature = "rust1", since = "1.0.0")] #[cfg_attr(not(test), rustc_diagnostic_item = "File")] +#[diagnostic::on_move(note = "you can use `File::try_clone` to duplicate a `File` instance")] pub struct File { inner: fs_imp::File, } diff --git a/library/std/src/lib.rs b/library/std/src/lib.rs index 807befec1ad11..8f83fede1edd2 100644 --- a/library/std/src/lib.rs +++ b/library/std/src/lib.rs @@ -278,6 +278,7 @@ #![feature(const_trait_impl)] #![feature(decl_macro)] #![feature(deprecated_suggestion)] +#![feature(diagnostic_on_move)] #![feature(doc_cfg)] #![feature(doc_masked)] #![feature(doc_notable_trait)] diff --git a/src/doc/rustc-dev-guide/examples/rustc-interface-example.rs b/src/doc/rustc-dev-guide/examples/rustc-interface-example.rs index b4439504650a1..4601d9adbb640 100644 --- a/src/doc/rustc-dev-guide/examples/rustc-interface-example.rs +++ b/src/doc/rustc-dev-guide/examples/rustc-interface-example.rs @@ -50,7 +50,7 @@ fn main() { make_codegen_backend: None, expanded_args: Vec::new(), ice_file: None, - hash_untracked_state: None, + track_state: None, using_internal_features: &rustc_driver::USING_INTERNAL_FEATURES, }; rustc_interface::run_compiler(config, |compiler| { @@ -72,4 +72,4 @@ fn main() { } }); }); -} \ No newline at end of file +} diff --git a/src/doc/rustc-dev-guide/examples/rustc-interface-getting-diagnostics.rs b/src/doc/rustc-dev-guide/examples/rustc-interface-getting-diagnostics.rs index 342316ba670af..ea2a772703bbd 100644 --- a/src/doc/rustc-dev-guide/examples/rustc-interface-getting-diagnostics.rs +++ b/src/doc/rustc-dev-guide/examples/rustc-interface-getting-diagnostics.rs @@ -78,7 +78,7 @@ fn main() { make_codegen_backend: None, expanded_args: Vec::new(), ice_file: None, - hash_untracked_state: None, + track_state: None, using_internal_features: &rustc_driver::USING_INTERNAL_FEATURES, }; rustc_interface::run_compiler(config, |compiler| { @@ -97,4 +97,4 @@ fn main() { buffer.lock().unwrap().iter().for_each(|diagnostic| { println!("{diagnostic:#?}"); }); -} \ No newline at end of file +} diff --git a/src/doc/rustc/src/platform-support/armv7a-vex-v5.md b/src/doc/rustc/src/platform-support/armv7a-vex-v5.md index 611ec04b42c8a..8c192c6dbdf69 100644 --- a/src/doc/rustc/src/platform-support/armv7a-vex-v5.md +++ b/src/doc/rustc/src/platform-support/armv7a-vex-v5.md @@ -4,14 +4,14 @@ Allows compiling user programs for the [VEX V5 Brain](https://www.vexrobotics.com/276-4810.html), a microcontroller for educational and competitive robotics. -Rust support for this target is not affiliated with VEX Robotics or IFI, and does not link to any official VEX SDK. +Rust support for this target is not affiliated with VEX Robotics or IFI, and does not link against any official VEX SDK. ## Target maintainers This target is maintained by members of the [vexide](https://github.com/vexide) organization: - [@lewisfm](https://github.com/lewisfm) -- [@Tropix126](https://github.com/Tropix126) +- [@tropicaaal](https://github.com/tropicaaal) - [@Gavin-Niederman](https://github.com/Gavin-Niederman) - [@max-niederman](https://github.com/max-niederman) @@ -22,27 +22,37 @@ This target is cross-compiled. Dynamic linking is unsupported. `#![no_std]` crates can be built using `build-std` to build `core` and `panic_abort` and optionally `alloc`. Unwinding panics are not yet supported on this target. `std` has only partial support due to platform limitations. Notably: + - `std::process` and `std::net` are unimplemented. `std::thread` only supports sleeping and yielding, as this is a single-threaded environment. - `std::time` has full support for `Instant`, but no support for `SystemTime`. - `std::io` has full support for `stdin`/`stdout`/`stderr`. `stdout` and `stderr` both write to USB channel 1 on this platform and are not differentiated. -- `std::fs` has limited support for reading or writing to files. Directory operations, file deletion, and some file opening features are unsupported and will return errors. +- `std::fs` has limited support for reading or writing to files. The following features are unsupported: + - All directory operations (including `mkdir` and `readdir`), although reading directories is possible through [third-party crates](https://docs.rs/vex-sdk/latest/vex_sdk/file/fn.vexFileDirectoryGet.html) + - Deleting files and directories + - File metadata other than file size and type (that is, file vs. directory) + - Opening files with an uncommon combination of open options, such as read + write at the same time. + The supported modes for opening files are in read-only mode, append mode, or write mode (with or without truncation). - A global allocator implemented on top of `dlmalloc` is provided. -- Modules that do not need to interact with the OS beyond allocation such as `std::collections`, `std::hash`, `std::future`, `std::sync`, etc are fully supported. +- Modules that do not need to interact with the OS beyond allocation, such as `std::collections`, `std::hash`, `std::future`, `std::sync`, etc., are fully supported. - Random number generation and hashing is insecure, as there is no reliable source of entropy on this platform. -In order to support some APIs, users are expected to provide a supporting runtime SDK for `libstd` to link against. This library may be provided either by [`vex-sdk-build`](https://github.com/vexide/vex-sdk/tree/main/packages/vex-sdk-build) (which will download an official SDK from VEX) or through an open-source implementation such as [`vex-sdk-jumptable`](https://crates.io/crates/vex-sdk-jumptable). - When compiling for this target, the "C" calling convention maps to AAPCS with VFP registers (hard float ABI) and the "system" calling convention maps to AAPCS without VFP registers (softfp ABI). This target generates binaries in the ELF format that may be uploaded to the brain with external tools. +### Platform SDKs + +To use most platform-specific APIs, users must configure a supporting runtime SDK for `libstd` to link against. Official *VEXcode* SDKs from VEX can be downloaded and linked via the [`vex-sdk-vexcode`](https://crates.io/crates/vex-sdk-vexcode) crate, but they have a restrictive redistribution policy that might not be suitable for all projects. The suggested SDK for open-source projects is the community-supported [`vex-sdk-jumptable`](https://crates.io/crates/vex-sdk-jumptable) crate. SDK implementations are generally thin wrappers over system calls, so projects should not expect to see significant differences in behavior depending on which SDK they use. + +Libraries may access symbols from the active VEX SDK without depending on a specific implementation by using the [`vex-sdk`](https://crates.io/crates/vex-sdk) crate. + ## Building the target You can build Rust with support for this target by adding it to the `target` list in `bootstrap.toml`, and then running `./x build --target armv7a-vex-v5 compiler`. ## Building Rust programs -Rust does not yet ship pre-compiled artifacts for this target. To compile for this target, you will either need to build Rust with the target enabled (see "Building the target" above), or build your own copy of `core` by using `build-std` or similar. +Rust does not yet ship pre-compiled artifacts for this target. To compile for this target, you will either need to build Rust with the target enabled (see "Building the target" above), or build your own copy of `std` using `build-std` or similar. When the compiler builds a binary, an ELF build artifact will be produced. Additional tools are required for this artifact to be recognizable to VEXos as a user program. @@ -78,9 +88,19 @@ Programs can also be directly uploaded to the brain over a USB connection immedi cargo v5 upload --release ``` +### Hello World program + +```rs +use ::vex_sdk_jumptable as _; // Bring VEX SDK symbols into scope + +fn main() { + println!("Hello, world"); +} +``` + ## Testing -Binaries built for this target can be run in an emulator (such as [vex-v5-qemu](https://github.com/vexide/vex-v5-qemu)), or uploaded to a physical device over a serial (USB) connection. +Binaries built for this target can be run in an emulator (such as [vex-v5-qemu](https://github.com/vexide/vex-v5-qemu)), or uploaded to a physical device over a USB serial connection. The default Rust test runner is not supported. @@ -90,4 +110,69 @@ The Rust test suite for `library/std` is not yet supported. This target can be cross-compiled from any host. -Linking to C libraries is not supported. +The recommended configuration for compiling compatible C code is to use the [Arm Toolchain for Embedded](https://github.com/arm/arm-toolchain/tree/arm-software/arm-software/embedded#readme) with the following compilation flags: + +```sh +clang --target=arm-none-eabi -mcpu=cortex-a9 -mfpu=neon -mfloat-abi=hard -fno-pic -fno-exceptions -fno-rtti -funwind-tables +``` + +The following Cargo configuration can be used to link with picolibc (the libc used by the Arm Toolchain for Embedded): + +```toml +[target.armv7a-vex-v5] +# We use ARM Clang as a linker because ld.lld by itself doesn't include the +# multilib logic for resolving static libraries. +linker = "clang" + +rustflags = [ + # These link flags resolve to this sysroot: + # `…/arm-none-eabi/armv7a_hard_vfpv3_d16_unaligned` + # (hard float / VFP version 3 with 16 regs / unaligned access) + "-Clink-arg=--target=armv7a-none-eabihf", + + # To disable crt0 and use Rust's _boot implementation + # (or something custom): + #"-Clink-arg=-nostartfiles", + + # Explicit `-lc` required because Rust calls the linker with + # `-nodefaultlibs` which disables libc, libm, etc. + "-Clink-arg=-lc", +] +``` + +You may also want to set these environment variables so that third-party crates use the correct C compiler: + +```sh +PATH=/path/to/arm-toolchain/bin:$PATH +CC_armv7a_vex_v5=clang +AR_armv7a_vex_v5=clang +CFLAGS_armv7a_vex_v5=[See above] +``` + +### CMake + +It may be helpful to create a CMake toolchain like the following if you are depending on the `cmake` crate: + +```cmake +# toolchain.cmake +set(CMAKE_SYSTEM_NAME Generic) +set(CMAKE_SYSTEM_PROCESSOR arm) + +set(triple armv7a-none-eabihf) + +set(CMAKE_C_COMPILER clang) +set(CMAKE_C_COMPILER_TARGET ${triple}) +set(CMAKE_CXX_COMPILER clang++) +set(CMAKE_CXX_COMPILER_TARGET ${triple}) +set(CMAKE_TRY_COMPILE_TARGET_TYPE "STATIC_LIBRARY") +``` + +You can enable it by setting the following environment variable alongside the previously mentioned environment variables: + +```sh +CMAKE_TOOLCHAIN_FILE_armv7a_vex_v5=/path/to/toolchain.cmake +``` + +### Implementation of libc functions + +You may have to implement [certain system support functions](https://github.com/picolibc/picolibc/blob/main/doc/os.md) for some parts of libc to work properly. diff --git a/src/doc/unstable-book/src/language-features/diagnostic-on-move.md b/src/doc/unstable-book/src/language-features/diagnostic-on-move.md new file mode 100644 index 0000000000000..ba35b07361416 --- /dev/null +++ b/src/doc/unstable-book/src/language-features/diagnostic-on-move.md @@ -0,0 +1,92 @@ +# `diagnostic_on_move` + +The tracking issue for this feature is: [#154181] + +------------------------ + +The `diagnostic_on_move` feature allows use of the `#[diagnostic::on_move]` attribute. It should be +placed on struct, enum and union declarations, though it is not an error to be located in other +positions. This attribute is a hint to the compiler to supplement the error message when the +annotated type is involved in a borrowcheck error. + +For example, [`File`] is annotated as such: +```rust +#![feature(diagnostic_on_move)] + +#[diagnostic::on_move(note = "you can use `File::try_clone` \ + to duplicate a `File` instance")] +pub struct File { + // ... +} +``` + +When you try to use a `File` after it's already been moved, it will helpfully tell you about `try_clone`. + +The message and label can also be customized: + +```rust +#![feature(diagnostic_on_move)] + +use std::marker::PhantomData; + +#[diagnostic::on_move( + message = "`{Self}` cannot be used multiple times", + label = "this token may only be used once", + note = "you can create a new `Token` with `Token::conjure()`" +)] +pub struct Token<'brand> { + spooky: PhantomData<&'brand ()>, +} + +impl Token<'_> { + pub fn conjure<'u>() -> Token<'u> { + Token { + spooky: PhantomData, + } + } +} +``` +The user may try to use it like this: +```rust,compile_fail,E0382 +# #![feature(diagnostic_on_move)] +# +# use std::marker::PhantomData; +# +# #[diagnostic::on_move( +# message = "`{Self}` cannot be used multiple times", +# label = "this token may only be used once", +# note = "you can create a new `Token` with `Token::conjure()`" +# )] +# pub struct Token<'brand> { +# spooky: PhantomData<&'brand ()>, +# } +# +# impl Token<'_> { +# pub fn conjure<'u>() -> Token<'u> { +# Token { +# spooky: PhantomData, +# } +# } +# } +# fn main() { +let token = Token::conjure(); +let _ = (token, token); +# } +``` +This will result in the following error: +```text +error[E0382]: `Token` cannot be used multiple times + --> src/main.rs:24:21 + | + 1 | let token = Token::conjure(); + | ----- this token may only be used once + 2 | let _ = (token, token); + | ----- ^^^^^ value used here after move + | | + | value moved here + | + = note: you can create a new `Token` with `Token::conjure()` +``` + +[`File`]: https://doc.rust-lang.org/nightly/std/fs/struct.File.html "File in std::fs" +[#154181]: https://github.com/rust-lang/rust/issues/154181 "Tracking Issue for #[diagnostic::on_move]" diff --git a/src/etc/lldb_providers.py b/src/etc/lldb_providers.py index 407e87cdf785b..ef3f94ee83530 100644 --- a/src/etc/lldb_providers.py +++ b/src/etc/lldb_providers.py @@ -1,6 +1,6 @@ from __future__ import annotations import sys -from typing import Generator, List, TYPE_CHECKING +from typing import Generator, List, TYPE_CHECKING, Optional from lldb import ( SBData, @@ -112,7 +112,7 @@ def get_child_index(self, name: str) -> int: return self.valobj.Dereference().GetSyntheticValue() return self.valobj.GetIndexOfChildWithName(name) - def get_child_at_index(self, index: int) -> SBValue: + def get_child_at_index(self, index: int) -> Optional[SBValue]: return self.valobj.GetChildAtIndex(index) def update(self): @@ -137,7 +137,7 @@ def get_child_index(self, name: str) -> int: return 0 return -1 - def get_child_at_index(self, index: int) -> SBValue: + def get_child_at_index(self, index: int) -> Optional[SBValue]: if index == 0: return self.valobj.Dereference().GetSyntheticValue() return None @@ -164,7 +164,7 @@ def num_children(self) -> int: def get_child_index(self, name: str) -> int: return -1 - def get_child_at_index(self, index: int) -> SBValue: + def get_child_at_index(self, index: int) -> Optional[SBValue]: return None def update(self): @@ -233,8 +233,6 @@ def resolve_msvc_template_arg(arg_name: str, target: SBTarget) -> SBType: return result.GetPointerType() if arg_name.startswith("array$<"): - arg_name = arg_name[7:-1].strip() - template_args = get_template_args(arg_name) element_name = next(template_args) @@ -425,7 +423,7 @@ def num_children(self) -> int: def get_child_index(self, name: str) -> int: return self.fields.get(name, -1) - def get_child_at_index(self, index: int) -> SBValue: + def get_child_at_index(self, index: int) -> Optional[SBValue]: if self.is_variant: field = self.type.GetFieldAtIndex(index + 1) else: @@ -470,7 +468,7 @@ def get_child_index(self, name: str) -> int: return -1 - def get_child_at_index(self, index: int) -> SBValue: + def get_child_at_index(self, index: int) -> Optional[SBValue]: if not 0 <= index < self.length: return None start = self.data_ptr.GetValueAsUnsigned() @@ -506,7 +504,7 @@ def get_child_index(self, name: str) -> int: return -1 - def get_child_at_index(self, index: int) -> SBValue: + def get_child_at_index(self, index: int) -> Optional[SBValue]: if not 0 <= index < self.length: return None start = self.data_ptr.GetValueAsUnsigned() @@ -562,7 +560,7 @@ def num_children(self) -> int: def get_child_index(self, name: str) -> int: return self.value.GetIndexOfChildWithName(name) - def get_child_at_index(self, index: int) -> SBValue: + def get_child_at_index(self, index: int) -> Optional[SBValue]: return self.value.GetChildAtIndex(index) def update(self): @@ -768,7 +766,7 @@ def num_children(self) -> int: def get_child_index(self, name: str) -> int: return self.value.GetIndexOfChildWithName(name) - def get_child_at_index(self, index: int) -> SBValue: + def get_child_at_index(self, index: int) -> Optional[SBValue]: return self.value.GetChildAtIndex(index) def has_children(self) -> bool: @@ -858,7 +856,7 @@ def get_child_index(self, name: str) -> int: else: return -1 - def get_child_at_index(self, index: int) -> SBValue: + def get_child_at_index(self, index: int) -> Optional[SBValue]: if self.is_variant: field = self.type.GetFieldAtIndex(index + 1) else: @@ -887,7 +885,7 @@ def num_children(self) -> int: def get_child_index(self, name: str) -> int: return self.valobj.GetIndexOfChildWithName(name) - def get_child_at_index(self, index: int) -> SBValue: + def get_child_at_index(self, index: int) -> Optional[SBValue]: child: SBValue = self.valobj.GetChildAtIndex(index) offset = self.valobj.GetType().GetFieldAtIndex(index).byte_offset return self.valobj.CreateChildAtOffset(str(index), offset, child.GetType()) @@ -935,7 +933,7 @@ def get_child_index(self, name: str) -> int: else: return -1 - def get_child_at_index(self, index: int) -> SBValue: + def get_child_at_index(self, index: int) -> Optional[SBValue]: start = self.data_ptr.GetValueAsUnsigned() address = start + index * self.element_type_size element = self.data_ptr.CreateValueFromAddress( @@ -983,7 +981,7 @@ def get_child_index(self, name: str) -> int: else: return -1 - def get_child_at_index(self, index: int) -> SBValue: + def get_child_at_index(self, index: int) -> Optional[SBValue]: start = self.data_ptr.GetValueAsUnsigned() address = start + index * self.element_size element = self.data_ptr.CreateValueFromAddress( @@ -1047,7 +1045,7 @@ def get_child_index(self, name: str) -> int: else: return -1 - def get_child_at_index(self, index: int) -> SBValue: + def get_child_at_index(self, index: int) -> Optional[SBValue]: start = self.data_ptr.GetValueAsUnsigned() address = start + ((index + self.head) % self.cap) * self.element_type_size element = self.data_ptr.CreateValueFromAddress( @@ -1106,7 +1104,7 @@ def get_child_index(self, name: str) -> int: else: return -1 - def get_child_at_index(self, index: int) -> SBValue: + def get_child_at_index(self, index: int) -> Optional[SBValue]: # logger = Logger.Logger() start = self.data_ptr.GetValueAsUnsigned() & ~1 @@ -1195,7 +1193,7 @@ def get_child_index(self, name: str) -> int: else: return -1 - def get_child_at_index(self, index: int) -> SBValue: + def get_child_at_index(self, index: int) -> Optional[SBValue]: pairs_start = self.data_ptr.GetValueAsUnsigned() idx = self.valid_indices[index] if self.new_layout: @@ -1318,7 +1316,7 @@ def get_child_index(self, name: str) -> int: return 2 return -1 - def get_child_at_index(self, index: int) -> SBValue: + def get_child_at_index(self, index: int) -> Optional[SBValue]: if index == 0: return self.value if index == 1: @@ -1351,7 +1349,7 @@ def get_child_index(self, name: str) -> int: return 0 return -1 - def get_child_at_index(self, index: int) -> SBValue: + def get_child_at_index(self, index: int) -> Optional[SBValue]: if index == 0: return self.value return None @@ -1406,7 +1404,7 @@ def get_child_index(self, name: str) -> int: return 1 return -1 - def get_child_at_index(self, index: int) -> SBValue: + def get_child_at_index(self, index: int) -> Optional[SBValue]: if index == 0: return self.value if index == 1: diff --git a/src/etc/rust_types.py b/src/etc/rust_types.py index 1ed68458ae3a5..ca462654e44e6 100644 --- a/src/etc/rust_types.py +++ b/src/etc/rust_types.py @@ -130,4 +130,4 @@ def classify_union(fields: List) -> RustType: assert len(fields) == 1 return RustType.CompressedEnum else: - return RustType.RegularEnum + return RustType.Union diff --git a/src/tools/clippy/src/driver.rs b/src/tools/clippy/src/driver.rs index 7b7aac09643af..c682f294048ba 100644 --- a/src/tools/clippy/src/driver.rs +++ b/src/tools/clippy/src/driver.rs @@ -121,7 +121,7 @@ struct RustcCallbacks { impl rustc_driver::Callbacks for RustcCallbacks { fn config(&mut self, config: &mut interface::Config) { let clippy_args_var = self.clippy_args_var.take(); - config.track_state = Some(Box::new(move |sess, _hasher| { + config.track_state = Some(Box::new(move |sess| { track_clippy_args(sess, clippy_args_var.as_deref()); })); config.extra_symbols = sym::EXTRA_SYMBOLS.into(); @@ -138,7 +138,7 @@ impl rustc_driver::Callbacks for ClippyCallbacks { let conf_path = clippy_config::lookup_conf_file(); let previous = config.register_lints.take(); let clippy_args_var = self.clippy_args_var.take(); - config.track_state = Some(Box::new(move |sess, _hasher| { + config.track_state = Some(Box::new(move |sess| { track_clippy_args(sess, clippy_args_var.as_deref()); track_files(sess); diff --git a/tests/ui/diagnostic_namespace/on_move/std_impls.rs b/tests/ui/diagnostic_namespace/on_move/std_impls.rs new file mode 100644 index 0000000000000..ea63d731a3434 --- /dev/null +++ b/tests/ui/diagnostic_namespace/on_move/std_impls.rs @@ -0,0 +1,25 @@ +//@ dont-require-annotations: NOTE + +use std::fs::File; +use std::sync::Arc; +use std::rc::Rc; + +fn main(){ + let file = File::open("foo.txt").unwrap(); + (file, file); + //~^ ERROR use of moved value: `file` + //~| NOTE you can use `File::try_clone` to duplicate a `File` instance + + let arc = Arc::new(42); + //~^ NOTE this move could be avoided by cloning the original `Arc`, which is inexpensive + (arc, arc); + //~^ ERROR the type `Arc` does not implement `Copy` + //~| NOTE consider using `Arc::clone` + + + let rc = Rc::new(12); + //~^ NOTE this move could be avoided by cloning the original `Rc`, which is inexpensive + (rc, rc); + //~^ ERROR the type `Rc` does not implement `Copy` + //~| NOTE consider using `Rc::clone` +} diff --git a/tests/ui/diagnostic_namespace/on_move/std_impls.stderr b/tests/ui/diagnostic_namespace/on_move/std_impls.stderr new file mode 100644 index 0000000000000..ba8869d9c73fb --- /dev/null +++ b/tests/ui/diagnostic_namespace/on_move/std_impls.stderr @@ -0,0 +1,49 @@ +error[E0382]: use of moved value: `file` + --> $DIR/std_impls.rs:9:12 + | +LL | let file = File::open("foo.txt").unwrap(); + | ---- move occurs because `file` has type `File`, which does not implement the `Copy` trait +LL | (file, file); + | ---- ^^^^ value used here after move + | | + | value moved here + | + = note: you can use `File::try_clone` to duplicate a `File` instance + +error[E0382]: the type `Arc` does not implement `Copy` + --> $DIR/std_impls.rs:15:11 + | +LL | let arc = Arc::new(42); + | --- this move could be avoided by cloning the original `Arc`, which is inexpensive +LL | +LL | (arc, arc); + | --- ^^^ value used here after move + | | + | value moved here + | + = note: consider using `Arc::clone` +help: clone the value to increment its reference count + | +LL | (arc.clone(), arc); + | ++++++++ + +error[E0382]: the type `Rc` does not implement `Copy` + --> $DIR/std_impls.rs:22:10 + | +LL | let rc = Rc::new(12); + | -- this move could be avoided by cloning the original `Rc`, which is inexpensive +LL | +LL | (rc, rc); + | -- ^^ value used here after move + | | + | value moved here + | + = note: consider using `Rc::clone` +help: clone the value to increment its reference count + | +LL | (rc.clone(), rc); + | ++++++++ + +error: aborting due to 3 previous errors + +For more information about this error, try `rustc --explain E0382`. diff --git a/tests/ui/macros/expr_2021.rs b/tests/ui/macros/expr_2021.rs index 8a274e7753359..7ddeedc7a0b55 100644 --- a/tests/ui/macros/expr_2021.rs +++ b/tests/ui/macros/expr_2021.rs @@ -1,5 +1,6 @@ //@ check-pass //@ edition: 2015 +//@ reference: macro.decl.meta.edition2024 // Ensures expr_2021 fragment specifier is accepted in old editions diff --git a/tests/ui/macros/expr_2021_inline_const.edi2021.stderr b/tests/ui/macros/expr_2021_inline_const.edi2021.stderr index bf7eb3888b33e..997f1d1d73fd3 100644 --- a/tests/ui/macros/expr_2021_inline_const.edi2021.stderr +++ b/tests/ui/macros/expr_2021_inline_const.edi2021.stderr @@ -1,5 +1,5 @@ error: no rules expected keyword `const` - --> $DIR/expr_2021_inline_const.rs:23:12 + --> $DIR/expr_2021_inline_const.rs:24:12 | LL | macro_rules! m2021 { | ------------------ when calling this macro @@ -8,13 +8,13 @@ LL | m2021!(const { 1 }); | ^^^^^ no rules expected this token in macro call | note: while trying to match meta-variable `$e:expr_2021` - --> $DIR/expr_2021_inline_const.rs:7:6 + --> $DIR/expr_2021_inline_const.rs:8:6 | LL | ($e:expr_2021) => { | ^^^^^^^^^^^^ error: no rules expected keyword `const` - --> $DIR/expr_2021_inline_const.rs:24:12 + --> $DIR/expr_2021_inline_const.rs:25:12 | LL | macro_rules! m2024 { | ------------------ when calling this macro @@ -23,7 +23,7 @@ LL | m2024!(const { 1 }); | ^^^^^ no rules expected this token in macro call | note: while trying to match meta-variable `$e:expr` - --> $DIR/expr_2021_inline_const.rs:13:6 + --> $DIR/expr_2021_inline_const.rs:14:6 | LL | ($e:expr) => { | ^^^^^^^ diff --git a/tests/ui/macros/expr_2021_inline_const.edi2024.stderr b/tests/ui/macros/expr_2021_inline_const.edi2024.stderr index 1028ddc4267fc..659738c0bb992 100644 --- a/tests/ui/macros/expr_2021_inline_const.edi2024.stderr +++ b/tests/ui/macros/expr_2021_inline_const.edi2024.stderr @@ -1,5 +1,5 @@ error: no rules expected keyword `const` - --> $DIR/expr_2021_inline_const.rs:23:12 + --> $DIR/expr_2021_inline_const.rs:24:12 | LL | macro_rules! m2021 { | ------------------ when calling this macro @@ -8,7 +8,7 @@ LL | m2021!(const { 1 }); | ^^^^^ no rules expected this token in macro call | note: while trying to match meta-variable `$e:expr_2021` - --> $DIR/expr_2021_inline_const.rs:7:6 + --> $DIR/expr_2021_inline_const.rs:8:6 | LL | ($e:expr_2021) => { | ^^^^^^^^^^^^ diff --git a/tests/ui/macros/expr_2021_inline_const.rs b/tests/ui/macros/expr_2021_inline_const.rs index 257f5b2f8cf98..d660db12328cb 100644 --- a/tests/ui/macros/expr_2021_inline_const.rs +++ b/tests/ui/macros/expr_2021_inline_const.rs @@ -1,6 +1,7 @@ //@ revisions: edi2021 edi2024 //@[edi2024] edition: 2024 //@[edi2021] edition: 2021 +//@ reference: macro.decl.meta.edition2024 // This test ensures that the inline const match only on edition 2024 macro_rules! m2021 { diff --git a/tests/ui/macros/expr_2024_underscore_expr.edi2021.stderr b/tests/ui/macros/expr_2024_underscore_expr.edi2021.stderr index 7b3ca54bb7132..37be53aafc5b0 100644 --- a/tests/ui/macros/expr_2024_underscore_expr.edi2021.stderr +++ b/tests/ui/macros/expr_2024_underscore_expr.edi2021.stderr @@ -1,5 +1,5 @@ error: no rules expected reserved identifier `_` - --> $DIR/expr_2024_underscore_expr.rs:19:12 + --> $DIR/expr_2024_underscore_expr.rs:20:12 | LL | macro_rules! m2021 { | ------------------ when calling this macro @@ -8,13 +8,13 @@ LL | m2021!(_); | ^ no rules expected this token in macro call | note: while trying to match meta-variable `$e:expr_2021` - --> $DIR/expr_2024_underscore_expr.rs:7:6 + --> $DIR/expr_2024_underscore_expr.rs:8:6 | LL | ($e:expr_2021) => { | ^^^^^^^^^^^^ error: no rules expected reserved identifier `_` - --> $DIR/expr_2024_underscore_expr.rs:20:12 + --> $DIR/expr_2024_underscore_expr.rs:21:12 | LL | macro_rules! m2024 { | ------------------ when calling this macro @@ -23,7 +23,7 @@ LL | m2024!(_); | ^ no rules expected this token in macro call | note: while trying to match meta-variable `$e:expr` - --> $DIR/expr_2024_underscore_expr.rs:13:6 + --> $DIR/expr_2024_underscore_expr.rs:14:6 | LL | ($e:expr) => { | ^^^^^^^ diff --git a/tests/ui/macros/expr_2024_underscore_expr.edi2024.stderr b/tests/ui/macros/expr_2024_underscore_expr.edi2024.stderr index 59104dafa1816..831cbd09de9d0 100644 --- a/tests/ui/macros/expr_2024_underscore_expr.edi2024.stderr +++ b/tests/ui/macros/expr_2024_underscore_expr.edi2024.stderr @@ -1,5 +1,5 @@ error: no rules expected reserved identifier `_` - --> $DIR/expr_2024_underscore_expr.rs:19:12 + --> $DIR/expr_2024_underscore_expr.rs:20:12 | LL | macro_rules! m2021 { | ------------------ when calling this macro @@ -8,7 +8,7 @@ LL | m2021!(_); | ^ no rules expected this token in macro call | note: while trying to match meta-variable `$e:expr_2021` - --> $DIR/expr_2024_underscore_expr.rs:7:6 + --> $DIR/expr_2024_underscore_expr.rs:8:6 | LL | ($e:expr_2021) => { | ^^^^^^^^^^^^ diff --git a/tests/ui/macros/expr_2024_underscore_expr.rs b/tests/ui/macros/expr_2024_underscore_expr.rs index 1d45d60c13644..e216dbb191e18 100644 --- a/tests/ui/macros/expr_2024_underscore_expr.rs +++ b/tests/ui/macros/expr_2024_underscore_expr.rs @@ -1,6 +1,7 @@ //@ revisions: edi2021 edi2024 //@[edi2024] edition: 2024 //@[edi2021] edition: 2021 +//@ reference: macro.decl.meta.edition2024 // This test ensures that the `_` tok is considered an // expression on edition 2024. macro_rules! m2021 { diff --git a/tests/ui/macros/local-ambiguity-multiple-parsing-options.rs b/tests/ui/macros/local-ambiguity-multiple-parsing-options.rs index 3967481098cff..d15850d43a288 100644 --- a/tests/ui/macros/local-ambiguity-multiple-parsing-options.rs +++ b/tests/ui/macros/local-ambiguity-multiple-parsing-options.rs @@ -1,3 +1,4 @@ +//@ reference: macro.decl.transcription.lookahead fn main() {} macro_rules! ambiguity { diff --git a/tests/ui/macros/local-ambiguity-multiple-parsing-options.stderr b/tests/ui/macros/local-ambiguity-multiple-parsing-options.stderr index 68b278fd3c886..80fc66f7e36b6 100644 --- a/tests/ui/macros/local-ambiguity-multiple-parsing-options.stderr +++ b/tests/ui/macros/local-ambiguity-multiple-parsing-options.stderr @@ -1,11 +1,11 @@ error: local ambiguity when calling macro `ambiguity`: multiple parsing options: built-in NTs ident ('i') or ident ('j'). - --> $DIR/local-ambiguity-multiple-parsing-options.rs:7:12 + --> $DIR/local-ambiguity-multiple-parsing-options.rs:8:12 | LL | ambiguity!(error); | ^^^^^ error: local ambiguity when calling macro `ambiguity`: multiple parsing options: built-in NTs ident ('i') or ident ('j'). - --> $DIR/local-ambiguity-multiple-parsing-options.rs:8:12 + --> $DIR/local-ambiguity-multiple-parsing-options.rs:9:12 | LL | ambiguity!(error); | ^^^^^ diff --git a/tests/ui/macros/macro-error.rs b/tests/ui/macros/macro-error.rs index 4984b92911efc..20ae8c137a569 100644 --- a/tests/ui/macros/macro-error.rs +++ b/tests/ui/macros/macro-error.rs @@ -1,3 +1,4 @@ +//@ reference: macro.decl.syntax macro_rules! foo { ($a:expr) => a; //~ ERROR macro rhs must be delimited } diff --git a/tests/ui/macros/macro-error.stderr b/tests/ui/macros/macro-error.stderr index fcf8d922d65c9..f3bab7af9b640 100644 --- a/tests/ui/macros/macro-error.stderr +++ b/tests/ui/macros/macro-error.stderr @@ -1,11 +1,11 @@ error: macro rhs must be delimited - --> $DIR/macro-error.rs:2:18 + --> $DIR/macro-error.rs:3:18 | LL | ($a:expr) => a; | ^ error: non-type macro in type position: cfg - --> $DIR/macro-error.rs:8:12 + --> $DIR/macro-error.rs:9:12 | LL | let _: cfg!(FALSE) = (); | ^^^^^^^^^^^ diff --git a/tests/ui/macros/macro-follow-rpass.rs b/tests/ui/macros/macro-follow-rpass.rs index 3103e86539a65..b407f10249890 100644 --- a/tests/ui/macros/macro-follow-rpass.rs +++ b/tests/ui/macros/macro-follow-rpass.rs @@ -1,5 +1,10 @@ //@ edition:2015..2021 //@ check-pass +//@ reference: macro.decl.follow-set.token-expr-stmt +//@ reference: macro.decl.follow-set.token-pat +//@ reference: macro.decl.follow-set.edition2021 +//@ reference: macro.decl.follow-set.token-path-ty +//@ reference: macro.decl.follow-set.token-other #![allow(unused_macros)] // Check the macro follow sets (see corresponding cfail test). diff --git a/tests/ui/macros/macro-follow.rs b/tests/ui/macros/macro-follow.rs index 874bad6a74316..cf83a9ad734bd 100644 --- a/tests/ui/macros/macro-follow.rs +++ b/tests/ui/macros/macro-follow.rs @@ -1,5 +1,7 @@ //@ edition:2015..2021 -// +//@ reference: macro.decl.follow-set.token-expr-stmt +//@ reference: macro.decl.follow-set.token-pat +//@ reference: macro.decl.follow-set.token-path-ty // Check the macro follow sets (see corresponding rpass test). #![feature(macro_guard_matcher)] diff --git a/tests/ui/macros/macro-follow.stderr b/tests/ui/macros/macro-follow.stderr index 78d167added73..64a916b4c227a 100644 --- a/tests/ui/macros/macro-follow.stderr +++ b/tests/ui/macros/macro-follow.stderr @@ -1,5 +1,5 @@ error: `$p:pat` is followed by `(`, which is not allowed for `pat` fragments - --> $DIR/macro-follow.rs:10:13 + --> $DIR/macro-follow.rs:12:13 | LL | ($p:pat ()) => {}; | ^ not allowed after `pat` fragments @@ -7,7 +7,7 @@ LL | ($p:pat ()) => {}; = note: allowed there are: `=>`, `,`, `=`, `|`, `if`, `if let` or `in` error: `$p:pat` is followed by `[`, which is not allowed for `pat` fragments - --> $DIR/macro-follow.rs:11:13 + --> $DIR/macro-follow.rs:13:13 | LL | ($p:pat []) => {}; | ^ not allowed after `pat` fragments @@ -15,7 +15,7 @@ LL | ($p:pat []) => {}; = note: allowed there are: `=>`, `,`, `=`, `|`, `if`, `if let` or `in` error: `$p:pat` is followed by `{`, which is not allowed for `pat` fragments - --> $DIR/macro-follow.rs:12:13 + --> $DIR/macro-follow.rs:14:13 | LL | ($p:pat {}) => {}; | ^ not allowed after `pat` fragments @@ -23,7 +23,7 @@ LL | ($p:pat {}) => {}; = note: allowed there are: `=>`, `,`, `=`, `|`, `if`, `if let` or `in` error: `$p:pat` is followed by `:`, which is not allowed for `pat` fragments - --> $DIR/macro-follow.rs:13:13 + --> $DIR/macro-follow.rs:15:13 | LL | ($p:pat :) => {}; | ^ not allowed after `pat` fragments @@ -31,7 +31,7 @@ LL | ($p:pat :) => {}; = note: allowed there are: `=>`, `,`, `=`, `|`, `if`, `if let` or `in` error: `$p:pat` is followed by `>`, which is not allowed for `pat` fragments - --> $DIR/macro-follow.rs:14:13 + --> $DIR/macro-follow.rs:16:13 | LL | ($p:pat >) => {}; | ^ not allowed after `pat` fragments @@ -39,7 +39,7 @@ LL | ($p:pat >) => {}; = note: allowed there are: `=>`, `,`, `=`, `|`, `if`, `if let` or `in` error: `$p:pat` is followed by `+`, which is not allowed for `pat` fragments - --> $DIR/macro-follow.rs:15:13 + --> $DIR/macro-follow.rs:17:13 | LL | ($p:pat +) => {}; | ^ not allowed after `pat` fragments @@ -47,7 +47,7 @@ LL | ($p:pat +) => {}; = note: allowed there are: `=>`, `,`, `=`, `|`, `if`, `if let` or `in` error: `$p:pat` is followed by `ident`, which is not allowed for `pat` fragments - --> $DIR/macro-follow.rs:16:13 + --> $DIR/macro-follow.rs:18:13 | LL | ($p:pat ident) => {}; | ^^^^^ not allowed after `pat` fragments @@ -55,7 +55,7 @@ LL | ($p:pat ident) => {}; = note: allowed there are: `=>`, `,`, `=`, `|`, `if`, `if let` or `in` error: `$p:pat` is followed by `$q:pat`, which is not allowed for `pat` fragments - --> $DIR/macro-follow.rs:17:13 + --> $DIR/macro-follow.rs:19:13 | LL | ($p:pat $q:pat) => {}; | ^^^^^^ not allowed after `pat` fragments @@ -63,7 +63,7 @@ LL | ($p:pat $q:pat) => {}; = note: allowed there are: `=>`, `,`, `=`, `|`, `if`, `if let` or `in` error: `$p:pat` is followed by `$e:expr`, which is not allowed for `pat` fragments - --> $DIR/macro-follow.rs:18:13 + --> $DIR/macro-follow.rs:20:13 | LL | ($p:pat $e:expr) => {}; | ^^^^^^^ not allowed after `pat` fragments @@ -71,7 +71,7 @@ LL | ($p:pat $e:expr) => {}; = note: allowed there are: `=>`, `,`, `=`, `|`, `if`, `if let` or `in` error: `$p:pat` is followed by `$t:ty`, which is not allowed for `pat` fragments - --> $DIR/macro-follow.rs:19:13 + --> $DIR/macro-follow.rs:21:13 | LL | ($p:pat $t:ty) => {}; | ^^^^^ not allowed after `pat` fragments @@ -79,7 +79,7 @@ LL | ($p:pat $t:ty) => {}; = note: allowed there are: `=>`, `,`, `=`, `|`, `if`, `if let` or `in` error: `$p:pat` is followed by `$s:stmt`, which is not allowed for `pat` fragments - --> $DIR/macro-follow.rs:20:13 + --> $DIR/macro-follow.rs:22:13 | LL | ($p:pat $s:stmt) => {}; | ^^^^^^^ not allowed after `pat` fragments @@ -87,7 +87,7 @@ LL | ($p:pat $s:stmt) => {}; = note: allowed there are: `=>`, `,`, `=`, `|`, `if`, `if let` or `in` error: `$p:pat` is followed by `$q:path`, which is not allowed for `pat` fragments - --> $DIR/macro-follow.rs:21:13 + --> $DIR/macro-follow.rs:23:13 | LL | ($p:pat $q:path) => {}; | ^^^^^^^ not allowed after `pat` fragments @@ -95,7 +95,7 @@ LL | ($p:pat $q:path) => {}; = note: allowed there are: `=>`, `,`, `=`, `|`, `if`, `if let` or `in` error: `$p:pat` is followed by `$b:block`, which is not allowed for `pat` fragments - --> $DIR/macro-follow.rs:22:13 + --> $DIR/macro-follow.rs:24:13 | LL | ($p:pat $b:block) => {}; | ^^^^^^^^ not allowed after `pat` fragments @@ -103,7 +103,7 @@ LL | ($p:pat $b:block) => {}; = note: allowed there are: `=>`, `,`, `=`, `|`, `if`, `if let` or `in` error: `$p:pat` is followed by `$i:ident`, which is not allowed for `pat` fragments - --> $DIR/macro-follow.rs:23:13 + --> $DIR/macro-follow.rs:25:13 | LL | ($p:pat $i:ident) => {}; | ^^^^^^^^ not allowed after `pat` fragments @@ -111,7 +111,7 @@ LL | ($p:pat $i:ident) => {}; = note: allowed there are: `=>`, `,`, `=`, `|`, `if`, `if let` or `in` error: `$p:pat` is followed by `$t:tt`, which is not allowed for `pat` fragments - --> $DIR/macro-follow.rs:24:13 + --> $DIR/macro-follow.rs:26:13 | LL | ($p:pat $t:tt) => {}; | ^^^^^ not allowed after `pat` fragments @@ -119,7 +119,7 @@ LL | ($p:pat $t:tt) => {}; = note: allowed there are: `=>`, `,`, `=`, `|`, `if`, `if let` or `in` error: `$p:pat` is followed by `$i:item`, which is not allowed for `pat` fragments - --> $DIR/macro-follow.rs:25:13 + --> $DIR/macro-follow.rs:27:13 | LL | ($p:pat $i:item) => {}; | ^^^^^^^ not allowed after `pat` fragments @@ -127,7 +127,7 @@ LL | ($p:pat $i:item) => {}; = note: allowed there are: `=>`, `,`, `=`, `|`, `if`, `if let` or `in` error: `$p:pat` is followed by `$m:meta`, which is not allowed for `pat` fragments - --> $DIR/macro-follow.rs:26:13 + --> $DIR/macro-follow.rs:28:13 | LL | ($p:pat $m:meta) => {}; | ^^^^^^^ not allowed after `pat` fragments @@ -135,7 +135,7 @@ LL | ($p:pat $m:meta) => {}; = note: allowed there are: `=>`, `,`, `=`, `|`, `if`, `if let` or `in` error: `$e:expr` is followed by `(`, which is not allowed for `expr` fragments - --> $DIR/macro-follow.rs:30:14 + --> $DIR/macro-follow.rs:32:14 | LL | ($e:expr ()) => {}; | ^ not allowed after `expr` fragments @@ -143,7 +143,7 @@ LL | ($e:expr ()) => {}; = note: allowed there are: `=>`, `,` or `;` error: `$e:expr` is followed by `[`, which is not allowed for `expr` fragments - --> $DIR/macro-follow.rs:31:14 + --> $DIR/macro-follow.rs:33:14 | LL | ($e:expr []) => {}; | ^ not allowed after `expr` fragments @@ -151,7 +151,7 @@ LL | ($e:expr []) => {}; = note: allowed there are: `=>`, `,` or `;` error: `$e:expr` is followed by `{`, which is not allowed for `expr` fragments - --> $DIR/macro-follow.rs:32:14 + --> $DIR/macro-follow.rs:34:14 | LL | ($e:expr {}) => {}; | ^ not allowed after `expr` fragments @@ -159,7 +159,7 @@ LL | ($e:expr {}) => {}; = note: allowed there are: `=>`, `,` or `;` error: `$e:expr` is followed by `=`, which is not allowed for `expr` fragments - --> $DIR/macro-follow.rs:33:14 + --> $DIR/macro-follow.rs:35:14 | LL | ($e:expr =) => {}; | ^ not allowed after `expr` fragments @@ -167,7 +167,7 @@ LL | ($e:expr =) => {}; = note: allowed there are: `=>`, `,` or `;` error: `$e:expr` is followed by `|`, which is not allowed for `expr` fragments - --> $DIR/macro-follow.rs:34:14 + --> $DIR/macro-follow.rs:36:14 | LL | ($e:expr |) => {}; | ^ not allowed after `expr` fragments @@ -175,7 +175,7 @@ LL | ($e:expr |) => {}; = note: allowed there are: `=>`, `,` or `;` error: `$e:expr` is followed by `:`, which is not allowed for `expr` fragments - --> $DIR/macro-follow.rs:35:14 + --> $DIR/macro-follow.rs:37:14 | LL | ($e:expr :) => {}; | ^ not allowed after `expr` fragments @@ -183,7 +183,7 @@ LL | ($e:expr :) => {}; = note: allowed there are: `=>`, `,` or `;` error: `$e:expr` is followed by `>`, which is not allowed for `expr` fragments - --> $DIR/macro-follow.rs:36:14 + --> $DIR/macro-follow.rs:38:14 | LL | ($e:expr >) => {}; | ^ not allowed after `expr` fragments @@ -191,7 +191,7 @@ LL | ($e:expr >) => {}; = note: allowed there are: `=>`, `,` or `;` error: `$e:expr` is followed by `+`, which is not allowed for `expr` fragments - --> $DIR/macro-follow.rs:37:14 + --> $DIR/macro-follow.rs:39:14 | LL | ($e:expr +) => {}; | ^ not allowed after `expr` fragments @@ -199,7 +199,7 @@ LL | ($e:expr +) => {}; = note: allowed there are: `=>`, `,` or `;` error: `$e:expr` is followed by `ident`, which is not allowed for `expr` fragments - --> $DIR/macro-follow.rs:38:14 + --> $DIR/macro-follow.rs:40:14 | LL | ($e:expr ident) => {}; | ^^^^^ not allowed after `expr` fragments @@ -207,7 +207,7 @@ LL | ($e:expr ident) => {}; = note: allowed there are: `=>`, `,` or `;` error: `$e:expr` is followed by `if`, which is not allowed for `expr` fragments - --> $DIR/macro-follow.rs:39:14 + --> $DIR/macro-follow.rs:41:14 | LL | ($e:expr if) => {}; | ^^ not allowed after `expr` fragments @@ -215,7 +215,7 @@ LL | ($e:expr if) => {}; = note: allowed there are: `=>`, `,` or `;` error: `$e:expr` is followed by `in`, which is not allowed for `expr` fragments - --> $DIR/macro-follow.rs:40:14 + --> $DIR/macro-follow.rs:42:14 | LL | ($e:expr in) => {}; | ^^ not allowed after `expr` fragments @@ -223,7 +223,7 @@ LL | ($e:expr in) => {}; = note: allowed there are: `=>`, `,` or `;` error: `$e:expr` is followed by `$p:pat`, which is not allowed for `expr` fragments - --> $DIR/macro-follow.rs:41:14 + --> $DIR/macro-follow.rs:43:14 | LL | ($e:expr $p:pat) => {}; | ^^^^^^ not allowed after `expr` fragments @@ -231,7 +231,7 @@ LL | ($e:expr $p:pat) => {}; = note: allowed there are: `=>`, `,` or `;` error: `$e:expr` is followed by `$f:expr`, which is not allowed for `expr` fragments - --> $DIR/macro-follow.rs:42:14 + --> $DIR/macro-follow.rs:44:14 | LL | ($e:expr $f:expr) => {}; | ^^^^^^^ not allowed after `expr` fragments @@ -239,7 +239,7 @@ LL | ($e:expr $f:expr) => {}; = note: allowed there are: `=>`, `,` or `;` error: `$e:expr` is followed by `$t:ty`, which is not allowed for `expr` fragments - --> $DIR/macro-follow.rs:43:14 + --> $DIR/macro-follow.rs:45:14 | LL | ($e:expr $t:ty) => {}; | ^^^^^ not allowed after `expr` fragments @@ -247,7 +247,7 @@ LL | ($e:expr $t:ty) => {}; = note: allowed there are: `=>`, `,` or `;` error: `$e:expr` is followed by `$s:stmt`, which is not allowed for `expr` fragments - --> $DIR/macro-follow.rs:44:14 + --> $DIR/macro-follow.rs:46:14 | LL | ($e:expr $s:stmt) => {}; | ^^^^^^^ not allowed after `expr` fragments @@ -255,7 +255,7 @@ LL | ($e:expr $s:stmt) => {}; = note: allowed there are: `=>`, `,` or `;` error: `$e:expr` is followed by `$p:path`, which is not allowed for `expr` fragments - --> $DIR/macro-follow.rs:45:14 + --> $DIR/macro-follow.rs:47:14 | LL | ($e:expr $p:path) => {}; | ^^^^^^^ not allowed after `expr` fragments @@ -263,7 +263,7 @@ LL | ($e:expr $p:path) => {}; = note: allowed there are: `=>`, `,` or `;` error: `$e:expr` is followed by `$b:block`, which is not allowed for `expr` fragments - --> $DIR/macro-follow.rs:46:14 + --> $DIR/macro-follow.rs:48:14 | LL | ($e:expr $b:block) => {}; | ^^^^^^^^ not allowed after `expr` fragments @@ -271,7 +271,7 @@ LL | ($e:expr $b:block) => {}; = note: allowed there are: `=>`, `,` or `;` error: `$e:expr` is followed by `$i:ident`, which is not allowed for `expr` fragments - --> $DIR/macro-follow.rs:47:14 + --> $DIR/macro-follow.rs:49:14 | LL | ($e:expr $i:ident) => {}; | ^^^^^^^^ not allowed after `expr` fragments @@ -279,7 +279,7 @@ LL | ($e:expr $i:ident) => {}; = note: allowed there are: `=>`, `,` or `;` error: `$e:expr` is followed by `$t:tt`, which is not allowed for `expr` fragments - --> $DIR/macro-follow.rs:48:14 + --> $DIR/macro-follow.rs:50:14 | LL | ($e:expr $t:tt) => {}; | ^^^^^ not allowed after `expr` fragments @@ -287,7 +287,7 @@ LL | ($e:expr $t:tt) => {}; = note: allowed there are: `=>`, `,` or `;` error: `$e:expr` is followed by `$i:item`, which is not allowed for `expr` fragments - --> $DIR/macro-follow.rs:49:14 + --> $DIR/macro-follow.rs:51:14 | LL | ($e:expr $i:item) => {}; | ^^^^^^^ not allowed after `expr` fragments @@ -295,7 +295,7 @@ LL | ($e:expr $i:item) => {}; = note: allowed there are: `=>`, `,` or `;` error: `$e:expr` is followed by `$m:meta`, which is not allowed for `expr` fragments - --> $DIR/macro-follow.rs:50:14 + --> $DIR/macro-follow.rs:52:14 | LL | ($e:expr $m:meta) => {}; | ^^^^^^^ not allowed after `expr` fragments @@ -303,7 +303,7 @@ LL | ($e:expr $m:meta) => {}; = note: allowed there are: `=>`, `,` or `;` error: `$e:expr` is followed by `$g:guard`, which is not allowed for `expr` fragments - --> $DIR/macro-follow.rs:51:14 + --> $DIR/macro-follow.rs:53:14 | LL | ($e:expr $g:guard) => {}; | ^^^^^^^^ not allowed after `expr` fragments @@ -311,7 +311,7 @@ LL | ($e:expr $g:guard) => {}; = note: allowed there are: `=>`, `,` or `;` error: `$t:ty` is followed by `(`, which is not allowed for `ty` fragments - --> $DIR/macro-follow.rs:56:12 + --> $DIR/macro-follow.rs:58:12 | LL | ($t:ty ()) => {}; | ^ not allowed after `ty` fragments @@ -319,7 +319,7 @@ LL | ($t:ty ()) => {}; = note: allowed there are: `{`, `[`, `=>`, `,`, `>`, `=`, `:`, `;`, `|`, `as` or `where` error: `$t:ty` is followed by `+`, which is not allowed for `ty` fragments - --> $DIR/macro-follow.rs:58:12 + --> $DIR/macro-follow.rs:60:12 | LL | ($t:ty +) => {}; | ^ not allowed after `ty` fragments @@ -327,7 +327,7 @@ LL | ($t:ty +) => {}; = note: allowed there are: `{`, `[`, `=>`, `,`, `>`, `=`, `:`, `;`, `|`, `as` or `where` error: `$t:ty` is followed by `ident`, which is not allowed for `ty` fragments - --> $DIR/macro-follow.rs:59:12 + --> $DIR/macro-follow.rs:61:12 | LL | ($t:ty ident) => {}; | ^^^^^ not allowed after `ty` fragments @@ -335,7 +335,7 @@ LL | ($t:ty ident) => {}; = note: allowed there are: `{`, `[`, `=>`, `,`, `>`, `=`, `:`, `;`, `|`, `as` or `where` error: `$t:ty` is followed by `if`, which is not allowed for `ty` fragments - --> $DIR/macro-follow.rs:60:12 + --> $DIR/macro-follow.rs:62:12 | LL | ($t:ty if) => {}; | ^^ not allowed after `ty` fragments @@ -343,7 +343,7 @@ LL | ($t:ty if) => {}; = note: allowed there are: `{`, `[`, `=>`, `,`, `>`, `=`, `:`, `;`, `|`, `as` or `where` error: `$t:ty` is followed by `$p:pat`, which is not allowed for `ty` fragments - --> $DIR/macro-follow.rs:61:12 + --> $DIR/macro-follow.rs:63:12 | LL | ($t:ty $p:pat) => {}; | ^^^^^^ not allowed after `ty` fragments @@ -351,7 +351,7 @@ LL | ($t:ty $p:pat) => {}; = note: allowed there are: `{`, `[`, `=>`, `,`, `>`, `=`, `:`, `;`, `|`, `as` or `where` error: `$t:ty` is followed by `$e:expr`, which is not allowed for `ty` fragments - --> $DIR/macro-follow.rs:62:12 + --> $DIR/macro-follow.rs:64:12 | LL | ($t:ty $e:expr) => {}; | ^^^^^^^ not allowed after `ty` fragments @@ -359,7 +359,7 @@ LL | ($t:ty $e:expr) => {}; = note: allowed there are: `{`, `[`, `=>`, `,`, `>`, `=`, `:`, `;`, `|`, `as` or `where` error: `$t:ty` is followed by `$r:ty`, which is not allowed for `ty` fragments - --> $DIR/macro-follow.rs:63:12 + --> $DIR/macro-follow.rs:65:12 | LL | ($t:ty $r:ty) => {}; | ^^^^^ not allowed after `ty` fragments @@ -367,7 +367,7 @@ LL | ($t:ty $r:ty) => {}; = note: allowed there are: `{`, `[`, `=>`, `,`, `>`, `=`, `:`, `;`, `|`, `as` or `where` error: `$t:ty` is followed by `$s:stmt`, which is not allowed for `ty` fragments - --> $DIR/macro-follow.rs:64:12 + --> $DIR/macro-follow.rs:66:12 | LL | ($t:ty $s:stmt) => {}; | ^^^^^^^ not allowed after `ty` fragments @@ -375,7 +375,7 @@ LL | ($t:ty $s:stmt) => {}; = note: allowed there are: `{`, `[`, `=>`, `,`, `>`, `=`, `:`, `;`, `|`, `as` or `where` error: `$t:ty` is followed by `$p:path`, which is not allowed for `ty` fragments - --> $DIR/macro-follow.rs:65:12 + --> $DIR/macro-follow.rs:67:12 | LL | ($t:ty $p:path) => {}; | ^^^^^^^ not allowed after `ty` fragments @@ -383,7 +383,7 @@ LL | ($t:ty $p:path) => {}; = note: allowed there are: `{`, `[`, `=>`, `,`, `>`, `=`, `:`, `;`, `|`, `as` or `where` error: `$t:ty` is followed by `$i:ident`, which is not allowed for `ty` fragments - --> $DIR/macro-follow.rs:67:12 + --> $DIR/macro-follow.rs:69:12 | LL | ($t:ty $i:ident) => {}; | ^^^^^^^^ not allowed after `ty` fragments @@ -391,7 +391,7 @@ LL | ($t:ty $i:ident) => {}; = note: allowed there are: `{`, `[`, `=>`, `,`, `>`, `=`, `:`, `;`, `|`, `as` or `where` error: `$t:ty` is followed by `$r:tt`, which is not allowed for `ty` fragments - --> $DIR/macro-follow.rs:68:12 + --> $DIR/macro-follow.rs:70:12 | LL | ($t:ty $r:tt) => {}; | ^^^^^ not allowed after `ty` fragments @@ -399,7 +399,7 @@ LL | ($t:ty $r:tt) => {}; = note: allowed there are: `{`, `[`, `=>`, `,`, `>`, `=`, `:`, `;`, `|`, `as` or `where` error: `$t:ty` is followed by `$i:item`, which is not allowed for `ty` fragments - --> $DIR/macro-follow.rs:69:12 + --> $DIR/macro-follow.rs:71:12 | LL | ($t:ty $i:item) => {}; | ^^^^^^^ not allowed after `ty` fragments @@ -407,7 +407,7 @@ LL | ($t:ty $i:item) => {}; = note: allowed there are: `{`, `[`, `=>`, `,`, `>`, `=`, `:`, `;`, `|`, `as` or `where` error: `$t:ty` is followed by `$m:meta`, which is not allowed for `ty` fragments - --> $DIR/macro-follow.rs:70:12 + --> $DIR/macro-follow.rs:72:12 | LL | ($t:ty $m:meta) => {}; | ^^^^^^^ not allowed after `ty` fragments @@ -415,7 +415,7 @@ LL | ($t:ty $m:meta) => {}; = note: allowed there are: `{`, `[`, `=>`, `,`, `>`, `=`, `:`, `;`, `|`, `as` or `where` error: `$t:ty` is followed by `$g:guard`, which is not allowed for `ty` fragments - --> $DIR/macro-follow.rs:71:12 + --> $DIR/macro-follow.rs:73:12 | LL | ($t:ty $g:guard) => {}; | ^^^^^^^^ not allowed after `ty` fragments @@ -423,7 +423,7 @@ LL | ($t:ty $g:guard) => {}; = note: allowed there are: `{`, `[`, `=>`, `,`, `>`, `=`, `:`, `;`, `|`, `as` or `where` error: `$s:stmt` is followed by `(`, which is not allowed for `stmt` fragments - --> $DIR/macro-follow.rs:75:14 + --> $DIR/macro-follow.rs:77:14 | LL | ($s:stmt ()) => {}; | ^ not allowed after `stmt` fragments @@ -431,7 +431,7 @@ LL | ($s:stmt ()) => {}; = note: allowed there are: `=>`, `,` or `;` error: `$s:stmt` is followed by `[`, which is not allowed for `stmt` fragments - --> $DIR/macro-follow.rs:76:14 + --> $DIR/macro-follow.rs:78:14 | LL | ($s:stmt []) => {}; | ^ not allowed after `stmt` fragments @@ -439,7 +439,7 @@ LL | ($s:stmt []) => {}; = note: allowed there are: `=>`, `,` or `;` error: `$s:stmt` is followed by `{`, which is not allowed for `stmt` fragments - --> $DIR/macro-follow.rs:77:14 + --> $DIR/macro-follow.rs:79:14 | LL | ($s:stmt {}) => {}; | ^ not allowed after `stmt` fragments @@ -447,7 +447,7 @@ LL | ($s:stmt {}) => {}; = note: allowed there are: `=>`, `,` or `;` error: `$s:stmt` is followed by `=`, which is not allowed for `stmt` fragments - --> $DIR/macro-follow.rs:78:14 + --> $DIR/macro-follow.rs:80:14 | LL | ($s:stmt =) => {}; | ^ not allowed after `stmt` fragments @@ -455,7 +455,7 @@ LL | ($s:stmt =) => {}; = note: allowed there are: `=>`, `,` or `;` error: `$s:stmt` is followed by `|`, which is not allowed for `stmt` fragments - --> $DIR/macro-follow.rs:79:14 + --> $DIR/macro-follow.rs:81:14 | LL | ($s:stmt |) => {}; | ^ not allowed after `stmt` fragments @@ -463,7 +463,7 @@ LL | ($s:stmt |) => {}; = note: allowed there are: `=>`, `,` or `;` error: `$s:stmt` is followed by `:`, which is not allowed for `stmt` fragments - --> $DIR/macro-follow.rs:80:14 + --> $DIR/macro-follow.rs:82:14 | LL | ($s:stmt :) => {}; | ^ not allowed after `stmt` fragments @@ -471,7 +471,7 @@ LL | ($s:stmt :) => {}; = note: allowed there are: `=>`, `,` or `;` error: `$s:stmt` is followed by `>`, which is not allowed for `stmt` fragments - --> $DIR/macro-follow.rs:81:14 + --> $DIR/macro-follow.rs:83:14 | LL | ($s:stmt >) => {}; | ^ not allowed after `stmt` fragments @@ -479,7 +479,7 @@ LL | ($s:stmt >) => {}; = note: allowed there are: `=>`, `,` or `;` error: `$s:stmt` is followed by `+`, which is not allowed for `stmt` fragments - --> $DIR/macro-follow.rs:82:14 + --> $DIR/macro-follow.rs:84:14 | LL | ($s:stmt +) => {}; | ^ not allowed after `stmt` fragments @@ -487,7 +487,7 @@ LL | ($s:stmt +) => {}; = note: allowed there are: `=>`, `,` or `;` error: `$s:stmt` is followed by `ident`, which is not allowed for `stmt` fragments - --> $DIR/macro-follow.rs:83:14 + --> $DIR/macro-follow.rs:85:14 | LL | ($s:stmt ident) => {}; | ^^^^^ not allowed after `stmt` fragments @@ -495,7 +495,7 @@ LL | ($s:stmt ident) => {}; = note: allowed there are: `=>`, `,` or `;` error: `$s:stmt` is followed by `if`, which is not allowed for `stmt` fragments - --> $DIR/macro-follow.rs:84:14 + --> $DIR/macro-follow.rs:86:14 | LL | ($s:stmt if) => {}; | ^^ not allowed after `stmt` fragments @@ -503,7 +503,7 @@ LL | ($s:stmt if) => {}; = note: allowed there are: `=>`, `,` or `;` error: `$s:stmt` is followed by `in`, which is not allowed for `stmt` fragments - --> $DIR/macro-follow.rs:85:14 + --> $DIR/macro-follow.rs:87:14 | LL | ($s:stmt in) => {}; | ^^ not allowed after `stmt` fragments @@ -511,7 +511,7 @@ LL | ($s:stmt in) => {}; = note: allowed there are: `=>`, `,` or `;` error: `$s:stmt` is followed by `$p:pat`, which is not allowed for `stmt` fragments - --> $DIR/macro-follow.rs:86:14 + --> $DIR/macro-follow.rs:88:14 | LL | ($s:stmt $p:pat) => {}; | ^^^^^^ not allowed after `stmt` fragments @@ -519,7 +519,7 @@ LL | ($s:stmt $p:pat) => {}; = note: allowed there are: `=>`, `,` or `;` error: `$s:stmt` is followed by `$e:expr`, which is not allowed for `stmt` fragments - --> $DIR/macro-follow.rs:87:14 + --> $DIR/macro-follow.rs:89:14 | LL | ($s:stmt $e:expr) => {}; | ^^^^^^^ not allowed after `stmt` fragments @@ -527,7 +527,7 @@ LL | ($s:stmt $e:expr) => {}; = note: allowed there are: `=>`, `,` or `;` error: `$s:stmt` is followed by `$t:ty`, which is not allowed for `stmt` fragments - --> $DIR/macro-follow.rs:88:14 + --> $DIR/macro-follow.rs:90:14 | LL | ($s:stmt $t:ty) => {}; | ^^^^^ not allowed after `stmt` fragments @@ -535,7 +535,7 @@ LL | ($s:stmt $t:ty) => {}; = note: allowed there are: `=>`, `,` or `;` error: `$s:stmt` is followed by `$t:stmt`, which is not allowed for `stmt` fragments - --> $DIR/macro-follow.rs:89:14 + --> $DIR/macro-follow.rs:91:14 | LL | ($s:stmt $t:stmt) => {}; | ^^^^^^^ not allowed after `stmt` fragments @@ -543,7 +543,7 @@ LL | ($s:stmt $t:stmt) => {}; = note: allowed there are: `=>`, `,` or `;` error: `$s:stmt` is followed by `$p:path`, which is not allowed for `stmt` fragments - --> $DIR/macro-follow.rs:90:14 + --> $DIR/macro-follow.rs:92:14 | LL | ($s:stmt $p:path) => {}; | ^^^^^^^ not allowed after `stmt` fragments @@ -551,7 +551,7 @@ LL | ($s:stmt $p:path) => {}; = note: allowed there are: `=>`, `,` or `;` error: `$s:stmt` is followed by `$b:block`, which is not allowed for `stmt` fragments - --> $DIR/macro-follow.rs:91:14 + --> $DIR/macro-follow.rs:93:14 | LL | ($s:stmt $b:block) => {}; | ^^^^^^^^ not allowed after `stmt` fragments @@ -559,7 +559,7 @@ LL | ($s:stmt $b:block) => {}; = note: allowed there are: `=>`, `,` or `;` error: `$s:stmt` is followed by `$i:ident`, which is not allowed for `stmt` fragments - --> $DIR/macro-follow.rs:92:14 + --> $DIR/macro-follow.rs:94:14 | LL | ($s:stmt $i:ident) => {}; | ^^^^^^^^ not allowed after `stmt` fragments @@ -567,7 +567,7 @@ LL | ($s:stmt $i:ident) => {}; = note: allowed there are: `=>`, `,` or `;` error: `$s:stmt` is followed by `$t:tt`, which is not allowed for `stmt` fragments - --> $DIR/macro-follow.rs:93:14 + --> $DIR/macro-follow.rs:95:14 | LL | ($s:stmt $t:tt) => {}; | ^^^^^ not allowed after `stmt` fragments @@ -575,7 +575,7 @@ LL | ($s:stmt $t:tt) => {}; = note: allowed there are: `=>`, `,` or `;` error: `$s:stmt` is followed by `$i:item`, which is not allowed for `stmt` fragments - --> $DIR/macro-follow.rs:94:14 + --> $DIR/macro-follow.rs:96:14 | LL | ($s:stmt $i:item) => {}; | ^^^^^^^ not allowed after `stmt` fragments @@ -583,7 +583,7 @@ LL | ($s:stmt $i:item) => {}; = note: allowed there are: `=>`, `,` or `;` error: `$s:stmt` is followed by `$m:meta`, which is not allowed for `stmt` fragments - --> $DIR/macro-follow.rs:95:14 + --> $DIR/macro-follow.rs:97:14 | LL | ($s:stmt $m:meta) => {}; | ^^^^^^^ not allowed after `stmt` fragments @@ -591,7 +591,7 @@ LL | ($s:stmt $m:meta) => {}; = note: allowed there are: `=>`, `,` or `;` error: `$s:stmt` is followed by `$g:guard`, which is not allowed for `stmt` fragments - --> $DIR/macro-follow.rs:96:14 + --> $DIR/macro-follow.rs:98:14 | LL | ($s:stmt $g:guard) => {}; | ^^^^^^^^ not allowed after `stmt` fragments @@ -599,7 +599,7 @@ LL | ($s:stmt $g:guard) => {}; = note: allowed there are: `=>`, `,` or `;` error: `$p:path` is followed by `(`, which is not allowed for `path` fragments - --> $DIR/macro-follow.rs:100:14 + --> $DIR/macro-follow.rs:102:14 | LL | ($p:path ()) => {}; | ^ not allowed after `path` fragments @@ -607,7 +607,7 @@ LL | ($p:path ()) => {}; = note: allowed there are: `{`, `[`, `=>`, `,`, `>`, `=`, `:`, `;`, `|`, `as` or `where` error: `$p:path` is followed by `+`, which is not allowed for `path` fragments - --> $DIR/macro-follow.rs:102:14 + --> $DIR/macro-follow.rs:104:14 | LL | ($p:path +) => {}; | ^ not allowed after `path` fragments @@ -615,7 +615,7 @@ LL | ($p:path +) => {}; = note: allowed there are: `{`, `[`, `=>`, `,`, `>`, `=`, `:`, `;`, `|`, `as` or `where` error: `$p:path` is followed by `ident`, which is not allowed for `path` fragments - --> $DIR/macro-follow.rs:103:14 + --> $DIR/macro-follow.rs:105:14 | LL | ($p:path ident) => {}; | ^^^^^ not allowed after `path` fragments @@ -623,7 +623,7 @@ LL | ($p:path ident) => {}; = note: allowed there are: `{`, `[`, `=>`, `,`, `>`, `=`, `:`, `;`, `|`, `as` or `where` error: `$p:path` is followed by `if`, which is not allowed for `path` fragments - --> $DIR/macro-follow.rs:104:14 + --> $DIR/macro-follow.rs:106:14 | LL | ($p:path if) => {}; | ^^ not allowed after `path` fragments @@ -631,7 +631,7 @@ LL | ($p:path if) => {}; = note: allowed there are: `{`, `[`, `=>`, `,`, `>`, `=`, `:`, `;`, `|`, `as` or `where` error: `$p:path` is followed by `$q:pat`, which is not allowed for `path` fragments - --> $DIR/macro-follow.rs:105:14 + --> $DIR/macro-follow.rs:107:14 | LL | ($p:path $q:pat) => {}; | ^^^^^^ not allowed after `path` fragments @@ -639,7 +639,7 @@ LL | ($p:path $q:pat) => {}; = note: allowed there are: `{`, `[`, `=>`, `,`, `>`, `=`, `:`, `;`, `|`, `as` or `where` error: `$p:path` is followed by `$e:expr`, which is not allowed for `path` fragments - --> $DIR/macro-follow.rs:106:14 + --> $DIR/macro-follow.rs:108:14 | LL | ($p:path $e:expr) => {}; | ^^^^^^^ not allowed after `path` fragments @@ -647,7 +647,7 @@ LL | ($p:path $e:expr) => {}; = note: allowed there are: `{`, `[`, `=>`, `,`, `>`, `=`, `:`, `;`, `|`, `as` or `where` error: `$p:path` is followed by `$t:ty`, which is not allowed for `path` fragments - --> $DIR/macro-follow.rs:107:14 + --> $DIR/macro-follow.rs:109:14 | LL | ($p:path $t:ty) => {}; | ^^^^^ not allowed after `path` fragments @@ -655,7 +655,7 @@ LL | ($p:path $t:ty) => {}; = note: allowed there are: `{`, `[`, `=>`, `,`, `>`, `=`, `:`, `;`, `|`, `as` or `where` error: `$p:path` is followed by `$s:stmt`, which is not allowed for `path` fragments - --> $DIR/macro-follow.rs:108:14 + --> $DIR/macro-follow.rs:110:14 | LL | ($p:path $s:stmt) => {}; | ^^^^^^^ not allowed after `path` fragments @@ -663,7 +663,7 @@ LL | ($p:path $s:stmt) => {}; = note: allowed there are: `{`, `[`, `=>`, `,`, `>`, `=`, `:`, `;`, `|`, `as` or `where` error: `$p:path` is followed by `$q:path`, which is not allowed for `path` fragments - --> $DIR/macro-follow.rs:109:14 + --> $DIR/macro-follow.rs:111:14 | LL | ($p:path $q:path) => {}; | ^^^^^^^ not allowed after `path` fragments @@ -671,7 +671,7 @@ LL | ($p:path $q:path) => {}; = note: allowed there are: `{`, `[`, `=>`, `,`, `>`, `=`, `:`, `;`, `|`, `as` or `where` error: `$p:path` is followed by `$i:ident`, which is not allowed for `path` fragments - --> $DIR/macro-follow.rs:111:14 + --> $DIR/macro-follow.rs:113:14 | LL | ($p:path $i:ident) => {}; | ^^^^^^^^ not allowed after `path` fragments @@ -679,7 +679,7 @@ LL | ($p:path $i:ident) => {}; = note: allowed there are: `{`, `[`, `=>`, `,`, `>`, `=`, `:`, `;`, `|`, `as` or `where` error: `$p:path` is followed by `$t:tt`, which is not allowed for `path` fragments - --> $DIR/macro-follow.rs:112:14 + --> $DIR/macro-follow.rs:114:14 | LL | ($p:path $t:tt) => {}; | ^^^^^ not allowed after `path` fragments @@ -687,7 +687,7 @@ LL | ($p:path $t:tt) => {}; = note: allowed there are: `{`, `[`, `=>`, `,`, `>`, `=`, `:`, `;`, `|`, `as` or `where` error: `$p:path` is followed by `$i:item`, which is not allowed for `path` fragments - --> $DIR/macro-follow.rs:113:14 + --> $DIR/macro-follow.rs:115:14 | LL | ($p:path $i:item) => {}; | ^^^^^^^ not allowed after `path` fragments @@ -695,7 +695,7 @@ LL | ($p:path $i:item) => {}; = note: allowed there are: `{`, `[`, `=>`, `,`, `>`, `=`, `:`, `;`, `|`, `as` or `where` error: `$p:path` is followed by `$m:meta`, which is not allowed for `path` fragments - --> $DIR/macro-follow.rs:114:14 + --> $DIR/macro-follow.rs:116:14 | LL | ($p:path $m:meta) => {}; | ^^^^^^^ not allowed after `path` fragments @@ -703,7 +703,7 @@ LL | ($p:path $m:meta) => {}; = note: allowed there are: `{`, `[`, `=>`, `,`, `>`, `=`, `:`, `;`, `|`, `as` or `where` error: `$p:path` is followed by `$g:guard`, which is not allowed for `path` fragments - --> $DIR/macro-follow.rs:115:14 + --> $DIR/macro-follow.rs:117:14 | LL | ($p:path $g:guard) => {}; | ^^^^^^^^ not allowed after `path` fragments diff --git a/tests/ui/macros/macro-followed-by-seq-bad.rs b/tests/ui/macros/macro-followed-by-seq-bad.rs index b73742f77ea58..ba72a6504885a 100644 --- a/tests/ui/macros/macro-followed-by-seq-bad.rs +++ b/tests/ui/macros/macro-followed-by-seq-bad.rs @@ -1,3 +1,4 @@ +//@ reference: macro.decl.follow-set.repetition // Regression test for issue #25436: check that things which can be // followed by any token also permit X* to come afterwards. diff --git a/tests/ui/macros/macro-followed-by-seq-bad.stderr b/tests/ui/macros/macro-followed-by-seq-bad.stderr index 7097979aeddf3..1621bd8ccf405 100644 --- a/tests/ui/macros/macro-followed-by-seq-bad.stderr +++ b/tests/ui/macros/macro-followed-by-seq-bad.stderr @@ -1,5 +1,5 @@ error: `$a:expr` is followed by `$b:tt`, which is not allowed for `expr` fragments - --> $DIR/macro-followed-by-seq-bad.rs:7:15 + --> $DIR/macro-followed-by-seq-bad.rs:8:15 | LL | ( $a:expr $($b:tt)* ) => { }; | ^^^^^ not allowed after `expr` fragments @@ -7,7 +7,7 @@ LL | ( $a:expr $($b:tt)* ) => { }; = note: allowed there are: `=>`, `,` or `;` error: `$a:ty` is followed by `$b:tt`, which is not allowed for `ty` fragments - --> $DIR/macro-followed-by-seq-bad.rs:8:13 + --> $DIR/macro-followed-by-seq-bad.rs:9:13 | LL | ( $a:ty $($b:tt)* ) => { }; | ^^^^^ not allowed after `ty` fragments diff --git a/tests/ui/macros/macro-followed-by-seq.rs b/tests/ui/macros/macro-followed-by-seq.rs index 3643836fa031f..1c61a4493fdec 100644 --- a/tests/ui/macros/macro-followed-by-seq.rs +++ b/tests/ui/macros/macro-followed-by-seq.rs @@ -1,4 +1,5 @@ //@ check-pass +//@ reference: macro.decl.follow-set.repetition #![allow(unused_macros)] // Regression test for issue #25436: check that things which can be // followed by any token also permit X* to come afterwards. diff --git a/tests/ui/macros/macro-hygiene-help-issue-148580.rs b/tests/ui/macros/macro-hygiene-help-issue-148580.rs index 8441290b17228..7f834c28c0989 100644 --- a/tests/ui/macros/macro-hygiene-help-issue-148580.rs +++ b/tests/ui/macros/macro-hygiene-help-issue-148580.rs @@ -1,3 +1,4 @@ +//@ reference: macro.decl.hygiene.intro macro_rules! print_it { {} => { println!("{:?}", it); } } //~^ ERROR cannot find value `it` in this scope diff --git a/tests/ui/macros/macro-hygiene-help-issue-148580.stderr b/tests/ui/macros/macro-hygiene-help-issue-148580.stderr index f6a4ae7dd1c66..56e021078855e 100644 --- a/tests/ui/macros/macro-hygiene-help-issue-148580.stderr +++ b/tests/ui/macros/macro-hygiene-help-issue-148580.stderr @@ -1,5 +1,5 @@ error[E0425]: cannot find value `it` in this scope - --> $DIR/macro-hygiene-help-issue-148580.rs:1:50 + --> $DIR/macro-hygiene-help-issue-148580.rs:2:50 | LL | macro_rules! print_it { {} => { println!("{:?}", it); } } | ^^ not found in this scope @@ -8,7 +8,7 @@ LL | print_it!(); | ----------- in this macro invocation | help: an identifier with the same name exists, but is not accessible due to macro hygiene - --> $DIR/macro-hygiene-help-issue-148580.rs:11:17 + --> $DIR/macro-hygiene-help-issue-148580.rs:12:17 | LL | let it = (); | ^^ diff --git a/tests/ui/macros/macro-hygiene-help-issue-149604.rs b/tests/ui/macros/macro-hygiene-help-issue-149604.rs index 5700218cc8671..2c01230fbe5df 100644 --- a/tests/ui/macros/macro-hygiene-help-issue-149604.rs +++ b/tests/ui/macros/macro-hygiene-help-issue-149604.rs @@ -1,3 +1,4 @@ +//@ reference: macro.decl.hygiene.intro macro_rules! let_it { {} => { let it = (); } } macro_rules! print_it { {} => { println!("{:?}", it); } } //~^ ERROR cannot find value `it` in this scope diff --git a/tests/ui/macros/macro-hygiene-help-issue-149604.stderr b/tests/ui/macros/macro-hygiene-help-issue-149604.stderr index dc95cb7a43f00..6df7c009e668b 100644 --- a/tests/ui/macros/macro-hygiene-help-issue-149604.stderr +++ b/tests/ui/macros/macro-hygiene-help-issue-149604.stderr @@ -1,11 +1,11 @@ error[E0425]: cannot find value `it` in this scope - --> $DIR/macro-hygiene-help-issue-149604.rs:7:14 + --> $DIR/macro-hygiene-help-issue-149604.rs:8:14 | LL | let () = it; | ^^ not found in this scope | help: an identifier with the same name is defined here, but is not accessible due to macro hygiene - --> $DIR/macro-hygiene-help-issue-149604.rs:1:35 + --> $DIR/macro-hygiene-help-issue-149604.rs:2:35 | LL | macro_rules! let_it { {} => { let it = (); } } | ^^ @@ -15,7 +15,7 @@ LL | let_it!(); = note: this error originates in the macro `let_it` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0425]: cannot find value `it` in this scope - --> $DIR/macro-hygiene-help-issue-149604.rs:2:50 + --> $DIR/macro-hygiene-help-issue-149604.rs:3:50 | LL | macro_rules! print_it { {} => { println!("{:?}", it); } } | ^^ not found in this scope @@ -24,7 +24,7 @@ LL | print_it!(); | ----------- in this macro invocation | help: an identifier with the same name is defined here, but is not accessible due to macro hygiene - --> $DIR/macro-hygiene-help-issue-149604.rs:1:35 + --> $DIR/macro-hygiene-help-issue-149604.rs:2:35 | LL | macro_rules! let_it { {} => { let it = (); } } | ^^ diff --git a/tests/ui/macros/macro-hygiene-scope-15167.rs b/tests/ui/macros/macro-hygiene-scope-15167.rs index 6578f898a5fb4..ec54f2a7e9887 100644 --- a/tests/ui/macros/macro-hygiene-scope-15167.rs +++ b/tests/ui/macros/macro-hygiene-scope-15167.rs @@ -1,3 +1,4 @@ +//@ reference: macro.decl.hygiene.intro //! Regression test for https://github.com/rust-lang/rust/issues/15167 // macro f should not be able to inject a reference to 'n'. diff --git a/tests/ui/macros/macro-hygiene-scope-15167.stderr b/tests/ui/macros/macro-hygiene-scope-15167.stderr index 332a58467cee1..dbb0514ba1aab 100644 --- a/tests/ui/macros/macro-hygiene-scope-15167.stderr +++ b/tests/ui/macros/macro-hygiene-scope-15167.stderr @@ -1,5 +1,5 @@ error[E0425]: cannot find value `n` in this scope - --> $DIR/macro-hygiene-scope-15167.rs:5:25 + --> $DIR/macro-hygiene-scope-15167.rs:6:25 | LL | macro_rules! f { () => (n) } | ^ not found in this scope @@ -8,14 +8,14 @@ LL | println!("{}", f!()); | ---- in this macro invocation | help: an identifier with the same name exists, but is not accessible due to macro hygiene - --> $DIR/macro-hygiene-scope-15167.rs:12:9 + --> $DIR/macro-hygiene-scope-15167.rs:13:9 | LL | for n in 0..1 { | ^ = note: this error originates in the macro `f` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0425]: cannot find value `n` in this scope - --> $DIR/macro-hygiene-scope-15167.rs:5:25 + --> $DIR/macro-hygiene-scope-15167.rs:6:25 | LL | macro_rules! f { () => (n) } | ^ not found in this scope @@ -24,14 +24,14 @@ LL | println!("{}", f!()); | ---- in this macro invocation | help: an identifier with the same name exists, but is not accessible due to macro hygiene - --> $DIR/macro-hygiene-scope-15167.rs:16:17 + --> $DIR/macro-hygiene-scope-15167.rs:17:17 | LL | if let Some(n) = None { | ^ = note: this error originates in the macro `f` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0425]: cannot find value `n` in this scope - --> $DIR/macro-hygiene-scope-15167.rs:5:25 + --> $DIR/macro-hygiene-scope-15167.rs:6:25 | LL | macro_rules! f { () => (n) } | ^ not found in this scope @@ -40,14 +40,14 @@ LL | println!("{}", f!()); | ---- in this macro invocation | help: an identifier with the same name exists, but is not accessible due to macro hygiene - --> $DIR/macro-hygiene-scope-15167.rs:21:24 + --> $DIR/macro-hygiene-scope-15167.rs:22:24 | LL | } else if let Some(n) = None { | ^ = note: this error originates in the macro `f` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0425]: cannot find value `n` in this scope - --> $DIR/macro-hygiene-scope-15167.rs:5:25 + --> $DIR/macro-hygiene-scope-15167.rs:6:25 | LL | macro_rules! f { () => (n) } | ^ not found in this scope @@ -56,7 +56,7 @@ LL | println!("{}", f!()); | ---- in this macro invocation | help: an identifier with the same name exists, but is not accessible due to macro hygiene - --> $DIR/macro-hygiene-scope-15167.rs:25:20 + --> $DIR/macro-hygiene-scope-15167.rs:26:20 | LL | while let Some(n) = None { | ^ diff --git a/tests/ui/macros/macro-or-patterns-back-compat.fixed b/tests/ui/macros/macro-or-patterns-back-compat.fixed index 5ff249ee17492..0321a36ae3b07 100644 --- a/tests/ui/macros/macro-or-patterns-back-compat.fixed +++ b/tests/ui/macros/macro-or-patterns-back-compat.fixed @@ -1,6 +1,7 @@ //@ edition:2015 //@ run-rustfix //@ aux-build:or-pattern.rs +//@ reference: macro.decl.follow-set.edition2021 #![deny(rust_2021_incompatible_or_patterns)] #![allow(unused_macros)] diff --git a/tests/ui/macros/macro-or-patterns-back-compat.rs b/tests/ui/macros/macro-or-patterns-back-compat.rs index 1c7beaeed7751..5d96ad456dc94 100644 --- a/tests/ui/macros/macro-or-patterns-back-compat.rs +++ b/tests/ui/macros/macro-or-patterns-back-compat.rs @@ -1,6 +1,7 @@ //@ edition:2015 //@ run-rustfix //@ aux-build:or-pattern.rs +//@ reference: macro.decl.follow-set.edition2021 #![deny(rust_2021_incompatible_or_patterns)] #![allow(unused_macros)] diff --git a/tests/ui/macros/macro-or-patterns-back-compat.stderr b/tests/ui/macros/macro-or-patterns-back-compat.stderr index 3718bcb4c8cc4..d4c2c57d0a8bb 100644 --- a/tests/ui/macros/macro-or-patterns-back-compat.stderr +++ b/tests/ui/macros/macro-or-patterns-back-compat.stderr @@ -1,5 +1,5 @@ error: the meaning of the `pat` fragment specifier is changing in Rust 2021, which may affect this macro - --> $DIR/macro-or-patterns-back-compat.rs:11:21 + --> $DIR/macro-or-patterns-back-compat.rs:12:21 | LL | macro_rules! foo { ($x:pat | $y:pat) => {} } | ^^^^^^ help: use pat_param to preserve semantics: `$x:pat_param` @@ -7,13 +7,13 @@ LL | macro_rules! foo { ($x:pat | $y:pat) => {} } = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021! = note: for more information, see note: the lint level is defined here - --> $DIR/macro-or-patterns-back-compat.rs:5:9 + --> $DIR/macro-or-patterns-back-compat.rs:6:9 | LL | #![deny(rust_2021_incompatible_or_patterns)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: the meaning of the `pat` fragment specifier is changing in Rust 2021, which may affect this macro - --> $DIR/macro-or-patterns-back-compat.rs:14:23 + --> $DIR/macro-or-patterns-back-compat.rs:15:23 | LL | macro_rules! bar { ($($x:pat)+ | $($y:pat)+) => {} } | ^^^^^^ help: use pat_param to preserve semantics: `$x:pat_param` @@ -22,7 +22,7 @@ LL | macro_rules! bar { ($($x:pat)+ | $($y:pat)+) => {} } = note: for more information, see error: the meaning of the `pat` fragment specifier is changing in Rust 2021, which may affect this macro - --> $DIR/macro-or-patterns-back-compat.rs:20:21 + --> $DIR/macro-or-patterns-back-compat.rs:21:21 | LL | macro_rules! ogg { ($x:pat | $y:pat_param) => {} } | ^^^^^^ help: use pat_param to preserve semantics: `$x:pat_param` @@ -31,7 +31,7 @@ LL | macro_rules! ogg { ($x:pat | $y:pat_param) => {} } = note: for more information, see error: the meaning of the `pat` fragment specifier is changing in Rust 2021, which may affect this macro - --> $DIR/macro-or-patterns-back-compat.rs:24:26 + --> $DIR/macro-or-patterns-back-compat.rs:25:26 | LL | ( $expr:expr , $( $( $pat:pat )|+ => $expr_arm:expr ),+ ) => { | ^^^^^^^^ help: use pat_param to preserve semantics: `$pat:pat_param` diff --git a/tests/ui/macros/macro-pat-follow-2018.rs b/tests/ui/macros/macro-pat-follow-2018.rs index b2a556fce6f9e..37752271c7f0e 100644 --- a/tests/ui/macros/macro-pat-follow-2018.rs +++ b/tests/ui/macros/macro-pat-follow-2018.rs @@ -1,5 +1,6 @@ //@ check-pass //@ edition:2018 +//@ reference: macro.decl.follow-set.edition2021 macro_rules! pat_bar { ($p:pat | $p2:pat) => {{ diff --git a/tests/ui/macros/macro-pat-follow.rs b/tests/ui/macros/macro-pat-follow.rs index 830cc7c0860d1..dfea3e8f7630e 100644 --- a/tests/ui/macros/macro-pat-follow.rs +++ b/tests/ui/macros/macro-pat-follow.rs @@ -1,4 +1,5 @@ //@ run-pass +//@ reference: macro.decl.follow-set.token-pat macro_rules! pat_in { ($p:pat in $e:expr) => {{ let mut iter = $e.into_iter(); diff --git a/tests/ui/macros/macro-pat-pattern-followed-by-or-in-2021.rs b/tests/ui/macros/macro-pat-pattern-followed-by-or-in-2021.rs index 154d6e339a7f9..b300398dd666f 100644 --- a/tests/ui/macros/macro-pat-pattern-followed-by-or-in-2021.rs +++ b/tests/ui/macros/macro-pat-pattern-followed-by-or-in-2021.rs @@ -1,4 +1,5 @@ //@ edition:2021 +//@ reference: macro.decl.follow-set.token-pat #![allow(unused_macros)] macro_rules! foo { ($x:pat | $y:pat) => {} } //~ ERROR `$x:pat` is followed by `|`, which is not allowed for `pat` fragments macro_rules! bar { ($($x:pat)+ | $($y:pat)+) => {} } //~ ERROR `$x:pat` is followed by `|`, which is not allowed for `pat` fragments diff --git a/tests/ui/macros/macro-pat-pattern-followed-by-or-in-2021.stderr b/tests/ui/macros/macro-pat-pattern-followed-by-or-in-2021.stderr index 9179fbc31961c..78500705d2350 100644 --- a/tests/ui/macros/macro-pat-pattern-followed-by-or-in-2021.stderr +++ b/tests/ui/macros/macro-pat-pattern-followed-by-or-in-2021.stderr @@ -1,5 +1,5 @@ error: `$x:pat` is followed by `|`, which is not allowed for `pat` fragments - --> $DIR/macro-pat-pattern-followed-by-or-in-2021.rs:3:28 + --> $DIR/macro-pat-pattern-followed-by-or-in-2021.rs:4:28 | LL | macro_rules! foo { ($x:pat | $y:pat) => {} } | ------ ^ not allowed after `pat` fragments @@ -9,7 +9,7 @@ LL | macro_rules! foo { ($x:pat | $y:pat) => {} } = note: allowed there are: `=>`, `,`, `=`, `if`, `if let` or `in` error: `$x:pat` is followed by `|`, which is not allowed for `pat` fragments - --> $DIR/macro-pat-pattern-followed-by-or-in-2021.rs:4:32 + --> $DIR/macro-pat-pattern-followed-by-or-in-2021.rs:5:32 | LL | macro_rules! bar { ($($x:pat)+ | $($y:pat)+) => {} } | ------ ^ not allowed after `pat` fragments @@ -19,7 +19,7 @@ LL | macro_rules! bar { ($($x:pat)+ | $($y:pat)+) => {} } = note: allowed there are: `=>`, `,`, `=`, `if`, `if let` or `in` error: `$pat:pat` may be followed by `|`, which is not allowed for `pat` fragments - --> $DIR/macro-pat-pattern-followed-by-or-in-2021.rs:7:36 + --> $DIR/macro-pat-pattern-followed-by-or-in-2021.rs:8:36 | LL | ( $expr:expr , $( $( $pat:pat )|+ => $expr_arm:expr ),+ ) => { | -------- ^ not allowed after `pat` fragments diff --git a/tests/ui/macros/macro-pat-pattern-followed-by-or.rs b/tests/ui/macros/macro-pat-pattern-followed-by-or.rs index 59d26a9af2e10..f5a56a7e8edda 100644 --- a/tests/ui/macros/macro-pat-pattern-followed-by-or.rs +++ b/tests/ui/macros/macro-pat-pattern-followed-by-or.rs @@ -1,5 +1,7 @@ //@ edition:2015..2021 //@ run-pass +//@ reference: macro.decl.follow-set.token-pat +//@ reference: macro.decl.follow-set.edition2021 #![allow(unused_macros)] macro_rules! foo { ($x:pat | $y:pat) => {} } // should be ok macro_rules! bar { ($($x:pat)+ | $($y:pat)+) => {} } // should be ok diff --git a/tests/ui/macros/macro-pat2021-pattern-followed-by-or.rs b/tests/ui/macros/macro-pat2021-pattern-followed-by-or.rs index c7dc5d53a9862..a690503a802af 100644 --- a/tests/ui/macros/macro-pat2021-pattern-followed-by-or.rs +++ b/tests/ui/macros/macro-pat2021-pattern-followed-by-or.rs @@ -1,4 +1,6 @@ //@ edition:2021 +//@ reference: macro.decl.follow-set.token-pat +//@ reference: macro.decl.follow-set.edition2021 #![allow(unused_macros)] macro_rules! foo { ($x:pat | $y:pat) => {} } //~ ERROR `$x:pat` is followed by `|`, which is not allowed for `pat` fragments diff --git a/tests/ui/macros/macro-pat2021-pattern-followed-by-or.stderr b/tests/ui/macros/macro-pat2021-pattern-followed-by-or.stderr index af76e3f095f15..2906272af8ad0 100644 --- a/tests/ui/macros/macro-pat2021-pattern-followed-by-or.stderr +++ b/tests/ui/macros/macro-pat2021-pattern-followed-by-or.stderr @@ -1,5 +1,5 @@ error: `$x:pat` is followed by `|`, which is not allowed for `pat` fragments - --> $DIR/macro-pat2021-pattern-followed-by-or.rs:4:28 + --> $DIR/macro-pat2021-pattern-followed-by-or.rs:6:28 | LL | macro_rules! foo { ($x:pat | $y:pat) => {} } | ------ ^ not allowed after `pat` fragments @@ -9,7 +9,7 @@ LL | macro_rules! foo { ($x:pat | $y:pat) => {} } = note: allowed there are: `=>`, `,`, `=`, `if`, `if let` or `in` error: `$x:pat` is followed by `|`, which is not allowed for `pat` fragments - --> $DIR/macro-pat2021-pattern-followed-by-or.rs:7:28 + --> $DIR/macro-pat2021-pattern-followed-by-or.rs:9:28 | LL | macro_rules! ogg { ($x:pat | $y:pat_param) => {} } | ------ ^ not allowed after `pat` fragments @@ -19,7 +19,7 @@ LL | macro_rules! ogg { ($x:pat | $y:pat_param) => {} } = note: allowed there are: `=>`, `,`, `=`, `if`, `if let` or `in` error: `$pat:pat` may be followed by `|`, which is not allowed for `pat` fragments - --> $DIR/macro-pat2021-pattern-followed-by-or.rs:9:35 + --> $DIR/macro-pat2021-pattern-followed-by-or.rs:11:35 | LL | ( $expr:expr , $( $( $pat:pat)|+ => $expr_arm:pat),+ ) => { | -------- ^ not allowed after `pat` fragments diff --git a/tests/ui/macros/macro-rules-as-derive-or-attr-issue-132928.rs b/tests/ui/macros/macro-rules-as-derive-or-attr-issue-132928.rs index a556983e204df..e31c20644fceb 100644 --- a/tests/ui/macros/macro-rules-as-derive-or-attr-issue-132928.rs +++ b/tests/ui/macros/macro-rules-as-derive-or-attr-issue-132928.rs @@ -1,3 +1,4 @@ +//@ reference: names.namespaces.sub-namespaces.intro #![crate_type = "lib"] macro_rules! sample { () => {} } diff --git a/tests/ui/macros/macro-rules-as-derive-or-attr-issue-132928.stderr b/tests/ui/macros/macro-rules-as-derive-or-attr-issue-132928.stderr index a3c21df43e758..43e893ecb3141 100644 --- a/tests/ui/macros/macro-rules-as-derive-or-attr-issue-132928.stderr +++ b/tests/ui/macros/macro-rules-as-derive-or-attr-issue-132928.stderr @@ -1,5 +1,5 @@ error: cannot find attribute `sample` in this scope - --> $DIR/macro-rules-as-derive-or-attr-issue-132928.rs:5:3 + --> $DIR/macro-rules-as-derive-or-attr-issue-132928.rs:6:3 | LL | macro_rules! sample { () => {} } | ------ `sample` exists, but has no `attr` rules @@ -8,7 +8,7 @@ LL | #[sample] | ^^^^^^ error: cannot find derive macro `sample` in this scope - --> $DIR/macro-rules-as-derive-or-attr-issue-132928.rs:6:10 + --> $DIR/macro-rules-as-derive-or-attr-issue-132928.rs:7:10 | LL | macro_rules! sample { () => {} } | ------ `sample` exists, but has no `derive` rules @@ -17,7 +17,7 @@ LL | #[derive(sample)] | ^^^^^^ error: cannot find derive macro `sample` in this scope - --> $DIR/macro-rules-as-derive-or-attr-issue-132928.rs:6:10 + --> $DIR/macro-rules-as-derive-or-attr-issue-132928.rs:7:10 | LL | macro_rules! sample { () => {} } | ------ `sample` exists, but has no `derive` rules diff --git a/tests/ui/macros/macro-shadowing.rs b/tests/ui/macros/macro-shadowing.rs index 710e83dfb3b99..87ed7c8d8fb09 100644 --- a/tests/ui/macros/macro-shadowing.rs +++ b/tests/ui/macros/macro-shadowing.rs @@ -1,4 +1,6 @@ //@ aux-build:two_macros.rs +//@ reference: macro.decl.scope.textual.shadow +//@ reference: names.resolution.expansion.macros.ambiguity.more-expanded-vs-outer #![allow(unused_macros)] diff --git a/tests/ui/macros/macro-shadowing.stderr b/tests/ui/macros/macro-shadowing.stderr index a052b43ac10e4..cf2a57d6319dd 100644 --- a/tests/ui/macros/macro-shadowing.stderr +++ b/tests/ui/macros/macro-shadowing.stderr @@ -1,5 +1,5 @@ error: `macro_two` is already in scope - --> $DIR/macro-shadowing.rs:12:5 + --> $DIR/macro-shadowing.rs:14:5 | LL | #[macro_use] | ^^^^^^^^^^^^ @@ -11,14 +11,14 @@ LL | m1!(); = note: this error originates in the macro `m1` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0659]: `foo` is ambiguous - --> $DIR/macro-shadowing.rs:17:1 + --> $DIR/macro-shadowing.rs:19:1 | LL | foo!(); | ^^^ ambiguous name | = note: ambiguous because of a conflict between a macro-expanded name and a less macro-expanded name from outer scope during import or macro resolution note: `foo` could refer to the macro defined here - --> $DIR/macro-shadowing.rs:10:5 + --> $DIR/macro-shadowing.rs:12:5 | LL | macro_rules! foo { () => {} } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -26,7 +26,7 @@ LL | macro_rules! foo { () => {} } LL | m1!(); | ----- in this macro invocation note: `foo` could also refer to the macro defined here - --> $DIR/macro-shadowing.rs:5:1 + --> $DIR/macro-shadowing.rs:7:1 | LL | macro_rules! foo { () => {} } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/tests/ui/macros/macro-use-all-and-none.rs b/tests/ui/macros/macro-use-all-and-none.rs index 53d450ed8d581..c56a55c4cb193 100644 --- a/tests/ui/macros/macro-use-all-and-none.rs +++ b/tests/ui/macros/macro-use-all-and-none.rs @@ -1,5 +1,6 @@ //@ check-pass //@ aux-build:two_macros-rpass.rs +//@ reference: macro.decl.scope.macro_use.duplicates #![warn(unused_attributes)] diff --git a/tests/ui/macros/macro-use-all-and-none.stderr b/tests/ui/macros/macro-use-all-and-none.stderr index b4c05adcb33d0..0b137ef040958 100644 --- a/tests/ui/macros/macro-use-all-and-none.stderr +++ b/tests/ui/macros/macro-use-all-and-none.stderr @@ -1,12 +1,12 @@ warning: unused attribute - --> $DIR/macro-use-all-and-none.rs:7:12 + --> $DIR/macro-use-all-and-none.rs:8:12 | LL | #[macro_use()] | ^^ help: remove these parentheses | = note: using `macro_use` with an empty list is equivalent to not using a list at all note: the lint level is defined here - --> $DIR/macro-use-all-and-none.rs:4:9 + --> $DIR/macro-use-all-and-none.rs:5:9 | LL | #![warn(unused_attributes)] | ^^^^^^^^^^^^^^^^^ diff --git a/tests/ui/macros/macro-use-bad-args-1.rs b/tests/ui/macros/macro-use-bad-args-1.rs index bfc19981804d0..0f078da44009a 100644 --- a/tests/ui/macros/macro-use-bad-args-1.rs +++ b/tests/ui/macros/macro-use-bad-args-1.rs @@ -1,3 +1,4 @@ +//@ reference: macro.decl.scope.macro_use.syntax #![no_std] #[macro_use(foo(bar))] //~ ERROR malformed `macro_use` attribute input diff --git a/tests/ui/macros/macro-use-bad-args-1.stderr b/tests/ui/macros/macro-use-bad-args-1.stderr index 542b4ae2b7a5e..d1b6b39e4ec17 100644 --- a/tests/ui/macros/macro-use-bad-args-1.stderr +++ b/tests/ui/macros/macro-use-bad-args-1.stderr @@ -1,5 +1,5 @@ error[E0565]: malformed `macro_use` attribute input - --> $DIR/macro-use-bad-args-1.rs:3:1 + --> $DIR/macro-use-bad-args-1.rs:4:1 | LL | #[macro_use(foo(bar))] | ^^^^^^^^^^^^^^^-----^^ diff --git a/tests/ui/macros/macro-use-bad-args-2.rs b/tests/ui/macros/macro-use-bad-args-2.rs index e328b6285d91e..86cb09a66756c 100644 --- a/tests/ui/macros/macro-use-bad-args-2.rs +++ b/tests/ui/macros/macro-use-bad-args-2.rs @@ -1,3 +1,4 @@ +//@ reference: macro.decl.scope.macro_use.syntax #![no_std] #[macro_use(foo="bar")] //~ ERROR malformed `macro_use` attribute input diff --git a/tests/ui/macros/macro-use-bad-args-2.stderr b/tests/ui/macros/macro-use-bad-args-2.stderr index 2db9ffe50b042..f5b577a1ca934 100644 --- a/tests/ui/macros/macro-use-bad-args-2.stderr +++ b/tests/ui/macros/macro-use-bad-args-2.stderr @@ -1,5 +1,5 @@ error[E0565]: malformed `macro_use` attribute input - --> $DIR/macro-use-bad-args-2.rs:3:1 + --> $DIR/macro-use-bad-args-2.rs:4:1 | LL | #[macro_use(foo="bar")] | ^^^^^^^^^^^^^^^------^^ diff --git a/tests/ui/macros/macro-use-both.rs b/tests/ui/macros/macro-use-both.rs index c41797513f6a3..2fdb90dced75b 100644 --- a/tests/ui/macros/macro-use-both.rs +++ b/tests/ui/macros/macro-use-both.rs @@ -1,5 +1,7 @@ //@ check-pass //@ aux-build:two_macros.rs +//@ reference: macro.decl.scope.macro_use.syntax +//@ reference: macro.decl.scope.macro_use.prelude #[macro_use(macro_one, macro_two)] extern crate two_macros; diff --git a/tests/ui/macros/module-macro_use-arguments.rs b/tests/ui/macros/module-macro_use-arguments.rs index 121b492e25437..c459e190d8b99 100644 --- a/tests/ui/macros/module-macro_use-arguments.rs +++ b/tests/ui/macros/module-macro_use-arguments.rs @@ -1,3 +1,4 @@ +//@ reference: macro.decl.scope.macro_use.syntax #[macro_use(foo, bar)] //~ ERROR arguments to `macro_use` are not allowed here mod foo { } diff --git a/tests/ui/macros/module-macro_use-arguments.stderr b/tests/ui/macros/module-macro_use-arguments.stderr index 3ac645ad3a93f..8741103ea8dd4 100644 --- a/tests/ui/macros/module-macro_use-arguments.stderr +++ b/tests/ui/macros/module-macro_use-arguments.stderr @@ -1,5 +1,5 @@ error: arguments to `macro_use` are not allowed here - --> $DIR/module-macro_use-arguments.rs:1:1 + --> $DIR/module-macro_use-arguments.rs:2:1 | LL | #[macro_use(foo, bar)] | ^^^^^^^^^^^^^^^^^^^^^^