Merge pull request #19327 from Veykril/push-qyyvkulltzpz

Fix `path` macro hygiene
This commit is contained in:
Lukas Wirth 2025-03-10 08:45:04 +00:00 committed by GitHub
commit f53d1eba48
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 6 additions and 2 deletions

View File

@ -5,6 +5,8 @@
//! expansion.
#![cfg_attr(feature = "in-rust-tree", feature(rustc_private))]
pub use intern;
pub mod attrs;
pub mod builtin;
pub mod change;

View File

@ -388,7 +388,7 @@ macro_rules! __path {
($start:ident $(:: $seg:ident)*) => ({
$crate::__known_path!($start $(:: $seg)*);
$crate::mod_path::ModPath::from_segments($crate::mod_path::PathKind::Abs, vec![
$crate::name::Name::new_symbol_root(intern::sym::$start.clone()), $($crate::name::Name::new_symbol_root(intern::sym::$seg.clone()),)*
$crate::name::Name::new_symbol_root($crate::intern::sym::$start.clone()), $($crate::name::Name::new_symbol_root($crate::intern::sym::$seg.clone()),)*
])
});
}
@ -399,7 +399,7 @@ pub use crate::__path as path;
macro_rules! __tool_path {
($start:ident $(:: $seg:ident)*) => ({
$crate::mod_path::ModPath::from_segments($crate::mod_path::PathKind::Plain, vec![
$crate::name::Name::new_symbol_root(intern::sym::rust_analyzer.clone()), $crate::name::Name::new_symbol_root(intern::sym::$start.clone()), $($crate::name::Name::new_symbol_root(intern::sym::$seg.clone()),)*
$crate::name::Name::new_symbol_root($crate::intern::sym::rust_analyzer.clone()), $crate::name::Name::new_symbol_root($crate::intern::sym::$start.clone()), $($crate::name::Name::new_symbol_root($crate::intern::sym::$seg.clone()),)*
])
});
}

View File

@ -139,6 +139,7 @@ pub use {
},
hygiene::{marks_rev, SyntaxContextExt},
inert_attr_macro::AttributeTemplate,
mod_path::tool_path,
name::Name,
prettify_macro_expansion,
proc_macro::{ProcMacros, ProcMacrosBuilder},

View File

@ -185,6 +185,7 @@ define_symbols! {
Clone,
coerce_unsized,
column,
completion,
compile_error,
concat_bytes,
concat_idents,