Skip to content

Fix CodeMap issue in expand_include_str() #11401

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

Closed

Conversation

michaelwoerister
Copy link
Member

expand_include_str() in libsyntax seems to have corrupted the CodeMap by always setting the BytePos of any included files to zero. It now uses CodeMap::new_filemap() which should set everything properly. This should fix issue #11322 but I don't want to close it before I have confirmation from the reporters that the problem is indeed fixed.

@alexcrichton
Copy link
Member

Could you add a test for this as well? Thanks for looking into this!

@michaelwoerister
Copy link
Member Author

Done!

@michaelwoerister
Copy link
Member Author

Unfortunately I don't have a computer running OS X available. Otherwise I would have already looked into it. I didn't even know that it didn't work until three weeks ago :P

bors added a commit that referenced this pull request Jan 8, 2014
`expand_include_str()` in libsyntax seems to have corrupted the CodeMap by always setting the BytePos of any included files to zero. It now uses `CodeMap::new_filemap()` which should set everything properly. This should fix issue #11322 but I don't want to close it before I have confirmation from the reporters that the problem is indeed fixed.
@bors bors closed this Jan 8, 2014
@michaelwoerister michaelwoerister deleted the issue11322 branch February 7, 2022 09:28
flip1995 pushed a commit to flip1995/rust that referenced this pull request Sep 7, 2023
[`if_then_some_else_none`]: look into local initializers for early returns

Fixes rust-lang#11394

As the PR title says, problem was that it only looked for early returns in semi statements. Local variables don't count as such, so it didn't count `let _v = x?;` (or even just `let _ = return;`) as a possible early return and didn't realize that it can't lint then.

Imo the `stmts_contains_early_return` function that was used before is redundant. `contains_return` could already do that if we just made the parameter a bit more generic, just like `for_each_expr`, which can already accept `&[Stmt]`

changelog: [`if_then_some_else_none`]: look into local initializers for early returns
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants