1 // Test for issue 81576
2 // Remove generic arguments if no method is found for all possible generic argument
4 use std
::marker
::PhantomData
;
6 struct Wrapper2
<'a
, T
, const C
: usize> {
10 impl<'a
, const C
: usize> Wrapper2
<'a
, i8, C
> {
14 impl<'a
, const C
: usize> Wrapper2
<'a
, i16, C
> {
18 impl<'a
, const C
: usize> Wrapper2
<'a
, i32, C
> {
53 fn distance(&self) -> f64 {
65 _phatom
: PhantomData
<T
>
68 impl<T
> Default
for Struct
<T
> {
69 fn default() -> Self {
70 Self{ _phatom: PhantomData }
74 impl<T
: Clone
+ Copy
+ PartialEq
+ Eq
+ PartialOrd
+ Ord
> Struct
<T
> {
79 let point_f64
= Point{ x: 1_f64, y: 1_f64}
;
80 let d
= point_f64
.distance();
81 let point_i32
= Point{ x: 1_i32, y: 1_i32}
;
82 let d
= point_i32
.distance();
83 //~^ ERROR no method named `distance` found for struct `Point<i32>
84 let d
= point_i32
.other();
85 //~^ ERROR no method named `other` found for struct `Point
86 let v
= vec
![1_i32, 2, 3];
87 v
.iter().map(|x
| x
* x
).extend(std
::iter
::once(100));
88 //~^ ERROR no method named `extend` found for struct `Map
89 let wrapper
= Wrapper(true);
91 //~^ ERROR no method named `method` found for struct `Wrapper<bool>
93 //~^ ERROR no method named `other` found for struct `Wrapper
95 let wrapper
= Wrapper2
::<'_
, _
, 3> {x: &boolean}
;
97 //~^ ERROR no method named `method` found for struct `Wrapper2<'_, bool, 3_usize>
99 //~^ ERROR no method named `other` found for struct `Wrapper2
100 let a
= vec
![1, 2, 3];
102 //~^ ERROR no method named `not_found` found for struct `Vec
103 let s
= Struct
::<f64>::default();
105 //~^ ERROR the method `method` exists for struct `Struct<f64>`, but its trait bounds were not satisfied