1. 28 7月, 2014 2 次提交
  2. 27 7月, 2014 14 次提交
    • J
      doc: TreeMap methods with examples. · 8c34a97b
      Jonas Hietala 提交于
      Small corrections for TreeSet examples.
      8c34a97b
    • J
      doc: TreeSet methods and main example. · 034ef079
      Jonas Hietala 提交于
      034ef079
    • B
      auto merge of #15963 : nham/rust/moar_15294, r=alexcrichton · d114ddac
      bors 提交于
      Implements PartialEq/Eq/Clone/Hash/FromIterator/Extendable for SmallIntMap and Clone/Show for TrieMap/TrieSet. cc #15294 
      d114ddac
    • B
      auto merge of #16021 : brson/rust/mb, r=pcwalton · 2de3fad7
      bors 提交于
      No longer does anything.
      2de3fad7
    • B
      Remove managed_box gate from tests · aa486547
      Brian Anderson 提交于
      No longer does anything.
      aa486547
    • B
      auto merge of #16006 : TeXitoi/rust/relicense-shootout-k-nucleotide, r=brson · 3d7a7f64
      bors 提交于
      Everyone agreed except @thestinger. As @thestinger contribution on this file is trivial,
      we can relicense it.
      
      Related to #14248, close #15330
      
      @brson OK?
      3d7a7f64
    • N
      Manually implement Hash for SmallIntMap · fadbc0b8
      nham 提交于
      fadbc0b8
    • B
      auto merge of #15941 : treeman/rust/doc-lru, r=alexcrichton · 32e521ff
      bors 提交于
      32e521ff
    • B
      auto merge of #15936 : alexcrichton/rust/stability, r=brson · e6e544f2
      bors 提交于
      This commit applies stability attributes to the contents of these modules,
      summarized here:
      
      * The `unit` and `bool` modules have become #[unstable] as they are purely meant
        for documentation purposes and are candidates for removal.
      
      * The `ty` module has been deprecated, and the inner `Unsafe` type has been
        renamed to `UnsafeCell` and moved to the `cell` module. The `marker1` field
        has been removed as the compiler now always infers `UnsafeCell` to be
        invariant. The `new` method i stable, but the `value` field, `get` and
        `unwrap` methods are all unstable.
      
      * The `tuple` module has its name as stable, the naming of the `TupleN` traits
        as stable while the methods are all #[unstable]. The other impls in the module
        have appropriate stability for the corresponding trait.
      
      * The `arc` module has received the exact same treatment as the `rc` module
        previously did.
      
      * The `any` module has its name as stable. The `Any` trait is also stable, with
        a new private supertrait which now contains the `get_type_id` method. This is
        to make the method a private implementation detail rather than a public-facing
        detail.
      
        The two extension traits in the module are marked #[unstable] as they will not
        be necessary with DST. The `is` method is #[stable], the as_{mut,ref} methods
        have been renamed to downcast_{mut,ref} and are #[unstable].
      
        The extension trait `BoxAny` has been clarified as to why it is unstable as it
        will not be necessary with DST.
      
      This is a breaking change because the `marker1` field was removed from the
      `UnsafeCell` type. To deal with this change, you can simply delete the field and
      only specify the value of the `data` field in static initializers.
      
      [breaking-change]
      e6e544f2
    • A
      std: Stabilize unit, bool, ty, tuple, arc, any · e5da6a71
      Alex Crichton 提交于
      This commit applies stability attributes to the contents of these modules,
      summarized here:
      
      * The `unit` and `bool` modules have become #[unstable] as they are purely meant
        for documentation purposes and are candidates for removal.
      
      * The `ty` module has been deprecated, and the inner `Unsafe` type has been
        renamed to `UnsafeCell` and moved to the `cell` module. The `marker1` field
        has been removed as the compiler now always infers `UnsafeCell` to be
        invariant. The `new` method i stable, but the `value` field, `get` and
        `unwrap` methods are all unstable.
      
      * The `tuple` module has its name as stable, the naming of the `TupleN` traits
        as stable while the methods are all #[unstable]. The other impls in the module
        have appropriate stability for the corresponding trait.
      
      * The `arc` module has received the exact same treatment as the `rc` module
        previously did.
      
      * The `any` module has its name as stable. The `Any` trait is also stable, with
        a new private supertrait which now contains the `get_type_id` method. This is
        to make the method a private implementation detail rather than a public-facing
        detail.
      
        The two extension traits in the module are marked #[unstable] as they will not
        be necessary with DST. The `is` method is #[stable], the as_{mut,ref} methods
        have been renamed to downcast_{mut,ref} and are #[unstable].
      
        The extension trait `BoxAny` has been clarified as to why it is unstable as it
        will not be necessary with DST.
      
      This is a breaking change because the `marker1` field was removed from the
      `UnsafeCell` type. To deal with this change, you can simply delete the field and
      only specify the value of the `data` field in static initializers.
      
      [breaking-change]
      e5da6a71
    • B
      auto merge of #15762 : nham/rust/ringbuf_docs, r=alexcrichton · ecce58c6
      bors 提交于
      This adds examples for get(), get_mut(), swap(), iter() and mut_iter()
      ecce58c6
    • N
      ebe80971
    • B
      d4dfb7d8
    • N
      Small fixes for tests · 3f1c37e9
      nham 提交于
      3f1c37e9
  3. 26 7月, 2014 24 次提交
    • B
      auto merge of #15998 : luqmana/rust/nmnnbd, r=thestinger · 7aa40795
      bors 提交于
      LLVM recently added a new attribute, dereferenceable: http://reviews.llvm.org/D4449
      
      >This patch adds a dereferencable attribute. In some sense, this is a companion to the nonnull attribute, but specifies that the pointer is known to be dereferencable in the same sense as a pointer generated by alloca is known to be dereferencable.
      
      With rust, everywhere that we previously marked `nonnull` we can actually mark as `dereferenceable` (which implies nonnull) since we know the size. That is, except for one case: when generating calls for TyVisitor. It seems like we haven't substituted the self type (so we have `ty_param`) and just treat it as an opaque pointer so I just left that bit as nonnull.
      
      With this, LLVM can for example hoist a load out of a loop where it previously couldn't:
      
      ```Rust
      pub fn baz(c: &uint, n: uint) -> uint {
          let mut res = 0;
          for i in range(0, n) {
              if i > 0 {
                  res += *c * i;
              }
          }
          res
      }
      ```
      
      Before:
      ```llvm
      define i64 @baz(i64* noalias nocapture nonnull readonly, i64) unnamed_addr #0 {
      entry-block:
        br label %for_loopback.outer
      
      for_loopback.outer:                               ; preds = %then-block-33-, %entry-block
        %.ph = phi i64 [ %.lcssa, %then-block-33- ], [ 0, %entry-block ]
        %res.0.ph = phi i64 [ %8, %then-block-33- ], [ 0, %entry-block ]
        br label %for_loopback
      
      for_exit:                                         ; preds = %for_loopback
        %res.0.ph.lcssa = phi i64 [ %res.0.ph, %for_loopback ]
        ret i64 %res.0.ph.lcssa
      
      for_loopback:                                     ; preds = %for_loopback.outer, %for_body
        %2 = phi i64 [ %4, %for_body ], [ %.ph, %for_loopback.outer ]
        %3 = icmp ult i64 %2, %1
        br i1 %3, label %for_body, label %for_exit
      
      for_body:                                         ; preds = %for_loopback
        %4 = add i64 %2, 1
        %5 = icmp eq i64 %2, 0
        br i1 %5, label %for_loopback, label %then-block-33-
      
      then-block-33-:                                   ; preds = %for_body
        %.lcssa = phi i64 [ %4, %for_body ]
        %.lcssa15 = phi i64 [ %2, %for_body ]
        %6 = load i64* %0, align 8                     ; <------- this load
        %7 = mul i64 %6, %.lcssa15
        %8 = add i64 %7, %res.0.ph
        br label %for_loopback.outer
      }
      ```
      
      After:
      ```llvm
      define i64 @baz(i64* noalias nocapture readonly dereferenceable(8), i64) unnamed_addr #0 {
      entry-block:
        %2 = load i64* %0, align 8                    ; <------- load once instead
        br label %for_loopback.outer
      
      for_loopback.outer:                               ; preds = %then-block-33-, %entry-block
        %.ph = phi i64 [ %.lcssa, %then-block-33- ], [ 0, %entry-block ]
        %res.0.ph = phi i64 [ %8, %then-block-33- ], [ 0, %entry-block ]
        br label %for_loopback
      
      for_exit:                                         ; preds = %for_loopback
        %res.0.ph.lcssa = phi i64 [ %res.0.ph, %for_loopback ]
        ret i64 %res.0.ph.lcssa
      
      for_loopback:                                     ; preds = %for_loopback.outer, %for_body
        %3 = phi i64 [ %5, %for_body ], [ %.ph, %for_loopback.outer ]
        %4 = icmp ult i64 %3, %1
        br i1 %4, label %for_body, label %for_exit
      
      for_body:                                         ; preds = %for_loopback
        %5 = add i64 %3, 1
        %6 = icmp eq i64 %3, 0
        br i1 %6, label %for_loopback, label %then-block-33-
      
      then-block-33-:                                   ; preds = %for_body
        %.lcssa = phi i64 [ %5, %for_body ]
        %.lcssa15 = phi i64 [ %3, %for_body ]
        %7 = mul i64 %2, %.lcssa15
        %8 = add i64 %7, %res.0.ph
        br label %for_loopback.outer
      }
      ```
      7aa40795
    • B
      auto merge of #15996 : nham/rust/smallintmap_not_hashmap, r=sanxiyn · 50c62b46
      bors 提交于
      SmallIntMap doesn't involve hashing?
      50c62b46
    • G
      Relicense shootout-k-nucleotide.rs · 92792248
      Guillaume Pinot 提交于
      Everyone agreed except @thestinger. As @thestinger contribution on this file is trivial,
      we can relicense it.
      
      Related to #14248, close #15330
      92792248
    • B
      auto merge of #15991 : pcwalton/rust/resolve-regions-in-trait-matching, r=alexcrichton · ee21b009
      bors 提交于
      matching.
      
      This breaks code like:
      
          struct Foo<'a,'b> {
              x: &'a int,
              y: &'b int,
          }
      
          trait Tr {
              fn foo(x: Self) {}
          }
      
          impl<'a,'b> Tr for Foo<'a,'b> {
              fn foo(x: Foo<'b,'a>) {} // <-- bad
          }
      
      Change this code to not contain a lifetime mismatch error. For example:
      
          struct Foo<'a,'b> {
              x: &'a int,
              y: &'b int,
          }
      
          trait Tr {
              fn foo(x: Self) {}
          }
      
          impl<'a,'b> Tr for Foo<'a,'b> {
              fn foo(x: Foo<'a,'b>) {} // OK
          }
      
      Closes #15517.
      
      [breaking-change]
      
      r? @alexcrichton
      ee21b009
    • B
      auto merge of #15988 : brson/rust/antlrprep, r=cmr · 0d53597c
      bors 提交于
      Add `check-secondary`, which runs the pretty and lexer tests so we can run them on a dedicated bot. Leaves the pretty tests running under `check` until the bots are switched over. Also fixes some issues.
      
      r? @cmr
      0d53597c
    • B
      auto merge of #15987 : brson/rust/hidestdrt, r=alexcrichton · cf61980d
      bors 提交于
      Rename and gensym the runtime on import, so that users
      can't refer to the `native` crate.
      
      This is unlikely to break code, but users should import the "native" crate directly.
      
      [breaking-change]
      
      cc @alexcrichton
      cf61980d
    • B
      auto merge of #15982 : alexcrichton/rust/rustdoc-fixes, r=brson · c0fa8764
      bors 提交于
      Sadly there's still a lot of open issues, but this tackles some of the more pressing ones. Each commit has its own description along with the issues it closes.
      c0fa8764
    • M
      fix small typo in guide-lifetimes · ca18c122
      Michael Matuzak 提交于
      ca18c122
    • B
      auto merge of #15975 : dotdash/rust/unwind_lifetimes, r=pcwalton · 34a6a8fc
      bors 提交于
      Currently we don't emit lifetime end markers when translating the
      unwinding code. I omitted that when I added the support for lifetime
      intrinsics, because I initially made the mistake of just returning true
      in clean_on_unwind(). That caused almost all calls to be translated as
      invokes, leading to quite awful results.
      
      To correctly emit the lifetime end markers, we must differentiate
      between cleanup that requires unwinding and such cleanup that just wants
      to emit code during unwinding.
      34a6a8fc
    • L
      rustllvm: Stub out some functions for llvm < 3.5 · a78c0f10
      Luqman Aden 提交于
      a78c0f10
    • N
      Fix a typo in SmallIntMap documentation · b2e81d16
      nham 提交于
      b2e81d16
    • N
      Implement PartialEq/Eq/Clone/Hash/FromIterator/Extendable for SmallIntMap and... · 1e997d62
      nham 提交于
      Implement PartialEq/Eq/Clone/Hash/FromIterator/Extendable for SmallIntMap and Show/Clone for TrieMap and TrieSet
      1e997d62
    • L
    • B
      auto merge of #15789 : steveklabnik/rust/guide_pointers, r=cmr · cf1381c1
      bors 提交于
      This is super, super WIP, but I'm going to go get lunch for a while, and figured I'd toss my work up here in case anyone wants to see my work as I do it.
      
      This contains a new introductory section explaining the basics of pointers, and some pitfalls that Rust attempts to solve. I'd be interested in hearing how my explanation is, as well as if this belongs here. Pointers are such a crucial concept, I don't mind having a beginners' section on them in the main docs, even though our main audience is supposed to understand them already. Reasonable people may disagree, however.
      cf1381c1
    • B
      6e03944d
    • L
      librustc: Use builder for llvm attributes. · 17256197
      Luqman Aden 提交于
      17256197
    • B
      auto merge of #15787 : treeman/rust/hashmap-doc, r=alexcrichton · 92c97059
      bors 提交于
      Add an example showing how to use the map with a custom type. Fill in
      examples for methods  without ones.
      
      Also move `pop_equiv` next to related public methods, to not create a
      duplicate trait in the docs.
      92c97059
    • P
      librustc: Resolve regions and report errors in trait/impl method · 5de8ed54
      Patrick Walton 提交于
      matching.
      
      This breaks code like:
      
          struct Foo<'a,'b> {
              x: &'a int,
              y: &'b int,
          }
      
          trait Tr {
              fn foo(x: Self) {}
          }
      
          impl<'a,'b> Tr for Foo<'a,'b> {
              fn foo(x: Foo<'b,'a>) {} // <-- bad
          }
      
      Change this code to not contain a lifetime mismatch error. For example:
      
          struct Foo<'a,'b> {
              x: &'a int,
              y: &'b int,
          }
      
          trait Tr {
              fn foo(x: Self) {}
          }
      
          impl<'a,'b> Tr for Foo<'a,'b> {
              fn foo(x: Foo<'a,'b>) {} // OK
          }
      
      Closes #15517.
      
      [breaking-change]
      5de8ed54
    • B
      mk: Print grammar info message like others · 3382ffef
      Brian Anderson 提交于
      3382ffef
    • B
      mk: Remove check-syntax target · ae97e6f8
      Brian Anderson 提交于
      This appears to be redundantly named with a shortcut target for
      testing the syntax crate.
      ae97e6f8
    • B
      rustc: Future proof runtime injection · 8f692e6a
      Brian Anderson 提交于
      Rename and gensym the runtime on import, so that users
      can't refer to the `native` crate.
      
      This is unlikely to break code, but users should import the "native" crate directly.
      
      [breaking-change]
      8f692e6a
    • B
      auto merge of #15979 : Randati/rust/patch-2, r=kballard · 66a0b528
      bors 提交于
      66a0b528
    • B
      auto merge of #15968 : nham/rust/keys_values_other_maps, r=alexcrichton · 74db6999
      bors 提交于
      Adds methods for obtaining iterators over the keys or values of a SmallIntMap/TreeMap/TrieMap.
      
      Closes #14376
      74db6999
    • A
      rustdoc: Inline items from foreign mods · 98f48630
      Alex Crichton 提交于
      These were all just previously skipped.
      
      Closes #15648
      98f48630