1. 28 4月, 2015 6 次提交
    • B
      Auto merge of #24478 - alexcrichton:issue-24313, r=aturon · 2b8c9b12
      bors 提交于
      Inspecting the current thread's info may not always work due to the TLS value
      having been destroyed (or is actively being destroyed). The code for printing
      a panic message assumed, however, that it could acquire the thread's name
      through this method.
      
      Instead this commit propagates the `Option` outwards to allow the
      `std::panicking` module to handle the case where the current thread isn't
      present.
      
      While it solves the immediate issue of #24313, there is still another underlying
      issue of panicking destructors in thread locals will abort the process.
      
      Closes #24313
      2b8c9b12
    • A
      std: Don't assume thread::current() works on panic · d98ab4fa
      Alex Crichton 提交于
      Inspecting the current thread's info may not always work due to the TLS value
      having been destroyed (or is actively being destroyed). The code for printing
      a panic message assumed, however, that it could acquire the thread's name
      through this method.
      
      Instead this commit propagates the `Option` outwards to allow the
      `std::panicking` module to handle the case where the current thread isn't
      present.
      
      While it solves the immediate issue of #24313, there is still another underlying
      issue of panicking destructors in thread locals will abort the process.
      
      Closes #24313
      d98ab4fa
    • B
      Auto merge of #24701 - Stebalien:slice, r=alexcrichton · 97d4e76c
      bors 提交于
      Instead of using the O(n) defaults, define O(1) shortcuts. I also copied (and slightly modified) the relevant tests from the iter tests into the slice tests just in case someone comes along and changes them in the future.
      
      Partially implements  #24214.
      97d4e76c
    • A
      std: Clean up some annotations in thread::local · 0e154aaa
      Alex Crichton 提交于
      Don't need so much manual #[doc(hidden)] and #[unstable] as much of it is
      inherited!
      0e154aaa
    • B
      Auto merge of #24765 - pnkfelix:fsk-enum-swapindrop, r=nikomatsakis · 9c88f3be
      bors 提交于
      Inspect enum discriminant *after* calling its destructor
      
      Includes some drive-by cleanup (e.g. changed some field and method names to reflect fill-on-drop; added comments about zero-variant enums being classified as `_match::Single`).
      
      Probably the most invasive change was the expansion of the maps `available_drop_glues` and `drop_glues` to now hold two different kinds of drop glues; there is the (old) normal drop glue, and there is (new) drop-contents glue that jumps straight to dropping the contents of a struct or enum, skipping its destructor.
      
       * For all types that do not have user-defined Drop implementations, the normal glue is generated as usual (i.e. recursively dropping the fields of the data structure).
      
        (And this actually is exactly what the newly-added drop-contents glue does as well.)
      
       * For types that have user-defined Drop implementations, the "normal" drop glue now schedules a cleanup before invoking the `Drop::drop` method that will call the drop-contents glue after that invocation returns.
      
      Fix #23611.
      
      ----
      
      Is this a breaking change?  The prior behavior was totally unsound, and it seems unreasonable that anyone was actually relying on it.
      
      Nonetheless, since there is a user-visible change to the language semantics, I guess I will conservatively mark this as a:
      
      [breaking-change]
      
      (To see an example of what sort of user-visible change this causes, see the comments in the regression test.)
      9c88f3be
    • B
      Auto merge of #23606 - quantheory:associated_const, r=nikomatsakis · 857ef6e2
      bors 提交于
      Closes #17841.
      
      The majority of the work should be done, e.g. trait and inherent impls, different forms of UFCS syntax, defaults, and cross-crate usage. It's probably enough to replace the constants in `f32`, `i8`, and so on, or close to good enough.
      
      There is still some significant functionality missing from this commit:
      
       - ~~Associated consts can't be used in match patterns at all. This is simply because I haven't updated the relevant bits in the parser or `resolve`, but it's *probably* not hard to get working.~~
       - Since you can't select an impl for trait-associated consts until partway through type-checking, there are some problems with code that assumes that you can check constants earlier. Associated consts that are not in inherent impls cause ICEs if you try to use them in array sizes or match ranges. For similar reasons, `check_static_recursion` doesn't check them properly, so the stack goes ka-blooey if you use an associated constant that's recursively defined. That's a bit trickier to solve; I'm not entirely sure what the best approach is yet.
       - Dealing with consts associated with type parameters will raise some new issues (e.g. if you have a `T: Int` type parameter and want to use `<T>::ZERO`). See rust-lang/rfcs#865.
       - ~~Unused associated consts don't seem to trigger the `dead_code` lint when they should. Probably easy to fix.~~
      
      Also, this is the first time I've been spelunking in rustc to such a large extent, so I've probably done some silly things in a couple of places.
      857ef6e2
  2. 27 4月, 2015 34 次提交