]> git.lizzy.rs Git - rust.git/commitdiff
Rollup merge of #65738 - ohadravid:re-rebalance-coherence-allow-fundamental-local...
authorMazdak Farrokhzad <twingoow@gmail.com>
Sun, 27 Oct 2019 15:46:52 +0000 (16:46 +0100)
committerGitHub <noreply@github.com>
Sun, 27 Oct 2019 15:46:52 +0000 (16:46 +0100)
Coherence should allow fundamental types to impl traits when they are local

After #64414, `impl<T> Remote for Box<T> { }` is disallowed, but it is also disallowed in liballoc, where `Box` is a local type!

Enabling `#![feature(re_rebalance_coherence)]` in `liballoc` results in:
```
error[E0210]: type parameter `F` must be used as the type parameter for some local type (e.g., `MyStruct<F>`)
    --> src\liballoc\boxed.rs:1098:1
     |
1098 | impl<F: ?Sized + Future + Unpin> Future for Box<F> {
     | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type parameter `F` must be used as the type parameter for some local type
```

This PR relaxes `uncover_fundamental_ty` to skip local fundamental types.
I didn't add a test since `liballoc` already fails to compile, but I can add one if needed.

r? @nikomatsakis

cc #63599


Trivial merge