Commit graph

162061 commits

Author SHA1 Message Date
Matthias Krüger
2b4ce0c539
Rollup merge of #93375 - Kvicii:ISSUE_93374, r=notriddle
fix typo `documenation`
2022-01-28 15:20:28 +01:00
Matthias Krüger
cfe03006b7
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">
2022-01-28 15:20:27 +01:00
Matthias Krüger
25cd639a4b
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 9648b313cc #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
2022-01-28 15:20:26 +01:00
Matthias Krüger
4f2e2ceeb7
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.
2022-01-28 15:20:25 +01:00
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
lcnr
9d65342591 fix nit 2022-01-28 15:02:47 +01:00
Pietro Albini
5b3462c556
update cfg(bootstrap)s 2022-01-28 15:01:07 +01:00
Pietro Albini
970e603006
bump bootstrap compiler 2022-01-28 15:01:04 +01:00
Thomas de Zeeuw
35f578fc78 Update tracking issue for unix_socket_creation 2022-01-28 15:00:17 +01:00
Amanieu d'Antras
9a814b8ba6 Update stdarch submodule 2022-01-28 12:46:22 +00:00
bors
427eba2f0b Auto merge of #93006 - michaelwoerister:fix-unsized-ptr-debuginfo, r=davidtwco,oli-obk
Fix debuginfo for pointers/references to unsized types

This PR makes the compiler emit fat pointer debuginfo in all cases. Before, we sometimes got thin-pointer debuginfo, making it impossible to fully interpret the pointed to memory in debuggers. The code is actually cleaner now, especially around generation of trait object pointer debuginfo.

Fixes https://github.com/rust-lang/rust/issues/92718

~~Blocked on https://github.com/rust-lang/rust/pull/92729.~~
2022-01-28 12:46:13 +00: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
Amanieu d'Antras
2188c551cd Move unstable is_{arch}_feature_detected! macros to std::arch 2022-01-28 09:51:46 +00: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
Michael Woerister
c10f9e7d1d [debuginfo] Fix and unify handling of fat pointers in debuginfo: Don't mark fat pointer fields as artificial.
LLDB does not seem to see fields if they are marked with DW_AT_artificial
which breaks pretty printers that use these fields for decoding fat pointers.
2022-01-28 10:41:36 +01:00
woppopo
cdd0873db6 Add a test case for using NonNull::new in const context 2022-01-28 18:41:35 +09:00
Guillaume Gomez
5cc32e7158 Remove extra empty doc line 2022-01-28 10:06:41 +01:00
woppopo
7a7144f413 test_const_allocate_at_runtime 2022-01-28 17:27:33 +09:00
pierwill
7c7509bc3b 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 respective mathematical concepts
on Wikipedia.
2022-01-28 00:46:04 -06: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
Tomoaki Kawada
da0d506ace kmc-solid: Implement FileDesc::duplicate 2022-01-28 15:02:44 +09:00
Kvicii
ff79ce7e6f fix typo documenation 2022-01-28 10:26:49 +08:00
scottmcm
81b4e51c41
Fix a typo from #92899
Just happened to notice this in passing
2022-01-28 01:35:33 +00:00
bors
5ab502c6d3 Auto merge of #93376 - flip1995:clippyup, r=Manishearth
Update Clippy

r? `@Manishearth`
2022-01-28 01:33:00 +00:00
Eric Huss
38f59a3188 rustbuild: Fix compiletest warning when building outside of root. 2022-01-27 15:57:38 -08: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
Michael Howell
2e38e3b9b4 rustdoc: remove tooltip from source link
This made more sense back when it was abbreviated, but now it
seems redundant.
2022-01-27 15:09:52 -07: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
Michael Woerister
d33e317a72 [debuginfo] Fix and unify handling of fat pointers in debuginfo: Change doc comment so it is not interpreted as doc-test. 2022-01-27 16:55:48 +01:00
flip1995
cce9231c19
Merge commit 'a98e7ab8b94485be6bd03e0c6b8682ecab5b52e6' into clippyup 2022-01-27 15:12:45 +01:00
Kvicii
db097f308a fix typo documenation 2022-01-27 22:07:17 +08: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
Michael Woerister
3c61d2e172 [debuginfo] Fix and unify handling of fat pointers in debuginfo: Fix some debuginfo tests for old GDB versions and 32-bit targets. 2022-01-27 11:45:45 +01:00
lcnr
2684dfe583 try apply rustc_pass_by_value to Span 2022-01-27 11:29:41 +01:00