12

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
  • 286,368
  • 41
  • 520
  • 731
Josh
  • 2,005
  • 1
  • 16
  • 21

1 Answers1

11

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
  • 326,504
  • 69
  • 892
  • 1,159
  • 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