Commit Graph

1558 Commits

Author SHA1 Message Date
Matthias Krüger
9d24ecc37b
Rollup merge of #125241 - Veykril:tool-rust-analyzer, r=davidtwco
Add `rust_analyzer` as a predefined tool

Given all the other rust-lang tools have it, I'd expect r-a to have it too. (we have a few ideas for using this https://github.com/rust-lang/rust-analyzer/issues/11556).
2024-06-24 15:06:21 +02:00
Jubilee Young
26dccadb47 Allow "C-unwind" fn to have C variadics 2024-06-22 15:14:14 -07:00
Guillaume Gomez
3ed2cd74b5
Rollup merge of #126686 - fmease:dump-preds-n-item-bounds, r=compiler-errors
Add `#[rustc_dump_{predicates,item_bounds}]`

Conflicts with #126668.

As discussed
r? compiler-errors CC ``@fee1-dead``
2024-06-22 12:57:19 +02:00
León Orell Valerian Liehr
38bd7a0fcb
Add #[rustc_dump_{predicates,item_bounds}] 2024-06-22 06:34:09 +02:00
Jubilee
e7956cd994
Rollup merge of #126530 - beetrees:f16-inline-asm-riscv, r=Amanieu
Add `f16` inline ASM support for RISC-V

This PR adds `f16` inline ASM support for RISC-V. A `FIXME` is left for `f128` support as LLVM does not support the required `Q` (Quad-Precision Floating-Point) extension yet.

Relevant issue: #125398
Tracking issue: #116909

`@rustbot` label +F-f16_and_f128
2024-06-21 21:02:26 -07:00
beetrees
771e44ebd3
Add f16 inline ASM support for RISC-V 2024-06-21 18:48:20 +01:00
bors
25c9f2ca06 Auto merge of #123165 - oli-obk:no_ord_def_id3, r=cjgillot
Stop sorting `Span`s' `SyntaxContext`, as that is incompatible with incremental

work towards https://github.com/rust-lang/rust/issues/90317

Luckily no one actually needed these to be sorted, so it didn't even affect diagnostics. I'm guessing they'd have been sorted by creation time anyway, so it wouldn't really have mattered.

r? `@cjgillot`
2024-06-21 13:47:43 +00:00
Lukas Wirth
339015920d Add rust_analyzer as a predefined tool 2024-06-21 12:10:18 +02:00
Scott McMurray
55d13379ac [GVN] Add tests for generic pointees with PtrMetadata 2024-06-20 22:16:59 -07:00
Vadim Petrochenkov
4d3b617911 rustc_span: Optimize span parent get/set methods 2024-06-20 17:02:13 +03:00
fee1-dead
be3b5663ae
Rollup merge of #126668 - fmease:rm-rustc_dump_program_clauses-attrs, r=fee1-dead
Remove now NOP attrs `#[rustc_dump{,_env}_program_clauses]`

Likely NOP since #113303.

r? `@fee1-dead`
2024-06-19 22:51:03 +08:00
León Orell Valerian Liehr
c894ece8fe
Remove now NOP attrs #[rustc_dump{,_env}_program_clauses] 2024-06-19 09:19:09 +02:00
许杰友 Jieyou Xu (Joe)
8eb2e5f4c8
Rollup merge of #125293 - dingxiangfei2009:tail-expr-temp-lifetime, r=estebank,davidtwco
Place tail expression behind terminating scope

This PR implements #123739 so that we can do further experiments in nightly.

A little rewrite has been applied to `for await` lowering. It was previously `unsafe { Pin::unchecked_new(into_async_iter(..)) }`. Under the edition 2024 rule, however, `into_async_iter` gets dropped at the end of the `unsafe` block. This presumably the first Edition 2024 migration rule goes by hoisting `into_async_iter(..)` into `match` one level above, so it now looks like the following.
```rust
match into_async_iter($iter_expr) {
  ref mut iter => match unsafe { Pin::unchecked_new(iter) } {
    ...
  }
}
```
2024-06-19 01:51:38 +01:00
Ding Xiang Fei
0f8c3f7882
tail expression behind terminating scope 2024-06-18 04:14:43 +08:00
Vadim Petrochenkov
91d05ba557 [perf] More span update benchmarking 2024-06-17 16:26:56 +03:00
bors
6b65c30f8e Auto merge of #126543 - petrochenkov:upctxt4, r=cjgillot
rustc_span: Optimize more hygiene operations using `Span::map_ctxt`

I missed these in https://github.com/rust-lang/rust/pull/125017.
2024-06-16 23:34:12 +00:00
Vadim Petrochenkov
14da80c372 rustc_span: Minor improvements
Introduce `{IndexNewtype,SyntaxContext}::from_u16` for convenience because small indices are sometimes encoded as `u16`.
Use `SpanData::span` instead of `Span::new` where appropriate.
Add a clarifying comment about decoding span parents.
2024-06-16 14:08:25 +03:00
Vadim Petrochenkov
c6c1c992e2 rustc_span: Optimize more hygiene operations using Span::map_ctxt 2024-06-16 13:30:43 +03:00
Matthias Krüger
5fac57284e
Rollup merge of #125829 - petrochenkov:upctxt2, r=michaelwoerister
rustc_span: Add conveniences for working with span formats

This is the refactoring part of https://github.com/rust-lang/rust/pull/125017.
2024-06-15 14:40:47 +02:00
bors
f8e5660532 Auto merge of #118958 - c410-f3r:concat-again, r=petrochenkov
Add a new concat metavar expr

Revival of #111930

Giving it another try now that #117050 was merged.

With the new rules, meta-variable expressions must be referenced with a dollar sign (`$`) and this can cause misunderstands with `$concat`.

```rust
macro_rules! foo {
    ( $bar:ident ) => {
        const ${concat(VAR, bar)}: i32 = 1;
    };
}

// Will produce `VARbar` instead of `VAR_123`
foo!(_123);
```

In other words, forgetting the dollar symbol can produce undesired outputs.

cc #29599
cc https://github.com/rust-lang/rust/issues/124225
2024-06-14 16:41:39 +00:00
Caio
4b82afb40c Add a new concat metavar expr 2024-06-13 22:12:26 -03:00
Vadim Petrochenkov
220f3ec99f rustc_span: Remove transmutes from span encoding 2024-06-13 20:12:50 +03:00
Vadim Petrochenkov
6fea953267 rustc_span: By-value interface for ctxt update 2024-06-13 19:29:24 +03:00
Vadim Petrochenkov
4440f50996 rustc_span: Add conveniences for working with span formats 2024-06-13 19:29:24 +03:00
Michael Goulet
d3812ac95f LangItem-ify Coroutine trait in solvers 2024-06-13 09:34:28 -04:00
Vadim Petrochenkov
d5dd2d8284 rustc_span: Optimize syntax context updates in spans 2024-06-10 02:20:16 +03:00
Ralf Jung
eb584a23bf offset_of: allow (unstably) taking the offset of slice tail fields 2024-06-08 18:17:55 +02:00
carbotaniuman
67f5dd1ef1 Parse unsafe attributes 2024-06-06 20:26:27 -05:00
bors
2d28b6384e Auto merge of #124482 - spastorino:unsafe-extern-blocks, r=oli-obk
Unsafe extern blocks

This implements RFC 3484.

Tracking issue #123743 and RFC https://github.com/rust-lang/rfcs/pull/3484

This is better reviewed commit by commit.
2024-06-06 08:14:58 +00:00
Matthias Krüger
79bb336b9c
Rollup merge of #125921 - Zalathar:buckets, r=oli-obk
coverage: Carve out hole spans in a separate early pass

When extracting spans from MIR for use in coverage instrumentation, we sometimes need to identify *hole spans* (currently just closures), and carve up the other spans so that they don't overlap with holes.

This PR simplifies the main coverage-span-refiner by extracting the hole-carving process into a separate early pass. That pass produces a series of independent buckets, and we run the span-refiner on each bucket separately.

There is almost no difference in the resulting mappings, other than in some edge cases involving macros.
2024-06-05 18:21:11 +02:00
Santiago Pastorino
0380321e78
Add unsafe_extern_blocks feature flag 2024-06-05 09:35:57 -03:00
Santiago Pastorino
2a377122dd
Handle safety keyword for extern block inner items 2024-06-04 14:19:42 -03:00
Zalathar
df96cba432 Add Span::trim_end
This is the counterpart of `Span::trim_start`.
2024-06-04 13:11:45 +10:00
Zalathar
e609c9b254 Add unit tests for Span::trim_start 2024-06-04 13:11:45 +10:00
Vadim Petrochenkov
8530285f4e rustc_span: Inline some hot functions 2024-06-03 01:01:18 +03:00
bors
99cb42c296 Auto merge of #124662 - zetanumbers:needs_async_drop, r=oli-obk
Implement `needs_async_drop` in rustc and optimize async drop glue

This PR expands on #121801 and implements `Ty::needs_async_drop` which works almost exactly the same as `Ty::needs_drop`, which is needed for #123948.

Also made compiler's async drop code to look more like compiler's regular drop code, which enabled me to write an optimization where types which do not use `AsyncDrop` can simply forward async drop glue to `drop_in_place`. This made size of the async block from the [async_drop test](67980dd6fb/tests/ui/async-await/async-drop.rs) to decrease by 12%.
2024-05-31 10:12:24 +00:00
bors
91c0823ee6 Auto merge of #124636 - tbu-:pr_env_unsafe, r=petrochenkov
Make `std::env::{set_var, remove_var}` unsafe in edition 2024

Allow calling these functions without `unsafe` blocks in editions up until 2021, but don't trigger the `unused_unsafe` lint for `unsafe` blocks containing these functions.

Fixes #27970.
Fixes #90308.
CC #124866.
2024-05-30 12:17:06 +00:00
Tobias Bucher
5d8f9b4dc1 Make std::env::{set_var, remove_var} unsafe in edition 2024
Allow calling these functions without `unsafe` blocks in editions up
until 2021, but don't trigger the `unused_unsafe` lint for `unsafe`
blocks containing these functions.

Fixes #27970.
Fixes #90308.
CC #124866.
2024-05-29 23:42:27 +02:00
Michael Goulet
a03ba7fd2d Add lang item for AsyncFnKindHelper::Upvars 2024-05-29 14:28:53 -04:00
Michael Goulet
a9c7e024c0 Add lang item for Future::Output 2024-05-29 14:22:56 -04:00
Michael Goulet
7f11d6f4bf Add lang items for AsyncFn's associated types 2024-05-29 14:09:19 -04:00
Daria Sukhonina
7cdd95e1a6 Optimize async drop glue for some old types 2024-05-29 12:56:59 +03:00
Scott McMurray
7150839552 Add custom mir support for PtrMetadata 2024-05-28 09:28:51 -07:00
Scott McMurray
459ce3f6bb Add an intrinsic for ptr::metadata 2024-05-28 09:28:51 -07:00
Nicholas Nethercote
e60c1916e0 Remove #[macro_use] extern crate tracing from rustc_span`.
Because explicit macro imports are better than implicit macro imports.
2024-05-22 16:03:48 +10:00
Nicholas Nethercote
220f3ab825 Add a useful comment.
For something that wasn't obvious to me.
2024-05-22 16:03:48 +10:00
bors
6715446db6 Auto merge of #125358 - matthiaskrgr:rollup-mx841tg, r=matthiaskrgr
Rollup of 7 pull requests

Successful merges:

 - #124570 (Miscellaneous cleanups)
 - #124772 (Refactor documentation for Apple targets)
 - #125011 (Add opt-for-size core lib feature flag)
 - #125218 (Migrate `run-make/no-intermediate-extras` to new `rmake.rs`)
 - #125225 (Use functions from `crt_externs.h` on iOS/tvOS/watchOS/visionOS)
 - #125266 (compiler: add simd_ctpop intrinsic)
 - #125348 (Small fixes to `std::path::absolute` docs)

Failed merges:

 - #125296 (Fix `unexpected_cfgs` lint on std)

r? `@ghost`
`@rustbot` modify labels: rollup
2024-05-21 12:50:09 +00:00
Matthias Krüger
fd975f75fa
Rollup merge of #125266 - workingjubilee:stream-plastic-love, r=RalfJung,nikic
compiler: add simd_ctpop intrinsic

Fairly straightforward addition.

cc `@rust-lang/opsem` new (extremely boring) intrinsic
2024-05-21 12:47:06 +02:00
Michael Goulet
a502e7ac1d Implement BOXED_SLICE_INTO_ITER 2024-05-20 19:21:30 -04:00
Matthias Krüger
a79737c3f0
Rollup merge of #125314 - jdonszelmann:global-registration-feature-gate, r=pnkfelix
Add an experimental feature gate for global registration

See #125119 for the tracking issue.
2024-05-20 18:13:49 +02:00