1. 31 3月, 2015 1 次提交
  2. 25 3月, 2015 3 次提交
    • N
      Bug fixes · 7e3ee020
      Nick Cameron 提交于
      7e3ee020
    • N
      Minor refactoring in coercion.rs · 9374c216
      Nick Cameron 提交于
      9374c216
    • N
      Add trivial cast lints. · 95602a75
      Nick Cameron 提交于
      This permits all coercions to be performed in casts, but adds lints to warn in those cases.
      
      Part of this patch moves cast checking to a later stage of type checking. We acquire obligations to check casts as part of type checking where we previously checked them. Once we have type checked a function or module, then we check any cast obligations which have been acquired. That means we have more type information available to check casts (this was crucial to making coercions work properly in place of some casts), but it means that casts cannot feed input into type inference.
      
      [breaking change]
      
      * Adds two new lints for trivial casts and trivial numeric casts, these are warn by default, but can cause errors if you build with warnings as errors. Previously, trivial numeric casts and casts to trait objects were allowed.
      * The unused casts lint has gone.
      * Interactions between casting and type inference have changed in subtle ways. Two ways this might manifest are:
      - You may need to 'direct' casts more with extra type information, for example, in some cases where `foo as _ as T` succeeded, you may now need to specify the type for `_`
      - Casts do not influence inference of integer types. E.g., the following used to type check:
      
      ```
      let x = 42;
      let y = &x as *const u32;
      ```
      
      Because the cast would inform inference that `x` must have type `u32`. This no longer applies and the compiler will fallback to `i32` for `x` and thus there will be a type error in the cast. The solution is to add more type information:
      
      ```
      let x: u32 = 42;
      let y = &x as *const u32;
      ```
      95602a75
  3. 23 3月, 2015 1 次提交
  4. 18 3月, 2015 1 次提交
  5. 17 3月, 2015 1 次提交
  6. 03 2月, 2015 1 次提交
  7. 30 1月, 2015 4 次提交
  8. 20 1月, 2015 1 次提交
  9. 07 1月, 2015 1 次提交
    • S
      core: split into fmt::Show and fmt::String · 44440e5c
      Sean McArthur 提交于
      fmt::Show is for debugging, and can and should be implemented for
      all public types. This trait is used with `{:?}` syntax. There still
      exists #[derive(Show)].
      
      fmt::String is for types that faithfully be represented as a String.
      Because of this, there is no way to derive fmt::String, all
      implementations must be purposeful. It is used by the default format
      syntax, `{}`.
      
      This will break most instances of `{}`, since that now requires the type
      to impl fmt::String. In most cases, replacing `{}` with `{:?}` is the
      correct fix. Types that were being printed specifically for users should
      receive a fmt::String implementation to fix this.
      
      Part of #20013
      
      [breaking-change]
      44440e5c
  10. 06 1月, 2015 2 次提交
  11. 04 1月, 2015 1 次提交
  12. 30 12月, 2014 1 次提交
  13. 29 12月, 2014 4 次提交
  14. 23 12月, 2014 2 次提交
  15. 22 12月, 2014 1 次提交
  16. 20 12月, 2014 1 次提交
  17. 19 12月, 2014 3 次提交
  18. 15 12月, 2014 1 次提交
  19. 14 12月, 2014 1 次提交
  20. 12 12月, 2014 1 次提交
  21. 04 12月, 2014 1 次提交
  22. 27 11月, 2014 1 次提交
  23. 19 11月, 2014 3 次提交
  24. 18 11月, 2014 1 次提交
  25. 08 11月, 2014 1 次提交
    • N
      Make TyTrait embed a `TraitRef`, so that when we extend TraitRef, it naturally... · c18a1327
      Niko Matsakis 提交于
      Make TyTrait embed a `TraitRef`, so that when we extend TraitRef, it naturally carries over to object types.
      
      I wanted to embed an `Rc<TraitRef>`, but I was foiled by the current
      static rules, which prohibit non-Sync values from being stored in
      static locations. This means that the constants for `ty_int` and so
      forth cannot be initialized.
      c18a1327
  26. 21 10月, 2014 1 次提交