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

Hygiene Example Typo #74118

Closed
BeniReydman opened this issue Jul 7, 2020 · 1 comment
Closed

Hygiene Example Typo #74118

BeniReydman opened this issue Jul 7, 2020 · 1 comment
Labels
A-docs Area: Documentation for any part of the project, including the compiler, standard library, and tools

Comments

@BeniReydman
Copy link

What needs to be fixed?

In the Rust book under Hygiene section for the following code:

macro_rules! foo {
    ($v:ident) => (let $v = 3);
}

fn main() {
    foo!(x);
    println!("{}", x);
}

There is missing a semi-colon at the line let $v = 3 which doesn't compile in Rust Playground

Page(s) Affected

https://doc.rust-lang.org/1.7.0/book/macros.html#hygiene

@Manishearth Manishearth transferred this issue from rust-lang/www.rust-lang.org Jul 7, 2020
@Manishearth Manishearth added the A-docs Area: Documentation for any part of the project, including the compiler, standard library, and tools label Jul 7, 2020
@ehuss
Copy link
Contributor

ehuss commented Jul 7, 2020

That link is from the 1.7 docs, which is more than 4 years old. I believe that code was valid at the time, but was changed in #34660.

The corrected, old documentation can be found at: https://doc.rust-lang.org/1.30.0/book/first-edition/macros.html#hygiene
Hygiene was removed from the new edition (https://doc.rust-lang.org/book/ch19-06-macros.html). I would guess that is because it is an advanced topic, which is covered in the reference.

cc #44687, where there really should be a version selector, and https://internals.rust-lang.org/t/adding-outdated-notices-to-archived-versions-of-documentation/12281 for the request for a bold disclaimer to indicate you are looking at outdated documentation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-docs Area: Documentation for any part of the project, including the compiler, standard library, and tools
Projects
None yet
Development

No branches or pull requests

4 participants