Commit Graph

168892 Commits

Author SHA1 Message Date
Michael Goulet
8eb4fc6057
Rollup merge of #97066 - petrochenkov:nofragkind, r=camelid
rustdoc: Remove `ItemFragment(Kind)`

And stop using `write!` when rendering URL fragments to avoid impossible errors.
2022-05-26 20:15:08 -07:00
Michael Goulet
e3813e46a2
Rollup merge of #96051 - newpavlov:duration_rounding, r=nagisa,joshtriplett
Use rounding in float to Duration conversion methods

Closes #96045
2022-05-26 20:15:07 -07:00
Артём Павлов [Artyom Pavlov]
6495963d5a fmt 2022-05-27 05:15:22 +03:00
Артём Павлов [Artyom Pavlov]
38609cd8a9 fix nanos overflow for f64 2022-05-27 04:59:01 +03:00
Artyom Pavlov
06af3a63a5
add debug asserts 2022-05-27 00:22:56 +00:00
bors
b2c9872c6c Auto merge of #97386 - nnethercote:optimize-pos-adjustments, r=bjorn3
Optimize position adjustments

A small improvement.

r? `@bjorn3`
2022-05-26 22:01:19 +00:00
bors
490324f7b2 Auto merge of #97434 - matthiaskrgr:rollup-7j3y16l, r=matthiaskrgr
Rollup of 3 pull requests

Successful merges:

 - #96033 (Add section on common message styles for Result::expect)
 - #97354 (Updates to browser-ui-test)
 - #97424 (clippy::complexity fixes)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2022-05-26 19:33:22 +00:00
Matthias Krüger
2cacc325bc
Rollup merge of #97424 - matthiaskrgr:clippy_complexity_may26, r=oli-obk
clippy::complexity fixes

clone_on_copy
useless_format
bind_instead_of_map
filter_map_identity
useless_conversion
map_flatten
unnecessary_unwrap
2022-05-26 20:59:43 +02:00
Matthias Krüger
f33601e753
Rollup merge of #97354 - GuillaumeGomez:browser-ui-test-update, r=notriddle
Updates to browser-ui-test

I took the commits from #97317. Since the ubuntu 22.04 version, you either need to use `--no-sandbox` or use another binary to run the GUI tests. I couldn't find out why the chromium used by `browser-ui-test` isn't working anymore on this ubuntu version.

r? `@notriddle`
2022-05-26 20:59:42 +02:00
Matthias Krüger
82beeabf54
Rollup merge of #96033 - yaahc:expect-elaboration, r=scottmcm
Add section on common message styles for Result::expect

Based on a question from https://github.com/rust-lang/project-error-handling/issues/50#issuecomment-1092339937

~~One thing I haven't decided on yet, should I duplicate this section on `Option::expect`, link to this section, or move it somewhere else and link to that location from both docs?~~: I ended up moving the section to `std::error` and referencing it from both `Result::expect` and `Option::expect`'s docs.

I think this section, when combined with the similar update I made on [`std::panic!`](https://doc.rust-lang.org/nightly/std/macro.panic.html#when-to-use-panic-vs-result) implies that we should possibly more aggressively encourage and support the "expect as precondition" style described in this section. The consensus among the libs team seems to be that panic should be used for bugs, not expected potential failure modes. The "expect as error message" style seems to align better with the panic for unrecoverable errors style where they're seen as normal errors where the only difference is a desire to kill the current execution unit (aka erlang style error handling). I'm wondering if we should be providing a panic hook similar to `human-panic` or more strongly recommending the "expect as precondition" style of expect message.
2022-05-26 20:59:40 +02:00
bors
1851f0802e Auto merge of #97046 - conradludgate:faster-ascii-case-conv-path, r=thomcc
improve case conversion happy path

Someone shared the source code for [Go's string case conversion](19156a5474/src/strings/strings.go (L558-L616)).

It features a hot path for ascii-only strings (although I assume for reasons specific to go, they've opted for a read safe hot loop).

I've borrowed these ideas and also kept our existing code to provide a fast path + seamless utf-8 correct path fallback.

(Naive) Benchmarks can be found here https://github.com/conradludgate/case-conv

For the cases where non-ascii is found near the start, the performance of this algorithm does fall back to original speeds and has not had any measurable speed loss
2022-05-26 15:29:01 +00:00
Conrad Ludgate
d0f9930709 improve case conversion happy path 2022-05-26 13:18:57 +01:00
bors
1ab98933fa Auto merge of #97168 - SparrowLii:accesses, r=cjgillot
omit `record_accesses` function when collecting `MonoItem`s

This PR fixes the FIXME in the impl of `record_accesses` function.
[Edit] We can call `instantiation_mode` when push the `MonoItem` into `neighbors`. This avoids extra local variables `accesses: SmallVec<[_; 128]>`
2022-05-26 11:15:15 +00:00
Matthias Krüger
5fc8a8e227 clippy::complexity fixes
clone_on_copy
useless_format
bind_instead_of_map
filter_map_identity
useless_conversion
map_flatten
unnecessary_unwrap
2022-05-26 13:14:24 +02:00
bors
9e26dc71fd Auto merge of #96742 - m-ou-se:bsd-no-ancillary, r=joshtriplett
Disable unix::net::ancillary on BSD.

See https://github.com/rust-lang/rust/issues/76915#issuecomment-1118954474
2022-05-26 08:50:33 +00:00
bors
8bf9c20765 Auto merge of #97410 - jyn514:tool-std-features, r=Mark-Simulacrum
Only allow `compiletest` to use `feature(test)`, not any other feature

Using language features occasionally causes issues when using nightly to bootstrap, rather than beta.
See #59264 for additional context.
2022-05-26 05:45:54 +00:00
Mara Bos
8b9f8e25ba Disable unix::net::ancillary on BSD. 2022-05-25 20:09:59 -07:00
bors
99c4758747 Auto merge of #97369 - tmiasko:codgen-ssa-atomic-ordering, r=michaelwoerister
rustc_codegen_ssa: cleanup `AtomicOrdering`

* Remove unused `NotAtomic` ordering.
* Rename `Monotonic` to `Relaxed` - a Rust specific name.
* Derive copy and clone.
2022-05-26 02:00:17 +00:00
SparrowLii
480e6036c5 call instantiation_mode when pushing a new mono_item 2022-05-26 09:36:54 +08:00
Joshua Nelson
e71c48c5a0 Only allow compiletest to use feature(test), not any other feature
Using language features occasionally causes issues when using nightly to bootstrap, rather than beta.
See #59264 for additional context.
2022-05-25 18:45:54 -05:00
bors
464ec64df7 Auto merge of #97409 - GuillaumeGomez:rollup-808v9ge, r=GuillaumeGomez
Rollup of 4 pull requests

Successful merges:

 - #97317 (Allow to click on setting text)
 - #97375 (Simplify implementation of `-Z gcc-ld`)
 - #97394 (Add more eslint rules)
 - #97407 (Update books)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2022-05-25 23:02:37 +00:00
Nicholas Nethercote
2b91c40c19 Avoid adjusting file positions twice.
`imported_source_files` adjusts lots of file positions, and then calls
`new_imported_source_file`, which then adjust them all again. This
commit combines the two adjustments into one, for a small perf win.
2022-05-26 08:56:49 +10:00
Nicholas Nethercote
3e810c64d0 Augment a comment. 2022-05-26 08:56:49 +10:00
Guillaume Gomez
f74e61ec05
Rollup merge of #97407 - ehuss:update-books, r=ehuss
Update books

## reference

6 commits in 8e36971959ff238b5aa2575fbc7a2e09e1313e82..b74825d8f88b685e239ade00f00de68ba4cd63d4
2022-05-09 17:20:59 -0700 to 2022-05-20 14:30:30 -0700
- Inline assembly: Clarify references to quoted regs (rust-lang/reference#1191)
- Add tile registers to inline-assembly documentation (rust-lang/reference#1220)
- Upper bound on hashes in raw string literals (rust-lang/reference#1180)
- Remove footnote on warning about lifetime shadowing labels.
- Makes explanation for Spans in "Procedural Macros" clearer (rust-lang/reference#1219)
- Update "Match Expressions" to remove 'cold' (rust-lang/reference#1216)

## book

18 commits in d9415b7cbfcb4b24062683f429bd0ff535396362..b4dd5f00b87190ad5ef42cbc2a88a783c6ae57ef
2022-05-09 09:10:44 -0400 to 2022-05-24 21:37:06 -0400
- Snapshot of appendices for nostarch
- Update rust-analyzer URLs and make links less repetitive
- Correct byte string literal type. Fixes rust-lang/book#2631.
- Fix verb agreement. Fixes rust-lang/book#3176
- Propagate ch19 edits to src
- Edits to chapter 19 from nostarch
- Propagate ch18 edits to src
- Edits to ch18 from nostarch
- Propagate tech review edits to src ch5
- Responses to chapter 5 tech review
- Ch5 after tech review
- Merge branch 'ch7-edits'
- fix: mdBook authors
- Propagating ch17 edits to src
- Edits from nostarch for ch17
- Fix rust-lang/book#3152 - Wrong character used
- & is not valid inside image alt text
- Merge branch 'ch20'

## rust-by-example

2 commits in e9f93cfcf410bc092c9107b8a41a82f144c761f2..2ed26865e8c29ef939dc913a97bd321cadd72a9a
2022-05-08 18:24:06 -0300 to 2022-05-18 17:23:47 -0300
- Rework cpuid asm example. (rust-lang/rust-by-example#1542)
- chore: better description for eprint macro (rust-lang/rust-by-example#1541)

## rustc-dev-guide

11 commits in 0c02acdb6f48f03907a02ea8e537c3272b4fde9f..554c00e4805df7f7bffac7db408437d62d6dfb9a
2022-05-10 09:45:31 -0300 to 2022-05-24 17:15:35 -0700
- Cleanup rustdoc-internals
- Fix some wording on the "Incremental Compilation In Detail" page
- Exclude `tomlee.co` from link-checking (rust-lang/rustc-dev-guide#1356)
- Add note about patching dependencies and warnings. (rust-lang/rustc-dev-guide#1354)
- make sentence more simple (rust-lang/rustc-dev-guide#1353)
- Update some links and docs (rust-lang/rustc-dev-guide#1340)
- Replace a broken YouTube link (rust-lang/rustc-dev-guide#1295)
- Edit the "Compiler Source Code" chapter (rust-lang/rustc-dev-guide#1307)
- Add docs for logging of queries. (rust-lang/rustc-dev-guide#1350)
- Fix configuration names for vscode/r-a (rust-lang/rustc-dev-guide#1352)
- Update docs for deprecated attribute (rust-lang/rustc-dev-guide#1338)
2022-05-26 00:32:12 +02:00
Guillaume Gomez
d932610bab
Rollup merge of #97394 - GuillaumeGomez:more-eslint-rules, r=notriddle
Add more eslint rules

This PR adds more eslint rules. Here are the explanations for each of them:

 * [space-infix-ops](https://eslint.org/docs/rules/space-infix-ops)
 * [space-before-function-paren](https://eslint.org/docs/rules/space-before-function-paren)
 * [space-before-blocks](https://eslint.org/docs/rules/space-before-blocks)
 * [comma-dangle](https://eslint.org/docs/rules/comma-dangle)
 * [comma-style](https://eslint.org/docs/rules/comma-style)
 * [max-len](https://eslint.org/docs/rules/max-len)
 * [eol-last](https://eslint.org/docs/rules/eol-last)

r? `@notriddle`
2022-05-26 00:32:11 +02:00
Guillaume Gomez
b7927413b3
Rollup merge of #97375 - petrochenkov:zgccld, r=bjorn3
Simplify implementation of `-Z gcc-ld`

- The logic is now unified for all targets (wasm targets should also be supported now)
- Additional "symlink" files like `ld64` are eliminated
- lld-wrapper is used for propagating the correct lld flavor
- Cleanup "unwrap or exit" logic in lld-wrapper

cc https://github.com/rust-lang/rust/issues/97352
r? `@bjorn3`
2022-05-26 00:32:10 +02:00
Guillaume Gomez
02b630f566
Rollup merge of #97317 - GuillaumeGomez:gui-settings-text-click, r=jsha
Allow to click on setting text

You can test it [here](https://rustdoc.crud.net/imperio/gui-settings-text-click/doc/foo/index.html).

This PR allows to click on the text alongside the toggle to change it.

r? `@jsha`
2022-05-26 00:32:09 +02:00
Vadim Petrochenkov
2984bf674f Simplify implementation of -Z gcc-ld
- The logic is now unified for all targets (wasm targets should also be supported now)
- Additional "symlink" files like `ld64` are eliminated
- lld-wrapper is used for propagating the correct lld flavor
- Cleanup "unwrap or exit" logic in lld-wrapper
2022-05-25 23:55:22 +03:00
bors
4cbaac699c Auto merge of #97403 - arlosi:update-cargo, r=ehuss
Update cargo

10 commits in a4c1cd0eb6b18082a7e693f5a665548fe1534be4..39ad1039d9e3e1746177bf5d134af4c164f95528
2022-05-20 00:55:25 +0000 to 2022-05-25 00:50:02 +0000

* doc: discuss build script instruction order (rust-lang/cargo#10600)
* Require http-registry URLs to end with a '/' (rust-lang/cargo#10698)
* No printing executable names when running tests and benchmarks with json message format (rust-lang/cargo#10691)
* Restore proper error for crate not in local reg (rust-lang/cargo#10683)
* Update libcurl (rust-lang/cargo#10696)
* Fixed small typos (rust-lang/cargo#10693)
* fix bugs with `workspace` key and `update_toml` (rust-lang/cargo#10685)
* Bump to 0.64.0, update changelog (rust-lang/cargo#10687)
* List C compiler as a build dependency in README (rust-lang/cargo#10678)
* Add unstable `rustc-check-cfg` build script output (rust-lang/cargo#10539)

r? `@ehuss`
2022-05-25 20:35:49 +00:00
Eric Huss
57c88ca40e Update books 2022-05-25 12:45:28 -07:00
Jane Lusby
ef879c680e fix broken doctest 2022-05-25 12:20:48 -07:00
Jane Lusby
720e987ac0 update option and result references to expect message docs 2022-05-25 11:37:39 -07:00
Jane Lusby
b6b621ec85 fix links 2022-05-25 10:46:56 -07:00
Arlo Siemsen
6b48b52a67 Update cargo 2022-05-25 10:33:59 -07:00
bors
1b5e1215ef Auto merge of #97401 - Dylan-DPC:rollup-fh9e61o, r=Dylan-DPC
Rollup of 5 pull requests

Successful merges:

 - #97302 (Do writeback of Closure params before visiting the parent expression)
 - #97328 (rustc: Fix ICE in native library error reporting)
 - #97351 (Output correct type responsible for structural match violation)
 - #97398 (Add regression test for #82830)
 - #97400 (Fix a typo on Struct `Substructure`)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2022-05-25 16:39:37 +00:00
Dylan DPC
e98f8f8fef
Rollup merge of #97400 - JohnTitor:typo-fix-substructure, r=cjgillot
Fix a typo on Struct `Substructure`
2022-05-25 17:37:23 +02:00
Dylan DPC
5d43ae8ece
Rollup merge of #97398 - JohnTitor:issue-82830, r=compiler-errors
Add regression test for #82830

Closes #82830
r? `@compiler-errors`
2022-05-25 17:37:22 +02:00
Dylan DPC
8a3ad4942c
Rollup merge of #97351 - b-naber:adt-const-params-structural-match-violation, r=michaelwoerister
Output correct type responsible for structural match violation

Previously we included the outermost type that caused a structural match violation in the error message and stated that that type must be annotated with `#[derive(Eq, PartialEq)]` even if it already had that annotation. This PR outputs the correct type in the error message.

Fixes https://github.com/rust-lang/rust/issues/97278
2022-05-25 17:37:21 +02:00
Dylan DPC
006707834f
Rollup merge of #97328 - petrochenkov:nativice, r=michaelwoerister
rustc: Fix ICE in native library error reporting

Fixes https://github.com/rust-lang/rust/issues/97299
2022-05-25 17:37:20 +02:00
Dylan DPC
d858d280e4
Rollup merge of #97302 - compiler-errors:writeback-ascending, r=cjgillot
Do writeback of Closure params before visiting the parent expression

This means that given the expression:

```
let x = |a: Vec<_>| {};
```

We will visit the HIR node for `a` before `x`, and report the ambiguity on the former instead of the latter. This also moves writeback for struct field ids and const blocks before, but the ordering of this and walking the expr doesn't seem to matter.
2022-05-25 17:37:18 +02:00
bors
9fed13030c Auto merge of #94954 - SimonSapin:null-thin3, r=yaahc
Extend ptr::null and null_mut to all thin (including extern) types

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

This change was accepted in https://rust-lang.github.io/rfcs/2580-ptr-meta.html

Note that this changes the signature of **stable** functions. The change should be backward-compatible, but it is **insta-stable** since it cannot (easily, at all?) be made available only through a `#![feature(…)]` opt-in.

The RFC also proposed the same change for `NonNull::dangling`, which makes sense it terms of its signature but not in terms of its implementation. `dangling` uses `align_of()` as an address. But what `align_of()` should be for extern types or whether it should be allowed at all remains an open question.

This commit depends on https://github.com/rust-lang/rust/pull/93977, which is not yet part of the bootstrap compiler. So `#[cfg]` is used to only apply the change in stage 1+. As far a I know bounds cannot be made conditional with `#[cfg]`, so the entire functions are duplicated. This is unfortunate but temporary.

Since this duplication makes it less obvious in the diff, the new definitions differ in:

* More permissive bounds (`Thin` instead of implied `Sized`)
* Different implementation
* Having `rustc_allow_const_fn_unstable(const_fn_trait_bound)`
* Having `rustc_allow_const_fn_unstable(ptr_metadata)`
2022-05-25 13:58:51 +00:00
Yuki Okushi
611948b968
Fix a typo on Struct Substructure 2022-05-25 22:25:37 +09:00
Yuki Okushi
cca9e63d70
Add regression test for #82830 2022-05-25 22:14:20 +09:00
Guillaume Gomez
bb29d5d6e0 Add new eslint rule "eol-last" 2022-05-25 13:58:42 +02:00
Guillaume Gomez
36d3c7e3c6 Add new eslint rule "max-len" 2022-05-25 13:58:14 +02:00
Guillaume Gomez
33245e0bb3 Add new eslint rule "comma-style" 2022-05-25 13:57:08 +02:00
Guillaume Gomez
4dbc6764cf Add new eslint rule "comma-dangle" 2022-05-25 13:56:27 +02:00
Guillaume Gomez
c5e3954887 Add new eslint rule "space-before-blocks" 2022-05-25 13:55:54 +02:00
Guillaume Gomez
6c7156d488 Add new eslint rule "space-before-function-paren" 2022-05-25 13:55:09 +02:00
Guillaume Gomez
231b47b2b9 Add eslint rule "space-infix-ops" 2022-05-25 13:53:19 +02:00