From d30252e3593af0c335f86de4242d581ffa11e270 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Esteban=20K=C3=BCber?= Date: Tue, 14 Nov 2023 22:41:45 +0000 Subject: [PATCH] Tweak wording --- compiler/rustc_resolve/src/late/diagnostics.rs | 8 ++++---- tests/ui/c-variadic/variadic-ffi-6.stderr | 2 +- tests/ui/lifetimes/issue-26638.stderr | 2 +- ...-elision-return-type-requires-explicit-lifetime.stderr | 8 ++++---- tests/ui/self/elision/nested-item.stderr | 2 +- .../suggestions/impl-trait-missing-lifetime-gated.stderr | 8 ++++---- tests/ui/suggestions/return-elided-lifetime.stderr | 2 +- 7 files changed, 16 insertions(+), 16 deletions(-) diff --git a/compiler/rustc_resolve/src/late/diagnostics.rs b/compiler/rustc_resolve/src/late/diagnostics.rs index 2998609c7c8..2cd3e673382 100644 --- a/compiler/rustc_resolve/src/late/diagnostics.rs +++ b/compiler/rustc_resolve/src/late/diagnostics.rs @@ -3012,7 +3012,7 @@ impl<'a: 'ast, 'ast, 'tcx> LateResolutionVisitor<'a, '_, 'ast, 'tcx> { sugg, Applicability::MaybeIncorrect, ); - "...or alternatively," + "...or alternatively, you might want" } else if let Some((kind, _span)) = self.diagnostic_metadata.current_function && let FnKind::Fn(_, _, sig, _, _, _) = kind @@ -3070,9 +3070,9 @@ impl<'a: 'ast, 'ast, 'tcx> LateResolutionVisitor<'a, '_, 'ast, 'tcx> { higher_ranked }, ); - "...or alternatively," + "alternatively, you might want" } else { - "instead, you are more likely" + "instead, you are more likely to want" }; let mut sugg = vec![(lt.span, String::new())]; if let Some((kind, _span)) = @@ -3105,7 +3105,7 @@ impl<'a: 'ast, 'ast, 'tcx> LateResolutionVisitor<'a, '_, 'ast, 'tcx> { } }; err.multipart_suggestion_verbose( - format!("{pre} to want to return an owned value"), + format!("{pre} to return an owned value"), sugg, Applicability::MaybeIncorrect, ); diff --git a/tests/ui/c-variadic/variadic-ffi-6.stderr b/tests/ui/c-variadic/variadic-ffi-6.stderr index b3497d31a0c..3511127a9fa 100644 --- a/tests/ui/c-variadic/variadic-ffi-6.stderr +++ b/tests/ui/c-variadic/variadic-ffi-6.stderr @@ -13,7 +13,7 @@ help: instead, you are more likely to want to change one of the arguments to be | LL | x: &usize, | + -help: ...or alternatively, to want to return an owned value +help: ...or alternatively, you might want to return an owned value | LL - ) -> &usize { LL + ) -> usize { diff --git a/tests/ui/lifetimes/issue-26638.stderr b/tests/ui/lifetimes/issue-26638.stderr index bea590237bc..ee958686259 100644 --- a/tests/ui/lifetimes/issue-26638.stderr +++ b/tests/ui/lifetimes/issue-26638.stderr @@ -25,7 +25,7 @@ help: instead, you are more likely to want to change the argument to be borrowed | LL | fn parse_type_2(iter: &fn(&u8)->&u8) -> &str { iter() } | + -help: ...or alternatively, to want to return an owned value +help: ...or alternatively, you might want to return an owned value | LL | fn parse_type_2(iter: fn(&u8)->&u8) -> String { iter() } | ~~~~~~ diff --git a/tests/ui/lifetimes/lifetime-elision-return-type-requires-explicit-lifetime.stderr b/tests/ui/lifetimes/lifetime-elision-return-type-requires-explicit-lifetime.stderr index caba886a3f7..37ebb178ec6 100644 --- a/tests/ui/lifetimes/lifetime-elision-return-type-requires-explicit-lifetime.stderr +++ b/tests/ui/lifetimes/lifetime-elision-return-type-requires-explicit-lifetime.stderr @@ -54,7 +54,7 @@ help: instead, you are more likely to want to change the argument to be borrowed | LL | fn i(_x: &isize) -> &isize { | + -help: ...or alternatively, to want to return an owned value +help: ...or alternatively, you might want to return an owned value | LL - fn i(_x: isize) -> &isize { LL + fn i(_x: isize) -> isize { @@ -75,7 +75,7 @@ help: instead, you are more likely to want to change the argument to be borrowed | LL | fn j(_x: &StaticStr) -> &isize { | + -help: ...or alternatively, to want to return an owned value +help: ...or alternatively, you might want to return an owned value | LL - fn j(_x: StaticStr) -> &isize { LL + fn j(_x: StaticStr) -> isize { @@ -96,7 +96,7 @@ help: instead, you are more likely to want to change the argument to be borrowed | LL | fn k<'a, T: WithLifetime<'a>>(_x: &T::Output) -> &isize { | + -help: ...or alternatively, to want to return an owned value +help: ...or alternatively, you might want to return an owned value | LL - fn k<'a, T: WithLifetime<'a>>(_x: T::Output) -> &isize { LL + fn k<'a, T: WithLifetime<'a>>(_x: T::Output) -> isize { @@ -117,7 +117,7 @@ help: instead, you are more likely to want to change one of the arguments to be | LL | fn l<'a>(_: &&'a str, _: &&'a str) -> &str { "" } | + + -help: ...or alternatively, to want to return an owned value +help: ...or alternatively, you might want to return an owned value | LL | fn l<'a>(_: &'a str, _: &'a str) -> String { "" } | ~~~~~~ diff --git a/tests/ui/self/elision/nested-item.stderr b/tests/ui/self/elision/nested-item.stderr index 5b784555910..7bad26fa133 100644 --- a/tests/ui/self/elision/nested-item.stderr +++ b/tests/ui/self/elision/nested-item.stderr @@ -29,7 +29,7 @@ help: instead, you are more likely to want to change the argument to be borrowed | LL | fn wrap(self: &Wrap<{ fn bar(&self) {} }>) -> &() { | + -help: ...or alternatively, to want to return an owned value +help: ...or alternatively, you might want to return an owned value | LL - fn wrap(self: Wrap<{ fn bar(&self) {} }>) -> &() { LL + fn wrap(self: Wrap<{ fn bar(&self) {} }>) -> () { diff --git a/tests/ui/suggestions/impl-trait-missing-lifetime-gated.stderr b/tests/ui/suggestions/impl-trait-missing-lifetime-gated.stderr index 3425092366f..a1ab4392214 100644 --- a/tests/ui/suggestions/impl-trait-missing-lifetime-gated.stderr +++ b/tests/ui/suggestions/impl-trait-missing-lifetime-gated.stderr @@ -13,7 +13,7 @@ help: consider introducing a named lifetime parameter | LL | fn g<'a>(mut x: impl Iterator) -> Option<&'a ()> { x.next() } | ++++ ~~~ ~~~ -help: ...or alternatively, to want to return an owned value +help: alternatively, you might want to return an owned value | LL - fn g(mut x: impl Iterator) -> Option<&()> { x.next() } LL + fn g(mut x: impl Iterator) -> Option<()> { x.next() } @@ -34,7 +34,7 @@ help: consider introducing a named lifetime parameter | LL | async fn i<'a>(mut x: impl Iterator) -> Option<&'a ()> { x.next() } | ++++ ~~~ ~~~ -help: ...or alternatively, to want to return an owned value +help: alternatively, you might want to return an owned value | LL - async fn i(mut x: impl Iterator) -> Option<&()> { x.next() } LL + async fn i(mut x: impl Iterator) -> Option<()> { x.next() } @@ -79,7 +79,7 @@ help: consider introducing a named lifetime parameter | LL | fn g<'a>(mut x: impl Foo) -> Option<&'a ()> { x.next() } | ++++ ~~~ -help: ...or alternatively, to want to return an owned value +help: alternatively, you might want to return an owned value | LL - fn g(mut x: impl Foo) -> Option<&()> { x.next() } LL + fn g(mut x: impl Foo) -> Option<()> { x.next() } @@ -100,7 +100,7 @@ help: consider introducing a named lifetime parameter | LL | fn g<'a>(mut x: impl Foo<()>) -> Option<&'a ()> { x.next() } | ++++ ~~~ -help: ...or alternatively, to want to return an owned value +help: alternatively, you might want to return an owned value | LL - fn g(mut x: impl Foo<()>) -> Option<&()> { x.next() } LL + fn g(mut x: impl Foo<()>) -> Option<()> { x.next() } diff --git a/tests/ui/suggestions/return-elided-lifetime.stderr b/tests/ui/suggestions/return-elided-lifetime.stderr index 54e0cfdf9a3..7bfffd30184 100644 --- a/tests/ui/suggestions/return-elided-lifetime.stderr +++ b/tests/ui/suggestions/return-elided-lifetime.stderr @@ -44,7 +44,7 @@ help: instead, you are more likely to want to change one of the arguments to be | LL | fn f2(a: &i32, b: &i32) -> &i32 { loop {} } | + + -help: ...or alternatively, to want to return an owned value +help: ...or alternatively, you might want to return an owned value | LL - fn f2(a: i32, b: i32) -> &i32 { loop {} } LL + fn f2(a: i32, b: i32) -> i32 { loop {} }