Commit graph

152963 commits

Author SHA1 Message Date
Albin Hedman
c8bf5ed628
Add test for int to float 2021-08-07 19:03:34 +02:00
Albin Hedman
09928a9a20
Add tests 2021-08-07 19:03:33 +02:00
Albin Hedman
eefd790d3b
impl const From<num> for num 2021-08-07 19:03:08 +02:00
Yuki Okushi
c159806cf0
Rollup merge of #87842 - steffahn:hidden_broken_intra_doc, r=dtolnay
Fix intra doc link in hidden doc of Iterator::__iterator_get_unchecked

Recently, I edited the import list of the `core::iter::traits::iterator` module (in #85874). This results in a broken intra doc link in a hidden documentation with the effect that `RUSTDOCFLAGS='--document-private-items --document-hidden-items' x doc library/std` fails. (This can be worked around by adding `-Arustdoc::broken-intra-doc-links`; still, it’s a broken link so let’s fix it.)

``@rustbot`` label C-cleanup, T-libs
2021-08-08 01:13:45 +09:00
Yuki Okushi
349290047f
Rollup merge of #87838 - jetomit:add-readdir-note, r=dtolnay
Document that fs::read_dir skips . and ..

Hi,

I think this is worth noting in the docs since it differs from POSIX `readdir`. I didn’t put it under platform-specific notes because it seems to be consistent across platforms, and changing this behavior in the future could cause pretty nasty bugs.

Thanks!
2021-08-08 01:13:44 +09:00
Yuki Okushi
08f56b7bdb
Rollup merge of #87834 - camelid:span-typo, r=CraftSpider
Fix small typo

The closing backtick was outside the closing bracket,
which is why the intra-doc link wasn't working.
2021-08-08 01:13:43 +09:00
Yuki Okushi
6ddbf9ec3c
Rollup merge of #87833 - m-rsha:patch-1, r=Aaron1011
Fix typo -- "The" -> "They"

I was reading through source code to try to learn more about the language and how to make the most of it when I ran into a small typo, so I figured I'd offer up a fix! I'm pretty new now, but hopefully I can offer up more substantial changes later. :D
2021-08-08 01:13:43 +09:00
Yuki Okushi
dc78ee0c80
Rollup merge of #87789 - tmiasko:panik, r=Mark-Simulacrum
Make vec-shrink-panic test compatible with v0 mangling

The v0 mangling includes an instantiating crate in a mangled name,
which crates a false positive match for a word `panic`.
Rename crate name / test case to avoid the issue.
2021-08-08 01:13:42 +09:00
Yuki Okushi
e862383dbb
Rollup merge of #87744 - Smittyvb:xpy-test-force-rerun, r=Mark-Simulacrum
Add x.py option to --force-rerun compiletest tests

This can be used like `./x.py test src/test/ui/abi/ --force-rerun`, and is useful when verifying that newly blessed tests don't change between test runs (such as due to being dependent on the current time or memory layout or RNG), without needing to change the test file or find the right file in `build` to remove.
2021-08-08 01:13:41 +09:00
Matthias Geier
bc9459f9d4
similar_names: allow "iter" and "item" 2021-08-07 18:11:49 +02:00
bors
57d8747cca Auto merge of #87849 - RalfJung:miri, r=RalfJung
update Miri

Fixes https://github.com/rust-lang/rust/issues/87778
r? `@ghost`
2021-08-07 15:53:32 +00:00
Ralf Jung
a22aa61d5f update Miri 2021-08-07 17:46:45 +02:00
Godmar Back
2a56a4fe54 removed references to parent/child from std::thread documentation
- also clarifies how thread.join and detaching of threads works
- the previous prose implied that there is a relationship between a
spawning thread and the thread being spawned, and that "child" threads
couldn't outlive their parents unless detached, which is incorrect.
2021-08-07 11:33:18 -04:00
Nathaniel McCallum
4968537780 Fix naked function test run on non-x86_64 2021-08-07 11:17:03 -04:00
Klim Tsoutsman
75e80358d2
Change proc_macro::Diagnostics docs
Add links

Fit 100-character limit
2021-08-07 23:54:34 +10:00
Kornel
7dca8eb565 Use assert_matches! instead of if let {} else 2021-08-07 14:48:27 +01:00
bors
176df7ca9a Auto merge of #7536 - LeSeulArtichaut:redundant-allocation-doc, r=giraffate
Add missing backtick in docs for `redundant_allocation`

changelog: none
2021-08-07 13:19:06 +00:00
bors
6cb30ad581 Auto merge of #7534 - LeSeulArtichaut:7517-closure-too-many-lines, r=flip1995
Don't emit `too_many_lines` for closures

changelog: don't emit the [`too_many_lines`] lint inside closures to avoir duplicated diagnostics.

Fixes #7517.
2021-08-07 13:05:53 +00:00
bors
a0e71e5d63 Auto merge of #7533 - Valentine-Mario:vec_extend_to_append, r=xFrednet
fix bug on mutable ref

fixes: #7524

This PR is related to issue #7524
changelog:  [`extend_with_drain`] Improve code suggestion for mutable and immutable references
2021-08-07 12:54:13 +00:00
Kornel
215712283f Inline from of TryReserveErrorKind 2021-08-07 13:46:19 +01:00
bors
508b328c39 Auto merge of #87810 - devnexen:haiku_os_simpl, r=Mark-Simulacrum
current_exe haiku code path simplification all of these part of libc
2021-08-07 12:44:09 +00:00
Frank Steffahn
5c30df5954 Fix intra doc link in hidden doc of Iterator::__iterator_get_unchecked 2021-08-07 13:42:15 +02:00
Timotej Lazar
c32e4ba60a
Document that fs::read_dir skips . and .. 2021-08-07 10:14:41 +02:00
r00ster
43ee3fe56c
Clean up examples in new lint suggestion template 2021-08-07 08:02:25 +02:00
bors
6b20506d17 Auto merge of #87796 - nielx:fix/socket2-0.4.1, r=Mark-Simulacrum
Update socket2 dependency from 0.4.0 to 0.4.1

This update contains a fix for building the tools that depend on this package on Haiku (tier 3).
2021-08-07 05:33:21 +00:00
bors
996ff2e0a0 Auto merge of #87408 - kornelski:try_reserve_error, r=yaahc
Hide allocator details from TryReserveError

I think there's [no need for TryReserveError to carry detailed information](https://github.com/rust-lang/rust/issues/48043#issuecomment-825139280), but I wouldn't want that issue to delay stabilization of the `try_reserve` feature.

So I'm proposing to stabilize `try_reserve` with a `TryReserveError` as an opaque structure, and if needed, expose error details later.

This PR moves the `enum` to an unstable inner `TryReserveErrorKind` that lives under a separate feature flag. `TryReserveErrorKind` could possibly be left as an implementation detail forever, and the `TryReserveError` get methods such as `allocation_size() -> Option<usize>` or `layout() -> Option<Layout>` instead, or the details could be dropped completely to make try-reserve errors just a unit struct, and thus smaller and cheaper.
2021-08-07 01:26:15 +00:00
LeSeulArtichaut
ae700b42ed Use EarlyContext::sess instead of LintContext::sess() 2021-08-07 01:59:08 +02:00
LeSeulArtichaut
64ff2b05b9 Replace span_to_snippet calls with snippet_opt from clippy_utils 2021-08-07 01:59:05 +02:00
Noah Lev
35122393fd
Fix small typo
The closing backtick was outside the closing bracket,
which is why the intra-doc link wasn't working.
2021-08-06 16:43:55 -07:00
await Marsha
4235d93434
Fix typo -- "The" -> "They"
I was reading through source code to try to learn more about the language and how to make the most of it when I ran into a small typo, so I figured I'd offer up a fix! I'm pretty new now, but hopefully I can offer up more substantial changes later. :D
2021-08-06 18:40:36 -05:00
bors
db3cb435c1 Auto merge of #87774 - camelid:process-typo, r=jyn514
Fix typo

Add missing "by".
2021-08-06 22:42:25 +00:00
Augie Fackler
482f1901b0 PassWrapper: handle move of OptimizationLevel class out of PassBuilder
This is the first build break of the LLVM 14 cycle, and was caused by
https://reviews.llvm.org/D107025. Mercifully an easy fix.
2021-08-06 18:08:04 -04:00
bors
5ad7389bdd Auto merge of #87822 - JohnTitor:rollup-kxojii0, r=JohnTitor
Rollup of 7 pull requests

Successful merges:

 - #85807 (bootstrap: Disable initial-exec TLS model on powerpc)
 - #87761 (Fix overflow in rustc happening if the `err_count()` is reduced in a stage.)
 - #87775 (Add hint for unresolved associated trait items if the trait has a single item)
 - #87779 (Remove special case for statement `NodeId` assignment)
 - #87787 (Use `C-unwind` ABI for `__rust_start_panic` in `panic_abort`)
 - #87809 (Fix typo in the ptr documentation)
 - #87816 (Sync rustc_codegen_cranelift)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2021-08-06 18:23:14 +00:00
Elichai Turkel
4763ef2bd3
Replace read_to_string with read_line in Stdin example 2021-08-06 20:27:09 +03:00
Yuki Okushi
0de0b88fea
Rollup merge of #87816 - bjorn3:sync_cg_clif-2021-08-06, r=bjorn3
Sync rustc_codegen_cranelift

05677b6bd6 removes two assertions that should have been removed in https://github.com/rust-lang/rust/pull/87515. They are no longer correct and trigger while compiling the sysroot.

r? `@ghost`

`@rustbot` label +A-codegen +A-cranelift +T-compiler
2021-08-07 01:46:37 +09:00
Yuki Okushi
dba6cb76c2
Rollup merge of #87809 - InnovativeInventor:pointer-typo, r=dtolnay
Fix typo in the ptr documentation

Spotted a minor typo in the docs ;). Pointers are cool!
2021-08-07 01:46:36 +09:00
Yuki Okushi
c5202b3779
Rollup merge of #87787 - hyd-dev:c-unwind, r=RalfJung
Use `C-unwind` ABI for `__rust_start_panic` in `panic_abort`

The function originally has `C` ABI but is called using `C-unwind` ABI in `std`:
d4ad1cfc63/library/std/src/panicking.rs (L49-L54)
Which might be [problematic](https://github.com/rust-lang/miri/pull/1745#discussion_r596096876) and triggers this [Miri error](https://github.com/rust-lang/rust/issues/87778#issuecomment-893306222):
```
error: Undefined Behavior: calling a function with ABI C using caller ABI C-unwind
   --> /home/hyd-dev/.rustup/toolchains/miri/lib/rustlib/src/rust/library/std/src/panicking.rs:672:9
    |
672 |         __rust_start_panic(obj)
    |         ^^^^^^^^^^^^^^^^^^^^^^^ calling a function with ABI C using caller ABI C-unwind
    |
    = help: this indicates a bug in the program: it performed an invalid operation, and caused Undefined Behavior
    = help: see https://doc.rust-lang.org/nightly/reference/behavior-considered-undefined.html for further information
```
Changing the ABI of the function to `C-unwind` fixes the error above.
2021-08-07 01:46:35 +09:00
Yuki Okushi
a4262cc984
Rollup merge of #87779 - Aaron1011:stmt-ast-id, r=petrochenkov
Remove special case for statement `NodeId` assignment

We now let `noop_flat_map_stmt` assign `NodeId`s (via `visit_id`),
just as we do for other AST nodes.
2021-08-07 01:46:34 +09:00
Yuki Okushi
8ee962f88e
Rollup merge of #87775 - Kobzol:single-associated-item-hint, r=oli-obk
Add hint for unresolved associated trait items if the trait has a single item

This PR introduces a special-cased hint for unresolved trait items paths. It is shown if:
- the path was not resolved to any existing trait item
- and no existing trait item's name was reasonably close with regard to edit distance
- and the trait only has a single item in the corresponding namespace

I didn't know where I should put tests, therefore so far I just managed to bless two existing tests. I would be glad for hints where should tests for a hint like this be created, how should they be named (with reference to the original issue?) and what tests should I create (is it enough to test it just for types? or create separate tests also for functions and constants?).

It could also be turned into a machine applicable suggestion I suppose.

This is my first `rustc` PR, so please go easy on me :)

Fixes: https://github.com/rust-lang/rust/issues/87638
2021-08-07 01:46:33 +09:00
Yuki Okushi
3b0e797ee6
Rollup merge of #87761 - rusticstuff:rustc_error_overflow, r=Mark-Simulacrum
Fix overflow in rustc happening if the `err_count()` is reduced in a stage.

This can happen if stashed diagnostics are removed or replaced with fewer errors. The semantics stay the same if built without overflow checks. Fixes #84219.

Background: I came across this independently by running `RUSTFLAGS="-C overflow-checks=on" ./x.py test`. Fixing this will allow us to move on and find further overflow errors with testing or fuzzing.
2021-08-07 01:46:32 +09:00
Yuki Okushi
352ad62265
Rollup merge of #85807 - glaubitz:powerpc-disable-initial-exec-tls, r=Mark-Simulacrum
bootstrap: Disable initial-exec TLS model on powerpc

Fixes #81334.
2021-08-07 01:46:31 +09:00
bors
24380a60f5 Auto merge of #87784 - rusticstuff:bootstrap_config_overflow_checks, r=Mark-Simulacrum
Add config.toml options for enabling overflow checks in rustc and std

The names are `overflow-checks` and `overflow-checks-std` and they work similar to  `debug-assertions` and `debug-assertions-std`. Once added we can measure how big the performance impact actually is and maybe enable them for CI tests.

Enabling them already makes two ui tests fail:
```
failures:
    [ui] ui/parser/item-free-const-no-body-semantic-fail.rs
    [ui] ui/parser/item-free-static-no-body-semantic-fail.rs
```
(See #84219 and #87761.)
2021-08-06 15:35:01 +00:00
Aaron Hill
a35d7f2bb3
Remove special case for statement NodeId assignment
We now let `noop_flat_map_stmt` assign `NodeId`s (via `visit_id`),
just as we do for other AST nodes.
2021-08-06 09:30:47 -05:00
bjorn3
279f486960 Merge commit '05677b6bd6c938ed760835d9b1f6514992654ae3' into sync_cg_clif-2021-08-06 2021-08-06 16:26:56 +02:00
Ellen
8ff2eccd80 uwu 2021-08-06 15:17:21 +01:00
Ellen
9a5fc0d911 *sprinkles some dust everywhere* 2021-08-06 14:55:53 +01:00
Ellen
2c004a2287 encode generics_of of fields and ty params 2021-08-06 14:20:59 +01:00
bors
4c29cc8fd0 Auto merge of #87777 - the8472:fix-mir-max-rss, r=oli-obk,joshtriplett
Use zeroed allocations in the mir interpreter instead eagerly touching the memory

#86255 introduced a 30% regression in [page faults](https://perf.rust-lang.org/compare.html?start=64ae15ddd3f3cca7036ab2b2f3a6b130b62af4da&end=39e20f1ae5f13451eb35247808d6a2527cb7d060&stat=faults
) and a 3% regression in [max-rss](https://perf.rust-lang.org/index.html?start=2021-07-01&end=&absolute=false&stat=max-rss) in the ctfe-stress benchmarks.
That's most likely happened because it separated allocation from initialization of the vec which defeats the zero-optimization.

Currently there's no allocation API that is fallible, zeroing and returns a slice, so this PR introduces one and then uses that to solve the problem. In principle `vec.resize(len, 0)` could be optimized to use `alloc::grow_zeroed` where appropriate but that would require new specializations and new plumbing in `RawVec`.
2021-08-06 12:11:30 +00:00
Hans Kratz
2f7095389d Add options for enabling overflow checks in rustc and std.
The options are `overflow-checks` and `overflow-checks-std`
defaulting to false.
2021-08-06 14:03:53 +02:00
Oli Scherer
7af445dc15 bless some nll tests 2021-08-06 11:06:34 +00:00