Skip to content

Conversation

@ChayimFriedman2
Copy link
Contributor

@ChayimFriedman2 ChayimFriedman2 commented Nov 25, 2024

Fixes #17321. Fixes #15634.

I don't think this is the same cause as #18387 (I'll try to work on it, no promises), but just in case: CC @compiler-errors.

@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Nov 25, 2024
Comment on lines +79 to +80
// Make up an invalid file id, so that if we will try to actually access it salsa will panic.
file_id: file_id.into(),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not a fan of this i have to say, I'd rather we pass the original file id even if it shouldn't ever be used. If we do use it and trigger a panic it will end up confusing devs that don't know of this part

Copy link
Contributor Author

@ChayimFriedman2 ChayimFriedman2 Dec 2, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we use the original file we can also trigger panics, only they will be less consistent and harder to debug. That was my motivation for doing it, although I agree it's not great.

Also note that the file ID is private to LowerCtx, so it should be easier to protect.


/// Resolve a path as-if it was written at the given scope. This is
/// necessary a heuristic, as it doesn't take hygiene into account.
pub fn speculative_resolve(&self, ast_path: &ast::Path) -> Option<PathResolution> {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not a blocker for this, but I wonder if this is a good API here. It feels brittle passing an ast node that isn't even from an actual file/expansion and then lowering it.

@Veykril Veykril added this pull request to the merge queue Dec 3, 2024
Merged via the queue into rust-lang:master with commit e6276c8 Dec 3, 2024
9 checks passed
@ChayimFriedman2 ChayimFriedman2 deleted the issue-17321 branch December 3, 2024 15:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

S-waiting-on-review Status: Awaiting review from the assignee but also interested parties.

Projects

None yet

3 participants