You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Since rust-lang/rust#49124, expressions and statements can be mutated if the flag stmt_expr_attributes is used.
Currently, mutagen assumes that mutations happen only on func/methods contexts. For example, there are some mutations that depends on methods_info.
We are also assuming this for the coverage information. We are prepending the static var on the beginning of the scope of a method, but we will need to think about how we will report the coverage when we will mutate single expressions or statements.
First, what code would we mutate here? The only things that may contain exprs outside of fns are consts, statics and [_, N] types, and the latter take only constexprs which we cannot mutate. Am I missing something?
Second, we could introduce a global method info for all extra-function mutations, if there were any. As for statements, we can add our own global static within fold_item, as it returns a SmallVector<P<Item>>.
Ah, I've now revisited the change. It means we could encounter #[mutate] attributes on statements or expressions within methods (or, unfortunately, elsewhere). For now I don't see the need to allow this. First, we'd have to explain why static FOO: u32 = #[mutate] 42; will crash. And usually people will want to mutation test a complete method or function. It rarely makes sense to choose a smaller view, unless you want to limit mutations, but in that case, I'd rather have a #[nomutate] attribute.
I'm ok with not allowing this, but maybe we should give some feedback to the user. As now Rust allows to annotate expressions and statements, maybe we should, somehow, raise a warning that the annotated expr/stmt won't be mutated.
Since rust-lang/rust#49124, expressions and statements can be mutated if the flag
stmt_expr_attributes
is used.Currently, mutagen assumes that mutations happen only on func/methods contexts. For example, there are some mutations that depends on
methods_info
.We are also assuming this for the coverage information. We are prepending the static var on the beginning of the scope of a method, but we will need to think about how we will report the coverage when we will mutate single expressions or statements.
Related: 15b2e37
The text was updated successfully, but these errors were encountered: