Open RalfJung opened 2 weeks ago
@oli-obk any idea what the best way might be to implement such an attribute? I am imagining something like
#![miri::flag("-Zmiri-tree-borrows")]
Usually this would be gated by cfg_attr(miri, ...)
.
In a lib crate this has no effect (we should likely lint against that), but in a binary crate this makes Miri act as-if those flags were passes on the command line.
Or should this maybe even be a more general rustc feature?
yea I've wanted this as a general rustc feature before, but it can't really work because some flags are processed before the source file is even opened.
I think I would prefer just allowing miri flags to also be used via native attributes like #[miri::tree_borrows]
. We can set up the infrastructure to not duplicate the logic between attributes and command line flags
It could be quite useful to support a crate-level attribute on binary crates like
#[miri::flag("-Zmiri-disable-leak-check")]
. That would help both on the playground and for doctests, to control the flags the file is run with.Not sure how to best implement that though, and it may be considered an abomination by the compiler team. ;)