-
Notifications
You must be signed in to change notification settings - Fork 3
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
Disable dependency errors (so only the current project is affected) #1
Comments
Lib authors could perhaps have an optional envar like Perhaps there's a Cargo metadata route that can disable all todo_by errors for a lib and its dependencies. |
An easy way to do this is return quote! {
#[cfg(test)]
compile_error!(#error_message);
#[cfg(not(test))]
pub const _: () = {
#[deprecated(note = #error_message)]
const TODO: () = ();
TODO
};
}
.into(); which would satisfy #2 also. It works by the fact that dependencies don't get passed
and when testing a crate which has
|
You could do something like #[forbid(dead_code)]
#[allow(non_upper_case_globals)]
const TODO_by_Jan_1_2022_has_passed: () = (); For dependencies cargo will pass |
Someone on Reddit brought up the CARGO_PRIMARY_PACKAGE envar. Here's what it says in the docs:
So we can attempt to use this to scope to the "current working crate", hopefully. I think this lib should provide a warning instead of a strong error though in order to have reproducible builds. |
I tested the CARGO_PRIMARY_PACKAGE envar and it's a dead end. I created a dependency tree to test like
Edit: It was present in the |
How did you implement it? It should work just fine, as long as you use |
Yep, this is what I used. I logged out the value along with the project name so I would know which depth the value came from. All said the same thing. I can try again though. |
Currently, if you publish/offer a crate and a todo_by expires in the lib code, then I believe it would be an unfixable compilation error for anyone importing the crate.
Is there a way around this? Can we limit the context in which this compiler error shows?
The text was updated successfully, but these errors were encountered: