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 #84564

Merged
merged 34 commits into from
Apr 26, 2021
Merged

Rollup of 8 pull requests #84564

merged 34 commits into from
Apr 26, 2021

Conversation

Dylan-DPC-zz
Copy link

Successful merges:

Failed merges:

r? @ghost
@rustbot modify labels: rollup

Create a similar rollup

klensy and others added 30 commits April 16, 2021 03:14
Rejecting the forbidden unsafe ops is done by const checking, not by unsafety checking
- Suggest using `rustup target add` if `RUSTUP_HOME` is set. I don't know if there's any precedent for doing this, but it seems harmless enough and it will be a big help.
- Add a note about `#![no_std]` if `std` is missing but not core
- On nightly, suggest using `cargo build -Z build-std` if `CARGO` is set
- Add a note that std may be unsupported if `std` is missing but not core
- Don't suggest `#![no_std]` when the load isn't injected by the
  compiler
refactor StyledBuffer

Refactors StyledBuffer `text` and `styles` fields content into StyledChar and touches some other stuff.
Give a better error when `std` or `core` are missing

- Suggest using `rustup target add` if `RUSTUP_HOME` is set. I don't know if there's any precedent for doing this, but it seems harmless enough and it will be a big help.
- On nightly, suggest using `cargo build -Z build-std` if `CARGO` is set
- Add a note about `#![no_std]` if `std` is missing but not core
- Add a note that std may be unsupported if `std` is missing but not core

Fixes rust-lang#84418.

r? `@petrochenkov`
…nt, r=petrochenkov

Handle pretty printing of `else if let` clauses without ICEing

When pretty printing the HIR of `if ... {} else if let ... {}` clauses, this displays it the `else if let` part as `match` it gets desugared to, the same way normal `if let` statements are currently displayed, instead of ICEing.

```rust
pub fn main() {
    if true {
        // 1
    } else if let a = 1 {
        // 2
    } else {
        // 3
    }
}
```

now gets desugared (via `rustc -Zunpretty=hir,typed src/x.rs`) to:

```rust
#[prelude_import]
use ::std::prelude::rust_2015::*;
#[macro_use]
extern crate std;
pub fn main() ({
                   (if (true as bool)
                       ({
                            // 1
                        } as
                           ()) else {match (1 as i32) {
                                         a => {
                                             // 2
                                         }
                                         _ => {
                                             // 3
                                         }
                                     }} as ())
                    } as ())
```

For comparison, this code gets HIR prettyprinted the same way before and after this change:

```rust
pub fn main() {
    if let a = 1 {
        // 2
    } else {
        // 3
    }
}
```
turns into
```rust
#[prelude_import]
use ::std::prelude::rust_2015::*;
#[macro_use]
extern crate std;
pub fn main() ({
                   (match (1 as i32) {
                        a => {
                            // 2
                        }
                        _ => {
                            // 3
                        }
                    } as ())
               } as ())
```

This closes rust-lang#82329. It closes rust-lang#84434 as well, due to having the same root cause.
Add suggestion to "use break" when attempting to implicit-break a loop

Fixes rust-lang#84114
Improve diagnostics for function passed when a type was expected.

This PR improves diagnostics, it provides more information when a function is passed where a type is expected.

r? `@lcnr`
Inline most raw socket, fd and handle conversions

Now that file descriptor types on Unix have niches, it is advantageous for user libraries which provide file descriptor wrappers (e.g. `Socket` from socket2) to store a `File` internally instead of a `RawFd`, so that the niche can be taken advantage of. However, doing so will currently result in worse performance as `IntoRawFd`, `FromRawFd` and `AsRawFd` are not inlined. This change adds `#[inline]` to those methods on std types that wrap file descriptors, handles or sockets.
Get rid of is_min_const_fn

This removes the last trace of the min_const_fn mechanism by making the unsafety checker agnostic about whether something is a min or "non-min" const fn. It seems this distinction was used to disallow some features inside `const fn`, but that is the responsibility of the const checker, not of the unsafety checker. No test seems to even notice this change in the unsafety checker so I guess we are good...

r? `@oli-obk`
Cc rust-lang#84510
@rustbot rustbot added the rollup A PR which is a rollup label Apr 25, 2021
@Dylan-DPC-zz
Copy link
Author

@bors r+ rollup=never p=5

@bors
Copy link
Contributor

bors commented Apr 25, 2021

📌 Commit 000a630 has been approved by Dylan-DPC

@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 Apr 25, 2021
@bors
Copy link
Contributor

bors commented Apr 25, 2021

⌛ Testing commit 000a630 with merge f8f5968...

@bors
Copy link
Contributor

bors commented Apr 26, 2021

☀️ Test successful - checks-actions
Approved by: Dylan-DPC
Pushing f8f5968 to master...

@bors bors added the merged-by-bors This PR was explicitly merged by bors. label Apr 26, 2021
@bors bors merged commit f8f5968 into rust-lang:master Apr 26, 2021
@rustbot rustbot added this to the 1.53.0 milestone Apr 26, 2021
@Dylan-DPC-zz Dylan-DPC-zz deleted the rollup-wxa2yr0 branch April 26, 2021 09:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
merged-by-bors This PR was explicitly merged by bors. 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.

10 participants