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 8 pull requests #90426

Closed
wants to merge 19 commits into from

Conversation

matthiaskrgr
Copy link
Member

Successful merges:

Failed merges:

r? @ghost
@rustbot modify labels: rollup

Create a similar rollup

chrismit3s and others added 19 commits October 1, 2021 21:55
The unifying theme for this commit is weak, admittedly. I put together a
list of "expensive" functions when I originally proposed this whole
effort, but nobody's cared about that criterion. Still, it's a decent
way to bite off a not-too-big chunk of work.

Given the grab bag nature of this commit, the messages I used vary quite
a bit.
Methods that were only blocked on `const_panic` have been stabilized.
The remaining methods of `duration_consts_2` are all related to floats,
and as such have been placed behind the `duration_consts_float` feature
gate.
…riplett

Add paragraph to ControlFlow docs to menion it works with the ? operator (rust-lang#88715)

fixes rust-lang#88715

r? `@steveklabnik`
…s, r=joshtriplett

Partially stabilize `duration_consts_2`

Methods that were only blocked on `const_panic` have been stabilized.
The remaining methods of `duration_consts_2` are all related to floats,
and as such have been placed behind the `duration_consts_float` feature
gate.
…=joshtriplett

Stabilize `is_symlink()` for `Metadata` and `Path`

I'm not fully sure about `since` version, correct me if I'm wrong

Needs update after stabilization: [cargo-test-support](https://github.com/rust-lang/cargo/blob/8063672238a5b6c3a901c0fc17f3164692d0be85/crates/cargo-test-support/src/paths.rs#L202)

Linked issue: rust-lang#85748
…joshtriplett

Add #[must_use] to Rc::downgrade

Missed this in previous PR rust-lang#89796 (comment)

Parent issue: rust-lang#89692

r? `@joshtriplett`
…ations, r=joshtriplett

Add #[must_use] to expensive computations

The unifying theme for this commit is weak, admittedly. I put together a list of "expensive" functions when I originally proposed this whole effort, but nobody's cared about that criterion. Still, it's a decent way to bite off a not-too-big chunk of work.

Given the grab bag nature of this commit, the messages I used vary quite a bit. I'm open to wording changes.

For some reason clippy flagged four `BTreeSet` methods but didn't say boo about equivalent ones on `HashSet`. I stared at them for a while but I can't figure out the difference so I added the `HashSet` ones in.

```rust
// Flagged by clippy.
alloc::collections::btree_set::BTreeSet<T>   fn difference<'a>(&'a self, other: &'a BTreeSet<T>) -> Difference<'a, T>;
alloc::collections::btree_set::BTreeSet<T>   fn symmetric_difference<'a>(&'a self, other: &'a BTreeSet<T>) -> SymmetricDifference<'a, T>
alloc::collections::btree_set::BTreeSet<T>   fn intersection<'a>(&'a self, other: &'a BTreeSet<T>) -> Intersection<'a, T>;
alloc::collections::btree_set::BTreeSet<T>   fn union<'a>(&'a self, other: &'a BTreeSet<T>) -> Union<'a, T>;

// Ignored by clippy, but not by me.
std::collections::HashSet<T, S>              fn difference<'a>(&'a self, other: &'a HashSet<T, S>) -> Difference<'a, T, S>;
std::collections::HashSet<T, S>              fn symmetric_difference<'a>(&'a self, other: &'a HashSet<T, S>) -> SymmetricDifference<'a, T, S>
std::collections::HashSet<T, S>              fn intersection<'a>(&'a self, other: &'a HashSet<T, S>) -> Intersection<'a, T, S>;
std::collections::HashSet<T, S>              fn union<'a>(&'a self, other: &'a HashSet<T, S>) -> Union<'a, T, S>;
```

Parent issue: rust-lang#89692

r? `@joshtriplett`
…s, r=joshtriplett

Add #[must_use] to mem/ptr functions

There's a lot of low-level / unsafe stuff here. Are there legit use cases for ignoring any of these return values?

* No regressions in `./x.py test --stage 1 library/std src/tools/clippy`.
* One regression in `./x.py test --stage 1 src/test/ui`. Fixed.
* I am unable to run `./x.py doc` on my machine so I'll need to wait for the CI to verify doctests pass. I eyeballed all the adjacent tests and they all look okay.

Parent issue: rust-lang#89692

r? `@joshtriplett`
…lett

Add #[must_use] to remaining core functions

I've run out of compelling reasons to group functions together across crates so I'm just going to go module-by-module. This is everything remaining from the `core` crate.

Ignored by clippy for reasons unknown:

```rust
core::alloc::Layout   unsafe fn for_value_raw<T: ?Sized>(t: *const T) -> Self;
core::any             const fn type_name_of_val<T: ?Sized>(_val: &T) -> &'static str;
```

Ignored by clippy because of `mut`:

```rust
str   fn split_at_mut(&mut self, mid: usize) -> (&mut str, &mut str);
```

<del>
Ignored by clippy presumably because a caller might want `f` called for side effects. That seems like a bad usage of `map` to me.

```rust
core::cell::Ref<'b, T>   fn map<U: ?Sized, F>(orig: Ref<'b, T>, f: F) -> Ref<'b, T>;
core::cell::Ref<'b, T>   fn map_split<U: ?Sized, V: ?Sized, F>(orig: Ref<'b, T>, f: F) -> (Ref<'b, U>, Ref<'b, V>);
```
</del>

Parent issue: rust-lang#89692

r? `@joshtriplett`
…olnay

Stabilize `option_result_unwrap_unchecked`

Closes rust-lang#81383.

Stabilization report: rust-lang#81383 (comment).

`@rustbot` label +A-option-result +T-libs-api
@rustbot rustbot added the rollup A PR which is a rollup label Oct 31, 2021
@matthiaskrgr
Copy link
Member Author

@bors r+ p=8 rollup=never

@bors
Copy link
Contributor

bors commented Oct 31, 2021

📌 Commit bbe133e has been approved by matthiaskrgr

@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 Oct 31, 2021
@rust-log-analyzer
Copy link
Collaborator

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

Click to see the possible cause of the failure (guessed by this bot)
   Compiling memchr v2.4.1
   Compiling std v0.0.0 (/checkout/library/std)
   Compiling compiler_builtins v0.1.49
   Compiling unwind v0.0.0 (/checkout/library/unwind)
error: `panic` is not yet stable as a const fn
    |
23  | / pub macro panic_2015 {
24  | |     () => (
25  | |         $crate::panicking::panic("explicit panic")
---
    | |_- in this expansion of `$crate::panic::panic_2015!` (#2)
    |
   ::: library/core/src/time.rs:189:21
    |
189 |               None => panic!("overflow in Duration::new"),
    |                       |
    |                       in this macro invocation (#1)
    |                       in this macro invocation (#2)
    |
---
    | |_- in this expansion of `panic!` (#1)
    |
    = help: const-stable functions can only call other const-stable functions

error: `panic` is not yet stable as a const fn
     |
214  | / macro_rules! debug_assert {
214  | / macro_rules! debug_assert {
215  | |     ($($arg:tt)*) => (if $crate::cfg!(debug_assertions) { $crate::assert!($($arg)*); })
     | |                                                           ^^^^^^^^^^^^^^^^^^^^^^^^^ in this macro invocation (#2)
     | |_- in this expansion of `debug_assert!` (#1)
...
1326 | /     macro_rules! assert {
1326 | /     macro_rules! assert {
1327 | |         ($cond:expr $(,)?) => {{ /* compiler built-in */ }};
1328 | |         ($cond:expr, $($arg:tt)+) => {{ /* compiler built-in */ }};
     | |_____- in this expansion of `$crate::assert!` (#2)
     |
    ::: library/core/src/time.rs:497:13
     |
     |
497  |               debug_assert!(nanos < NANOS_PER_SEC);
     |
     = help: const-stable functions can only call other const-stable functions


error: `panic` is not yet stable as a const fn
     |
214  | / macro_rules! debug_assert {
214  | / macro_rules! debug_assert {
215  | |     ($($arg:tt)*) => (if $crate::cfg!(debug_assertions) { $crate::assert!($($arg)*); })
     | |                                                           ^^^^^^^^^^^^^^^^^^^^^^^^^ in this macro invocation (#2)
     | |_- in this expansion of `debug_assert!` (#1)
...
1326 | /     macro_rules! assert {
1326 | /     macro_rules! assert {
1327 | |         ($cond:expr $(,)?) => {{ /* compiler built-in */ }};
1328 | |         ($cond:expr, $($arg:tt)+) => {{ /* compiler built-in */ }};
     | |_____- in this expansion of `$crate::assert!` (#2)
     |
    ::: library/core/src/time.rs:557:13
     |
     |
557  |               debug_assert!(nanos < NANOS_PER_SEC);
     |
     = help: const-stable functions can only call other const-stable functions


error: `panic` is not yet stable as a const fn
     |
214  | / macro_rules! debug_assert {
214  | / macro_rules! debug_assert {
215  | |     ($($arg:tt)*) => (if $crate::cfg!(debug_assertions) { $crate::assert!($($arg)*); })
     | |                                                           ^^^^^^^^^^^^^^^^^^^^^^^^^ in this macro invocation (#2)
     | |_- in this expansion of `debug_assert!` (#1)
...
1326 | /     macro_rules! assert {
1326 | /     macro_rules! assert {
1327 | |         ($cond:expr $(,)?) => {{ /* compiler built-in */ }};
1328 | |         ($cond:expr, $($arg:tt)+) => {{ /* compiler built-in */ }};
     | |_____- in this expansion of `$crate::assert!` (#2)
     |
    ::: library/core/src/time.rs:613:17
     |
     |
613  |                   debug_assert!(nanos < NANOS_PER_SEC);
     |
     = help: const-stable functions can only call other const-stable functions


error: `panic` is not yet stable as a const fn
     |
214  | / macro_rules! debug_assert {
214  | / macro_rules! debug_assert {
215  | |     ($($arg:tt)*) => (if $crate::cfg!(debug_assertions) { $crate::assert!($($arg)*); })
     | |                                                           ^^^^^^^^^^^^^^^^^^^^^^^^^ in this macro invocation (#2)
     | |_- in this expansion of `debug_assert!` (#1)
...
1326 | /     macro_rules! assert {
1326 | /     macro_rules! assert {
1327 | |         ($cond:expr $(,)?) => {{ /* compiler built-in */ }};
1328 | |         ($cond:expr, $($arg:tt)+) => {{ /* compiler built-in */ }};
     | |_____- in this expansion of `$crate::assert!` (#2)
     |
    ::: library/core/src/time.rs:670:13
     |
     |
670  |               debug_assert!(nanos < NANOS_PER_SEC);
     |
     = help: const-stable functions can only call other const-stable functions

error: could not compile `core` due to 5 previous errors

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.

9 participants