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 12 pull requests #101073

Closed

Conversation

compiler-errors
Copy link
Member

Successful merges:

Failed merges:

r? @ghost
@rustbot modify labels: rollup

Create a similar rollup

joshtriplett and others added 30 commits July 12, 2022 21:30
We have `File::create` for creating a file or opening an existing file,
but the secure way to guarantee creating a new file requires a longhand
invocation via `OpenOptions`.

Add `File::create_new` to handle this case, to make it easier for people
to do secure file creation.
Apply the diagnostic migration lint to more functions on `Session`.

Signed-off-by: David Wood <david.wood@huawei.com>
Add impls of `IntoDiagnosticArg` for `std::io::Error`, `std::path::Path`
and `std::path::PathBuf`.

Signed-off-by: David Wood <david.wood@huawei.com>
Migrate the `rustc_incremental` crate's diagnostics to translatable
diagnostic structs.

Signed-off-by: David Wood <david.wood@huawei.com>
Reduce duplication by moving fetching logic into a dedicated function.
`writeln!` already includes a reference to `write!` for more
information, so remove duplicated information.
Stabilization has been completed [here](rust-lang#92980 (comment))
with a FCP.
Related to rust-lang#100952

This is definitely not a complete solution, but it does shrink
keysyms/index.html on smithay from 620K to 516K.
…rminal

The UNIX and WASI implementations use `isatty`. The Windows
implementation uses the same logic the `atty` crate uses, including the
hack needed to detect msys terminals.

Implement this trait for `File` and for `Stdin`/`Stdout`/`Stderr` and
their locked counterparts on all platforms. On UNIX and WASI, implement
it for `BorrowedFd`/`OwnedFd`. On Windows, implement it for
`BorrowedHandle`/`OwnedHandle`.

Based on rust-lang#91121

Co-authored-by: Matt Wilkinson <mattwilki17@gmail.com>
If a process has no console, it'll have NULL in place of a console
handle, so return early with `false` in that case without making any OS
calls.
Rather than referencing a slice's pointer and then creating a new slice
with a longer length, offset from the base structure pointer instead.
This makes some choices of Rust semantics happier.
… r=joshtriplett

Support parsing IP addresses from a byte string

Fixes rust-lang#94821

The goal is to be able to parse addresses from a byte string without requiring to do any utf8 validation. Since internally the parser already works on byte strings, this should be possible and I personally already needed this in the past too.

~~I used the proposed approach from the issue by implementing `TryFrom<&'a [u8]>` for all 6 address types (3 ip address types and 3 socket address types). I believe implementing stable traits for stable types is insta-stable so this will probably need an FCP?~~

Switched to an unstable inherent method approach called `parse_ascii` as requested.

cc ``@jyn514``
…ffset_from, r=Mark-Simulacrum

Stabilize `const_ptr_offset_from`.

Stabilization has been completed [here](rust-lang#92980 (comment)) with a FCP.

Closes rust-lang#92980.
… r=thomcc

Add `IsTerminal` trait to determine if a descriptor or handle is a terminal

The UNIX implementation uses `isatty`. The Windows implementation uses
the same logic the `atty` crate uses, including the hack needed to
detect msys terminals.

Implement this trait for `Stdin`/`Stdout`/`Stderr`/`File` on all
platforms. On Unix, implement it for `BorrowedFd`/`OwnedFd`. On Windows,
implement it for `BorrowedHandle`/`OwnedHandle`.

Based on rust-lang#91121

Co-authored-by: Matt Wilkinson <mattwilki17@gmail.com>
Add a `File::create_new` constructor

We have `File::create` for creating a file or opening an existing file,
but the secure way to guarantee creating a new file requires a longhand
invocation via `OpenOptions`.

Add `File::create_new` to handle this case, to make it easier for people
to do secure file creation.
…, r=Mark-Simulacrum

Make forward compatibility lint deprecated_cfg_attr_crate_type_name deny by default

Turns the forward compatibility lint added by rust-lang#83744 to deprecate `cfg_attr` usage with `#![crate_type]` and `#![crate_name]` attributes into deny by default. Copying the example from rust-lang#83744:

```Rust
#![crate_type = "lib"] // remains working
#![cfg_attr(foo, crate_type = "bin")] // will stop working
```

Over 8 months have passed since rust-lang#83744 was merged so I'd say this gives ample time for people to have been warned, so we can make the warning stronger. No usage was found via grep.app except for one, which was in an unmaintained code base that didn't seem to be used in the open source eco system. The crater run conducted in rust-lang#83744 also didn't show up anything.

cc rust-lang#91632 - tracking issue for the lint
… r=compiler-errors

incremental: migrate diagnostics

- Apply the diagnostic migration lints to more functions on `Session`, namely: `span_warn`, `span_warn_with_code`, `warn` `note_without_error`, `span_note_without_error`, `struct_note_without_error`.
- Add impls of `IntoDiagnosticArg` for `std::io::Error`, `std::path::Path` and `std::path::PathBuf`.
- Migrate the `rustc_incremental` crate's diagnostics to translatable diagnostic structs.

r? ```@compiler-errors```
cc rust-lang#100717
Fix wrong compiletest filters on Windows

As discussed in [rust-lang#79334](rust-lang#79334), when calling e.g.
```
python x.py test src/test/ui/expr/compound-assignment/eval-order.rs
```
on Windows, compiletest passes the filter `expr/compound-assignment/eval-order.rs` to libtest, which instead should be `expr\compound-assignment\eval-order.rs`, as that is the file found when collecting tests. This is what I fixed.

I'm not sure how to organize a test for this. Any suggestions?
…mulacrum

Smaller improvements of tidy and the unicode generator
…mulacrum

Update documentation for `write!` and `writeln!`

rust-lang#37472 added this documentation, but it
needs updating:

- Remove some documentation duplicated between `writeln!` and `write!`
- Update `write!` docs: can now import traits as `_` to avoid conflicts
- Expand example to show how to implement qualified trait names
…n, r=davidtwco

Allow deriving multipart suggestions

This turned into a bit more of a rewrite than I was initially hoping for... Still, I think the `SessionSubdiagnostic` derive is a little cleaner overall now, and closer to the `SessionDiagnostic` derive to make future code sharing easier.

r? `@davidtwco`
Provide structured suggestion for `hashmap[idx] = val`
…block-short, r=GuillaumeGomez

rustdoc: omit start/end tags for empty item description blocks

Related to rust-lang#100952

This is definitely not a complete solution, but it does shrink keysyms/index.html on smithay from 620K to 516K.
@rustbot rustbot added T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) A-translation Area: Translation infrastructure, and migrating existing diagnostics to SessionDiagnostic T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. T-libs Relevant to the library team, which will review and decide on the PR/issue. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. rollup A PR which is a rollup labels Aug 27, 2022
@compiler-errors
Copy link
Member Author

@bors r+ rollup=never p=10

@bors
Copy link
Contributor

bors commented Aug 27, 2022

📌 Commit 8468c71 has been approved by compiler-errors

It is now in the queue for this repository.

@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 Aug 27, 2022
@rust-log-analyzer
Copy link
Collaborator

The job mingw-check failed! Check out the build log: (web) (plain)

Click to see the possible cause of the failure (guessed by this bot)
    Checking rustc_mir_transform v0.0.0 (/checkout/compiler/rustc_mir_transform)
    Checking rustc_codegen_llvm v0.0.0 (/checkout/compiler/rustc_codegen_llvm)
    Checking rustc_privacy v0.0.0 (/checkout/compiler/rustc_privacy)
    Checking rustc_interface v0.0.0 (/checkout/compiler/rustc_interface)
error: diagnostics should only be created in `SessionDiagnostic`/`AddSubdiagnostic` impls
    |
    |
578 |             session.warn(&format!(
    |
note: the lint level is defined here
   --> compiler/rustc_interface/src/lib.rs:9:9
    |
    |
9   | #![deny(rustc::diagnostic_outside_of_impl)]


error: diagnostics should be created using translatable messages
    |
    |
578 |             session.warn(&format!(
    |
note: the lint level is defined here
   --> compiler/rustc_interface/src/lib.rs:8:9
    |
    |
8   | #![deny(rustc::untranslatable_diagnostic)]


error: diagnostics should only be created in `SessionDiagnostic`/`AddSubdiagnostic` impls
    |
627 |                 sess.warn(
    |                      ^^^^


error: diagnostics should be created using translatable messages
    |
627 |                 sess.warn(
    |                      ^^^^


error: diagnostics should only be created in `SessionDiagnostic`/`AddSubdiagnostic` impls
    |
    |
634 |                     sess.warn("ignoring -C extra-filename flag due to -o flag");


error: diagnostics should be created using translatable messages
    |
    |
634 |                     sess.warn("ignoring -C extra-filename flag due to -o flag");


error: diagnostics should only be created in `SessionDiagnostic`/`AddSubdiagnostic` impls
    |
    |
639 |                 sess.warn("ignoring --out-dir flag due to -o flag");


error: diagnostics should be created using translatable messages
    |
    |
639 |                 sess.warn("ignoring --out-dir flag due to -o flag");

error: could not compile `rustc_interface` due to 8 previous errors
warning: build failed, waiting for other jobs to finish...
error: could not compile `rustc_interface` due to 8 previous errors

@compiler-errors
Copy link
Member Author

@bors r-

@bors bors added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Aug 27, 2022
@davidtwco davidtwco removed the A-translation Area: Translation infrastructure, and migrating existing diagnostics to SessionDiagnostic label Oct 4, 2022
@compiler-errors compiler-errors deleted the rollup-11q3br2 branch November 2, 2022 03:00
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-author Status: This is awaiting some action (such as code changes or more information) from the author. T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. T-libs Relevant to the library team, which will review and decide on the PR/issue. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.