1. 20 11月, 2017 1 次提交
    • A
      std: Add a new wasm32-unknown-unknown target · 80ff0f74
      Alex Crichton 提交于
      This commit adds a new target to the compiler: wasm32-unknown-unknown. This
      target is a reimagining of what it looks like to generate WebAssembly code from
      Rust. Instead of using Emscripten which can bring with it a weighty runtime this
      instead is a target which uses only the LLVM backend for WebAssembly and a
      "custom linker" for now which will hopefully one day be direct calls to lld.
      
      Notable features of this target include:
      
      * There is zero runtime footprint. The target assumes nothing exists other than
        the wasm32 instruction set.
      * There is zero toolchain footprint beyond adding the target. No custom linker
        is needed, rustc contains everything.
      * Very small wasm modules can be generated directly from Rust code using this
        target.
      * Most of the standard library is stubbed out to return an error, but anything
        related to allocation works (aka `HashMap`, `Vec`, etc).
      * Naturally, any `#[no_std]` crate should be 100% compatible with this new
        target.
      
      This target is currently somewhat janky due to how linking works. The "linking"
      is currently unconditional whole program LTO (aka LLVM is being used as a
      linker). Naturally that means compiling programs is pretty slow! Eventually
      though this target should have a linker.
      
      This target is also intended to be quite experimental. I'm hoping that this can
      act as a catalyst for further experimentation in Rust with WebAssembly. Breaking
      changes are very likely to land to this target, so it's not recommended to rely
      on it in any critical capacity yet. We'll let you know when it's "production
      ready".
      
      ---
      
      Currently testing-wise this target is looking pretty good but isn't complete.
      I've got almost the entire `run-pass` test suite working with this target (lots
      of tests ignored, but many passing as well). The `core` test suite is still
      getting LLVM bugs fixed to get that working and will take some time. Relatively
      simple programs all seem to work though!
      
      ---
      
      It's worth nothing that you may not immediately see the "smallest possible wasm
      module" for the input you feed to rustc. For various reasons it's very difficult
      to get rid of the final "bloat" in vanilla rustc (again, a real linker should
      fix all this). For now what you'll have to do is:
      
          cargo install --git https://github.com/alexcrichton/wasm-gc
          wasm-gc foo.wasm bar.wasm
      
      And then `bar.wasm` should be the smallest we can get it!
      
      ---
      
      In any case for now I'd love feedback on this, particularly on the various
      integration points if you've got better ideas of how to approach them!
      80ff0f74
  2. 06 2月, 2017 1 次提交
  3. 04 2月, 2017 1 次提交
  4. 06 1月, 2017 1 次提交
  5. 03 1月, 2017 1 次提交
  6. 25 8月, 2015 1 次提交
  7. 16 3月, 2015 1 次提交
  8. 17 1月, 2015 1 次提交
    • A
      syntax: Feature gate #[start] and #[main] · 38cb91e6
      Alex Crichton 提交于
      These two attributes are used to change the entry point into a Rust program, but
      for now they're being put behind feature gates until we have a chance to think
      about them a little more. The #[start] attribute specifically may have its
      signature changed.
      
      This is a breaking change to due the usage of these attributes generating errors
      by default now. If your crate is using these attributes, add this to your crate
      root:
      
          #![feature(start)] // if you're using the #[start] attribute
          #![feature(main)]  // if you're using the #[main] attribute
      
      cc #20064
      38cb91e6
  9. 10 1月, 2015 1 次提交
    • A
      syntax: Add #[allow(unstable)] to --test expansion · 9cc847d8
      Alex Crichton 提交于
      This will temporarily prevent warnings generated from expanding to code that the
      test harness itself uses. This solution will require tweaking around the beta
      cycle, but it will prevent spurious warnings for now.
      
      Closes #20823
      9cc847d8
  10. 05 1月, 2015 1 次提交
  11. 02 1月, 2015 1 次提交
  12. 25 8月, 2014 1 次提交
    • A
      rustc: Encode the visibility of foreign items · 1c76d559
      Alex Crichton 提交于
      The privacy pass of the compiler was previously not taking into account the
      privacy of foreign items, or bindings to external functions. This commit fixes
      this oversight by encoding the visibility of foreign items into the metadata for
      each crate.
      
      Any code relying on this will start to fail to  compile and the bindings must be
      marked with `pub` to indicate that they can be used externally.
      
      Closes #16725
      [breaking-change]
      1c76d559
  13. 16 5月, 2014 1 次提交
    • F
      Unit tests for flowgraph pretty printing. · 3aad0e24
      Felix S. Klock II 提交于
      Each test works by rendering the flowgraph for the last identified
      block we see in expanded pretty-printed output, and comparing it (via
      `diff`) against a checked in "foo.dot-expected.dot" file.
      
      Each test post-processes the output to remove NodeIds ` (id=NUM)` so
      that the expected output is somewhat stable (or at least independent
      of how we assign NodeIds) and easier for a human to interpret when
      looking at the expected output file itself.
      
      ----
      
      Test writing style notes:
      
      I usually tried to write the tests in a way that would avoid duplicate
      labels in the output rendered flow graph, when possible.
      
      The tests that have string literals "unreachable" in the program text
      are deliberately written that way to remind the reader that the
      unreachable nodes in the resulting graph are not an error in the
      control flow computation, but rather a natural consequence of its
      construction.
      3aad0e24
  14. 07 4月, 2014 1 次提交
  15. 21 3月, 2014 2 次提交
  16. 08 2月, 2014 1 次提交
  17. 23 12月, 2013 1 次提交
  18. 13 12月, 2013 1 次提交
  19. 30 11月, 2013 1 次提交
    • A
      Add a new run-make test directory · 6d6ccb75
      Alex Crichton 提交于
      This infrastructure is meant to support runnings tests that involve various
      interesting interdependencies about the types of crates being linked or possibly
      interacting with C libraries. The goal of these make tests is to not restrict
      them to a particular test runner, but allow each test to run its own tests.
      
      To this end, there is a new src/test/run-make directory which has sub-folders of
      tests. Each test requires a `Makefile`, and running the tests constitues simply
      running `make` inside the directory. The new target is `check-stageN-rmake`.
      
      These tests will have the destination directory (as TMPDIR) and the local rust
      compiler (as RUSTC) passed along to them. There is also some helpful
      cross-platform utilities included in src/test/run-make/tools.mk to aid with
      compiling C programs and running them.
      
      The impetus for adding this new test suite is to allow various interesting forms
      of testing rust linkage. All of the tests initially added are various flavors of
      compiling Rust and C with one another as well as just making sure that rust
      linkage works in general.
      
      Closes #10434
      6d6ccb75