-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Implement env! macro #3549
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implement env! macro #3549
Conversation
|
||
// Note: Some env variables (e.g. OUT_DIR) are located outside of the | ||
// crate. We store a map to allow remap it to ExternSourceId | ||
extern_paths: FxHashMap<String, ExternSourceId>, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hm, it's ... less then ideal that we need to single out OUT_DIR
this way, but I guess that's the only way given current VFS API...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, it is the only solution I came up without altering too much code. But after some thoughts, I think I should separate this part to a new struct ExternPaths
ExternSource
and put it in CrateGraph
instead.
[Edit] change to ExternSource
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done!
I could look into hooking up the check code to send events for the OUT_DIR
info and add a way to trigger a single check sometime this week. Shouldn't
be too hard given that all the infrastructure for event passing is already
in place 👍
…On Wed, 11 Mar 2020, 04.07 Edwin Cheng, ***@***.***> wrote:
***@***.**** commented on this pull request.
------------------------------
In crates/ra_db/src/input.rs
<#3549 (comment)>
:
> #[derive(Default, Debug, Clone, PartialEq, Eq)]
pub struct Env {
entries: FxHashMap<String, String>,
+
+ // Note: Some env variables (e.g. OUT_DIR) are located outside of the
+ // crate. We store a map to allow remap it to ExternSourceId
+ extern_paths: FxHashMap<String, ExternSourceId>,
Done!
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#3549>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AABTDKNNGM2EIKW7LC5KDWDRG357FANCNFSM4LFBOCEA>
.
|
bors r+ |
Build succeeded |
Cleans up the code a bit in tari_core::proto by removing the `generated` module. Instead of including the generated files directly, protos are generated to the OUT_DIR and included using the `include!` macro. This is the intended way that generated files are included, however this would break intellisense in IDEs. IDE and rust analyser support for OUT_DIR has greatly improved. see: https://blog.jetbrains.com/clion/2019/12/recent-updates-in-rust/ rust-lang/rust-analyzer#3549
Cleans up the code a bit in tari_core::proto by removing the `generated` module. Instead of including the generated files directly, protos are generated to the OUT_DIR and included using the `include!` macro. This is the intended way that generated files are included, however this would break intellisense in IDEs. IDE and rust analyser support for OUT_DIR has greatly improved. see: https://blog.jetbrains.com/clion/2019/12/recent-updates-in-rust/ rust-lang/rust-analyzer#3549
Cleans up the code a bit in tari_core::proto by removing the `generated` module. Instead of including the generated files directly, protos are generated to the OUT_DIR and included using the `include!` macro. This is the intended way that generated files are included, however this would break intellisense in IDEs. IDE and rust analyser support for OUT_DIR has greatly improved. see: https://blog.jetbrains.com/clion/2019/12/recent-updates-in-rust/ rust-lang/rust-analyzer#3549
Cleans up the code a bit in tari_core::proto by removing the `generated` module. Instead of including the generated files directly, protos are generated to the OUT_DIR and included using the `include!` macro. This is the intended way that generated files are included, however this would break intellisense in IDEs. IDE and rust analyser support for OUT_DIR has greatly improved. see: https://blog.jetbrains.com/clion/2019/12/recent-updates-in-rust/ rust-lang/rust-analyzer#3549
This PR implements
env!
macro by adding following things:additional_outdirs
settings in vscode. (naming to be bikeshed)ExternSourceId
which is a wrapping for SourceRootId but only used in extern sources. It is becauseOUT_DIR
is not belonged to any crate and we have to access it behind anAstDatabase
.OUT_DIR
parsing fromcargo check
. I don't have general design about this, @kiljacken could we reuse some cargo watch code for that ?Block on [#3536]PS: After this PR , we (kind of) completed the
include!(concat!(env!('OUT_DIR'), "foo.rs")
macro call combo. Exodia Obliterate!