• B
    Auto merge of #43690 - scalexm:issue-28229, r=nikomatsakis · 942711e1
    bors 提交于
    Generate builtin impls for `Clone`
    
    This fixes a long-standing ICE and limitation where some builtin types implement `Copy` but not `Clone` (whereas `Clone` is a super trait of `Copy`).
    
    However, this PR has a few side-effects:
    * `Clone` is now marked as a lang item.
    * `[T; N]` is now `Clone` if `T: Clone` (currently, only if `T: Copy` and for `N <= 32`).
    * `fn foo<'a>() where &'a mut (): Clone { }` won't compile anymore because of how bounds for builtin traits are handled (e.g. same thing currently if you replace `Clone` by `Copy` in this example). Of course this function is unusable anyway, an error would pop as soon as it is called.
    
    Hence, I'm wondering wether this PR would need an RFC...
    Also, cc-ing @nikomatsakis, @arielb1.
    
    Related issues: #28229, #24000.
    942711e1
array.rs 8.0 KB