1. 24 11月, 2014 1 次提交
    • A
      std: Add a new top-level thread_local module · a9c1152c
      Alex Crichton 提交于
      This commit removes the `std::local_data` module in favor of a new
      `std::thread_local` module providing thread local storage. The module provides
      two variants of TLS: one which owns its contents and one which is based on
      scoped references. Each implementation has pros and cons listed in the
      documentation.
      
      Both flavors have accessors through a function called `with` which yield a
      reference to a closure provided. Both flavors also panic if a reference cannot
      be yielded and provide a function to test whether an access would panic or not.
      This is an implementation of [RFC 461][rfc] and full details can be found in
      that RFC.
      
      This is a breaking change due to the removal of the `std::local_data` module.
      All users can migrate to the new thread local system like so:
      
          thread_local!(static FOO: Rc<RefCell<Option<T>>> = Rc::new(RefCell::new(None)))
      
      The old `local_data` module inherently contained the `Rc<RefCell<Option<T>>>` as
      an implementation detail which must now be explicitly stated by users.
      
      [rfc]: https://github.com/rust-lang/rfcs/pull/461
      [breaking-change]
      a9c1152c
  2. 19 11月, 2014 1 次提交
    • A
      std: Stabilize std::fmt · 4af3494b
      Alex Crichton 提交于
      This commit applies the stabilization of std::fmt as outlined in [RFC 380][rfc].
      There are a number of breaking changes as a part of this commit which will need
      to be handled to migrated old code:
      
      * A number of formatting traits have been removed: String, Bool, Char, Unsigned,
        Signed, and Float. It is recommended to instead use Show wherever possible or
        to use adaptor structs to implement other methods of formatting.
      
      * The format specifier for Boolean has changed from `t` to `b`.
      
      * The enum `FormatError` has been renamed to `Error` as well as becoming a unit
        struct instead of an enum. The `WriteError` variant no longer exists.
      
      * The `format_args_method!` macro has been removed with no replacement. Alter
        code to use the `format_args!` macro instead.
      
      * The public fields of a `Formatter` have become read-only with no replacement.
        Use a new formatting string to alter the formatting flags in combination with
        the `write!` macro. The fields can be accessed through accessor methods on the
        `Formatter` structure.
      
      Other than these breaking changes, the contents of std::fmt should now also all
      contain stability markers. Most of them are still #[unstable] or #[experimental]
      
      [rfc]: https://github.com/rust-lang/rfcs/blob/master/text/0380-stabilize-std-fmt.md
      [breaking-change]
      
      Closes #18904
      4af3494b
  3. 18 11月, 2014 1 次提交
  4. 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
  5. 28 10月, 2014 1 次提交
  6. 11 10月, 2014 1 次提交
    • A
      Register new snapshots · dae48a07
      Alex Crichton 提交于
      Also convert a number of `static mut` to just a plain old `static` and remove
      some unsafe blocks.
      dae48a07
  7. 10 10月, 2014 3 次提交
  8. 08 10月, 2014 1 次提交
  9. 18 9月, 2014 1 次提交
    • K
      Fix the inverted RUST_LOG filter · e7b25708
      Kevin Ballard 提交于
      RUST_LOG supports regex filtering of log messages with a syntax like
      `RUST_LOG=main/foo` to use the regex filter 'foo'. Unfortunately, the
      filter was inverted, so `RUST_LOG=main/foo` would actually show all
      messages except the ones containing 'foo'.
      e7b25708
  10. 01 9月, 2014 1 次提交
    • A
      Rename `RawPtr::to_option()` to `RawPtr::as_ref()` · 00ff5aac
      Andrew Poelstra 提交于
      As outlined in
      
        https://aturon.github.io/style/naming/conversions.html
      
      `to_` functions names should only be used for expensive operations.
      Thus `to_option` is better named `as_option`. Also, putting type
      names into method names is considered bad style; what the user is
      really trying to get is a reference. This `as_ref` is even better.
      
      Also, we are missing a mutable version of this method. So add a
      new trait `RawMutPtr` with a corresponding `as_mut` methode.
      
      Finally, there is a bug in the signature of `to_option` which has
      been around since lifetime elision: originally the returned reference
      had 'static lifetime, but since the elision changes this become
      the lifetime of the raw pointer (which does not make sense, since
      the pointer lifetime and referent lifetime are unrelated). Fix
      the bug to return a reference with a fresh lifetime (which will
      be inferred from the calling context).
      
      [breaking-change]
      00ff5aac
  11. 29 8月, 2014 1 次提交
  12. 28 8月, 2014 1 次提交
    • N
      Allow a regex filter for RUST_LOG · cc9b2b05
      Nick Cameron 提交于
      When specifying RUST_LOG, the programmer may append `/regex` to the end of the spec. All results will then be filtered using that regex.
      cc9b2b05
  13. 12 7月, 2014 1 次提交
  14. 10 7月, 2014 1 次提交
  15. 06 7月, 2014 1 次提交
  16. 04 7月, 2014 1 次提交
  17. 29 6月, 2014 1 次提交
  18. 28 6月, 2014 1 次提交
  19. 25 6月, 2014 1 次提交
    • N
      librustc: Remove the fallback to `int` from typechecking. · 9e3d0b00
      Niko Matsakis 提交于
      This breaks a fair amount of code. The typical patterns are:
      
      * `for _ in range(0, 10)`: change to `for _ in range(0u, 10)`;
      
      * `println!("{}", 3)`: change to `println!("{}", 3i)`;
      
      * `[1, 2, 3].len()`: change to `[1i, 2, 3].len()`.
      
      RFC #30. Closes #6023.
      
      [breaking-change]
      9e3d0b00
  20. 18 6月, 2014 1 次提交
  21. 16 6月, 2014 1 次提交
  22. 12 6月, 2014 2 次提交
    • A
      rustc: Remove ~[T] from the language · 3316b1eb
      Alex Crichton 提交于
      The following features have been removed
      
      * box [a, b, c]
      * ~[a, b, c]
      * box [a, ..N]
      * ~[a, ..N]
      * ~[T] (as a type)
      * deprecated_owned_vector lint
      
      All users of ~[T] should move to using Vec<T> instead.
      3316b1eb
    • A
      sync: Move underneath libstd · b1c9ce9c
      Alex Crichton 提交于
      This commit is the final step in the libstd facade, #13851. The purpose of this
      commit is to move libsync underneath the standard library, behind the facade.
      This will allow core primitives like channels, queues, and atomics to all live
      in the same location.
      
      There were a few notable changes and a few breaking changes as part of this
      movement:
      
      * The `Vec` and `String` types are reexported at the top level of libcollections
      * The `unreachable!()` macro was copied to libcore
      * The `std::rt::thread` module was moved to librustrt, but it is still
        reexported at the same location.
      * The `std::comm` module was moved to libsync
      * The `sync::comm` module was moved under `sync::comm`, and renamed to `duplex`.
        It is now a private module with types/functions being reexported under
        `sync::comm`. This is a breaking change for any existing users of duplex
        streams.
      * All concurrent queues/deques were moved directly under libsync. They are also
        all marked with #![experimental] for now if they are public.
      * The `task_pool` and `future` modules no longer live in libsync, but rather
        live under `std::sync`. They will forever live at this location, but they may
        move to libsync if the `std::task` module moves as well.
      
      [breaking-change]
      b1c9ce9c
  23. 10 6月, 2014 1 次提交
  24. 07 6月, 2014 1 次提交
    • A
      rustdoc: Submit examples to play.rust-lang.org · e5bbbca3
      Alex Crichton 提交于
      This grows a new option inside of rustdoc to add the ability to submit examples
      to an external website. If the `--markdown-playground-url` command line option
      or crate doc attribute `html_playground_url` is present, then examples will have
      a button on hover to submit the code to the playground specified.
      
      This commit enables submission of example code to play.rust-lang.org. The code
      submitted is that which is tested by rustdoc, not necessarily the exact code
      shown in the example.
      
      Closes #14654
      e5bbbca3
  25. 02 6月, 2014 1 次提交
    • F
      docs: Stop using `notrust` · 20fb7c62
      Florian Gilcher 提交于
      Now that rustdoc understands proper language tags
      as the code not being Rust, we can tag everything
      properly.
      
      This change tags examples in other languages by
      their language. Plain notations are marked as `text`.
      Console examples are marked as `console`.
      
      Also fix markdown.rs to not highlight non-rust code.
      20fb7c62
  26. 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
  27. 28 5月, 2014 1 次提交
  28. 23 5月, 2014 1 次提交
  29. 22 5月, 2014 1 次提交
  30. 16 5月, 2014 1 次提交
    • A
      Updates with core::fmt changes · 1de4b65d
      Alex Crichton 提交于
      1. Wherever the `buf` field of a `Formatter` was used, the `Formatter` is used
         instead.
      2. The usage of `write_fmt` is minimized as much as possible, the `write!` macro
         is preferred wherever possible.
      3. Usage of `fmt::write` is minimized, favoring the `write!` macro instead.
      1de4b65d
  31. 15 5月, 2014 1 次提交
  32. 13 5月, 2014 1 次提交
  33. 11 5月, 2014 1 次提交
    • A
      core: Remove the cast module · f94d671b
      Alex Crichton 提交于
      This commit revisits the `cast` module in libcore and libstd, and scrutinizes
      all functions inside of it. The result was to remove the `cast` module entirely,
      folding all functionality into the `mem` module. Specifically, this is the fate
      of each function in the `cast` module.
      
      * transmute - This function was moved to `mem`, but it is now marked as
                    #[unstable]. This is due to planned changes to the `transmute`
                    function and how it can be invoked (see the #[unstable] comment).
                    For more information, see RFC 5 and #12898
      
      * transmute_copy - This function was moved to `mem`, with clarification that is
                         is not an error to invoke it with T/U that are different
                         sizes, but rather that it is strongly discouraged. This
                         function is now #[stable]
      
      * forget - This function was moved to `mem` and marked #[stable]
      
      * bump_box_refcount - This function was removed due to the deprecation of
                            managed boxes as well as its questionable utility.
      
      * transmute_mut - This function was previously deprecated, and removed as part
                        of this commit.
      
      * transmute_mut_unsafe - This function doesn't serve much of a purpose when it
                               can be achieved with an `as` in safe code, so it was
                               removed.
      
      * transmute_lifetime - This function was removed because it is likely a strong
                             indication that code is incorrect in the first place.
      
      * transmute_mut_lifetime - This function was removed for the same reasons as
                                 `transmute_lifetime`
      
      * copy_lifetime - This function was moved to `mem`, but it is marked
                        `#[unstable]` now due to the likelihood of being removed in
                        the future if it is found to not be very useful.
      
      * copy_mut_lifetime - This function was also moved to `mem`, but had the same
                            treatment as `copy_lifetime`.
      
      * copy_lifetime_vec - This function was removed because it is not used today,
                            and its existence is not necessary with DST
                            (copy_lifetime will suffice).
      
      In summary, the cast module was stripped down to these functions, and then the
      functions were moved to the `mem` module.
      
          transmute - #[unstable]
          transmute_copy - #[stable]
          forget - #[stable]
          copy_lifetime - #[unstable]
          copy_mut_lifetime - #[unstable]
      
      [breaking-change]
      f94d671b
  34. 08 5月, 2014 1 次提交
    • A
      std: Modernize the local_data api · ab92ea52
      Alex Crichton 提交于
      This commit brings the local_data api up to modern rust standards with a few key
      improvements:
      
      * The `pop` and `set` methods have been combined into one method, `replace`
      
      * The `get_mut` method has been removed. All interior mutability should be done
        through `RefCell`.
      
      * All functionality is now exposed as a method on the keys themselves. Instead
        of importing std::local_data, you now use "key.replace()" and "key.get()".
      
      * All closures have been removed in favor of RAII functionality. This means that
        get() and get_mut() no long require closures, but rather return
        Option<SmartPointer> where the smart pointer takes care of relinquishing the
        borrow and also implements the necessary Deref traits
      
      * The modify() function was removed to cut the local_data interface down to its
        bare essentials (similarly to how RefCell removed set/get).
      
      [breaking-change]
      ab92ea52
  35. 07 5月, 2014 2 次提交
  36. 06 5月, 2014 1 次提交
    • S
      log: Logger receiveis a LogRecord · ceb29314
      Sean McArthur 提交于
      The logging macros now create a LogRecord, and pass that to the
      Logger, instead of passing a `level` and `args`. The new signature is:
      
          trait Logger {
              fn log(&mut self, record: &LogRecord);
          }
      
      The LogRecord includes additional values that may be useful to custom
      loggers, and also allows for further expansion if not values are found
      useful.
      
      DefaultLogger's formatting was taken from Python's default formatting:
      `LEVEL:from: message`
      
      Also included: fmt::Arguments now implement Show, so they can be used to
      extend format strings.
      
      [breaking-change]
      ceb29314