Skip to content

Remove -Z no-opt flag, allow --opt-level override, and add -O<n> flag #14336

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Closed
wants to merge 4 commits into from

Conversation

wsddn
Copy link

@wsddn wsddn commented May 21, 2014

Remove the -Z no-opt flag from rustc, fix #13649.

Also fix #7493 and in the process add -O<n> flag in the same vein as gcc, clang, and ghc.

The additional flag -O<n> flag may not be desired, but doing it this way unifies the two optimisation flags and results in clearer code.

Backwards compatibility is kept as the -O flag still defaults to optimisation level 2. However this only works when no other -O<n> or --opt-level arguments are passed to rustc (is this bad?).

@alexcrichton
Copy link
Member

There's been some issues in the past with getopts and optional values, if I invoke the compiler via

rustc -O foo.rs

Will that interpret foo.rs as an optimization level or as the file to compile?

@wsddn
Copy link
Author

wsddn commented May 22, 2014

You are right in this current state the patch will not work, my mistake. The reason behind this is that, using this method, you cannot maintain backwards compatibility with -O, unify the optimisation flags, and allow the user to override -O flags.

Following thestinger's comments it is questionable if overriding of optimisation flags is even a good idea.

I propose that this should be discussed more on #7493 and that I close this PR.

@wsddn wsddn closed this May 22, 2014
bors added a commit to rust-lang-ci/rust that referenced this pull request Mar 20, 2023
internal: add `as_slice` to `hir::Type`

~`remove_slice`~ `as_slice` is same as `remove_ref` but for slices.

Though there is `as_array` which I believe was named such because it also gets the length of the array, maybe. I am still shaky on the names feel free to suggest corrections.
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

remove the -Z no-opt flag Can not override previous opt-levels in list of command flags
3 participants