Repository navigation
Conversation
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
14e90d3 to
fe20e9e
Compare
This comment has been minimized.
This comment has been minimized.
There was a problem hiding this comment.
I don't think we should add a new flag here - I think we should be reusing --emit.
I think we likely need a couple things:
- We need to
ANALYSISandANALYSIS_FULL(or similar) output types to stop immediately after required and full analyses. - I don't think we should be doing something like "if emitting depinfo and nothing else" but rather "needs XYZ". Because we may want to do `--emit=depinfo,metadata"
go-to-stage optionValidation and FullAnalysis output types, allow for early returns
This comment has been minimized.
This comment has been minimized.
| shorthand: "validation", | ||
| extension: "rmeta", | ||
| description: "Generates metadata and exits after doing only validation and required analysis", | ||
| default_filename: "libCRATE_NAME.rmeta", |
There was a problem hiding this comment.
Have you considered giving it either a different extension or at least a different name? The extension could even be validation.rmeta. All the other output files have have different types.
With the current name schema it's not clear to me what will be the content of libCRATE_NAME.rmeta if user pass --emit=validation,full-analysis,rmeta.
There was a problem hiding this comment.
Originally I gave it the same name because Cargo would know what kind of run it is. But having it in the filename is good for other build systems, thanks
| Validation => { | ||
| shorthand: "validation", | ||
| extension: "rmeta", | ||
| description: "Generates metadata and exits after doing only validation and required analysis", |
There was a problem hiding this comment.
I'm assuming the compiler will only exit if other outputs weren't required, right?
25af58a to
13a4efe
Compare
This comment has been minimized.
This comment has been minimized.
13a4efe to
3c2f2f1
Compare
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
3c2f2f1 to
59541ba
Compare
|
|
||
| if sess.opts.output_types.stop_before_codegen() { | ||
| return None; | ||
| } |
There was a problem hiding this comment.
codegen_and_build_linker already emits crate metadata through start_codegen. Why not move this into start_codegen after metadata emission and remove the above encode_and_write_metadata?
There was a problem hiding this comment.
I think that moving this check into codegen_and_build_linker would make the overall compiler workflow harder to follow (which is already a big problem). And would give codegen_and_build_linker even another responsability.
There was a problem hiding this comment.
Regular crate metadata is already handled there even for check-only builds. I think putting crate metadata subsets elsewhere would be even harder to follow.
There was a problem hiding this comment.
I think that we should move that metadata emission out of start_codegen, not the other way around. Having an --emit=dep-info,metadata compilation call a start_codegen function is extremely confusing. But that should be another PR.
There was a problem hiding this comment.
Skipping start_codegen for --emit=dep-info,metadata would mean that we did have to either duplicate the incr comp finalization code or split up Linker::link in nonsensical ways. Returning None for stop_before_codegen() will break incr comp as the incr comp session never gets finalized in Linker::link(). return None inside this function is only meant for errors or custom drivers that want to abort early without caring for incr comp.
There was a problem hiding this comment.
that we did have to either duplicate the incr comp finalization code or split up Linker::link in nonsensical ways
My gripe with metadata inside link is not that that it's not returned early, but that it goes too far only because link_rlib and gives too many responsabilities to link.
I've opened #165524 to get some responsabilities out of link and start_codegen.
There was a problem hiding this comment.
With that PR landed we still have the issue that returning None here breaks incr comp as Linker::link is responsible for finalizing the incr comp session.
This comment has been minimized.
This comment has been minimized.
3ed0866 to
a3a67d5
Compare
…n, r=bjorn3 Cleanup, Get emitting metadata out of codegen Related to rust-lang/rust#163670 (comment) While metadata is not completely out of `link`, emitting or modifying it is now done outside `link` and `start_codegen`. Other miscellaneous non-codegen things are also taken out of `link`. Best reviewed commit by commit. r? @jackh726
2fd4844 to
8e9ba10
Compare
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
…n, r=bjorn3 Cleanup, Get emitting metadata out of codegen Related to rust-lang/rust#163670 (comment) While metadata is not completely out of `link`, emitting or modifying it is now done outside `link` and `start_codegen`. Other miscellaneous non-codegen things are also taken out of `link`. Best reviewed commit by commit. r? @jackh726
There was a problem hiding this comment.
minor: Can you remove some whitespace from the table to make it aligned again?
|
Would it make sense to move the |
This comment has been minimized.
This comment has been minimized.
4f4a2a7 to
8927f7c
Compare
|
cc @rust-lang/rustfmt |
|
This PR was rebased onto a different main commit. Here's a range-diff highlighting what actually changed. Rebasing is a normal part of keeping PRs up to date, so no action is needed—this note is just to help reviewers. |
I don't have a preference, I'm open to do it if you think it's worthwhile |
This comment has been minimized.
This comment has been minimized.
|
I think it would be. |
|
I've opened #166270, I'll remove those changes from here |
8927f7c to
14febb3
Compare
This comment was marked as outdated.
This comment was marked as outdated.
14febb3 to
c6c4a95
Compare
|
The job Click to see the possible cause of the failure (guessed by this bot) |
…jorn3 Output type refactors & change analysis query into required_analysis Split from rust-lang#163670 We split OutputType from `config.rs` to `output.rs`, and because we only use full_analysis a single time in each compilation (at least currently), convert it to a regular function, and have `required_analysis` be the query. r? @bjorn3
Rollup merge of #166270 - blyxyas:output-type-refactors, r=bjorn3 Output type refactors & change analysis query into required_analysis Split from #163670 We split OutputType from `config.rs` to `output.rs`, and because we only use full_analysis a single time in each compilation (at least currently), convert it to a regular function, and have `required_analysis` be the query. r? @bjorn3
|
☔ The latest upstream changes (presumably #166371) made this pull request unmergeable. Please resolve the merge conflicts by rebasing. |
Output type refactors & change analysis query into required_analysis Split from rust-lang/rust#163670 We split OutputType from `config.rs` to `output.rs`, and because we only use full_analysis a single time in each compilation (at least currently), convert it to a regular function, and have `required_analysis` be the query. r? @bjorn3
Output type refactors & change analysis query into required_analysis Split from rust-lang/rust#163670 We split OutputType from `config.rs` to `output.rs`, and because we only use full_analysis a single time in each compilation (at least currently), convert it to a regular function, and have `required_analysis` be the query. r? @bjorn3
View all comments
Add a
ValidationandFullAnalysisnightly output type. This allows us to encode metadata and exit both before and after executinganalysis.Old Body
Adds a go-to-stage flag, this flag makes the compiler exit after a certain stage. Currently it recognizes
end(the default which is effectively a no-op),analysisfor stopping afteranalysisandnameresfor stopping just after name resolution.analysisis similar to--emit=metadatawithoutlink, andnamereswill be used for the probe run in Cargo (See blyxyas/incr-systems#4)Related to blyxyas/incr-systems#3 and rust-lang/goals#641
r? @jackh726