Expression with ill-formed type
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 1/5
- Estimated time
- Under an hour
- Newbie friendliness
- 94/100
Research direction
Open parser/src/lib.rs around lines 90–100 and read the self.parse_top match described in the issue. Remove the extra reference operator as specified, then run the parser crate’s tests or compile check. Done when the crate compiles with the Rust lifetime fix.
Written by the indexing model from the issue text.
Description
In some cases, the compiler has accidentally allowed types' lifetime constraints to be bypassed (e.g., &'a T requires that T: 'a), which causes... problems. The parser crate here somehow managed to be affected, and this bug fix would cause it to no longer compile: https://github.com/rust-lang/rust/pull/164277
Thankfully, AFAICT, a one-character fix is enough.
Problem and explanation
The problem lies here: https://github.com/uutils/awk/blob/c7a7cd64d68507d61b125f02713850cf1973a06d/parser/src/lib.rs#L90-L100
Let's say that the lifetime of the outer reference type of &mut self is 'b and the lifetime of the outer reference type of &self.parse_top(&mut lex, true) is 'c.
Then, &self.parse_top(&mut lex, true) has type &'c Result<&'b Ast<'a>>, and in the error branch, error has type &'c ParsingError. self is mutably (exclusively) borrowed until 'b expires, error cannot outlive 'c, and self is borrowed again before the last usage of error. This could only occur if 'b is strictly shorter than 'c, which makes type &'c Result<&'b Ast<'a>> ill-formed (we have a &'c T without T: 'c). So, with a bug fix, this would be rejected.
Fix
Match self.parse_top(&mut lex, true) instead of &self.parse_top(&mut lex, true). Just remove one ampersand.
- Dominant language
- Rust
- Stars
- 30
- Forks
- 10
- Avg merge
- 1d 8h
- Merged PRs (30d)
- 17
Getting set up
This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from uutils/awk
-
bug
Difficulty 4/5 3-5 days Newbie friendliness 48/100
Maintainers usually reply within 1 day
-
bug
Difficulty 3/5 1-2 days Newbie friendliness 45/100
Maintainers usually reply within 1 day
-
Missing record splitting modesPossibly taken @Franklin-Qi claimed this 46 days ago. Openenhancement
Maintainers usually reply within 1 day
-
GNU bug
Difficulty 3/5 1-2 days Newbie friendliness 62/100
Maintainers usually reply within 1 day
-
Add pwcat commandPossibly taken @Franklin-Qi claimed this 130 days ago. Open
Difficulty 3/5 1-2 days Newbie friendliness 45/100
Maintainers usually reply within 1 day
Similar issues
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
Maintainers usually reply within 2 days
-
enhancement good first issue help wanted
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Maintainers usually reply within 1 day
-
area:ui
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
openfootmanager/openfootmanager#1365 ·
Maintainers usually reply within 1 day
-
documentation
Difficulty 1/5 1-3 hours Newbie friendliness 90/100
JackMechem/marbble#305 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
boxlite-ai/boxlite#2543 ·
Maintainers usually reply within 1 day