mirror of
https://github.com/rust-lang/rust.git
synced 2025-06-06 12:18:33 +00:00
binary operator overload type inference: add test mark
This commit is contained in:
parent
4e49b2f731
commit
0e9d1e17d6
@ -12,6 +12,7 @@ use hir_def::{
|
|||||||
};
|
};
|
||||||
use hir_expand::name::{name, Name};
|
use hir_expand::name::{name, Name};
|
||||||
use syntax::ast::RangeOp;
|
use syntax::ast::RangeOp;
|
||||||
|
use test_utils::mark;
|
||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
autoderef, method_resolution, op,
|
autoderef, method_resolution, op,
|
||||||
@ -537,6 +538,8 @@ impl<'a> InferenceContext<'a> {
|
|||||||
let ret = op::binary_op_return_ty(*op, lhs_ty.clone(), rhs_ty.clone());
|
let ret = op::binary_op_return_ty(*op, lhs_ty.clone(), rhs_ty.clone());
|
||||||
|
|
||||||
if ret == Ty::Unknown {
|
if ret == Ty::Unknown {
|
||||||
|
mark::hit!(infer_expr_inner_binary_operator_overload);
|
||||||
|
|
||||||
self.resolve_associated_type_with_params(
|
self.resolve_associated_type_with_params(
|
||||||
lhs_ty,
|
lhs_ty,
|
||||||
self.resolve_binary_op_output(op),
|
self.resolve_binary_op_output(op),
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
use expect_test::expect;
|
use expect_test::expect;
|
||||||
|
use test_utils::mark;
|
||||||
|
|
||||||
use super::{check_infer, check_types};
|
use super::{check_infer, check_types};
|
||||||
|
|
||||||
@ -2228,6 +2229,8 @@ fn generic_default_depending_on_other_type_arg_forward() {
|
|||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn infer_operator_overload() {
|
fn infer_operator_overload() {
|
||||||
|
mark::check!(infer_expr_inner_binary_operator_overload);
|
||||||
|
|
||||||
check_infer(
|
check_infer(
|
||||||
r#"
|
r#"
|
||||||
struct V2([f32; 2]);
|
struct V2([f32; 2]);
|
||||||
|
Loading…
Reference in New Issue
Block a user