From 64d98f8ee037282c35007b64c2649055c56af1db Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Wed, 17 Apr 2024 14:19:03 +0200 Subject: Merging upstream version 1.68.2+dfsg1. Signed-off-by: Daniel Baumann --- tests/ui/ufcs/ufcs-explicit-self-bad.rs | 59 +++++++ tests/ui/ufcs/ufcs-explicit-self-bad.stderr | 107 ++++++++++++ tests/ui/ufcs/ufcs-partially-resolved.rs | 56 ++++++ tests/ui/ufcs/ufcs-partially-resolved.stderr | 230 +++++++++++++++++++++++++ tests/ui/ufcs/ufcs-qpath-missing-params.rs | 20 +++ tests/ui/ufcs/ufcs-qpath-missing-params.stderr | 49 ++++++ tests/ui/ufcs/ufcs-qpath-self-mismatch.rs | 11 ++ tests/ui/ufcs/ufcs-qpath-self-mismatch.stderr | 76 ++++++++ 8 files changed, 608 insertions(+) create mode 100644 tests/ui/ufcs/ufcs-explicit-self-bad.rs create mode 100644 tests/ui/ufcs/ufcs-explicit-self-bad.stderr create mode 100644 tests/ui/ufcs/ufcs-partially-resolved.rs create mode 100644 tests/ui/ufcs/ufcs-partially-resolved.stderr create mode 100644 tests/ui/ufcs/ufcs-qpath-missing-params.rs create mode 100644 tests/ui/ufcs/ufcs-qpath-missing-params.stderr create mode 100644 tests/ui/ufcs/ufcs-qpath-self-mismatch.rs create mode 100644 tests/ui/ufcs/ufcs-qpath-self-mismatch.stderr (limited to 'tests/ui/ufcs') diff --git a/tests/ui/ufcs/ufcs-explicit-self-bad.rs b/tests/ui/ufcs/ufcs-explicit-self-bad.rs new file mode 100644 index 000000000..cb1fac0ba --- /dev/null +++ b/tests/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 { + f: T, +} + +impl Bar { + fn foo(self: Bar, x: isize) -> isize { + //~^ ERROR invalid `self` parameter type + x + } + fn bar(self: &Bar, 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 { + fn dummy1(self: &&'a Bar) { } + fn dummy2(self: &Bar) {} //~ ERROR mismatched `self` parameter type + //~^ ERROR mismatched `self` parameter type + fn dummy3(self: &&Bar) {} + //~^ ERROR mismatched `self` parameter type + //~| expected reference `&'a Bar` + //~| found reference `&Bar` + //~| lifetime mismatch + //~| ERROR mismatched `self` parameter type + //~| expected reference `&'a Bar` + //~| found reference `&Bar` + //~| 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/tests/ui/ufcs/ufcs-explicit-self-bad.stderr b/tests/ui/ufcs/ufcs-explicit-self-bad.stderr new file mode 100644 index 000000000..f325d1d81 --- /dev/null +++ b/tests/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: Rc`, `self: Arc`, or `self: Pin

` (where P is one of the previous types except `Self`) + +error[E0307]: invalid `self` parameter type: Bar + --> $DIR/ufcs-explicit-self-bad.rs:19:18 + | +LL | fn foo(self: Bar, 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: Rc`, `self: Arc`, or `self: Pin

` (where P is one of the previous types except `Self`) + +error[E0307]: invalid `self` parameter type: &Bar + --> $DIR/ufcs-explicit-self-bad.rs:23:18 + | +LL | fn bar(self: &Bar, 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: Rc`, `self: Arc`, or `self: Pin

` (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) {} + | ^^^^^^^ lifetime mismatch + | + = note: expected reference `&'a Bar` + found reference `&Bar` +note: the anonymous lifetime defined here... + --> $DIR/ufcs-explicit-self-bad.rs:37:21 + | +LL | fn dummy2(self: &Bar) {} + | ^^^^^^^ +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 { + | ^^ + +error[E0308]: mismatched `self` parameter type + --> $DIR/ufcs-explicit-self-bad.rs:37:21 + | +LL | fn dummy2(self: &Bar) {} + | ^^^^^^^ lifetime mismatch + | + = note: expected reference `&'a Bar` + found reference `&Bar` +note: the lifetime `'a` as defined here... + --> $DIR/ufcs-explicit-self-bad.rs:35:6 + | +LL | impl<'a, T> SomeTrait for &'a Bar { + | ^^ +note: ...does not necessarily outlive the anonymous lifetime defined here + --> $DIR/ufcs-explicit-self-bad.rs:37:21 + | +LL | fn dummy2(self: &Bar) {} + | ^^^^^^^ + +error[E0308]: mismatched `self` parameter type + --> $DIR/ufcs-explicit-self-bad.rs:39:21 + | +LL | fn dummy3(self: &&Bar) {} + | ^^^^^^^^ lifetime mismatch + | + = note: expected reference `&'a Bar` + found reference `&Bar` +note: the anonymous lifetime defined here... + --> $DIR/ufcs-explicit-self-bad.rs:39:22 + | +LL | fn dummy3(self: &&Bar) {} + | ^^^^^^^ +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 { + | ^^ + +error[E0308]: mismatched `self` parameter type + --> $DIR/ufcs-explicit-self-bad.rs:39:21 + | +LL | fn dummy3(self: &&Bar) {} + | ^^^^^^^^ lifetime mismatch + | + = note: expected reference `&'a Bar` + found reference `&Bar` +note: the lifetime `'a` as defined here... + --> $DIR/ufcs-explicit-self-bad.rs:35:6 + | +LL | impl<'a, T> SomeTrait for &'a Bar { + | ^^ +note: ...does not necessarily outlive the anonymous lifetime defined here + --> $DIR/ufcs-explicit-self-bad.rs:39:22 + | +LL | fn dummy3(self: &&Bar) {} + | ^^^^^^^ + +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/tests/ui/ufcs/ufcs-partially-resolved.rs b/tests/ui/ufcs/ufcs-partially-resolved.rs new file mode 100644 index 000000000..e6470aa6d --- /dev/null +++ b/tests/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 _: ::N; //~ ERROR cannot find associated type `N` in trait `Tr` + let _: ::N; //~ ERROR cannot find associated type `N` in enum `E` + let _: ::N; //~ ERROR cannot find associated type `N` in `A` + ::N; //~ ERROR cannot find method or associated constant `N` in trait `Tr` + ::N; //~ ERROR cannot find method or associated constant `N` in enum `E` + ::N; //~ ERROR cannot find method or associated constant `N` in `A` + let _: ::Y; // OK + let _: ::Y; //~ ERROR expected associated type, found variant `E::Y` + ::Y; // OK + ::Y; //~ ERROR expected method or associated constant, found unit variant `E::Y` + + let _: ::N::NN; //~ ERROR cannot find associated type `N` in trait `Tr` + let _: ::N::NN; //~ ERROR cannot find associated type `N` in enum `E` + let _: ::N::NN; //~ ERROR cannot find associated type `N` in `A` + ::N::NN; //~ ERROR cannot find associated type `N` in trait `Tr` + ::N::NN; //~ ERROR cannot find associated type `N` in enum `E` + ::N::NN; //~ ERROR cannot find associated type `N` in `A` + let _: ::Y::NN; //~ ERROR ambiguous associated type + let _: ::Y::NN; //~ ERROR expected associated type, found variant `E::Y` + ::Y::NN; //~ ERROR no associated item named `NN` found for type `u16` + ::Y::NN; //~ ERROR expected associated type, found variant `E::Y` + + let _: ::NN; //~ ERROR cannot find associated type `NN` in `Tr::N` + let _: ::NN; //~ ERROR cannot find associated type `NN` in `E::N` + let _: ::NN; //~ ERROR cannot find associated type `NN` in `A::N` + ::NN; //~ ERROR cannot find method or associated constant `NN` in `Tr::N` + ::NN; //~ ERROR cannot find method or associated constant `NN` in `E::N` + ::NN; //~ ERROR cannot find method or associated constant `NN` in `A::N` + let _: ::NN; //~ ERROR cannot find associated type `NN` in `Tr::Y` + let _: ::NN; //~ ERROR failed to resolve: `Y` is a variant, not a module + ::NN; //~ ERROR cannot find method or associated constant `NN` in `Tr::Y` + ::NN; //~ ERROR failed to resolve: `Y` is a variant, not a module + + let _: ::Z; //~ ERROR expected associated type, found associated function `Dr::Z` + ::X; //~ ERROR expected method or associated constant, found associated type `Dr::X` + let _: ::Z::N; //~ ERROR expected associated type, found associated function `Dr::Z` + ::X::N; //~ ERROR no associated item named `N` found for type `u16` +} diff --git a/tests/ui/ufcs/ufcs-partially-resolved.stderr b/tests/ui/ufcs/ufcs-partially-resolved.stderr new file mode 100644 index 000000000..72fccea8a --- /dev/null +++ b/tests/ui/ufcs/ufcs-partially-resolved.stderr @@ -0,0 +1,230 @@ +error[E0433]: failed to resolve: `Y` is a variant, not a module + --> $DIR/ufcs-partially-resolved.rs:48:22 + | +LL | let _: ::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 | ::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 _: ::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 _: ::N; + | ^ not found in `E` + +error[E0576]: cannot find associated type `N` in `A` + --> $DIR/ufcs-partially-resolved.rs:21:23 + | +LL | let _: ::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 | ::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 | ::N; + | ^ not found in `E` + +error[E0576]: cannot find method or associated constant `N` in `A` + --> $DIR/ufcs-partially-resolved.rs:24:16 + | +LL | ::N; + | ^ not found in `A` + +error[E0575]: expected associated type, found variant `E::Y` + --> $DIR/ufcs-partially-resolved.rs:26:12 + | +LL | let _: ::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 | ::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 _: ::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 _: ::N::NN; + | ^ not found in `E` + +error[E0576]: cannot find associated type `N` in `A` + --> $DIR/ufcs-partially-resolved.rs:32:23 + | +LL | let _: ::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 | ::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 | ::N::NN; + | ^ not found in `E` + +error[E0576]: cannot find associated type `N` in `A` + --> $DIR/ufcs-partially-resolved.rs:35:16 + | +LL | ::N::NN; + | ^ not found in `A` + +error[E0575]: expected associated type, found variant `E::Y` + --> $DIR/ufcs-partially-resolved.rs:37:12 + | +LL | let _: ::Y::NN; + | ^^^^^^^^^^^^^^^^ not a associated type + +error[E0575]: expected associated type, found variant `E::Y` + --> $DIR/ufcs-partially-resolved.rs:39:5 + | +LL | ::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 _: ::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 _: ::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 _: ::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 | ::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 | ::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 | ::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 _: ::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 | ::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 _: ::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 | ::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 _: ::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 _: ::Y::NN; + | ^^^^^^^^^^^^^^^^^ + | +help: if there were a trait named `Example` with associated type `NN` implemented for `::Y`, you could use the fully-qualified path + | +LL | let _: <::Y as Example>::NN; + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +error[E0599]: no associated item named `NN` found for type `u16` in the current scope + --> $DIR/ufcs-partially-resolved.rs:38:20 + | +LL | ::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 | ::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/tests/ui/ufcs/ufcs-qpath-missing-params.rs b/tests/ui/ufcs/ufcs-qpath-missing-params.rs new file mode 100644 index 000000000..766351634 --- /dev/null +++ b/tests/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() { + ::into_cow("foo".to_string()); + //~^ ERROR missing generics for + + ::into_cow::("foo".to_string()); + //~^ ERROR this associated function takes 0 generic arguments but 1 + //~| ERROR missing generics for +} diff --git a/tests/ui/ufcs/ufcs-qpath-missing-params.stderr b/tests/ui/ufcs/ufcs-qpath-missing-params.stderr new file mode 100644 index 000000000..d0ec47d61 --- /dev/null +++ b/tests/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 | ::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 | >::into_cow("foo".to_string()); + | +++ + +error[E0107]: missing generics for trait `IntoCow` + --> $DIR/ufcs-qpath-missing-params.rs:17:16 + | +LL | ::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 | >::into_cow::("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 | ::into_cow::("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/tests/ui/ufcs/ufcs-qpath-self-mismatch.rs b/tests/ui/ufcs/ufcs-qpath-self-mismatch.rs new file mode 100644 index 000000000..ec86213f8 --- /dev/null +++ b/tests/ui/ufcs/ufcs-qpath-self-mismatch.rs @@ -0,0 +1,11 @@ +use std::ops::Add; + +fn main() { + >::add(1, 2); + //~^ ERROR cannot add `u32` to `i32` + //~| ERROR cannot add `u32` to `i32` + >::add(1u32, 2); + //~^ ERROR mismatched types + >::add(1, 2u32); + //~^ ERROR mismatched types +} diff --git a/tests/ui/ufcs/ufcs-qpath-self-mismatch.stderr b/tests/ui/ufcs/ufcs-qpath-self-mismatch.stderr new file mode 100644 index 000000000..e85144a31 --- /dev/null +++ b/tests/ui/ufcs/ufcs-qpath-self-mismatch.stderr @@ -0,0 +1,76 @@ +error[E0277]: cannot add `u32` to `i32` + --> $DIR/ufcs-qpath-self-mismatch.rs:4:31 + | +LL | >::add(1, 2); + | ---------------------- ^ no implementation for `i32 + u32` + | | + | required by a bound introduced by this call + | + = help: the trait `Add` is not implemented for `i32` + = help: the following other types implement trait `Add`: + <&'a i32 as Add> + <&i32 as Add<&i32>> + > + + +error[E0308]: mismatched types + --> $DIR/ufcs-qpath-self-mismatch.rs:7:28 + | +LL | >::add(1u32, 2); + | ---------------------- ^^^^ expected `i32`, found `u32` + | | + | arguments to this function are incorrect + | +help: the return type of this call is `u32` due to the type of the argument passed + --> $DIR/ufcs-qpath-self-mismatch.rs:7:5 + | +LL | >::add(1u32, 2); + | ^^^^^^^^^^^^^^^^^^^^^^^----^^^^ + | | + | this argument influences the return type of `Add` +note: associated function defined here + --> $SRC_DIR/core/src/ops/arith.rs:LL:COL +help: change the type of the numeric literal from `u32` to `i32` + | +LL | >::add(1i32, 2); + | ~~~ + +error[E0308]: mismatched types + --> $DIR/ufcs-qpath-self-mismatch.rs:9:31 + | +LL | >::add(1, 2u32); + | ---------------------- ^^^^ expected `i32`, found `u32` + | | + | arguments to this function are incorrect + | +help: the return type of this call is `u32` due to the type of the argument passed + --> $DIR/ufcs-qpath-self-mismatch.rs:9:5 + | +LL | >::add(1, 2u32); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^----^ + | | + | this argument influences the return type of `Add` +note: associated function defined here + --> $SRC_DIR/core/src/ops/arith.rs:LL:COL +help: change the type of the numeric literal from `u32` to `i32` + | +LL | >::add(1, 2i32); + | ~~~ + +error[E0277]: cannot add `u32` to `i32` + --> $DIR/ufcs-qpath-self-mismatch.rs:4:5 + | +LL | >::add(1, 2); + | ^^^^^^^^^^^^^^^^^^^^^^ no implementation for `i32 + u32` + | + = help: the trait `Add` is not implemented for `i32` + = help: the following other types implement trait `Add`: + <&'a i32 as Add> + <&i32 as Add<&i32>> + > + + +error: aborting due to 4 previous errors + +Some errors have detailed explanations: E0277, E0308. +For more information about an error, try `rustc --explain E0277`. -- cgit v1.2.3