-
Notifications
You must be signed in to change notification settings - Fork 12.9k
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
-Zunpretty=expanded
does not preserve hygiene
#13573
Comments
The problem here is generally that rustc --pretty doesn't respect hygiene. You can see this by expanding this program #![feature(macro_rules)]
macro_rules! dont_capture {($v:expr) => ({let _x = 13; $v})}
fn main() -> (){
let _x = 2;
let y = dont_capture!(_x);
println!("2 = {}",y);
} using rustc --pretty expanded, which shows a program where the inner let should clearly capture the inner varref. As far as I know, rustc --pretty doesn't claim to preserve semantics. I would argue that this is currently not a bug, or perhaps a change request. |
Triage: no changes I'm aware of. |
Loops are no longer expanded as suggested by this issue as far as I can tell. However, the macro example still doesn't work quite correctly in that |
i
when for
is expanded
Triage: no change |
Triage: no change. However, there is a new option
|
internal: error instead of panic on invalid file range Fixes the panic in rust-lang/rust-analyzer#13170
-Zunpretty=expanded
does not preserve hygiene
Don't lint unnamed consts and nested items within functions in `missing_docs_in_private_items` With this change we no longer require doc comments for `const _: ()` items as well as nested items in functions or other bodies. In both of those cases, rustdoc generates no documentation even with `--document-private-items`. Fixes rust-lang#13427 (first commit) Fixes rust-lang#13298 (second commit) cc rust-lang/rust-clippy#5736 (comment) changelog: [`missing_docs_in_private_items`]: avoid linting in more cases where rustdoc generates no documentation
rustc internally converts
for val in iter { ... }
to:where
i
is created bylet local_ident = token::gensym_ident("i");
, soi
does not clash with other local variables.However, pprust just prints it as plain
i
. So the following code:is prettified by rustc as:
which is not correct anymore.
The text was updated successfully, but these errors were encountered: