rust/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
..
bootstrap Auto merge of #79115 - cuviper:rust-description, r=Mark-Simulacrum 2020-11-21 15:43:09 +00:00
build_helper Fix even more URLs 2020-11-05 20:11:29 +01:00
ci Revert "Auto merge of #79132 - pietroalbini:beta-next, r=Mark-Simulacrum" 2020-11-18 11:18:40 +01:00
doc Rollup merge of #78714 - m-ou-se:simplify-local-streams, r=KodrAus 2020-11-16 17:26:27 +01:00
etc BTreeMap: reuse NodeRef as Root, keep BoxedNode for edges only, ban Unique 2020-11-18 10:07:42 +01:00
librustdoc Rollup merge of #79300 - GuillaumeGomez:hidden-feature-info, r=jyn514 2020-11-22 16:15:13 +01:00
llvm-project@ee16174578 Bump LLVM for DeadArgElim fix 2020-10-22 18:37:03 -04:00
test Rollup merge of #79287 - jonas-schievink:const-trait-impl, r=oli-obk 2020-11-23 15:25:44 +01:00
tools Rollup merge of #79287 - jonas-schievink:const-trait-impl, r=oli-obk 2020-11-23 15:25:44 +01:00
README.md Update README.md 2020-08-30 13:40:11 -05:00
stage0.txt Bump bootstrap compiler version 2020-11-19 19:23:36 -05:00
version bump version to 1.50.0 2020-11-13 09:47:16 +01:00

This directory contains the source code of the rust project, including:

  • The test suite
  • The bootstrapping build system
  • Various submodules for tools, like rustdoc, rls, etc.

For more information on how various parts of the compiler work, see the rustc dev guide.