-
-
Notifications
You must be signed in to change notification settings - Fork 14.3k
Add new failed_merged_doctest_compilation rustdoc lint
#148866
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
base: main
Are you sure you want to change the base?
Add new failed_merged_doctest_compilation rustdoc lint
#148866
Conversation
|
|
|
@bors2 try @rust-timer queue |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
…compilation, r=<try> Add new `failed_merged_doctest_compilation` rustdoc lint
|
The job Click to see the possible cause of the failure (guessed by this bot) |
|
Another thing I thought: should we display errors? |
This comment has been minimized.
This comment has been minimized.
|
Finished benchmarking commit (fa55e90): comparison URL. Overall result: no relevant changes - no action neededBenchmarking this pull request means it may be perf-sensitive – we'll automatically label it not fit for rolling up. You can override this, but we strongly advise not to, due to possible changes in compiler perf. @bors rollup=never Instruction countThis benchmark run did not return any relevant results for this metric. Max RSS (memory usage)Results (primary 1.5%)A less reliable metric. May be of interest, but not used to determine the overall result above.
CyclesResults (secondary -1.1%)A less reliable metric. May be of interest, but not used to determine the overall result above.
Binary sizeThis benchmark run did not return any relevant results for this metric. Bootstrap: 474.976s -> 474.831s (-0.03%) |
|
☔ The latest upstream changes (presumably #149891) made this pull request unmergeable. Please resolve the merge conflicts. |
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.
What's the status of this PR? I've only given it a cursory glance. Perf came back clean, so does that mean the current approach can be taken or are there still other blockers?
Would you like me to review this code? I didn't review it so far because of the draft status & the failed CI (the failure seems to stem from lib alloc containing two unmergeable doctests).
| mergeable_tests: FxIndexMap<MergeableTestKey, Vec<(DocTestBuilder, ScrapedDocTest)>>, | ||
| // We pass this argument so we can drop it manually before using `exit`. | ||
| mut temp_dir: Option<TempDir>, | ||
| tcx: Option<TyCtxt<'_>>, |
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.
(preliminary review) this is always Some(_); I'm probably missing sth.
| continue; | ||
| } | ||
| if let Some(tcx) = tcx { | ||
| tcx.node_span_lint( |
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'd really love to see if it's possible to emit lints from
DiagCtxtHandlesomehow,
That's not possible, it doesn't contain the necessary information. DiagCtxtHandle just stores low-level things in order to properly emit diagnostics. For lints on the other hand we need to be able to check if they were suppressed via lint control attributes or flags (allow, expect) which form a hierarchy (apart from that, it needs access to the query system (so TyCtxt) & some other data that's stored in the Session).
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 haven't taken a deeper look at the code yet, so I'm not fully up to speed re. all the constraints that are imposed here but I can say that if lack of access to TyCtxt is a problem (as you've alluded to in the PR description), consider "buffering" the lint instead of calling node_span_lint eagerly. That's what rustc also does / has to do for early lints, it just puts them into a vector and emits them at a later point where TyCtxt is available.
Hopefully this is relevant ^^' I've yet to take a proper look. Of course if you want to avoid keeping TyCtxt or Session or XYZ alive for a longer time, buffering won't help.
Finally took the time to write this lint. We need to have a compiler context in order to be able to emit the lint, but I'm not sure if
DiagCtxtHandledoesn't provide it somehow... Anyway, I'm expecting performance regression because we keep the compiler and its internals around for much longer, stacking doctests memory on top of the allocated memory to the current crate (which is why I'd really love to see if it's possible to emit lints fromDiagCtxtHandlesomehow, gonna investigate).Also: both lint name and lint message are very much up to debate.
r? @fmease