1. 03 3月, 2013 11 次提交
  2. 02 3月, 2013 2 次提交
  3. 03 3月, 2013 2 次提交
  4. 02 3月, 2013 25 次提交
    • B
      auto merge of #5137 : yjh0502/rust/empty_struct, r=nikomatsakis · 5aca7d6a
      bors 提交于
      The fix is straight-forward, but there are several changes
      while fixing the issue.
      
      1) disallow `mut` keyword when making a new struct
      
      In code base, there are following code,
      
      ```rust
      struct Foo { mut a: int };
      let a = Foo { mut a: 1 };
      ```
      
      This is because of structural record, which is
      deprecated corrently (see issue #3089) In structural
      record, `mut` keyword should be allowd to control
      mutability. But without structural record, we don't
      need to allow `mut` keyword while constructing struct.
      
      2) disallow structural records in parser level
      This is related to 1). With structural records, there
      is an ambiguity between empty block and empty struct
      To solve the problem, I change parser to stop parsing
      structural records. I think this is not a problem,
      because structural records are not compiled already.
      
      Misc. issues
      
      There is an ambiguity between empty struct vs. empty match stmt.
      with following code,
      
      ```rust
      match x{} {}
      ```
      
      Two interpretation is possible, which is listed blow
      
      ```rust
      match (x{}) {} //  matching with newly-constructed empty struct
      (match x{}) {}  //  matching with empty enum(or struct) x
                      //  and then empty block
      ```
      
      It seems that there is no such code in rust code base, but
      there is one test which uses empty match statement:
      https://github.com/mozilla/rust/blob/incoming/src/test/run-pass/issue-3037.rs
      
      All other cases could be distinguished with look-ahead,
      but this can't be. One possible solution is wrapping with
      parentheses when matching with an uninhabited type.
      
      ```rust
      enum what { }
      fn match_with_empty(x: what) -> ~str {
          match (x) { //use parentheses to remove the ambiguity
          }
      }
      ```
      5aca7d6a
    • B
      auto merge of #5193 : sethpink/rust/struct-tup-pp, r=catamorphism · d3b94f6f
      bors 提交于
      - Removed space between struct name and parentheses
      - Fixed indentation of the rest of the file (missing end)
      - Don't print parentheses for structs with no fields
      - Added test
      d3b94f6f
    • B
      auto merge of #5191 : brson/rust/movert, r=brson · 2f901126
      bors 提交于
      Moving them out of the way so the new scheduler code can occupy core::rt.
      2f901126
    • B
      auto merge of #5188 : ben0x539/rust/doc-call-generic-fn, r=catamorphism · 10faa521
      bors 提交于
      I have seen a few people confused on how to explicitly instantiate generic functions, since the syntax differs from C++'s and C#'s, which is probably where most people asking questions about generic functions are coming from. The only use of the `::<T>` syntax in the reference right now is in the section on paths, which is possibly not where someone trying to find out about generic functions is going to start looking. The tutorial doesn't mention it at all, but I think it's all right to make the reference a tiny bit more redundant and avoid stuffing the tutorial with syntax details.
      
      ----
      
      The "Generic functions" subsection mentions that generic functions are instantiated based on context, so let's also mention right away (with a link to the #paths section) that an explicit form is available.
      
      This also adds an example that explicitly instantiates a generic function to the function call expression section.
      10faa521
    • J
      Better highlight for repeat count error · b662d3c9
      Jeong YunWon 提交于
      Before:
      ````
      test.rs:3:21: 3:30 error: expected constant integer for repeat count but found variable
      test.rs:3             let a = ~[0, ..n]; //~ ERROR expected constant integer for repeat count but found variable
                                    ^~~~~~~~~
      ````
      
      After:
      ````
      test.rs:3:27: 3:28 error: expected constant integer for repeat count but found variable
      test.rs:3             let a = ~[0, ..n]; //~ ERROR expected constant integer for repeat count but found variable
                                           ^
      ````
      b662d3c9
    • B
      auto merge of #5187 : ben0x539/rust/docs-unit-struct, r=catamorphism · 0917e131
      bors 提交于
      This adds a few words about unit-like struct types (`struct Foo;`) in the sections for `struct` items, structure expressions and structure types (and fixes an adjacent typo or two). The added text is at the same time triply redundant because of how the sections are split and rather brief because I don't think there's that much to say about field-less structs without digressing into `impl`s and generic functions and whatnot, but it's probably better than nothing for a start.
      
      The added arm for the grammar of struct expressions is really awkward. It's just
      
          | expr_path
      
      which is clearly not unambiguously a struct expression, but it didn't feel right not to add anything to the grammar chunk (and I can't tell whether the arm for enum-like structs is somehow unambiguous with regular enum expressions, either). Is this okay?
      0917e131
    • B
      auto merge of #5186 : ben0x539/rust/contributing, r=brson · 3f91f329
      bors 提交于
      I'm wary of editing the offical-looking things like the contribution policy, but I hope fixing typos/the sentence structure is okay.
      3f91f329
    • B
      auto merge of #5185 : ben0x539/rust/net-tcp-docs, r=brson · 36e89896
      bors 提交于
      This changes various type_names to TypeNames and fixes the example for `tcp::accept` that was still using the old `match` syntax and `{|args| ...}` closures.
      
      The `accept` example was fairly outdated. I was just going to stay away from all the IO things until the scheduler revamp lands, but `accept` is probably one of the obvious starting points for networking stuff for a learner, and I don't want to get in the way of anyone's enthusiasm.
      
      Doesn't touch non-comment lines, so I hope I will get away without learning about unit tests. It doesn't seem like the test system is set up to extract tests from doc comments right now.
      36e89896
    • E
    • J
      Remove REC, change related tests/docs · 95bc9ea2
      Jihyun Yu 提交于
      95bc9ea2
    • B
      auto merge of #5165 : brson/rust/unstable, r=brson · 10929ed1
      bors 提交于
      r?
      
      This probably isn't controversial, but I want somebody else to sign off on it.
      10929ed1
    • S
      Fix some struct-tuple def prettyprint issues · dcd2f735
      Seth Pink 提交于
      - Removed space between struct name and parentheses
      - Fixed indentation of the rest of the file (missing end)
      - Don't print parentheses for structs with no fields
      - Added test
      dcd2f735
    • B
      auto merge of #5190 : brson/rust/snap, r=brson · 0fd1b58f
      bors 提交于
      0fd1b58f
    • P
    • B
      core: Move core::rt to core::unstable::lang · 9639ca5a
      Brian Anderson 提交于
      9639ca5a
    • B
      Register FreeBSD snapshot · 4c35a008
      Brian Anderson 提交于
      4c35a008
    • N
      Avoid calling to_vec() unnecessarily in parser. · ca9549bd
      Niko Matsakis 提交于
      Also, rename the OptVec-to-vector conversion method to
      opt_vec::take_vec() and convert from a method into a fn
      because I fear strange bugs.
      ca9549bd
    • B
      doc/rust.md: Demonstrate the `f::<T>()` syntax more often · 382143ab
      Benjamin Herr 提交于
      The "Generic functions" subsection mentions that generic functions are
      instantiated based on context, so let's also mention right away (with a
      link to the #paths section) that an explicit form is available.
      
      This also adds an example to the function call expression section that
      explicitly instantiates a generic function.
      382143ab
    • B
    • B
      Rename core::private to core::unstable. #4743 · bcf62681
      Brian Anderson 提交于
      bcf62681
    • B
      Contributing.md: remove spurious verb · ae89328b
      Benjamin Herr 提交于
      ae89328b
    • B
      `std::net::tcp` docs: Use current syntax and types · 228e8388
      Benjamin Herr 提交于
      Doesn't touch non-comment lines. This changes various type_names to TypeNames
      and fixes the example for `tcp::accept` that was still using the old
      `match` syntax and `{|args| ...}` closures.
      228e8388
    • P
      librustc: Add missing import. rs=burningtree · cab8ec24
      Patrick Walton 提交于
      cab8ec24
    • P
      Merge pull request #5178 from catamorphism/constant-buffers · 50c08dbf
      Patrick Walton 提交于
      core: Address XXX, make static constants for strings used when stringify...
      50c08dbf
    • P