Skip to content

Conversation

Jazzpirate
Copy link

@Jazzpirate Jazzpirate commented Apr 18, 2025

The previous fix (#3859) from two days ago replaced the call to site.source_file() by site.file(), but the latter returns a (displayable) String rather than something that has a path(), causing compile time errors on nightly.

There are two options that I see:

  1. site.local_file() returns an Option<PathBuf> that needs dealing with before we can defer to span_to_stable_id() as before.
  2. Use site.file() and generate an ID analogous to span_to_stable_id() - notably though, the String returned by site.file() may or may not be stable (e.g. according to the docs, it could return something like "<macro expansion>").

This PR therefore prefers 1. when local_file().is_some() and uses 2. otherwise, in the interest of returning Some if at all possible.

Jazzpirate and others added 3 commits April 18, 2025 08:48
Previous fix replaced call to site.source_file() by site.file(), but the latter returns a (displayable) String rather than something that has a path(), causing compile time errors on nightly.
This fix uses local_file() (Option<PathBuf>) and span_to_stable_id() if possible, and file() (String) and format! otherwise (which may or may not be actually stable)
.replace(['/', '\\'], "-")
@Jazzpirate Jazzpirate closed this by deleting the head repository Aug 9, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant