1. 07 5月, 2014 6 次提交
    • B
      auto merge of #13892 : alexcrichton/rust/mixing-rlib-dylib-deps, r=brson · 24f6f26e
      bors 提交于
      Currently, rustc requires that a linkage be a product of 100% rlibs or 100%
      dylibs. This is to satisfy the requirement that each object appear at most once
      in the final output products. This is a bit limiting, and the upcoming libcore
      library cannot exist as a dylib, so these rules must change.
      
      The goal of this commit is to enable *some* use cases for mixing rlibs and
      dylibs, primarily libcore's use case. It is not targeted at allowing an
      exhaustive number of linkage flavors.
      
      There is a new dependency_format module in rustc which calculates what format
      each upstream library should be linked as in each output type of the current
      unit of compilation. The module itself contains many gory details about what's
      going on here.
      
      cc #10729
      24f6f26e
    • B
      auto merge of #13982 : alexcrichton/rust/more-logging, r=nikomatsakis · b299231d
      bors 提交于
      This was accidentally left out of the recent logging improvements.
      b299231d
    • A
      log: Use writeln!() instead of write!() · be71d809
      Alex Crichton 提交于
      This was accidentally left out of the recent logging improvements.
      be71d809
    • B
      auto merge of #13960 : brandonw/rust/master, r=alexcrichton · df621acf
      bors 提交于
      Update the example to make the usage of `pub mod foo;` much more
      apparent, as well as using an example where setting the visibility of
      the module is actually necessary.
      df621acf
    • B
      auto merge of #13897 : aturon/rust/issue-6085, r=bjz · cf6857b9
      bors 提交于
      The `std::bitflags::bitflags!` macro did not provide support for
      adding attributes to the generates structure, due to limitations in
      the parser for macros. This patch works around the parser limitations
      by requiring a `flags` keyword in the `bitflags!` invocations:
      
          bitflags!(
              #[deriving(Hash)]
              #[doc="Three flags"]
              flags Flags: u32 {
                  FlagA       = 0x00000001,
                  FlagB       = 0x00000010,
                  FlagC       = 0x00000100
              }
          )
      
      The intent of `std::bitflags` is to allow building type-safe wrappers
      around C-style flags APIs. But in addition to construction these flags
      from the Rust side, we need a way to convert them from the C
      side. This patch adds a `from_bits` function, which is unsafe since
      the bits in question may not represent a valid combination of flags.
      
      Finally, this patch changes `std::io::FilePermissions` from an exposed
      `u32` representation to a typesafe representation (that only allows valid
      flag combinations) using the `std::bitflags`.
      
      Closes #6085.
      cf6857b9
    • B
      auto merge of #13822 : EdorianDark/rust/master, r=cmr · 1f6db7f4
      bors 提交于
      New attempt to generalize stats, after #12606.
      Since #12355 did not get merged, i want go get first get my change done and the try to fix sum.
      1f6db7f4
  2. 06 5月, 2014 20 次提交
  3. 05 5月, 2014 14 次提交
    • B
      auto merge of #13935 : thestinger/rust/noalias, r=pcwalton · 2be738ae
      bors 提交于
      This was removed because these could alias with `&const T` or `@mut T`
      and those are now gone from the language. There are still aliasing
      issues within local scopes, but this is correct for function parameters.
      
      This also removes the no-op `noalias` marker on proc (not a pointer) and
      leaves out the mention of #6750 because real type-based alias analysis
      is not within the scope of best effort usage of the `noalias` attribute.
      
      Test case:
      
          pub fn foo(x: &mut &mut u32) {
              **x = 5;
              **x = 5;
          }
      
      Before:
      
          define void @_ZN3foo20h0ce94c9671b0150bdaa4v0.0E(i32** nocapture readonly) unnamed_addr #0 {
          entry-block:
            %1 = load i32** %0, align 8
            store i32 5, i32* %1, align 4
            %2 = load i32** %0, align 8
            store i32 5, i32* %2, align 4
            ret void
          }
      
      After:
      
          define void @_ZN3foo20h0ce94c9671b0150bdaa4v0.0E(i32** noalias nocapture readonly) unnamed_addr #0 {
          entry-block:
            %1 = load i32** %0, align 8
            store i32 5, i32* %1, align 4
            ret void
          }
      
      Closes #12436
      2be738ae
    • M
      doc: Corrected example in 17.8 Deriving implementations for traits · 055cbdee
      Mike Boutin 提交于
      Corrected example to to use Rand trait referenced in preceding
      description and included an example using the Show trait to print ABC.
      055cbdee
    • M
      doc: Minor example formatting in 11 References · e65aea52
      Mike Boutin 提交于
      e65aea52
    • M
      doc: Clarified 4.2 Pattern matching · 81bc32d9
      Mike Boutin 提交于
      Combined redundant paragraphs about the match expression and removed a
      redundant example.
      81bc32d9
    • B
      auto merge of #13749 : pnkfelix/rust/add-libgraphviz-crate, r=alexcrichton · ecc18f34
      bors 提交于
      Add a `graphviz` crate for making .dot files to layout and render graphs.
      
      (This is a precursor to other work to render control-flow graphs from within rustc itself; but this crate should be independently usable, since it abstracts over the client's graph-representation and labeling method.)
      ecc18f34
    • F
      67307d4e
    • E
      Adjust codegen logic for range and guarded arms · 90449abc
      Edward Wang 提交于
      By carefully distinguishing falling back to the default arm from moving
      on to the next pattern, this patch adjusts the codegen logic for range
      and guarded arms of pattern matching expression. It is a more
      appropriate way of fixing #12582 and #13027 without causing regressions
      such as #13867.
      
      Closes #13867
      90449abc
    • E
      Reverse #13034 · 7adc4852
      Edward Wang 提交于
      It has been found that #13034 was flawed and caused regression #13867.
      This patch reveres the changes made by it except the companion tests.
      7adc4852
    • F
      Cleanup proc comment in guide-tasks.md. · 0fb1f3fd
      Felix S. Klock II 提交于
      0fb1f3fd
    • B
      auto merge of #13942 : JamesLaverack/rust/master, r=luqmana · 8895f252
      bors 提交于
      Version changed due to a newer requirement in LLVM.
      8895f252
    • B
      auto merge of #13936 : Armavica/rust/lint_check-range, r=kballard · dcde1ee1
      bors 提交于
      Some cases were not correctly handled by this lint, for instance `let a = 42u8; a < 0` and `let a = 42u8; a > 255`.
      It led to the discovery of two useless comparisons, which I removed.
      dcde1ee1
    • H
      edd9bad4
    • H
      std: deprecate cast::transmute_mut. · 781ac3e7
      Huon Wilson 提交于
      Turning a `&T` into an `&mut T` carries a large risk of undefined
      behaviour, and needs to be done very very carefully. Providing a
      convenience function for exactly this task is a bad idea, just tempting
      people into doing the wrong thing.
      
      The right thing is to use types like `Cell`, `RefCell` or `Unsafe`.
      
      For memory safety, Rust has that guarantee that `&mut` pointers do not
      alias with any other pointer, that is, if you have a `&mut T` then that
      is the only usable pointer to that `T`. This allows Rust to assume that
      writes through a `&mut T` do not affect the values of any other `&` or
      `&mut` references. `&` pointers have no guarantees about aliasing or
      not, so it's entirely possible for the same pointer to be passed into
      both arguments of a function like
      
          fn foo(x: &int, y: &int) { ... }
      
      Converting either of `x` or `y` to a `&mut` pointer and modifying it
      would affect the other value: invalid behaviour.
      
      (Similarly, it's undefined behaviour to modify the value of an immutable
      local, like `let x = 1;`.)
      
      At a low-level, the *only* safe way to obtain an `&mut` out of a `&` is
      using the `Unsafe` type (there are higher level wrappers around it, like
      `Cell`, `RefCell`, `Mutex` etc.). The `Unsafe` type is registered with
      the compiler so that it can reason a little about these `&` to `&mut`
      casts, but it is still up to the user to ensure that the `&mut`s
      obtained out of an `Unsafe` never alias.
      
      (Note that *any* conversion from `&` to `&mut` can be invalid, including
      a plain `transmute`, or casting `&T` -> `*T` -> `*mut T` -> `&mut T`.)
      
      [breaking-change]
      781ac3e7
    • B
      auto merge of #13930 : alexcrichton/rust/snapshots, r=huonw · abdacecd
      bors 提交于
      cc @pcwalton and @flaper87, this has box expressions and opt-in builtin kinds.
      abdacecd