Skip to content
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

Remove LintBuffer from Session #65835

Merged
merged 6 commits into from Nov 4, 2019

Conversation

@Mark-Simulacrum
Copy link
Member

Mark-Simulacrum commented Oct 25, 2019

This moves the LintBuffer from Session into the Resolver, where it is used until lowering is done and then consumed by early lint passes. This also happily removes the failure mode of buffering lints too late where it would have previously lead to ICEs; it is statically no longer possible to do so.

I suspect that with a bit more work a similar move could be done for the lint buffer inside ParseSess, but this PR doesn't touch it (in part to keep itself small).

The last commit is the "interesting" commit -- the ones before it don't work (though they compile) as they sort of prepare the various crates for the lint buffer to be passed in rather than accessed through Session.

@Mark-Simulacrum

This comment has been minimized.

Copy link
Member Author

Mark-Simulacrum commented Oct 25, 2019

I plan to prepare some similar documentation to what I'm working on now in rust-lang/rustc-guide#476 once this lands -- we don't have a lot that talks about lint buffering today, but I've gained a decent understanding of why we need it in working on this so can write that up.

Copy link
Contributor

nikomatsakis left a comment

Looks good to me! I left one small suggestion to add a helper method. r=me with that suggestion.

src/librustc_interface/util.rs Outdated Show resolved Hide resolved
src/librustc_interface/util.rs Outdated Show resolved Hide resolved
@petrochenkov petrochenkov self-assigned this Oct 26, 2019
src/librustc_interface/passes.rs Outdated Show resolved Hide resolved
src/librustc_resolve/lib.rs Outdated Show resolved Hide resolved
@petrochenkov petrochenkov removed their assignment Oct 26, 2019
@Mark-Simulacrum Mark-Simulacrum force-pushed the Mark-Simulacrum:lockless-lintbuffer branch from 1ab8dc8 to a44126a Oct 26, 2019
@Mark-Simulacrum

This comment has been minimized.

Copy link
Member Author

Mark-Simulacrum commented Oct 26, 2019

@bors r=nikomatsakis

@bors

This comment has been minimized.

Copy link
Contributor

bors commented Oct 26, 2019

📌 Commit a44126a has been approved by nikomatsakis

Centril added a commit to Centril/rust that referenced this pull request Oct 26, 2019
…, r=nikomatsakis

Remove LintBuffer from Session

This moves the `LintBuffer` from `Session` into the `Resolver`, where it is used until lowering is done and then consumed by early lint passes. This also happily removes the failure mode of buffering lints too late where it would have previously lead to ICEs; it is statically no longer possible to do so.

I suspect that with a bit more work a similar move could be done for the lint buffer inside `ParseSess`, but this PR doesn't touch it (in part to keep itself small).

The last commit is the "interesting" commit -- the ones before it don't work (though they compile) as they sort of prepare the various crates for the lint buffer to be passed in rather than accessed through Session.
bors added a commit that referenced this pull request Oct 26, 2019
Rollup of 7 pull requests

Successful merges:

 - #65288 (Point at associated type for some obligations)
 - #65541 (rustc: add `Span`s to `inferred_outlives_of` predicates.)
 - #65738 (Coherence should allow fundamental types to impl traits when they are local)
 - #65777 (Don't ICE for completely unexpandable `impl Trait` types)
 - #65830 (Use ident.span instead of def_span in dead-code pass)
 - #65834 (Remove lint callback from driver)
 - #65835 (Remove LintBuffer from Session)

Failed merges:

r? @ghost
@Centril

This comment has been minimized.

Copy link
Member

Centril commented Oct 27, 2019

Possibly caused failure in #65854 (comment), @bors rollup=never

@bors

This comment has been minimized.

Copy link
Contributor

bors commented Oct 27, 2019

☔️ The latest upstream changes (presumably #65869) made this pull request unmergeable. Please resolve the merge conflicts.

@Mark-Simulacrum Mark-Simulacrum force-pushed the Mark-Simulacrum:lockless-lintbuffer branch from a44126a to bdcaedf Oct 28, 2019
@Mark-Simulacrum

This comment has been minimized.

Copy link
Member Author

Mark-Simulacrum commented Oct 28, 2019

@bors r=nikomatsakis rollup=never

I can't reproduce the rollup failure locally so I suspect/hope it is #65830 that is responsible (that seems more likely than this PR, personally, given the small number of errors, and being limited to dead code, though that PR doesn't look immediately at fault either.

@bors

This comment has been minimized.

Copy link
Contributor

bors commented Oct 28, 2019

📌 Commit bdcaedf has been approved by nikomatsakis

@bors

This comment has been minimized.

Copy link
Contributor

bors commented Nov 4, 2019

⌛️ Testing commit bdcaedf with merge d9d421e...

bors added a commit that referenced this pull request Nov 4, 2019
…sakis

Remove LintBuffer from Session

This moves the `LintBuffer` from `Session` into the `Resolver`, where it is used until lowering is done and then consumed by early lint passes. This also happily removes the failure mode of buffering lints too late where it would have previously lead to ICEs; it is statically no longer possible to do so.

I suspect that with a bit more work a similar move could be done for the lint buffer inside `ParseSess`, but this PR doesn't touch it (in part to keep itself small).

The last commit is the "interesting" commit -- the ones before it don't work (though they compile) as they sort of prepare the various crates for the lint buffer to be passed in rather than accessed through Session.
@rust-highfive

This comment has been minimized.

Copy link
Collaborator

rust-highfive commented Nov 4, 2019

The job mingw-check of your PR failed (pretty log, raw log). Through arcane magic we have determined that the following fragments from the build log may contain information about the problem.

Click to expand the log.
2019-11-04T02:29:54.6616073Z     Checking rustc_resolve v0.0.0 (/checkout/src/librustc_resolve)
2019-11-04T02:29:55.9373034Z error[E0599]: no method named `buffer_lint` found for type `&'b rustc::session::Session` in the current scope
2019-11-04T02:29:55.9376629Z    --> src/librustc_resolve/resolve_imports.rs:982:36
2019-11-04T02:29:55.9378510Z     |
2019-11-04T02:29:55.9379015Z 982 |                     self.r.session.buffer_lint(UNUSED_IMPORTS, directive.id, directive.span, msg);
2019-11-04T02:29:55.9379651Z     |                                    ^^^^^^^^^^^ method not found in `&'b rustc::session::Session`
2019-11-04T02:29:56.0025618Z error: aborting due to previous error
2019-11-04T02:29:56.0026642Z 
2019-11-04T02:29:56.0035113Z For more information about this error, try `rustc --explain E0599`.
2019-11-04T02:29:56.0214828Z error: could not compile `rustc_resolve`.
---
2019-11-04T02:30:07.1722273Z   local time: Mon Nov  4 02:30:07 UTC 2019
2019-11-04T02:30:07.3091555Z   network time: Mon, 04 Nov 2019 02:30:07 GMT
2019-11-04T02:30:07.3094644Z == end clock drift check ==
2019-11-04T02:30:08.5654743Z 
2019-11-04T02:30:08.5751144Z ##[error]Bash exited with code '1'.
2019-11-04T02:30:08.5781169Z ##[section]Starting: Checkout
2019-11-04T02:30:08.5783032Z ==============================================================================
2019-11-04T02:30:08.5783131Z Task         : Get sources
2019-11-04T02:30:08.5783219Z Description  : Get sources from a repository. Supports Git, TfsVC, and SVN repositories.

I'm a bot! I can only do what humans tell me to, so if this was not helpful or you have suggestions for improvements, please ping or otherwise contact @TimNN. (Feature Requests)

@bors

This comment has been minimized.

Copy link
Contributor

bors commented Nov 4, 2019

💔 Test failed - checks-azure

@Mark-Simulacrum Mark-Simulacrum force-pushed the Mark-Simulacrum:lockless-lintbuffer branch from bdcaedf to c68df7c Nov 4, 2019
@Mark-Simulacrum

This comment has been minimized.

Copy link
Member Author

Mark-Simulacrum commented Nov 4, 2019

@bors r=nikomatsakis

@bors

This comment has been minimized.

Copy link
Contributor

bors commented Nov 4, 2019

📌 Commit c68df7c has been approved by nikomatsakis

@bors

This comment has been minimized.

Copy link
Contributor

bors commented Nov 4, 2019

⌛️ Testing commit c68df7c with merge ab6e478...

bors added a commit that referenced this pull request Nov 4, 2019
…sakis

Remove LintBuffer from Session

This moves the `LintBuffer` from `Session` into the `Resolver`, where it is used until lowering is done and then consumed by early lint passes. This also happily removes the failure mode of buffering lints too late where it would have previously lead to ICEs; it is statically no longer possible to do so.

I suspect that with a bit more work a similar move could be done for the lint buffer inside `ParseSess`, but this PR doesn't touch it (in part to keep itself small).

The last commit is the "interesting" commit -- the ones before it don't work (though they compile) as they sort of prepare the various crates for the lint buffer to be passed in rather than accessed through Session.
@bors

This comment has been minimized.

Copy link
Contributor

bors commented Nov 4, 2019

☀️ Test successful - checks-azure
Approved by: nikomatsakis
Pushing ab6e478 to master...

@bors bors added the merged-by-bors label Nov 4, 2019
@bors bors merged commit c68df7c into rust-lang:master Nov 4, 2019
5 checks passed
5 checks passed
homu Test successful
Details
pr Build #20191104.4 succeeded
Details
pr (Linux mingw-check) Linux mingw-check succeeded
Details
pr (Linux x86_64-gnu-llvm-6.0) Linux x86_64-gnu-llvm-6.0 succeeded
Details
pr (Linux x86_64-gnu-tools) Linux x86_64-gnu-tools succeeded
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
6 participants
You can’t perform that action at this time.