85 Commits

Author SHA1 Message Date
David Barsky
788232b355 internal: don't panic when the crate graph isn't ready #19351 2025-03-13 15:14:08 -04:00
Chayim Refael Friedman
c94e9efbef Salsify the crate graph
I.e. make it not one giant input but multiple, for incrementality and decreased memory usage for Salsa 3 reasons.
2025-03-12 21:02:30 +02:00
David Barsky
74620e64ec internal: port rust-analyzer to new Salsa 2025-03-10 13:30:51 -04:00
Chayim Refael Friedman
2fc0dc0f13 Pass the target crate in HirFormatter
This is required to format evaluated consts, because we need trait env, and it needs the crate (currently it uses the last crate in topological order, which is wrong, the next commit will fix that).
2025-03-06 21:00:05 +02:00
Thalia Archibald
0811ca0a61 Use size_of from the prelude instead of imported
Use `std::mem::{size_of, size_of_val, align_of, align_of_val}` from the
prelude instead of importing or qualifying them.

These functions were added to all preludes in Rust 1.80.
2025-03-05 00:48:44 -08:00
Lukas Wirth
bf669dab84 Re-implement rust string highlighting via tool attribute 2025-01-10 13:49:35 +01:00
Lukas Wirth
1cdc34fa4a Fix recursive_adt fixture 2024-10-21 11:28:18 +02:00
Lukas Wirth
20f7ab5ab4 fix: Always explicitly set trait ref self types when lowering 2024-09-06 14:06:41 +02:00
Shoyu Vanilla
d186bdc617 feat: Implement cast typechecks 2024-09-03 04:11:36 +09:00
Shoyu Vanilla
6520a43ca3 feat: Implement object safety 2024-08-29 22:22:21 +09:00
hkalbasi
850a83c7ce Implement floating point casts in const eval 2024-08-22 09:16:00 -04:00
Chayim Refael Friedman
9d3368f2c2 Properly account for editions in names
This PR touches a lot of parts. But the main changes are changing
`hir_expand::Name` to be raw edition-dependently and only when necessary
(unrelated to how the user originally wrote the identifier),
and changing `is_keyword()` and `is_raw_identifier()` to be edition-aware
(this was done in #17896, but the FIXMEs were fixed here).

It is possible that I missed some cases, but most IDE parts should properly
escape (or not escape) identifiers now.

The rules of thumb are:

 - If we show the identifier to the user, its rawness should be determined
   by the edition of the edited crate. This is nice for IDE features,
   but really important for changes we insert to the source code.
 - For tests, I chose `Edition::CURRENT` (so we only have to (maybe) update
   tests when an edition becomes stable, to avoid churn).
 - For debugging tools (helper methods and logs), I used `Edition::LATEST`.
2024-08-16 16:46:24 +03:00
Lukas Wirth
5264f86242 Encode edition within FileId in the hir layer 2024-07-18 08:49:10 +02:00
beetrees
d5db933f9d
Add f16 and f128 support 2024-07-10 10:43:14 +01:00
Hamir Mahal
7c34eb3880
style: simplify string interpolation 2024-05-30 16:18:49 -07:00
6d7a
142ef764ee fix: Check stack depth to prevent stack overflows in create_memory_map 2024-03-24 10:19:25 +01:00
6d7a
7c1be82cd9 fix: Prevent stack overflow in recursive const types
In the evaluation of const values of recursive types
certain declarations could cause an endless call-loop
within the interpreter (hir-ty’s create_memory_map),
which would lead to a stack overflow.
This commit adds a check that prevents values that contain
an address in their value (such as TyKind::Ref) from being
allocated at the address they contain.
The commit also adds a test for this edge case.
2024-03-21 22:57:21 +01:00
Tetsuharu Ohzeki
d580b2c7bc hir-ty: Fix warnings about clippy str_to_string rule 2024-02-10 01:00:40 +09:00
Lukas Wirth
f49a2fed3f internal: Move out WithFixture into dev-dep only crate 2023-12-18 15:24:08 +01:00
Lukas Wirth
35620306a6 internal: Move proc-macro knowledge out of base-db 2023-12-18 12:37:18 +01:00
hkalbasi
8b82ea4f51 Store binding mode for each instance independently 2023-10-22 23:35:33 +03:30
hkalbasi
021802c59c Support enum in memory map patch address 2023-08-09 00:27:23 +03:30
hkalbasi
31c30933cf Support closure in clone shim 2023-08-08 01:49:34 +03:30
hkalbasi
b96e4f2f4a Add mir lower support for tuple destructing assignment 2023-08-07 02:12:35 +03:30
hkalbasi
6990d0f26a Fix unsized struct problems in mir eval 2023-08-02 17:36:11 +03:30
hkalbasi
bd2a8ca507 Add manual implementation of clone for tuples in mir interpreter 2023-07-28 18:52:01 +03:30
hkalbasi
17cc813e92 Support atomic fence intrinsic 2023-07-27 12:28:16 +03:30
hkalbasi
ed8e1fd472 Lookup super traits in is_dyn_method 2023-07-20 15:43:42 +03:30
hkalbasi
eb143383c3 Pass TraitEnvironment into layout_ty and const_eval 2023-07-20 13:08:38 +03:30
bors
8e5f944317 Auto merge of #15282 - HKalbasi:mir, r=HKalbasi
Give real discriminant_type to chalk
2023-07-14 16:46:35 +00:00
hkalbasi
5208bf8f55 implement type_name intrinsic 2023-07-14 16:52:36 +03:30
bors
d16d5fcf68 Auto merge of #15268 - HKalbasi:mir, r=HKalbasi
Add write_bytes and ctlz intrinsics
2023-07-12 23:19:30 +00:00
hkalbasi
274e8301c1 Add write_bytes and ctlz intrinsics 2023-07-12 01:14:49 +03:30
Ryo Yoshida
0312c6c321
Mark test for MIR execution limit as slow test 2023-07-11 23:36:47 +09:00
hkalbasi
59420afa46 Support getrandom syscall 2023-07-11 00:29:06 +03:30
hkalbasi
4a444e768c Implement recursion in mir interpreter without recursion 2023-07-07 15:07:29 +03:30
hkalbasi
171ae2ee5d Fix size_of_val and support min_align_of_val 2023-07-06 15:41:52 +03:30
hkalbasi
6f7452882a Fix layout of simd types and respect align in mir interpreter 2023-07-02 00:42:33 +03:30
hkalbasi
15a0da6f30 Fix overflow checking in shift operator 2023-07-01 17:16:56 +03:30
hkalbasi
302bb3c871 Fix data layout of reference to nested unsized structs 2023-06-29 23:38:13 +03:30
hkalbasi
6d2d1387af Fix some unsizing problems in mir 2023-06-26 01:57:12 +03:30
hkalbasi
99a4f2e983 Support manual impl of fn traits in mir interpreter 2023-06-22 22:24:21 +03:30
dfireBird
410ede9101
Add some tests in number evaluvation and hover to prevent regression
Added a test near positive extermes and two test near negative
extermes as well one for 0.
Added a test using the `as` cast and one with comparison with 0.
2023-06-22 17:58:12 +05:30
hkalbasi
a481e004b0 Lower const params with a bad id 2023-06-11 00:39:28 +03:30
hkalbasi
aab7589c40 Fix string pattern matching in mir interpreter 2023-06-02 23:45:29 +03:30
hkalbasi
51368793b4 MIR episode 6 2023-05-28 23:25:15 +03:30
Lukas Wirth
c7ef6c25b7 internal: Replace Display impl for Name 2023-05-24 20:55:12 +02:00
hkalbasi
92d6670f72 Consider block impls in lookup_impl_assoc_item_for_trait_ref 2023-05-20 01:11:17 +03:30
hkalbasi
4adfbbfbad partially support panic message in MirEvalError 2023-05-18 18:30:49 +03:30
bors
9ce95674e8 Auto merge of #14837 - Veykril:rustc-lexer, r=Veykril
Support c string literals
2023-05-18 11:55:38 +00:00