Commit Graph

196504 Commits

Author SHA1 Message Date
Michael Goulet
47a7a91c96 Use (actually) dummy place for let-else divergence 2022-08-04 05:08:09 +00:00
bors
1b57946a40 Auto merge of #100088 - RalfJung:anyhow, r=Mark-Simulacrum
update anyhow

Fixes https://github.com/rust-lang/rust/issues/100062 by incorporating https://github.com/dtolnay/anyhow/pull/249
2022-08-03 19:34:24 +00:00
bors
d6b96b61e7 Auto merge of #100064 - RalfJung:disaligned, r=petrochenkov
fix is_disaligned logic for nested packed structs

https://github.com/rust-lang/rust/pull/83605 broke the `is_disaligned` logic by bailing out of the loop in `is_within_packed` early. This PR fixes that problem and adds suitable tests.

Fixes https://github.com/rust-lang/rust/issues/99838
2022-08-03 16:09:56 +00:00
Ralf Jung
9097ce9054 fix is_disaligned logic for nested packed structs 2022-08-03 09:59:08 -04:00
bors
04f72f9538 Auto merge of #100023 - saethlin:send-sync-chunksmut, r=m-ou-se
Add back Send and Sync impls on ChunksMut iterators

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

These were accidentally removed in #94247 because the representation was changed from `&mut [T]` to `*mut T`, which has `!Send + !Sync`.
2022-08-03 13:17:58 +00:00
bors
7308c22c6a Auto merge of #100100 - Dylan-DPC:rollup-llcaaq8, r=Dylan-DPC
Rollup of 5 pull requests

Successful merges:

 - #99371 (Remove synchronization from Windows `hashmap_random_keys`)
 - #99614 (do not claim that transmute is like memcpy)
 - #99738 (rustdoc: avoid inlining modules with duplicate names)
 - #99800 (Fix futex module imports on wasm+atomics)
 - #100079 (Replace `* -> vec` with `-> vec` in docs)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2022-08-03 10:26:01 +00:00
Dylan DPC
e92b2415aa
Rollup merge of #100079 - camelid:fix-doc-star-search, r=Dylan-DPC
Replace `* -> vec` with `-> vec` in docs

Fixes #100078.

Rustdoc's current syntax is `-> vec`.
2022-08-03 13:45:53 +05:30
Dylan DPC
8d465cc551
Rollup merge of #99800 - sandydoo:bugfix/wasm-futex, r=m-ou-se
Fix futex module imports on wasm+atomics

The futex modules were rearranged a bit in #98707, which meant that wasm+atomics would no longer compile on nightly. I don’t believe any other targets were impacted by this.
2022-08-03 13:45:52 +05:30
Dylan DPC
acf691234f
Rollup merge of #99738 - notriddle:notriddle/multiple-modules-w-same-name, r=camelid
rustdoc: avoid inlining modules with duplicate names

Fixes rust-lang/rust#99734
2022-08-03 13:45:51 +05:30
Dylan DPC
cb9932ea64
Rollup merge of #99614 - RalfJung:transmute-is-not-memcpy, r=thomcc
do not claim that transmute is like memcpy

Saying transmute is like memcpy is not a well-formed statement, since memcpy is by-ref whereas transmute is by-val. The by-val nature of transmute inherently means that padding is lost along the way. (This is not specific to transmute, this is how all by-value operations work.) So adjust the docs to clarify this aspect.

Cc `@workingjubilee`
2022-08-03 13:45:50 +05:30
Dylan DPC
5730f12b37
Rollup merge of #99371 - ChrisDenton:simplify-gen-random-keys, r=thomcc
Remove synchronization from Windows `hashmap_random_keys`

Unfortunately using synchronization when generating hashmap keys can prevent it being used in `DllMain`.

~~Fixes #99341~~
2022-08-03 13:45:49 +05:30
bors
e141246cbb Auto merge of #100082 - matthiaskrgr:rollup-ywu4iux, r=matthiaskrgr
Rollup of 6 pull requests

Successful merges:

 - #99933 (parallelize HTML checking tool)
 - #99958 (Improve position named arguments lint underline and formatting names)
 - #100008 (Update all pre-cloned submodules on startup)
 - #100049 (⬆️ rust-analyzer)
 - #100070 (Clarify Cargo.toml comments)
 - #100074 (rustc-docs: Be less specific about the representation of `+bundle`)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2022-08-03 04:50:42 +00:00
Ralf Jung
2bde0e7bbc update anyhow 2022-08-02 22:14:48 -04:00
bors
b759b2efad Auto merge of #99509 - lcnr:commit_unconditionally, r=jackh726
remove `commit_unconditionally`

`commit_unconditionally` is a noop unless we somehow inspect the current state of our snapshot. The only thing which does that is the leak check which was only used in one place where `commit_if_ok` is probably at least as, or even more, correct.

r? rust-lang/types
2022-08-03 01:55:20 +00:00
Ralf Jung
da3e11fc42 wordsmithing 2022-08-02 20:43:48 -04:00
Michael Howell
8724ca3114 rustdoc: avoid inlining foreigns with duplicate names 2022-08-02 14:48:23 -07:00
bors
e4417cf020 Auto merge of #92268 - jswrenn:transmute, r=oli-obk
Initial implementation of transmutability trait.

*T'was the night before Christmas and all through the codebase, not a miri was stirring — no hint of `unsafe`!*

This PR provides an initial, **incomplete** implementation of *[MCP 411: Lang Item for Transmutability](https://github.com/rust-lang/compiler-team/issues/411)*. The `core::mem::BikeshedIntrinsicFrom` trait provided by this PR is implemented on-the-fly by the compiler for types `Src` and `Dst` when the bits of all possible values of type `Src` are safely reinterpretable as a value of type `Dst`.

What this PR provides is:
- [x] [support for transmutations involving primitives](https://github.com/jswrenn/rust/tree/transmute/src/test/ui/transmutability/primitives)
- [x] [support for transmutations involving arrays](https://github.com/jswrenn/rust/tree/transmute/src/test/ui/transmutability/arrays)
- [x] [support for transmutations involving structs](https://github.com/jswrenn/rust/tree/transmute/src/test/ui/transmutability/structs)
- [x] [support for transmutations involving enums](https://github.com/jswrenn/rust/tree/transmute/src/test/ui/transmutability/enums)
- [x] [support for transmutations involving unions](https://github.com/jswrenn/rust/tree/transmute/src/test/ui/transmutability/unions)
- [x] [support for weaker validity checks](https://github.com/jswrenn/rust/blob/transmute/src/test/ui/transmutability/unions/should_permit_intersecting_if_validity_is_assumed.rs) (i.e., `Assume::VALIDITY`)
- [x] visibility checking

What isn't yet implemented:
- [ ] transmutability options passed using the `Assume` struct
- [ ] [support for references](https://github.com/jswrenn/rust/blob/transmute/src/test/ui/transmutability/references.rs)
- [ ] smarter error messages

These features will be implemented in future PRs.
2022-08-02 21:17:31 +00:00
Matthias Krüger
e20f7f83c0
Rollup merge of #100074 - petrochenkov:bundledoc, r=bjorn3
rustc-docs: Be less specific about the representation of `+bundle`

For https://github.com/rust-lang/rust/issues/99429.
r? `@bjorn3`
2022-08-02 23:07:49 +02:00
Matthias Krüger
7a6f461673
Rollup merge of #100070 - mqudsi:99768_revisited, r=RalfJung
Clarify Cargo.toml comments

Existing comments were left in an incoherent state after #99768.

r? `@RalfJung`
2022-08-02 23:07:48 +02:00
Matthias Krüger
a15500cdf0
Rollup merge of #100049 - lnicola:rust-analyzer-2022-08-02, r=lnicola
⬆️ rust-analyzer

r? `@ghost`
2022-08-02 23:07:47 +02:00
Matthias Krüger
4fbe53f70b
Rollup merge of #100008 - jyn514:eager-submodules, r=bjorn3
Update all pre-cloned submodules on startup

Fixes https://github.com/rust-lang/rust/issues/99083
2022-08-02 23:07:46 +02:00
Matthias Krüger
82feb4996c
Rollup merge of #99958 - PrestonFrom:issue_99907, r=compiler-errors
Improve position named arguments lint underline and formatting names

For named arguments used as implicit position arguments, underline both
the opening curly brace and either:
* if there is formatting, the next character (which will either be the
  closing curl brace or the `:` denoting the start of formatting args)
* if there is no formatting, the entire arg span (important if there is
  whitespace like `{  }`)

This should make it more obvious where the named argument should be.

Additionally, in the lint message, emit the formatting argument names
without a dollar sign to avoid potentially confusion.

Fixes #99907
2022-08-02 23:07:45 +02:00
Matthias Krüger
63cd10154d
Rollup merge of #99933 - alex:parallel-html-checking, r=Mark-Simulacrum
parallelize HTML checking tool

there's a lot of IO, so timings on my laptop are far from stable, but it seems to be considerably faster.

this step often appears to take 5+ minutes in CI, so hopefully this offers a speedup
2022-08-02 23:07:44 +02:00
Noah Lev
234bfc04b0 Replace * -> vec with -> vec in docs
Rustdoc's current syntax is `-> vec`.
2022-08-02 13:59:18 -07:00
Vadim Petrochenkov
2bbdc4158e rustc-docs: Be less specific about the representation of +bundle 2022-08-02 22:29:29 +03:00
Mahmoud Al-Qudsi
63e04eeb6d Clarify Cargo.toml comments
Existing comments were left in an incoherent state after #99768.
2022-08-02 12:50:06 -05:00
bors
4493a0f472 Auto merge of #100063 - matthiaskrgr:rollup-lznouys, r=matthiaskrgr
Rollup of 7 pull requests

Successful merges:

 - #99987 (Always include a position span in `rustc_parse_format::Argument`)
 - #100005 (Remove Clean trait for ast::Attribute and improve Attributes::from_ast)
 - #100025 (Remove redundant `TransferWrapper` struct)
 - #100045 (Properly reject the `may_unwind` option in `global_asm!`)
 - #100052 (RISC-V ASM test: relax label name constraint.)
 - #100053 (move [`assertions_on_result_states`] to restriction)
 - #100057 (Remove more Clean trait implementations)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2022-08-02 17:18:58 +00:00
Matthias Krüger
269d15fbf8
Rollup merge of #100057 - GuillaumeGomez:rm-more-clean-impl, r=Dylan-DPC
Remove more Clean trait implementations

Follow-up of https://github.com/rust-lang/rust/pull/99638.

r? ``@notriddle``
2022-08-02 17:17:37 +02:00
Matthias Krüger
446895ad21
Rollup merge of #100053 - flip1995:clippy_backport, r=xFrednet
move [`assertions_on_result_states`] to restriction

"Backports" the first commit of https://github.com/rust-lang/rust-clippy/pull/9273, so that the lint doesn't go into beta as a warn-by-default lint.

The other changes in the linked PR can ride the train as usual.

r? ``@xFrednet`` (only Clippy changes, so we don't need to bother compiler people)

---

For Clippy:

changelog: none
2022-08-02 17:17:36 +02:00
Matthias Krüger
0b3bbe6f9a
Rollup merge of #100052 - TimNN:patch-1, r=nikic
RISC-V ASM test: relax label name constraint.

The test is currently [broken at LLVM Head](https://buildkite.com/llvm-project/rust-llvm-integrate-prototype/builds/12425#01825d5b-c3d1-4fdc-a98d-5956b246aee2), likely since 260a641068:

```plain
/var/lib/buildkite-agent/builds/rust-llvm-integrate/llvm-project/rust-llvm-integrate-prototype/src/test/assembly/asm/riscv-types.rs:59:11: error: CHECK: expected string not found in input
--
  | // CHECK: lb t0, %pcrel_lo(.Lpcrel_hi0)(t0)
  | ^
  | /var/lib/buildkite-agent/builds/rust-llvm-integrate/llvm-project/rust-llvm-integrate-prototype/build/x86_64-unknown-linux-gnu/test/assembly/asm/riscv-types.riscv64/riscv-types.s:24:36: note: scanning from here
  | auipc t0, %pcrel_hi(extern_static)
  | ^
  | /var/lib/buildkite-agent/builds/rust-llvm-integrate/llvm-project/rust-llvm-integrate-prototype/build/x86_64-unknown-linux-gnu/test/assembly/asm/riscv-types.riscv64/riscv-types.s:25:2: note: possible intended match here
  | lb t0, %pcrel_lo(.Lpcrel_hi18)(t0)
  | ^
```

As far as I can tell, the exact index in the label probably doesn't matter for the test, especially if LLVM can change it to ~arbitrary values, though I'm not an ASM or RISC-V expert.

This [fixes the test](https://buildkite.com/llvm-project/rust-llvm-integrate-prototype/builds/12427).
2022-08-02 17:17:35 +02:00
Matthias Krüger
06333e092b
Rollup merge of #100045 - Amanieu:global_asm_may_unwind, r=tmiasko
Properly reject the `may_unwind` option in `global_asm!`

This was accidentally accepted even though it had no effect in
`global_asm!`. The option only makes sense for `asm!` which runs within
a function.
2022-08-02 17:17:34 +02:00
Matthias Krüger
1ce85b1c39
Rollup merge of #100025 - tmiasko:rm-transfer-wrapper, r=cjgillot
Remove redundant `TransferWrapper` struct
2022-08-02 17:17:33 +02:00
Matthias Krüger
e20b59977b
Rollup merge of #100005 - GuillaumeGomez:cleanup-ast-attr-clean, r=notriddle
Remove Clean trait for ast::Attribute and improve Attributes::from_ast

I prefer to keep this commit on its own for this PR because I'm changing a bit more things than expected originally: I split `Attributes::from_ast` into two because there is only one location making use of its second parameter.

Follow-up of https://github.com/rust-lang/rust/pull/99638.

r? `@notriddle`
2022-08-02 17:17:31 +02:00
Matthias Krüger
a0991b8ba8
Rollup merge of #99987 - Alexendoo:parse-format-position-span, r=fee1-dead
Always include a position span in `rustc_parse_format::Argument`

Moves the spans from the `Position` enum to always be included in the `Argument` struct. Doesn't make any changes to use it in rustc, but it will be useful for some upcoming Clippy lints
2022-08-02 17:17:30 +02:00
Jack Wrenn
965ffb0b5c safe transmute: fix broken intradoc link 2022-08-02 14:44:23 +00:00
bors
06f4950cbd Auto merge of #100032 - BoxyUwU:no_ty_in_placeholder_const, r=compiler-errors
make `PlaceholderConst` not store the type of the const

Currently the `Placeholder` variant on `ConstKind` is 28 bytes when with this PR its 8 bytes, i am not sure this is really useful at all rn since `Unevaluated` and `Value` variants are huge still but eventually it should be possible to get both down to 16 bytes 🤔. Mostly opening this to see if this change has any perf impact when done before it can make `ConstKind`/`ConstS` smaller
2022-08-02 13:10:49 +00:00
Guillaume Gomez
04f570aad0 Remove Clean trait implementation for ast::Attribute and cleanup Attributes::from_ast function by splitting it in two 2022-08-02 13:03:13 +02:00
Guillaume Gomez
f84a948df1 Remove Clean trait implementation for hir::Lifetime 2022-08-02 12:55:52 +02:00
Guillaume Gomez
fa14d02d9b Remove Clean trait implementation for ty::TraitRef 2022-08-02 12:55:52 +02:00
bors
792bc5a010 Auto merge of #99977 - BlackHoleFox:cfte-cstr, r=thomcc
Add validation to const fn CStr creation

Improves upon the existing validation that only worked when building the stdlib from source. `CStr::from_bytes_with_nul_unchecked` now utilizes `const_eval_select` to validate the safety requirements of the function when used as `const FOO: &CStr = CStr::from_bytes_with_nul_unchecked(b"Foobar\0");`.

This can help catch erroneous code written by accident and, assuming a new enough `rustc` in use, remove the need for boilerplate safety comments for this function in `const` contexts.

~~I think this might need a UI test, but I don't know where to put it. If this is a worth change, a perf run would be nice to make sure the `O(n)` validation isn't too bad. I didn't notice a difference building the stdlib tests locally.~~
2022-08-02 09:07:31 +00:00
tabokie
b608ec8f41
move [assertions_on_result_states] to restriction
Signed-off-by: tabokie <xy.tao@outlook.com>
2022-08-02 10:13:51 +02:00
Tim Neumann
efa9586427
RISC-V ASM test: relax label name constraint. 2022-08-02 10:10:11 +02:00
Preston From
298acef307 Move if-block into closure to reduce duplicate code 2022-08-02 00:20:44 -06:00
Preston From
d0ea440dfe Improve position named arguments lint underline and formatting names
For named arguments used as implicit position arguments, underline both
the opening curly brace and either:
* if there is formatting, the next character (which will either be the
  closing curl brace or the `:` denoting the start of formatting args)
* if there is no formatting, the entire arg span (important if there is
  whitespace like `{  }`)

This should make it more obvious where the named argument should be.

Additionally, in the lint message, emit the formatting argument names
without a dollar sign to avoid potentially confusion.

Fixes #99907
2022-08-02 00:20:44 -06:00
bors
ca37a45232 Auto merge of #100048 - matthiaskrgr:rollup-agimvm6, r=matthiaskrgr
Rollup of 8 pull requests

Successful merges:

 - #99156 (`codegen_fulfill_obligation` expect erased regions)
 - #99293 (only run --all-targets in stage0 for Std)
 - #99779 (Fix item info pos and height)
 - #99994 (Remove `guess_head_span`)
 - #100011 (Use Parser's `restrictions` instead of `let_expr_allowed`)
 - #100017 (kmc-solid: Update `Socket::connect_timeout` to be in line with #78802)
 - #100037 (Update rustc man page to match `rustc --help`)
 - #100042 (Update books)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2022-08-02 06:09:22 +00:00
Laurențiu Nicola
30a3706786 ⬆️ rust-analyzer 2022-08-02 09:05:16 +03:00
Matthias Krüger
6ab19fd4f5
Rollup merge of #100042 - ehuss:update-books, r=ehuss
Update books

## reference

2 commits in a92be0fef439b3d8e0468d82cb24812d303520a0..f3d3953bf3b158d596c96d55ce5366f9f3f972e9
2022-07-21 19:01:23 -0700 to 2022-08-01 17:17:37 -0700
- Add `let_chains` references (rust-lang/reference#1179)
- Remove outdated warning (rust-lang/reference#1243)

## rust-by-example

18 commits in 3155db49b0d57cd82c65456ac210b69ecec5ccb1..ee342dc91e1ba1bb1e1f1318f84bbe3bfac04798
2022-07-05 20:35:53 -0300 to 2022-07-27 11:06:36 -0300
- Closure inferred twice (rust-lang/rust-by-example#1588)
- fix a syntax bug in example assembly (rust-lang/rust-by-example#1511)
- Minor grammar change in src/std/rc.md paragraph 2 (rust-lang/rust-by-example#1586)
- Fix typo in asm.md (rust-lang/rust-by-example#1585)
- Fix incorrect padding in fixed-width print (rust-lang/rust-by-example#1584)
- Update print.md (rust-lang/rust-by-example#1582)
- add-chapter-on-defaults (rust-lang/rust-by-example#1580)
- Fix typo (rust-lang/rust-by-example#1579)
- fix a compile error (rust-lang/rust-by-example#1578)
- Suggest using mod.rs pattern to share test code (rust-lang/rust-by-example#1577)
- fix a compile error in iter_any.md (rust-lang/rust-by-example#1576)
- Mention attribute like macros in attributes.md (rust-lang/rust-by-example#1574)
- Update exercise to be clearer (rust-lang/rust-by-example#1573)
- fixes link for turbofish in testcase_mapreduce.md (rust-lang/rust-by-example#1572)
- Fix inconsistency between comment and code in hello/print.md (rust-lang/rust-by-example#1571)
- Fixes a typo in print.md (rust-lang/rust-by-example#1570)
- into_iter-moves-elements (rust-lang/rust-by-example#1569)
- Fix a typo in print.md (rust-lang/rust-by-example#1568)

## rustc-dev-guide

16 commits in d5201cddace979b299ec1bf9fd8997338151aa9d..04f3cf0bb2f5a6ee2bfc4b1a6a6cd8c11d1c5531
2022-07-21 04:48:49 +0200 to 2022-07-31 07:46:57 +0200
- address review comment
- accept review suggestion
- try address review comments
- summary of chapter
- Update src/building/compiler-documenting.md
- revamp doc-build chapter
- minor fixes
- Prefer relative links
- Fix the link to clippy docs
- Fix the link to `ResolverAstLowering`
- Fix the link to `ProcMacro` trait
- Fix the link to `Lazy&lt;T&gt;`
- Add instructions to fix build errors in std after adding a new target
- Document how to build a cross-compiler
- Add documentation about Microsoft provided debuggers and CodeView/PDB… (rust-lang/rustc-dev-guide#1406)
- rust-analyzer is now a subtree

## embedded-book

2 commits in 766979590da8100998f0d662499d4a901d8d1640..befe6840874311635c417cf731377f07234ee373
2022-07-04 09:13:58 +0000 to 2022-07-25 07:51:14 +0000
- Updated instructions for running first Hardware example  (rust-embedded/book#323)
- Improved ligability for hardware.md  (rust-embedded/book#324)
2022-08-02 07:30:47 +02:00
Matthias Krüger
703ee5c3f4
Rollup merge of #100037 - fw-immunant:patch-1, r=jyn514
Update rustc man page to match `rustc --help`

This brings the `--crate-type`,  `--emit`, and `--print` options' allowed arguments into sync with that printed by `rustc --help`.

c.f. the `opt::multi_s` calls for `"crate-type"`, `"emit"`, and `"print"` here: https://github.com/rust-lang/rust/blob/master/compiler/rustc_session/src/config.rs
2022-08-02 07:30:46 +02:00
Matthias Krüger
042bba799b
Rollup merge of #100017 - solid-rs:patch/kmc-solid/adapt-to-78802, r=thomcc
kmc-solid: Update `Socket::connect_timeout` to be in line with #78802

Fixes the build failure of the [`*-kmc-solid_*`](https://doc.rust-lang.org/nightly/rustc/platform-support/kmc-solid.html) Tier 3 targets after #78802.

```
error[E0308]: mismatched types
   --> library\std\src\sys\solid\net.rs:234:45
    |
234 |             cvt(netc::connect(self.0.raw(), addrp, len))
    |                 -------------               ^^^^^ expected *-ptr, found union `SocketAddrCRepr`
    |                 |
    |                 arguments to this function are incorrect
    |
    = note: expected raw pointer `*const sockets::sockaddr`
                     found union `SocketAddrCRepr`
note: function defined here
   --> library\std\src\sys\solid\abi\sockets.rs:173:12
    |
    173 |     pub fn connect(s: c_int, name: *const sockaddr, namelen: socklen_t) -> c_int;
    |            ^^^^^^^
```
2022-08-02 07:30:45 +02:00
Matthias Krüger
beb4cdddde
Rollup merge of #100011 - compiler-errors:let-chain-restriction, r=fee1-dead
Use Parser's `restrictions` instead of `let_expr_allowed`

This also means that the `ALLOW_LET` flag is reset properly for subexpressions, so we can properly deny things like `a && (b && let c = d)`. Also the parser is a tiny bit smaller now.

It doesn't reject _all_ bad `let` expr usages, just a bit more.

cc `@c410-f3r`
2022-08-02 07:30:44 +02:00