From 3212734bd744719dc197a19902d083c591670ab1 Mon Sep 17 00:00:00 2001 From: Ellen Date: Tue, 7 Sep 2021 13:36:50 +0100 Subject: [PATCH] resolve `from_hir_call` FIXME --- .../src/traits/const_evaluatable.rs | 1 - .../abstract-consts-as-cast-5.rs | 2 +- .../unify-op-with-fn-call.rs | 23 +++++++++++++++++++ 3 files changed, 24 insertions(+), 2 deletions(-) create mode 100644 src/test/ui/const-generics/generic_const_exprs/unify-op-with-fn-call.rs diff --git a/compiler/rustc_trait_selection/src/traits/const_evaluatable.rs b/compiler/rustc_trait_selection/src/traits/const_evaluatable.rs index 26c71a0f539..702b5a508b7 100644 --- a/compiler/rustc_trait_selection/src/traits/const_evaluatable.rs +++ b/compiler/rustc_trait_selection/src/traits/const_evaluatable.rs @@ -337,7 +337,6 @@ impl<'a, 'tcx> AbstractConstBuilder<'a, 'tcx> { // `::ASSOC` as well as `12` &ExprKind::Literal { literal, .. } => self.nodes.push(Node::Leaf(literal)), - // FIXME(generic_const_exprs): Handle `from_hir_call` field ExprKind::Call { fun, args, .. } => { let fun = self.recurse_build(*fun)?; diff --git a/src/test/ui/const-generics/generic_const_exprs/abstract-consts-as-cast-5.rs b/src/test/ui/const-generics/generic_const_exprs/abstract-consts-as-cast-5.rs index b3cde61f5e7..916d60c0e0d 100644 --- a/src/test/ui/const-generics/generic_const_exprs/abstract-consts-as-cast-5.rs +++ b/src/test/ui/const-generics/generic_const_exprs/abstract-consts-as-cast-5.rs @@ -8,4 +8,4 @@ fn foo(a: [(); N as usize]) { fn bar() {} -fn main() {} \ No newline at end of file +fn main() {} diff --git a/src/test/ui/const-generics/generic_const_exprs/unify-op-with-fn-call.rs b/src/test/ui/const-generics/generic_const_exprs/unify-op-with-fn-call.rs new file mode 100644 index 00000000000..abbeb2c928e --- /dev/null +++ b/src/test/ui/const-generics/generic_const_exprs/unify-op-with-fn-call.rs @@ -0,0 +1,23 @@ +#![feature(generic_const_exprs, adt_const_params, const_trait_impl)] +#![allow(incomplete_features)] + +#[derive(PartialEq, Eq)] +struct Foo(u8); + +impl const std::ops::Add for Foo { + type Output = Self; + + fn add(self, rhs: Self) -> Self::Output { + self + } +} + +struct Evaluatable; + +fn foo(a: Evaluatable<{ N + N }>) { + bar::<{ std::ops::Add::add(N, N) }>(); +} + +fn bar() {} + +fn main() {}