diff options
Diffstat (limited to 'src/test/ui/ufcs')
-rw-r--r-- | src/test/ui/ufcs/ufcs-explicit-self-bad.rs | 59 | ||||
-rw-r--r-- | src/test/ui/ufcs/ufcs-explicit-self-bad.stderr | 107 | ||||
-rw-r--r-- | src/test/ui/ufcs/ufcs-partially-resolved.rs | 56 | ||||
-rw-r--r-- | src/test/ui/ufcs/ufcs-partially-resolved.stderr | 225 | ||||
-rw-r--r-- | src/test/ui/ufcs/ufcs-qpath-missing-params.rs | 20 | ||||
-rw-r--r-- | src/test/ui/ufcs/ufcs-qpath-missing-params.stderr | 49 | ||||
-rw-r--r-- | src/test/ui/ufcs/ufcs-qpath-self-mismatch.rs | 10 | ||||
-rw-r--r-- | src/test/ui/ufcs/ufcs-qpath-self-mismatch.stderr | 58 |
8 files changed, 584 insertions, 0 deletions
diff --git a/src/test/ui/ufcs/ufcs-explicit-self-bad.rs b/src/test/ui/ufcs/ufcs-explicit-self-bad.rs new file mode 100644 index 000000000..cb1fac0ba --- /dev/null +++ b/src/test/ui/ufcs/ufcs-explicit-self-bad.rs @@ -0,0 +1,59 @@ +struct Foo { + f: isize, +} + + + +impl Foo { + fn foo(self: isize, x: isize) -> isize { + //~^ ERROR invalid `self` parameter type + self.f + x + } +} + +struct Bar<T> { + f: T, +} + +impl<T> Bar<T> { + fn foo(self: Bar<isize>, x: isize) -> isize { + //~^ ERROR invalid `self` parameter type + x + } + fn bar(self: &Bar<usize>, x: isize) -> isize { + //~^ ERROR invalid `self` parameter type + x + } +} + +trait SomeTrait { + fn dummy1(&self); + fn dummy2(&self); + fn dummy3(&self); +} + +impl<'a, T> SomeTrait for &'a Bar<T> { + fn dummy1(self: &&'a Bar<T>) { } + fn dummy2(self: &Bar<T>) {} //~ ERROR mismatched `self` parameter type + //~^ ERROR mismatched `self` parameter type + fn dummy3(self: &&Bar<T>) {} + //~^ ERROR mismatched `self` parameter type + //~| expected reference `&'a Bar<T>` + //~| found reference `&Bar<T>` + //~| lifetime mismatch + //~| ERROR mismatched `self` parameter type + //~| expected reference `&'a Bar<T>` + //~| found reference `&Bar<T>` + //~| lifetime mismatch +} + +fn main() { + let foo = Box::new(Foo { + f: 1, + }); + println!("{}", foo.foo(2)); + let bar = Box::new(Bar { + f: 1, + }); + println!("{} {}", bar.foo(2), bar.bar(2)); +} diff --git a/src/test/ui/ufcs/ufcs-explicit-self-bad.stderr b/src/test/ui/ufcs/ufcs-explicit-self-bad.stderr new file mode 100644 index 000000000..f325d1d81 --- /dev/null +++ b/src/test/ui/ufcs/ufcs-explicit-self-bad.stderr @@ -0,0 +1,107 @@ +error[E0307]: invalid `self` parameter type: isize + --> $DIR/ufcs-explicit-self-bad.rs:8:18 + | +LL | fn foo(self: isize, x: isize) -> isize { + | ^^^^^ + | + = note: type of `self` must be `Self` or a type that dereferences to it + = help: consider changing to `self`, `&self`, `&mut self`, `self: Box<Self>`, `self: Rc<Self>`, `self: Arc<Self>`, or `self: Pin<P>` (where P is one of the previous types except `Self`) + +error[E0307]: invalid `self` parameter type: Bar<isize> + --> $DIR/ufcs-explicit-self-bad.rs:19:18 + | +LL | fn foo(self: Bar<isize>, x: isize) -> isize { + | ^^^^^^^^^^ + | + = note: type of `self` must be `Self` or a type that dereferences to it + = help: consider changing to `self`, `&self`, `&mut self`, `self: Box<Self>`, `self: Rc<Self>`, `self: Arc<Self>`, or `self: Pin<P>` (where P is one of the previous types except `Self`) + +error[E0307]: invalid `self` parameter type: &Bar<usize> + --> $DIR/ufcs-explicit-self-bad.rs:23:18 + | +LL | fn bar(self: &Bar<usize>, x: isize) -> isize { + | ^^^^^^^^^^^ + | + = note: type of `self` must be `Self` or a type that dereferences to it + = help: consider changing to `self`, `&self`, `&mut self`, `self: Box<Self>`, `self: Rc<Self>`, `self: Arc<Self>`, or `self: Pin<P>` (where P is one of the previous types except `Self`) + +error[E0308]: mismatched `self` parameter type + --> $DIR/ufcs-explicit-self-bad.rs:37:21 + | +LL | fn dummy2(self: &Bar<T>) {} + | ^^^^^^^ lifetime mismatch + | + = note: expected reference `&'a Bar<T>` + found reference `&Bar<T>` +note: the anonymous lifetime defined here... + --> $DIR/ufcs-explicit-self-bad.rs:37:21 + | +LL | fn dummy2(self: &Bar<T>) {} + | ^^^^^^^ +note: ...does not necessarily outlive the lifetime `'a` as defined here + --> $DIR/ufcs-explicit-self-bad.rs:35:6 + | +LL | impl<'a, T> SomeTrait for &'a Bar<T> { + | ^^ + +error[E0308]: mismatched `self` parameter type + --> $DIR/ufcs-explicit-self-bad.rs:37:21 + | +LL | fn dummy2(self: &Bar<T>) {} + | ^^^^^^^ lifetime mismatch + | + = note: expected reference `&'a Bar<T>` + found reference `&Bar<T>` +note: the lifetime `'a` as defined here... + --> $DIR/ufcs-explicit-self-bad.rs:35:6 + | +LL | impl<'a, T> SomeTrait for &'a Bar<T> { + | ^^ +note: ...does not necessarily outlive the anonymous lifetime defined here + --> $DIR/ufcs-explicit-self-bad.rs:37:21 + | +LL | fn dummy2(self: &Bar<T>) {} + | ^^^^^^^ + +error[E0308]: mismatched `self` parameter type + --> $DIR/ufcs-explicit-self-bad.rs:39:21 + | +LL | fn dummy3(self: &&Bar<T>) {} + | ^^^^^^^^ lifetime mismatch + | + = note: expected reference `&'a Bar<T>` + found reference `&Bar<T>` +note: the anonymous lifetime defined here... + --> $DIR/ufcs-explicit-self-bad.rs:39:22 + | +LL | fn dummy3(self: &&Bar<T>) {} + | ^^^^^^^ +note: ...does not necessarily outlive the lifetime `'a` as defined here + --> $DIR/ufcs-explicit-self-bad.rs:35:6 + | +LL | impl<'a, T> SomeTrait for &'a Bar<T> { + | ^^ + +error[E0308]: mismatched `self` parameter type + --> $DIR/ufcs-explicit-self-bad.rs:39:21 + | +LL | fn dummy3(self: &&Bar<T>) {} + | ^^^^^^^^ lifetime mismatch + | + = note: expected reference `&'a Bar<T>` + found reference `&Bar<T>` +note: the lifetime `'a` as defined here... + --> $DIR/ufcs-explicit-self-bad.rs:35:6 + | +LL | impl<'a, T> SomeTrait for &'a Bar<T> { + | ^^ +note: ...does not necessarily outlive the anonymous lifetime defined here + --> $DIR/ufcs-explicit-self-bad.rs:39:22 + | +LL | fn dummy3(self: &&Bar<T>) {} + | ^^^^^^^ + +error: aborting due to 7 previous errors + +Some errors have detailed explanations: E0307, E0308. +For more information about an error, try `rustc --explain E0307`. diff --git a/src/test/ui/ufcs/ufcs-partially-resolved.rs b/src/test/ui/ufcs/ufcs-partially-resolved.rs new file mode 100644 index 000000000..e6470aa6d --- /dev/null +++ b/src/test/ui/ufcs/ufcs-partially-resolved.rs @@ -0,0 +1,56 @@ +#![feature(associated_type_defaults)] + +trait Tr { + type Y = u16; + fn Y() {} +} +impl Tr for u8 {} + +trait Dr { + type X = u16; + fn Z() {} +} +impl Dr for u8 {} + +enum E { Y } +type A = u32; + +fn main() { + let _: <u8 as Tr>::N; //~ ERROR cannot find associated type `N` in trait `Tr` + let _: <u8 as E>::N; //~ ERROR cannot find associated type `N` in enum `E` + let _: <u8 as A>::N; //~ ERROR cannot find associated type `N` in `A` + <u8 as Tr>::N; //~ ERROR cannot find method or associated constant `N` in trait `Tr` + <u8 as E>::N; //~ ERROR cannot find method or associated constant `N` in enum `E` + <u8 as A>::N; //~ ERROR cannot find method or associated constant `N` in `A` + let _: <u8 as Tr>::Y; // OK + let _: <u8 as E>::Y; //~ ERROR expected associated type, found variant `E::Y` + <u8 as Tr>::Y; // OK + <u8 as E>::Y; //~ ERROR expected method or associated constant, found unit variant `E::Y` + + let _: <u8 as Tr>::N::NN; //~ ERROR cannot find associated type `N` in trait `Tr` + let _: <u8 as E>::N::NN; //~ ERROR cannot find associated type `N` in enum `E` + let _: <u8 as A>::N::NN; //~ ERROR cannot find associated type `N` in `A` + <u8 as Tr>::N::NN; //~ ERROR cannot find associated type `N` in trait `Tr` + <u8 as E>::N::NN; //~ ERROR cannot find associated type `N` in enum `E` + <u8 as A>::N::NN; //~ ERROR cannot find associated type `N` in `A` + let _: <u8 as Tr>::Y::NN; //~ ERROR ambiguous associated type + let _: <u8 as E>::Y::NN; //~ ERROR expected associated type, found variant `E::Y` + <u8 as Tr>::Y::NN; //~ ERROR no associated item named `NN` found for type `u16` + <u8 as E>::Y::NN; //~ ERROR expected associated type, found variant `E::Y` + + let _: <u8 as Tr::N>::NN; //~ ERROR cannot find associated type `NN` in `Tr::N` + let _: <u8 as E::N>::NN; //~ ERROR cannot find associated type `NN` in `E::N` + let _: <u8 as A::N>::NN; //~ ERROR cannot find associated type `NN` in `A::N` + <u8 as Tr::N>::NN; //~ ERROR cannot find method or associated constant `NN` in `Tr::N` + <u8 as E::N>::NN; //~ ERROR cannot find method or associated constant `NN` in `E::N` + <u8 as A::N>::NN; //~ ERROR cannot find method or associated constant `NN` in `A::N` + let _: <u8 as Tr::Y>::NN; //~ ERROR cannot find associated type `NN` in `Tr::Y` + let _: <u8 as E::Y>::NN; //~ ERROR failed to resolve: `Y` is a variant, not a module + <u8 as Tr::Y>::NN; //~ ERROR cannot find method or associated constant `NN` in `Tr::Y` + <u8 as E::Y>::NN; //~ ERROR failed to resolve: `Y` is a variant, not a module + + let _: <u8 as Dr>::Z; //~ ERROR expected associated type, found associated function `Dr::Z` + <u8 as Dr>::X; //~ ERROR expected method or associated constant, found associated type `Dr::X` + let _: <u8 as Dr>::Z::N; //~ ERROR expected associated type, found associated function `Dr::Z` + <u8 as Dr>::X::N; //~ ERROR no associated item named `N` found for type `u16` +} diff --git a/src/test/ui/ufcs/ufcs-partially-resolved.stderr b/src/test/ui/ufcs/ufcs-partially-resolved.stderr new file mode 100644 index 000000000..3950dc987 --- /dev/null +++ b/src/test/ui/ufcs/ufcs-partially-resolved.stderr @@ -0,0 +1,225 @@ +error[E0433]: failed to resolve: `Y` is a variant, not a module + --> $DIR/ufcs-partially-resolved.rs:48:22 + | +LL | let _: <u8 as E::Y>::NN; + | ^ `Y` is a variant, not a module + +error[E0433]: failed to resolve: `Y` is a variant, not a module + --> $DIR/ufcs-partially-resolved.rs:50:15 + | +LL | <u8 as E::Y>::NN; + | ^ `Y` is a variant, not a module + +error[E0576]: cannot find associated type `N` in trait `Tr` + --> $DIR/ufcs-partially-resolved.rs:19:24 + | +LL | type Y = u16; + | ------------- similarly named associated type `Y` defined here +... +LL | let _: <u8 as Tr>::N; + | ^ help: an associated type with a similar name exists: `Y` + +error[E0576]: cannot find associated type `N` in enum `E` + --> $DIR/ufcs-partially-resolved.rs:20:23 + | +LL | let _: <u8 as E>::N; + | ^ not found in `E` + +error[E0576]: cannot find associated type `N` in `A` + --> $DIR/ufcs-partially-resolved.rs:21:23 + | +LL | let _: <u8 as A>::N; + | ^ not found in `A` + +error[E0576]: cannot find method or associated constant `N` in trait `Tr` + --> $DIR/ufcs-partially-resolved.rs:22:17 + | +LL | fn Y() {} + | ------ similarly named associated function `Y` defined here +... +LL | <u8 as Tr>::N; + | ^ help: an associated function with a similar name exists: `Y` + +error[E0576]: cannot find method or associated constant `N` in enum `E` + --> $DIR/ufcs-partially-resolved.rs:23:16 + | +LL | <u8 as E>::N; + | ^ not found in `E` + +error[E0576]: cannot find method or associated constant `N` in `A` + --> $DIR/ufcs-partially-resolved.rs:24:16 + | +LL | <u8 as A>::N; + | ^ not found in `A` + +error[E0575]: expected associated type, found variant `E::Y` + --> $DIR/ufcs-partially-resolved.rs:26:12 + | +LL | let _: <u8 as E>::Y; + | ^^^^^^^^^^^^ not a associated type + +error[E0575]: expected method or associated constant, found unit variant `E::Y` + --> $DIR/ufcs-partially-resolved.rs:28:5 + | +LL | <u8 as E>::Y; + | ^^^^^^^^^^^^ not a method or associated constant + +error[E0576]: cannot find associated type `N` in trait `Tr` + --> $DIR/ufcs-partially-resolved.rs:30:24 + | +LL | type Y = u16; + | ------------- similarly named associated type `Y` defined here +... +LL | let _: <u8 as Tr>::N::NN; + | ^ help: an associated type with a similar name exists: `Y` + +error[E0576]: cannot find associated type `N` in enum `E` + --> $DIR/ufcs-partially-resolved.rs:31:23 + | +LL | let _: <u8 as E>::N::NN; + | ^ not found in `E` + +error[E0576]: cannot find associated type `N` in `A` + --> $DIR/ufcs-partially-resolved.rs:32:23 + | +LL | let _: <u8 as A>::N::NN; + | ^ not found in `A` + +error[E0576]: cannot find associated type `N` in trait `Tr` + --> $DIR/ufcs-partially-resolved.rs:33:17 + | +LL | type Y = u16; + | ------------- similarly named associated type `Y` defined here +... +LL | <u8 as Tr>::N::NN; + | ^ help: an associated type with a similar name exists: `Y` + +error[E0576]: cannot find associated type `N` in enum `E` + --> $DIR/ufcs-partially-resolved.rs:34:16 + | +LL | <u8 as E>::N::NN; + | ^ not found in `E` + +error[E0576]: cannot find associated type `N` in `A` + --> $DIR/ufcs-partially-resolved.rs:35:16 + | +LL | <u8 as A>::N::NN; + | ^ not found in `A` + +error[E0575]: expected associated type, found variant `E::Y` + --> $DIR/ufcs-partially-resolved.rs:37:12 + | +LL | let _: <u8 as E>::Y::NN; + | ^^^^^^^^^^^^^^^^ not a associated type + +error[E0575]: expected associated type, found variant `E::Y` + --> $DIR/ufcs-partially-resolved.rs:39:5 + | +LL | <u8 as E>::Y::NN; + | ^^^^^^^^^^^^^^^^ not a associated type + +error[E0576]: cannot find associated type `NN` in `Tr::N` + --> $DIR/ufcs-partially-resolved.rs:41:27 + | +LL | let _: <u8 as Tr::N>::NN; + | ^^ not found in `Tr::N` + +error[E0576]: cannot find associated type `NN` in `E::N` + --> $DIR/ufcs-partially-resolved.rs:42:26 + | +LL | let _: <u8 as E::N>::NN; + | ^^ not found in `E::N` + +error[E0576]: cannot find associated type `NN` in `A::N` + --> $DIR/ufcs-partially-resolved.rs:43:26 + | +LL | let _: <u8 as A::N>::NN; + | ^^ not found in `A::N` + +error[E0576]: cannot find method or associated constant `NN` in `Tr::N` + --> $DIR/ufcs-partially-resolved.rs:44:20 + | +LL | <u8 as Tr::N>::NN; + | ^^ not found in `Tr::N` + +error[E0576]: cannot find method or associated constant `NN` in `E::N` + --> $DIR/ufcs-partially-resolved.rs:45:19 + | +LL | <u8 as E::N>::NN; + | ^^ not found in `E::N` + +error[E0576]: cannot find method or associated constant `NN` in `A::N` + --> $DIR/ufcs-partially-resolved.rs:46:19 + | +LL | <u8 as A::N>::NN; + | ^^ not found in `A::N` + +error[E0576]: cannot find associated type `NN` in `Tr::Y` + --> $DIR/ufcs-partially-resolved.rs:47:27 + | +LL | let _: <u8 as Tr::Y>::NN; + | ^^ not found in `Tr::Y` + +error[E0576]: cannot find method or associated constant `NN` in `Tr::Y` + --> $DIR/ufcs-partially-resolved.rs:49:20 + | +LL | <u8 as Tr::Y>::NN; + | ^^ not found in `Tr::Y` + +error[E0575]: expected associated type, found associated function `Dr::Z` + --> $DIR/ufcs-partially-resolved.rs:52:12 + | +LL | type X = u16; + | ------------- similarly named associated type `X` defined here +... +LL | let _: <u8 as Dr>::Z; + | ^^^^^^^^^^^^- + | | + | help: an associated type with a similar name exists: `X` + +error[E0575]: expected method or associated constant, found associated type `Dr::X` + --> $DIR/ufcs-partially-resolved.rs:53:5 + | +LL | fn Z() {} + | ------ similarly named associated function `Z` defined here +... +LL | <u8 as Dr>::X; + | ^^^^^^^^^^^^- + | | + | help: an associated function with a similar name exists: `Z` + | + = note: can't use a type alias as a constructor + +error[E0575]: expected associated type, found associated function `Dr::Z` + --> $DIR/ufcs-partially-resolved.rs:54:12 + | +LL | type X = u16; + | ------------- similarly named associated type `X` defined here +... +LL | let _: <u8 as Dr>::Z::N; + | ^^^^^^^^^^^^-^^^ + | | + | help: an associated type with a similar name exists: `X` + +error[E0223]: ambiguous associated type + --> $DIR/ufcs-partially-resolved.rs:36:12 + | +LL | let _: <u8 as Tr>::Y::NN; + | ^^^^^^^^^^^^^^^^^ help: use fully-qualified syntax: `<u16 as Trait>::NN` + +error[E0599]: no associated item named `NN` found for type `u16` in the current scope + --> $DIR/ufcs-partially-resolved.rs:38:20 + | +LL | <u8 as Tr>::Y::NN; + | ^^ associated item not found in `u16` + +error[E0599]: no associated item named `N` found for type `u16` in the current scope + --> $DIR/ufcs-partially-resolved.rs:55:20 + | +LL | <u8 as Dr>::X::N; + | ^ associated item not found in `u16` + +error: aborting due to 32 previous errors + +Some errors have detailed explanations: E0223, E0433, E0575, E0576, E0599. +For more information about an error, try `rustc --explain E0223`. diff --git a/src/test/ui/ufcs/ufcs-qpath-missing-params.rs b/src/test/ui/ufcs/ufcs-qpath-missing-params.rs new file mode 100644 index 000000000..766351634 --- /dev/null +++ b/src/test/ui/ufcs/ufcs-qpath-missing-params.rs @@ -0,0 +1,20 @@ +use std::borrow::Cow; + +pub trait IntoCow<'a, B: ?Sized> where B: ToOwned { + fn into_cow(self) -> Cow<'a, B>; +} + +impl<'a> IntoCow<'a, str> for String { + fn into_cow(self) -> Cow<'a, str> { + Cow::Owned(self) + } +} + +fn main() { + <String as IntoCow>::into_cow("foo".to_string()); + //~^ ERROR missing generics for + + <String as IntoCow>::into_cow::<str>("foo".to_string()); + //~^ ERROR this associated function takes 0 generic arguments but 1 + //~| ERROR missing generics for +} diff --git a/src/test/ui/ufcs/ufcs-qpath-missing-params.stderr b/src/test/ui/ufcs/ufcs-qpath-missing-params.stderr new file mode 100644 index 000000000..a832964d2 --- /dev/null +++ b/src/test/ui/ufcs/ufcs-qpath-missing-params.stderr @@ -0,0 +1,49 @@ +error[E0107]: missing generics for trait `IntoCow` + --> $DIR/ufcs-qpath-missing-params.rs:14:16 + | +LL | <String as IntoCow>::into_cow("foo".to_string()); + | ^^^^^^^ expected 1 generic argument + | +note: trait defined here, with 1 generic parameter: `B` + --> $DIR/ufcs-qpath-missing-params.rs:3:11 + | +LL | pub trait IntoCow<'a, B: ?Sized> where B: ToOwned { + | ^^^^^^^ - +help: add missing generic argument + | +LL | <String as IntoCow<B>>::into_cow("foo".to_string()); + | ~~~~~~~~~~ + +error[E0107]: missing generics for trait `IntoCow` + --> $DIR/ufcs-qpath-missing-params.rs:17:16 + | +LL | <String as IntoCow>::into_cow::<str>("foo".to_string()); + | ^^^^^^^ expected 1 generic argument + | +note: trait defined here, with 1 generic parameter: `B` + --> $DIR/ufcs-qpath-missing-params.rs:3:11 + | +LL | pub trait IntoCow<'a, B: ?Sized> where B: ToOwned { + | ^^^^^^^ - +help: add missing generic argument + | +LL | <String as IntoCow<B>>::into_cow::<str>("foo".to_string()); + | ~~~~~~~~~~ + +error[E0107]: this associated function takes 0 generic arguments but 1 generic argument was supplied + --> $DIR/ufcs-qpath-missing-params.rs:17:26 + | +LL | <String as IntoCow>::into_cow::<str>("foo".to_string()); + | ^^^^^^^^------- help: remove these generics + | | + | expected 0 generic arguments + | +note: associated function defined here, with 0 generic parameters + --> $DIR/ufcs-qpath-missing-params.rs:4:8 + | +LL | fn into_cow(self) -> Cow<'a, B>; + | ^^^^^^^^ + +error: aborting due to 3 previous errors + +For more information about this error, try `rustc --explain E0107`. diff --git a/src/test/ui/ufcs/ufcs-qpath-self-mismatch.rs b/src/test/ui/ufcs/ufcs-qpath-self-mismatch.rs new file mode 100644 index 000000000..939b3c522 --- /dev/null +++ b/src/test/ui/ufcs/ufcs-qpath-self-mismatch.rs @@ -0,0 +1,10 @@ +use std::ops::Add; + +fn main() { + <i32 as Add<u32>>::add(1, 2); + //~^ ERROR cannot add `u32` to `i32` + <i32 as Add<i32>>::add(1u32, 2); + //~^ ERROR mismatched types + <i32 as Add<i32>>::add(1, 2u32); + //~^ ERROR mismatched types +} diff --git a/src/test/ui/ufcs/ufcs-qpath-self-mismatch.stderr b/src/test/ui/ufcs/ufcs-qpath-self-mismatch.stderr new file mode 100644 index 000000000..c6f9b3661 --- /dev/null +++ b/src/test/ui/ufcs/ufcs-qpath-self-mismatch.stderr @@ -0,0 +1,58 @@ +error[E0277]: cannot add `u32` to `i32` + --> $DIR/ufcs-qpath-self-mismatch.rs:4:5 + | +LL | <i32 as Add<u32>>::add(1, 2); + | ^^^^^^^^^^^^^^^^^^^^^^ no implementation for `i32 + u32` + | + = help: the trait `Add<u32>` is not implemented for `i32` + = help: the following other types implement trait `Add<Rhs>`: + <&'a f32 as Add<f32>> + <&'a f64 as Add<f64>> + <&'a i128 as Add<i128>> + <&'a i16 as Add<i16>> + <&'a i32 as Add<i32>> + <&'a i64 as Add<i64>> + <&'a i8 as Add<i8>> + <&'a isize as Add<isize>> + and 48 others + +error[E0308]: mismatched types + --> $DIR/ufcs-qpath-self-mismatch.rs:6:28 + | +LL | <i32 as Add<i32>>::add(1u32, 2); + | ---------------------- ^^^^ expected `i32`, found `u32` + | | + | arguments to this function are incorrect + | +note: associated function defined here + --> $SRC_DIR/core/src/ops/arith.rs:LL:COL + | +LL | fn add(self, rhs: Rhs) -> Self::Output; + | ^^^ +help: change the type of the numeric literal from `u32` to `i32` + | +LL | <i32 as Add<i32>>::add(1i32, 2); + | ~~~ + +error[E0308]: mismatched types + --> $DIR/ufcs-qpath-self-mismatch.rs:8:31 + | +LL | <i32 as Add<i32>>::add(1, 2u32); + | ---------------------- ^^^^ expected `i32`, found `u32` + | | + | arguments to this function are incorrect + | +note: associated function defined here + --> $SRC_DIR/core/src/ops/arith.rs:LL:COL + | +LL | fn add(self, rhs: Rhs) -> Self::Output; + | ^^^ +help: change the type of the numeric literal from `u32` to `i32` + | +LL | <i32 as Add<i32>>::add(1, 2i32); + | ~~~ + +error: aborting due to 3 previous errors + +Some errors have detailed explanations: E0277, E0308. +For more information about an error, try `rustc --explain E0277`. |