]> git.lizzy.rs Git - rust.git/log
rust.git
2 years agoExtract constant MARGIN out of Printer struct
David Tolnay [Mon, 31 Jan 2022 18:56:40 +0000 (10:56 -0800)]
Extract constant MARGIN out of Printer struct

2 years agoAuto merge of #93373 - spastorino:def_id_to_hir_id_refactor, r=oli-obk
bors [Mon, 31 Jan 2022 14:23:44 +0000 (14:23 +0000)]
Auto merge of #93373 - spastorino:def_id_to_hir_id_refactor, r=oli-obk

Store def_id_to_hir_id as variant in hir_owner.

If hir_owner is Owner(_), the LocalDefId is pointing to an owner, so the ItemLocalId is 0.
If the HIR node does not exist, we store Phantom.
Otherwise, we store the HirId associated to the LocalDefId.

Related to #89278

r? `@oli-obk`

2 years agoAuto merge of #93498 - matthiaskrgr:rollup-k5shwrc, r=matthiaskrgr
bors [Mon, 31 Jan 2022 11:24:03 +0000 (11:24 +0000)]
Auto merge of #93498 - matthiaskrgr:rollup-k5shwrc, r=matthiaskrgr

Rollup of 8 pull requests

Successful merges:

 - #90277 (Improve terminology around "after typeck")
 - #92918 (Allow eliding GATs in expression position)
 - #93039 (Don't suggest inaccessible fields)
 - #93155 (Switch pretty printer to block-based indentation)
 - #93214 (Respect doc(hidden) when suggesting available fields)
 - #93347 (Make `char::DecodeUtf16::size_hist` more precise)
 - #93392 (Clarify documentation on char::MAX)
 - #93444 (Fix some CSS warnings and errors from VS Code)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup

2 years agoAuto merge of #93499 - matthiaskrgr:rollup-icdex11, r=matthiaskrgr
bors [Mon, 31 Jan 2022 08:12:10 +0000 (08:12 +0000)]
Auto merge of #93499 - matthiaskrgr:rollup-icdex11, r=matthiaskrgr

Rollup of 8 pull requests

Successful merges:

 - #93395 (Improve suggestion for escaping reserved keywords)
 - #93403 (review the total_cmp documentation)
 - #93461 (Accommodate yield points in the format_args expansion)
 - #93462 (Document `SystemTime` platform precision)
 - #93471 (unix: Use metadata for `DirEntry::file_type` fallback)
 - #93480 (Remove deprecated and unstable slice_partition_at_index functions)
 - #93485 (core: Remove some redundant {}s from the sorting code)
 - #93494 (kmc-solid: Inherit the calling task's base priority in `Thread::new`)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup

2 years agoRollup merge of #93494 - solid-rs:fix-kmc-solid-spawned-task-priority, r=Mark-Simulacrum
Matthias Krüger [Mon, 31 Jan 2022 06:00:47 +0000 (07:00 +0100)]
Rollup merge of #93494 - solid-rs:fix-kmc-solid-spawned-task-priority, r=Mark-Simulacrum

kmc-solid: Inherit the calling task's base priority in `Thread::new`

This PR fixes the initial priority calculation of spawned threads on the [`*-kmc-solid_*`](https://doc.rust-lang.org/nightly/rustc/platform-support/kmc-solid.html) Tier 3 targets.

Fixes a spawned task (an RTOS object on top of which threads are implemented for this target; unrelated to async tasks) getting an unexpectedly higher priority if it's spawned by a task whose priority is temporarily boosted by a priority-protection mutex.

2 years agoRollup merge of #93485 - est31:remove_curly, r=joshtriplett
Matthias Krüger [Mon, 31 Jan 2022 06:00:46 +0000 (07:00 +0100)]
Rollup merge of #93485 - est31:remove_curly, r=joshtriplett

core: Remove some redundant {}s from the sorting code

2 years agoRollup merge of #93480 - est31:remove_unstable_deprecated, r=Mark-Simulacrum
Matthias Krüger [Mon, 31 Jan 2022 06:00:45 +0000 (07:00 +0100)]
Rollup merge of #93480 - est31:remove_unstable_deprecated, r=Mark-Simulacrum

Remove deprecated and unstable slice_partition_at_index functions

They have been deprecated since commit 01ac5a97c90c26ac35ca9d65f685dd6701edfa3b
which was part of the 1.49.0 release, so from the point of nightly,
11 releases ago.

2 years agoRollup merge of #93471 - cuviper:direntry-file_type-stat, r=the8472
Matthias Krüger [Mon, 31 Jan 2022 06:00:44 +0000 (07:00 +0100)]
Rollup merge of #93471 - cuviper:direntry-file_type-stat, r=the8472

unix: Use metadata for `DirEntry::file_type` fallback

When `DirEntry::file_type` fails to match a known `d_type`, we should
fall back to `DirEntry::metadata` instead of a bare `lstat`, because
this is faster and more reliable on targets with `fstatat`.

2 years agoRollup merge of #93462 - ChrisDenton:systime-doc, r=joshtriplett
Matthias Krüger [Mon, 31 Jan 2022 06:00:43 +0000 (07:00 +0100)]
Rollup merge of #93462 - ChrisDenton:systime-doc, r=joshtriplett

Document `SystemTime` platform precision

Fixes #88822

2 years agoRollup merge of #93461 - dtolnay:fmtyield, r=davidtwco
Matthias Krüger [Mon, 31 Jan 2022 06:00:42 +0000 (07:00 +0100)]
Rollup merge of #93461 - dtolnay:fmtyield, r=davidtwco

Accommodate yield points in the format_args expansion

Fixes #93274.

For the case `println!("{} {:?}", "", async {}.await)` in the issue, the expansion before:

```rust
::std::io::_print(
    ::core::fmt::Arguments::new_v1(
        &["", " ", "\n"],
        &[
            ::core::fmt::ArgumentV1::new(&"", ::core::fmt::Display::fmt),
            ::core::fmt::ArgumentV1::new(&async {}.await, ::core::fmt::Debug::fmt),
        ],
    ),
);
```

After:

```rust
::std::io::_print(
    ::core::fmt::Arguments::new_v1(
        &["", " ", "\n"],
        &match (&"", &async {}.await) {
            _args => [
                ::core::fmt::ArgumentV1::new(_args.0, ::core::fmt::Display::fmt),
                ::core::fmt::ArgumentV1::new(_args.1, ::core::fmt::Debug::fmt),
            ],
        },
    ),
);
```

2 years agoRollup merge of #93403 - nagisa:total-cmp-review, r=joshtriplett
Matthias Krüger [Mon, 31 Jan 2022 06:00:41 +0000 (07:00 +0100)]
Rollup merge of #93403 - nagisa:total-cmp-review, r=joshtriplett

review the total_cmp documentation

The documentation has been restructured to split out a brief summary
paragraph out from the following elaborating paragraphs.

I also attempted my hand at wording improvements and adding articles
where I felt them missing, but being non-native english speaker these
may need more thorough review.

cc https://github.com/rust-lang/rust/issues/72599

2 years agoRollup merge of #93395 - camelid:reserved-sugg, r=davidtwco
Matthias Krüger [Mon, 31 Jan 2022 06:00:40 +0000 (07:00 +0100)]
Rollup merge of #93395 - camelid:reserved-sugg, r=davidtwco

Improve suggestion for escaping reserved keywords

r? `@davidtwco`

2 years agoRollup merge of #93444 - camelid:rustdoc-css-cleanup, r=GuillaumeGomez,jsha
Matthias Krüger [Mon, 31 Jan 2022 05:58:33 +0000 (06:58 +0100)]
Rollup merge of #93444 - camelid:rustdoc-css-cleanup, r=GuillaumeGomez,jsha

Fix some CSS warnings and errors from VS Code

There's no such CSS rule as `box-shadow-color`, so I instead copied the
whole `box-shadow` property to each rule to make it actually apply.

r? `@jsha`

2 years agoRollup merge of #93392 - GKFX:char-docs, r=scottmcm
Matthias Krüger [Mon, 31 Jan 2022 05:58:32 +0000 (06:58 +0100)]
Rollup merge of #93392 - GKFX:char-docs, r=scottmcm

Clarify documentation on char::MAX

As mentioned in https://github.com/rust-lang/rust/issues/91836#issuecomment-994106874, the documentation on `char::MAX` is not quite correct – USVs are not "only ones within a certain range", they are code points _outside_ a certain range. I have corrected this and given the actual numbers as there is no reason to hide them.

2 years agoRollup merge of #93347 - WaffleLapkin:better_char_decode_utf16_size_hint, r=dtolnay
Matthias Krüger [Mon, 31 Jan 2022 05:58:31 +0000 (06:58 +0100)]
Rollup merge of #93347 - WaffleLapkin:better_char_decode_utf16_size_hint, r=dtolnay

Make `char::DecodeUtf16::size_hist` more precise

New implementation takes into account contents of `self.buf` and rounds lower bound up instead of down.

Fixes #88762
Revival of #88763

2 years agoRollup merge of #93214 - ibraheemdev:issue-93210, r=davidtwco
Matthias Krüger [Mon, 31 Jan 2022 05:58:30 +0000 (06:58 +0100)]
Rollup merge of #93214 - ibraheemdev:issue-93210, r=davidtwco

Respect doc(hidden) when suggesting available fields

Resolves #93210

2 years agoRollup merge of #93155 - dtolnay:blockindent, r=nagisa
Matthias Krüger [Mon, 31 Jan 2022 05:58:29 +0000 (06:58 +0100)]
Rollup merge of #93155 - dtolnay:blockindent, r=nagisa

Switch pretty printer to block-based indentation

This PR backports https://github.com/dtolnay/prettyplease/commit/401d60c04213e6c66565e0e69a95b4588db5fdba from the `prettyplease` crate into `rustc_ast_pretty`.

A before and after:

```diff
- let res =
-     ((::alloc::fmt::format as
-          for<'r> fn(Arguments<'r>) -> String {format})(((::core::fmt::Arguments::new_v1
-                                                             as
-                                                             fn(&[&'static str], &[ArgumentV1]) -> Arguments {Arguments::new_v1})((&([("test"
-                                                                                                                                          as
-                                                                                                                                          &str)]
-                                                                                                                                        as
-                                                                                                                                        [&str; 1])
-                                                                                                                                      as
-                                                                                                                                      &[&str; 1]),
-                                                                                                                                  (&([]
-                                                                                                                                        as
-                                                                                                                                        [ArgumentV1; 0])
-                                                                                                                                      as
-                                                                                                                                      &[ArgumentV1; 0]))
-                                                            as
-                                                            Arguments))
-         as String);
+ let res =
+     ((::alloc::fmt::format as
+             for<'r> fn(Arguments<'r>) -> String {format})(((::core::fmt::Arguments::new_v1
+                 as
+                 fn(&[&'static str], &[ArgumentV1]) -> Arguments {Arguments::new_v1})((&([("test"
+                             as &str)] as [&str; 1]) as
+                 &[&str; 1]),
+             (&([] as [ArgumentV1; 0]) as &[ArgumentV1; 0])) as
+             Arguments)) as String);
```

Previously the pretty printer would compute indentation always relative to whatever column a block begins at, like this:

```rust
fn demo(arg1: usize,
        arg2: usize);
```

This is never the thing to do in the dominant contemporary Rust style. Rustfmt's default and the style used by the vast majority of Rust codebases is block indentation:

```rust
fn demo(
    arg1: usize,
    arg2: usize,
);
```

where every indentation level is a multiple of 4 spaces and each level is indented relative to the indentation of the previous line, not the position that the block starts in.

By itself this PR doesn't get perfect formatting in all cases, but it is the smallest possible step in clearly the right direction. More backports from `prettyplease` to tune the ibox/cbox indent levels around various AST node types are upcoming.

2 years agoRollup merge of #93039 - terrarier2111:fix-field-help, r=nagisa
Matthias Krüger [Mon, 31 Jan 2022 05:58:28 +0000 (06:58 +0100)]
Rollup merge of #93039 - terrarier2111:fix-field-help, r=nagisa

Don't suggest inaccessible fields

Fixes: https://github.com/rust-lang/rust/issues/92999
2 years agoRollup merge of #92918 - compiler-errors:gat-expr-lifetime-elision, r=jackh726
Matthias Krüger [Mon, 31 Jan 2022 05:58:27 +0000 (06:58 +0100)]
Rollup merge of #92918 - compiler-errors:gat-expr-lifetime-elision, r=jackh726

Allow eliding GATs in expression position

Thoughts on whether this is worthwhile?

Fixes #92836

r? ``@jackh726``

2 years agoRollup merge of #90277 - pierwill:fix-70258-inference-terms, r=jackh726
Matthias Krüger [Mon, 31 Jan 2022 05:58:26 +0000 (06:58 +0100)]
Rollup merge of #90277 - pierwill:fix-70258-inference-terms, r=jackh726

Improve terminology around "after typeck"

Closes #70258.

2 years agoAuto merge of #93270 - klensy:sec-up, r=Mark-Simulacrum
bors [Mon, 31 Jan 2022 04:23:21 +0000 (04:23 +0000)]
Auto merge of #93270 - klensy:sec-up, r=Mark-Simulacrum

update vulnerable/yanked deps

tokio v1.8.2 -> v1.8.4: https://rustsec.org/advisories/RUSTSEC-2021-0124
ammonia v3.1.0 -> v3.1.3: https://rustsec.org/advisories/RUSTSEC-2022-0003
thread_local v1.0.1 -> v1.1.4: https://rustsec.org/advisories/RUSTSEC-2022-0006

pin-project-lite v0.2.4 -> v0.2.8: yanked: https://github.com/taiki-e/pin-project-lite/blob/main/CHANGELOG.md#024---2021-01-11

2 years agoRestore a visual alignment mode for block comments
David Tolnay [Fri, 21 Jan 2022 09:26:00 +0000 (01:26 -0800)]
Restore a visual alignment mode for block comments

2 years agoBless all pretty printer tests and ui tests
David Tolnay [Fri, 21 Jan 2022 09:34:06 +0000 (01:34 -0800)]
Bless all pretty printer tests and ui tests

2 years agoFix some double indents on exprs containing blocks
David Tolnay [Fri, 21 Jan 2022 05:22:40 +0000 (21:22 -0800)]
Fix some double indents on exprs containing blocks

The `print_expr` method already places an `ibox(INDENT_UNIT)` around
every expr that gets printed. Some exprs were then using `self.head`
inside of that, which does its own `cbox(INDENT_UNIT)`, resulting in two
levels of indentation:

    while true {
            stuff;
        }

This commit fixes those cases to produce the expected single level of
indentation within every expression containing a block.

    while true {
        stuff;
    }

2 years agoCompute indent never relative to current column
David Tolnay [Fri, 21 Jan 2022 09:34:19 +0000 (01:34 -0800)]
Compute indent never relative to current column

Previously the pretty printer would compute indentation always relative
to whatever column a block begins at, like this:

    fn demo(arg1: usize,
            arg2: usize);

This is never the thing to do in the dominant contemporary Rust style.
Rustfmt's default and the style used by the vast majority of Rust
codebases is block indentation:

    fn demo(
        arg1: usize,
        arg2: usize,
    );

where every indentation level is a multiple of 4 spaces and each level
is indented relative to the indentation of the previous line, not the
position that the block starts in.

2 years agokmc-solid: Inherit the calling task's base priority in `Thread::new`
Tomoaki Kawada [Fri, 28 Jan 2022 08:41:13 +0000 (17:41 +0900)]
kmc-solid: Inherit the calling task's base priority in `Thread::new`

Fixes a spawned task getting an unexpectedly higher priority if it's
spawned by a task whose priority is temporarily boosted by a priority-
protection mutex.

2 years agoAuto merge of #90891 - nbdd0121:format, r=Mark-Simulacrum
bors [Mon, 31 Jan 2022 00:04:46 +0000 (00:04 +0000)]
Auto merge of #90891 - nbdd0121:format, r=Mark-Simulacrum

Create `core::fmt::ArgumentV1` with generics instead of fn pointer

Split from (and prerequisite of) #90488, as this seems to have perf implication.

`@rustbot` label: +T-libs

2 years ago(#93392) Update char::MAX docs and core::char::MAX
George Bateman [Sun, 30 Jan 2022 19:41:52 +0000 (19:41 +0000)]
(#93392) Update char::MAX docs and core::char::MAX

2 years agoreview the total_cmp documentation
Simonas Kazlauskas [Fri, 28 Jan 2022 01:21:30 +0000 (03:21 +0200)]
review the total_cmp documentation

The documentation has been restructured to split out a brief summary
paragraph out from the following elaborating paragraphs.

I also attempted my hand at wording improvements and adding articles
where I felt them missing, but being non-native english speaker these
may need more thorough review.

2 years agoAuto merge of #92711 - zredb:issue-90187-fix, r=notriddle
bors [Sun, 30 Jan 2022 20:57:34 +0000 (20:57 +0000)]
Auto merge of #92711 - zredb:issue-90187-fix, r=notriddle

rustdoc: Remove `def_id_no_primitives`

Fixes #90187.

2 years agoMac calls
David Tolnay [Sun, 30 Jan 2022 06:16:35 +0000 (22:16 -0800)]
Mac calls

2 years agoAccommodate yield points in the format_args expansion
David Tolnay [Sat, 29 Jan 2022 20:05:19 +0000 (12:05 -0800)]
Accommodate yield points in the format_args expansion

2 years agoAdd regression test for issue 93274
David Tolnay [Sat, 29 Jan 2022 19:44:30 +0000 (11:44 -0800)]
Add regression test for issue 93274

Currently fails with:

    error: future cannot be sent between threads safely
      --> $DIR/src/test/ui/fmt/format-with-yield-point.rs:21:17
       |
    LL |     assert_send(with_await());
       |                 ^^^^^^^^^^^^ future returned by `with_await` is not `Send`
       |
       = help: the trait `Sync` is not implemented for `core::fmt::Opaque`
    note: future is not `Send` as this value is used across an await
      --> $DIR/src/test/ui/fmt/format-with-yield-point.rs:11:37
       |
    LL |     println!("{} {:?}", "", async {}.await);
       |     --------------------------------^^^^^^-
       |     |                               |
       |     |                               await occurs here, with `$crate::format_args_nl!($($arg)*)` maybe used later
       |     has type `ArgumentV1<'_>` which is not `Send`
       |     `$crate::format_args_nl!($($arg)*)` is later dropped here
    note: required by a bound in `assert_send`
      --> $DIR/src/test/ui/fmt/format-with-yield-point.rs:18:24
       |
    LL | fn assert_send(_: impl Send) {}
       |                        ^^^^ required by this bound in `assert_send`

    error: future cannot be sent between threads safely
      --> $DIR/src/test/ui/fmt/format-with-yield-point.rs:22:17
       |
    LL |     assert_send(with_macro_call());
       |                 ^^^^^^^^^^^^^^^^^ future returned by `with_macro_call` is not `Send`
       |
       = help: the trait `Sync` is not implemented for `core::fmt::Opaque`
    note: future is not `Send` as this value is used across an await
      --> $DIR/src/test/ui/fmt/format-with-yield-point.rs:6:17
       |
    LL |         async {}.await
       |                 ^^^^^^ await occurs here, with `$crate::format_args_nl!($($arg)*)` maybe used later
    ...
    LL |     println!("{} {:?}", "", m!());
       |     -----------------------------
       |     |                       |
       |     |                       in this macro invocation
       |     has type `ArgumentV1<'_>` which is not `Send`
       |     `$crate::format_args_nl!($($arg)*)` is later dropped here
    note: required by a bound in `assert_send`
      --> $DIR/src/test/ui/fmt/format-with-yield-point.rs:18:24
       |
    LL | fn assert_send(_: impl Send) {}
       |                        ^^^^ required by this bound in `assert_send`
       = note: this error originates in the macro `m` (in Nightly builds, run with -Z macro-backtrace for more info)

    error: aborting due to 2 previous errors

2 years agoAuto merge of #93482 - ehuss:rollup-qjyppci, r=ehuss
bors [Sun, 30 Jan 2022 18:12:08 +0000 (18:12 +0000)]
Auto merge of #93482 - ehuss:rollup-qjyppci, r=ehuss

Rollup of 5 pull requests

Successful merges:

 - #92887 (Bootstrap compiler update)
 - #92908 (Render more readable macro matcher tokens in rustdoc)
 - #93183 (rustdoc: mobile nav fixes)
 - #93192 (Add VS 2022 into error message)
 - #93475 (Add test to ensure that theme is applied correctly when going back in history)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup

2 years agocore: Remove some redundant {}s from the sorting code
est31 [Sun, 30 Jan 2022 17:32:24 +0000 (18:32 +0100)]
core: Remove some redundant {}s from the sorting code

2 years agoRollup merge of #93475 - GuillaumeGomez:theme-in-history, r=jsha
Eric Huss [Sun, 30 Jan 2022 16:37:51 +0000 (08:37 -0800)]
Rollup merge of #93475 - GuillaumeGomez:theme-in-history, r=jsha

Add test to ensure that theme is applied correctly when going back in history

Fixes #93258.

r? `@jsha`

2 years agoRollup merge of #93192 - theidexisted:patch-1, r=wesleywiser
Eric Huss [Sun, 30 Jan 2022 16:37:50 +0000 (08:37 -0800)]
Rollup merge of #93192 - theidexisted:patch-1, r=wesleywiser

Add VS 2022 into error message

2 years agoRollup merge of #93183 - jsha:mobile-nav-fixes, r=GuillaumeGomez
Eric Huss [Sun, 30 Jan 2022 16:37:49 +0000 (08:37 -0800)]
Rollup merge of #93183 - jsha:mobile-nav-fixes, r=GuillaumeGomez

rustdoc: mobile nav fixes

- Make sure the mobile-topbar doesn't overflow its height if the user sets a bigger font.

- Make sure the sidebar can be scrolled all the way to the bottom by shortening it to accommodate the mobile-topbar.

- Make the item name in the mobile-topbar clickable to go to the top of the page.

- Remove excess padding sidebar in mobile mode.

Demo https://rustdoc.crud.net/jsha/mobile-nav-fixes/std/string/struct.String.html

r? `@GuillaumeGomez`

2 years agoRollup merge of #92908 - dtolnay:rustdoc, r=GuillaumeGomez
Eric Huss [Sun, 30 Jan 2022 16:37:47 +0000 (08:37 -0800)]
Rollup merge of #92908 - dtolnay:rustdoc, r=GuillaumeGomez

Render more readable macro matcher tokens in rustdoc

Follow-up to #92334.

This PR lifts some of the token rendering logic from https://github.com/dtolnay/prettyplease into rustdoc so that even the matchers for which a source code snippet is not available (because they are macro-generated, or any other reason) follow some baseline good assumptions about where the tokens in the macro matcher are appropriate to space.

The below screenshots show an example of the difference using one of the gnarliest macros I could find. Some things to notice:

- In the **before**, notice how a couple places break in between `$(....)`↵`*`, which is just about the worst possible place that it could break.

- In the **before**, the lines that wrapped are weirdly indented by 1 space of indentation relative to column 0. In the **after**, we use the typical way of block indenting in Rust syntax which is put the open/close delimiters on their own line and indent their contents by 4 spaces relative to the previous line (so 8 spaces relative to column 0, because the matcher itself is indented by 4 relative to the `macro_rules` header).

- In the **after**, macro_rules metavariables like `$tokens:tt` are kept together, which is how just about everybody writing Rust today writes them.

## Before

![Screenshot from 2022-01-14 13-05-53](https://user-images.githubusercontent.com/1940490/149585105-1f182b78-751f-421f-a234-9dbc04fa3bbd.png)

## After

![Screenshot from 2022-01-14 13-06-04](https://user-images.githubusercontent.com/1940490/149585118-d4b52ea7-3e67-4b6e-a12b-31dfb8172f86.png)

r? `@camelid`

2 years agoRollup merge of #92887 - pietroalbini:pa-bootstrap-update, r=Mark-Simulacrum
Eric Huss [Sun, 30 Jan 2022 16:37:46 +0000 (08:37 -0800)]
Rollup merge of #92887 - pietroalbini:pa-bootstrap-update, r=Mark-Simulacrum

Bootstrap compiler update

r? ``@Mark-Simulacrum``

2 years agoRemove deprecated and unstable slice_partition_at_index functions
est31 [Sun, 30 Jan 2022 15:19:03 +0000 (16:19 +0100)]
Remove deprecated and unstable slice_partition_at_index functions

They have been deprecated since commit 01ac5a97c90c26ac35ca9d65f685dd6701edfa3b
which was part of the 1.49.0 release, so from the point of nightly,
11 releases ago.

2 years agoFix an edge case in `chat::DecodeUtf16::size_hint`
Maybe Waffle [Sun, 30 Jan 2022 12:32:21 +0000 (15:32 +0300)]
Fix an edge case in `chat::DecodeUtf16::size_hint`

There are cases, when data in the buf might or might not be an error.

2 years agoAdd test to ensure that theme is applied correctly when going back in history
Guillaume Gomez [Sun, 30 Jan 2022 10:39:10 +0000 (11:39 +0100)]
Add test to ensure that theme is applied correctly when going back in history

2 years agoAuto merge of #93468 - matthiaskrgr:rollup-vxullvd, r=matthiaskrgr
bors [Sun, 30 Jan 2022 10:30:42 +0000 (10:30 +0000)]
Auto merge of #93468 - matthiaskrgr:rollup-vxullvd, r=matthiaskrgr

Rollup of 8 pull requests

Successful merges:

 - #93256 (Make `join!` description more accurate)
 - #93358 (Add note suggesting that predicate may be satisfied, but is not `const`)
 - #93362 (Do not register infer var for GAT projection in RPIT)
 - #93391 (rustdoc: remove tooltip from source link)
 - #93414 (Move unstable is_{arch}_feature_detected! macros to std::arch)
 - #93441 (rustdoc: load the set of in-scope traits for modules with no docstring)
 - #93459 (fs: Don't copy d_name from struct dirent)
 - #93463 (Rename _args -> args in format_args expansion)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup

2 years agorustdoc: small fixes to mobile navigation
Jacob Hoffman-Andrews [Sat, 22 Jan 2022 01:44:54 +0000 (17:44 -0800)]
rustdoc: small fixes to mobile navigation

- Make sure the mobile-topbar doesn't overflow its height if the user
  sets a bigger font.

- Make sure the sidebar can be scrolled all the way to the bottom by
  shortening it to accommodate the mobile-topbar.

- Make the item name in the mobile-topbar clickable to go to the top of
  the page.

- Remove excess padding sidebar in mobile mode.

2 years agounix: Use metadata for `DirEntry::file_type` fallback
Josh Stone [Sun, 30 Jan 2022 00:58:18 +0000 (16:58 -0800)]
unix: Use metadata for `DirEntry::file_type` fallback

When `DirEntry::file_type` fails to match a known `d_type`, we should
fall back to `DirEntry::metadata` instead of a bare `lstat`, because
this is faster and more reliable on targets with `fstatat`.

2 years agoRollup merge of #93463 - dtolnay:_args, r=cjgillot
Matthias Krüger [Sat, 29 Jan 2022 23:04:17 +0000 (00:04 +0100)]
Rollup merge of #93463 - dtolnay:_args, r=cjgillot

Rename _args -> args in format_args expansion

As observed in https://github.com/rust-lang/rust/pull/91359#discussion_r786058960, prior to that PR this variable was sometimes never used, such as in the case of:

```rust
println!("");

// used to expand to:
::std::io::_print(
    ::core::fmt::Arguments::new_v1(
        &["\n"],
        &match () {
            _args => [],
        },
    ),
);
```

so the leading underscore in `_args` was used to suppress an unused variable lint. However after #91359 the variable is always used when present, as the unused case would instead expand to:

```rust
::std::io::_print(::core::fmt::Arguments::new_v1(&["\n"], &[]));
```

2 years agoRollup merge of #93459 - tavianator:dirent-copy-only-reclen, r=cuviper
Matthias Krüger [Sat, 29 Jan 2022 23:04:16 +0000 (00:04 +0100)]
Rollup merge of #93459 - tavianator:dirent-copy-only-reclen, r=cuviper

fs: Don't copy d_name from struct dirent

The dirent returned from readdir() is only guaranteed to be valid for
d_reclen bytes on common platforms.  Since we copy the name separately
anyway, we can copy everything except d_name into DirEntry::entry.

Fixes #93384.

2 years agoRollup merge of #93441 - notriddle:notriddle/collect-crate-doc-links-very-early,...
Matthias Krüger [Sat, 29 Jan 2022 23:04:15 +0000 (00:04 +0100)]
Rollup merge of #93441 - notriddle:notriddle/collect-crate-doc-links-very-early, r=petrochenkov

rustdoc: load the set of in-scope traits for modules with no docstring

Fixes #93428

This fix is a response to a couple of special cases related to the `module_id`, which is eventually used for trait candidates:

  * The module id is always set to the current crate, when checking `crate::`.

    Normally, the set of in-scope traits would be set in `load_links_in_attrs`, but if there are no doc comments, then that loop will never run.

  * the module id is set to the parent module, when resolving a module that is spelled like this:

        // Notice how we use an outlined doc comment here!
        // [`Test::my_fn`]
        mod something {
        }

    As with the above problem with `crate::`, we need to make sure the module gets its traits in scope resolved, even if it has no doc comments of its own.

2 years agoRollup merge of #93414 - Amanieu:std_arch_detect, r=m-ou-se
Matthias Krüger [Sat, 29 Jan 2022 23:04:14 +0000 (00:04 +0100)]
Rollup merge of #93414 - Amanieu:std_arch_detect, r=m-ou-se

Move unstable is_{arch}_feature_detected! macros to std::arch

These macros are unstable, except for `is_x86_feature_detected` which is still exported from the crate root for backwards-compatibility.

This should unblock the stabilization of `is_aarch64_feature_detected`.

r? ```@m-ou-se```

2 years agoRollup merge of #93391 - notriddle:notriddle/remove-srclink-tooltip, r=jsha,Guillaume...
Matthias Krüger [Sat, 29 Jan 2022 23:04:13 +0000 (00:04 +0100)]
Rollup merge of #93391 - notriddle:notriddle/remove-srclink-tooltip, r=jsha,GuillaumeGomez

rustdoc: remove tooltip from source link

This made more sense back when it was abbreviated, but now it seems redundant.

2 years agoRollup merge of #93362 - compiler-errors:ice-gat-in-rpit, r=oli-obk
Matthias Krüger [Sat, 29 Jan 2022 23:04:12 +0000 (00:04 +0100)]
Rollup merge of #93362 - compiler-errors:ice-gat-in-rpit, r=oli-obk

Do not register infer var for GAT projection in RPIT

Fixes #93340
Fixes #91603

r? ```@oli-obk```

2 years agoRollup merge of #93358 - compiler-errors:is-not-const, r=fee1-dead
Matthias Krüger [Sat, 29 Jan 2022 23:04:11 +0000 (00:04 +0100)]
Rollup merge of #93358 - compiler-errors:is-not-const, r=fee1-dead

Add note suggesting that predicate may be satisfied, but is not `const`

Not sure if we should be printing this in addition to, or perhaps _instead_ of the help message:
```
help: the trait `~const Add` is not implemented for `NonConstAdd`
```

Also added `ParamEnv::is_const` and `PolyTraitPredicate::is_const_if_const` and, in a separate commit, used those in other places instead of `== hir::Constness::Const`, etc.

r? ````@fee1-dead````

2 years agoRollup merge of #93256 - EFanZh:patch-1, r=joshtriplett
Matthias Krüger [Sat, 29 Jan 2022 23:04:10 +0000 (00:04 +0100)]
Rollup merge of #93256 - EFanZh:patch-1, r=joshtriplett

Make `join!` description more accurate

2 years agofs: Add a regression test for #93384
Tavian Barnes [Sat, 29 Jan 2022 17:18:27 +0000 (12:18 -0500)]
fs: Add a regression test for #93384

2 years agofs: Don't copy d_name from struct dirent
Tavian Barnes [Sat, 29 Jan 2022 16:23:28 +0000 (11:23 -0500)]
fs: Don't copy d_name from struct dirent

The dirent returned from readdir() is only guaranteed to be valid for
d_reclen bytes on common platforms.  Since we copy the name separately
anyway, we can copy everything except d_name into DirEntry::entry.

Fixes #93384.

2 years agoFix some CSS warnings and errors from VS Code
Noah Lev [Fri, 7 Jan 2022 22:50:43 +0000 (14:50 -0800)]
Fix some CSS warnings and errors from VS Code

There's no such CSS rule as `box-shadow-color`, so I instead copied the
whole `box-shadow` property to each rule to make it actually apply.

2 years agoRename _args -> args in format_args expansion
David Tolnay [Sat, 29 Jan 2022 20:44:41 +0000 (12:44 -0800)]
Rename _args -> args in format_args expansion

2 years agoDocument `SystemTime` platform precision
Chris Denton [Sat, 29 Jan 2022 20:41:18 +0000 (20:41 +0000)]
Document `SystemTime` platform precision

2 years agoAuto merge of #93457 - matthiaskrgr:rollup-e43ry1l, r=matthiaskrgr
bors [Sat, 29 Jan 2022 16:08:35 +0000 (16:08 +0000)]
Auto merge of #93457 - matthiaskrgr:rollup-e43ry1l, r=matthiaskrgr

Rollup of 8 pull requests

Successful merges:

 - #88205 (Add Explanation For Error E0772)
 - #92274 (Add `intrinsics::const_deallocate`)
 - #93236 (Make `NonNull::new` `const`)
 - #93299 (Fix dot separator when there is no source link)
 - #93410 (kmc-solid: Implement `net::FileDesc::duplicate`)
 - #93424 (fix nit)
 - #93431 (remove unused `jemallocator` crate)
 - #93453 (Add GUI theme change test)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup

2 years agoChange index_refutable_slice to use FxIndexMap
Gary Guo [Sat, 8 Jan 2022 01:56:13 +0000 (01:56 +0000)]
Change index_refutable_slice to use FxIndexMap

This will prevent unstable order when HirIds are pertubated.

2 years agoCreate `core::fmt::ArgumentV1` with generics instead of fn pointer
Gary Guo [Sun, 17 Oct 2021 23:41:57 +0000 (00:41 +0100)]
Create `core::fmt::ArgumentV1` with generics instead of fn pointer

2 years agoRollup merge of #93453 - GuillaumeGomez:theme-change-test, r=jsha
Matthias Krüger [Sat, 29 Jan 2022 13:46:35 +0000 (14:46 +0100)]
Rollup merge of #93453 - GuillaumeGomez:theme-change-test, r=jsha

Add GUI theme change test

r? `@jsha`

2 years agoRollup merge of #93431 - lqd:remove-jemallocator, r=Mark-Simulacrum
Matthias Krüger [Sat, 29 Jan 2022 13:46:34 +0000 (14:46 +0100)]
Rollup merge of #93431 - lqd:remove-jemallocator, r=Mark-Simulacrum

remove unused `jemallocator` crate

When it was noticed that the rustc binary wasn't actually using jemalloc via `#[global_allocator]` and that was removed, the dependency remained.

Tests pass locally with a `jemalloc = true` build, but I'll trigger a try build to ensure I haven't missed an edge-case somewhere.

r? ```@ghost``` until that completes

2 years agoRollup merge of #93424 - lcnr:nit, r=spastorino
Matthias Krüger [Sat, 29 Jan 2022 13:46:33 +0000 (14:46 +0100)]
Rollup merge of #93424 - lcnr:nit, r=spastorino

fix nit

2 years agoRollup merge of #93410 - solid-rs:feat-kmc-solid-net-dup, r=dtolnay
Matthias Krüger [Sat, 29 Jan 2022 13:46:32 +0000 (14:46 +0100)]
Rollup merge of #93410 - solid-rs:feat-kmc-solid-net-dup, r=dtolnay

kmc-solid: Implement `net::FileDesc::duplicate`

This PR implements `std::sys::solid::net::FileDesc::duplicate`, which was accidentally left out when this target was added by #86191.

2 years agoRollup merge of #93299 - GuillaumeGomez:dot-separator-no-source, r=jsha
Matthias Krüger [Sat, 29 Jan 2022 13:46:32 +0000 (14:46 +0100)]
Rollup merge of #93299 - GuillaumeGomez:dot-separator-no-source, r=jsha

Fix dot separator when there is no source link

Fixes #92973.

We did well adding this test since there was a bug:

![Screenshot from 2022-01-25 17-05-48](https://user-images.githubusercontent.com/3050060/151016535-39b45f52-e1e0-4963-ad19-532e24ec4c9b.png)

r? `@jsha`

2 years agoRollup merge of #93236 - woppopo:const_nonnull_new, r=oli-obk
Matthias Krüger [Sat, 29 Jan 2022 13:46:31 +0000 (14:46 +0100)]
Rollup merge of #93236 - woppopo:const_nonnull_new, r=oli-obk

Make `NonNull::new` `const`

Tracking issue: #93235

2 years agoRollup merge of #92274 - woppopo:const_deallocate, r=oli-obk
Matthias Krüger [Sat, 29 Jan 2022 13:46:30 +0000 (14:46 +0100)]
Rollup merge of #92274 - woppopo:const_deallocate, r=oli-obk

Add `intrinsics::const_deallocate`

Tracking issue: #79597
Related: #91884

This allows deallocation of a memory allocated by `intrinsics::const_allocate`. At the moment, this can be only used to reduce memory usage, but in the future this may be useful to detect memory leaks (If an allocated memory remains after evaluation, raise an error...?).

2 years agoRollup merge of #88205 - danii:e0772, r=GuillaumeGomez
Matthias Krüger [Sat, 29 Jan 2022 13:46:29 +0000 (14:46 +0100)]
Rollup merge of #88205 - danii:e0772, r=GuillaumeGomez

Add Explanation For Error E0772

I've added an error explanation for the error code E0772.

Assists with #61137

2 years agoAuto merge of #92312 - BGR360:needs-test, r=Mark-Simulacrum
bors [Sat, 29 Jan 2022 13:04:51 +0000 (13:04 +0000)]
Auto merge of #92312 - BGR360:needs-test, r=Mark-Simulacrum

Add tests for three old ICEs

Closes #84044
Closes #91594
Closes #89066

2 years agoMake local_def_id_to_hir_id query directly returh HirId
Santiago Pastorino [Sat, 29 Jan 2022 11:40:23 +0000 (08:40 -0300)]
Make local_def_id_to_hir_id query directly returh HirId

2 years agoDocument about some behaviors of `const_(de)allocate` and add some tests.
woppopo [Sat, 29 Jan 2022 10:13:23 +0000 (19:13 +0900)]
Document about some behaviors of `const_(de)allocate` and add some tests.

2 years agoExtend theme change GUI test
Guillaume Gomez [Sat, 29 Jan 2022 09:44:27 +0000 (10:44 +0100)]
Extend theme change GUI test

2 years agoUpdate browser-ui-test version to 0.5.8
Guillaume Gomez [Sat, 29 Jan 2022 09:44:18 +0000 (10:44 +0100)]
Update browser-ui-test version to 0.5.8

2 years agoAuto merge of #93351 - anp:fuchsia-remove-dir-all, r=tmandry
bors [Sat, 29 Jan 2022 09:01:01 +0000 (09:01 +0000)]
Auto merge of #93351 - anp:fuchsia-remove-dir-all, r=tmandry

Bump libc and fix remove_dir_all on Fuchsia after CVE fix

With the previous `is_dir` impl, we would attempt to unlink
a directory in the None branch, but Fuchsia supports returning
ENOTEMPTY from unlinkat() without the AT_REMOVEDIR flag because
we don't currently differentiate unlinking files and directories
by default.

On the Fuchsia side I've opened https://fxbug.dev/92273 to discuss
whether this is the correct behavior, but it doesn't seem like
addressing the error code is necessary to make our tests happy.

Depends on https://github.com/rust-lang/libc/pull/2654 since we
apparently haven't needed to reference DT_UNKNOWN before this.

2 years agoAuto merge of #93434 - Mark-Simulacrum:apple-various, r=pietroalbini
bors [Sat, 29 Jan 2022 02:20:00 +0000 (02:20 +0000)]
Auto merge of #93434 - Mark-Simulacrum:apple-various, r=pietroalbini

Move tier-2 (without host tools) apple targets to separate builder

One-off (likely fairly unreliable, but give some idea) measurements:

* dist-apple-various (new):  2h10m
* dist-x86_64-apple: 2h55m -> 2h36m (cutting roughly 20 minutes)

2 years agoAdd test for old ICE in #89066
Ben Reeves [Mon, 27 Dec 2021 06:24:19 +0000 (00:24 -0600)]
Add test for old ICE in #89066

2 years agoAdd test for old ICE in #91594
Ben Reeves [Mon, 27 Dec 2021 06:09:19 +0000 (00:09 -0600)]
Add test for old ICE in #91594

2 years agoAdd test for old ICE
Ben Reeves [Mon, 27 Dec 2021 05:30:46 +0000 (23:30 -0600)]
Add test for old ICE

The ICE from #84044 no longer occurs.

2 years agoAuto merge of #93427 - matthiaskrgr:rollup-esd3ixl, r=matthiaskrgr
bors [Fri, 28 Jan 2022 23:20:38 +0000 (23:20 +0000)]
Auto merge of #93427 - matthiaskrgr:rollup-esd3ixl, r=matthiaskrgr

Rollup of 10 pull requests

Successful merges:

 - #92611 (Add links to the reference and rust by example for asm! docs and lints)
 - #93158 (wasi: implement `sock_accept` and enable networking)
 - #93239 (Add os::unix::net::SocketAddr::from_path)
 - #93261 (Some unwinding related cg_ssa cleanups)
 - #93295 (Avoid double panics when using `TempDir` in tests)
 - #93353 (Unimpl {Add,Sub,Mul,Div,Rem,BitXor,BitOr,BitAnd}<$t> for Saturating<$t>)
 - #93356 (Edit docs introduction for `std::cmp::PartialOrd`)
 - #93375 (fix typo `documenation`)
 - #93399 (rustbuild: Fix compiletest warning when building outside of root.)
 - #93404 (Fix a typo from #92899)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup

2 years agoFix remove_dir_all on Fuchsia after CVE fix.
Adam Perry [Wed, 26 Jan 2022 22:32:21 +0000 (22:32 +0000)]
Fix remove_dir_all on Fuchsia after CVE fix.

With the previous `is_dir` impl, we would attempt to unlink
a directory in the None branch, but Fuchsia supports returning
ENOTEMPTY from unlinkat() without the AT_REMOVEDIR flag because
we don't currently differentiate unlinking files and directories
by default.

On the Fuchsia side I've opened https://fxbug.dev/92273 to discuss
whether this is the correct behavior, but it doesn't seem like
addressing the error code is necessary to make our tests happy.

Updates std's libc crate to include DT_UNKNOWN for Fuchsia.

2 years agoAuto merge of #93426 - pnkfelix:issue-91671-backport-llvm-fix, r=nikic
bors [Fri, 28 Jan 2022 20:11:52 +0000 (20:11 +0000)]
Auto merge of #93426 - pnkfelix:issue-91671-backport-llvm-fix, r=nikic

backport llvm fix for issue 91671.

fix #91671

2 years agorustdoc: load the set of in-scope traits for modules with no docstring
Michael Howell [Fri, 28 Jan 2022 19:12:17 +0000 (12:12 -0700)]
rustdoc: load the set of in-scope traits for modules with no docstring

Fixes #93428

This fix is a response to a couple of special cases related to the
`module_id`, which is eventually used for trait candidates:

  * The module id is always set to the current crate, when checking `crate::`.

    Normally, the set of in-scope traits would be set in `load_links_in_attrs`,
    but if there are no doc comments, then that loop will never run.

  * the module id is set to the parent module, when resolving a module
    that is spelled like this:

        // Notice how we use an outlined doc comment here!
        // [`Test::my_fn`]
        mod something {
        }

    As with the above problem with `crate::`, we need to make sure the
    module gets its traits in scope resolved, even if it has no doc comments
    of its own.

2 years agoMake local_def_id_to_hir_id return MaybeOwner<()>
Santiago Pastorino [Fri, 28 Jan 2022 18:13:01 +0000 (15:13 -0300)]
Make local_def_id_to_hir_id return MaybeOwner<()>

2 years agoSeparate hir_owner query into two queries to avoid using extensive data on incr comp...
Santiago Pastorino [Fri, 28 Jan 2022 17:58:27 +0000 (14:58 -0300)]
Separate hir_owner query into two queries to avoid using extensive data on incr comp most of the time

2 years agoMove target-only apple targets to separate builder
Mark Rousskov [Fri, 28 Jan 2022 17:26:36 +0000 (12:26 -0500)]
Move target-only apple targets to separate builder

2 years agoAdd Explanation For Error E0772
Daniel Conley [Fri, 28 Jan 2022 16:00:56 +0000 (11:00 -0500)]
Add Explanation For Error E0772

2 years agoremove unused `jemallocator` crate
Rémy Rakic [Fri, 28 Jan 2022 15:56:05 +0000 (16:56 +0100)]
remove unused `jemallocator` crate

2 years agobackport llvm fix for issue 91671.
Felix S. Klock II [Fri, 28 Jan 2022 14:22:16 +0000 (09:22 -0500)]
backport llvm fix for issue 91671.

2 years agoRollup merge of #93404 - rust-lang:scottmcm-patch-1, r=wesleywiser
Matthias Krüger [Fri, 28 Jan 2022 14:20:30 +0000 (15:20 +0100)]
Rollup merge of #93404 - rust-lang:scottmcm-patch-1, r=wesleywiser

Fix a typo from #92899

Just happened to notice this in passing

2 years agoRollup merge of #93399 - ehuss:fix-compiletest-path-relative, r=Mark-Simulacrum
Matthias Krüger [Fri, 28 Jan 2022 14:20:29 +0000 (15:20 +0100)]
Rollup merge of #93399 - ehuss:fix-compiletest-path-relative, r=Mark-Simulacrum

rustbuild: Fix compiletest warning when building outside of root.

This fixes a warning that would happen when passing arguments to compiletest (like `x.py test src/test/ui`) when running `x.py` outside of the root source directory. For example, the CI builders do this, which causes a confusing warning message. This also fixes it so that passing a full path works (like `x.py test src/test/ui/hello.rs`) in the same scenario (previously it would just ignore the `hello.rs` part).

2 years agoRollup merge of #93375 - Kvicii:ISSUE_93374, r=notriddle
Matthias Krüger [Fri, 28 Jan 2022 14:20:28 +0000 (15:20 +0100)]
Rollup merge of #93375 - Kvicii:ISSUE_93374, r=notriddle

fix typo `documenation`

2 years agoRollup merge of #93356 - pierwill:partialord-headline, r=dtolnay
Matthias Krüger [Fri, 28 Jan 2022 14:20:27 +0000 (15:20 +0100)]
Rollup merge of #93356 - pierwill:partialord-headline, r=dtolnay

Edit docs introduction for `std::cmp::PartialOrd`

This makes `PartialOrd` consistent with the other three traits in this module, which all include links to their corresponding mathematical concepts on Wikipedia.

<img width="500" alt="Screen Shot 2022-01-26 at 10 24 23 PM" src="https://user-images.githubusercontent.com/19642016/151291720-decd85ed-cd6e-4be0-84a9-619b98ceb386.png">

2 years agoRollup merge of #93353 - kellerkindt:saturating_int_assign_impl, r=joshtriplett
Matthias Krüger [Fri, 28 Jan 2022 14:20:26 +0000 (15:20 +0100)]
Rollup merge of #93353 - kellerkindt:saturating_int_assign_impl, r=joshtriplett

Unimpl {Add,Sub,Mul,Div,Rem,BitXor,BitOr,BitAnd}<$t> for Saturating<$t>

Tracking issue #92354

Analog to 9648b313cc8896970a12f45b3bb5c0593c3d510f #93208 reduce `saturating_int_assign_impl` (#93208) to:

```rust
let mut value = Saturating(2u8);
value += 3u8;
value -= 1u8;
value *= 2u8;
value /= 2u8;
value %= 2u8;
value ^= 255u8;
value |= 123u8;
value &= 2u8;
```

See https://github.com/rust-lang/rust/pull/93208#issuecomment-1022564429

2 years agoRollup merge of #93295 - ChrisDenton:tempdir-double-panic, r=dtolnay
Matthias Krüger [Fri, 28 Jan 2022 14:20:25 +0000 (15:20 +0100)]
Rollup merge of #93295 - ChrisDenton:tempdir-double-panic, r=dtolnay

Avoid double panics when using `TempDir` in tests

`TempDir` could panic on drop if `remove_dir_all` returns an error. If this happens while already panicking, the test process would abort and therefore not show the test results.

This PR tries to avoid such double panics.

2 years agoRollup merge of #93261 - bjorn3:cg_ssa_refactor6, r=cjgillot
Matthias Krüger [Fri, 28 Jan 2022 14:20:24 +0000 (15:20 +0100)]
Rollup merge of #93261 - bjorn3:cg_ssa_refactor6, r=cjgillot

Some unwinding related cg_ssa cleanups

These should make it a bit easier for alternative codegen backends to implement unwinding.

2 years agoRollup merge of #93239 - Thomasdezeeuw:socketaddr_creation, r=m-ou-se
Matthias Krüger [Fri, 28 Jan 2022 14:20:23 +0000 (15:20 +0100)]
Rollup merge of #93239 - Thomasdezeeuw:socketaddr_creation, r=m-ou-se

Add os::unix::net::SocketAddr::from_path

Creates a new SocketAddr from a path, supports both regular paths and
abstract namespaces.

Note that `SocketAddr::from_abstract_namespace` could be removed after this as `SocketAddr::unix` also supports abstract namespaces.

Updates #65275
Unblocks https://github.com/tokio-rs/mio/issues/1527

r? `@m-ou-se`

2 years agoRollup merge of #93158 - haraldh:wasi_sock_accept, r=dtolnay
Matthias Krüger [Fri, 28 Jan 2022 14:20:22 +0000 (15:20 +0100)]
Rollup merge of #93158 - haraldh:wasi_sock_accept, r=dtolnay

wasi: implement `sock_accept` and enable networking

With the addition of `sock_accept()` to snapshot1, simple networking via a passed `TcpListener` is possible. This PR implements the basics to make a simple server work.

See also:
* [wasmtime tracking issue](https://github.com/bytecodealliance/wasmtime/issues/3730)
* [wasmtime PR](https://github.com/bytecodealliance/wasmtime/pull/3711)

TODO:
* [ ] Discussion of `SocketAddr` return value for `::accept()`

```rust
        Ok((
            TcpStream::from_inner(unsafe { Socket::from_raw_fd(fd as _) }),
            // WASI has no concept of SocketAddr yet
            // return an unspecified IPv4Addr
            SocketAddr::new(Ipv4Addr::UNSPECIFIED.into(), 0),
        ))
```

2 years agoRollup merge of #92611 - Amanieu:asm-reference, r=m-ou-se
Matthias Krüger [Fri, 28 Jan 2022 14:20:21 +0000 (15:20 +0100)]
Rollup merge of #92611 - Amanieu:asm-reference, r=m-ou-se

Add links to the reference and rust by example for asm! docs and lints

These were previously removed in #91728 due to broken links.

cc ``@ehuss`` since this updates the rust-by-example submodule