Commit Graph

226498 Commits

Author SHA1 Message Date
bors 10b7e468f3 Auto merge of #96875 - SabrinaJewson:noop-waker, r=m-ou-se
Add `task::Waker::noop`

I have found myself reimplementing this function many times when I need a `Context` but don't have a runtime or `futures` to hand.

Prior art: [`futures::task::noop_waker`](https://docs.rs/futures/0.3/futures/task/fn.noop_waker.html) and [`futures::task::noop_waker_ref`](https://docs.rs/futures/0.3/futures/task/fn.noop_waker_ref.html)

Tracking issue: https://github.com/rust-lang/rust/issues/98286

Unresolved questions:
1. Should we also add `RawWaker::noop()`? (I don't think so, I can't think of a use case for it)
2. Should we also add `Context::noop()`? Depending on the future direction `Context` goes a "noop context" might not even make sense in future.
3. Should it be an associated constant instead? That would allow for `let cx = &mut Context::from_waker(&Waker::NOOP);` to work on one line which is pretty nice. I don't really know what the guideline is here.

r? rust-lang/libs-api `@rustbot` label +T-libs-api -T-libs
2023-06-07 06:04:32 +00:00
bors b3dd578767 Auto merge of #111819 - nikarh:vita-improved, r=Amanieu
Improved std support for ps vita target

Fixed a couple of things in std support for ps vita via Vita SDK newlib oss implementation:

- Added missing hardware features to target spec
- Compile in thumb by default (newlib is also compiled in thumb)
- Fixed fs calls. Vita newlib has a not-very-posix dirent. Also vita does not expose inodes, it's stubbed as 0 in stat, and I'm stubbing it here for dirent (because vita newlibs's dirent doesn't even have that field)
- Enabled signal handlers for panic unwinding
- Dropped static link requirement from the platform support md. Also, rearranged sections to better stick with the template.
2023-06-07 03:20:15 +00:00
bohan 5eafab30ba feat(expand): emit note for doc comment in macro matcher 2023-06-07 10:20:36 +08:00
Nicholas Nethercote 853345635b Move `mono_item_placement` construction.
It's currently created in `place_inlined_mono_items` and then used in
`internalize_symbols`. This commit moves the creation to
`internalize_symbols`.
2023-06-07 11:02:15 +10:00
Nicholas Nethercote 1defd30764 Remove `PlacedRootMonoItems::roots`.
It's no longer used.
2023-06-07 10:27:00 +10:00
Nicholas Nethercote 8dbb3475b9 Split loop in `place_inlined_mono_item`.
This loop is doing two different things. For inlined items, it's adding
them to the CGU. For all items, it's recording them in
`mono_item_placements`.

This commit splits it into two separate loops. This avoids putting root
mono items into `reachable`, and removes the low-value check that
`roots` doesn't contain inlined mono items.
2023-06-07 10:27:00 +10:00
Nicholas Nethercote fe3b646565 Merge the two loops in `internalize_symbols`.
Because they have a lot of overlap.
2023-06-07 10:27:00 +10:00
Nicholas Nethercote 392045b7e7 Make the two loops in `internalize_symbols` have the same form.
Because the next commit will merge them.
2023-06-07 10:27:00 +10:00
Nicholas Nethercote 9fd6d97915 Improve sorting in `debug_dump`.
Currently it sorts by symbol name, which is a mangled name like
`_ZN1a4main17hb29587cdb6db5f42E`, which leads to non-obvious orderings.

This commit changes it to use the existing
`items_in_deterministic_order`, which iterates in source code order.
2023-06-07 10:26:58 +10:00
bors 7b28a6b08a Auto merge of #111495 - Kobzol:dist-tests, r=Mark-Simulacrum
Run tests on PGO/LTO/BOLT optimized dist artifacts

This PR adds baisc tests for the optimized dist builds on x64 Linux and Windows. A subset of the test suite is run, so it's not perfect, but it's better than the status quo (which is basically no testing at all, apart from the perf bot on Linux).

r? `@ghost`
2023-06-07 00:14:06 +00:00
Jing Peng ade6c36e53 fix
- remove useless commands from test Makefile
- do not unnecessarily remove metadata temporary files because they'll be managed by MaybeTempDir
- remove unused FailedRemove error introduced by this PR
2023-06-06 17:54:34 -04:00
Jing Peng 9b1a1e1d95 Write to stdout if `-` is given as output file
If `-o -` or `--emit KIND=-` is provided, output will be written
to stdout instead. Binary output (`obj`, `llvm-bc`, `link` and
`metadata`) being written this way will result in an error unless
stdout is not a tty. Multiple output types going to stdout will
trigger an error too, as they will all be mixded together.
2023-06-06 17:53:29 -04:00
bors afab3662eb Auto merge of #112361 - matthiaskrgr:rollup-39zxrw1, r=matthiaskrgr
Rollup of 8 pull requests

Successful merges:

 - #111250 (Add Terminator conversion from MIR to SMIR, part #2)
 - #112310 (Add new Tier-3 targets: `loongarch64-unknown-none*`)
 - #112334 (Add myself to highfive rotation)
 - #112340 (remove `TyCtxt::has_error_field` helper method)
 - #112343 (Prevent emitting `missing_docs` for `pub extern crate`)
 - #112350 (Avoid duplicate type sanitization of local decls in borrowck)
 - #112356 (Fix comment for `get_region_var_origins`)
 - #112358 (Remove default visitor impl in region constraint generation)

r? `@ghost`
`@rustbot` modify labels: rollup
2023-06-06 21:28:34 +00:00
Matthias Krüger 63e0423cde
Rollup merge of #112358 - Nilstrieb:fancy-more-borrowck-cleanups, r=compiler-errors
Remove default visitor impl in region constraint generation

I wanted to group it together with other possibly minor borrowck cleanups but that's all I have right now so I rather put it up than forget about it before doing something else.

r? `@compiler-errors`
2023-06-06 22:00:21 +02:00
Matthias Krüger 53881f91b0
Rollup merge of #112356 - Nilstrieb:get-region-var-origins, r=compiler-errors
Fix comment for `get_region_var_origins`

#109753 changed the logic but not the comment.

r? `@compiler-errors`
2023-06-06 22:00:21 +02:00
Matthias Krüger fd6efcf960
Rollup merge of #112350 - Nilstrieb:borrow-me-some-cleanups, r=compiler-errors
Avoid duplicate type sanitization of local decls in borrowck

The type of the local decl is already sanitized in `visit_local_decl`.
2023-06-06 22:00:20 +02:00
Matthias Krüger 38ddff516c
Rollup merge of #112343 - GuillaumeGomez:extern-crate-missing-docs, r=notriddle
Prevent emitting `missing_docs` for `pub extern crate`

Fixes #112308.

r? `@notriddle`
2023-06-06 22:00:20 +02:00
Matthias Krüger e937fa49dd
Rollup merge of #112340 - lcnr:tyctxt-cleanup, r=compiler-errors
remove `TyCtxt::has_error_field` helper method
2023-06-06 22:00:20 +02:00
Matthias Krüger 319a905a92
Rollup merge of #112334 - fee1-dead-contrib:add-rotation, r=Nilstrieb
Add myself to highfive rotation
2023-06-06 22:00:19 +02:00
Matthias Krüger 157d0f03ab
Rollup merge of #112310 - loongarch-rs:bare-metal, r=WaffleLapkin
Add new Tier-3 targets: `loongarch64-unknown-none*`

This PR adds new Tier-3 targets `loongarch64-unknown-none*` that are introduced by MCP rust-lang/compiler-team#628
2023-06-06 22:00:19 +02:00
Matthias Krüger 1788d49789
Rollup merge of #111250 - spastorino:smir-terminator-2, r=oli-obk
Add Terminator conversion from MIR to SMIR, part #2

r? `@oli-obk`
2023-06-06 22:00:18 +02:00
Nilstrieb 70980929b4 Respect `RUST_BACKTRACE` for delayed bugs
Sometimes, especially with MIR validation, the backtraces from delayed
bugs are noise and make it harder to look at them. Respect the
environment variable and don't print it when the user doesn't want it.
2023-06-06 19:24:33 +00:00
Michael Howell 0f1aaef7e9 rustdoc: convert `if let Some()` that always matches to variable 2023-06-06 12:20:54 -07:00
Nilstrieb 459bd2cbde Remove default visitor impl in region constraint generation 2023-06-06 19:00:47 +00:00
Nilstrieb 5593e7e2ba Avoid duplicate type sanitization of local decls
The type of the local decl is already sanitized in `visit_local_decl`.
2023-06-06 18:52:47 +00:00
Nilstrieb 0e01088f07 Fix comment for `get_region_var_origins` 2023-06-06 18:50:38 +00:00
Michael Goulet 3ea7c512bd Fall back to bidirectional normalizes-to if no subst-eq in alias-eq goal 2023-06-06 18:44:22 +00:00
Michael Goulet 7a2cdf20e4 Move alias-relate to its own module 2023-06-06 18:44:22 +00:00
Michael Goulet aabdeedc7c bless coherence test 2023-06-06 18:43:20 +00:00
Michael Goulet 3d4da98273 Make TraitEngine::new use the right solver, add compare mode 2023-06-06 18:43:20 +00:00
Michael Goulet b637048a89 Add -Ztrait-solver=next-coherence 2023-06-06 18:43:20 +00:00
Michael Goulet e0acff796a New trait solver is a property of inference context 2023-06-06 18:43:06 +00:00
bors b2b34bd831 Auto merge of #112344 - matthiaskrgr:rollup-tswr83e, r=matthiaskrgr
Rollup of 7 pull requests

Successful merges:

 - #111058 (Correct fortanix LVI test print function)
 - #111369 (Added custom risc32-imac for esp-espidf target)
 - #111962 (Make GDB Python Pretty Printers loadable after spawning GDB, avoiding required `rust-gdb`)
 - #112019 (Don't suggest changing `&self` and `&mut self` in function signature to be mutable when taking `&mut self` in closure)
 - #112199 (Fix suggestion for matching struct with `..` on both ends)
 - #112220 (Cleanup some `EarlyBinder::skip_binder()` -> `EarlyBinder::subst_identity()`)
 - #112325 (diagnostics: do not suggest type name tweaks on type-inferred closure args)

r? `@ghost`
`@rustbot` modify labels: rollup
2023-06-06 17:56:23 +00:00
bohan c927743b7b fix(expand): prevent infinity loop in macro containing only "///" 2023-06-06 23:11:08 +08:00
Nikolay Arhipov 032857e7e4 Bumped libc version 2023-06-06 16:09:05 +03:00
Matthias Krüger 38c92cca65
Rollup merge of #112325 - notriddle:notriddle/issue-111932, r=compiler-errors
diagnostics: do not suggest type name tweaks on type-inferred closure args

Fixes #111932
2023-06-06 12:00:34 +02:00
Matthias Krüger 7c76f3b9d8
Rollup merge of #112220 - kylematsuda:earlybinder-fix, r=compiler-errors
Cleanup some `EarlyBinder::skip_binder()` -> `EarlyBinder::subst_identity()`

fix some incorrect `skip_binder()`'s as identified in https://github.com/rust-lang/rust/pull/112006#pullrequestreview-1448369203

r? ``@compiler-errors`` ``@lcnr`` ``@jackh726``

(hope it's alright to just tag everyone who commented 😅)
2023-06-06 12:00:34 +02:00
Matthias Krüger 71a72ee34a
Rollup merge of #112199 - jieyouxu:issue-112188, r=compiler-errors
Fix suggestion for matching struct with `..` on both ends

### Before This PR

```
error: expected `}`, found `,`
 --> src\main.rs:8:17
  |
8 |         Foo { .., x, .. } => (),
  |               --^
  |               | |
  |               | expected `}`
  |               `..` must be at the end and cannot have a trailing comma
  |
help: move the `..` to the end of the field list
  |
8 -         Foo { .., x, .. } => (),
8 +         Foo { .., x,  , .. } => (),
  |
```

### After This PR

```
error: expected `}`, found `,`
  --> tests/ui/parser/issue-112188.rs:11:17
   |
11 |     let Foo { .., x, .. } = f; //~ ERROR expected `}`, found `,`
   |               --^-
   |               | |
   |               | expected `}`
   |               `..` must be at the end and cannot have a trailing comma
   |               help: remove the starting `..`
```

Fixes #112188.
2023-06-06 12:00:33 +02:00
Matthias Krüger 21e7463bf8
Rollup merge of #112019 - jieyouxu:issue-111554, r=compiler-errors
Don't suggest changing `&self` and `&mut self` in function signature to be mutable when taking `&mut self` in closure

Current suggestion for when taking a mutable reference to `self` in a closure (as an upvar) will produce a machine-applicable suggestion to change the `self` in the function signature to `mut self`, but does not account for the specialness of implicit self in that it can already have `&` and `&mut` (see #111554). This causes the function signature to become `test(&mut mut self)` which does not seem desirable.

```
error[E0596]: cannot borrow `self` as mutable, as it is not declared as mutable
   --> src/sound_player.rs:870:11
    |
869 |     pub fn test(&mut self) {
    |                      ---- help: consider changing this to be mutable: `mut self`
870 |     || test2(&mut self);
    |              ^^^^^^^^^ cannot borrow as mutable
```

This PR suppresses the "changing this to be mutable" suggestion if the implicit self is either `ImplicitSelfKind::ImmRef` or `ImplicitSelfKind::MutRef`.

Fixes #111554.
2023-06-06 12:00:33 +02:00
Matthias Krüger 29871d5480
Rollup merge of #111962 - theIDinside:better-gdb, r=Mark-Simulacrum
Make GDB Python Pretty Printers loadable after spawning GDB, avoiding required `rust-gdb`

Fixes #111961

Makes the Python pretty printer library source'able from within GDB after spawn, making the wrapper script `rust-gdb` become not the required approach to use the pretty printer library.

Allows for integration into GUI:s that wrap GDB extremely easy. The previous design complicates this feature.
2023-06-06 12:00:32 +02:00
Matthias Krüger c4e11dc327
Rollup merge of #111369 - Nassiel:master, r=oli-obk
Added custom risc32-imac for esp-espidf target

ESP32-C6 and the upcoming ESP32-P4 are the first Espressif chips that support the "A" (atomic) extension of the RISCV specification.
As such, they do not work with the existing `riscv32imc-esp-espidf` target and instead need a new one (in this PR) called `riscv32imac-esp-espidf`.
2023-06-06 12:00:32 +02:00
Matthias Krüger 92327c05f1
Rollup merge of #111058 - fortanix:raoul/fix_lvi_mitigations, r=cuviper
Correct fortanix LVI test print function

A recent change resulted in a different machine code for the `print` function. This caused the LVI test for this function to fail. This PR:

- Fixes the test for the `print` function
- Simplified the test a bit so future modifications are more unlikely

cc: ``@jethrogb``
2023-06-06 12:00:31 +02:00
Guillaume Gomez 550fe634bf Add regression test for #112308 2023-06-06 11:50:24 +02:00
Guillaume Gomez 4711c3078a Prevent emitting `missing_docs` for `pub extern crate` 2023-06-06 11:50:04 +02:00
bors 3572d7451d Auto merge of #112312 - nikic:llvm-16.0.5, r=cuviper
Update to LLVM 16.0.5

Rebase to LLVM 16.0.5, plus one cherry-pick.

Fixes #111823.
Fixes #112061.
Fixes #112170.
2023-06-06 09:40:31 +00:00
lcnr 01aaad3f1f remove `has_error_field` helper method 2023-06-06 09:37:30 +02:00
Laurențiu Nicola a3cc503876 Fix rust-analyzer proc macro server 2023-06-06 10:33:32 +03:00
Deadbeef aaca1712db Add myself to highfive rotation 2023-06-06 03:15:52 +00:00
WANG Rui bd32075934 Add new Tier-3 targets: `loongarch64-unknown-none*`
MCP: https://github.com/rust-lang/compiler-team/issues/628
2023-06-06 10:55:52 +08:00
John Kåre Alsaker fd3d2d49f2 Don't hold the active queries lock while calling `make_query` 2023-06-06 04:51:34 +02:00