impl Read and Write for VecDeque<u8>
Implementing `Read` and `Write` for `VecDeque<u8>` fills in the VecDeque api surface where `Vec<u8>` and `Cursor<Vec<u8>>` already impl Read and Write. Not only for completeness, but VecDeque in particular is a very handy mock interface for a TCP echo service, if only it supported Read/Write.
Since this PR is just an impl trait, I don't think there is a way to limit it behind a feature flag, so it's "insta-stable". Please correct me if I'm wrong here, not trying to rush stability.
optimize `superset` method of `IntervalSet`
Given that intervals in the `IntervalSet` are sorted and strictly separated( it means the `end` of the previous interval will not be equal to the `start` of the next interval), we can reduce the complexity of the `superset` method from O(NMlogN) to O(2N) (N is the number of intervals and M is the length of each interval)
Update minifier version to 0.2.1
This change and these changes come from an idea of `@camelid:` instead of creating a string, we just `write` the type into the file directly.
I don't think it'll have a big impact on perf but it's still a potential small improvement.
r? `@notriddle`
use precise spans for recursive const evaluation
This fixes https://github.com/rust-lang/rust/issues/73283 by using a `TyCtxtAt` with a more precise span when the interpreter recursively calls itself. Hopefully such calls are sufficiently rare that this does not cost us too much performance.
(In theory, cycles can also arise through layout computation, as layout can depend on consts -- but layout computation happens all the time so we'd have to do something to not make this terrible for performance.)
Fix polonius compare mode.
This fixes running compiler tests in `--compare-mode=polonius`. The `-Zborrowck=mir` option was removed in #95565.
r? `@jackh726`
Update books
## nomicon
5 commits in 10d40c59a581c66d8ecd29ad18d410bf97ed524d..3a43983b76174342b7dbd3e12ea2c49f762e52be
2022-05-07 10:45:07 +0900 to 2022-05-30 17:01:30 +0900
- Changes for `c_unwind` (rust-lang/nomicon#365)
- Upgrade actions/checkout to v3 (rust-lang/nomicon#367)
- Clarification of borrowck (rust-lang/nomicon#354)
- Update the now stale warning about `PhantomData<T>` and dropck (rust-lang/nomicon#363)
- Minor language fixes (rust-lang/nomicon#364)
## reference
1 commits in b74825d8f88b685e239ade00f00de68ba4cd63d4..683bfe5cd64d589c6a1645312ab5f93b6385ccbb
2022-05-20 14:30:30 -0700 to 2022-05-27 11:54:20 -0700
- Reflect changes about unsizing casts in const context (rust-lang/reference#1221)
## book
58 commits in b4dd5f00b87190ad5ef42cbc2a88a783c6ae57ef..396fdb69de7fb18f24b15c7ad13491b1c1fa7231
2022-05-24 21:37:06 -0400 to 2022-06-08 10:02:35 -0400
- Make not-equals operator example consistent. Fixesrust-lang/book#3189.
- Propagate nostarch appendix edits to src
- Edits to edits to appendices
- Edits from nostarch for the appendices
- Propagate edits to chapter 20 to src
- Edits to edits of chapter 20
- Update reference to chapter 12 code that was changed
- Edits from nostarch to chapter 20
- Fix spelling mistake
- Propagate ch17 tech review changes to src
- Responses to tech review for ch17
- Chapter 17 tech review comments
- Update dependencies via `cargo update`
- Propagate changes from ch16 tech review to src
- Tech review comments and responses for chapter 16
- Println captures in chapter 15
- Propagate chapter 15 tech review edits to src
- Responses to tech review for chapter 15
- Tech review comments for chapter 15
- Merge branch 'ch14-tr'
- Upgrade to Rust 1.61
- Upgrade to Rust 1.60
- More little improvements to chapter 12
- Update references to ch12 to be Config::build instead of new
- Propagate ch12 tech review edits to src
- Responses to tech review of chapter 12
- Tech review comments of chapter 12
- Show directory layouts including integration test files
- Clarify that integration/doc tests aren't run if unit tests fail
- Propagate ch11 tech review edits to src
- Edits in response to tech review of chapter 11
- Comments from tech review in chapter 11
- Propagate other edits to nostarch
- Adjust listing so error output line numbers match
- Merge remote-tracking branch 'origin/pr/3153' into ch10-tr
- Reword a rewording about lifetimes of values vs references
- Merge remote-tracking branch 'origin/pr/3107' into ch10-tr
- Merge remote-tracking branch 'origin/pr/3104' into ch10-tr
- Propagate ch10 edits to src
- Edits in response to tech review
- Comments from tech review for chapter 10
- New dictionary entries
- Demonstrate a better expect message. Fixesrust-lang/book#2918.
- Propagate tech review ch9 edits to src
- Termination has stabilized! Fixesrust-lang/book#3116.
- Respond to tech review comments to chapter 9
- Comments from tech review on chapter 9
- Propagate changes for ch8 to src
- Clarify that split_whitespace returns an iterator
- Add type annotation in nostarch snapshot too
- Extra-clarity qualification
- Edits to chapter 8 in response to tech review
- Comments from tech review for chapter 8
- Propagate tech review edits to ch06 src
- Responses to tech review comments on chapter 6
- Chapter 6 after tech review
- Snapshot of chapter 1 for nostarch
- src: use TLSv1.3 if we're going to specify at all
## rust-by-example
4 commits in 2ed26865e8c29ef939dc913a97bd321cadd72a9a..dbb7e5e2345ee26199ffba218156b6009016a20c
2022-05-18 17:23:47 -0300 to 2022-06-02 16:30:51 -0300
- Fix typo in Traits → "impl Trait" (rust-lang/rust-by-example#1544)
- doc_testing.md: clarify tests vs doc-tests (rust-lang/rust-by-example#1547)
- unsafe::asm.md: add some explicit declarations (rust-lang/rust-by-example#1548)
- Update dsl.md to remove unnecessary braces (rust-lang/rust-by-example#1543)
## rustc-dev-guide
6 commits in 554c00e4805df7f7bffac7db408437d62d6dfb9a..6e4d6435db89bcc027b1bba9742e4f59666f5412
2022-05-24 17:15:35 -0700 to 2022-06-08 08:06:32 +0900
- Make build scripts and proc macros work with the suggested rust-analyzer config (rust-lang/rustc-dev-guide#1365)
- improve rustc_interface examples a little (rust-lang/rustc-dev-guide#1362)
- Bump regex from 1.4.3 to 1.5.5 in /ci/date-check (rust-lang/rustc-dev-guide#1364)
- Clarify cargo fallback behavior for rustup link (rust-lang/rustc-dev-guide#1273)
- Update rustc-driver related examples
- Triage some date references related to traits
## embedded-book
1 commits in f7cefbb995eec8c6148f213235e9e2e03268e775..cbb494f96da3268c2925bdadc65ca83d42f2d4ef
2022-04-20 10:38:51 +0000 to 2022-05-26 06:58:43 +0000
- Add Chinese translation repository (rust-embedded/book#318)
Suggest using `iter()` or `into_iter()` for `Vec`
We cannot do that for `&Vec` because `#[rustc_on_unimplemented]` is limited (it does not clean generic instantiation for references, only for ADTs).
`@rustbot` label +A-diagnostics
Don't suggest adding `let` in certain `if` conditions
Avoid being too eager to suggest `let` in an `if` condition with an `=`, namely when the LHS of the `=` isn't even valid as a pattern (to a first degree approximation).
This heustic I came up with kinda sucks. Let me know if it needs to be refined.
Fix indices and remove some unwraps in arg mismatch algorithm
This is a more conservative fix than #97542, addressing some indices which were used incorectly and unwraps which are bound to panic (e.g. when the provided and expected arg counts differ). Beta nominating this as it's quite easy to cause ICEs -- I wrote a fuzzer and found hundreds of examples of ICEs.
cc `@jackh726` as author of #92364, and `@estebank` as reviewer of that PR.
fixes#97484
r? `@jackh726` this should be _much_ easier to review than the other PR 😅
Update cargo
7 commits in 38472bc19f2f76e245eba54a6e97ee6821b3c1db..85e457e158db216a2938d51bc3b617a5a7fe6015
2022-05-31 02:03:24 +0000 to 2022-06-07 21:57:52 +0000
- Make -Z http-registry use index.crates.io when accessing crates-io (rust-lang/cargo#10725)
- Respect submodule update=none strategy in .gitmodules (rust-lang/cargo#10717)
- Expose rust-version through env var (rust-lang/cargo#10713)
- add validation for string "true"/"false" in lto profile (rust-lang/cargo#10676)
- Enhance documentation of testing (rust-lang/cargo#10726)
- Clear disk space on CI. (rust-lang/cargo#10724)
- Enforce to use tar v0.4.38 (rust-lang/cargo#10720)
Add regression test for anonymous lifetimes
Fixes#84634.
Seems like this issue was already solved. I added a regression test just in case so we can close it with peace in mind.
r? `@notriddle`
Move rustfmt downloads from bootstrap.py to rustbuild
- Allow verifying CI downloads using src/stage0.json
- Change download functions not to hard-code `ci-artifacts.rust-lang.org`
- Change `format::format` to take a `Builder` so it has access to `download_component`. I think we may want to reconsider the distinction between Build and Builder at some point; I don't think it's particularly useful.
- Move rustfmt downloads out of bootstrap.py
Fixes https://github.com/rust-lang/rust/issues/95136. Helps with https://github.com/rust-lang/rust/issues/94829. This is based on https://github.com/rust-lang/rust/pull/96687 for simplicity.
Impl Traits lowering minor refactors
This are unrelated changes on my RPIT refactor that may be better to merge before opening the main PR.
r? `@cjgillot`
cc `@nikomatsakis`
Specify DWARF alignment in bits, not bytes.
In DWARF, alignment of types is specified in bits, as is made clear by the
parameter name `AlignInBits`. However, `rustc` was incorrectly passing a byte
alignment. This commit fixes that.
This was noticed in upstream LLVM when I tried to check in a test consisting of
LLVM IR generated from `rustc` and it triggered assertions [1].
[1]: https://reviews.llvm.org/D126835
Use repr(C) when depending on struct layout in ptr tests
The test depends on the layout of this struct `Pair`, so it should use `repr(C)` instead of the default `repr(Rust)`.
Recover missing comma after match arm
If we're missing a comma after a match arm expression, try parsing another pattern and a following `=>`. If we find both of those, then recover by suggesting to insert a `,`.
Fixes#80112
Recover `import` instead of `use` in item
When we definitely don't have a macro invocation (i.e. when we don't have `import ::`), then it's more productive to parse `import` as if it was incorrectly mistaken for `use`.
Not sure if this needs to be a verbose suggestion, but it renders strangely when it's not verbose:
```
error: expected item, found `import`
--> /home/michael/test.rs:1:1
|
1 | import std::{io::{self, Write}, rc::Rc};
| ^^^^^^ help: items are imported using the `use` keyword: `use`
```
Happy to change it to `span_suggestion` instead of `span_suggestion_verbose` though.
Fixes#97788