about summary refs log tree commit diff
AgeCommit message (Collapse)AuthorLines
2022-01-31Fix invalid special casing of the unreachable! macroLoïc BRANSTETT-19/+140
2022-01-31Auto merge of #93498 - matthiaskrgr:rollup-k5shwrc, r=matthiaskrgrbors-323/+593
Rollup of 8 pull requests Successful merges: - #90277 (Improve terminology around "after typeck") - #92918 (Allow eliding GATs in expression position) - #93039 (Don't suggest inaccessible fields) - #93155 (Switch pretty printer to block-based indentation) - #93214 (Respect doc(hidden) when suggesting available fields) - #93347 (Make `char::DecodeUtf16::size_hist` more precise) - #93392 (Clarify documentation on char::MAX) - #93444 (Fix some CSS warnings and errors from VS Code) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2022-01-31Auto merge of #93499 - matthiaskrgr:rollup-icdex11, r=matthiaskrgrbors-232/+285
Rollup of 8 pull requests Successful merges: - #93395 (Improve suggestion for escaping reserved keywords) - #93403 (review the total_cmp documentation) - #93461 (Accommodate yield points in the format_args expansion) - #93462 (Document `SystemTime` platform precision) - #93471 (unix: Use metadata for `DirEntry::file_type` fallback) - #93480 (Remove deprecated and unstable slice_partition_at_index functions) - #93485 (core: Remove some redundant {}s from the sorting code) - #93494 (kmc-solid: Inherit the calling task's base priority in `Thread::new`) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2022-01-31Rollup merge of #93494 - solid-rs:fix-kmc-solid-spawned-task-priority, ↵Matthias Krüger-5/+2
r=Mark-Simulacrum kmc-solid: Inherit the calling task's base priority in `Thread::new` This PR fixes the initial priority calculation of spawned threads on the [`*-kmc-solid_*`](https://doc.rust-lang.org/nightly/rustc/platform-support/kmc-solid.html) Tier 3 targets. Fixes a spawned task (an RTOS object on top of which threads are implemented for this target; unrelated to async tasks) getting an unexpectedly higher priority if it's spawned by a task whose priority is temporarily boosted by a priority-protection mutex.
2022-01-31Rollup merge of #93485 - est31:remove_curly, r=joshtriplettMatthias Krüger-3/+3
core: Remove some redundant {}s from the sorting code
2022-01-31Rollup merge of #93480 - est31:remove_unstable_deprecated, r=Mark-SimulacrumMatthias Krüger-45/+0
Remove deprecated and unstable slice_partition_at_index functions They have been deprecated since commit 01ac5a97c90c26ac35ca9d65f685dd6701edfa3b which was part of the 1.49.0 release, so from the point of nightly, 11 releases ago.
2022-01-31Rollup merge of #93471 - cuviper:direntry-file_type-stat, r=the8472Matthias Krüger-2/+2
unix: Use metadata for `DirEntry::file_type` fallback When `DirEntry::file_type` fails to match a known `d_type`, we should fall back to `DirEntry::metadata` instead of a bare `lstat`, because this is faster and more reliable on targets with `fstatat`.
2022-01-31Rollup merge of #93462 - ChrisDenton:systime-doc, r=joshtriplettMatthias Krüger-1/+6
Document `SystemTime` platform precision Fixes #88822
2022-01-31Rollup merge of #93461 - dtolnay:fmtyield, r=davidtwcoMatthias Krüger-4/+84
Accommodate yield points in the format_args expansion Fixes #93274. For the case `println!("{} {:?}", "", async {}.await)` in the issue, the expansion before: ```rust ::std::io::_print( ::core::fmt::Arguments::new_v1( &["", " ", "\n"], &[ ::core::fmt::ArgumentV1::new(&"", ::core::fmt::Display::fmt), ::core::fmt::ArgumentV1::new(&async {}.await, ::core::fmt::Debug::fmt), ], ), ); ``` After: ```rust ::std::io::_print( ::core::fmt::Arguments::new_v1( &["", " ", "\n"], &match (&"", &async {}.await) { _args => [ ::core::fmt::ArgumentV1::new(_args.0, ::core::fmt::Display::fmt), ::core::fmt::ArgumentV1::new(_args.1, ::core::fmt::Debug::fmt), ], }, ), ); ```
2022-01-31Rollup merge of #93403 - nagisa:total-cmp-review, r=joshtriplettMatthias Krüger-38/+54
review the total_cmp documentation The documentation has been restructured to split out a brief summary paragraph out from the following elaborating paragraphs. I also attempted my hand at wording improvements and adding articles where I felt them missing, but being non-native english speaker these may need more thorough review. cc https://github.com/rust-lang/rust/issues/72599
2022-01-31Rollup merge of #93395 - camelid:reserved-sugg, r=davidtwcoMatthias Krüger-134/+134
Improve suggestion for escaping reserved keywords r? `@davidtwco`
2022-01-31Rollup merge of #93444 - camelid:rustdoc-css-cleanup, r=GuillaumeGomez,jshaMatthias Krüger-7/+8
Fix some CSS warnings and errors from VS Code There's no such CSS rule as `box-shadow-color`, so I instead copied the whole `box-shadow` property to each rule to make it actually apply. r? `@jsha`
2022-01-31Rollup merge of #93392 - GKFX:char-docs, r=scottmcmMatthias Krüger-12/+22
Clarify documentation on char::MAX As mentioned in https://github.com/rust-lang/rust/issues/91836#issuecomment-994106874, the documentation on `char::MAX` is not quite correct – USVs are not "only ones within a certain range", they are code points _outside_ a certain range. I have corrected this and given the actual numbers as there is no reason to hide them.
2022-01-31Rollup merge of #93347 - WaffleLapkin:better_char_decode_utf16_size_hint, ↵Matthias Krüger-3/+55
r=dtolnay Make `char::DecodeUtf16::size_hist` more precise New implementation takes into account contents of `self.buf` and rounds lower bound up instead of down. Fixes #88762 Revival of #88763
2022-01-31Rollup merge of #93214 - ibraheemdev:issue-93210, r=davidtwcoMatthias Krüger-9/+75
Respect doc(hidden) when suggesting available fields Resolves #93210
2022-01-31Rollup merge of #93155 - dtolnay:blockindent, r=nagisaMatthias Krüger-263/+276
Switch pretty printer to block-based indentation This PR backports https://github.com/dtolnay/prettyplease/commit/401d60c04213e6c66565e0e69a95b4588db5fdba from the `prettyplease` crate into `rustc_ast_pretty`. A before and after: ```diff - let res = - ((::alloc::fmt::format as - for<'r> fn(Arguments<'r>) -> String {format})(((::core::fmt::Arguments::new_v1 - as - fn(&[&'static str], &[ArgumentV1]) -> Arguments {Arguments::new_v1})((&([("test" - as - &str)] - as - [&str; 1]) - as - &[&str; 1]), - (&([] - as - [ArgumentV1; 0]) - as - &[ArgumentV1; 0])) - as - Arguments)) - as String); + let res = + ((::alloc::fmt::format as + for<'r> fn(Arguments<'r>) -> String {format})(((::core::fmt::Arguments::new_v1 + as + fn(&[&'static str], &[ArgumentV1]) -> Arguments {Arguments::new_v1})((&([("test" + as &str)] as [&str; 1]) as + &[&str; 1]), + (&([] as [ArgumentV1; 0]) as &[ArgumentV1; 0])) as + Arguments)) as String); ``` Previously the pretty printer would compute indentation always relative to whatever column a block begins at, like this: ```rust fn demo(arg1: usize, arg2: usize); ``` This is never the thing to do in the dominant contemporary Rust style. Rustfmt's default and the style used by the vast majority of Rust codebases is block indentation: ```rust fn demo( arg1: usize, arg2: usize, ); ``` where every indentation level is a multiple of 4 spaces and each level is indented relative to the indentation of the previous line, not the position that the block starts in. By itself this PR doesn't get perfect formatting in all cases, but it is the smallest possible step in clearly the right direction. More backports from `prettyplease` to tune the ibox/cbox indent levels around various AST node types are upcoming.
2022-01-31Rollup merge of #93039 - terrarier2111:fix-field-help, r=nagisaMatthias Krüger-9/+49
Don't suggest inaccessible fields Fixes: https://github.com/rust-lang/rust/issues/92999
2022-01-31Rollup merge of #92918 - compiler-errors:gat-expr-lifetime-elision, r=jackh726Matthias Krüger-2/+88
Allow eliding GATs in expression position Thoughts on whether this is worthwhile? Fixes #92836 r? ``@jackh726``
2022-01-31Rollup merge of #90277 - pierwill:fix-70258-inference-terms, r=jackh726Matthias Krüger-18/+20
Improve terminology around "after typeck" Closes #70258.
2022-01-31Auto merge of #93270 - klensy:sec-up, r=Mark-Simulacrumbors-9/+9
update vulnerable/yanked deps tokio v1.8.2 -> v1.8.4: https://rustsec.org/advisories/RUSTSEC-2021-0124 ammonia v3.1.0 -> v3.1.3: https://rustsec.org/advisories/RUSTSEC-2022-0003 thread_local v1.0.1 -> v1.1.4: https://rustsec.org/advisories/RUSTSEC-2022-0006 pin-project-lite v0.2.4 -> v0.2.8: yanked: https://github.com/taiki-e/pin-project-lite/blob/main/CHANGELOG.md#024---2021-01-11
2022-01-30Restore a visual alignment mode for block commentsDavid Tolnay-7/+33
2022-01-30Bless all pretty printer tests and ui testsDavid Tolnay-234/+210
2022-01-30Fix some double indents on exprs containing blocksDavid Tolnay-10/+18
The `print_expr` method already places an `ibox(INDENT_UNIT)` around every expr that gets printed. Some exprs were then using `self.head` inside of that, which does its own `cbox(INDENT_UNIT)`, resulting in two levels of indentation: while true { stuff; } This commit fixes those cases to produce the expected single level of indentation within every expression containing a block. while true { stuff; }
2022-01-30Compute indent never relative to current columnDavid Tolnay-19/+22
Previously the pretty printer would compute indentation always relative to whatever column a block begins at, like this: fn demo(arg1: usize, arg2: usize); This is never the thing to do in the dominant contemporary Rust style. Rustfmt's default and the style used by the vast majority of Rust codebases is block indentation: fn demo( arg1: usize, arg2: usize, ); where every indentation level is a multiple of 4 spaces and each level is indented relative to the indentation of the previous line, not the position that the block starts in.
2022-01-31kmc-solid: Inherit the calling task's base priority in `Thread::new`Tomoaki Kawada-5/+2
Fixes a spawned task getting an unexpectedly higher priority if it's spawned by a task whose priority is temporarily boosted by a priority- protection mutex.
2022-01-31Auto merge of #90891 - nbdd0121:format, r=Mark-Simulacrumbors-78/+104
Create `core::fmt::ArgumentV1` with generics instead of fn pointer Split from (and prerequisite of) #90488, as this seems to have perf implication. `@rustbot` label: +T-libs
2022-01-30(#93392) Update char::MAX docs and core::char::MAXGeorge Bateman-12/+22
2022-01-30review the total_cmp documentationSimonas Kazlauskas-38/+54
The documentation has been restructured to split out a brief summary paragraph out from the following elaborating paragraphs. I also attempted my hand at wording improvements and adding articles where I felt them missing, but being non-native english speaker these may need more thorough review.
2022-01-30Auto merge of #92711 - zredb:issue-90187-fix, r=notriddlebors-49/+51
rustdoc: Remove `def_id_no_primitives` Fixes #90187.
2022-01-30Mac callsDavid Tolnay-5/+17
2022-01-30Accommodate yield points in the format_args expansionDavid Tolnay-4/+49
2022-01-30Add regression test for issue 93274David Tolnay-0/+23
Currently fails with: error: future cannot be sent between threads safely --> $DIR/src/test/ui/fmt/format-with-yield-point.rs:21:17 | LL | assert_send(with_await()); | ^^^^^^^^^^^^ future returned by `with_await` is not `Send` | = help: the trait `Sync` is not implemented for `core::fmt::Opaque` note: future is not `Send` as this value is used across an await --> $DIR/src/test/ui/fmt/format-with-yield-point.rs:11:37 | LL | println!("{} {:?}", "", async {}.await); | --------------------------------^^^^^^- | | | | | await occurs here, with `$crate::format_args_nl!($($arg)*)` maybe used later | has type `ArgumentV1<'_>` which is not `Send` | `$crate::format_args_nl!($($arg)*)` is later dropped here note: required by a bound in `assert_send` --> $DIR/src/test/ui/fmt/format-with-yield-point.rs:18:24 | LL | fn assert_send(_: impl Send) {} | ^^^^ required by this bound in `assert_send` error: future cannot be sent between threads safely --> $DIR/src/test/ui/fmt/format-with-yield-point.rs:22:17 | LL | assert_send(with_macro_call()); | ^^^^^^^^^^^^^^^^^ future returned by `with_macro_call` is not `Send` | = help: the trait `Sync` is not implemented for `core::fmt::Opaque` note: future is not `Send` as this value is used across an await --> $DIR/src/test/ui/fmt/format-with-yield-point.rs:6:17 | LL | async {}.await | ^^^^^^ await occurs here, with `$crate::format_args_nl!($($arg)*)` maybe used later ... LL | println!("{} {:?}", "", m!()); | ----------------------------- | | | | | in this macro invocation | has type `ArgumentV1<'_>` which is not `Send` | `$crate::format_args_nl!($($arg)*)` is later dropped here note: required by a bound in `assert_send` --> $DIR/src/test/ui/fmt/format-with-yield-point.rs:18:24 | LL | fn assert_send(_: impl Send) {} | ^^^^ required by this bound in `assert_send` = note: this error originates in the macro `m` (in Nightly builds, run with -Z macro-backtrace for more info) error: aborting due to 2 previous errors
2022-01-30Auto merge of #93482 - ehuss:rollup-qjyppci, r=ehussbors-514/+739
Rollup of 5 pull requests Successful merges: - #92887 (Bootstrap compiler update) - #92908 (Render more readable macro matcher tokens in rustdoc) - #93183 (rustdoc: mobile nav fixes) - #93192 (Add VS 2022 into error message) - #93475 (Add test to ensure that theme is applied correctly when going back in history) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2022-01-30core: Remove some redundant {}s from the sorting codeest31-3/+3
2022-01-30Rollup merge of #93475 - GuillaumeGomez:theme-in-history, r=jshaEric Huss-0/+25
Add test to ensure that theme is applied correctly when going back in history Fixes #93258. r? `@jsha`
2022-01-30Rollup merge of #93192 - theidexisted:patch-1, r=wesleywiserEric Huss-1/+1
Add VS 2022 into error message
2022-01-30Rollup merge of #93183 - jsha:mobile-nav-fixes, r=GuillaumeGomezEric Huss-4/+26
rustdoc: mobile nav fixes - Make sure the mobile-topbar doesn't overflow its height if the user sets a bigger font. - Make sure the sidebar can be scrolled all the way to the bottom by shortening it to accommodate the mobile-topbar. - Make the item name in the mobile-topbar clickable to go to the top of the page. - Remove excess padding sidebar in mobile mode. Demo https://rustdoc.crud.net/jsha/mobile-nav-fixes/std/string/struct.String.html r? `@GuillaumeGomez`
2022-01-30Rollup merge of #92908 - dtolnay:rustdoc, r=GuillaumeGomezEric Huss-61/+296
Render more readable macro matcher tokens in rustdoc Follow-up to #92334. This PR lifts some of the token rendering logic from https://github.com/dtolnay/prettyplease into rustdoc so that even the matchers for which a source code snippet is not available (because they are macro-generated, or any other reason) follow some baseline good assumptions about where the tokens in the macro matcher are appropriate to space. The below screenshots show an example of the difference using one of the gnarliest macros I could find. Some things to notice: - In the **before**, notice how a couple places break in between `$(....)`↵`*`, which is just about the worst possible place that it could break. - In the **before**, the lines that wrapped are weirdly indented by 1 space of indentation relative to column 0. In the **after**, we use the typical way of block indenting in Rust syntax which is put the open/close delimiters on their own line and indent their contents by 4 spaces relative to the previous line (so 8 spaces relative to column 0, because the matcher itself is indented by 4 relative to the `macro_rules` header). - In the **after**, macro_rules metavariables like `$tokens:tt` are kept together, which is how just about everybody writing Rust today writes them. ## Before ![Screenshot from 2022-01-14 13-05-53](https://user-images.githubusercontent.com/1940490/149585105-1f182b78-751f-421f-a234-9dbc04fa3bbd.png) ## After ![Screenshot from 2022-01-14 13-06-04](https://user-images.githubusercontent.com/1940490/149585118-d4b52ea7-3e67-4b6e-a12b-31dfb8172f86.png) r? `@camelid`
2022-01-30Rollup merge of #92887 - pietroalbini:pa-bootstrap-update, r=Mark-SimulacrumEric Huss-448/+391
Bootstrap compiler update r? ``@Mark-Simulacrum``
2022-01-30Remove deprecated and unstable slice_partition_at_index functionsest31-45/+0
They have been deprecated since commit 01ac5a97c90c26ac35ca9d65f685dd6701edfa3b which was part of the 1.49.0 release, so from the point of nightly, 11 releases ago.
2022-01-30Fix an edge case in `chat::DecodeUtf16::size_hint`Maybe Waffle-11/+20
There are cases, when data in the buf might or might not be an error.
2022-01-30Add test to ensure that theme is applied correctly when going back in historyGuillaume Gomez-0/+25
2022-01-30Auto merge of #93468 - matthiaskrgr:rollup-vxullvd, r=matthiaskrgrbors-47/+218
Rollup of 8 pull requests Successful merges: - #93256 (Make `join!` description more accurate) - #93358 (Add note suggesting that predicate may be satisfied, but is not `const`) - #93362 (Do not register infer var for GAT projection in RPIT) - #93391 (rustdoc: remove tooltip from source link) - #93414 (Move unstable is_{arch}_feature_detected! macros to std::arch) - #93441 (rustdoc: load the set of in-scope traits for modules with no docstring) - #93459 (fs: Don't copy d_name from struct dirent) - #93463 (Rename _args -> args in format_args expansion) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2022-01-29rustdoc: small fixes to mobile navigationJacob Hoffman-Andrews-4/+26
- Make sure the mobile-topbar doesn't overflow its height if the user sets a bigger font. - Make sure the sidebar can be scrolled all the way to the bottom by shortening it to accommodate the mobile-topbar. - Make the item name in the mobile-topbar clickable to go to the top of the page. - Remove excess padding sidebar in mobile mode.
2022-01-29unix: Use metadata for `DirEntry::file_type` fallbackJosh Stone-2/+2
When `DirEntry::file_type` fails to match a known `d_type`, we should fall back to `DirEntry::metadata` instead of a bare `lstat`, because this is faster and more reliable on targets with `fstatat`.
2022-01-30Rollup merge of #93463 - dtolnay:_args, r=cjgillotMatthias Krüger-4/+4
Rename _args -> args in format_args expansion As observed in https://github.com/rust-lang/rust/pull/91359#discussion_r786058960, prior to that PR this variable was sometimes never used, such as in the case of: ```rust println!(""); // used to expand to: ::std::io::_print( ::core::fmt::Arguments::new_v1( &["\n"], &match () { _args => [], }, ), ); ``` so the leading underscore in `_args` was used to suppress an unused variable lint. However after #91359 the variable is always used when present, as the unused case would instead expand to: ```rust ::std::io::_print(::core::fmt::Arguments::new_v1(&["\n"], &[])); ```
2022-01-30Rollup merge of #93459 - tavianator:dirent-copy-only-reclen, r=cuviperMatthias Krüger-2/+26
fs: Don't copy d_name from struct dirent The dirent returned from readdir() is only guaranteed to be valid for d_reclen bytes on common platforms. Since we copy the name separately anyway, we can copy everything except d_name into DirEntry::entry. Fixes #93384.
2022-01-30Rollup merge of #93441 - ↵Matthias Krüger-0/+41
notriddle:notriddle/collect-crate-doc-links-very-early, r=petrochenkov rustdoc: load the set of in-scope traits for modules with no docstring Fixes #93428 This fix is a response to a couple of special cases related to the `module_id`, which is eventually used for trait candidates: * The module id is always set to the current crate, when checking `crate::`. Normally, the set of in-scope traits would be set in `load_links_in_attrs`, but if there are no doc comments, then that loop will never run. * the module id is set to the parent module, when resolving a module that is spelled like this: // Notice how we use an outlined doc comment here! // [`Test::my_fn`] mod something { } As with the above problem with `crate::`, we need to make sure the module gets its traits in scope resolved, even if it has no doc comments of its own.
2022-01-30Rollup merge of #93414 - Amanieu:std_arch_detect, r=m-ou-seMatthias Krüger-19/+31
Move unstable is_{arch}_feature_detected! macros to std::arch These macros are unstable, except for `is_x86_feature_detected` which is still exported from the crate root for backwards-compatibility. This should unblock the stabilization of `is_aarch64_feature_detected`. r? ```@m-ou-se```
2022-01-30Rollup merge of #93391 - notriddle:notriddle/remove-srclink-tooltip, ↵Matthias Krüger-2/+2
r=jsha,GuillaumeGomez rustdoc: remove tooltip from source link This made more sense back when it was abbreviated, but now it seems redundant.