Commit Graph

168925 Commits

Author SHA1 Message Date
bors
56fd680cf9 Auto merge of #96046 - oli-obk:const_typeck, r=cjgillot
Move various checks to typeck so them failing causes the typeck result to get tainted

Fixes #69487
fixes #79047

cc `@RalfJung` this gets rid of the `Transmute` invalid program error variant
2022-05-27 11:31:37 +00:00
Oli Scherer
4332c2fbbd Update tests on aarch64 2022-05-27 09:18:11 +00:00
bors
46147119ec Auto merge of #97442 - hafeoz:master, r=GuillaumeGomez
Fix multiline attributes processing in doctest

Fixes #97440.

It seems like the call to `check_if_attr_is_complete` is not provided with the correct argument: the pending attribute should be passed, while the current line is actually being passed. This causes any attribute with more than 2 lines to fail and produces ICE when running through doctest.
2022-05-27 08:50:51 +00:00
bors
f558990814 Auto merge of #97004 - nnethercote:proc-macro-tweaks, r=eddyb
Proc macro tweaks

Various improvements I spotted while looking through the proc macro code.

r? `@eddyb`
2022-05-27 06:09:45 +00:00
Nicholas Nethercote
41c10dde95 Cut down associated_item.
The part of it dealing with types obfuscates and makes the code less
concise. This commit removes that part.
2022-05-27 16:02:24 +10:00
Nicholas Nethercote
e6fa19a3ce Remove unnecessary blank line. 2022-05-27 16:02:24 +10:00
Nicholas Nethercote
f5c9c1215c Rename b as buf in several places.
Because it's easy to confuse with `bridge`.
2022-05-27 15:58:35 +10:00
Nicholas Nethercote
c2c505737f Add some comments about _marker fields.
There is some non-obvious information required to understand them.
2022-05-27 15:58:35 +10:00
Nicholas Nethercote
9a785e0aa5 Clarify a comment.
`reverse_encode` isn't necessary to please the borrow checker, it's to
match the ordering done by `reverse_decode`.
2022-05-27 15:58:35 +10:00
Nicholas Nethercote
bc70d0db92 Rename ProcMacroDerive as DeriveProcMacro.
So it matches the existing `AttrProcMacro` and `BangProcMacro` types.
2022-05-27 15:58:35 +10:00
Nicholas Nethercote
dbdc7dd0dc Rename ProcMacro trait as BangProcMacro.
Similar to the existing `AttrProcMacro` trait.
2022-05-27 15:58:35 +10:00
Nicholas Nethercote
1a9514d5ce Simplify types in proc_macro_harness.rs.
This gives the more obvious derive/attr/bang distinction, and reduces
code size slightly.
2022-05-27 15:58:35 +10:00
Nicholas Nethercote
2ece157e17 Make Buffer<T> non-generic.
`u8` is the only type that makes sense for `T`, as demonstrated by the
fact that several impls and functions are hardwired to `Buffer<u8>`.
2022-05-27 15:58:35 +10:00
Nicholas Nethercote
e02789c9f8 Improve formatting in associated_item! definition. 2022-05-27 15:58:35 +10:00
Nicholas Nethercote
a61a85eb24 Add some comments. 2022-05-27 15:58:35 +10:00
Nicholas Nethercote
2469ed0142 Fix a typo in a comment. 2022-05-27 15:58:35 +10:00
bors
9a42c6509d Auto merge of #97444 - compiler-errors:rollup-2gvdav6, r=compiler-errors
Rollup of 3 pull requests

Successful merges:

 - #96051 (Use rounding in float to Duration conversion methods)
 - #97066 (rustdoc: Remove `ItemFragment(Kind)`)
 - #97436 (Update `triagebot.toml` for macos ping group)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2022-05-27 03:27:04 +00:00
Michael Goulet
036f62badf
Rollup merge of #97436 - compiler-errors:macos-ping-2, r=Mark-Simulacrum
Update `triagebot.toml` for macos ping group

idk what i'm doing but i saw https://github.com/rust-lang/rust/pull/96392#issuecomment-1138893845

cc: `@thomcc`
2022-05-26 20:15:09 -07:00
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
bors
4f68efad64 Auto merge of #96298 - petrochenkov:fromgen, r=estebank
libcore: Add `iter::from_generator` which is like `iter::from_fn`, but for coroutines instead of functions

An equally useful little helper.

I didn't follow any of the async-wg work, so I don't know why something like this wasn't added before.
2022-05-27 01:01:15 +00:00
Artyom Pavlov
06af3a63a5
add debug asserts 2022-05-27 00:22:56 +00:00
Vadim Petrochenkov
5bf23f64cc libcore: Add iter::from_generator which is like iter::from_fn, but for coroutines instead of functions 2022-05-27 01:51:31 +03:00
hafeoz
c3beb03909
Formatting 2022-05-26 23:27:41 +01:00
hafeoz
c6cda15a16
Remove few characters for tidy check to pass 2022-05-26 23:13:37 +01: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
hafeoz
73ba7a756d
Add tests 2022-05-26 22:55:29 +01:00
hafeoz
d61ab20ff0
Use correct var for attribute completeness fn 2022-05-26 22:54:31 +01:00
Michael Goulet
c838129205
Update triagebot.toml for macos ping group 2022-05-26 12:42:14 -07: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