Skip to content
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 10 pull requests #82790

Closed
wants to merge 63 commits into from
Closed

Conversation

JohnTitor
Copy link
Member

Successful merges:

Failed merges:

r? @ghost
@rustbot modify labels: rollup

Create a similar rollup

Nicholas-Baron and others added 20 commits March 4, 2021 10:25
Due to a rebase, some edits were needed in the mod file.
- Remove most of the information about passes. Passes are deprecated.
- Add `--document-private-items`; it was missing before.
- Update `--output-format json`; it was very outdated.
- Note that `--input-format` is deprecated.
- Move deprecated options to the very end.
- Move `passes.html` to the end of the table of contents. Ideally it
  would be removed altogether, but that causes mdbook not to generate the
  docs.
…c-hidden, r=jyn514

Don't warn for `missing_doc_examples` when item is #[doc(hidden)]

r? ```@jyn514```
resolve: Reduce scope of `pub_use_of_private_extern_crate` deprecation lint

This lint was deny-by-default since July 2017, crater showed 7 uses on crates.io back then (rust-lang#42894 (comment)).

Unfortunately, the construction `pub use foo as bar` where `foo` is `extern crate foo;` was used by an older version `bitflags`, so turning it into an error causes too many regressions.
So, this PR reduces the scope of the lint instead of turning it into a hard error, and only turns some more rarely used components of it into errors.
…ramertj

Improved IO Bytes Size Hint

After trying to implement better `size_hint()` return values for `File` in [this PR](rust-lang#81044) and changing to implementing it for `BufReader` in [this PR](rust-lang#81052), I have arrived at this implementation that provides tighter bounds for the `Bytes` iterator of various readers including `BufReader`, `Empty`, and `Chain`.

Unfortunately, for `BufReader`, the size_hint only improves after calling `fill_buffer` due to it using the contents of the buffer for the hint. Nevertheless, the the tighter bounds  should result in better pre-allocation of space to handle the contents of the `Bytes` iterator.

Closes rust-lang#81052
… r=GuillaumeGomez

Shorten html::render

The `mod.rs` for librustdoc's `html::render` was over 3,000 lines. This PR reduces it to around 2,300 by
1. Moving `Context` and associated `impl`s to a separate file
2. Moving the `print_item` function and its helpers to a separate file
3. Moving `write_shared` and `write_minify` to their own file

Related to issue rust-lang#60302.
Edit 1: `SharedContext` and related `impl`s is only 72 lines and so will not be moved.
Update rustdoc documentation

- Remove most of the information about passes. Passes are deprecated.
- Add `--document-private-items`; it was missing before.
- Update `--output-format json`; it was very outdated.
- Note that `--input-format` is deprecated.
- Move deprecated options to the very end.

Closes rust-lang#82675.

r? ```@Manishearth```
Add a regression test for issue-81712

Fixes rust-lang#81712, also fixes rust-lang#79768 as duplicate.
r? ``@jackh726``
Add {BTreeMap,HashMap}::try_insert

`{BTreeMap,HashMap}::insert(key, new_val)` returns `Some(old_val)` if the key was already in the map. It's often useful to assert no duplicate values are inserted.

We experimented with `map.insert(key, val).unwrap_none()` (rust-lang#62633), but decided that that's not the kind of method we'd like to have on `Option`s.

`insert` always succeeds because it replaces the old value if it exists. One could argue that `insert()` is never the right method for panicking on duplicates, since already handles that case by replacing the value, only allowing you to panic after that already happened.

This PR adds a `try_insert` method that instead returns a `Result::Err` when the key already exists. This error contains both the `OccupiedEntry` and the value that was supposed to be inserted. This means that unwrapping that result gives more context:
```rust
    map.insert(10, "world").unwrap_none();
    // thread 'main' panicked at 'called `Option::unwrap_none()` on a `Some` value: "hello"', src/main.rs:8:29
```

```rust
    map.try_insert(10, "world").unwrap();
    // thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value:
    // OccupiedError { key: 10, old_value: "hello", new_value: "world" }', src/main.rs:6:33
```

It also allows handling the failure in any other way, as you have full access to the `OccupiedEntry` and the value.

`try_insert` returns a reference to the value in case of success, making it an alternative to `.entry(key).or_insert(value)`.

r? `@Amanieu`

Fixes rust-lang/rfcs#3092
…, r=davidtwco

Fix polymorphization ICE on associated types in trait decls using const generics in bounds

r? ``@davidtwco``

only the last commit actually changes something
Add assert_matches macro.

This adds `assert_matches!(expression, pattern)`.

Unlike the other asserts, this one ~~consumes the expression~~ may consume the expression, to be able to match the pattern. (It could add a `&` implicitly, but that's noticable in the pattern, and will make a consuming guard impossible.)

See rust-lang#62633 (comment)

This re-uses the same `left: .. right: ..` output as the `assert_eq` and `assert_ne` macros, but with the pattern as the right part:

assert_eq:
```
assertion failed: `(left == right)`
  left: `Some("asdf")`,
 right: `None`
```
assert_matches:
```
assertion failed: `(left matches right)`
  left: `Ok("asdf")`,
 right: `Err(_)`
```

cc `@cuviper`
@rustbot rustbot added the rollup A PR which is a rollup label Mar 5, 2021
@JohnTitor
Copy link
Member Author

@bors r+ p=10 rollup=never

@bors
Copy link
Contributor

bors commented Mar 5, 2021

📌 Commit a910b04 has been approved by JohnTitor

@bors bors added the S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. label Mar 5, 2021
@bors
Copy link
Contributor

bors commented Mar 5, 2021

⌛ Testing commit a910b04 with merge 4dd60963d0663dfce0e13d729c1457ac28b1706a...

@rust-log-analyzer
Copy link
Collaborator

The job x86_64-apple failed! Check out the build log: (web) (plain)

Click to see the possible cause of the failure (guessed by this bot)
      Memory: 14 GB
      Boot ROM Version: VMW71.00V.13989454.B64.1906190538
      Apple ROM Info: [MS_VM_CERT/SHA1/27d66596a61c48dd3dc7216fd715126e33f59ae7]Welcome to the Virtual Machine
      SMC Version (system): 2.8f0
      Serial Number (system): VMN8oPavJ/Pw

hw.ncpu: 3
hw.byteorder: 1234
hw.memsize: 15032385536
---
   Compiling rustc-main v0.0.0 (/Users/runner/work/rust/rust/compiler/rustc)
error[E0308]: mismatched types
  --> compiler/rustc/src/main.rs:39:50
   |
39 |             static _F7: unsafe extern "C" fn() = _rjem_je_zone_register();
   |
   |
   = note: expected fn pointer `unsafe extern "C" fn()`

error: aborting due to previous error

For more information about this error, try `rustc --explain E0308`.
For more information about this error, try `rustc --explain E0308`.
[RUSTC-TIMING] rustc_main test:false 0.533
error: could not compile `rustc-main`

To learn more, run the command again with --verbose.
command did not execute successfully: "/Users/runner/work/rust/rust/build/x86_64-apple-darwin/stage0/bin/cargo" "build" "--target" "x86_64-apple-darwin" "-Zbinary-dep-depinfo" "-j" "3" "--release" "--locked" "--color" "always" "--features" "jemalloc llvm max_level_info" "--manifest-path" "/Users/runner/work/rust/rust/compiler/rustc/Cargo.toml" "--message-format" "json-render-diagnostics"
failed to run: /Users/runner/work/rust/rust/build/bootstrap/debug/bootstrap --stage 2 test
Build completed unsuccessfully in 0:42:35

@JohnTitor JohnTitor closed this Mar 5, 2021
@JohnTitor JohnTitor deleted the rollup-fkwc7qi branch March 5, 2021 09:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
rollup A PR which is a rollup S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion.
Projects
None yet
Development

Successfully merging this pull request may close these issues.