Auto merge of #155710 - tgross35:rollup-skXlTFI, r=tgross35

Rollup of 7 pull requests

Successful merges:

 - rust-lang/rust#155660 (c-variadic: fix for sparc64)
 - rust-lang/rust#153482 (tests/ui/macros: add annotations for reference rules)
 - rust-lang/rust#155075 (Add docs about SDKs and C compilation on armv7a-vex-v5)
 - rust-lang/rust#155685 (Fix `get_child_at_index` return type hints)
 - rust-lang/rust#155686 (Fix array template arg lookup behavior)
 - rust-lang/rust#155689 (Const initialize `LOCK_LATCH` thread local)
 - rust-lang/rust#155690 (Fix classify_union to return Union for regular unions)
This commit is contained in:
bors
2026-04-24 02:27:01 +00:00
55 changed files with 436 additions and 184 deletions
+21 -1
View File
@@ -88,11 +88,30 @@ enum SlotSize {
Bytes1 = 1,
}
/// Whether to respect a value alignment that is higher than the slot alignment.
///
/// When `No` the argument is in the next slot, when `Yes` there will be empty slots
/// until a slot's starting address has the required alignment.
enum AllowHigherAlign {
No,
Yes,
}
/// Determines where in the slot the value is located. Only takes effect on big-endian targets.
///
/// with 8-byte slots, a 32-bit integer is either stored right-adjusted:
///
/// ```text
/// [0x0, 0x0, 0x0, 0x0, 0xaa, 0xaa, 0xaa, 0xaa]
/// ```
///
/// or left-adjusted:
///
/// ```text
/// [0xaa, 0xaa, 0xaa, 0xaa, 0x0, 0x0, 0x0, 0x0]
/// ```
///
/// Most big-endian targets store values as right-adjusted.
enum ForceRightAdjust {
No,
Yes,
@@ -1169,7 +1188,8 @@ pub(super) fn emit_va_arg<'ll, 'tcx>(
if target_ty_size > 2 * 8 { PassMode::Indirect } else { PassMode::Direct },
SlotSize::Bytes8,
AllowHigherAlign::Yes,
ForceRightAdjust::No,
// sparc64 is a big-endian target and stores variable arguments right-adjusted.
ForceRightAdjust::Yes,
),
Arch::Mips | Arch::Mips32r6 | Arch::Mips64 | Arch::Mips64r6 => emit_ptr_va_arg(
bx,
+1 -1
View File
@@ -220,7 +220,7 @@ pub(super) struct LockLatch {
impl LockLatch {
#[inline]
pub(super) fn new() -> LockLatch {
pub(super) const fn new() -> LockLatch {
LockLatch { m: Mutex::new(false), v: Condvar::new() }
}
+1 -1
View File
@@ -524,7 +524,7 @@ unsafe fn in_worker_cold<OP, R>(&self, op: OP) -> R
OP: FnOnce(&WorkerThread, bool) -> R + Send,
R: Send,
{
thread_local!(static LOCK_LATCH: LockLatch = LockLatch::new());
thread_local!(static LOCK_LATCH: LockLatch = const { LockLatch::new() });
LOCK_LATCH.with(|l| {
// This thread isn't a member of *any* thread pool, so just block.
@@ -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.
+19 -21
View File
@@ -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 @@ class DefaultSyntheticProvider:
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 @@ class IndirectionSyntheticProvider:
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 @@ class EmptySyntheticProvider:
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 @@ class StructSyntheticProvider:
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 @@ class StdStringSyntheticProvider:
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 @@ class MSVCStrSyntheticProvider:
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 @@ class ClangEncodedEnumProvider:
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 @@ class MSVCEnumSyntheticProvider:
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 @@ class TupleSyntheticProvider:
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 @@ class MSVCTupleSyntheticProvider:
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 @@ class StdVecSyntheticProvider:
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 @@ class StdSliceSyntheticProvider:
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 @@ class StdVecDequeSyntheticProvider:
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 @@ class StdOldHashMapSyntheticProvider:
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 @@ class StdHashMapSyntheticProvider:
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 @@ class StdRcSyntheticProvider:
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 @@ class StdCellSyntheticProvider:
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 @@ class StdRefSyntheticProvider:
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:
+1 -1
View File
@@ -130,4 +130,4 @@ def classify_union(fields: List) -> RustType:
assert len(fields) == 1
return RustType.CompressedEnum
else:
return RustType.RegularEnum
return RustType.Union
@@ -7,7 +7,9 @@
#![crate_type = "lib"]
#![feature(c_variadic)]
// Check that the assembly that rustc generates matches what clang emits.
// Check that the assembly that rustc generates matches what clang emits. This example in particular
// is related to https://github.com/rust-lang/rust/pull/144549 and shows the effect of us correctly
// emitting annotations that start and end the lifetime of the va_list.
#[unsafe(no_mangle)]
unsafe extern "C" fn variadic(a: f64, mut args: ...) -> f64 {
+112
View File
@@ -0,0 +1,112 @@
//@ add-minicore
//@ assembly-output: emit-asm
//
//@ revisions: SPARC SPARC64
//@ [SPARC] compile-flags: -Copt-level=3 --target sparc-unknown-linux-gnu
//@ [SPARC] needs-llvm-components: sparc
//@ [SPARC64] compile-flags: -Copt-level=3 --target sparc64-unknown-linux-gnu
//@ [SPARC64] needs-llvm-components: sparc
#![feature(c_variadic, no_core, lang_items, intrinsics, rustc_attrs, asm_experimental_arch)]
#![no_core]
#![crate_type = "lib"]
// Check that the assembly that rustc generates matches what clang emits.
extern crate minicore;
use minicore::*;
#[lang = "va_arg_safe"]
pub unsafe trait VaArgSafe {}
unsafe impl VaArgSafe for i32 {}
unsafe impl VaArgSafe for i64 {}
unsafe impl VaArgSafe for f64 {}
unsafe impl<T> VaArgSafe for *const T {}
#[repr(transparent)]
struct VaListInner {
ptr: *const c_void,
}
#[repr(transparent)]
#[lang = "va_list"]
pub struct VaList<'a> {
inner: VaListInner,
_marker: PhantomData<&'a mut ()>,
}
#[rustc_intrinsic]
#[rustc_nounwind]
pub const unsafe fn va_arg<T: VaArgSafe>(ap: &mut VaList<'_>) -> T;
#[unsafe(no_mangle)]
unsafe extern "C" fn read_f64(ap: &mut VaList<'_>) -> f64 {
// CHECK-LABEL: read_f64
//
// SPARC: ld [%o0], %o1
// SPARC-NEXT: add %o1, 8, %o2
// SPARC-NEXT: st %o2, [%o0]
// SPARC-NEXT: ld [%o1+4], %o0
// SPARC-NEXT: add %sp, 96, %o2
// SPARC-NEXT: or %o2, 4, %o2
// SPARC-NEXT: st %o0, [%o2]
// SPARC-NEXT: ld [%o1], %o0
// SPARC-NEXT: st %o0, [%sp+96]
// SPARC-NEXT: ldd [%sp+96], %f0
// SPARC-NEXT: retl
// SPARC-NEXT: add %sp, 104, %sp
//
// SPARC64: ldx [%o0], %o1
// SPARC64-NEXT: add %o1, 8, %o2
// SPARC64-NEXT: stx %o2, [%o0]
// SPARC64-NEXT: retl
// SPARC64-NEXT: ldd [%o1], %f0
va_arg(ap)
}
#[unsafe(no_mangle)]
unsafe extern "C" fn read_i32(ap: &mut VaList<'_>) -> i32 {
// CHECK-LABEL: read_i32
//
// SPARC: ld [%o0], %o1
// SPARC-NEXT: add %o1, 4, %o2
// SPARC-NEXT: st %o2, [%o0]
// SPARC-NEXT: retl
// SPARC-NEXT: ld [%o1], %o0
//
// SPARC64: ldx [%o0], %o1
// SPARC64-NEXT: add %o1, 8, %o2
// SPARC64-NEXT: stx %o2, [%o0]
// SPARC64-NEXT: retl
// SPARC64-NEXT: ldsw [%o1+4], %o0
va_arg(ap)
}
#[unsafe(no_mangle)]
unsafe extern "C" fn read_i64(ap: &mut VaList<'_>) -> i64 {
// CHECK-LABEL: read_i64
//
// SPARC: ld [%o0], %o1
// SPARC-NEXT: add %o1, 4, %o2
// SPARC-NEXT: st %o2, [%o0]
// SPARC-NEXT: ld [%o1], %o2
// SPARC-NEXT: add %o1, 8, %o3
// SPARC-NEXT: st %o3, [%o0]
// SPARC-NEXT: ld [%o1+4], %o1
// SPARC-NEXT: retl
// SPARC-NEXT: mov %o2, %o0
//
// SPARC64: ldx [%o0], %o1
// SPARC64-NEXT: add %o1, 8, %o2
// SPARC64-NEXT: stx %o2, [%o0]
// SPARC64-NEXT: retl
// SPARC64-NEXT: ldx [%o1], %o0
va_arg(ap)
}
#[unsafe(no_mangle)]
unsafe extern "C" fn read_ptr(ap: &mut VaList<'_>) -> *const u8 {
// SPARC: read_ptr = read_i32
// SPARC64: read_ptr = read_i64
va_arg(ap)
}
+1
View File
@@ -1,5 +1,6 @@
//@ check-pass
//@ edition: 2015
//@ reference: macro.decl.meta.edition2024
// Ensures expr_2021 fragment specifier is accepted in old editions
@@ -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) => {
| ^^^^^^^
@@ -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) => {
| ^^^^^^^^^^^^
@@ -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 {
@@ -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) => {
| ^^^^^^^
@@ -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) => {
| ^^^^^^^^^^^^
@@ -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 {
@@ -1,3 +1,4 @@
//@ reference: macro.decl.transcription.lookahead
fn main() {}
macro_rules! ambiguity {
@@ -1,14 +1,14 @@
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
|
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
|
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:9:12
|
LL | ambiguity!(error);
| ^^^^^
error: aborting due to 2 previous errors
+1
View File
@@ -1,3 +1,4 @@
//@ reference: macro.decl.syntax
macro_rules! foo {
($a:expr) => a; //~ ERROR macro rhs must be delimited
}
+2 -2
View File
@@ -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) = ();
| ^^^^^^^^^^^
+5
View File
@@ -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).
+3 -1
View File
@@ -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)]
+89 -89
View File
@@ -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
@@ -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.
@@ -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
+1
View File
@@ -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.
@@ -1,3 +1,4 @@
//@ reference: macro.decl.hygiene.intro
macro_rules! print_it { {} => { println!("{:?}", it); } }
//~^ ERROR cannot find value `it` in this scope
@@ -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 = ();
| ^^
@@ -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
@@ -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 = (); } }
| ^^
@@ -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'.
@@ -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 {
| ^
@@ -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)]
@@ -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)]
@@ -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 <https://doc.rust-lang.org/edition-guide/rust-2021/or-patterns-macro-rules.html>
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 <https://doc.rust-lang.org/edition-guide/rust-2021/or-patterns-macro-rules.html>
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 <https://doc.rust-lang.org/edition-guide/rust-2021/or-patterns-macro-rules.html>
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`
+1
View File
@@ -1,5 +1,6 @@
//@ check-pass
//@ edition:2018
//@ reference: macro.decl.follow-set.edition2021
macro_rules! pat_bar {
($p:pat | $p2:pat) => {{
+1
View File
@@ -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();
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -1,3 +1,4 @@
//@ reference: names.namespaces.sub-namespaces.intro
#![crate_type = "lib"]
macro_rules! sample { () => {} }
@@ -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
+2
View File
@@ -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)]
+4 -4
View File
@@ -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 { () => {} }
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -1,5 +1,6 @@
//@ check-pass
//@ aux-build:two_macros-rpass.rs
//@ reference: macro.decl.scope.macro_use.duplicates
#![warn(unused_attributes)]
@@ -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)]
| ^^^^^^^^^^^^^^^^^
+1
View File
@@ -1,3 +1,4 @@
//@ reference: macro.decl.scope.macro_use.syntax
#![no_std]
#[macro_use(foo(bar))] //~ ERROR malformed `macro_use` attribute input
+1 -1
View File
@@ -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))]
| ^^^^^^^^^^^^^^^-----^^
+1
View File
@@ -1,3 +1,4 @@
//@ reference: macro.decl.scope.macro_use.syntax
#![no_std]
#[macro_use(foo="bar")] //~ ERROR malformed `macro_use` attribute input
+1 -1
View File
@@ -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")]
| ^^^^^^^^^^^^^^^------^^
+2
View File
@@ -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;
@@ -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 {
}
@@ -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)]
| ^^^^^^^^^^^^^^^^^^^^^^