-
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
Make treat_err_as_bug
Option<NonZeroUsize>
#82255
Conversation
r? @davidtwco (rust-highfive has picked a reviewer for you, use r? to override) |
Historically we haven't tried very much to optimize the slow path (i.e. when an error is emitted). Does this help with normal compilation? (to be clear, I think this is a good change, but if it affects normal perf it should at least have a perf run.) |
I don't think this has any benefits for compilation on the happy path, so I'm not sure if a perf run is necessary (unless this somehow causes regressions). |
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.
Looks good to me, don't think this warrants a perf run.
@bors r+ |
📌 Commit 8ddd846 has been approved by |
Rollup of 12 pull requests Successful merges: - rust-lang#79423 (Enable smart punctuation) - rust-lang#81154 (Improve design of `assert_len`) - rust-lang#81235 (Improve suggestion for tuple struct pattern matching errors.) - rust-lang#81769 (Suggest `return`ing tail expressions that match return type) - rust-lang#81837 (Slight perf improvement on char::to_ascii_lowercase) - rust-lang#81969 (Avoid `cfg_if` in `std::os`) - rust-lang#81984 (Make WASI's `hard_link` behavior match other platforms.) - rust-lang#82091 (use PlaceRef abstractions more consistently) - rust-lang#82128 (add diagnostic items for OsString/PathBuf/Owned as well as to_vec on slice) - rust-lang#82166 (add s390x-unknown-linux-musl target) - rust-lang#82234 (Remove query parameters when skipping search results) - rust-lang#82255 (Make `treat_err_as_bug` Option<NonZeroUsize>) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
Use u32 over Option<u32> in DebugLoc ~~Changes `Option<u32>` fields in `DebugLoc` to `Option<NonZeroU32>`. Since the respective fields (`line` and `col`) are guaranteed to be 1-based, this layout optimization is a freebie.~~ EDIT: Changes `Option<u32>` fields in `DebugLoc` to `u32`. As `@bugadani` pointed out, an `Option<NonZeroU32>` is probably an unnecessary layer of abstraction since the `None` variant is always used as `UNKNOWN_LINE_NUMBER` (which is just `0`). Also, `SourceInfo` in `metadata.rs` already uses a `u32` instead of an `Option<u32>` to encode the same information, so I think this change is warranted. Since `@jyn514` raised some concerns over measuring performance in a similar PR (rust-lang#82255), does this need a perf run?
rustc -Z treat-err-as-bug=N
already requiresN
to be nonzero when the argument is parsed, so changing the type fromOption<usize>
toOption<NonZeroUsize>
is a low-hanging fruit in terms of layout optimization.