1. 04 12月, 2014 1 次提交
  2. 27 11月, 2014 1 次提交
  3. 22 11月, 2014 3 次提交
  4. 17 11月, 2014 2 次提交
    • S
      Switch to purely namespaced enums · 3dcd2157
      Steven Fackler 提交于
      This breaks code that referred to variant names in the same namespace as
      their enum. Reexport the variants in the old location or alter code to
      refer to the new locations:
      
      ```
      pub enum Foo {
          A,
          B
      }
      
      fn main() {
          let a = A;
      }
      ```
      =>
      ```
      pub use self::Foo::{A, B};
      
      pub enum Foo {
          A,
          B
      }
      
      fn main() {
          let a = A;
      }
      ```
      or
      ```
      pub enum Foo {
          A,
          B
      }
      
      fn main() {
          let a = Foo::A;
      }
      ```
      
      [breaking-change]
      3dcd2157
    • N
      Fix fallout from coercion removal · ca08540a
      Nick Cameron 提交于
      ca08540a
  5. 19 9月, 2014 1 次提交
    • N
      Add enum variants to the type namespace · ce0907e4
      Nick Cameron 提交于
      Change to resolve and update compiler and libs for uses.
      
      [breaking-change]
      
      Enum variants are now in both the value and type namespaces. This means that
      if you have a variant with the same name as a type in scope in a module, you
      will get a name clash and thus an error. The solution is to either rename the
      type or the variant.
      ce0907e4
  6. 04 9月, 2014 1 次提交
    • W
      Center alignment for fmt · 2bc4a5e9
      wickerwaka 提交于
      Use '^' to specify center alignment in format strings.
      
      fmt!( "[{:^5s}]", "Hi" ) -> "[ Hi  ]"
      fmt!( "[{:^5s}]", "H" )  -> "[  H  ]"
      fmt!( "[{:^5d}]", 1i )   -> "[  1  ]"
      fmt!( "[{:^5d}]", -1i )  -> "[ -1  ]"
      fmt!( "[{:^6d}]", 1i )   -> "[  1   ]"
      fmt!( "[{:^6d}]", -1i )  -> "[  -1  ]"
      
      If the padding is odd then the padding on the right will be one
      character longer than the padding on the left.
      
      Tuples squashed
      2bc4a5e9
  7. 30 8月, 2014 1 次提交
  8. 24 8月, 2014 1 次提交
  9. 17 8月, 2014 1 次提交
    • P
      librustc: Forbid external crates, imports, and/or items from being · 7f928d15
      Patrick Walton 提交于
      declared with the same name in the same scope.
      
      This breaks several common patterns. First are unused imports:
      
          use foo::bar;
          use baz::bar;
      
      Change this code to the following:
      
          use baz::bar;
      
      Second, this patch breaks globs that import names that are shadowed by
      subsequent imports. For example:
      
          use foo::*; // including `bar`
          use baz::bar;
      
      Change this code to remove the glob:
      
          use foo::{boo, quux};
          use baz::bar;
      
      Or qualify all uses of `bar`:
      
          use foo::{boo, quux};
          use baz;
      
          ... baz::bar ...
      
      Finally, this patch breaks code that, at top level, explicitly imports
      `std` and doesn't disable the prelude.
      
          extern crate std;
      
      Because the prelude imports `std` implicitly, there is no need to
      explicitly import it; just remove such directives.
      
      The old behavior can be opted into via the `import_shadowing` feature
      gate. Use of this feature gate is discouraged.
      
      This implements RFC #116.
      
      Closes #16464.
      
      [breaking-change]
      7f928d15
  10. 26 7月, 2014 1 次提交
    • P
      librustc: Disallow mutation and assignment in pattern guards, and modify · b2eb8884
      Patrick Walton 提交于
      the CFG for match statements.
      
      There were two bugs in issue #14684. One was simply that the borrow
      check didn't know about the correct CFG for match statements: the
      pattern must be a predecessor of the guard. This disallows the bad
      behavior if there are bindings in the pattern. But it isn't enough to
      prevent the memory safety problem, because of wildcards; thus, this
      patch introduces a more restrictive rule, which disallows assignments
      and mutable borrows inside guards outright.
      
      I discussed this with Niko and we decided this was the best plan of
      action.
      
      This breaks code that performs mutable borrows in pattern guards. Most
      commonly, the code looks like this:
      
          impl Foo {
              fn f(&mut self, ...) {}
              fn g(&mut self, ...) {
                  match bar {
                      Baz if self.f(...) => { ... }
                      _ => { ... }
                  }
              }
          }
      
      Change this code to not use a guard. For example:
      
          impl Foo {
              fn f(&mut self, ...) {}
              fn g(&mut self, ...) {
                  match bar {
                      Baz => {
                          if self.f(...) {
                              ...
                          } else {
                              ...
                          }
                      }
                      _ => { ... }
                  }
              }
          }
      
      Sometimes this can result in code duplication, but often it illustrates
      a hidden memory safety problem.
      
      Closes #14684.
      
      [breaking-change]
      b2eb8884
  11. 10 7月, 2014 1 次提交
  12. 06 7月, 2014 1 次提交
  13. 28 6月, 2014 1 次提交
  14. 18 6月, 2014 1 次提交
  15. 12 6月, 2014 1 次提交
    • A
      std: Remove i18n/l10n from format! · cac7a205
      Alex Crichton 提交于
      * The select/plural methods from format strings are removed
      * The # character no longer needs to be escaped
      * The \-based escapes have been removed
      * '{{' is now an escape for '{'
      * '}}' is now an escape for '}'
      
      Closes #14810
      [breaking-change]
      cac7a205
  16. 02 6月, 2014 1 次提交
    • A
      std: Drop Total from Total{Eq,Ord} · bba701c5
      Alex Crichton 提交于
      This completes the last stage of the renaming of the comparison hierarchy of
      traits. This change renames TotalEq to Eq and TotalOrd to Ord.
      
      In the future the new Eq/Ord will be filled out with their appropriate methods,
      but for now this change is purely a renaming change.
      
      [breaking-change]
      bba701c5
  17. 31 5月, 2014 1 次提交
    • A
      std: Rename {Eq,Ord} to Partial{Eq,Ord} · 748bc3ca
      Alex Crichton 提交于
      This is part of the ongoing renaming of the equality traits. See #12517 for more
      details. All code using Eq/Ord will temporarily need to move to Partial{Eq,Ord}
      or the Total{Eq,Ord} traits. The Total traits will soon be renamed to {Eq,Ord}.
      
      cc #12517
      
      [breaking-change]
      748bc3ca
  18. 28 5月, 2014 1 次提交
  19. 25 5月, 2014 1 次提交
  20. 23 5月, 2014 1 次提交
  21. 17 5月, 2014 1 次提交
  22. 13 5月, 2014 1 次提交
  23. 09 5月, 2014 1 次提交
    • A
      std: Extract format string parsing out of libstd · 80487ddc
      Alex Crichton 提交于
      This code does not belong in libstd, and rather belongs in a dedicated crate. In
      the future, the syntax::ext::format module should move to the fmt_macros crate
      (hence the name of the crate), but for now the fmt_macros crate will only
      contain the format string parser.
      
      The entire fmt_macros crate is marked #[experimental] because it is not meant
      for general consumption, only the format!() interface is officially supported,
      not the internals.
      
      This is a breaking change for anyone using the internals of std::fmt::parse.
      Some of the flags have moved to std::fmt::rt, while the actual parsing support
      has all moved to the fmt_macros library.
      
      [breaking-change]
      80487ddc
  24. 07 5月, 2014 1 次提交
    • P
      librustc: Remove `~EXPR`, `~TYPE`, and `~PAT` from the language, except · 090040bf
      Patrick Walton 提交于
      for `~str`/`~[]`.
      
      Note that `~self` still remains, since I forgot to add support for
      `Box<self>` before the snapshot.
      
      How to update your code:
      
      * Instead of `~EXPR`, you should write `box EXPR`.
      
      * Instead of `~TYPE`, you should write `Box<Type>`.
      
      * Instead of `~PATTERN`, you should write `box PATTERN`.
      
      [breaking-change]
      090040bf
  25. 03 5月, 2014 1 次提交
  26. 11 4月, 2014 1 次提交
  27. 01 4月, 2014 1 次提交
  28. 26 3月, 2014 1 次提交
    • P
      libstd: Document the following modules: · a424e84a
      Patrick Walton 提交于
      * native::io
      * std::char
      * std::fmt
      * std::fmt::parse
      * std::io
      * std::io::extensions
      * std::io::net::ip
      * std::io::net::udp
      * std::io::net::unix
      * std::io::pipe
      * std::num
      * std::num::f32
      * std::num::f64
      * std::num::strconv
      * std::os
      a424e84a
  29. 23 3月, 2014 1 次提交
  30. 01 3月, 2014 1 次提交
    • 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
  31. 24 2月, 2014 1 次提交
  32. 07 2月, 2014 1 次提交
    • A
      Remove std::condition · 454882dc
      Alex Crichton 提交于
      This has been a long time coming. Conditions in rust were initially envisioned
      as being a good alternative to error code return pattern. The idea is that all
      errors are fatal-by-default, and you can opt-in to handling the error by
      registering an error handler.
      
      While sounding nice, conditions ended up having some unforseen shortcomings:
      
      * Actually handling an error has some very awkward syntax:
      
          let mut result = None;
          let mut answer = None;
          io::io_error::cond.trap(|e| { result = Some(e) }).inside(|| {
              answer = Some(some_io_operation());
          });
          match result {
              Some(err) => { /* hit an I/O error */ }
              None => {
                  let answer = answer.unwrap();
                  /* deal with the result of I/O */
              }
          }
      
        This pattern can certainly use functions like io::result, but at its core
        actually handling conditions is fairly difficult
      
      * The "zero value" of a function is often confusing. One of the main ideas
        behind using conditions was to change the signature of I/O functions. Instead
        of read_be_u32() returning a result, it returned a u32. Errors were notified
        via a condition, and if you caught the condition you understood that the "zero
        value" returned is actually a garbage value. These zero values are often
        difficult to understand, however.
      
        One case of this is the read_bytes() function. The function takes an integer
        length of the amount of bytes to read, and returns an array of that size. The
        array may actually be shorter, however, if an error occurred.
      
        Another case is fs::stat(). The theoretical "zero value" is a blank stat
        struct, but it's a little awkward to create and return a zero'd out stat
        struct on a call to stat().
      
        In general, the return value of functions that can raise error are much more
        natural when using a Result as opposed to an always-usable zero-value.
      
      * Conditions impose a necessary runtime requirement on *all* I/O. In theory I/O
        is as simple as calling read() and write(), but using conditions imposed the
        restriction that a rust local task was required if you wanted to catch errors
        with I/O. While certainly an surmountable difficulty, this was always a bit of
        a thorn in the side of conditions.
      
      * Functions raising conditions are not always clear that they are raising
        conditions. This suffers a similar problem to exceptions where you don't
        actually know whether a function raises a condition or not. The documentation
        likely explains, but if someone retroactively adds a condition to a function
        there's nothing forcing upstream users to acknowledge a new point of task
        failure.
      
      * Libaries using I/O are not guaranteed to correctly raise on conditions when an
        error occurs. In developing various I/O libraries, it's much easier to just
        return `None` from a read rather than raising an error. The silent contract of
        "don't raise on EOF" was a little difficult to understand and threw a wrench
        into the answer of the question "when do I raise a condition?"
      
      Many of these difficulties can be overcome through documentation, examples, and
      general practice. In the end, all of these difficulties added together ended up
      being too overwhelming and improving various aspects didn't end up helping that
      much.
      
      A result-based I/O error handling strategy also has shortcomings, but the
      cognitive burden is much smaller. The tooling necessary to make this strategy as
      usable as conditions were is much smaller than the tooling necessary for
      conditions.
      
      Perhaps conditions may manifest themselves as a future entity, but for now
      we're going to remove them from the standard library.
      
      Closes #9795
      Closes #8968
      454882dc
  33. 18 1月, 2014 1 次提交
    • P
      Rename iterators for consistency · 3fd8c8b3
      Palmer Cox 提交于
      Rename existing iterators to get rid of the Iterator suffix and to
      give them names that better describe the things being iterated over.
      3fd8c8b3
  34. 04 1月, 2014 1 次提交
  35. 12 12月, 2013 1 次提交
  36. 29 11月, 2013 1 次提交
  37. 26 11月, 2013 1 次提交