Commit Graph

161960 Commits

Author SHA1 Message Date
Matthias Krüger
ada77e94ab
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.
2022-01-28 15:20:24 +01:00
Matthias Krüger
18c8d0da64
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`
2022-01-28 15:20:23 +01:00
Matthias Krüger
9f15c4d08b
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),
        ))
```
2022-01-28 15:20:22 +01:00
Matthias Krüger
db6ca25325
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
2022-01-28 15:20:21 +01:00
Thomas de Zeeuw
35f578fc78 Update tracking issue for unix_socket_creation 2022-01-28 15:00:17 +01:00
Harald Hoyer
d2a13693c2 wasi: enable TcpListener and TcpStream
With the addition of `sock_accept()` to snapshot1, simple networking via
a passed `TcpListener` is possible. This patch implements the basics to
make a simple server work.

Signed-off-by: Harald Hoyer <harald@profian.com>
2022-01-28 13:27:30 +01:00
Harald Hoyer
00cbc8d0c8 wasi: update to wasi 0.11.0
To make use of `sock_accept()`, update the wasi crate to `0.11.0`.

Signed-off-by: Harald Hoyer <harald@profian.com>
2022-01-28 13:27:29 +01:00
bors
e0e70c0c2c Auto merge of #90677 - bobrippling:suggest-tuple-parens, r=camelid
Suggest tuple-parentheses for enum variants

This follows on from #86493 / #86481, making the parentheses suggestion. To summarise, given the following code:

```rust
fn f() -> Option<(i32, i8)> {
    Some(1, 2)
}
```

The current output is:

```
error[E0061]: this enum variant takes 1 argument but 2 arguments were supplied
 --> b.rs:2:5
  |
2 |     Some(1, 2)
  |     ^^^^ -  - supplied 2 arguments
  |     |
  |     expected 1 argument

error: aborting due to previous error

For more information about this error, try `rustc --explain E0061`.
```

With this change, `rustc` will now suggest parentheses when:
- The callee is expecting a single tuple argument
- The number of arguments passed matches the element count in the above tuple
- The arguments' types match the tuple's fields

```
error[E0061]: this enum variant takes 1 argument but 2 arguments were supplied
 --> b.rs:2:5
  |
2 |     Some(1, 2)
  |     ^^^^ -  - supplied 2 arguments
  |
help: use parentheses to construct a tuple
  |
2 |     Some((1, 2))
  |          +    +
```
2022-01-28 09:46:22 +00:00
bors
312a7995e7 Auto merge of #93343 - lqd:attrs, r=spastorino
Only traverse attrs once while checking for coherence override attributes

In coherence, while checking for negative impls override attributes: only traverse the `DefId`s' attributes once.

This PR is an easy way to get back some of the small perf loss in #93175
2022-01-28 06:28:08 +00:00
bors
5ab502c6d3 Auto merge of #93376 - flip1995:clippyup, r=Manishearth
Update Clippy

r? `@Manishearth`
2022-01-28 01:33:00 +00:00
bors
1b4109306c Auto merge of #93390 - matthiaskrgr:rollup-4xeki5w, r=matthiaskrgr
Rollup of 8 pull requests

Successful merges:

 - #91641 (Define c_char using cfg_if rather than repeating 40-line cfg)
 - #92899 (Mention std::iter::zip in Iterator::zip docs)
 - #93193 (Add test for stable hash uniqueness of adjacent field values)
 - #93325 (Introduce a limit to Levenshtein distance computation)
 - #93339 (rustdoc: add test case for multiple traits and erased names)
 - #93357 (Clarify the `usage-of-qualified-ty` error message.)
 - #93363 (`#[rustc_pass_by_value]` cleanup)
 - #93365 (More arena cleanups)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2022-01-27 22:34:34 +00:00
Matthias Krüger
0eb6753fc5
Rollup merge of #93365 - nnethercote:more-arena-cleanups, r=oli-obk
More arena cleanups

A sequel to #90990.

r? `@oli-obk`
2022-01-27 22:32:30 +01:00
Matthias Krüger
8347f7851a
Rollup merge of #93363 - lcnr:pass-by-value, r=petrochenkov
`#[rustc_pass_by_value]` cleanup
2022-01-27 22:32:29 +01:00
Matthias Krüger
5d79874e79
Rollup merge of #93357 - nnethercote:clarify-usage-of-qualified-ty, r=lcnr
Clarify the `usage-of-qualified-ty` error message.

I found this message confusing when I encountered it. This commit makes
it clearer that you have to import the unqualified type yourself.

r? `@lcnr`
2022-01-27 22:32:28 +01:00
Matthias Krüger
b232c46069
Rollup merge of #93339 - notriddle:notriddle/test-generics-multi-trait, r=GuillaumeGomez
rustdoc: add test case for multiple traits and erased names

https://github.com/rust-lang/rust/pull/92339#discussion_r792805289
2022-01-27 22:32:27 +01:00
Matthias Krüger
6caa533dc7
Rollup merge of #93325 - tmiasko:lev, r=davidtwco
Introduce a limit to Levenshtein distance computation

Incorporate distance limit from `find_best_match_for_name` directly into
Levenshtein distance computation.

Use the string size difference as a lower bound on the distance and exit
early when it exceeds the specified limit.

After finding a candidate within a limit, lower the limit further to
restrict the search space.
2022-01-27 22:32:26 +01:00
Matthias Krüger
bc26f97394
Rollup merge of #93193 - Kobzol:stable-hash-permutation-test, r=the8472
Add test for stable hash uniqueness of adjacent field values

This PR adds a simple test to check that stable hash will produce a different hash if the order of two values that have the same combined bit pattern changes.

r? `@the8472`
2022-01-27 22:32:24 +01:00
Matthias Krüger
54f357836e
Rollup merge of #92899 - cameron1024:zip-docs, r=dtolnay
Mention std::iter::zip in Iterator::zip docs

Closes https://github.com/rust-lang/rust/issues/91960

I'm not sure about the wording. I think it's alright, but happy to change.
2022-01-27 22:32:23 +01:00
Matthias Krüger
4af3930f28
Rollup merge of #91641 - dtolnay:cchar-if, r=Mark-Simulacrum
Define c_char using cfg_if rather than repeating 40-line cfg

Libstd has a 40-line cfg that defines the targets on which `c_char` is unsigned, and then repeats the same cfg with `not(…)` for the targets on which `c_char` is signed.

This PR replaces it with a `cfg_if!` in which an `else` takes care of the signed case.

I confirmed that `x.py doc library/std` inlines the type alias because c_char_definition is not a publicly accessible path:

![Screenshot from 2021-12-07 13-42-07](https://user-images.githubusercontent.com/1940490/145110596-f1058406-9f32-44ff-9a81-1dfd19b4a24f.png)
2022-01-27 22:32:23 +01:00
David Tolnay
857ea1e7eb
Touch up PR 92899 Iterator::zip docs 2022-01-27 12:41:03 -08:00
Nicholas Nethercote
6035487715 Clarify ArenaAllocatable's second parameter.
It's simply a binary thing to allow different behaviour for `Copy` vs
`!Copy` types. The new code makes this much clearer; I was scratching my
head over the old code for some time.
2022-01-28 07:37:10 +11:00
Nicholas Nethercote
9065c7ced6 Add some comments. 2022-01-28 07:37:07 +11:00
flip1995
cce9231c19
Merge commit 'a98e7ab8b94485be6bd03e0c6b8682ecab5b52e6' into clippyup 2022-01-27 15:12:45 +01:00
bors
a98e7ab8b9 Auto merge of #8359 - flip1995:rustup, r=flip1995
Rustup

r? `@ghost`

changelog: none
2022-01-27 13:48:23 +00:00
flip1995
b96e76869d
Bump nightly version -> 2022-01-27 2022-01-27 14:23:42 +01:00
flip1995
d037b28025
Merge remote-tracking branch 'upstream/master' into rustup 2022-01-27 14:23:31 +01:00
lcnr
2684dfe583 try apply rustc_pass_by_value to Span 2022-01-27 11:29:41 +01:00
Thomas de Zeeuw
4acb8ac46c Use sockaddr_un in unix SocketAddr::from_path 2022-01-27 09:54:28 +01:00
Thomas de Zeeuw
ca9a3c9a9f Make sockaddr_un safe and use copy_nonoverlapping
The creation of libc::sockaddr_un is a safe operation, no need for it to
be unsafe.

This also uses the more performant copy_nonoverlapping instead of an
iterator.
2022-01-27 09:52:59 +01:00
lcnr
e6808381e5 update pass_by_value 2022-01-27 07:58:33 +01:00
cameron
f27758e8d7 mention std::iter::zip in Iterator::zip docs 2022-01-27 06:47:52 +00:00
Nicholas Nethercote
696d5034b2 Clarify the usage-of-qualified-ty error message.
I found this message confusing when I encountered it. This commit makes
it clearer that you have to import the unqualified type yourself.
2022-01-27 17:42:35 +11:00
bors
21b4a9cfdc Auto merge of #92889 - tmiasko:unbounded-recursion, r=ecstatic-morse
Ignore unwinding edges when checking for unconditional recursion

The unconditional recursion lint determines if all execution paths
eventually lead to a self-recursive call.

The implementation always follows unwinding edges which limits its
practical utility. For example, it would not lint function `f` because a
call to `g` might unwind. It also wouldn't lint function `h` because an
overflow check preceding the self-recursive call might unwind:

```rust
pub fn f() {
    g();
    f();
}

pub fn g() { /* ... */ }

pub fn h(a: usize) {
  h(a + 1);
}
```

To avoid the issue, assume that terminators that might continue
execution along non-unwinding edges do so.

Fixes #78474.
2022-01-27 06:21:53 +00:00
bors
563250a65c Auto merge of #93081 - nikic:aarch64-fix, r=cuviper
Update LLVM submodule

Update LLVM to fix #92786.
2022-01-27 01:53:24 +00:00
bors
009c1d0248 Auto merge of #93352 - matthiaskrgr:rollup-5peret4, r=matthiaskrgr
Rollup of 7 pull requests

Successful merges:

 - #90247 (Improve Duration::try_from_secs_f32/64 accuracy by directly processing exponent and mantissa)
 - #91861 (Replace iterator-based construction of collections by `Into<T>`)
 - #92098 (add OpenBSD platform-support page)
 - #92134 (Add x86_64-pc-windows-msvc linker-plugin-lto instructions)
 - #92256 (Improve selection errors for `~const` trait bounds)
 - #92778 (fs: Use readdir() instead of readdir_r() on Linux and Android)
 - #93338 (Update minifier crate version to 0.0.42)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2022-01-26 22:54:26 +00:00
Matthias Krüger
4276626299
Rollup merge of #93338 - GuillaumeGomez:update-minifier, r=notriddle
Update minifier crate version to 0.0.42

Some issues on the CSS minification.

r? `@notriddle`
2022-01-26 23:45:24 +01:00
Matthias Krüger
253f64c9c6
Rollup merge of #92778 - tavianator:linux-readdir-no-r, r=joshtriplett
fs: Use readdir() instead of readdir_r() on Linux and Android

See #40021 for more details.  Fixes #86649.  Fixes #34668.
2022-01-26 23:45:23 +01:00
Matthias Krüger
e2b2bfe10c
Rollup merge of #92256 - fee1-dead:improve-selection-err, r=oli-obk
Improve selection errors for `~const` trait bounds
2022-01-26 23:45:22 +01:00
Matthias Krüger
e249812597
Rollup merge of #92134 - nico-abram:patch-1, r=michaelwoerister
Add x86_64-pc-windows-msvc linker-plugin-lto instructions

I had some trouble getting cross language LTO working for this target, in part because the very few links of documentation I could find were linux-centric and because of a few very specific errors I ran into. I'm not sure if this is the correct place to document this, but this is one of the first links I found when looking for documentation so it might be the best place for it.
2022-01-26 23:45:21 +01:00
Matthias Krüger
75eb96301d
Rollup merge of #92098 - semarie:openbsd-platform, r=pietroalbini
add OpenBSD platform-support page

It mentions x86_64, i686, aarch64 and sparc64 which are actively maintained and used on OpenBSD (binaries provided by standard package distribution on OpenBSD).

I volontary kept `powerpc-unknown-openbsd` unmentioned as it was added by `@Yn0ga` in #82733, and I am unaware if it is functional or not (I doubt as I added libc support only few days ago, and std `c_char` signess was wrong). `@Yn0ga` maybe you comment on your `powerpc-unknown-openbsd` usage ?
2022-01-26 23:45:20 +01:00
Matthias Krüger
1dd0ac1f6a
Rollup merge of #91861 - juniorbassani:use-from-array-in-collections-examples, r=yaahc
Replace iterator-based construction of collections by `Into<T>`

Just a few quality of life improvements in the doc examples. I also removed some `Vec`s in favor of arrays.
2022-01-26 23:45:19 +01:00
Matthias Krüger
faf2b7f455
Rollup merge of #90247 - newpavlov:duration_float_fract, r=nagisa
Improve Duration::try_from_secs_f32/64 accuracy by directly processing exponent and mantissa

Closes: #90225

The methods now implement direct processing of exponent and mantissa, which should result in the best possible conversion accuracy (modulo truncation, i.e. float value of 19.995 ns will be represented as 19 ns).
2022-01-26 23:45:18 +01:00
Michael Howell
f5cdfb47e5 rustdoc: add test case for multiple traits and erased names
https://github.com/rust-lang/rust/pull/92339#discussion_r792805289
2022-01-26 13:03:31 -07:00
bors
6abb6385b2 Auto merge of #93301 - spastorino:perf-test-1, r=oli-obk
Store hir_id_to_def_id in OwnerInfo.

This is for perf test purposes only. Related to #89278
2022-01-26 19:45:09 +00:00
bors
ea4db3a6c6 Auto merge of #8350 - dswij:8331, r=Manishearth
fix bad suggestion on `numeric_literal`

closes #8331

changelog: [`numeric_literal`]  fix suggestion not showing sign
2022-01-26 19:19:28 +00:00
Rémy Rakic
644c22d3ad Only traverse attrs once while checking for coherence override 2022-01-26 18:32:02 +01:00
Guillaume Gomez
91f39315e8 Update minifier crate version to 0.0.42 2022-01-26 17:24:34 +01:00
Santiago Pastorino
384189c3d9
Filter out local_id == 0, those are already considered on the call site 2022-01-26 12:25:31 -03:00
Camille GILLOT
14a64e0a55
Bless incremental tests. 2022-01-26 12:25:30 -03:00
Артём Павлов [Artyom Pavlov]
e0bcf771d6 Improve Duration::try_from_secs_f32/64 accuracy by directly processing exponent and mantissa 2022-01-26 18:14:25 +03:00