1. 02 11月, 2018 6 次提交
    • M
      add `U: Trait` to the param env during DispatchFromDyn check · eb997d76
      Michael Hewson 提交于
      also updated the doc on `receiver_is_dispatchable` to reflect current state of the implementation
      eb997d76
    • M
      Add layout sanity checks in object safety · 6f2a161b
      Michael Hewson 提交于
      If object-safety checks succeed for a receiver type, make sure the
      receiver’s abi is
      a) a Scalar, when Self = ()
      b) a ScalarPair, when Self = dyn Trait
      6f2a161b
    • M
    • M
      Replace CoerceSized trait with DispatchFromDyn · f12c250e
      Michael Hewson 提交于
      Rename `CoerceSized` to `DispatchFromDyn`, and reverse the direction so that, for example, you write
      
      ```
      impl<T: Unsize<U>, U> DispatchFromDyn<*const U> for *const T {}
      ```
      
      instead of
      
      ```
      impl<T: Unsize<U>, U> DispatchFromDyn<*const T> for *const U {}
      ```
      
      this way the trait is really just a subset of `CoerceUnsized`.
      
      The checks in object_safety.rs are updated for the new trait, and some documentation and method names in there are updated for the new trait name — e.g. `receiver_is_coercible` is now called `receiver_is_dispatchable`. Since the trait now works in the opposite direction, some code had to updated here for that too.
      
      I did not update the error messages for invalid `CoerceSized` (now `DispatchFromDyn`) implementations, except to find/replace `CoerceSized` with `DispatchFromDyn`. Will ask for suggestions in the PR thread.
      f12c250e
    • M
      Implement the object-safety checks for arbitrary_self_types: part 1 · d5c2c4a4
      Michael Hewson 提交于
      For a trait method to be considered object-safe, the receiver type must
      satisfy certain properties: first, we need to be able to get the vtable
      to so we can look up the method, and second, we need to convert the
      receiver from the version where `Self=dyn Trait`, to the version where
      `Self=T`, `T` being some unknown, `Sized` type that implements `Trait`.
      
      To check that the receiver satisfies those properties, we use the
      following query:
      
      forall (U) {
      if (Self: Unsize<U>) {
      Receiver[Self => U]: CoerceSized<Receiver>
      }
      }
      
      where `Receiver` is the receiver type of the method (e.g. `Rc<Self>`),
      and `Receiver[Self => U]` is the receiver type where `Self = U`, e.g.
      `Rc<U>`.
      
      forall queries like this aren’t implemented in the trait system yet, so
      for now we are using a bit of a hack — see the code for explanation.
      d5c2c4a4
    • M
      d14af130
  2. 28 9月, 2018 1 次提交
  3. 18 9月, 2018 1 次提交
  4. 22 8月, 2018 2 次提交
  5. 27 7月, 2018 1 次提交
  6. 02 7月, 2018 1 次提交
  7. 28 6月, 2018 1 次提交
  8. 25 6月, 2018 2 次提交
  9. 15 5月, 2018 6 次提交
  10. 25 4月, 2018 1 次提交
  11. 04 3月, 2018 1 次提交
  12. 17 12月, 2017 1 次提交
  13. 06 12月, 2017 1 次提交
  14. 09 11月, 2017 1 次提交
  15. 08 11月, 2017 1 次提交
  16. 11 9月, 2017 1 次提交
  17. 05 9月, 2017 1 次提交
    • A
      rustc: Migrate lang items to a query · a2e2aba0
      Alex Crichton 提交于
      This commit moves the calculation of the `LanguageItems` structure into a
      query rather than being calculated before the `TyCtxt` exists, with the eventual
      end goal of removing some `CrateStore` methods.
      a2e2aba0
  18. 11 7月, 2017 1 次提交
  19. 27 6月, 2017 1 次提交
  20. 15 5月, 2017 1 次提交
  21. 13 5月, 2017 2 次提交
  22. 01 5月, 2017 2 次提交
  23. 24 4月, 2017 4 次提交