Auto merge of #88143 - GuillaumeGomez:rollup-sgh318f, r=GuillaumeGomez
Rollup of 10 pull requests Successful merges: - #87818 (Fix anchors display in rustdoc) - #87983 (Use more accurate spans when proposing adding lifetime to item) - #88012 (Change WASI's `RawFd` from `u32` to `c_int` (`i32`).) - #88031 (Make `BuildHasher` object safe) - #88036 (Fix dead code warning when inline const is used in pattern) - #88082 (Take into account jobs number for rustdoc GUI tests) - #88109 (Fix environment variable getter docs) - #88111 (Add background-color on clickable definitions in source code) - #88129 (Fix dataflow graphviz bug, make dataflow graphviz modules public) - #88136 (Move private_unused.rs test to impl-trait) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
This commit is contained in:
commit
ad1eaffc7e
37 changed files with 303 additions and 108 deletions
|
|
@ -59,7 +59,7 @@ LL | type MyStr = &str;
|
|||
help: consider introducing a named lifetime parameter
|
||||
|
|
||||
LL | type MyStr<'a> = &'a str;
|
||||
| ++++ ~~~
|
||||
| ++++ ++
|
||||
|
||||
error: aborting due to 5 previous errors
|
||||
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ LL | type F<T1> = &[u8];
|
|||
help: consider introducing a named lifetime parameter
|
||||
|
|
||||
LL | type F<'a, T1> = &'a [u8];
|
||||
| +++ ~~~
|
||||
| +++ ++
|
||||
|
||||
error: aborting due to 2 previous errors
|
||||
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ LL | type Output = &i32;
|
|||
help: consider introducing a named lifetime parameter
|
||||
|
|
||||
LL | type Output<'a> = &'a i32;
|
||||
| ++++ ~~~
|
||||
| ++++ ++
|
||||
|
||||
error[E0106]: missing lifetime specifier
|
||||
--> $DIR/assoc-type.rs:16:20
|
||||
|
|
|
|||
|
|
@ -9,11 +9,11 @@ LL | type Foo = fn(&u8, &u8) -> &u8;
|
|||
help: consider making the type lifetime-generic with a new `'a` lifetime
|
||||
|
|
||||
LL | type Foo = for<'a> fn(&'a u8, &'a u8) -> &'a u8;
|
||||
| +++++++ ~~~~~~ ~~~~~~ ~~~
|
||||
| +++++++ ++ ++ ++
|
||||
help: consider introducing a named lifetime parameter
|
||||
|
|
||||
LL | type Foo<'a> = fn(&'a u8, &'a u8) -> &'a u8;
|
||||
| ++++ ~~~~~~ ~~~~~~ ~~~
|
||||
| ++++ ++ ++ ++
|
||||
|
||||
error[E0106]: missing lifetime specifier
|
||||
--> $DIR/issue-19707.rs:5:27
|
||||
|
|
@ -26,11 +26,11 @@ LL | fn bar<F: Fn(&u8, &u8) -> &u8>(f: &F) {}
|
|||
help: consider making the bound lifetime-generic with a new `'a` lifetime
|
||||
|
|
||||
LL | fn bar<F: for<'a> Fn(&'a u8, &'a u8) -> &'a u8>(f: &F) {}
|
||||
| +++++++ ~~~~~~ ~~~~~~ ~~~
|
||||
| +++++++ ++ ++ ++
|
||||
help: consider introducing a named lifetime parameter
|
||||
|
|
||||
LL | fn bar<'a, F: Fn(&'a u8, &'a u8) -> &'a u8>(f: &F) {}
|
||||
| +++ ~~~~~~ ~~~~~~ ~~~
|
||||
| +++ ++ ++ ++
|
||||
|
||||
error: aborting due to 2 previous errors
|
||||
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ LL | fn parse_type(iter: Box<dyn Iterator<Item=&str>+'static>) -> &str { iter.ne
|
|||
help: consider introducing a named lifetime parameter
|
||||
|
|
||||
LL | fn parse_type<'a>(iter: Box<dyn Iterator<Item=&str>+'static>) -> &'a str { iter.next() }
|
||||
| ++++ ~~~
|
||||
| ++++ ++
|
||||
|
||||
error[E0106]: missing lifetime specifier
|
||||
--> $DIR/issue-26638.rs:4:40
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ LL | fn f(a: &S, b: i32) -> &i32 {
|
|||
help: consider introducing a named lifetime parameter
|
||||
|
|
||||
LL | fn f<'a>(a: &'a S, b: i32) -> &'a i32 {
|
||||
| ++++ ~~~~~ ~~~
|
||||
| ++++ ++ ++
|
||||
|
||||
error[E0106]: missing lifetime specifier
|
||||
--> $DIR/issue-30255.rs:14:34
|
||||
|
|
@ -20,7 +20,7 @@ LL | fn g(a: &S, b: bool, c: &i32) -> &i32 {
|
|||
help: consider introducing a named lifetime parameter
|
||||
|
|
||||
LL | fn g<'a>(a: &'a S, b: bool, c: &'a i32) -> &'a i32 {
|
||||
| ++++ ~~~~~ ~~~~~~~ ~~~
|
||||
| ++++ ++ ++ ++
|
||||
|
||||
error[E0106]: missing lifetime specifier
|
||||
--> $DIR/issue-30255.rs:19:44
|
||||
|
|
@ -32,7 +32,7 @@ LL | fn h(a: &bool, b: bool, c: &S, d: &i32) -> &i32 {
|
|||
help: consider introducing a named lifetime parameter
|
||||
|
|
||||
LL | fn h<'a>(a: &'a bool, b: bool, c: &'a S, d: &'a i32) -> &'a i32 {
|
||||
| ++++ ~~~~~~~~ ~~~~~ ~~~~~~~ ~~~
|
||||
| ++++ ++ ++ ++ ++
|
||||
|
||||
error: aborting due to 3 previous errors
|
||||
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ LL | fn g(_x: &isize, _y: &isize) -> &isize {
|
|||
help: consider introducing a named lifetime parameter
|
||||
|
|
||||
LL | fn g<'a>(_x: &'a isize, _y: &'a isize) -> &'a isize {
|
||||
| ++++ ~~~~~~~~~ ~~~~~~~~~ ~~~
|
||||
| ++++ ++ ++ ++
|
||||
|
||||
error[E0106]: missing lifetime specifier
|
||||
--> $DIR/lifetime-elision-return-type-requires-explicit-lifetime.rs:17:19
|
||||
|
|
@ -32,7 +32,7 @@ LL | fn h(_x: &Foo) -> &isize {
|
|||
help: consider introducing a named lifetime parameter
|
||||
|
|
||||
LL | fn h<'a>(_x: &'a Foo) -> &'a isize {
|
||||
| ++++ ~~~~~~~ ~~~
|
||||
| ++++ ++ ++
|
||||
|
||||
error[E0106]: missing lifetime specifier
|
||||
--> $DIR/lifetime-elision-return-type-requires-explicit-lifetime.rs:21:20
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ LL | fn foo(x: &i32, y: &i32) -> &i32 {
|
|||
help: consider introducing a named lifetime parameter
|
||||
|
|
||||
LL | fn foo<'a>(x: &'a i32, y: &'a i32) -> &'a i32 {
|
||||
| ++++ ~~~~~~~ ~~~~~~~ ~~~
|
||||
| ++++ ++ ++ ++
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
|
|
|
|||
45
src/test/ui/lint/dead-code/anon-const-in-pat.rs
Normal file
45
src/test/ui/lint/dead-code/anon-const-in-pat.rs
Normal file
|
|
@ -0,0 +1,45 @@
|
|||
// check-pass
|
||||
#![feature(inline_const)]
|
||||
#![allow(incomplete_features)]
|
||||
#![deny(dead_code)]
|
||||
|
||||
const fn one() -> i32 {
|
||||
1
|
||||
}
|
||||
|
||||
const fn two() -> i32 {
|
||||
2
|
||||
}
|
||||
|
||||
const fn three() -> i32 {
|
||||
3
|
||||
}
|
||||
|
||||
fn inline_const() {
|
||||
// rust-lang/rust#78171: dead_code lint triggers even though function is used in const pattern
|
||||
match 1 {
|
||||
const { one() } => {}
|
||||
_ => {}
|
||||
}
|
||||
}
|
||||
|
||||
fn inline_const_range() {
|
||||
match 1 {
|
||||
1 ..= const { two() } => {}
|
||||
_ => {}
|
||||
}
|
||||
}
|
||||
|
||||
struct S<const C: i32>;
|
||||
|
||||
fn const_generic_arg() {
|
||||
match S::<3> {
|
||||
S::<{three()}> => {}
|
||||
}
|
||||
}
|
||||
|
||||
fn main() {
|
||||
inline_const();
|
||||
inline_const_range();
|
||||
const_generic_arg();
|
||||
}
|
||||
|
|
@ -9,7 +9,7 @@ LL | static NON_ELIDABLE_FN: &fn(&u8, &u8) -> &u8 =
|
|||
help: consider making the type lifetime-generic with a new `'a` lifetime
|
||||
|
|
||||
LL | static NON_ELIDABLE_FN: &for<'a> fn(&'a u8, &'a u8) -> &'a u8 =
|
||||
| +++++++ ~~~~~~ ~~~~~~ ~~~
|
||||
| +++++++ ++ ++ ++
|
||||
|
||||
error[E0106]: missing lifetime specifier
|
||||
--> $DIR/rfc1623-2.rs:10:39
|
||||
|
|
@ -22,7 +22,7 @@ LL | &(non_elidable as fn(&u8, &u8) -> &u8);
|
|||
help: consider making the type lifetime-generic with a new `'a` lifetime
|
||||
|
|
||||
LL | &(non_elidable as for<'a> fn(&'a u8, &'a u8) -> &'a u8);
|
||||
| +++++++ ~~~~~~ ~~~~~~ ~~~
|
||||
| +++++++ ++ ++ ++
|
||||
|
||||
error: aborting due to 2 previous errors
|
||||
|
||||
|
|
|
|||
|
|
@ -25,11 +25,11 @@ LL | struct S2<F: Fn(&i32, &i32) -> &i32>(F);
|
|||
help: consider making the bound lifetime-generic with a new `'a` lifetime
|
||||
|
|
||||
LL | struct S2<F: for<'a> Fn(&'a i32, &'a i32) -> &'a i32>(F);
|
||||
| +++++++ ~~~~~~~ ~~~~~~~ ~~~
|
||||
| +++++++ ++ ++ ++
|
||||
help: consider introducing a named lifetime parameter
|
||||
|
|
||||
LL | struct S2<'a, F: Fn(&'a i32, &'a i32) -> &'a i32>(F);
|
||||
| +++ ~~~~~~~ ~~~~~~~ ~~~
|
||||
| +++ ++ ++ ++
|
||||
|
||||
error[E0582]: binding for associated type `Output` references lifetime `'a`, which does not appear in the trait input types
|
||||
--> $DIR/fn-missing-lifetime-in-item.rs:3:40
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ LL | fn two_lifetimes_needed(a: &(), b: &()) -> TwoLifetimes<'_, '_> {
|
|||
help: consider introducing a named lifetime parameter
|
||||
|
|
||||
LL | fn two_lifetimes_needed<'a>(a: &'a (), b: &'a ()) -> TwoLifetimes<'a, 'a> {
|
||||
| ++++ ~~~~~~ ~~~~~~ ~~ ~~
|
||||
| ++++ ++ ++ ~~ ~~
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ LL | async fn a(s1: &str, s2: &str) -> &str {
|
|||
help: consider introducing a named lifetime parameter
|
||||
|
|
||||
LL | async fn a<'a>(s1: &'a str, s2: &'a str) -> &'a str {
|
||||
| ++++ ~~~~~~~ ~~~~~~~ ~~~
|
||||
| ++++ ++ ++ ++
|
||||
|
||||
error[E0106]: missing lifetime specifier
|
||||
--> $DIR/issue-86667.rs:11:29
|
||||
|
|
@ -20,7 +20,7 @@ LL | fn b(s1: &str, s2: &str) -> &str {
|
|||
help: consider introducing a named lifetime parameter
|
||||
|
|
||||
LL | fn b<'a>(s1: &'a str, s2: &'a str) -> &'a str {
|
||||
| ++++ ~~~~~~~ ~~~~~~~ ~~~
|
||||
| ++++ ++ ++ ++
|
||||
|
||||
error: aborting due to 2 previous errors
|
||||
|
||||
|
|
|
|||
|
|
@ -47,7 +47,7 @@ LL | struct V<'a>(&'a dyn for<'b> Fn(&X) -> &X);
|
|||
help: consider using one of the available lifetimes here
|
||||
|
|
||||
LL | struct V<'a>(&'a dyn for<'b> Fn(&X) -> &'lifetime X);
|
||||
| ~~~~~~~~~~
|
||||
| +++++++++
|
||||
|
||||
error[E0106]: missing lifetime specifier
|
||||
--> $DIR/missing-lt-for-hrtb.rs:5:41
|
||||
|
|
|
|||
|
|
@ -80,7 +80,7 @@ LL | fn f3(s: &S) -> &i32 { loop {} }
|
|||
help: consider introducing a named lifetime parameter
|
||||
|
|
||||
LL | fn f3<'a>(s: &'a S) -> &'a i32 { loop {} }
|
||||
| ++++ ~~~~~ ~~~
|
||||
| ++++ ++ ++
|
||||
|
||||
error[E0106]: missing lifetime specifier
|
||||
--> $DIR/return-elided-lifetime.rs:21:26
|
||||
|
|
@ -92,7 +92,7 @@ LL | fn f3_(s: &S, t: &S) -> (&i32, &i32) { loop {} }
|
|||
help: consider introducing a named lifetime parameter
|
||||
|
|
||||
LL | fn f3_<'a>(s: &'a S, t: &'a S) -> (&'a i32, &i32) { loop {} }
|
||||
| ++++ ~~~~~ ~~~~~ ~~~
|
||||
| ++++ ++ ++ ++
|
||||
|
||||
error[E0106]: missing lifetime specifier
|
||||
--> $DIR/return-elided-lifetime.rs:21:32
|
||||
|
|
@ -104,7 +104,7 @@ LL | fn f3_(s: &S, t: &S) -> (&i32, &i32) { loop {} }
|
|||
help: consider introducing a named lifetime parameter
|
||||
|
|
||||
LL | fn f3_<'a>(s: &'a S, t: &'a S) -> (&i32, &'a i32) { loop {} }
|
||||
| ++++ ~~~~~ ~~~~~ ~~~
|
||||
| ++++ ++ ++ ++
|
||||
|
||||
error[E0106]: missing lifetime specifier
|
||||
--> $DIR/return-elided-lifetime.rs:25:42
|
||||
|
|
@ -121,7 +121,7 @@ LL | fn f4<'a, 'b>(a: &'a i32, b: &'b i32) -> &i32 { loop {} }
|
|||
help: consider using one of the available lifetimes here
|
||||
|
|
||||
LL | fn f4<'a, 'b>(a: &'a i32, b: &'b i32) -> &'lifetime i32 { loop {} }
|
||||
| ~~~~~~~~~~
|
||||
| +++++++++
|
||||
|
||||
error[E0106]: missing lifetime specifier
|
||||
--> $DIR/return-elided-lifetime.rs:27:44
|
||||
|
|
@ -138,7 +138,7 @@ LL | fn f4_<'a, 'b>(a: &'a i32, b: &'b i32) -> (&i32, &i32) { loop {} }
|
|||
help: consider using one of the available lifetimes here
|
||||
|
|
||||
LL | fn f4_<'a, 'b>(a: &'a i32, b: &'b i32) -> (&'lifetime i32, &i32) { loop {} }
|
||||
| ~~~~~~~~~~
|
||||
| +++++++++
|
||||
|
||||
error[E0106]: missing lifetime specifier
|
||||
--> $DIR/return-elided-lifetime.rs:27:50
|
||||
|
|
@ -155,7 +155,7 @@ LL | fn f4_<'a, 'b>(a: &'a i32, b: &'b i32) -> (&i32, &i32) { loop {} }
|
|||
help: consider using one of the available lifetimes here
|
||||
|
|
||||
LL | fn f4_<'a, 'b>(a: &'a i32, b: &'b i32) -> (&i32, &'lifetime i32) { loop {} }
|
||||
| ~~~~~~~~~~
|
||||
| +++++++++
|
||||
|
||||
error[E0106]: missing lifetime specifier
|
||||
--> $DIR/return-elided-lifetime.rs:31:35
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ LL | fn foo(x: &u32, y: &u32) -> &'_ u32 { loop { } }
|
|||
help: consider introducing a named lifetime parameter
|
||||
|
|
||||
LL | fn foo<'a>(x: &'a u32, y: &'a u32) -> &'a u32 { loop { } }
|
||||
| ++++ ~~~~~~~ ~~~~~~~ ~~
|
||||
| ++++ ++ ++ ~~
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
|
|
|
|||
|
|
@ -43,7 +43,7 @@ LL | fn foo2(_: &'_ u8, y: &'_ u8) -> &'_ u8 { y }
|
|||
help: consider introducing a named lifetime parameter
|
||||
|
|
||||
LL | fn foo2<'a>(_: &'a u8, y: &'a u8) -> &'a u8 { y }
|
||||
| ++++ ~~~~~~ ~~~~~~ ~~
|
||||
| ++++ ~~ ~~ ~~
|
||||
|
||||
error: aborting due to 5 previous errors
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue