Edwin Cheng
8e07b23b84
Fix macro expansion for statements w/o semicolon
2021-03-16 13:44:50 +08:00
Aleksey Kladov
f7156cb0ae
Simplify source maps for fields
2021-03-15 15:38:50 +03:00
Jonas Schievink
7beec8fda1
Stop fetching ItemTrees for no reason
2021-03-10 02:32:16 +01:00
Jonas Schievink
6be4f30cae
Remove item_scope
field from Body
2021-03-09 18:27:23 +01:00
Jonas Schievink
13f4356d2f
Store inner BlockId
s in Body
2021-03-09 18:27:23 +01:00
Laurențiu Nicola
fc9eed4836
Use upstream cov-mark
2021-03-08 22:19:44 +02:00
bors[bot]
803ff2e55e
Merge #7804
...
7804: Introduce TypeCtor::Scalar r=lnicola a=Veykril
`TypeCtor::Int(..) | TypeCtor::Float(..) | TypeCtor::Char | TypeCtor::Bool` => `TypeCtor::Scalar(..)`, in this case we can actually just straight up use `chalk_ir::Scalar` already since its just a POD without any IDs or anything.
Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-02-28 13:36:44 +00:00
Jonas Schievink
6990b89b26
Restrict visibilities to the containing DefMap
2021-02-28 04:47:38 +01:00
Lukas Wirth
5183c9f083
Introduce TypeCtor::Scalar
2021-02-28 01:20:04 +01:00
Jonas Schievink
7067a22e1c
Add another block def map test
2021-02-09 17:24:43 +01:00
Jonas Schievink
27f77060e2
Add TestDB::module_at_position
2021-02-09 17:22:57 +01:00
Jonas Schievink
1956286368
Add expression scopes for blocks
2021-02-09 17:11:44 +01:00
Jonas Schievink
c312ab51d0
Test super
resolution too
2021-02-05 19:25:50 +01:00
Jonas Schievink
997bd97b77
Fix resolution of self
module within blocks
2021-02-05 19:24:03 +01:00
Yoshua Wuyts
79d103d5b4
Remove redundant clones
2021-02-05 16:57:26 +01:00
Jonas Schievink
cacaebcb33
Expander: store a LocalModuleId, not ModuleId
...
It already stores the DefMap containing the module, so having
a full ModuleId is unnecessary and makes it easier to mix things up
2021-02-04 15:04:21 +01:00
Jonas Schievink
26a2a2433c
Don't keep the parent DefMap alive via Arc
...
This seems like it could easily leak a lot of memory since we don't
currently run GC
2021-02-04 13:44:54 +01:00
Jonas Schievink
6458f9107c
Add newline between block and crate maps
2021-02-03 18:23:59 +01:00
Jonas Schievink
63744fe128
Test for name resolution with DefMap shortcut
2021-02-03 15:33:25 +01:00
Jonas Schievink
da57f5dc17
Shortcut block_def_map
if there's no inner items
...
This previously didn't work, but apparently only because of the wonky
test setup
2021-02-03 15:33:25 +01:00
Jonas Schievink
7eff6705cc
Use body lowering for block_def_map tests
...
Removes the hacky and buggy custom lowering code
2021-02-03 14:21:15 +01:00
Jonas Schievink
b7be2b1d3c
Use block_def_map in body lowering
2021-02-03 14:21:15 +01:00
Jonas Schievink
7202ce6c96
Revert "Use block_def_map in body lowering"
2021-02-02 11:46:58 +01:00
Jonas Schievink
80ae583dc0
Use body lowering for block_def_map tests
...
Removes the hacky and buggy custom lowering code
2021-02-01 13:33:18 +01:00
Jonas Schievink
9cc7d57429
Use block_def_map in body lowering
2021-02-01 13:33:18 +01:00
Aleksey Kladov
181590412e
add more counts
2021-01-27 12:16:24 +03:00
Jonas Schievink
4d19607057
Add test for path resolution bug
2021-01-21 20:35:36 +01:00
Jonas Schievink
3f4f253028
Revert "Make use of block_def_map
in body lowering"
2021-01-21 19:04:31 +01:00
Jonas Schievink
cdb0e25aaa
Make use of block_def_map
in body lowering
...
Removes the `local_scope` hack from `Expander` in favor of tracking the
`DefMap` in use during body lowering
2021-01-21 18:05:52 +01:00
Daiki Ihara
85cd3524e2
Add support for yiled keyword
2021-01-15 23:35:17 +09:00
Aleksey Kladov
4c4e54ac8a
prepare to publish el libro de arena
2021-01-14 19:06:02 +03:00
Vincent Esche
21f8239ac8
Fixed typos in code comments
2021-01-09 15:41:29 +01:00
Kevaundray Wedderburn
72b9a4fbd3
Change <|> to $0 - Rebase
2021-01-07 12:09:23 +00:00
Aleksey Kladov
f9707cde68
Rename expr -> tail_expr
2021-01-05 15:51:13 +03:00
bors[bot]
06320015af
Merge #7021
...
7021: Track labels in the HIR r=matklad a=Veykril
Groundwork for #6966
Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2020-12-24 12:04:28 +00:00
Lukas Wirth
262b9c3982
Track labels in the HIR
2020-12-24 12:49:40 +01:00
Lukas Wirth
a142beaf01
Implement const block inference
2020-12-23 12:24:24 +01:00
Lukas Wirth
0a780c0ab3
Implement const pat inference
2020-12-23 12:15:38 +01:00
Lukas Wirth
be7260485e
Update ungrammar for const block patterns
2020-12-23 01:26:31 +01:00
Jonas Schievink
4f07d8dd58
Refactor attributes API to allow handling cfg_attr
2020-12-18 02:24:14 +01:00
Lukas Wirth
dd496223f5
Node-ify lifetimes
2020-12-16 14:16:09 +01:00
Jonas Schievink
b238ddd21a
Make macro def krate mandatory
...
Refactors builtin derive support to go through proper name resolution
2020-12-15 20:33:05 +01:00
Jonas Schievink
c31c3246a8
Basic support for decl macros 2.0
2020-12-15 18:43:34 +01:00
Jonas Schievink
c1cb595382
Move to upstream macro_rules!
model
2020-12-15 15:37:37 +01:00
Edwin Cheng
a68ff269a9
Expand statements for mbe in lowering
2020-12-15 14:39:15 +08:00
Jonas Schievink
6c1d292569
Add test for $crate
in builtin macros
...
Fixes #6716
2020-12-08 17:17:30 +01:00
Jonas Schievink
957fb18799
Make compile_error!
message match upstream rustc
...
It only consists of the argument passed to it
2020-12-03 19:07:37 +01:00
Jonas Schievink
883c8d177d
Make compile_error!
lazy and emit a diagnostic
2020-12-03 15:48:29 +01:00
Jonas Schievink
4634bfb332
Give better diagnostic if OUT_DIR
is unset
2020-12-03 15:48:29 +01:00
Jonas Schievink
17542d08b4
Update/Fix tests
2020-12-03 15:48:29 +01:00
Jonas Schievink
f4866bb05c
Test macro diagnostics in body lowering
2020-12-02 15:03:21 +01:00
Jonas Schievink
319fcd01ac
Attach macro expansion errors to the right file
2020-12-02 14:23:51 +01:00
Jonas Schievink
ea7b81fef9
Emit unresolved proc macro errors
2020-12-01 12:40:03 +01:00
Jonas Schievink
be50908a50
Emit macro diagnostics when lowering bodies
2020-11-30 20:26:35 +01:00
Aleksey Kladov
5db789df9c
Cleanup API
2020-11-06 22:52:42 +01:00
Aleksey Kladov
ba8d6d1e4e
Remove more unreachable pubs
2020-11-02 16:58:33 +01:00
Aleksey Kladov
b610118453
Deny unreachable-pub
...
It's very useful when `pub` is equivalent to "this is crate's public
API", let's enforce this!
Ideally, we should enforce it for local `cargo test`, and only during
CI, but that needs https://github.com/rust-lang/cargo/issues/5034 .
2020-11-02 14:07:08 +01:00
Jonas Schievink
93dc6f511b
Diagnose #[cfg]s in bodies
2020-10-23 19:27:04 +02:00
Lukas Wirth
9909ccb4f4
Fix mut self
not emitting mutable binding on self
use
2020-10-11 18:39:03 +02:00
bors[bot]
0d03fe6ef5
Merge #5971
...
5971: Implement async blocks r=flodiebold a=oxalica
Fix #4018
@flodiebold already gave a generic guide in the issue. Here's some concern about implementation detail:
- Chalk doesn't support generator type yet.
- Adding generator type as a brand new type (ctor) can be complex and need to *re-introduced* builtin impls. (Like how we implement closures before native closure support of chalk, which is already removed in #5401 )
- The output type of async block should be known after type inference of the whole body.
- We cannot directly get the type from source like return-positon-impl-trait. But we still need to provide trait bounds when chalk asking for `opaque_ty_data`.
- During the inference, the output type of async block can be temporary unknown and participate the later inference.
`let a = async { None }; let _: i32 = a.await.unwrap();`
So in this PR, the type of async blocks is inferred as an opaque type parameterized by the `Future::Output` type it should be, like what we do with closure type.
And it really works now.
Well, I still have some questions:
- The bounds `AsyncBlockImplType<T>: Future<Output = T>` is currently generated in `opaque_ty_data`. I'm not sure if we should put this code here.
- Type of async block is now rendered as `impl Future<Output = OutputType>`. Do we need to special display to hint that it's a async block? Note that closure type has its special format, instead of `impl Fn(..) -> ..` or function type.
Co-authored-by: oxalica <oxalicc@pm.me>
2020-09-13 17:28:22 +00:00
Jonas Schievink
07a704e31c
Implement box pattern inference
2020-09-12 21:18:57 +02:00
oxalica
251ef93ac3
Implement async blocks
2020-09-10 20:01:23 +08:00
Aleksey Kladov
863b1fb731
⬆️ ungrammar
2020-08-21 19:14:05 +02:00
Aleksey Kladov
b28c54a2c2
Rename ra_hir_def -> hir_def
2020-08-13 16:29:33 +02:00