-
Notifications
You must be signed in to change notification settings - Fork 12.8k
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
ICE: -Z unstable-options
without extra argument
#21715
Comments
Oh dear, sorry about that! |
Just hit this myself - it would seem that the pretty option has disappeared too, making it very difficult to debug compiler plugins. |
I believe that this specific error has been fixed, only to be replaced by this:
Note that the unspecified options is now |
And it also happens if you simply do |
If I understand correctly, the problem is that if sess.unstable_options() {
sess.opts.show_span = matches.opt_str("show-span");
} It's missing due to the way we parse unstable options in
One obvious fix is to ensure that I think I have a fix; I'll test it. |
* Consumers of handle_options assume the unstable options are defined in the getopts::Matches value if -Z unstable-options is set, but that's not the case if there weren't any actual unstable options. Fix this by always reparsing options when -Z unstable-options is set. * If both argument parsing attempts fail, print the error from the second attempt rather than the first. The error from the first is very poor whenever unstable options are present. e.g.: $ rustc hello.rs -Z unstable-options --show-span error: Unrecognized option: 'show-span'. $ rustc hello.rs -Z unstable-options --pretty --pretty error: Unrecognized option: 'pretty'. $ rustc hello.rs -Z unstable-options --pretty --bad-option error: Unrecognized option: 'pretty'. * On the second parse, add a separate pass to reject unstable options if -Z unstable-options wasn't specified. Fixes rust-lang#21715. r? @pnkfelix
Is it worth considering adding one or more |
I think so. I'll look into it. |
@rprichard actually, doing this nicely might be harder than I initially thought, since in all the cases listed above, the ... so the Update: I guess we could at least ensure that we do not emit |
It's supposed to succeed quietly in the case where AFAIK, we don't have a test verifying that unstable options require |
@rprichard I guess I was solely looking at the original description ... running |
Oh, right, the original test should still have failed for lack of a |
* Consumers of handle_options assume the unstable options are defined in the getopts::Matches value if -Z unstable-options is set, but that's not the case if there weren't any actual unstable options. Fix this by always reparsing options when -Z unstable-options is set. * If both argument parsing attempts fail, print the error from the second attempt rather than the first. The error from the first is very poor whenever unstable options are present. e.g.: $ rustc hello.rs -Z unstable-options --show-span error: Unrecognized option: 'show-span'. $ rustc hello.rs -Z unstable-options --pretty --pretty error: Unrecognized option: 'pretty'. $ rustc hello.rs -Z unstable-options --pretty --bad-option error: Unrecognized option: 'pretty'. * On the second parse, add a separate pass to reject unstable options if -Z unstable-options wasn't specified. Fixes rust-lang#21715. r? @pnkfelix
The text was updated successfully, but these errors were encountered: