Commit graph

32094 commits

Author SHA1 Message Date
Lukas Wirth
0ba893e1a0
Merge pull request #18453 from ChayimFriedman2/leading-or
Parse patterns with leading pipe properly in all places
2024-10-31 14:49:35 +00:00
Chayim Refael Friedman
210ead8454 Parse patterns with leading pipe properly in all places 2024-10-31 15:32:37 +02:00
Lukas Wirth
86a850d49e
Merge pull request #18447 from ChayimFriedman2/cleanup-tylowerctx
Avoid interior mutability in `TyLoweringContext`
2024-10-31 12:48:17 +00:00
Lukas Wirth
1aac2c637b
Merge pull request #18448 from Veykril/push-zwuuoytnmnqz
Move `child_by_source` from `hir-def` to `hir`
2024-10-31 08:42:59 +00:00
Lukas Wirth
70348faf2b Move child_by_source from hir-def to hir 2024-10-31 09:28:08 +01:00
Lukas Wirth
fb8ca32d06
Merge pull request #18437 from sam-mccall/publish_fixture
Publish test-fixture => ra_ap_test_fixture
2024-10-31 08:03:44 +00:00
Chayim Refael Friedman
4317927231 Avoid interior mutability in TyLoweringContext
This requires some serious code juggling.
2024-10-30 21:24:19 +02:00
Lukas Wirth
8244f30eff
Merge pull request #18446 from ChayimFriedman2/safe-statement
fix: Only parse `safe` as contextual kw in extern blocks
2024-10-30 19:04:56 +00:00
Chayim Refael Friedman
3a8dc27e72 Only parse safe as contextual kw in extern blocks
I don't like the party of `bool`s that is becoming, but two isn't worth a refactoring yet IMO.
2024-10-30 19:28:33 +02:00
Lukas Wirth
cd206f5c9b
Merge pull request #18304 from davidkurilla/docs-create-setup-document
docs: create setup documentation
2024-10-30 09:52:39 +00:00
Lukas Wirth
223979bf97
Merge pull request #18382 from dqkqd/issue-17042
fix: auto-complete import for aliased function and module
2024-10-30 09:42:46 +00:00
Lukas Wirth
bb3239d415
Merge pull request #18385 from Giga-Bowser/master
feat: Add assist to generate a type alias for a function
2024-10-30 09:36:55 +00:00
Lukas Wirth
436ace3ecb
Merge pull request #18436 from Veykril/lw-yvkqwpnwsouo
Do not render meta info when hovering usages
2024-10-30 09:21:35 +00:00
Lukas Wirth
a953875f49 Style hover messages a bit differently 2024-10-29 16:59:48 +01:00
Sam McCall
98f3304831 Publish test-fixture => ra_ap_test_fixture 2024-10-29 16:26:18 +01:00
Lukas Wirth
3741b863a6 Do not render meta info when hovering usages 2024-10-29 15:34:17 +01:00
Lukas Wirth
468b5cd430
Merge pull request #18432 from Veykril/lw-yptzmuxyvxxt
fix: Fix the server not honoring diagnostic refresh support
2024-10-29 10:32:11 +00:00
Lukas Wirth
1da6138b40 fix: Fix the server not honoring diagnostic refresh support 2024-10-29 11:06:16 +01:00
Lukas Wirth
3fd6a72556
Merge pull request #18427 from ChayimFriedman2/cleanup-ty
Cleanup TypeRef lowering
2024-10-29 10:00:44 +00:00
Laurențiu Nicola
2eaf49bef8
Merge pull request #18431 from lnicola/sync-from-rust
minor: Sync from downstream
2024-10-29 06:54:19 +00:00
Laurențiu Nicola
ffdeb5dbb2 Bump rustc crates 2024-10-29 08:39:55 +02:00
Laurențiu Nicola
779074df51 Merge from rust-lang/rust 2024-10-29 08:13:34 +02:00
Laurențiu Nicola
478b234d6a Preparing for merge from rust-lang/rust 2024-10-29 08:13:20 +02:00
bors
0dc8c6c224 Auto merge of #128985 - GrigorenkoPV:instantly-dangling-pointer, r=Urgau
Lint against getting pointers from immediately dropped temporaries

Fixes #123613

## Changes:
1. New lint: `dangling_pointers_from_temporaries`. Is a generalization of `temporary_cstring_as_ptr` for more types and more ways to get a temporary.
2. `temporary_cstring_as_ptr` is removed and marked as renamed to `dangling_pointers_from_temporaries`.
3. `clippy::temporary_cstring_as_ptr` is marked as renamed to `dangling_pointers_from_temporaries`.
4. Fixed a false positive[^fp] for when the pointer is not actually dangling because of lifetime extension for function/method call arguments.
5. `core::cell::Cell` is now `rustc_diagnostic_item = "Cell"`

## Questions:
- [ ]  Instead of manually checking for a list of known methods and diagnostic items, maybe add some sort of annotation to those methods in library and check for the presence of that annotation? https://github.com/rust-lang/rust/pull/128985#issuecomment-2318714312

## Known limitations:

### False negatives[^fn]:

See the comments in `compiler/rustc_lint/src/dangling.rs`

1. Method calls that are not checked for:
   - `temporary_unsafe_cell.get()`
   - `temporary_sync_unsafe_cell.get()`
2. Ways to get a temporary that are not recognized:
   - `owning_temporary.field`
   - `owning_temporary[index]`
3. No checks for ref-to-ptr conversions:
   - `&raw [mut] temporary`
   - `&temporary as *(const|mut) _`
    - `ptr::from_ref(&temporary)` and friends

[^fn]: lint **should** be emitted, but **is not**

[^fp]: lint **should not** be emitted, but **is**
2024-10-29 00:24:07 +00:00
bors
aecc3e7984 Auto merge of #132145 - RalfJung:stdarch, r=Amanieu
bump stdarch

This lets us remove a hack from https://github.com/rust-lang/rust/pull/131349.

r? `@Amanieu`

try-job: test-various
2024-10-28 16:25:56 +00:00
Chayim Refael Friedman
41658de227 Cleanup TypeRef lowering
By removing interior mutability from it.
2024-10-28 17:38:37 +02:00
Lukas Wirth
cf8f950baa
Merge pull request #18420 from ChayimFriedman2/cfg-true-false
feat: Support `cfg(true)` and `cfg(false)`
2024-10-28 13:56:41 +00:00
Lukas Wirth
8672eb8adb
Merge pull request #18421 from Veykril/push-uxxwvwnqvomr
Move text-edit into ide-db
2024-10-28 13:52:16 +00:00
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