Unnamed repository; edit this file 'description' to name the repository.
Diffstat (limited to 'crates/hir-expand/src/mod_path.rs')
-rw-r--r--crates/hir-expand/src/mod_path.rs21
1 files changed, 17 insertions, 4 deletions
diff --git a/crates/hir-expand/src/mod_path.rs b/crates/hir-expand/src/mod_path.rs
index 7ecf521987..89eae862bd 100644
--- a/crates/hir-expand/src/mod_path.rs
+++ b/crates/hir-expand/src/mod_path.rs
@@ -273,10 +273,9 @@ fn convert_path(
res
}
}
- ast::PathSegmentKind::SelfTypeKw => ModPath::from_segments(
- PathKind::Plain,
- Some(Name::new_symbol(sym::Self_.clone(), SyntaxContextId::ROOT)),
- ),
+ ast::PathSegmentKind::SelfTypeKw => {
+ ModPath::from_segments(PathKind::Plain, Some(Name::new_symbol_root(sym::Self_.clone())))
+ }
ast::PathSegmentKind::CrateKw => ModPath::from_segments(PathKind::Crate, iter::empty()),
ast::PathSegmentKind::SelfKw => handle_super_kw(0)?,
ast::PathSegmentKind::SuperKw => handle_super_kw(1)?,
@@ -399,6 +398,9 @@ macro_rules! __known_path {
(core::fmt::Debug) => {};
(std::fmt::format) => {};
(core::ops::Try) => {};
+ (core::convert::From) => {};
+ (core::convert::TryFrom) => {};
+ (core::str::FromStr) => {};
($path:path) => {
compile_error!("Please register your known path in the path module")
};
@@ -415,3 +417,14 @@ macro_rules! __path {
}
pub use crate::__path as path;
+
+#[macro_export]
+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()),)*
+ ])
+ });
+}
+
+pub use crate::__tool_path as tool_path;