Vincent Esche
3d4f10a856
Fix a few typos
2024-12-13 09:54:35 +01:00
Lukas Wirth
6aadbae022
Merge pull request #18674 from Veykril/push-lrxotqknvxvr
...
Show expansion errors in expand_macro feature
2024-12-13 08:50:45 +00:00
Lukas Wirth
7ce807bf4d
Merge pull request #18672 from Veykril/push-lurnqpqtzvzq
...
internal: Do not require a special env var to be set for the proc-macro-srv
2024-12-13 08:43:33 +00:00
Lukas Wirth
28fbecff42
Show expansion errors in expand_macro feature
2024-12-13 09:36:03 +01:00
bors
7ef657f73d
Auto merge of #133899 - scottmcm:strip-mir-debuginfo, r=oli-obk
...
We don't need `NonNull::as_ptr` debuginfo
In order to stop pessimizing the use of local variables in core, skip debug info for MIR temporaries in tiny (single-BB) functions.
For functions as simple as this -- `Pin::new`, etc -- nobody every actually wants debuginfo for them in the first place. They're more like intrinsics than real functions, and stepping over them is good.
2024-12-13 08:32:20 +00:00
Lukas Wirth
a5adfafd93
Do not require a special env var to be set for the proc-macro-srv
2024-12-13 09:29:16 +01:00
bors
4839571ddc
Auto merge of #132961 - adetaylor:arbitrary-self-types-the-big-bit, r=compiler-errors,wesleywiser
...
Arbitrary self types v2: main compiler changes
This is the main PR in a series of PRs related to Arbitrary Self Types v2, tracked in #44874 . Specifically this is step 7 of the plan [described here](https://github.com/rust-lang/rust/issues/44874#issuecomment-2122179688 ), for [RFC 3519](https://github.com/rust-lang/rfcs/pull/3519 ).
Overall this PR:
* Switches from the `Deref` trait to the new `Receiver` trait when the unstable `arbitrary_self_types` feature is enabled (the simple bit)
* Introduces new algorithms to spot "shadowing"; that is, the case where a newly-added method in an outer smart pointer might end up overriding a pre-existing method in the pointee (the complex bit). Most of this bit was explored in [this earlier perf-testing PR](https://github.com/rust-lang/rust/pull/127812#issuecomment-2236911900 ).
* Lots of tests
This should not break compatibility for:
* Stable users, where it should have no effect
* Users of the existing `arbitrary_self_types` feature (because we implement `Receiver` for `T: Deref`) _unless_ those folks have added methods which may shadow methods in inner types, which we no longer want to allow
Subsequent PRs will add better diagnostics.
It's probably easiest to review this commit-by-commit.
r? `@wesleywiser`
2024-12-12 21:40:39 +00:00
Lukas Wirth
9b2e72c404
Merge pull request #18677 from Veykril/push-uumpxklsqpzk
...
internal: Implement `naked_asm!` builtin
2024-12-12 16:58:26 +00:00
Lukas Wirth
f748eb510e
internal: Implement naked_asm!
builtin
2024-12-12 17:43:27 +01:00
Lukas Wirth
cde07f29c9
Merge pull request #18675 from ShoyuVanilla/issue-18664
...
fix: Panic when displaying generic params with defaults, again
2024-12-12 16:37:10 +00:00
Shoyu Vanilla
94ec3fe7ed
fix: Panic when displaying generic params with defaults, again
2024-12-13 01:15:41 +09:00
bors
d5708aad45
Auto merge of #132789 - matthiaskrgr:debug_tests, r=jieyouxu
...
add some debug-assertion crash tests
r? ghost
try-job: x86_64-gnu
2024-12-12 16:08:06 +00:00
Lukas Wirth
0ae381327b
Merge pull request #18671 from p-hofer/master
...
Fix typo in error message for invalid casting
2024-12-12 14:58:26 +00:00
Philipp Hofer
04ac6f8405
Fix typo in error message for invalid casting
...
Corrected the spelling of "defererence" to "dereference" in the error message that informs users about invalid casting requirements.
2024-12-12 15:42:21 +01:00
Lukas Wirth
acd469681f
Merge pull request #18670 from Veykril/push-ylomnylswnxm
...
internal: Drop proc-macro server support for ~1.66.0 and older toolchains
2024-12-12 14:19:07 +00:00
Lukas Wirth
f0b5b8333d
internal: Drop proc-macro server support for ~1.66.0 and older toolchains
2024-12-12 15:06:14 +01:00
Lukas Wirth
a6c291ed07
Merge pull request #18652 from Giga-Bowser/extract-constant
...
feat: Add an assist to extract an expression into a constant
2024-12-12 13:22:05 +00:00
Lukas Wirth
3bd459767c
Merge pull request #18669 from Veykril/push-qqkuxtvsmsut
...
internal: Only parse the object file once in proc-macro-srv
2024-12-12 12:46:29 +00:00
Lukas Wirth
8a86fa01ac
Fix clippy lints in proc-macro-srv
2024-12-12 13:30:42 +01:00
Lukas Wirth
c9314d4aff
Only parse the object file once
2024-12-12 13:23:25 +01:00
Lukas Wirth
096e3e55e3
Merge pull request #18668 from Veykril/push-tpkmsyllunqv
...
fix: Fix sourceroot construction for virtual manifests
2024-12-12 12:13:48 +00:00
Lukas Wirth
a8efb137a1
Merge pull request #18660 from Veykril/push-snumrtvzwqvw
...
fix: copied proc-macros not being cleaned up on exit
2024-12-12 12:09:41 +00:00
bors
e4c861005c
Auto merge of #134199 - RalfJung:gitmerge, r=oli-obk
...
Revert "Stop git from merging generated files"
This reverts https://github.com/rust-lang/rust/pull/133851 . "-merge" makes git not even do merges if they are entirely conflict-free, which is not the behavior we want. We sometimes have conflict-free merges in generated files and it's much better if git can handle them automatically.
r? `@oli-obk`
Cc `@jieyouxu` `@Urgau`
2024-12-12 12:02:38 +00:00
Lukas Wirth
ab46e97188
fix: Fix sourceroot construction for virtual manifests
2024-12-12 12:58:18 +01:00
Lukas Wirth
8ffa5ecb76
Merge pull request #18667 from 1hakusai1/generate_custom_imple_with_no_snippet
...
fix: Generate implementation with items even if snippet text edit is disabled
2024-12-12 10:51:44 +00:00
1hakusai1
fc2b70132f
Generate implementation with items even if snippet text edit is disabled
2024-12-12 18:55:14 +09:00
bors
67dcb7a3c3
Auto merge of #129181 - beetrees:asm-spans, r=pnkfelix,compiler-errors
...
Pass end position of span through inline ASM cookie
Before this PR, only the start position of the span was passed though the inline ASM cookie to diagnostics. LLVM 19 has full support for 64-bit inline ASM cookies; this PR uses that to pass the end position of the span in the upper 32 bits, meaning inline ASM diagnostics now point at the entire line the error occurred on, not just the first character of it.
2024-12-12 02:34:06 +00:00
bors
ead998e6de
Auto merge of #128004 - folkertdev:naked-fn-asm, r=Amanieu
...
codegen `#[naked]` functions using global asm
tracking issue: https://github.com/rust-lang/rust/issues/90957
Fixes #124375
This implements the approach suggested in the tracking issue: use the existing global assembly infrastructure to emit the body of `#[naked]` functions. The main advantage is that we now have full control over what gets generated, and are no longer dependent on LLVM not sneakily messing with our output (inlining, adding extra instructions, etc).
I discussed this approach with `@Amanieu` and while I think the general direction is correct, there is probably a bunch of stuff that needs to change or move around here. I'll leave some inline comments on things that I'm not sure about.
Combined with https://github.com/rust-lang/rust/pull/127853 , if both accepted, I think that resolves all steps from the tracking issue.
r? `@Amanieu`
2024-12-11 21:51:07 +00:00
Laurențiu Nicola
b707b5a117
Merge pull request #18466 from ChayimFriedman2/proper-lint-severity
...
Properly handle different defaults for severity of lints
2024-12-11 20:05:39 +00:00
Laurențiu Nicola
547be42074
Merge pull request #18666 from samestep/manual-autopublish-link
...
Fix publish workflow link in manual
2024-12-11 19:50:55 +00:00
Sam Estep
33f7d1dae1
Fix publish workflow link in manual
2024-12-11 14:35:36 -05:00
Giga Bowser
21782b9a8d
minor: Group extract_function
with other extraction assists
2024-12-11 14:11:20 -05:00
bors
8e244991f9
Auto merge of #134177 - matthiaskrgr:rollup-hgp8q60, r=matthiaskrgr
...
Rollup of 6 pull requests
Successful merges:
- #132975 (De-duplicate and improve definition of core::ffi::c_char)
- #133598 (Change `GetManyMutError` to match T-libs-api decision)
- #134148 (add comments in check_expr_field)
- #134163 (coverage: Rearrange the code for embedding per-function coverage metadata)
- #134165 (wasm(32|64): update alignment string)
- #134170 (Subtree update of `rust-analyzer`)
r? `@ghost`
`@rustbot` modify labels: rollup
2024-12-11 19:06:46 +00:00
Giga Bowser
0cad614b3b
feat: Add an assist to extract an expression into a static
2024-12-11 14:04:54 -05:00
Matthias Krüger
48f34bb639
Rollup merge of #134170 - lnicola:sync-from-ra, r=lnicola
...
Subtree update of `rust-analyzer`
r? `@ghost`
2024-12-11 20:00:22 +01:00
Matthias Krüger
d41a896908
Rollup merge of #133598 - ChayimFriedman2:get-many-mut-detailed-err, r=scottmcm
...
Change `GetManyMutError` to match T-libs-api decision
That is, differentiate between out-of-bounds and overlapping indices, and remove the generic parameter `N`.
I also exported `GetManyMutError` from `alloc` (and `std`), which was apparently forgotten.
Changing the error to carry additional details means LLVM no longer generates separate short-circuiting branches for the checks, instead it generates one branch at the end. I therefore changed the code to use early returns to make LLVM generate jumps. Benchmark results between the approaches are somewhat mixed, but I chose this approach because it is significantly faster with ranges and also faster with `unwrap()`.
Benchmark (`jumps` refer to short-circuiting, `acc` is not short-circuiting):
```rust
use criterion::{black_box, criterion_group, criterion_main, Criterion};
use my_crate::{get_many_check_valid_acc, get_many_check_valid_jumps, GetManyMutError};
mod externs {
#[unsafe(no_mangle)]
fn foo() {}
#[unsafe(no_mangle)]
fn bar() {}
#[unsafe(no_mangle)]
fn baz() {}
}
unsafe extern "C" {
safe fn foo();
safe fn bar();
safe fn baz();
}
fn bench_method(c: &mut Criterion) {
c.bench_function("jumps two usize", |b| {
b.iter(|| get_many_check_valid_jumps(&[black_box(1), black_box(5)], black_box(10)))
});
c.bench_function("jumps two usize unwrap", |b| {
b.iter(|| get_many_check_valid_jumps(&[black_box(1), black_box(5)], black_box(10)).unwrap())
});
c.bench_function("jumps two usize ok", |b| {
b.iter(|| get_many_check_valid_jumps(&[black_box(1), black_box(5)], black_box(10)).ok())
});
c.bench_function("jumps three usize", |b| {
b.iter(|| {
get_many_check_valid_jumps(&[black_box(1), black_box(5), black_box(7)], black_box(10))
})
});
c.bench_function("jumps three usize match", |b| {
b.iter(|| {
match get_many_check_valid_jumps(
&[black_box(1), black_box(5), black_box(7)],
black_box(10),
) {
Err(GetManyMutError::IndexOutOfBounds) => foo(),
Err(GetManyMutError::OverlappingIndices) => bar(),
Ok(()) => baz(),
}
})
});
c.bench_function("jumps two Range", |b| {
b.iter(|| {
get_many_check_valid_jumps(
&[black_box(1)..black_box(5), black_box(7)..black_box(8)],
black_box(10),
)
})
});
c.bench_function("jumps two RangeInclusive", |b| {
b.iter(|| {
get_many_check_valid_jumps(
&[black_box(1)..=black_box(5), black_box(7)..=black_box(8)],
black_box(10),
)
})
});
c.bench_function("acc two usize", |b| {
b.iter(|| get_many_check_valid_acc(&[black_box(1), black_box(5)], black_box(10)))
});
c.bench_function("acc two usize unwrap", |b| {
b.iter(|| get_many_check_valid_acc(&[black_box(1), black_box(5)], black_box(10)).unwrap())
});
c.bench_function("acc two usize ok", |b| {
b.iter(|| get_many_check_valid_acc(&[black_box(1), black_box(5)], black_box(10)).ok())
});
c.bench_function("acc three usize", |b| {
b.iter(|| {
get_many_check_valid_acc(&[black_box(1), black_box(5), black_box(7)], black_box(10))
})
});
c.bench_function("acc three usize match", |b| {
b.iter(|| {
match get_many_check_valid_jumps(
&[black_box(1), black_box(5), black_box(7)],
black_box(10),
) {
Err(GetManyMutError::IndexOutOfBounds) => foo(),
Err(GetManyMutError::OverlappingIndices) => bar(),
Ok(()) => baz(),
}
})
});
c.bench_function("acc two Range", |b| {
b.iter(|| {
get_many_check_valid_acc(
&[black_box(1)..black_box(5), black_box(7)..black_box(8)],
black_box(10),
)
})
});
c.bench_function("acc two RangeInclusive", |b| {
b.iter(|| {
get_many_check_valid_acc(
&[black_box(1)..=black_box(5), black_box(7)..=black_box(8)],
black_box(10),
)
})
});
}
criterion_group!(benches, bench_method);
criterion_main!(benches);
```
Benchmark results:
```none
jumps two usize time: [586.44 ps 590.20 ps 594.50 ps]
jumps two usize unwrap time: [390.44 ps 393.63 ps 397.44 ps]
jumps two usize ok time: [585.52 ps 591.74 ps 599.38 ps]
jumps three usize time: [976.51 ps 983.79 ps 991.51 ps]
jumps three usize match time: [390.82 ps 393.80 ps 397.07 ps]
jumps two Range time: [1.2583 ns 1.2640 ns 1.2695 ns]
jumps two RangeInclusive time: [1.2673 ns 1.2770 ns 1.2877 ns]
acc two usize time: [592.63 ps 596.44 ps 600.52 ps]
acc two usize unwrap time: [582.65 ps 587.07 ps 591.90 ps]
acc two usize ok time: [581.59 ps 587.82 ps 595.71 ps]
acc three usize time: [894.69 ps 901.23 ps 908.24 ps]
acc three usize match time: [392.68 ps 395.73 ps 399.17 ps]
acc two Range time: [1.5531 ns 1.5617 ns 1.5711 ns]
acc two RangeInclusive time: [1.5746 ns 1.5840 ns 1.5939 ns]
```
2024-12-11 20:00:14 +01:00
Chayim Refael Friedman
0b7a6f38d7
Properly handle different defaults for severity of lints
...
Previously all lints were assumed to be `#[warn]`, and we had a hand-coded list of `#[allow]` exceptions. Now the severity is autogenerated from rustdoc output.
Also support lints that change status between editions, and the `warnings` lint group.
2024-12-11 20:48:41 +02:00
Giga Bowser
135e71fcb3
minor: Add item_static
constructor to SyntaxFactory
2024-12-11 10:32:32 -05:00
Giga Bowser
1979d3f9b5
feat: Add an assist to extract an expression into a constant
2024-12-11 09:52:03 -05:00
Giga Bowser
17e482b1a9
internal: Move is_body_const
to ide_assists::utils
2024-12-11 09:52:03 -05:00
Giga Bowser
27a2f9d594
minor: Add item_const
constructor to SyntaxFactory
2024-12-11 09:52:03 -05:00
Lukas Wirth
e7a4c99ce3
Merge pull request #18663 from Veykril/push-syoklzkntykn
...
fix: Swallow rustfmt parsing panics
2024-12-11 10:06:28 +00:00
Laurențiu Nicola
b248e53859
Merge pull request #18662 from lnicola/sync-from-rust
...
internal: Sync from downstream
2024-12-11 10:05:39 +00:00
Lukas Wirth
8963e9736b
fix: Swallow rustfmt parsing panics
2024-12-11 10:52:04 +01:00
Laurențiu Nicola
c1433e9742
Bump rustc crates
2024-12-11 11:50:19 +02:00
Laurențiu Nicola
30262281eb
Merge from rust-lang/rust
2024-12-11 11:49:08 +02:00
Laurențiu Nicola
b19be7dcfe
Preparing for merge from rust-lang/rust
2024-12-11 11:48:46 +02:00
Lukas Wirth
16c0f25579
Fix copied proc-macros not being cleaned up on exit
2024-12-11 10:17:33 +01:00
Lukas Wirth
f370550b0a
Unload proc-macro dlls on changed timestamp
2024-12-11 09:34:27 +01:00
Lukas Wirth
41f3319173
Merge pull request #18458 from Giga-Bowser/master
...
feat: Add diagnostic fix to remove unnecessary wrapper in type mismatch
2024-12-11 07:09:15 +00:00