-
Notifications
You must be signed in to change notification settings - Fork 12.7k
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
Should we use an enum to encode fields? #75550
Comments
I started writing a naive implementation.
PS: I will put a branch up once everything is compiling, unless someone would like to see the code earlier. |
Nice, could you open a draft PR? |
@lzutao Draft PR opened. |
@rustbot claim |
Super drive by comment, but my gut feeling is that the better fix is to add a type for Wild-guessing even further, I'd suggest pub struct SourceFileName {
// Note absence of pub
name: FileName,
unmapped_name: Option<FileName>
}
impl SourceFileName {
pub fn name(&self) -> &FileName { &self.name }
pub fn unmapped_name(&self) -> &FileName { self.unmpped_name.as_ref().unwrap_or(self.name()) }
} |
Yeah, #75616 looks like a regression rather than improvement to me. |
@petrochenkov @matklad I have started working on the suggestion. The crate itself and some of its dependents compile. |
@matklad Your wild guess seems to be working. @petrochenkov I hope now #75616 is not a regression. |
@rustbot unclaim I am too distracted to finish the pull request. |
Triage: looks like this was fixed in #83813 :) |
Closing as fixed. |
rust/src/librustc_span/lib.rs
Lines 1079 to 1088 in 668a34e
The text was updated successfully, but these errors were encountered: