Skip to content

rustc -g file.rs does not work #12811

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
pnkfelix opened this issue Mar 10, 2014 · 1 comment
Closed

rustc -g file.rs does not work #12811

pnkfelix opened this issue Mar 10, 2014 · 1 comment

Comments

@pnkfelix
Copy link
Member

After PR #12714, the -g option to rustc stopped working robustly.

Basically, it seems to gobble up any succeeding token as the numeric argument setting the debuginfo level, so you cannot pass -g immediately before the input file name.

Here is an example of the breakage:

% rustc /tmp/hw.rs -g
% rustc -g /tmp/hw.rs
error: no input filename given
% rustc -g=2 /tmp/hw.rs
error: debug info level needs to be between 0-2
% rustc -g 2 /tmp/hw.rs
% rustc -g2 /tmp/hw.rs
% 

My recommended fix: split the options so that --debuginfo requires the level parameter, while -g does not accept a level parameter (and instead always has the same effect as --debuginfo 2).

@michaelwoerister
Copy link
Member

There's already some discussion about this problem on reddit.
I'd prefer if libgetopts had a way of robustly handling optional arguments but implementing that with a nice, non-hacky interface would probably mean more work than I want to spend on this at the moment.
I think your proposed fix (also suggested on reddit by @SiegeLord) seems like a good solution for the time being.

bors added a commit that referenced this issue Mar 12, 2014
@bors bors closed this as completed in 3ea50f0 Mar 12, 2014
fasterthanlime pushed a commit to fasterthanlime/rust that referenced this issue Jul 22, 2022
fix: Insert `pub(crate)` after doc comments and attribute macros

Fixes rust-lang#12790

Original behavior was to insert `pub(crate)` at the `first_child_or_token`, which for an item with a comment or attribute macro, would put the visibility marker before the comment or macro, instead of after.

This merge request alters the call to find the node with appropriate `SyntaxKind` in the `children_or_tokens`. It also adds a test case to the module to verify the behavior. Test case verifies function, module, records, enum, impl, trait, and type cases.
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 a pull request may close this issue.

2 participants