Commit graph

32266 commits

Author SHA1 Message Date
Lukas Wirth
09547e9ea5
Merge pull request #18413 from ShoyuVanilla/extern-crate-reexport
fix: Allow public re-export of `extern crate` import
2024-10-28 13:51:26 +00:00
Lukas Wirth
343abd9193
Merge pull request #18422 from ChayimFriedman2/cursed-name-res
fix: Properly resolve prelude paths inside modules inside blocks
2024-10-28 13:45:19 +00:00
Lukas Wirth
68e2d8465f
Merge pull request #18312 from LastExceed/symbolkind-variable
Report document symbols of kind `variable` for let statements
2024-10-28 13:40:42 +00:00
Lukas Wirth
27306c5e4b Reformat 2024-10-28 14:37:52 +01:00
Lukas Wirth
64f56f458f Move text-edit into ide-db 2024-10-28 14:37:41 +01:00
bors
1a7657bb70 Auto merge of #132262 - matthiaskrgr:rollup-pcphi6l, r=matthiaskrgr
Rollup of 4 pull requests

Successful merges:

 - #131391 (Stabilize `isqrt` feature)
 - #132248 (rustc_transmute: Directly use types from rustc_abi)
 - #132252 (compiler: rename LayoutS to LayoutData)
 - #132253 (Known-bug test for `keyword_idents` lint not propagating to other files)

r? `@ghost`
`@rustbot` modify labels: rollup
2024-10-28 13:32:57 +00:00
Matthias Krüger
4d0ed44a85
Rollup merge of #132253 - Zalathar:keyword-idents-bug, r=jieyouxu
Known-bug test for `keyword_idents` lint not propagating to other files

Known-bug test for `keyword_idents` lint not propagating to other files when configured via attribute (#132218).
2024-10-28 12:14:59 +01:00
Matthias Krüger
ea042628df
Rollup merge of #132252 - workingjubilee:rename-layouts-to-layoutdata, r=jieyouxu
compiler: rename LayoutS to LayoutData

Bid `LayoutS` goodbye because it looks like a typo.

`LayoutS` is the last of the types that use the "`{TypeName}` is the interned type, `{TypeName}S` is the backing data that is interned" convention. This is pretty confusing to those not intimately familiar with the history of rustc's names for its types over time, and doubly so now that there are no other examples in the tree. Abolish this convention.
2024-10-28 12:14:59 +01:00
Matthias Krüger
065ff2f856
Rollup merge of #131391 - ChaiTRex:isqrt, r=scottmcm,tgross35
Stabilize `isqrt` feature

Stabilizes the `isqrt` feature. FCP is incomplete.

Closes #116226
2024-10-28 12:14:57 +01:00
Lukas Wirth
80e9d014be
Merge pull request #18074 from ChayimFriedman2/typeref-source-map
internal: Build source map for `hir_def::TypeRef`s
2024-10-28 11:01:12 +00:00
Laurențiu Nicola
ae86e6a229
Merge pull request #18256 from MoskalykA/use-is_none_or
Start using `Option::is_none_or`
2024-10-28 10:12:36 +00:00
Laurențiu Nicola
d481decd06
Merge pull request #18412 from lnicola/windows-no-gz
internal: Stop producing .gz artifacts for Windows
2024-10-28 10:11:29 +00:00
Jubilee Young
f806406728 rust-analyzer: Rename LayoutS to LayoutData 2024-10-27 22:32:58 -07:00
LastExceed
167fe5fd7c add test 2024-10-27 23:29:14 +01:00
LastExceed
7c8c28ce96 add LetStmt arm 2024-10-27 23:29:14 +01:00
Chayim Refael Friedman
1fed2403d1 Properly resolve prelude paths inside modules inside blocks
I.e. the following situation:
```
fn foo() {
    mod bar {
        fn qux() {
            // Prelude path here (e.g. macro use prelude or extern prelude).
        }
    }
}
```
Those were previously unresolved, because, in order to support `self` and `super` properly, since #15148 we do not ascend block paths when there is a module in between, but only crate def maps register preludes, not block def maps, and we can't change this because block def map prelude can always be overridden by another block. E.g.
```
fn foo() {
    struct WithTheSameNameAsPreludeItem;
    {
        WithTheSameNameAsPreludeItem
    }
}
```
Here `WithTheSameNameAsPreludeItem` refer to the item from the top block, but if we would register prelude items in each block the child block would overwrite it incorrectly.
2024-10-27 19:23:12 +02:00
Shoyu Vanilla
eb2a50e75d fix: Allow public re-export of extern crate import 2024-10-27 23:44:44 +09:00
Lukas Wirth
3b3a87fe9b
Merge pull request #18419 from ChayimFriedman2/leading-or
fix: Put leading `|` in patterns under `OrPat`
2024-10-27 11:25:16 +00:00
Chayim Refael Friedman
e12a001b55 Put leading | in patterns under OrPat
Previously it was one level above, and that caused problems with macros that expand to it, because macros expect to get only one top-level node.
2024-10-27 13:11:38 +02:00
Lukas Wirth
715b67c425
Merge pull request #18410 from Veykril/veykril/push-lvwxpnowqrxk
internal: Invert token iteration order in macro mapping
2024-10-27 10:44:32 +00:00
Lukas Wirth
20ac30fb75 Invert token iteration order in macro mapping 2024-10-27 11:32:12 +01:00
Lukas Wirth
79b86f25b4
Merge pull request #18418 from ChayimFriedman2/explicitly-disable
feat: Split `macro-error` diagnostic so users can ignore only parts of it
2024-10-27 09:37:56 +00:00
Lukas Wirth
8d10e248c8
Merge pull request #18417 from ChayimFriedman2/hash-string
fix: Correctly handle `#""` in edition <2024
2024-10-27 09:28:47 +00:00
Chayim Refael Friedman
074050c242 Support cfg(true) and cfg(false)
As per RFC 3695.
2024-10-27 10:46:49 +02:00
Chayim Refael Friedman
f4585ea023 Split macro-error diagnostic so users can ignore only parts of it
Split it into `macro-error`, `proc-macros-disabled` and `proc-macro-disabled`.
2024-10-27 02:24:15 +02:00
bors
bfeadff2b2 Auto merge of #131900 - mrkajetanp:target-feature-pauth-lr, r=Amanieu
rustc_target: Add pauth-lr aarch64 target feature

Add the pauth-lr target feature, corresponding to aarch64 FEAT_PAuth_LR. This feature has been added in LLVM 19.
It is currently not supported by the Linux hwcap and so we cannot add runtime feature detection for it at this time.

r? `@Amanieu`
2024-10-27 00:09:49 +00:00
bors
fa1eaeacde Auto merge of #131715 - tgross35:add-const_sockaddr_setters, r=Amanieu
Add an unstable `const_sockaddr_setters` feature

Unstably add `const` to the `sockaddr_setters` methods. Included API:

```rust
// core::net

impl SocketAddr {
    pub const fn set_ip(&mut self, new_ip: IpAddr);
    pub const fn set_port(&mut self, new_port: u16);
}

impl SocketAddrV4 {
    pub const fn set_ip(&mut self, new_ip: Ipv4Addr);
    pub const fn set_port(&mut self, new_port: u16);
}

impl SocketAddrV6 {
    pub const fn set_ip(&mut self, new_ip: Ipv6Addr);
    pub const fn set_port(&mut self, new_port: u16);
}
```

Tracking issue: <https://github.com/rust-lang/rust/issues/131714>
2024-10-26 21:47:35 +00:00
Chayim Refael Friedman
3b3beaab31 Correctly handle #"" in edition <2024 2024-10-27 00:47:13 +03:00
bors
e3b428c15a Auto merge of #125116 - blyxyas:ignore-allowed-lints-final, r=cjgillot
(Big performance change) Do not run lints that cannot emit

Before this change, adding a lint was a difficult matter because it always had some overhead involved. This was because all lints would run, no matter their default level, or if the user had `#![allow]`ed them. This PR changes that. This change would improve both the Rust lint infrastructure and Clippy, but Clippy will see the most benefit, as it has about 900 registered lints (and growing!)

So yeah, with this little patch we filter all lints pre-linting, and remove any lint that is either:
- Manually `#![allow]`ed in the whole crate,
- Allowed in the command line, or
- Not manually enabled with `#[warn]` or similar, and its default level is `Allow`

As some lints **need** to run, this PR also adds **loadbearing lints**. On a lint declaration, you can use the ``@eval_always` = true` marker to label it as loadbearing. A loadbearing lint will never be filtered (it will always run)

Fixes #106983
2024-10-26 16:37:43 +00:00
Laurențiu Nicola
cce06862a2 Bump MSRV to 1.82 2024-10-26 09:39:23 +03:00
MoskalykA
feba680c39 Use method syntax 2024-10-26 09:39:04 +03:00
MoskalykA
41fa877362 Start using Option::is_none_or 2024-10-26 09:39:04 +03:00
Laurențiu Nicola
26d2fbaef2
Merge pull request #18415 from lnicola/nicer-remove-dbg
fix: Turn "Remove `dbg!`" into a quick fix for better prioritization
2024-10-26 06:21:26 +00:00
Laurențiu Nicola
4e3c331d86 Turn Remove dbg into a quick fix for better prioritization 2024-10-26 09:06:10 +03:00
bors
c1cba5b299 Auto merge of #131917 - jieyouxu:rmake-clang, r=Kobzol
Run the full stage 2 `run-make` test suite in `x86_64-gnu-debug`

Run the full `run-make` test suite in the `x86_64-gnu-debug` CI job. This is currently the *only* CI job where `//@ needs-force-clang-based-test` will be satisfied, so some `run-make` tests will literally never be run otherwise. Before this PR, the CI job only ran `run-make` tests which contains the substring `clang` in its test name, which is both (1) a footgun because it's very easy to forget and (2) it masks tests that would otherwise fail (even failing to compile) because the test is skipped if doesn't have a `clang` in its test name.

With the environment of `x86_64-gnu-debug`, two `run-make` tests failed before this PR:

1. `tests/run-make/issue-84395-lto-embed-bitcode/rmake.rs`: this was broken for a long time because `objcopy` in llvm bin tools was renamed to `llvm-objcopy`. This test was converted into a rmake.rs test, rather straight forward.
2. `tests/run-make/cross-lang-lto-riscv-abi/rmake.rs`: this was broken for a long time and never worked. The old version inspected human-readable output of `llvm-readobj --file-header` looking for substring `EF_RISCV_FLOAT_ABI_DOUBLE`, but the human-readable output will only contain something like `Flags: 0x5, RVC, double-float ABI`, hence it will never match. This test was fixed by instead using the `object` crate to actually decode the ELF headers looking for the specific `e_flags` based on reading the RISCV ELF psABI docs.

This PR is best reviewed commit-by-commit, two commits setup the support library for functionality and two commits are for each of the failing `run-make` tests.

I had to bump the `x86_64-gnu-debug` job to be ran with a runner with larger disk space.

Part of #132034.

try-job: x86_64-gnu-debug
2024-10-25 18:33:17 +00:00
bors
3a6ace0105 Auto merge of #127731 - veluca93:abi_checks, r=RalfJung
Emit future-incompatibility lint when calling/declaring functions with vectors that require missing target feature

On some architectures, vector types may have a different ABI depending on whether the relevant target features are enabled. (The ABI when the feature is disabled is often not specified, but LLVM implements some de-facto ABI.)

As discussed in https://github.com/rust-lang/lang-team/issues/235, this turns out to very easily lead to unsound code.

This commit makes it a post-monomorphization error to declare or call functions using those vector types in a context in which the corresponding target features are disabled, if using an ABI for which the difference is relevant. This ensures that these functions are always called with a consistent ABI.

See the [nomination comment](https://github.com/rust-lang/rust/pull/127731#issuecomment-2288558187) for more discussion.

r? RalfJung

Part of https://github.com/rust-lang/rust/issues/116558
2024-10-25 15:17:47 +00:00
Laurențiu Nicola
47cb838b2c Stop producing .gz artifacts for Windows 2024-10-25 15:14:52 +03:00
Lukas Wirth
ca3699bd50 Factor out token ranking 2024-10-25 12:03:12 +02:00
Lukas Wirth
f4466718b8
Merge pull request #18409 from Veykril/veykril/push-rkrkpvzvumvx
Only construct a resolver in macro descension when needed
2024-10-25 08:40:55 +00:00
Lukas Wirth
a12f1781eb Only construct a resolver in macro descension when needed 2024-10-25 10:23:59 +02:00
Lukas Wirth
52a03ec237
Merge pull request #18408 from Veykril/veykril/push-ulxyznwzokut
fix: Don't compute diagnostics for non local files
2024-10-25 05:55:32 +00:00
Lukas Wirth
8eef1c5275 Add server cancellation support to pull diagnostic handler 2024-10-25 07:39:28 +02:00
Lukas Wirth
eac7840810 Don't compute diagnostics for non local files 2024-10-25 07:28:29 +02:00
Lukas Wirth
169d4469bd
Merge pull request #18407 from hackervole/code-fix-welcome-setup-tips
Fix formatting on welcome page, read only paths setting example
2024-10-25 05:15:39 +00:00
Chayim Refael Friedman
bf7edd3783 Shrink TypeRef from 16 from 32 bytes
Only references and arrays need to be boxed, and they comprise only 9.4% of the types (according to counting on r-a's code).

This saves 17mb.
2024-10-25 06:44:56 +03:00
Chayim Refael Friedman
061e5d7f71 Shrink Path to 16 bytes
Thanks to the observation (supported by counting) that the vast majority paths have neither generics no type anchors, and thanks to a new datastructure `ThinVecWithHeader` that is essentially `(T, Box<[U]>)` but with the size of a single pointer, we are able to reach this feat.

This (together with `ThinVecWithHeader`) makes the possibility to shrink `TypeRef`, because most types are paths.
2024-10-25 06:44:56 +03:00
HackerVole
d2e856ccc4 editors/code: Add md for walkthrough setup example
Add a separate markdown file containing the settings.json snippet from
the "Useful Setup Tips". This fixes the rendering and also makes the
text selectable.

Also use double-backticks for `code` rendering.
2024-10-24 23:20:40 -04:00
Chayim Refael Friedman
bccf0062b7 Do not allocate attributes entry if there are no attributes
This saves 8mb.
2024-10-25 06:15:06 +03:00
Chayim Refael Friedman
d0933cc097 Shrink ItemTreeSourceMaps
This saves 16mb on `analysis-stats .`.
2024-10-25 06:15:06 +03:00
Chayim Refael Friedman
39747cb518 Reuse empty GenericParams
This saves back 15mb that went for typeref source maps.
2024-10-25 06:15:06 +03:00