-
Notifications
You must be signed in to change notification settings - Fork 12.9k
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
Rollup of 12 pull requests #126016
Rollup of 12 pull requests #126016
Conversation
…relude Many, many projects use `size_of` to get the size of a type. However, it's also often equally easy to hardcode a size (e.g. `8` instead of `size_of::<u64>()`). Minimizing friction in the use of `size_of` helps ensure that people use it and make code more self-documenting. The name `size_of` is unambiguous: the name alone, without any prefix or path, is self-explanatory and unmistakeable for any other functionality. Adding it to the prelude cannot produce any name conflicts, as any local definition will silently shadow the one from the prelude. Thus, we don't need to wait for a new edition prelude to add it. Add `size_of_val`, `align_of`, and `align_of_val` as well, with similar justification: widely useful, self-explanatory, unmistakeable for anything else, won't produce conflicts.
Unlike static declarations with #[linkage], for definitions rustc doesn't rewrite it to add an extra indirection.
Some of the bootstrap logics should be ignored during unit tests because they either make the tests take longer or cause them to fail. Therefore we need to be able to exclude them from the bootstrap when it's called by unit tests. This change introduces a new feature called `bootstrap-self-test`, which is enabled on bootstrap unit tests by default. This allows us to keep the logic separate between compiler builds and bootstrap tests without needing messy workarounds (like checking if target names match those in the unit tests). Signed-off-by: onur-ozkan <work@onurozkan.dev>
- Avoid unnecessary escaping of single quotes within string literals. - Add a missing blank line between two `UNICODE_ARRAY` sections.
Lexing converts source text into a token stream. Parsing converts a token stream into AST fragments. This commit renames several lexing operations that have "parse" in the name. I think these names have been subtly confusing me for years. This is just a `s/parse/lex/` on function names, with one exception: `parse_stream_from_source_str` becomes `source_str_to_stream`, to make it consistent with the existing `source_file_to_stream`. The commit also moves that function's location in the file to be just above `source_file_to_stream`. The commit also cleans up a few comments along the way.
It has a single call site. This also means `CFG_ATTR_{GRAMMAR_HELP,NOTE_REF}` can be moved into `parse_cfg_attr`, now that it's the only function that uses them. And the commit removes the line break in the URL.
Because it takes an `Lrc<SourceFile>`, and for consistency with `source_file_to_stream`.
It's a zero-value wrapper of `Parser::new`.
- Convert it from a macro to a function, which is nicer. - Rename it as `unwrap_or_emit_fatal`, which is clearer. - Fix the comment. In particular, `panictry!` no longer exists. - Remove the unnecessary `use` declaration.
The first one is out-of-date -- there are no longer functions expr, item, stmt. And I don't know what a "HOF" is. The second one doesn't really tell you anything.
…_file`. For consistency with `new_parser_from_{file,source_str}` and `maybe_new_parser_from_source_str`.
It does exactly what is required.
All four functions are simple and have a single call site. This requires making `Parser::parse_inner_attributes` public, which is no big deal.
It's the only one of these functions where `psess` isn't the first argument.
It has a single call site.
Currently we have an awkward mix of fallible and infallible functions: ``` new_parser_from_source_str maybe_new_parser_from_source_str new_parser_from_file (maybe_new_parser_from_file) // missing (new_parser_from_source_file) // missing maybe_new_parser_from_source_file source_str_to_stream maybe_source_file_to_stream ``` We could add the two missing functions, but instead this commit removes of all the infallible ones and renames the fallible ones leaving us with these which are all fallible: ``` new_parser_from_source_str new_parser_from_file new_parser_from_source_file source_str_to_stream source_file_to_stream ``` This requires making `unwrap_or_emit_fatal` public so callers of formerly infallible functions can still work. This does make some of the call sites slightly more verbose, but I think it's worth it for the simpler API. Also, there are two `catch_unwind` calls and one `catch_fatal_errors` call in this diff that become removable thanks this change. (I will do that in a follow-up PR.)
The `Input::File` and `Input::Text` cases should be very similar. However, currently the `Input::File` case uses `catch_unwind` because, until recently (rust-lang#125815) there was a fallible version of `new_parser_from_source_str` but only an infallible version of `new_parser_from_file`. This difference wasn't fundamental, just an overlooked gap in the API of `rustc_parse`. Both of those operations are now fallible, so the `Input::File` and `Input::Text` cases can made more similar, with no need for `catch_unwind`. This also lets us simplify an `Option<Vec<Diag>>` to `Vec<Diag>`.
…t arent mentioned in substs
…anieu Add `size_of` and `size_of_val` and `align_of` and `align_of_val` to the prelude (Note: need to update the PR to add `align_of` and `align_of_val`, and remove the second commit with the myriad changes to appease the lint.) Many, many projects use `size_of` to get the size of a type. However, it's also often equally easy to hardcode a size (e.g. `8` instead of `size_of::<u64>()`). Minimizing friction in the use of `size_of` helps ensure that people use it and make code more self-documenting. The name `size_of` is unambiguous: the name alone, without any prefix or path, is self-explanatory and unmistakeable for any other functionality. Adding it to the prelude cannot produce any name conflicts, as any local definition will silently shadow the one from the prelude. Thus, we don't need to wait for a new edition prelude to add it.
Make deleting on LinkedList aware of the allocator Fixed rust-lang#125950
…trieb Use inline const blocks to create arrays of `MaybeUninit`. This PR contains 2 changes enabled by the fact that [`inline_const` is now stable](rust-lang#104087), and was split out of rust-lang#125082. 1. Use inline const instead of `unsafe` to construct arrays in `MaybeUninit` examples. Rationale: Demonstrate good practice of avoiding `unsafe` code where it is not strictly necessary. 4. Use inline const instead of `unsafe` to implement `MaybeUninit::uninit_array()`. This is arguably giving the compiler more work to do, in exchange for eliminating just one single internal unsafe block, so it's less certain that this is good on net. r? `@Nilstrieb`
…ble, r=oli-obk Closures are recursively reachable Fixes rust-lang#126012.
…iler-errors Add a co-maintainer for the two ARMv4T targets This adds a second maintainer to the `armv4t-none-eabi` and `thumbv4t-none-eabi` targets, a necessary step on the path to Tier 2
…-test, r=lcnr Add another test for hidden types capturing lifetimes that outlive but arent mentioned in substs Another test to make sure future implementations of rust-lang#116040 don't have any subtle unsoundness 🤔 r? types
@bors r+ rollup=never p=12 |
🌲 The tree is currently closed for pull requests below priority 101. This pull request will be tested once the tree is reopened. |
☀️ Test successful - checks-actions |
📌 Perf builds for each rolled up PR:
previous master: 5ee2dfd2bc In the case of a perf regression, run the following command for each PR you suspect might be the cause: |
Finished benchmarking commit (db8aca4): comparison URL. Overall result: no relevant changes - no action needed@rustbot label: -perf-regression Instruction countThis benchmark run did not return any relevant results for this metric. Max RSS (memory usage)Results (primary 2.5%, secondary -5.9%)This is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.
CyclesResults (secondary -0.9%)This is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.
Binary sizeThis benchmark run did not return any relevant results for this metric. Bootstrap: 669.008s -> 666.65s (-0.35%) |
Successful merges:
size_of
andsize_of_val
andalign_of
andalign_of_val
to the prelude #123168 (Addsize_of
andsize_of_val
andalign_of
andalign_of_val
to the prelude)bootstrap-self-test
#125273 (bootstrap: implement new featurebootstrap-self-test
)suspicious-library
,resolve-rename
andincr-prev-body-beyond-eof
run-make
tests inrmake.rs
format #125683 (Rewritesuspicious-library
,resolve-rename
andincr-prev-body-beyond-eof
run-make
tests inrmake.rs
format)rustc_parse
top-level cleanups #125815 (rustc_parse
top-level cleanups)report_method_error
#125906 (Remove a bunch of redundant args fromreport_method_error
)MaybeUninit
. #125995 (Use inline const blocks to create arrays ofMaybeUninit
.)r? @ghost
@rustbot modify labels: rollup
Create a similar rollup