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

Document file!() and line!() macros #8683

Closed
orenbenkiki opened this issue Aug 22, 2013 · 4 comments
Closed

Document file!() and line!() macros #8683

orenbenkiki opened this issue Aug 22, 2013 · 4 comments

Comments

@orenbenkiki
Copy link

** ORIGINAL ISSUE **

Title: Provide macros similar to CPP's __FILE__ and __LINE__.

Perhaps file!() and line!()?

@alexcrichton
Copy link
Member

These actually both already exist :)

$ cat asdf.rs
fn main() {
    printfln!("%? %?", file!(), line!());
}
$ rust run asdf.rs
warning: no debug symbols in executable (-arch x86_64)
"asdf.rs" 2

@orenbenkiki
Copy link
Author

In that case, they should be listed in the documentation...

@alexcrichton
Copy link
Member

That is a good point, reopening and tweaking title, original was

Provide macros similar to CPP's `__FILE__` and `__LINE__`.

@alexcrichton alexcrichton reopened this Aug 22, 2013
@alexcrichton
Copy link
Member

Actually, closing as a dupe of #6444

flip1995 pushed a commit to flip1995/rust that referenced this issue Aug 11, 2022

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
More proc-macro detection

fixes rust-lang#6514
fixes rust-lang#8683
fixes rust-lang#6858
fixes rust-lang#6594

This is a more general way of checking if an expression comes from a macro and could be trivially applied to other lints. Ideally this would be fixed in rustc's proc-macro api, but I don't see that happening any time soon.

changelog: FPs: [`unit_arg`] [`default_trait_access`] [`missing_docs_in_private_items`]: No longer trigger in code generated from proc-macros.
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

No branches or pull requests

2 participants