14

I feel like binary portability isn't really a concern, and so something like -march=native may always be the default behavior. I can't find anything saying one way or the other though.

Peter Cordes
  • 328,167
  • 45
  • 605
  • 847
Josh
  • 2,077
  • 1
  • 17
  • 21

1 Answers1

13

As mentioned in the comments, pass the -C target-cpu option to rustc:

rustc -C target-cpu=native

For more options:

$ rustc -C help
    ...     
    -C        target-cpu=val -- select target processor (rustc --print target-cpus for details)
    ...

See How to pass rustc flags to cargo? for more methods of passing the option.

I feel like binary portability isn't really a concern

I'm pretty sure that the Firefox developers that rely on Rust would disagree with you, as well as plenty of others.

Shepmaster
  • 388,571
  • 95
  • 1,107
  • 1,366
  • That's absolutely true... I knew I was missing something. I was thinking that crates are installed locally through cargo install - which compiles from source. Dependencies are also source-based. Thanks! – Josh Oct 17 '17 at 14:19