rust/tests/ui/parser/macro/unicode-control-codepoints-macros.rs
Matthew Jasper 65bdb31a97 Report text_direction_codepoint_in_literal when parsing
- The lint is now reported in code that gets removed/modified/duplicated
  by macro expansion.
- Spans are more accurate
- Fixes #140281
2025-05-27 15:57:41 +00:00

50 lines
1.2 KiB
Rust
Raw Permalink Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

// Regression test for #140281
//@ edition: 2021
//@ proc-macro: unicode-control.rs
extern crate unicode_control;
use unicode_control::*;
macro_rules! foo {
($x:expr) => {
$x
};
}
macro_rules! empty {
($x:expr) => {};
}
fn main() {
let t = vec![
/// test RTL in doc in vec
//~^ ERROR unicode codepoint changing visible direction of text present in doc comment
1
];
foo!(
/**
* test RTL in doc in macro
*/
//~^^^ ERROR unicode codepoint changing visible direction of text present in doc comment
1
);
empty!(
/**
* test RTL in doc in macro
*/
//~^^^ ERROR unicode codepoint changing visible direction of text present in doc comment
1
);
let x = create_rtl_in_string!(); // OK
forward_stream!(
/// test RTL in doc in proc macro
//~^ ERROR unicode codepoint changing visible direction of text present in doc comment
mod a {}
);
recollect_stream!(
/// test RTL in doc in proc macro
//~^ ERROR unicode codepoint changing visible direction of text present in doc comment
mod b {}
);
}