- 03 9月, 2021 21 次提交
-
-
由 Mara Bos 提交于
Add an example for deriving PartialOrd on enums For some reason, I always forget which variants are smaller and which are larger when you derive PartialOrd on an enum. And the wording in the current docs is not entirely clear to me. So, I often end up making a small enum, deriving PartialOrd on it, and then writing a `#[test]` with an assert that the top one is smaller than the bottom one (or the other way around) to figure out which way the deriving goes. So then I figured, it would be great if the standard library docs just had that example, so if I keep forgetting, at least I can figure it out quickly by looking at std's docs.
-
由 bors 提交于
expand: Treat more macro calls as statement macro calls This PR implements the suggestion from https://github.com/rust-lang/rust/pull/87981#issuecomment-906641052 and treats fn-like macro calls inside `StmtKind::Item` and `StmtKind::Semi` as statement macro calls, which is consistent with treatment of attribute invocations in the same positions and with token-based macro expansion model in general. This also allows to remove a special case in `NodeId` assignment (previously tried in #87779), and to use statement `NodeId`s for linting (`assign_id!`). r? `@Aaron1011`
-
由 bors 提交于
Point at unclosed delimiters as part of the primary MultiSpan Both the place where the parser encounters a needed closed delimiter and the unclosed opening delimiter are important, so they should get the same level of highlighting in the output. _Context: https://twitter.com/mwk4/status/1430631546432675840_
-
由 bors 提交于
Path remapping: Make behavior of diagnostics output dependent on presence of --remap-path-prefix. This PR fixes a regression (#87745) with `--remap-path-prefix` where the flag stopped causing diagnostic messages to be remapped as well. The regression was introduced in https://github.com/rust-lang/rust/pull/83813 where we erroneously assumed that remapping of diagnostic messages was not desired anymore (because #70642 partially undid that functionality with nobody objecting). The issue is fixed by making `--remap-path-prefix` remap diagnostic messages again, including for paths that have been remapped in upstream crates (e.g. the standard library). This means that "sysroot-localization" (implemented in #70642) is also disabled if `rustc` is invoked with `--remap-path-prefix`. The assumption is that once someone starts explicitly remapping paths they also don't want paths to their local Rust installation in their build output. In the future we might want to give more fine-grained control over this behavior via compiler flags (see https://github.com/rust-lang/rfcs/pull/3127 for a related RFC). For now this PR is intended as a regression fix. This PR is an alternative to https://github.com/rust-lang/rust/pull/88191, which makes diagnostic messages be remapped unconditionally. That approach, however, would effectively revert #70642. Fixes https://github.com/rust-lang/rust/issues/87745. cc `@cbeuw` r? `@ghost`
-
由 bors 提交于
Preserve most sub-obligations in the projection cache Fixes https://github.com/rust-lang/rust/issues/85360 When we evaluate a projection predicate, we may produce sub-obligations. During trait evaluation, evaluating these sub-obligations might cause us to produce `EvaluatedToOkModuloRegions`. When we cache the result of projection in our projection cache, we try to throw away some of the sub-obligations, so that we don't need to re-evaluate/process them the next time we need to perform this particular projection. However, we may end up throwing away predicates that will (recursively) evaluate to `EvaluatedToOkModuloRegions`. If we do, then the result of evaluating a predicate will depend on the state of the predicate cache - this is global untracked state, which interacts badly with incremental compilation. To fix this, we now only discard global predicates that evaluate to `EvaluatedToOk`. This ensures that any predicates that (may) evaluate to `EvaluatedToOkModuloRegions` are kept in the cache, and influence the results of any queries which perform this projection.
-
由 bors 提交于
Rollup of 12 pull requests Successful merges: - #88177 (Stabilize std::os::unix::fs::chroot) - #88505 (Use `unwrap_unchecked` where possible) - #88512 (Upgrade array_into_iter lint to include Deref-to-array types.) - #88532 (Remove single use variables) - #88543 (Improve closure dummy capture suggestion in macros.) - #88560 (`fmt::Formatter::pad`: don't call chars().count() more than one time) - #88565 (Add regression test for issue 83190) - #88567 (Remove redundant `Span` in `QueryJobInfo`) - #88573 (rustdoc: Don't panic on ambiguous inherent associated types) - #88582 (Implement #88581) - #88589 (Correct doc comments inside `use_expr_visitor.rs`) - #88592 (Fix ICE in const check) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
-
由 Mara Bos 提交于
Fix ICE in const check Fixes https://github.com/rust-lang/rust/issues/88433
-
由 Mara Bos 提交于
Correct doc comments inside `use_expr_visitor.rs` Just a simple update. I haven't changed any content inside the comments, as they still seem correct. Have a wonderful rest of the day
🙃 -
由 Mara Bos 提交于
Implement #88581 See #88581 for details. This API was discussed on Zulip. `@rustbot` label: +T-libs-api +S-waiting-on-review r? `@joshtriplett`
-
由 Mara Bos 提交于
rustdoc: Don't panic on ambiguous inherent associated types Instead, return `Type::Infer` since compilation should fail anyway. That's how rustdoc handles `hir::TyKind::Err`s, so this just extends that behavior to `ty::Err`s when analyzing associated types. For some reason, the error is printed twice with rustdoc (though only once with rustc). I'm not sure why that is, but it's better than panicking. This commit also makes rustdoc fail early in the non-projection, non-error case, instead of returning a `Res::Err` that would likely cause rustdoc to panic later on. This change is originally from #88379. r? `@GuillaumeGomez`
-
由 Mara Bos 提交于
Remove redundant `Span` in `QueryJobInfo` Previously, `QueryJobInfo` was composed of two parts: a `QueryInfo` and a `QueryJob`. However, both `QueryInfo` and `QueryJob` have a `span` field, which seem to be the same. So, the `span` was recorded twice. Now, `QueryJobInfo` is composed of a `QueryStackFrame` (the other field of `QueryInfo`) and a `QueryJob`. So, now, the `span` is only recorded once.
-
由 Mara Bos 提交于
Add regression test for issue 83190 Reduced from `bioyino-metric` by ````@hellow554```` and myself. Closes #83190. r? ````@spastorino````
-
由 Mara Bos 提交于
`fmt::Formatter::pad`: don't call chars().count() more than one time First commit merges two branches of match to call chars().count() only once: that should be faster if this method hits place of 3rd (previous) branch, plus quarter shorter. Second commit fixes some clippy lints while i'm here (should it be separate PR?).
-
由 Mara Bos 提交于
Improve closure dummy capture suggestion in macros. Fixes some cases of https://github.com/rust-lang/rust/issues/88440 Fixes https://crater-reports.s3.amazonaws.com/pr-87190-3/try%23a7a572ce3edd6d476191fbfe92c9c1986e009b34/reg/rcodec-1.0.1/log.txt
-
由 Mara Bos 提交于
Remove single use variables
-
由 Mara Bos 提交于
Upgrade array_into_iter lint to include Deref-to-array types. Fixes https://github.com/rust-lang/rust/issues/88099 Fixes the issue mentioned here: https://github.com/rust-lang/rust/pull/84147#issuecomment-819000436
-
由 Mara Bos 提交于
Use `unwrap_unchecked` where possible
-
由 Mara Bos 提交于
Stabilize std::os::unix::fs::chroot I've verified that this works as documented, and I've tested it in (a nightly build of) production software as a replacement for an unsafe call to `libc::chroot`. It's been available in nightly for a few releases. I think it's ready to stabilize. --- Tracking issue: https://github.com/rust-lang/rust/issues/84715
-
由 Aaron Hill 提交于
-
由 bors 提交于
Update Windows Argument Parsing Fixes #44650 The Windows command line is passed to applications [as a single string](https://docs.microsoft.com/en-us/archive/blogs/larryosterman/the-windows-command-line-is-just-a-string) which the application then parses to get a list of arguments. The standard rules (as used by C/C++) for parsing the command line have slightly changed over the years, most recently in 2008 which added new escaping rules. This PR implements the new rules as [described on MSDN](https://docs.microsoft.com/en-us/cpp/cpp/main-function-command-line-args?view=msvc-160#parsing-c-command-line-arguments) and [further detailed here](https://daviddeley.com/autohotkey/parameters/parameters.htm#WIN). It has been tested against the behaviour of C++ by calling a C++ program that outputs its raw command line and the contents of `argv`. See [my repo](https://github.com/ChrisDenton/winarg/tree/std) if anyone wants to reproduce my work. For an overview of how this PR changes argument parsing behavior and why we feel it is warranted see https://github.com/rust-lang/rust/pull/87580#issuecomment-893833893. For some examples see: https://github.com/rust-lang/rust/pull/87580#issuecomment-894299249
-
由 Aaron Hill 提交于
-
- 02 9月, 2021 19 次提交
-
-
由 b-naber 提交于
-
由 b-naber 提交于
-
由 bors 提交于
Shrink Session a bit Remove a couple of unnecessary fields from `Session` and remove a `Lock<T>` for a field that is never mutated anyway.
-
由 xFrednet 提交于
-
由 Vadim Petrochenkov 提交于
-
由 bjorn3 提交于
-
由 bjorn3 提交于
-
由 bjorn3 提交于
-
由 bjorn3 提交于
-
由 bors 提交于
some low hanging clippy::perf fixes
-
由 bors 提交于
Lint missing Abi in ast validation instead of lowering.
-
由 Jacob Pratt 提交于
-
由 bors 提交于
Allow writing of incomplete UTF-8 sequences to the Windows console via stdout/stderr # Problem Writes of just an incomplete UTF-8 byte sequence (e.g. `b"\xC3"` or `b"\xF0\x9F"`) to stdout/stderr with a Windows console attached error with `io::ErrorKind::InvalidData, "Windows stdio in console mode does not support writing non-UTF-8 byte sequences"` even though further writes could complete the codepoint. This is currently a rare occurence since the [linewritershim](https://github.com/rust-lang/rust/blob/2c56ea38b045624dc8b42ec948fc169eaff1206a/library/std/src/io/buffered/linewritershim.rs) implementation flushes complete lines immediately and buffers up to 1024 bytes for incomplete lines. It can still happen as described in #83258. The problem will become more pronounced once the developer can switch stdout/stderr from line-buffered to block-buffered or immediate when the changes in the "Switchable buffering for Stdout" pull request (#78515) get merged. # Patch description If there is at least one valid UTF-8 codepoint all valid UTF-8 is passed through to the extracted `write_valid_utf8_to_console()` fn. The new code only comes into play if `write()` is being passed a short byte slice comprising an incomplete UTF-8 codepoint. In this case up to three bytes are buffered in the `IncompleteUtf8` struct associated with `Stdout` / `Stderr`. The bytes are accepted one at a time. As soon as an error can be detected `io::ErrorKind::InvalidData, "Windows stdio in console mode does not support writing non-UTF-8 byte sequences"` is returned. Once a complete UTF-8 codepoint is received it is passed to the `write_valid_utf8_to_console()` and the buffer length is set to zero. Calling `flush()` will neither error nor write anything if an incomplete codepoint is present in the buffer. # Tests Currently there are no Windows-specific tests for console writing code at all. Writing (regression) tests for this problem is a bit challenging since unit tests and UI tests don't run in a console and suddenly popping up another console window might be surprising to developers running the testsuite and it might not work at all in CI builds. To just test the new functionality in unit tests the code would need to be refactored. Some guidance on how to proceed would be appreciated. # Public API changes * `std::str::verifications::utf8_char_width()` would be exposed as `std::str::utf8_char_width()` behind the "str_internals" feature gate. # Related issues * Fixes #83258. * PR #78515 will exacerbate the problem. # Open questions * Add tests? * Squash into one commit with better commit message?
-
由 bors 提交于
rustdoc: Box `GenericArgs::Parenthesized.output` Split out from #88379. This reduces the size of `GenericArgs` from 104 bytes to 56 bytes, essentially reducing it by half. `GenericArgs` is one of the fields of `PathSegment`, so this should reduce the amount of memory allocated for `PathSegment`s in the cases where the generics are not for a `Fn`, `FnMut`, or `FnOnce` trait. r? `@jyn514`
-
由 Noah Lev 提交于
Instead, return `Type::Infer` since compilation should fail anyway. That's how rustdoc handles `hir::TyKind::Err`s, so this just extends that behavior to `ty::Err`s when analyzing associated types. For some reason, the error is printed twice with rustdoc (though only once with rustc). I'm not sure why that is, but it's better than panicking. This commit also makes rustdoc fail early in the non-projection, non-error case, instead of returning a `Res::Err` that would likely cause rustdoc to panic later on. This change is originally from #88379.
-
由 bors 提交于
Display associated types of implementors Fixes #86631. Contrary to before, it doesn't display methods. I also had to "resurrect" the `auto-hide-trait-implementations` setting. :3 Only question at this point: should I move the `render_impl` boolean arguments into one struct? We're starting to have quite a lot of them... cc `@cynecx` r? `@camelid`
-
由 Guillaume Gomez 提交于
-
由 Noah Lev 提交于
Previously, `QueryJobInfo` was composed of two parts: a `QueryInfo` and a `QueryJob`. However, both `QueryInfo` and `QueryJob` have a `span` field, which seem to be the same. So, the `span` was recorded twice. Now, `QueryJobInfo` is composed of a `QueryStackFrame` (the other field of `QueryInfo`) and a `QueryJob`. So, now, the `span` is only recorded once.
-
由 bors 提交于
Update cargo, books ## nomicon 2 commits in 0c7e5bd1428e7838252bb57b7f0fbfda4ec82f02..fe6227eb3c8533200c52dffa42ef1b6f2f02c40e 2021-08-04 10:18:22 -0700 to 2021-08-31 05:42:38 +0900 - update lifetime-elision to show what elided code under `rust_2018_idi… (rust-lang/nomicon#306) - Change code for `into_iter` on the `RawVec` section for consistency/soundness (rust-lang/nomicon#302) ## cargo 8 commits in f559c109cc79fe413a8535fb620a5a58b3823d94..18751dd3f238d94d384a7fe967abfac06cbfe0b9 2021-08-26 22:54:55 +0000 to 2021-09-01 14:26:00 +0000 - print the full destination path when no track duplicates (rust-lang/cargo#9850) - Stabilize 2021 edition (rust-lang/cargo#9800) - Stabilize patch-in-config (and prefer config over manifest) (rust-lang/cargo#9839) - Adding the cargo doc --examples subcommand (rust-lang/cargo#9808) - Make library created with `cargo new` clippy happy (rust-lang/cargo#9796) - Swap out some outdated repo urls in documentation (rust-lang/cargo#9862) - Change `cargo fix --edition` to only fix edition lints. (rust-lang/cargo#9846) - Show desc of well known subcommands (fmt, clippy) in cargo --list (rust-lang/cargo#9848) ## reference 1 commits in da6ea9b03f74cae0a292f40315723d7a3a973637..0e5ed7a4bec065f0cc18c35d1c904639e095314d 2021-08-19 21:28:10 -0700 to 2021-08-29 17:33:21 +0900 - expressions.md: Attempt fixing broken grammar in Mutability paragraph (rust-lang/reference#1084) ## book 1 commits in 687e21bde2ea10c261f79fa14797c5137425098d..fcb5e0ea68112d85a1d29a7a7335978ef2a02181 2021-08-18 20:48:38 -0400 to 2021-08-31 21:26:19 -0400 - Improve the reading of the code (rust-lang/book#2845) ## rustc-dev-guide 7 commits in cf0e151b7925a40f13fbc6573c6f97d5f94c7c17..95f1acf9a39d6f402f654e917e2c1dfdb779c5fc 2021-08-22 11:47:02 -0300 to 2021-08-31 12:38:30 -0500 - Add link to `Span` - Add rustc-source to suggested rust-analyzer config (rust-lang/rustc-dev-guide#1189) - Fix typo, clarify backtick wording, and use inline code - Trailing date comments in a line inside of a paragraph caused beginning of a new paragraph. (rust-lang/rustc-dev-guide#1196) - Fix warning "Renderer command uses a path relative to the renderer output directory ..." (rust-lang/rustc-dev-guide#1194) - Fix a code block containing ```rust - date-check: Recognize capitalized 'Date' as well ## edition-guide 1 commits in 3710b0cae783d0bcd2b42452a63b081473f5970a..2d9b1b9da706de24650fdc5c3b0182f55c82115d 2021-07-26 11:34:46 -0700 to 2021-08-31 10:44:09 +0200 - Update for 2021 stabilization (rust-lang/edition-guide#266) ## embedded-book 1 commits in 4f9fcaa30d11ba52b641e6fd5206536d65838af9..c3a51e23859554369e6bbb5128dcef0e4f159fb5 2021-08-06 17:43:12 +0000 to 2021-08-26 07:04:58 +0000 - Make glossary more linkable and add more detail (rust-embedded/book#299)
-