-
Notifications
You must be signed in to change notification settings - Fork 909
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fallback to dir_path when relative external mod resolution fails #5205
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
fn main( ) { println!("Hello World!") } |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
mod a; | ||
mod b; | ||
mod c; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
fn main( ) { println!("Hello World!") } | ||
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
mod e; | ||
mod f; | ||
mod g; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
This file is contained in the './lib/c/d/' directory. | ||
|
||
The directory name './lib/c/d/' conflicts with the './lib/c/d.rs' file name. | ||
|
||
'./lib/c/d.rs' defines 3 external modules: | ||
|
||
* mod e; | ||
* mod f; | ||
* mod g; | ||
|
||
Module resolution will fail if we look for './lib/c/d/e.rs' or './lib/c/d/e/mod.rs', | ||
so we should fall back to looking for './lib/c/e.rs', which correctly finds the modlue, that | ||
rustfmt should format. | ||
|
||
'./lib/c/d/f.rs' and './lib/c/d/g/mod.rs' exist at the default submodule paths so we should be able | ||
to resolve these modules with no problems. |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
fn main( ) { println!("Hello World!") } |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
fn main( ) { println!("Hello World!") } |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
fn main( ) { println!("Hello World!") } |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
mod d; | ||
|
||
fn main( ) { println!("Hello World!") } |
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
@@ -0,0 +1,16 @@ | ||||||
This file is contained in the './lib' directory. | ||||||
|
||||||
The directory name './lib' conflicts with the './lib.rs' file name. | ||||||
|
||||||
'lib.rs' defines 3 external modules: | ||||||
|
||||||
* mod a; | ||||||
* mod b; | ||||||
* mod c; | ||||||
|
||||||
Module resolution will fail if we look for './lib/a.rs' or './lib/a/mod.rs', | ||||||
so we should fall back to looking for './a.rs', which correctly finds the modlue that | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. minor typo fyi
Suggested change
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Aww man, I'm sorry about that. I totally would have gone back and fixed this before you merged had I had the opportunity to do so before the merge. Unrelated to the typo, but was the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ha no worries. We've typos all over the place 😆 And yes I think the text file with explanatory commentary is helpful in cases like these as it lowers the barrier required to grok especially when trying to eyeball runtime module loading behavior |
||||||
rustfmt should format. | ||||||
|
||||||
'./lib/b.rs' and './lib/c/mod.rs' exist at the default submodule paths so we should be able | ||||||
to resolve these modules with no problems. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fully understand the utility of copy/pasta but for future reference I find it's helpful to make these types of files even subtly different (even just a different fn name) as it stands out more on the off chance we end up mapping the wrong files to modules.
Understand that wouldn't be caught by the particular test here given the nature of the test, just wanted to make a note
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I really appreciate you calling this out!