about summary refs log tree commit diff
path: root/compiler/rustc_expand/src
diff options
context:
space:
mode:
authorNicholas Nethercote <n.nethercote@gmail.com>2021-12-15 08:32:21 +1100
committerNicholas Nethercote <n.nethercote@gmail.com>2021-12-15 13:30:26 +1100
commit8cddcd39ba2189da859a5164804556190906ee2a (patch)
tree80c9ffaa12dad22abec107679298920b1f07509a /compiler/rustc_expand/src
parent22f8bde876f2fa9c5c4e95be1bce29cc271f2b51 (diff)
downloadrust-8cddcd39ba2189da859a5164804556190906ee2a.tar.gz
rust-8cddcd39ba2189da859a5164804556190906ee2a.zip
Remove `SymbolStr`.
By changing `as_str()` to take `&self` instead of `self`, we can just
return `&str`. We're still lying about lifetimes, but it's a smaller lie
than before, where `SymbolStr` contained a (fake) `&'static str`!
Diffstat (limited to 'compiler/rustc_expand/src')
-rw-r--r--compiler/rustc_expand/src/module.rs10
1 files changed, 6 insertions, 4 deletions
diff --git a/compiler/rustc_expand/src/module.rs b/compiler/rustc_expand/src/module.rs
index 1c0b2a9b487..43fd94ce8a7 100644
--- a/compiler/rustc_expand/src/module.rs
+++ b/compiler/rustc_expand/src/module.rs
@@ -170,8 +170,8 @@ fn mod_file_path_from_attr(
 ) -> Option<PathBuf> {
     // Extract path string from first `#[path = "path_string"]` attribute.
     let first_path = attrs.iter().find(|at| at.has_name(sym::path))?;
-    let path_string = match first_path.value_str() {
-        Some(s) => s.as_str(),
+    let path_sym = match first_path.value_str() {
+        Some(s) => s,
         None => {
             // This check is here mainly to catch attempting to use a macro,
             // such as #[path = concat!(...)]. This isn't currently supported
@@ -189,14 +189,16 @@ fn mod_file_path_from_attr(
         }
     };
 
+    let path_str = path_sym.as_str();
+
     // On windows, the base path might have the form
     // `\\?\foo\bar` in which case it does not tolerate
     // mixed `/` and `\` separators, so canonicalize
     // `/` to `\`.
     #[cfg(windows)]
-    let path_string = path_string.replace("/", "\\");
+    let path_str = path_str.replace("/", "\\");
 
-    Some(dir_path.join(&*path_string))
+    Some(dir_path.join(path_str))
 }
 
 /// Returns a path to a module.