rust/compiler/rustc_mir/src
Jonas Schievink c7a67209c8
Rollup merge of #79287 - jonas-schievink:const-trait-impl, r=oli-obk
Allow using generic trait methods in `const fn`

Next step for https://github.com/rust-lang/rust/issues/67792, this now also allows code like the following:

```rust
struct S;

impl const PartialEq for S {
    fn eq(&self, _: &S) -> bool {
        true
    }
}

const fn equals_self<T: PartialEq>(t: &T) -> bool {
    *t == *t
}

pub const EQ: bool = equals_self(&S);
```

This works by threading const-ness of trait predicates through trait selection, in particular through `ParamCandidate`, and exposing it in the resulting `ImplSource`.

Since this change makes two bounds `T: Trait` and `T: ?const Trait` that only differ in their const-ness be treated like different bounds, candidate winnowing has been changed to drop the `?const` candidate in favor of the const candidate, to avoid ambiguities when both a const and a non-const bound is present.
2020-11-23 15:25:44 +01:00
..
borrow_check Auto merge of #78801 - sexxi-goose:min_capture, r=nikomatsakis 2020-11-17 03:56:03 +00:00
const_eval review comments 2020-11-12 21:08:18 +05:30
dataflow compiler: fold by value 2020-11-16 22:34:57 +01:00
interpret List all variants of TyKind 2020-11-21 13:45:59 +08:00
monomorphize Auto merge of #78779 - LeSeulArtichaut:ty-visitor-return, r=oli-obk 2020-11-17 12:24:34 +00:00
transform Rollup merge of #79287 - jonas-schievink:const-trait-impl, r=oli-obk 2020-11-23 15:25:44 +01:00
util Introduce TypeVisitor::BreakTy 2020-11-14 20:25:27 +01:00
lib.rs TypeVisitor: use ControlFlow in rustc_{mir,privacy,traits,typeck} 2020-10-30 12:27:44 +01:00
shim.rs Support building clone shims for arrays with generic size 2020-11-21 00:00:00 +00:00