Skip to content
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

rust: fails to reduce away items completely #180

Open
matthiaskrgr opened this issue Mar 18, 2024 · 1 comment
Open

rust: fails to reduce away items completely #180

matthiaskrgr opened this issue Mar 18, 2024 · 1 comment
Labels
enhancement New feature or request

Comments

@matthiaskrgr
Copy link

matthiaskrgr commented Mar 18, 2024

Often when reducing fuzzed code, for example

impl<T> VSet<T, {  }> {
    pub fn new(
        _: for<'a> fn(
            capture: T,
            std::marker::PhantomData<&'a ()>,
        ) -> <M2::Yokeable as Yokeable<'a>>::Output,
    ) -> Self {
        
    }
}

treereduce will manage to reduce away items, but keep the commas separating them
=>

impl<T> VSet<T, {  }> {
    pub fn new(
        ,
    ) -> Self {
        
    }
}

which will then throw annoying syntax errors, hinder further reduction or throw off rustfmt

I think I have seen this with enum/structs too

@langston-barrett
Copy link
Owner

Thanks for the report! This is due to the fact that treereduce works by deleting tree-sitter AST nodes via their byte ranges. So it's deleting the argument nodes, but their ranges don't include the comma. Not sure what the best fix for this would be.

@langston-barrett langston-barrett changed the title fails to reduce away items completely rust: fails to reduce away items completely Mar 19, 2024
@langston-barrett langston-barrett added the enhancement New feature or request label Mar 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants