Jonas Schievink
090b2f0e50
Fix incorrect FileId
and remove broken shortcut
...
Apparently we were using the crate's root file instead of the file
containing the block.
2021-01-28 19:33:00 +01:00
Jonas Schievink
7177045a67
block_def_map: add a few macro tests
2021-01-28 18:53:35 +01:00
Jonas Schievink
232b75394e
Update original_module
when ascending DefMap
s
2021-01-28 18:27:27 +01:00
Jonas Schievink
ad254f4c97
Fix legacy macro resolution in block expressions
2021-01-27 19:16:39 +01:00
Jonas Schievink
08253d5473
Traverse parent DefMap for super
paths
2021-01-25 19:15:39 +01:00
Jonas Schievink
98a88ebb9e
Intern block locations and handle them in ModuleId
2021-01-25 19:02:05 +01:00
Jonas Schievink
5c241b0766
Create all ModuleId
s through a DefMap
method
...
`ModuleId` needs to be able to represent blocks, and only the
associated `DefMap` will know how to construct that `ModuleId`
2021-01-25 15:21:33 +01:00
bors[bot]
eab5db20ed
Merge #7391
...
7391: Fix error when using "extern crate self as" r=kazatsuyu a=kazatsuyu
Fix #6957
Co-authored-by: kazatsuyu <shirayama.kazatsuyu@gmail.com>
2021-01-23 04:04:09 +00:00
Jonas Schievink
ce29730bc7
Obtain ModuleId
's DefMap
through a method
2021-01-22 16:33:58 +01:00
kazatsuyu
90d6740e32
Add mark::check! and mark::hit!
2021-01-23 00:11:37 +09:00
kazatsuyu
0fb4544403
cargo fmt
2021-01-22 22:52:04 +09:00
kazatsuyu
e52589e3a7
Fix error when using "extern crate self as"
2021-01-22 22:28:45 +09:00
Jonas Schievink
d157a03e93
Remove unnecessary annotations from tests
2021-01-21 17:19:46 +01:00
Jonas Schievink
4e603b7947
Add test for nameres in nested blocks
2021-01-21 16:42:56 +01:00
Jonas Schievink
ec4a1dc297
Add test that merges inner and outer names
2021-01-21 16:23:50 +01:00
Jonas Schievink
f8f44cfb9b
Fall back to parent DefMaps when resolving paths
2021-01-21 15:24:15 +01:00
Jonas Schievink
896dfacfc4
Add name resolution query for block expressions
2021-01-21 15:22:17 +01:00
Jonas Schievink
57a82fb05b
Rename CrateDefMap
to DefMap
2021-01-18 20:18:05 +01: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
Jonas Schievink
3cb7c8b548
Emit diagnostics for unresolved item-level macros
2021-01-05 15:42:43 +01:00
Edwin Cheng
877c251bef
Fixed old failed test due to new fixes
2020-12-28 20:08:50 +08:00
Aleksey Kladov
2c84c2d07a
Don't think that /submod.rs is /mod.rs
2020-12-23 11:02:42 +03:00
Jonas Schievink
aa00d1acd6
fixture -> ra_fixture
2020-12-19 01:12:41 +01:00
Jonas Schievink
d5edd0e928
Test paths to derive macros
2020-12-19 01:11:33 +01:00
Jonas Schievink
ea5cc8d07a
More accurate #[derive]
parsing
...
This now allows full paths to the derive macro
2020-12-19 01:10:56 +01:00
bors[bot]
38b108c20e
Merge #6935
...
6935: Don't look at attributes when lowering to ItemTree r=jonas-schievink a=jonas-schievink
Resolves 2 `cfg_attr` FIXMEs
bors r+
Co-authored-by: Jonas Schievink <jonasschievink@gmail.com>
2020-12-18 19:38:07 +00:00
Jonas Schievink
77972e2001
Don't look at attributes when lowering to ItemTree
...
Resolves 2 `cfg_attr` FIXMEs
2020-12-18 20:37:26 +01:00
Jonas Schievink
aab9cc9cfb
Hit a mark
2020-12-18 20:25:41 +01:00
Jonas Schievink
382ee2fa03
Add test
2020-12-18 20:01:02 +01:00
Jonas Schievink
4f07d8dd58
Refactor attributes API to allow handling cfg_attr
2020-12-18 02:24:14 +01:00
Jonas Schievink
28b5334580
Avoid querying attributes in item tree lowering
...
ItemTree is per-file, so there is no unique crate associated with it.
This means that it cannot know the active CfgOptions and thus couldn't
handle `cfg_attr`.
Prepare it for `cfg_attr`s by avoiding accessing attributes.
2020-12-16 23:42:03 +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
Aleksey Kladov
6e24321e45
Introduce anchored_path
...
They allow to represent paths like `#[path = "C:\path.rs"] mod foo;`
in a lossless cross-platform & network-transparent way.
2020-12-09 19:07:05 +03:00
Lukas Wirth
2facd9517f
Escape string literals in Attr::from_src
2020-12-08 13:47:58 +01:00
Lukas Wirth
7b456552b8
Don't discard PathKind::Abs information in lower_use::convert_path
2020-12-02 09:54:03 +01:00
Jonas Schievink
0432aa0ed7
Publish diagnostics for macro expansion errors
2020-11-27 13:50:22 +01:00
Jonas Schievink
519d870c11
Don't store SyntaxNodePtr
in CrateDefMap
...
It is volatile across reparses and makes incrementality worse.
2020-11-26 17:29:09 +01:00
Jonas Schievink
74cb3e96a5
Test def map invalidation with #[cfg] below change
2020-11-26 17:28:00 +01:00
Aleksey Kladov
2b108133ac
Don't stack overflow on circular modules
...
closes #6453
2020-11-04 15:31:35 +01:00
bors[bot]
8ad01d863b
Merge #6435
...
6435: Test Fixture ExplicitRoot + ModuleResolutionRelativePathOutsideRoot. r=matklad a=rickvanprim
Updates `module_resolution_relative_path_outside_root` test to check valid paths outside of the root, by moving the root to a subpath so that paths outside of it are possible. If this would be more appropriate as a new test, or if the original check for an invalid path should be left, I'm happy to update.
Co-authored-by: James Leitch <rickvanprim@gmail.com>
2020-11-03 16:36:34 +00:00
James Leitch
ff87726074
Feedback.
2020-11-02 10:57:31 -07: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
James Leitch
d2d7a4403c
Test Fixture ExplicitRoot + ModuleResolutionRelativePathOutsideRoot.
2020-11-01 17:20:55 -07:00
Jonas Schievink
cd3c632cfc
Handle #![cfg] in crate root
2020-10-26 16:04:08 +01:00
Jonas Schievink
93dc6f511b
Diagnose #[cfg]s in bodies
2020-10-23 19:27:04 +02:00
Jonas Schievink
3421b645e6
Emit better #[cfg] diagnostics
2020-10-22 19:19:18 +02:00