1. 02 11月, 2014 1 次提交
  2. 29 10月, 2014 1 次提交
    • S
      Rename fail! to panic! · 7828c3dd
      Steve Klabnik 提交于
      https://github.com/rust-lang/rfcs/pull/221
      
      The current terminology of "task failure" often causes problems when
      writing or speaking about code. You often want to talk about the
      possibility of an operation that returns a Result "failing", but cannot
      because of the ambiguity with task failure. Instead, you have to speak
      of "the failing case" or "when the operation does not succeed" or other
      circumlocutions.
      
      Likewise, we use a "Failure" header in rustdoc to describe when
      operations may fail the task, but it would often be helpful to separate
      out a section describing the "Err-producing" case.
      
      We have been steadily moving away from task failure and toward Result as
      an error-handling mechanism, so we should optimize our terminology
      accordingly: Result-producing functions should be easy to describe.
      
      To update your code, rename any call to `fail!` to `panic!` instead.
      Assuming you have not created your own macro named `panic!`, this
      will work on UNIX based systems:
      
          grep -lZR 'fail!' . | xargs -0 -l sed -i -e 's/fail!/panic!/g'
      
      You can of course also do this by hand.
      
      [breaking-change]
      7828c3dd
  3. 20 10月, 2014 1 次提交
    • A
      Remove a large amount of deprecated functionality · 9d5d97b5
      Alex Crichton 提交于
      Spring cleaning is here! In the Fall! This commit removes quite a large amount
      of deprecated functionality from the standard libraries. I tried to ensure that
      only old deprecated functionality was removed.
      
      This is removing lots and lots of deprecated features, so this is a breaking
      change. Please consult the deprecation messages of the deleted code to see how
      to migrate code forward if it still needs migration.
      
      [breaking-change]
      9d5d97b5
  4. 17 10月, 2014 1 次提交
    • B
      Fix soundness bug in treatment of closure upvars by regionck · 9094aabb
      Brian Koropoff 提交于
      - Unify the representations of `cat_upvar` and `cat_copied_upvar`
      - In `link_reborrowed_region`, account for the ability of upvars to
        change their mutability due to later processing.  A map of recursive
        region links we may want to establish in the future is maintained,
        with the links being established when the kind of the borrow is
        adjusted.
      - When categorizing upvars, add an explicit deref that represents the
        closure environment pointer for closures that do not take the
        environment by value.  The region for the implicit pointer is an
        anonymous free region type introduced for this purpose.  This
        creates the necessary constraint to prevent unsound reborrows from
        the environment.
      - Add a note to categorizations to make it easier to tell when extra
        dereferences have been inserted by an upvar without having to
        perform deep pattern matching.
      - Adjust borrowck to deal with the changes.  Where `cat_upvar` and
        `cat_copied_upvar` were previously treated differently, they are
        now both treated roughly like local variables within the closure
        body, as the explicit derefs now ensure proper behavior.  However,
        error diagnostics had to be changed to explicitly look through the
        extra dereferences to avoid producing confusing messages about
        references not present in the source code.
      
      Closes issue #17403.  Remaining work:
      
      - The error diagnostics that result from failed region inference are
        pretty inscrutible and should be improved.
      
      Code like the following is now rejected:
      
          let mut x = 0u;
          let f = || &mut x;
          let y = f();
          let z = f(); // multiple mutable references to the same location
      
      This also breaks code that uses a similar construction even if it does
      not go on to violate aliasability semantics.  Such code will need to
      be reworked in some way, such as by using a capture-by-value closure
      type.
      
      [breaking-change]
      9094aabb
  5. 05 10月, 2014 1 次提交
  6. 02 10月, 2014 1 次提交
  7. 17 9月, 2014 1 次提交
  8. 19 8月, 2014 1 次提交
  9. 15 7月, 2014 1 次提交
  10. 09 7月, 2014 1 次提交
  11. 04 7月, 2014 1 次提交
    • J
      Simplify PatIdent to contain an Ident rather than a Path · e38cb972
      John Clements 提交于
      Rationale: for what appear to be historical reasons only, the PatIdent contains
      a Path rather than an Ident.  This means that there are many places in the code
      where an ident is artificially promoted to a path, and---much more problematically---
      a bunch of elements from a path are simply thrown away, which seems like an invitation
      to some really nasty bugs.
      
      This commit replaces the Path in a PatIdent with a SpannedIdent, which just contains an ident
      and a span.
      e38cb972
  12. 23 5月, 2014 1 次提交
  13. 25 4月, 2014 1 次提交
    • N
      Pre-step towards issue #12624 and others: Introduce ExprUseVisitor, remove the · 96dfed2b
      Niko Matsakis 提交于
      moves computation. ExprUseVisitor is a visitor that walks the AST for a
      function and calls a delegate to inform it where borrows, copies, and moves
      occur.
      
      In this patch, I rewrite the gather_loans visitor to use ExprUseVisitor, but in
      future patches, I think we could rewrite regionck, check_loans, and possibly
      other passes to use it as well. This would refactor the repeated code between
      those places that tries to determine where copies/moves/etc occur.
      96dfed2b
  14. 23 4月, 2014 1 次提交
  15. 10 4月, 2014 1 次提交
    • K
      Collect move errors before reporting · 13d6c35c
      Kiet Tran 提交于
      This commit changes the way move errors are reported when some value is
      captured by a PatIdent. First, we collect all of the "cannot move out
      of" errors before reporting them, and those errors with the same "move
      source" are reported together. If the move is caused by a PatIdent (that
      binds by value), we add a note indicating where it is and suggest the
      user to put `ref` if they don't want the value to move. This makes the
      "cannot move out of" error in match expression nicer (though the extra
      note may not feel that helpful in other places :P). For example, with
      the following code snippet,
      
      ```rust
      enum Foo {
          Foo1(~u32, ~u32),
          Foo2(~u32),
          Foo3,
      }
      
      fn main() {
          let f = &Foo1(~1u32, ~2u32);
          match *f {
              Foo1(num1, num2) => (),
              Foo2(num) => (),
              Foo3 => ()
          }
      }
      ```
      
      Errors before the change:
      
      ```rust
      test.rs:10:9: 10:25 error: cannot move out of dereference of `&`-pointer
      test.rs:10         Foo1(num1, num2) => (),
                         ^~~~~~~~~~~~~~~~
      test.rs:10:9: 10:25 error: cannot move out of dereference of `&`-pointer
      test.rs:10         Foo1(num1, num2) => (),
                         ^~~~~~~~~~~~~~~~
      test.rs:11:9: 11:18 error: cannot move out of dereference of `&`-pointer
      test.rs:11         Foo2(num) => (),
                         ^~~~~~~~~
      ```
      
      After:
      
      ```rust
      test.rs:9:11: 9:13 error: cannot move out of dereference of `&`-pointer
      test.rs:9     match *f {
                          ^~
      test.rs:10:14: 10:18 note: attempting to move value to here (to prevent the move, you can use `ref num1` to capture value by reference)
      test.rs:10         Foo1(num1, num2) => (),
                              ^~~~
      test.rs:10:20: 10:24 note: and here (use `ref num2`)
      test.rs:10         Foo1(num1, num2) => (),
                                    ^~~~
      test.rs:11:14: 11:17 note: and here (use `ref num`)
      test.rs:11         Foo2(num) => (),
                              ^~~
      ```
      
      Close #8064
      13d6c35c