]> git.proxmox.com Git - rustc.git/blobdiff - compiler/rustc_expand/src/module.rs
New upstream version 1.56.0~beta.4+dfsg1
[rustc.git] / compiler / rustc_expand / src / module.rs
index 4d777049f0d627614d9d322fa7b47d0f175c7753..60d653ac8b6f9be426af54ac13c47fe76aaecf46 100644 (file)
@@ -86,13 +86,12 @@ crate fn mod_dir_path(
     inline: Inline,
 ) -> (PathBuf, DirOwnership) {
     match inline {
+        Inline::Yes if let Some(file_path) = mod_file_path_from_attr(sess, attrs, &module.dir_path) => {
+            // For inline modules file path from `#[path]` is actually the directory path
+            // for historical reasons, so we don't pop the last segment here.
+            (file_path, DirOwnership::Owned { relative: None })
+        }
         Inline::Yes => {
-            if let Some(file_path) = mod_file_path_from_attr(sess, attrs, &module.dir_path) {
-                // For inline modules file path from `#[path]` is actually the directory path
-                // for historical reasons, so we don't pop the last segment here.
-                return (file_path, DirOwnership::Owned { relative: None });
-            }
-
             // We have to push on the current module name in the case of relative
             // paths in order to ensure that any additional module paths from inline
             // `mod x { ... }` come after the relative extension.