diff options
Diffstat (limited to 'src/test')
57 files changed, 338 insertions, 147 deletions
diff --git a/src/test/rustdoc-gui/escape-key.goml b/src/test/rustdoc-gui/escape-key.goml index 78e9f23093e..5d80d24969d 100644 --- a/src/test/rustdoc-gui/escape-key.goml +++ b/src/test/rustdoc-gui/escape-key.goml @@ -5,7 +5,7 @@ goto: "file://" + |DOC_PATH| + "/test_docs/index.html" write: (".search-input", "test") // To be SURE that the search will be run. press-key: 'Enter' -wait-for: "#search h1" // The search element is empty before the first search +wait-for: "#search h1" // The search element is empty before the first search // Check that the currently displayed element is search. wait-for: "#alternative-display #search" assert-attribute: ("#main-content", {"class": "content hidden"}) diff --git a/src/test/rustdoc-gui/impl-doc.goml b/src/test/rustdoc-gui/impl-doc.goml index 7322032b3f5..6caffb9c39f 100644 --- a/src/test/rustdoc-gui/impl-doc.goml +++ b/src/test/rustdoc-gui/impl-doc.goml @@ -3,7 +3,7 @@ goto: "file://" + |DOC_PATH| + "/test_docs/struct.TypeWithImplDoc.html" // The text is about 24px tall, so if there's a margin, then their position will be >24px apart compare-elements-position-near-false: ( - "#implementations-list > .implementors-toggle > .docblock > p", - "#implementations-list > .implementors-toggle > .impl-items", - {"y": 24} + "#implementations-list > .implementors-toggle > .docblock > p", + "#implementations-list > .implementors-toggle > .impl-items", + {"y": 24} ) diff --git a/src/test/rustdoc-gui/mobile.goml b/src/test/rustdoc-gui/mobile.goml index 704542a39d2..895864d8944 100644 --- a/src/test/rustdoc-gui/mobile.goml +++ b/src/test/rustdoc-gui/mobile.goml @@ -27,4 +27,8 @@ assert-css-false: (".content .out-of-band .since::before", { "content": "\"Since goto: "file://" + |DOC_PATH| + "/settings.html" size: (400, 600) // Ignored for now https://github.com/rust-lang/rust/issues/93784. -// compare-elements-position-near-false: ("#preferred-light-theme .setting-name", "#preferred-light-theme .choice", {"y": 16}) +// compare-elements-position-near-false: ( +// "#preferred-light-theme .setting-name", +// "#preferred-light-theme .choice", +// {"y": 16}, +// ) diff --git a/src/test/rustdoc-gui/rust-logo.goml b/src/test/rustdoc-gui/rust-logo.goml index e94dc9a964d..2d15e8b9699 100644 --- a/src/test/rustdoc-gui/rust-logo.goml +++ b/src/test/rustdoc-gui/rust-logo.goml @@ -31,13 +31,28 @@ define-function: ( call-function: ( "check-logo", - ("ayu", "drop-shadow(rgb(255, 255, 255) 1px 0px 0px) drop-shadow(rgb(255, 255, 255) 0px 1px 0px) drop-shadow(rgb(255, 255, 255) -1px 0px 0px) drop-shadow(rgb(255, 255, 255) 0px -1px 0px)"), + { + "theme": "ayu", + "filter": "drop-shadow(rgb(255, 255, 255) 1px 0px 0px) " + + "drop-shadow(rgb(255, 255, 255) 0px 1px 0px) " + + "drop-shadow(rgb(255, 255, 255) -1px 0px 0px) " + + "drop-shadow(rgb(255, 255, 255) 0px -1px 0px)", + }, ) call-function: ( "check-logo", - ("dark", "drop-shadow(rgb(255, 255, 255) 1px 0px 0px) drop-shadow(rgb(255, 255, 255) 0px 1px 0px) drop-shadow(rgb(255, 255, 255) -1px 0px 0px) drop-shadow(rgb(255, 255, 255) 0px -1px 0px)"), + { + "theme": "dark", + "filter": "drop-shadow(rgb(255, 255, 255) 1px 0px 0px) " + + "drop-shadow(rgb(255, 255, 255) 0px 1px 0px) " + + "drop-shadow(rgb(255, 255, 255) -1px 0px 0px) " + + "drop-shadow(rgb(255, 255, 255) 0px -1px 0px)", + }, ) call-function: ( "check-logo", - ("light", "none"), + { + "theme": "light", + "filter": "none", + }, ) diff --git a/src/test/rustdoc-gui/scrape-examples-button-focus.goml b/src/test/rustdoc-gui/scrape-examples-button-focus.goml index bba518db099..10651a3f669 100644 --- a/src/test/rustdoc-gui/scrape-examples-button-focus.goml +++ b/src/test/rustdoc-gui/scrape-examples-button-focus.goml @@ -5,25 +5,25 @@ store-property: (initialScrollTop, ".scraped-example-list > .scraped-example pre focus: ".scraped-example-list > .scraped-example .next" press-key: "Enter" assert-property-false: (".scraped-example-list > .scraped-example pre", { - "scrollTop": |initialScrollTop| + "scrollTop": |initialScrollTop| }) focus: ".scraped-example-list > .scraped-example .prev" press-key: "Enter" assert-property: (".scraped-example-list > .scraped-example pre", { - "scrollTop": |initialScrollTop| + "scrollTop": |initialScrollTop| }) // The expand button increases the scrollHeight of the minimized code viewport store-property: (smallOffsetHeight, ".scraped-example-list > .scraped-example pre", "offsetHeight") assert-property-false: (".scraped-example-list > .scraped-example pre", { - "scrollHeight": |smallOffsetHeight| + "scrollHeight": |smallOffsetHeight| }) focus: ".scraped-example-list > .scraped-example .expand" press-key: "Enter" assert-property-false: (".scraped-example-list > .scraped-example pre", { - "offsetHeight": |smallOffsetHeight| + "offsetHeight": |smallOffsetHeight| }) store-property: (fullOffsetHeight, ".scraped-example-list > .scraped-example pre", "offsetHeight") assert-property: (".scraped-example-list > .scraped-example pre", { - "scrollHeight": |fullOffsetHeight| + "scrollHeight": |fullOffsetHeight| }) diff --git a/src/test/rustdoc-gui/sidebar.goml b/src/test/rustdoc-gui/sidebar.goml index 9db7f59695b..9c742be0587 100644 --- a/src/test/rustdoc-gui/sidebar.goml +++ b/src/test/rustdoc-gui/sidebar.goml @@ -148,4 +148,4 @@ assert-text: ("#toggle-all-docs", "[+]") assert-property: (".sidebar", {"clientWidth": "200"}) click: "#toggle-all-docs" assert-text: ("#toggle-all-docs", "[−]") -assert-property: (".sidebar", {"clientWidth": "200"}) \ No newline at end of file +assert-property: (".sidebar", {"clientWidth": "200"}) diff --git a/src/test/rustdoc-gui/type-declation-overflow.goml b/src/test/rustdoc-gui/type-declation-overflow.goml index c014eb52e71..9b60bc04738 100644 --- a/src/test/rustdoc-gui/type-declation-overflow.goml +++ b/src/test/rustdoc-gui/type-declation-overflow.goml @@ -1,3 +1,4 @@ +// ignore-tidy-linelength // This test ensures that the items declaration content overflow is handled inside the <pre> directly. // We need to disable this check because diff --git a/src/test/ui/associated-types/defaults-specialization.stderr b/src/test/ui/associated-types/defaults-specialization.stderr index 8df326351fa..7e21f7fc306 100644 --- a/src/test/ui/associated-types/defaults-specialization.stderr +++ b/src/test/ui/associated-types/defaults-specialization.stderr @@ -22,8 +22,8 @@ note: type in trait | LL | fn make() -> Self::Ty { | ^^^^^^^^ - = note: expected fn pointer `fn() -> <A<T> as Tr>::Ty` - found fn pointer `fn() -> u8` + = note: expected signature `fn() -> <A<T> as Tr>::Ty` + found signature `fn() -> u8` error[E0053]: method `make` has an incompatible type for trait --> $DIR/defaults-specialization.rs:35:18 @@ -42,8 +42,8 @@ note: type in trait | LL | fn make() -> Self::Ty { | ^^^^^^^^ - = note: expected fn pointer `fn() -> <B<T> as Tr>::Ty` - found fn pointer `fn() -> bool` + = note: expected signature `fn() -> <B<T> as Tr>::Ty` + found signature `fn() -> bool` error[E0308]: mismatched types --> $DIR/defaults-specialization.rs:10:9 diff --git a/src/test/ui/async-await/in-trait/async-example-desugared-boxed-in-trait.stderr b/src/test/ui/async-await/in-trait/async-example-desugared-boxed-in-trait.stderr index 22d2928f2f5..13e7222551a 100644 --- a/src/test/ui/async-await/in-trait/async-example-desugared-boxed-in-trait.stderr +++ b/src/test/ui/async-await/in-trait/async-example-desugared-boxed-in-trait.stderr @@ -9,8 +9,8 @@ note: type in trait | LL | fn foo(&self) -> Pin<Box<dyn Future<Output = i32> + '_>>; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - = note: expected fn pointer `fn(&i32) -> Pin<Box<dyn Future<Output = i32>>>` - found fn pointer `fn(&i32) -> impl Future<Output = i32>` + = note: expected signature `fn(&i32) -> Pin<Box<dyn Future<Output = i32>>>` + found signature `fn(&i32) -> impl Future<Output = i32>` error: aborting due to previous error diff --git a/src/test/ui/borrowck/regions-bound-missing-bound-in-impl.stderr b/src/test/ui/borrowck/regions-bound-missing-bound-in-impl.stderr index 1e3b071ef92..930fea9158d 100644 --- a/src/test/ui/borrowck/regions-bound-missing-bound-in-impl.stderr +++ b/src/test/ui/borrowck/regions-bound-missing-bound-in-impl.stderr @@ -22,8 +22,8 @@ error[E0308]: method not compatible with trait LL | fn wrong_bound1<'b,'c,'d:'a+'c>(self, b: Inv<'b>, c: Inv<'c>, d: Inv<'d>) { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ lifetime mismatch | - = note: expected fn pointer `fn(&'a isize, Inv<'c>, Inv<'c>, Inv<'_>)` - found fn pointer `fn(&'a isize, Inv<'_>, Inv<'c>, Inv<'_>)` + = note: expected signature `fn(&'a isize, Inv<'c>, Inv<'c>, Inv<'_>)` + found signature `fn(&'a isize, Inv<'_>, Inv<'c>, Inv<'_>)` note: the lifetime `'c` as defined here... --> $DIR/regions-bound-missing-bound-in-impl.rs:27:24 | @@ -41,8 +41,8 @@ error[E0308]: method not compatible with trait LL | fn wrong_bound1<'b,'c,'d:'a+'c>(self, b: Inv<'b>, c: Inv<'c>, d: Inv<'d>) { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ lifetime mismatch | - = note: expected fn pointer `fn(&'a isize, Inv<'c>, Inv<'c>, Inv<'_>)` - found fn pointer `fn(&'a isize, Inv<'_>, Inv<'c>, Inv<'_>)` + = note: expected signature `fn(&'a isize, Inv<'c>, Inv<'c>, Inv<'_>)` + found signature `fn(&'a isize, Inv<'_>, Inv<'c>, Inv<'_>)` note: the lifetime `'c` as defined here... --> $DIR/regions-bound-missing-bound-in-impl.rs:27:24 | diff --git a/src/test/ui/compare-method/bad-self-type.stderr b/src/test/ui/compare-method/bad-self-type.stderr index 90e907157a5..cad942e646e 100644 --- a/src/test/ui/compare-method/bad-self-type.stderr +++ b/src/test/ui/compare-method/bad-self-type.stderr @@ -7,8 +7,8 @@ LL | fn poll(self, _: &mut Context<'_>) -> Poll<()> { | expected struct `Pin`, found struct `MyFuture` | help: change the self-receiver type to match the trait: `self: Pin<&mut MyFuture>` | - = note: expected fn pointer `fn(Pin<&mut MyFuture>, &mut Context<'_>) -> Poll<_>` - found fn pointer `fn(MyFuture, &mut Context<'_>) -> Poll<_>` + = note: expected signature `fn(Pin<&mut MyFuture>, &mut Context<'_>) -> Poll<_>` + found signature `fn(MyFuture, &mut Context<'_>) -> Poll<_>` error[E0053]: method `foo` has an incompatible type for trait --> $DIR/bad-self-type.rs:22:18 @@ -24,8 +24,8 @@ note: type in trait | LL | fn foo(self); | ^^^^ - = note: expected fn pointer `fn(MyFuture)` - found fn pointer `fn(Box<MyFuture>)` + = note: expected signature `fn(MyFuture)` + found signature `fn(Box<MyFuture>)` error[E0053]: method `bar` has an incompatible type for trait --> $DIR/bad-self-type.rs:24:18 @@ -38,8 +38,8 @@ note: type in trait | LL | fn bar(self) -> Option<()>; | ^^^^^^^^^^ - = note: expected fn pointer `fn(MyFuture) -> Option<()>` - found fn pointer `fn(MyFuture)` + = note: expected signature `fn(MyFuture) -> Option<()>` + found signature `fn(MyFuture)` help: change the output type to match the trait | LL | fn bar(self) -> Option<()> {} diff --git a/src/test/ui/compare-method/issue-90444.stderr b/src/test/ui/compare-method/issue-90444.stderr index ee63f34b799..52e23d03b14 100644 --- a/src/test/ui/compare-method/issue-90444.stderr +++ b/src/test/ui/compare-method/issue-90444.stderr @@ -7,8 +7,8 @@ LL | fn from(_: fn((), (), &mut ())) -> Self { | types differ in mutability | help: change the parameter type to match the trait: `for<'a> fn((), (), &'a ())` | - = note: expected fn pointer `fn(for<'a> fn((), (), &'a ())) -> A` - found fn pointer `fn(for<'a> fn((), (), &'a mut ())) -> A` + = note: expected signature `fn(for<'a> fn((), (), &'a ())) -> A` + found signature `fn(for<'a> fn((), (), &'a mut ())) -> A` error[E0053]: method `from` has an incompatible type for trait --> $DIR/issue-90444.rs:11:16 @@ -19,8 +19,8 @@ LL | fn from(_: fn((), (), u64)) -> Self { | expected `u32`, found `u64` | help: change the parameter type to match the trait: `fn((), (), u32)` | - = note: expected fn pointer `fn(fn((), (), u32)) -> B` - found fn pointer `fn(fn((), (), u64)) -> B` + = note: expected signature `fn(fn((), (), u32)) -> B` + found signature `fn(fn((), (), u64)) -> B` error: aborting due to 2 previous errors diff --git a/src/test/ui/compare-method/reordered-type-param.stderr b/src/test/ui/compare-method/reordered-type-param.stderr index 49b5b1b92cd..1552d542d15 100644 --- a/src/test/ui/compare-method/reordered-type-param.stderr +++ b/src/test/ui/compare-method/reordered-type-param.stderr @@ -14,8 +14,8 @@ note: type in trait | LL | fn b<C:Clone,D>(&self, x: C) -> C; | ^ - = note: expected fn pointer `fn(&E, F) -> F` - found fn pointer `fn(&E, G) -> G` + = note: expected signature `fn(&E, F) -> F` + found signature `fn(&E, G) -> G` = note: a type parameter was expected, but a different one was found; you might be missing a type parameter or trait bound = note: for more information, visit https://doc.rust-lang.org/book/ch10-02-traits.html#traits-as-parameters diff --git a/src/test/ui/illegal-sized-bound/mutability-mismatch-arg.fixed b/src/test/ui/illegal-sized-bound/mutability-mismatch-arg.fixed new file mode 100644 index 00000000000..74f3c887f02 --- /dev/null +++ b/src/test/ui/illegal-sized-bound/mutability-mismatch-arg.fixed @@ -0,0 +1,9 @@ +// run-rustfix +fn test(t: &mut dyn Iterator<Item=&u64>) -> u64 { + *t.min().unwrap() //~ ERROR the `min` method cannot be invoked on +} + +fn main() { + let array = [0u64]; + test(&mut array.iter()); +} diff --git a/src/test/ui/illegal-sized-bound/mutability-mismatch-arg.rs b/src/test/ui/illegal-sized-bound/mutability-mismatch-arg.rs new file mode 100644 index 00000000000..3b02c5a5ad1 --- /dev/null +++ b/src/test/ui/illegal-sized-bound/mutability-mismatch-arg.rs @@ -0,0 +1,9 @@ +// run-rustfix +fn test(t: &dyn Iterator<Item=&u64>) -> u64 { + *t.min().unwrap() //~ ERROR the `min` method cannot be invoked on +} + +fn main() { + let array = [0u64]; + test(&mut array.iter()); +} diff --git a/src/test/ui/illegal-sized-bound/mutability-mismatch-arg.stderr b/src/test/ui/illegal-sized-bound/mutability-mismatch-arg.stderr new file mode 100644 index 00000000000..89613bd5c20 --- /dev/null +++ b/src/test/ui/illegal-sized-bound/mutability-mismatch-arg.stderr @@ -0,0 +1,13 @@ +error: the `min` method cannot be invoked on `&dyn Iterator<Item = &u64>` + --> $DIR/mutability-mismatch-arg.rs:3:9 + | +LL | *t.min().unwrap() + | ^^^ + | +help: you need `&mut dyn Iterator<Item = &u64>` instead of `&dyn Iterator<Item = &u64>` + | +LL | fn test(t: &mut dyn Iterator<Item=&u64>) -> u64 { + | +++ + +error: aborting due to previous error + diff --git a/src/test/ui/illegal-sized-bound/mutability-mismatch.rs b/src/test/ui/illegal-sized-bound/mutability-mismatch.rs index deb84f6fe97..01bb3537c2d 100644 --- a/src/test/ui/illegal-sized-bound/mutability-mismatch.rs +++ b/src/test/ui/illegal-sized-bound/mutability-mismatch.rs @@ -4,7 +4,6 @@ pub trait MutTrait { fn function(&mut self) where Self: Sized; - //~^ this has a `Sized` requirement } impl MutTrait for MutType { @@ -17,7 +16,6 @@ pub trait Trait { fn function(&self) where Self: Sized; - //~^ this has a `Sized` requirement } impl Trait for Type { @@ -26,9 +24,9 @@ impl Trait for Type { fn main() { (&MutType as &dyn MutTrait).function(); - //~^ ERROR the `function` method cannot be invoked on a trait object - //~| NOTE you need `&mut dyn MutTrait` instead of `&dyn MutTrait` + //~^ ERROR the `function` method cannot be invoked on `&dyn MutTrait` + //~| HELP you need `&mut dyn MutTrait` instead of `&dyn MutTrait` (&mut Type as &mut dyn Trait).function(); - //~^ ERROR the `function` method cannot be invoked on a trait object - //~| NOTE you need `&dyn Trait` instead of `&mut dyn Trait` + //~^ ERROR the `function` method cannot be invoked on `&mut dyn Trait` + //~| HELP you need `&dyn Trait` instead of `&mut dyn Trait` } diff --git a/src/test/ui/illegal-sized-bound/mutability-mismatch.stderr b/src/test/ui/illegal-sized-bound/mutability-mismatch.stderr index dbbf79a4f1a..2ca571d9b79 100644 --- a/src/test/ui/illegal-sized-bound/mutability-mismatch.stderr +++ b/src/test/ui/illegal-sized-bound/mutability-mismatch.stderr @@ -1,24 +1,18 @@ -error: the `function` method cannot be invoked on a trait object - --> $DIR/mutability-mismatch.rs:28:33 +error: the `function` method cannot be invoked on `&dyn MutTrait` + --> $DIR/mutability-mismatch.rs:26:33 | -LL | Self: Sized; - | ----- this has a `Sized` requirement -... LL | (&MutType as &dyn MutTrait).function(); | ^^^^^^^^ | - = note: you need `&mut dyn MutTrait` instead of `&dyn MutTrait` + = help: you need `&mut dyn MutTrait` instead of `&dyn MutTrait` -error: the `function` method cannot be invoked on a trait object - --> $DIR/mutability-mismatch.rs:31:35 +error: the `function` method cannot be invoked on `&mut dyn Trait` + --> $DIR/mutability-mismatch.rs:29:35 | -LL | Self: Sized; - | ----- this has a `Sized` requirement -... LL | (&mut Type as &mut dyn Trait).function(); | ^^^^^^^^ | - = note: you need `&dyn Trait` instead of `&mut dyn Trait` + = help: you need `&dyn Trait` instead of `&mut dyn Trait` error: aborting due to 2 previous errors diff --git a/src/test/ui/impl-trait/impl-generic-mismatch-ab.stderr b/src/test/ui/impl-trait/impl-generic-mismatch-ab.stderr index acf768d5795..db97fc2bdc4 100644 --- a/src/test/ui/impl-trait/impl-generic-mismatch-ab.stderr +++ b/src/test/ui/impl-trait/impl-generic-mismatch-ab.stderr @@ -13,8 +13,8 @@ note: type in trait | LL | fn foo<A: Debug>(&self, a: &A, b: &impl Debug); | ^^ - = note: expected fn pointer `fn(&(), &B, &impl Debug)` - found fn pointer `fn(&(), &impl Debug, &B)` + = note: expected signature `fn(&(), &B, &impl Debug)` + found signature `fn(&(), &impl Debug, &B)` = note: a type parameter was expected, but a different one was found; you might be missing a type parameter or trait bound = note: for more information, visit https://doc.rust-lang.org/book/ch10-02-traits.html#traits-as-parameters diff --git a/src/test/ui/impl-trait/in-trait/method-signature-matches.stderr b/src/test/ui/impl-trait/in-trait/method-signature-matches.stderr index 2b32c52c829..4dfd772222e 100644 --- a/src/test/ui/impl-trait/in-trait/method-signature-matches.stderr +++ b/src/test/ui/impl-trait/in-trait/method-signature-matches.stderr @@ -12,8 +12,8 @@ note: type in trait | LL | fn owo(x: ()) -> impl Sized; | ^^ - = note: expected fn pointer `fn(())` - found fn pointer `fn(u8)` + = note: expected signature `fn(())` + found signature `fn(u8)` error[E0053]: method `owo` has an incompatible type for trait --> $DIR/method-signature-matches.rs:20:21 @@ -39,8 +39,8 @@ note: type in trait | LL | async fn owo(x: ()) {} | ^^ - = note: expected fn pointer `fn(()) -> _` - found fn pointer `fn(u8) -> _` + = note: expected signature `fn(()) -> _` + found signature `fn(u8) -> _` error[E0050]: method `calm_down_please` has 3 parameters but the declaration in trait `TooMuch::calm_down_please` has 0 --> $DIR/method-signature-matches.rs:29:28 @@ -75,8 +75,8 @@ note: type in trait | LL | fn early<'early, T>(x: &'early T) -> impl Sized; | ^^^^^^^^^ - = note: expected fn pointer `fn(&'early T)` - found fn pointer `fn(&())` + = note: expected signature `fn(&'early T)` + found signature `fn(&())` error: aborting due to 5 previous errors diff --git a/src/test/ui/impl-trait/in-trait/signature-mismatch.stderr b/src/test/ui/impl-trait/in-trait/signature-mismatch.stderr index 6663d7faa1e..e105660173b 100644 --- a/src/test/ui/impl-trait/in-trait/signature-mismatch.stderr +++ b/src/test/ui/impl-trait/in-trait/signature-mismatch.stderr @@ -7,8 +7,8 @@ LL | fn async_fn(&self, buff: &[u8]) -> impl Future<Output = Vec<u8>>; LL | fn async_fn<'a>(&self, buff: &'a [u8]) -> impl Future<Output = Vec<u8>> + 'a { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ found `fn(&'1 Struct, &'2 [u8]) -> impl Future<Output = Vec<u8>> + '2` | - = note: expected `fn(&'1 Struct, &'2 [u8]) -> impl Future<Output = Vec<u8>> + 'static` - found `fn(&'1 Struct, &'2 [u8]) -> impl Future<Output = Vec<u8>> + '2` + = note: expected signature `fn(&'1 Struct, &'2 [u8]) -> impl Future<Output = Vec<u8>> + 'static` + found signature `fn(&'1 Struct, &'2 [u8]) -> impl Future<Output = Vec<u8>> + '2` = help: the lifetime requirements from the `impl` do not correspond to the requirements in the `trait` = help: verify the lifetime relationships in the `trait` and `impl` between the `self` argument, the other inputs and its output diff --git a/src/test/ui/impl-trait/in-trait/specialization-broken.stderr b/src/test/ui/impl-trait/in-trait/specialization-broken.stderr index a30e6346b29..37cfd74498d 100644 --- a/src/test/ui/impl-trait/in-trait/specialization-broken.stderr +++ b/src/test/ui/impl-trait/in-trait/specialization-broken.stderr @@ -15,8 +15,8 @@ note: type in trait | LL | fn bar(&self) -> impl Sized; | ^^^^^^^^^^ - = note: expected fn pointer `fn(&U) -> impl Sized` - found fn pointer `fn(&U) -> U` + = note: expected signature `fn(&U) -> impl Sized` + found signature `fn(&U) -> U` error: aborting due to previous error diff --git a/src/test/ui/impl-trait/recursive-type-alias-impl-trait-declaration-too-subtle.stderr b/src/test/ui/impl-trait/recursive-type-alias-impl-trait-declaration-too-subtle.stderr index 3ee26f74a78..c7c6ca44012 100644 --- a/src/test/ui/impl-trait/recursive-type-alias-impl-trait-declaration-too-subtle.stderr +++ b/src/test/ui/impl-trait/recursive-type-alias-impl-trait-declaration-too-subtle.stderr @@ -18,8 +18,8 @@ LL | fn eq(&self, _other: &(Foo, i32)) -> bool { | expected struct `Bar`, found opaque type | help: change the parameter type to match the trait: `&(a::Bar, i32)` | - = note: expected fn pointer `fn(&a::Bar, &(a::Bar, i32)) -> _` - found fn pointer `fn(&a::Bar, &(a::Foo, i32)) -> _` + = note: expected signature `fn(&a::Bar, &(a::Bar, i32)) -> _` + found signature `fn(&a::Bar, &(a::Foo, i32)) -> _` error: unconstrained opaque type --> $DIR/recursive-type-alias-impl-trait-declaration-too-subtle.rs:18:16 @@ -41,8 +41,8 @@ LL | fn eq(&self, _other: &(Bar, i32)) -> bool { | expected opaque type, found struct `Bar` | help: change the parameter type to match the trait: `&(b::Foo, i32)` | - = note: expected fn pointer `fn(&b::Bar, &(b::Foo, i32)) -> _` - found fn pointer `fn(&b::Bar, &(b::Bar, i32)) -> _` + = note: expected signature `fn(&b::Bar, &(b::Foo, i32)) -> _` + found signature `fn(&b::Bar, &(b::Bar, i32)) -> _` error: aborting due to 4 previous errors diff --git a/src/test/ui/impl-trait/trait_type.stderr b/src/test/ui/impl-trait/trait_type.stderr index bea24339837..81e4c933e53 100644 --- a/src/test/ui/impl-trait/trait_type.stderr +++ b/src/test/ui/impl-trait/trait_type.stderr @@ -7,8 +7,8 @@ LL | fn fmt(&self, x: &str) -> () { } | types differ in mutability | help: change the parameter type to match the trait: `&mut Formatter<'_>` | - = note: expected fn pointer `fn(&MyType, &mut Formatter<'_>) -> Result<(), std::fmt::Error>` - found fn pointer `fn(&MyType, &str)` + = note: expected signature `fn(&MyType, &mut Formatter<'_>) -> Result<(), std::fmt::Error>` + found signature `fn(&MyType, &str)` error[E0050]: method `fmt` has 1 parameter but the declaration in trait `std::fmt::Display::fmt` has 2 --> $DIR/trait_type.rs:12:11 diff --git a/src/test/ui/issues/issue-13033.rs b/src/test/ui/issues/issue-13033.rs index 7631831a81a..fdb356e70c5 100644 --- a/src/test/ui/issues/issue-13033.rs +++ b/src/test/ui/issues/issue-13033.rs @@ -7,8 +7,8 @@ struct Baz; impl Foo for Baz { fn bar(&mut self, other: &dyn Foo) {} //~^ ERROR method `bar` has an incompatible type for trait - //~| expected fn pointer `fn(&mut Baz, &mut dyn Foo)` - //~| found fn pointer `fn(&mut Baz, &dyn Foo)` + //~| expected signature `fn(&mut Baz, &mut dyn Foo)` + //~| found signature `fn(&mut Baz, &dyn Foo)` } fn main() {} diff --git a/src/test/ui/issues/issue-13033.stderr b/src/test/ui/issues/issue-13033.stderr index 72e549813e8..db2c1189e1e 100644 --- a/src/test/ui/issues/issue-13033.stderr +++ b/src/test/ui/issues/issue-13033.stderr @@ -12,8 +12,8 @@ note: type in trait | LL | fn bar(&mut self, other: &mut dyn Foo); | ^^^^^^^^^^^^ - = note: expected fn pointer `fn(&mut Baz, &mut dyn Foo)` - found fn pointer `fn(&mut Baz, &dyn Foo)` + = note: expected signature `fn(&mut Baz, &mut dyn Foo)` + found signature `fn(&mut Baz, &dyn Foo)` error: aborting due to previous error diff --git a/src/test/ui/issues/issue-15094.rs b/src/test/ui/issues/issue-15094.rs index 71b75a6e7e0..cb27e2bcfb6 100644 --- a/src/test/ui/issues/issue-15094.rs +++ b/src/test/ui/issues/issue-15094.rs @@ -10,8 +10,8 @@ impl<T: fmt::Debug> ops::FnOnce<(),> for Debuger<T> { type Output = (); fn call_once(self, _args: ()) { //~^ ERROR `call_once` has an incompatible type for trait - //~| expected fn pointer `extern "rust-call" fn - //~| found fn pointer `fn + //~| expected signature `extern "rust-call" fn + //~| found signature `fn println!("{:?}", self.x); } } diff --git a/src/test/ui/issues/issue-15094.stderr b/src/test/ui/issues/issue-15094.stderr index 2dcdaba170a..b7c950892dc 100644 --- a/src/test/ui/issues/issue-15094.stderr +++ b/src/test/ui/issues/issue-15094.stderr @@ -4,8 +4,8 @@ error[E0053]: method `call_once` has an incompatible type for trait LL | fn call_once(self, _args: ()) { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected "rust-call" fn, found "Rust" fn | - = note: expected fn pointer `extern "rust-call" fn(Debuger<_>, ())` - found fn pointer `fn(Debuger<_>, ())` + = note: expected signature `extern "rust-call" fn(Debuger<_>, ())` + found signature `fn(Debuger<_>, ())` error: aborting due to previous error diff --git a/src/test/ui/issues/issue-20225.stderr b/src/test/ui/issues/issue-20225.stderr index 6f4813ca623..5822160107c 100644 --- a/src/test/ui/issues/issue-20225.stderr +++ b/src/test/ui/issues/issue-20225.stderr @@ -9,8 +9,8 @@ LL | extern "rust-call" fn call(&self, (_,): (T,)) {} | expected `&T`, found type parameter `T` | help: change the parameter type to match the trait: `(&'a T,)` | - = note: expected fn pointer `extern "rust-call" fn(&Foo, (&'a T,))` - found fn pointer `extern "rust-call" fn(&Foo, (T,))` + = note: expected signature `extern "rust-call" fn(&Foo, (&'a T,))` + found signature `extern "rust-call" fn(&Foo, (T,))` error[E0053]: method `call_mut` has an incompatible type for trait --> $DIR/issue-20225.rs:11:51 @@ -23,8 +23,8 @@ LL | extern "rust-call" fn call_mut(&mut self, (_,): (T,)) {} | expected `&T`, found type parameter `T` | help: change the parameter type to match the trait: `(&'a T,)` | - = note: expected fn pointer `extern "rust-call" fn(&mut Foo, (&'a T,))` - found fn pointer `extern "rust-call" fn(&mut Foo, (T,))` + = note: expected signature `extern "rust-call" fn(&mut Foo, (&'a T,))` + found signature `extern "rust-call" fn(&mut Foo, (T,))` error[E0053]: method `call_once` has an incompatible type for trait --> $DIR/issue-20225.rs:18:47 @@ -38,8 +38,8 @@ LL | extern "rust-call" fn call_once(self, (_,): (T,)) {} | expected `&T`, found type parameter `T` | help: change the parameter type to match the trait: `(&'a T,)` | - = note: expected fn pointer `extern "rust-call" fn(Foo, (&'a T,))` - found fn pointer `extern "rust-call" fn(Foo, (T,))` + = note: expected signature `extern "rust-call" fn(Foo, (&'a T,))` + found signature `extern "rust-call" fn(Foo, (T,))` error: aborting due to 3 previous errors diff --git a/src/test/ui/issues/issue-21332.stderr b/src/test/ui/issues/issue-21332.stderr index d92966da17c..0e1beebf293 100644 --- a/src/test/ui/issues/issue-21332.stderr +++ b/src/test/ui/issues/issue-21332.stderr @@ -7,8 +7,8 @@ LL | fn next(&mut self) -> Result<i32, i32> { Ok(7) } | expected enum `Option`, found enum `Result` | help: change the output type to match the trait: `Option<i32>` | - = note: expected fn pointer `fn(&mut S) -> Option<i32>` - found fn pointer `fn(&mut S) -> Result<i32, i32>` + = note: expected signature `fn(&mut S) -> Option<i32>` + found signature `fn(&mut S) -> Result<i32, i32>` error: aborting due to previous error diff --git a/src/test/ui/issues/issue-25386.rs b/src/test/ui/issues/issue-25386.rs index a76d8a615f6..b26cc77680d 100644 --- a/src/test/ui/issues/issue-25386.rs +++ b/src/test/ui/issues/issue-25386.rs @@ -24,5 +24,4 @@ macro_rules! check_ptr_exist { fn main() { let item = stuff::Item::new(); println!("{}", check_ptr_exist!(item, name)); - //~^ ERROR field `name` of struct `CObj` is private } diff --git a/src/test/ui/issues/issue-25386.stderr b/src/test/ui/issues/issue-25386.stderr index bce269393ee..727b9690829 100644 --- a/src/test/ui/issues/issue-25386.stderr +++ b/src/test/ui/issues/issue-25386.stderr @@ -9,12 +9,6 @@ LL | println!("{}", check_ptr_exist!(item, name)); | = note: this error originates in the macro `check_ptr_exist` (in Nightly builds, run with -Z macro-backtrace for more info) -error[E0616]: field `name` of struct `CObj` is private - --> $DIR/issue-25386.rs:26:43 - | -LL | println!("{}", check_ptr_exist!(item, name)); - | ^^^^ private field - -error: aborting due to 2 previous errors +error: aborting due to previous error For more information about this error, try `rustc --explain E0616`. diff --git a/src/test/ui/issues/issue-37884.stderr b/src/test/ui/issues/issue-37884.stderr index e9f50b41f6a..7ddb36c8e6f 100644 --- a/src/test/ui/issues/issue-37884.stderr +++ b/src/test/ui/issues/issue-37884.stderr @@ -4,8 +4,8 @@ error[E0308]: method not compatible with trait LL | fn next(&'a mut self) -> Option<Self::Item> | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ lifetime mismatch | - = note: expected fn pointer `fn(&mut RepeatMut<'a, T>) -> Option<_>` - found fn pointer `fn(&'a mut RepeatMut<'a, T>) -> Option<_>` + = note: expected signature `fn(&mut RepeatMut<'a, T>) -> Option<_>` + found signature `fn(&'a mut RepeatMut<'a, T>) -> Option<_>` note: the anonymous lifetime as defined here... --> $DIR/issue-37884.rs:6:5 | diff --git a/src/test/ui/lifetimes/lifetime-mismatch-between-trait-and-impl.stderr b/src/test/ui/lifetimes/lifetime-mismatch-between-trait-and-impl.stderr index 3040a8512ce..9c61d5a0c25 100644 --- a/src/test/ui/lifetimes/lifetime-mismatch-between-trait-and-impl.stderr +++ b/src/test/ui/lifetimes/lifetime-mismatch-between-trait-and-impl.stderr @@ -7,8 +7,8 @@ LL | fn foo<'a>(x: &i32, y: &'a i32) -> &'a i32; LL | fn foo<'a>(x: &'a i32, y: &'a i32) -> &'a i32 { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ found `fn(&'1 i32, &'1 i32) -> &'1 i32` | - = note: expected `fn(&'1 i32, &'a i32) -> &'a i32` - found `fn(&'1 i32, &'1 i32) -> &'1 i32` + = note: expected signature `fn(&'1 i32, &'a i32) -> &'a i32` + found signature `fn(&'1 i32, &'1 i32) -> &'1 i32` = help: the lifetime requirements from the `impl` do not correspond to the requirements in the `trait` = help: verify the lifetime relationships in the `trait` and `impl` between the `self` argument, the other inputs and its output diff --git a/src/test/ui/mismatched_types/E0053.stderr b/src/test/ui/mismatched_types/E0053.stderr index 54b41926451..154f2fcbee0 100644 --- a/src/test/ui/mismatched_types/E0053.stderr +++ b/src/test/ui/mismatched_types/E0053.stderr @@ -12,8 +12,8 @@ note: type in trait | LL | fn foo(x: u16); | ^^^ - = note: expected fn pointer `fn(u16)` - found fn pointer `fn(i16)` + = note: expected signature `fn(u16)` + found signature `fn(i16)` error[E0053]: method `bar` has an incompatible type for trait --> $DIR/E0053.rs:11:12 @@ -29,8 +29,8 @@ note: type in trait | LL | fn bar(&self); | ^^^^^ - = note: expected fn pointer `fn(&Bar)` - found fn pointer `fn(&mut Bar)` + = note: expected signature `fn(&Bar)` + found signature `fn(&mut Bar)` error: aborting due to 2 previous errors diff --git a/src/test/ui/mismatched_types/issue-74918-missing-lifetime.stderr b/src/test/ui/mismatched_types/issue-74918-missing-lifetime.stderr index b75c7a99fdd..9ddea162944 100644 --- a/src/test/ui/mismatched_types/issue-74918-missing-lifetime.stderr +++ b/src/test/ui/mismatched_types/issue-74918-missing-lifetime.stderr @@ -18,8 +18,8 @@ LL | fn next(&mut self) -> Option<IteratorChunk<T, S>> { | = note: expected `fn(&'1 mut ChunkingIterator<T, S>) -> Option<IteratorChunk<'static, T, S>>` | - = note: expected `fn(&'1 mut ChunkingIterator<T, S>) -> Option<IteratorChunk<'static, T, S>>` - found `fn(&'1 mut ChunkingIterator<T, S>) -> Option<IteratorChunk<'1, T, S>>` + = note: expected signature `fn(&'1 mut ChunkingIterator<T, S>) -> Option<IteratorChunk<'static, T, S>>` + found signature `fn(&'1 mut ChunkingIterator<T, S>) -> Option<IteratorChunk<'1, T, S>>` = help: the lifetime requirements from the `impl` do not correspond to the requirements in the `trait` = help: verify the lifetime relationships in the `trait` and `impl` between the `self` argument, the other inputs and its output diff --git a/src/test/ui/mismatched_types/issue-75361-mismatched-impl.stderr b/src/test/ui/mismatched_types/issue-75361-mismatched-impl.stderr index 2a2c23c9421..88416ba4bb6 100644 --- a/src/test/ui/mismatched_types/issue-75361-mismatched-impl.stderr +++ b/src/test/ui/mismatched_types/issue-75361-mismatched-impl.stderr @@ -7,8 +7,8 @@ LL | fn adjacent_edges(&self) -> Box<dyn MyTrait<Item = &Self::EdgeType>>; LL | fn adjacent_edges(&self) -> Box<dyn MyTrait<Item = &Self::EdgeType> + '_> { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ found `fn(&'1 T) -> Box<(dyn MyTrait<Item = &'1 T> + '1)>` | - = note: expected `fn(&'1 T) -> Box<(dyn MyTrait<Item = &'1 T> + 'static)>` - found `fn(&'1 T) -> Box<(dyn MyTrait<Item = &'1 T> + '1)>` + = note: expected signature `fn(&'1 T) -> Box<(dyn MyTrait<Item = &'1 T> + 'static)>` + found signature `fn(&'1 T) -> Box<(dyn MyTrait<Item = &'1 T> + '1)>` help: the lifetime requirements from the `impl` do not correspond to the requirements in the `trait` --> $DIR/issue-75361-mismatched-impl.rs:12:55 | diff --git a/src/test/ui/mismatched_types/trait-impl-fn-incompatibility.stderr b/src/test/ui/mismatched_types/trait-impl-fn-incompatibility.stderr index 6b2ba53daa0..6e7bf5eb46d 100644 --- a/src/test/ui/mismatched_types/trait-impl-fn-incompatibility.stderr +++ b/src/test/ui/mismatched_types/trait-impl-fn-incompatibility.stderr @@ -12,8 +12,8 @@ note: type in trait | LL | fn foo(x: u16); | ^^^ - = note: expected fn pointer `fn(u16)` - found fn pointer `fn(i16)` + = note: expected signature `fn(u16)` + found signature `fn(i16)` error[E0053]: method `bar` has an incompatible type for trait --> $DIR/trait-impl-fn-incompatibility.rs:10:28 @@ -29,8 +29,8 @@ note: type in trait | LL | fn bar(&mut self, bar: &mut Bar); | ^^^^^^^^ - = note: expected fn pointer `fn(&mut Bar, &mut Bar)` - found fn pointer `fn(&mut Bar, &Bar)` + = note: expected signature `fn(&mut Bar, &mut Bar)` + found signature `fn(&mut Bar, &Bar)` error: aborting due to 2 previous errors diff --git a/src/test/ui/parser/nested-bad-turbofish.rs b/src/test/ui/parser/nested-bad-turbofish.rs new file mode 100644 index 00000000000..02099fde212 --- /dev/null +++ b/src/test/ui/parser/nested-bad-turbofish.rs @@ -0,0 +1,3 @@ +fn main() { + foo<<S as T>::V>(); //~ ERROR +} diff --git a/src/test/ui/parser/nested-bad-turbofish.stderr b/src/test/ui/parser/nested-bad-turbofish.stderr new file mode 100644 index 00000000000..d82fa80e594 --- /dev/null +++ b/src/test/ui/parser/nested-bad-turbofish.stderr @@ -0,0 +1,11 @@ +error: comparison operators cannot be chained + --> $DIR/nested-bad-turbofish.rs:2:16 + | +LL | foo<<S as T>::V>(); + | ^ ^ + | + = help: use `::<...>` instead of `<...>` to specify lifetime, type, or const arguments + = help: or use `(...)` if you meant to specify fn arguments + +error: aborting due to previous error + diff --git a/src/test/ui/privacy/private-field-ty-err.rs b/src/test/ui/privacy/private-field-ty-err.rs new file mode 100644 index 00000000000..10db6069567 --- /dev/null +++ b/src/test/ui/privacy/private-field-ty-err.rs @@ -0,0 +1,20 @@ +fn main() { + let x = foo::Foo::default(); + if x.len { + //~^ ERROR field `len` of struct `Foo` is private + println!("foo"); + } +} + +mod foo { + #[derive(Default)] + pub struct Foo { + len: String, + } + + impl Foo { + pub fn len(&self) -> usize { + 42 + } + } +} diff --git a/src/test/ui/privacy/private-field-ty-err.stderr b/src/test/ui/privacy/private-field-ty-err.stderr new file mode 100644 index 00000000000..e583a25fd8f --- /dev/null +++ b/src/test/ui/privacy/private-field-ty-err.stderr @@ -0,0 +1,14 @@ +error[E0616]: field `len` of struct `Foo` is private + --> $DIR/private-field-ty-err.rs:3:10 + | +LL | if x.len { + | ^^^ private field + | +help: a method `len` also exists, call it with parentheses + | +LL | if x.len() { + | ++ + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0616`. diff --git a/src/test/ui/suggestions/imm-ref-trait-object.rs b/src/test/ui/suggestions/imm-ref-trait-object.rs index 288d6c699f5..c1c969b90e4 100644 --- a/src/test/ui/suggestions/imm-ref-trait-object.rs +++ b/src/test/ui/suggestions/imm-ref-trait-object.rs @@ -1,5 +1,5 @@ fn test(t: &dyn Iterator<Item=&u64>) -> u64 { - t.min().unwrap() //~ ERROR the `min` method cannot be invoked on a trait object + t.min().unwrap() //~ ERROR the `min` method cannot be invoked on `&dyn Iterator<Item = &u64>` } fn main() { diff --git a/src/test/ui/suggestions/imm-ref-trait-object.stderr b/src/test/ui/suggestions/imm-ref-trait-object.stderr index 7791b308d5d..f7f7902c17d 100644 --- a/src/test/ui/suggestions/imm-ref-trait-object.stderr +++ b/src/test/ui/suggestions/imm-ref-trait-object.stderr @@ -1,13 +1,13 @@ -error: the `min` method cannot be invoked on a trait object +error: the `min` method cannot be invoked on `&dyn Iterator<Item = &u64>` --> $DIR/imm-ref-trait-object.rs:2:8 | LL | t.min().unwrap() | ^^^ - --> $SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL | - = note: this has a `Sized` requirement +help: you need `&mut dyn Iterator<Item = &u64>` instead of `&dyn Iterator<Item = &u64>` | - = note: you need `&mut dyn Iterator<Item = &u64>` instead of `&dyn Iterator<Item = &u64>` +LL | fn test(t: &mut dyn Iterator<Item=&u64>) -> u64 { + | +++ error: aborting due to previous error diff --git a/src/test/ui/suggestions/issue-106443-sugg-clone-for-arg.rs b/src/test/ui/suggestions/issue-106443-sugg-clone-for-arg.rs new file mode 100644 index 00000000000..48efdb82c46 --- /dev/null +++ b/src/test/ui/suggestions/issue-106443-sugg-clone-for-arg.rs @@ -0,0 +1,23 @@ +#[derive(Clone)] +struct S; + +// without Clone +struct T; + +fn foo(_: S) {} + +fn test1() { + let s = &S; + foo(s); //~ ERROR mismatched types +} + +fn bar(_: T) {} +fn test2() { + let t = &T; + bar(t); //~ ERROR mismatched types +} + +fn main() { + test1(); + test2(); +} diff --git a/src/test/ui/suggestions/issue-106443-sugg-clone-for-arg.stderr b/src/test/ui/suggestions/issue-106443-sugg-clone-for-arg.stderr new file mode 100644 index 00000000000..1e66fe3af24 --- /dev/null +++ b/src/test/ui/suggestions/issue-106443-sugg-clone-for-arg.stderr @@ -0,0 +1,35 @@ +error[E0308]: mismatched types + --> $DIR/issue-106443-sugg-clone-for-arg.rs:11:9 + | +LL | foo(s); + | --- ^ expected struct `S`, found `&S` + | | + | arguments to this function are incorrect + | +note: function defined here + --> $DIR/issue-106443-sugg-clone-for-arg.rs:7:4 + | +LL | fn foo(_: S) {} + | ^^^ ---- +help: consider using clone here + | +LL | foo(s.clone()); + | ++++++++ + +error[E0308]: mismatched types + --> $DIR/issue-106443-sugg-clone-for-arg.rs:17:9 + | +LL | bar(t); + | --- ^ expected struct `T`, found `&T` + | | + | arguments to this function are incorrect + | +note: function defined here + --> $DIR/issue-106443-sugg-clone-for-arg.rs:14:4 + | +LL | fn bar(_: T) {} + | ^^^ ---- + +error: aborting due to 2 previous errors + +For more information about this error, try `rustc --explain E0308`. diff --git a/src/test/ui/suggestions/issue-106443-sugg-clone-for-bound.rs b/src/test/ui/suggestions/issue-106443-sugg-clone-for-bound.rs new file mode 100644 index 00000000000..3b2e316b296 --- /dev/null +++ b/src/test/ui/suggestions/issue-106443-sugg-clone-for-bound.rs @@ -0,0 +1,20 @@ +#[derive(Clone)] +struct S; + +trait X {} + +impl X for S {} + +fn foo<T: X>(_: T) {} +fn bar<T: X>(s: &T) { + foo(s); //~ ERROR the trait bound `&T: X` is not satisfied +} + +fn bar_with_clone<T: X + Clone>(s: &T) { + foo(s); //~ ERROR the trait bound `&T: X` is not satisfied +} + +fn main() { + let s = &S; + bar(s); +} diff --git a/src/test/ui/suggestions/issue-106443-sugg-clone-for-bound.stderr b/src/test/ui/suggestions/issue-106443-sugg-clone-for-bound.stderr new file mode 100644 index 00000000000..8607917ede6 --- /dev/null +++ b/src/test/ui/suggestions/issue-106443-sugg-clone-for-bound.stderr @@ -0,0 +1,29 @@ +error[E0277]: the trait bound `&T: X` is not satisfied + --> $DIR/issue-106443-sugg-clone-for-bound.rs:10:9 + | +LL | foo(s); + | ^ the trait `X` is not implemented for `&T` + | +help: consider further restricting this bound + | +LL | fn bar<T: X + Clone>(s: &T) { + | +++++++ +help: consider using clone here + | +LL | foo(s.clone()); + | ++++++++ + +error[E0277]: the trait bound `&T: X` is not satisfied + --> $DIR/issue-106443-sugg-clone-for-bound.rs:14:9 + | +LL | foo(s); + | ^ the trait `X` is not implemented for `&T` + | +help: consider using clone here + | +LL | foo(s.clone()); + | ++++++++ + +error: aborting due to 2 previous errors + +For more information about this error, try `rustc --explain E0277`. diff --git a/src/test/ui/traits/impl-method-mismatch.rs b/src/test/ui/traits/impl-method-mismatch.rs index 683b1c1aa43..62580755c81 100644 --- a/src/test/ui/traits/impl-method-mismatch.rs +++ b/src/test/ui/traits/impl-method-mismatch.rs @@ -6,8 +6,8 @@ impl Mumbo for usize { // Cannot have a larger effect than the trait: unsafe fn jumbo(&self, x: &usize) { *self + *x; } //~^ ERROR method `jumbo` has an incompatible type for trait - //~| expected fn pointer `fn - //~| found fn pointer `unsafe fn + //~| expected signature `fn + //~| found signature `unsafe fn } fn main() {} diff --git a/src/test/ui/traits/impl-method-mismatch.stderr b/src/test/ui/traits/impl-method-mismatch.stderr index 30aa97d2934..252b5aff96a 100644 --- a/src/test/ui/traits/impl-method-mismatch.stderr +++ b/src/test/ui/traits/impl-method-mismatch.stderr @@ -9,8 +9,8 @@ note: type in trait | LL | fn jumbo(&self, x: &usize) -> usize; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - = note: expected fn pointer `fn(&usize, &usize) -> usize` - found fn pointer `unsafe fn(&usize, &usize)` + = note: expected signature `fn(&usize, &usize) -> usize` + found signature `unsafe fn(&usize, &usize)` error: aborting due to previous error diff --git a/src/test/ui/traits/issue-35869.stderr b/src/test/ui/traits/issue-35869.stderr index 0780109b843..6d985bdeaf8 100644 --- a/src/test/ui/traits/issue-35869.stderr +++ b/src/test/ui/traits/issue-35869.stderr @@ -12,8 +12,8 @@ note: type in trait | LL | fn foo(_: fn(u8) -> ()); | ^^^^^^^^^^^^ - = note: expected fn pointer `fn(fn(u8))` - found fn pointer `fn(fn(u16))` + = note: expected signature `fn(fn(u8))` + found signature `fn(fn(u16))` error[E0053]: method `bar` has an incompatible type for trait --> $DIR/issue-35869.rs:13:15 @@ -29,8 +29,8 @@ note: type in trait | LL | fn bar(_: Option<u8>); | ^^^^^^^^^^ - = note: expected fn pointer `fn(Option<u8>)` - found fn pointer `fn(Option<u16>)` + = note: expected signature `fn(Option<u8>)` + found signature `fn(Option<u16>)` error[E0053]: method `baz` has an incompatible type for trait --> $DIR/issue-35869.rs:15:15 @@ -46,8 +46,8 @@ note: type in trait | LL | fn baz(_: (u8, u16)); | ^^^^^^^^^ - = note: expected fn pointer `fn((u8, _))` - found fn pointer `fn((u16, _))` + = note: expected signature `fn((u8, _))` + found signature `fn((u16, _))` error[E0053]: method `qux` has an incompatible type for trait --> $DIR/issue-35869.rs:17:17 @@ -63,8 +63,8 @@ note: type in trait | LL | fn qux() -> u8; | ^^ - = note: expected fn pointer `fn() -> u8` - found fn pointer `fn() -> u16` + = note: expected signature `fn() -> u8` + found signature `fn() -> u16` error: aborting due to 4 previous errors diff --git a/src/test/ui/traits/matching-lifetimes.stderr b/src/test/ui/traits/matching-lifetimes.stderr index de1c878a513..f8119ed415d 100644 --- a/src/test/ui/traits/matching-lifetimes.stderr +++ b/src/test/ui/traits/matching-lifetimes.stderr @@ -4,8 +4,8 @@ error[E0308]: method not compatible with trait LL | fn foo(x: Foo<'b,'a>) { | ^^^^^^^^^^^^^^^^^^^^^ lifetime mismatch | - = note: expected fn pointer `fn(Foo<'a, 'b>)` - found fn pointer `fn(Foo<'b, 'a>)` + = note: expected signature `fn(Foo<'a, 'b>)` + found signature `fn(Foo<'b, 'a>)` note: the lifetime `'b` as defined here... --> $DIR/matching-lifetimes.rs:13:9 | @@ -23,8 +23,8 @@ error[E0308]: method not compatible with trait LL | fn foo(x: Foo<'b,'a>) { | ^^^^^^^^^^^^^^^^^^^^^ lifetime mismatch | - = note: expected fn pointer `fn(Foo<'a, 'b>)` - found fn pointer `fn(Foo<'b, 'a>)` + = note: expected signature `fn(Foo<'a, 'b>)` + found signature `fn(Foo<'b, 'a>)` note: the lifetime `'a` as defined here... --> $DIR/matching-lifetimes.rs:13:6 | diff --git a/src/test/ui/traits/param-without-lifetime-constraint.stderr b/src/test/ui/traits/param-without-lifetime-constraint.stderr index 118b2cf3ecd..b128b6518ce 100644 --- a/src/test/ui/traits/param-without-lifetime-constraint.stderr +++ b/src/test/ui/traits/param-without-lifetime-constraint.stderr @@ -7,8 +7,8 @@ LL | fn get_relation(&self) -> To; LL | fn get_relation(&self) -> &ProofReader { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ found `fn(&'1 Article) -> &'1 ProofReader` | - = note: expected `fn(&'1 Article) -> &'2 ProofReader` - found `fn(&'1 Article) -> &'1 ProofReader` + = note: expected signature `fn(&'1 Article) -> &'2 ProofReader` + found signature `fn(&'1 Article) -> &'1 ProofReader` help: the lifetime requirements from the `impl` do not correspond to the requirements in the `trait` --> $DIR/param-without-lifetime-constraint.rs:10:31 | diff --git a/src/test/ui/traits/self-without-lifetime-constraint.stderr b/src/test/ui/traits/self-without-lifetime-constraint.stderr index 85fada3b87c..05a49820a82 100644 --- a/src/test/ui/traits/self-without-lifetime-constraint.stderr +++ b/src/test/ui/traits/self-without-lifetime-constraint.stderr @@ -7,8 +7,8 @@ LL | fn column_result(value: ValueRef<'_>) -> FromSqlResult<Self, &Self>; LL | fn column_result(value: ValueRef<'_>) -> FromSqlResult<&str, &&str> { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ found `fn(ValueRef<'1>) -> Result<(&'1 str, &'1 &'1 str), FromSqlError>` | - = note: expected `fn(ValueRef<'1>) -> Result<(&'2 str, &'1 &'2 str), FromSqlError>` - found `fn(ValueRef<'1>) -> Result<(&'1 str, &'1 &'1 str), FromSqlError>` + = note: expected signature `fn(ValueRef<'1>) -> Result<(&'2 str, &'1 &'2 str), FromSqlError>` + found signature `fn(ValueRef<'1>) -> Result<(&'1 str, &'1 &'1 str), FromSqlError>` help: the lifetime requirements from the `impl` do not correspond to the requirements in the `trait` --> $DIR/self-without-lifetime-constraint.rs:41:60 | diff --git a/src/test/ui/unsafe/unsafe-trait-impl.rs b/src/test/ui/unsafe/unsafe-trait-impl.rs index 03a251be1a9..1fc84ca0256 100644 --- a/src/test/ui/unsafe/unsafe-trait-impl.rs +++ b/src/test/ui/unsafe/unsafe-trait-impl.rs @@ -7,8 +7,8 @@ trait Foo { impl Foo for u32 { fn len(&self) -> u32 { *self } //~^ ERROR method `len` has an incompatible type for trait - //~| expected fn pointer `unsafe fn(&u32) -> _` - //~| found fn pointer `fn(&u32) -> _` + //~| expected signature `unsafe fn(&u32) -> _` + //~| found signature `fn(&u32) -> _` } fn main() { } diff --git a/src/test/ui/unsafe/unsafe-trait-impl.stderr b/src/test/ui/unsafe/unsafe-trait-impl.stderr index 8a0cba1fac5..18ba79404b7 100644 --- a/src/test/ui/unsafe/unsafe-trait-impl.stderr +++ b/src/test/ui/unsafe/unsafe-trait-impl.stderr @@ -9,8 +9,8 @@ note: type in trait | LL | unsafe fn len(&self) -> u32; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - = note: expected fn pointer `unsafe fn(&u32) -> _` - found fn pointer `fn(&u32) -> _` + = note: expected signature `unsafe fn(&u32) -> _` + found signature `fn(&u32) -> _` error: aborting due to previous error diff --git a/src/test/ui/wrong-mul-method-signature.stderr b/src/test/ui/wrong-mul-method-signature.stderr index 8338f61b22a..504a6032b01 100644 --- a/src/test/ui/wrong-mul-method-signature.stderr +++ b/src/test/ui/wrong-mul-method-signature.stderr @@ -7,8 +7,8 @@ LL | fn mul(self, s: &f64) -> Vec1 { | expected `f64`, found `&f64` | help: change the parameter type to match the trait: `f64` | - = note: expected fn pointer `fn(Vec1, f64) -> Vec1` - found fn pointer `fn(Vec1, &f64) -> Vec1` + = note: expected signature `fn(Vec1, f64) -> Vec1` + found signature `fn(Vec1, &f64) -> Vec1` error[E0053]: method `mul` has an incompatible type for trait --> $DIR/wrong-mul-method-signature.rs:33:21 @@ -19,8 +19,8 @@ LL | fn mul(self, s: f64) -> Vec2 { | expected struct `Vec2`, found `f64` | help: change the parameter type to match the trait: `Vec2` | - = note: expected fn pointer `fn(Vec2, Vec2) -> f64` - found fn pointer `fn(Vec2, f64) -> Vec2` + = note: expected signature `fn(Vec2, Vec2) -> f64` + found signature `fn(Vec2, f64) -> Vec2` error[E0053]: method `mul` has an incompatible type for trait --> $DIR/wrong-mul-method-signature.rs:52:29 @@ -31,8 +31,8 @@ LL | fn mul(self, s: f64) -> f64 { | expected `i32`, found `f64` | help: change the output type to match the trait: `i32` | - = note: expected fn pointer `fn(Vec3, _) -> i32` - found fn pointer `fn(Vec3, _) -> f64` + = note: expected signature `fn(Vec3, _) -> i32` + found signature `fn(Vec3, _) -> f64` error[E0308]: mismatched types --> $DIR/wrong-mul-method-signature.rs:63:45 |
