1. 02 3月, 2014 11 次提交
  2. 01 3月, 2014 22 次提交
    • B
      auto merge of #12639 : luqmana/rust/struct-variant-pat, r=pcwalton · 3d117cf3
      bors 提交于
      We weren't passing the node id for the enum and hence it couldn't retrieve the field types for the struct variant we were trying to destructure.
      
      Fixes #11577.
      3d117cf3
    • B
      auto merge of #12638 : luqmana/rust/op-no-ref, r=alexcrichton · d60e43d9
      bors 提交于
      From my comment on #11450:
      
      The reason for the ICE is because for operators `rustc` does a little bit of magic. Notice that while you implement the `Mul` trait for some type `&T` (i.e a reference to some T), you can simply do `Vec2 {..} * 2.0f32`. That is, `2.0f32` is `f32` and not `&f32`. This works because `rustc` will automatically take a reference. So what's happening is that with `foo * T`, the compiler is expecting the `mul` method to take some `&U` and then it can compare to make sure `T == U` (or more specifically that `T` coerces to `U`). But in this case, the argument of the `mul` method is not a reference and hence the "no ref" error.
      
      I don't think we should ICE in this case since we do catch the mismatched trait/impl method and hence provide a better error message that way.
      
      Fixes #11450
      d60e43d9
    • B
      auto merge of #12627 : alexcrichton/rust/issue-12623, r=brson · cb498cc4
      bors 提交于
      This helps prevent the unfortunate interleavings found in #12623.
      cb498cc4
    • B
      auto merge of #12626 : alexcrichton/rust/assert-eq, r=thestinger · 567201e1
      bors 提交于
      Formatting via reflection has been a little questionable for some time now, and
      it's a little unfortunate that one of the standard macros will silently use
      reflection when you weren't expecting it. This adds small bits of code bloat to
      libraries, as well as not always being necessary. In light of this information,
      this commit switches assert_eq!() to using {} in the error message instead of
      {:?}.
      
      In updating existing code, there were a few error cases that I encountered:
      
      * It's impossible to define Show for [T, ..N]. I think DST will alleviate this
        because we can define Show for [T].
      * A few types here and there just needed a #[deriving(Show)]
      * Type parameters needed a Show bound, I often moved this to `assert!(a == b)`
      * `Path` doesn't implement `Show`, so assert_eq!() cannot be used on two paths.
        I don't think this is much of a regression though because {:?} on paths looks
        awful (it's a byte array).
      
      Concretely speaking, this shaved 10K off a 656K binary. Not a lot, but sometime
      significant for smaller binaries.
      567201e1
    • A
      std: Change assert_eq!() to use {} instead of {:?} · 02882fbd
      Alex Crichton 提交于
      Formatting via reflection has been a little questionable for some time now, and
      it's a little unfortunate that one of the standard macros will silently use
      reflection when you weren't expecting it. This adds small bits of code bloat to
      libraries, as well as not always being necessary. In light of this information,
      this commit switches assert_eq!() to using {} in the error message instead of
      {:?}.
      
      In updating existing code, there were a few error cases that I encountered:
      
      * It's impossible to define Show for [T, ..N]. I think DST will alleviate this
        because we can define Show for [T].
      * A few types here and there just needed a #[deriving(Show)]
      * Type parameters needed a Show bound, I often moved this to `assert!(a == b)`
      * `Path` doesn't implement `Show`, so assert_eq!() cannot be used on two paths.
        I don't think this is much of a regression though because {:?} on paths looks
        awful (it's a byte array).
      
      Concretely speaking, this shaved 10K off a 656K binary. Not a lot, but sometime
      significant for smaller binaries.
      02882fbd
    • C
      Cleaned up trans_fail functions, per eddyb request. · e2afa1cd
      chromatic 提交于
      e2afa1cd
    • L
    • A
      rustdoc: Capture all output from rustc by default · 0e1a8607
      Alex Crichton 提交于
      This helps prevent interleaving of error messages when running rustdoc tests.
      This has an interesting bit of shuffling with I/O handles, but other than that
      this is just using the APIs laid out in the previous commit.
      
      Closes #12623
      0e1a8607
    • L
    • B
      auto merge of #12632 : fhahn/rust/issue-12507-rustdoc-std-module, r=alexcrichton · 123eb4eb
      bors 提交于
      This PR for #12507 marks the top level `Module` in rustdoc as a crate and does render the header accordingly.
      123eb4eb
    • B
      auto merge of #12616 : alexcrichton/rust/size, r=huonw · 5b4a141b
      bors 提交于
      I've been playing around with code size when linking to libstd recently, and these were some findings I found that really helped code size. I started out by eliminating all I/O implementations from libnative and instead just return an unimplemented error.
      
      In doing so, a `fn main() {}` executable was ~378K before this patch, and about 170K after the patch. These size wins are all pretty minor, but they all seemed pretty reasonable to me. With native I/O not stubbed out, this takes the size of an LTO executable from 675K to 400K.
      5b4a141b
    • A
      std: Flag run_fmt() as #[inline(always)] · ddc1c212
      Alex Crichton 提交于
      This function is a tiny wrapper that LLVM doesn't want to inline, and it ends up
      causing more bloat than necessary. The bloat is pretty small, but it's a win of
      at least 7k for small executables, and I imagine that the number goes up as
      there are more calls to fail!().
      ddc1c212
    • A
      std: Avoid using "{:?}" in format strings · 79e6ab54
      Alex Crichton 提交于
      This removes all usage of Poly in format strings from libstd. This doesn't
      prevent more future strings from coming in, but it at least removes the ones for
      now.
      79e6ab54
    • A
      std: Remove lots of allocations from log settings · d89074c8
      Alex Crichton 提交于
      Most of these are unnecessary because we're only looking at static strings. This
      also moves to Vec in a few places instead of ~[T].
      
      This didn't end up getting much of a code size win (update_log_settings is the
      third largest function in the executables I'm looking at), but this seems like a
      generally nice improvement regardless.
      d89074c8
    • B
      auto merge of #12607 : alexcrichton/rust/io++, r=brson · 84ebf74e
      bors 提交于
      This lowers the #[allow(missing_doc)] directive into some of the lower modules
      which are less mature. Most I/O modules now require comprehensive documentation.
      84ebf74e
    • A
      syntax: Refactor diagnostics to focus on Writers · 32454714
      Alex Crichton 提交于
      This commit alters the diagnostic emission machinery to be focused around a
      Writer for emitting errors. This allows it to not hard-code emission of errors
      to stderr (useful for other applications).
      32454714
    • B
      auto merge of #12533 : alexcrichton/rust/svh, r=brson · 58ea029d
      bors 提交于
      These hashes are used to detect changes to upstream crates and generate errors which mention that crates possibly need recompilation.
      
      More details can be found in the respective commit messages below. This change is also accompanied with a much needed refactoring of some of the crate loading code to focus more on crate ids instead of name/version pairs.
      
      Closes #12601
      58ea029d
    • A
      std: Improve some I/O documentation · 311ac8f4
      Alex Crichton 提交于
      This lowers the #[allow(missing_doc)] directive into some of the lower modules
      which are less mature. Most I/O modules now require comprehensive documentation.
      311ac8f4
    • A
      syntax: Expand format!() deterministically · 017c5044
      Alex Crichton 提交于
      Previously, format!("{a}{b}", a=foo(), b=bar()) has foo() and bar() run in a
      nondeterminisc order. This is clearly a non-desirable property, so this commit
      uses iteration over a list instead of iteration over a hash map to provide
      deterministic code generation of these format arguments.
      017c5044
    • A
      rustc: Add the concept of a Strict Version Hash · ec57db08
      Alex Crichton 提交于
      This new SVH is used to uniquely identify all crates as a snapshot in time of
      their ABI/API/publicly reachable state. This current calculation is just a hash
      of the entire crate's AST. This is obviously incorrect, but it is currently the
      reality for today.
      
      This change threads through the new Svh structure which originates from crate
      dependencies. The concept of crate id hash is preserved to provide efficient
      matching on filenames for crate loading. The inspected hash once crate metadata
      is opened has been changed to use the new Svh.
      
      The goal of this hash is to identify when upstream crates have changed but
      downstream crates have not been recompiled. This will prevent the def-id drift
      problem where upstream crates were recompiled, thereby changing their metadata,
      but downstream crates were not recompiled.
      
      In the future this hash can be expanded to exclude contents of the AST like doc
      comments, but limitations in the compiler prevent this change from being made at
      this time.
      
      Closes #10207
      ec57db08
    • A
      rustc: Simplify crate loading constraints · 8213e184
      Alex Crichton 提交于
      The previous code passed around a {name,version} pair everywhere, but this is
      better expressed as a CrateId. This patch changes these paths to store and pass
      around crate ids instead of these pairs of name/version. This also prepares the
      code to change the type of hash that is stored in crates.
      8213e184
    • A
      std: Add cfg(test) to UnsafeArc assertions · d5aa795a
      Alex Crichton 提交于
      This is a ubiquitous type in concurrent code, and the assertions are causing
      significant code bloat for simple operations such as reading the pointer
      (injecting a failure point, etc).
      
      I am testing executable sizes with no I/O implementations (everything stubbed
      out to return nothing), and this took the size of a libnative executable from
      328K to 207K (37% reduction in size), so I think that this is one assertion
      that's well worth configuring off for now.
      d5aa795a
  3. 28 2月, 2014 7 次提交