mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-10-01 06:11:35 +00:00
fix: preserve where clause when builtin derive
This commit is contained in:
parent
e9d3565cd1
commit
dad0fdb13f
3 changed files with 50 additions and 5 deletions
|
@ -1373,3 +1373,34 @@ pub fn attr_macro() {}
|
|||
"#,
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn clone_with_type_bound() {
|
||||
check_types(
|
||||
r#"
|
||||
//- minicore: derive, clone, builtin_impls
|
||||
#[derive(Clone)]
|
||||
struct Float;
|
||||
|
||||
trait TensorKind: Clone {
|
||||
/// The primitive type of the tensor.
|
||||
type Primitive: Clone;
|
||||
}
|
||||
|
||||
impl TensorKind for Float {
|
||||
type Primitive = f64;
|
||||
}
|
||||
|
||||
#[derive(Clone)]
|
||||
struct Tensor<K = Float> where K: TensorKind
|
||||
{
|
||||
primitive: K::Primitive,
|
||||
}
|
||||
|
||||
fn foo(t: Tensor) {
|
||||
let x = t.clone();
|
||||
//^ Tensor<Float>
|
||||
}
|
||||
"#,
|
||||
);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue