bors [Fri, 28 Jan 2022 12:46:13 +0000 (12:46 +0000)]
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.
Harald Hoyer [Fri, 21 Jan 2022 13:19:48 +0000 (14:19 +0100)]
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.
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))
| + +
```
[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.
pierwill [Thu, 27 Jan 2022 02:57:46 +0000 (20:57 -0600)]
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.
bors [Thu, 27 Jan 2022 22:34:34 +0000 (22:34 +0000)]
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)
Matthias Krüger [Thu, 27 Jan 2022 21:32:24 +0000 (22:32 +0100)]
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.
Matthias Krüger [Thu, 27 Jan 2022 21:32:23 +0000 (22:32 +0100)]
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:
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.
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.
bors [Thu, 27 Jan 2022 06:21:53 +0000 (06:21 +0000)]
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.
bors [Wed, 26 Jan 2022 22:54:26 +0000 (22:54 +0000)]
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)
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.
Matthias Krüger [Wed, 26 Jan 2022 22:45:20 +0000 (23:45 +0100)]
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 ?
Matthias Krüger [Wed, 26 Jan 2022 22:45:18 +0000 (23:45 +0100)]
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).
Tomasz Miąsko [Fri, 14 Jan 2022 00:00:00 +0000 (00:00 +0000)]
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.
bors [Wed, 26 Jan 2022 12:10:54 +0000 (12:10 +0000)]
Auto merge of #91840 - JakobDegen:fix_early_otherwise, r=oli-obk
Fix the unsoundness in the `early_otherwise_branch` mir opt pass
Closes #78496 .
This change is a significant rewrite of much of the pass. Exactly what it does is documented in the source file (with ascii art!), and all the changes that are made to the MIR that are not trivially sound are carefully documented. That being said, this is my first time touching MIR, so there are probably some invariants I did not know about that I broke.
This version of the optimization is also somewhat more flexible than the original; for example, we do not care how or where the value on which the parent is switching is computed. There is no requirement that any types be the same. This could be made even more flexible in the future by allowing a wider range of statements in the bodies of `BBC, BBD` (as long as they are all the same of course). This should be a good first step though.
Probably needs a perf run.
r? `@oli-obk` who reviewed things the last time this was touched
bors [Wed, 26 Jan 2022 09:10:27 +0000 (09:10 +0000)]
Auto merge of #88679 - petrochenkov:doctrscope, r=GuillaumeGomez
rustdoc: Pre-calculate traits that are in scope for doc links
This eliminates one more late use of resolver (part of #83761).
At early doc link resolution time we go through parent modules of items from the current crate, reexports of items from other crates, trait items, and impl items collected by `collect-intra-doc-links` pass, determine traits that are in scope in each such module, and put those traits into a map used by later rustdoc passes.
r? `@jyn514`
woppopo [Wed, 26 Jan 2022 04:06:09 +0000 (13:06 +0900)]
`const_deallocate`: Don't deallocate memory allocated in an another const. Does nothing at runtime.
`const_allocate`: Returns a null pointer at runtime.
bors [Wed, 26 Jan 2022 01:47:08 +0000 (01:47 +0000)]
Auto merge of #93314 - ehuss:update-cargo, r=ehuss
Update cargo
9 commits in 95bb3c92bf516017e812e7f1c14c2dea3845b30e..1c034752de0df744fcd7788fcbca158830b8bf85
2022-01-18 17:39:35 +0000 to 2022-01-25 22:36:53 +0000
- Sync toml_edit versions (rust-lang/cargo#10329)
- Check --config for dotted keys only (rust-lang/cargo#10176)
- Remove deprecated --host arg for search and publish cmds (rust-lang/cargo#10327)
- doc: it's valid to use OUT_DIR for intermediate artifacts (rust-lang/cargo#10326)
- Use local git info for version. (rust-lang/cargo#10323)
- Fix documenting with undocumented dependencies. (rust-lang/cargo#10324)
- do not compile test for bins flagged as `test = false` (rust-lang/cargo#10305)
- Port cargo from toml-rs to toml_edit (rust-lang/cargo#10086)
- Fix new::git_default_branch with different default (rust-lang/cargo#10306)
bors [Tue, 25 Jan 2022 22:30:07 +0000 (22:30 +0000)]
Auto merge of #93308 - matthiaskrgr:rollup-9tc73ft, r=matthiaskrgr
Rollup of 5 pull requests
Successful merges:
- #93250 (Remove deduplication of early lints)
- #93286 (Add white-space: nowrap to links in the sidebar)
- #93291 (minor fix for #93231)
- #93300 (make Windows abort_internal Miri-compatible)
- #93303 (Fix ICE when parsing bad turbofish with lifetime argument)
Matthias Krüger [Tue, 25 Jan 2022 22:06:03 +0000 (23:06 +0100)]
Rollup merge of #93300 - RalfJung:win-abort-miri, r=Amanieu
make Windows abort_internal Miri-compatible
https://github.com/rust-lang/rust/pull/92828 started calling `abort_internal` on double-panics, uncovering that on Windows this function does not work in Miri because of its use of inline assembly.
Matthias Krüger [Tue, 25 Jan 2022 22:06:02 +0000 (23:06 +0100)]
Rollup merge of #93291 - conradludgate:minor-fix-93231, r=GuillaumeGomez
minor fix for #93231
In #93231 I introduced the new sidebar colours to make the contrast more balanced and easier to read, but it seems I made a copy-paste error in the light theme, resulting in functions appearing green.
This one line change replaces that colour with it's corrected orange/brown colour.
I have double checked the rest of the colours and they seem ok. Sorry for the inconvenience
Matthias Krüger [Tue, 25 Jan 2022 22:06:01 +0000 (23:06 +0100)]
Rollup merge of #93286 - jsha:sidebar-nowrap, r=GuillaumeGomez
Add white-space: nowrap to links in the sidebar
We already have overflow: hidden on these links, but if there is a possibility to wrap, they will wrap. This happens in particular for trait implementations because the punctuation (`<>, `) introduces opportunities for breaks. That produces inconsistent UI. Fix it by forcing them not to wrap.
Matthias Krüger [Tue, 25 Jan 2022 22:06:00 +0000 (23:06 +0100)]
Rollup merge of #93250 - Aaron1011:remove-early-dedup, r=oli-obk
Remove deduplication of early lints
We already have a general mechanism for deduplicating reported
lints, so there's no need to have an additional one for early lints
specifically. This allows us to remove some `PartialEq` impls.