forked from rust-lang/rust
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rollup merge of rust-lang#107111 - chenyukang:yukang/fix-107090-fluen…
…t-parameters, r=petrochenkov Fix missing arguments issues and copy-paste bug for fluent Fixes rust-lang#107090
- Loading branch information
Showing
5 changed files
with
223 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
use std::marker::PhantomData; | ||
struct Foo<'a, 'b, T>(PhantomData<(&'a (), &'b (), T)>) | ||
where | ||
Foo<'short, 'out, T>: Convert<'a, 'b>; | ||
//~^ ERROR mismatched types | ||
//~^^ ERROR mismatched types | ||
//~^^^ ERROR use of undeclared lifetime name | ||
//~| ERROR use of undeclared lifetime name `'out` | ||
|
||
trait Convert<'a, 'b>: Sized { | ||
fn cast(&'a self) -> &'b Self; | ||
} | ||
impl<'long: 'short, 'short, T> Convert<'long, 'b> for Foo<'short, 'out, T> { | ||
//~^ ERROR use of undeclared lifetime name | ||
//~^^ ERROR use of undeclared lifetime name `'out` | ||
//~| ERROR cannot infer an appropriate lifetime for lifetime parameter | ||
fn cast(&'long self) -> &'short Foo<'short, 'out, T> { | ||
//~^ ERROR use of undeclared lifetime name | ||
//~| ERROR cannot infer an appropriate lifetime for lifetime parameter | ||
self | ||
} | ||
} | ||
|
||
fn badboi<'in_, 'out, T>(x: Foo<'in_, 'out, T>, sadness: &'in_ Foo<'short, 'out, T>) -> &'out T { | ||
//~^ ERROR use of undeclared lifetime name | ||
//~^^ ERROR incompatible lifetime on type | ||
//~| ERROR `x` has lifetime `'in_` but it needs to satisfy a `'static` lifetime requirement | ||
sadness.cast() | ||
} | ||
|
||
fn main() {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,173 @@ | ||
error[E0261]: use of undeclared lifetime name `'short` | ||
--> $DIR/issue-107090.rs:4:9 | ||
| | ||
LL | Foo<'short, 'out, T>: Convert<'a, 'b>; | ||
| ^^^^^^ undeclared lifetime | ||
| | ||
= note: for more information on higher-ranked polymorphism, visit https://doc.rust-lang.org/nomicon/hrtb.html | ||
help: consider making the bound lifetime-generic with a new `'short` lifetime | ||
| | ||
LL | for<'short> Foo<'short, 'out, T>: Convert<'a, 'b>; | ||
| +++++++++++ | ||
help: consider introducing lifetime `'short` here | ||
| | ||
LL | struct Foo<'short, 'a, 'b, T>(PhantomData<(&'a (), &'b (), T)>) | ||
| +++++++ | ||
|
||
error[E0261]: use of undeclared lifetime name `'out` | ||
--> $DIR/issue-107090.rs:4:17 | ||
| | ||
LL | Foo<'short, 'out, T>: Convert<'a, 'b>; | ||
| ^^^^ undeclared lifetime | ||
| | ||
help: consider making the bound lifetime-generic with a new `'out` lifetime | ||
| | ||
LL | for<'out> Foo<'short, 'out, T>: Convert<'a, 'b>; | ||
| +++++++++ | ||
help: consider introducing lifetime `'out` here | ||
| | ||
LL | struct Foo<'out, 'a, 'b, T>(PhantomData<(&'a (), &'b (), T)>) | ||
| +++++ | ||
|
||
error[E0261]: use of undeclared lifetime name `'b` | ||
--> $DIR/issue-107090.rs:13:47 | ||
| | ||
LL | impl<'long: 'short, 'short, T> Convert<'long, 'b> for Foo<'short, 'out, T> { | ||
| - ^^ undeclared lifetime | ||
| | | ||
| help: consider introducing lifetime `'b` here: `'b,` | ||
|
||
error[E0261]: use of undeclared lifetime name `'out` | ||
--> $DIR/issue-107090.rs:13:67 | ||
| | ||
LL | impl<'long: 'short, 'short, T> Convert<'long, 'b> for Foo<'short, 'out, T> { | ||
| - help: consider introducing lifetime `'out` here: `'out,` ^^^^ undeclared lifetime | ||
|
||
error[E0261]: use of undeclared lifetime name `'out` | ||
--> $DIR/issue-107090.rs:17:49 | ||
| | ||
LL | fn cast(&'long self) -> &'short Foo<'short, 'out, T> { | ||
| ^^^^ undeclared lifetime | ||
| | ||
help: consider introducing lifetime `'out` here | ||
| | ||
LL | fn cast<'out>(&'long self) -> &'short Foo<'short, 'out, T> { | ||
| ++++++ | ||
help: consider introducing lifetime `'out` here | ||
| | ||
LL | impl<'out, 'long: 'short, 'short, T> Convert<'long, 'b> for Foo<'short, 'out, T> { | ||
| +++++ | ||
|
||
error[E0261]: use of undeclared lifetime name `'short` | ||
--> $DIR/issue-107090.rs:24:68 | ||
| | ||
LL | fn badboi<'in_, 'out, T>(x: Foo<'in_, 'out, T>, sadness: &'in_ Foo<'short, 'out, T>) -> &'out T { | ||
| - ^^^^^^ undeclared lifetime | ||
| | | ||
| help: consider introducing lifetime `'short` here: `'short,` | ||
|
||
error[E0308]: mismatched types | ||
--> $DIR/issue-107090.rs:4:27 | ||
| | ||
LL | Foo<'short, 'out, T>: Convert<'a, 'b>; | ||
| ^^^^^^^^^^^^^^^ lifetime mismatch | ||
| | ||
= note: expected trait `Convert<'static, 'static>` | ||
found trait `Convert<'a, 'b>` | ||
note: the lifetime `'a` as defined here... | ||
--> $DIR/issue-107090.rs:2:12 | ||
| | ||
LL | struct Foo<'a, 'b, T>(PhantomData<(&'a (), &'b (), T)>) | ||
| ^^ | ||
= note: ...does not necessarily outlive the static lifetime | ||
|
||
error[E0308]: mismatched types | ||
--> $DIR/issue-107090.rs:4:27 | ||
| | ||
LL | Foo<'short, 'out, T>: Convert<'a, 'b>; | ||
| ^^^^^^^^^^^^^^^ lifetime mismatch | ||
| | ||
= note: expected trait `Convert<'static, 'static>` | ||
found trait `Convert<'a, 'b>` | ||
note: the lifetime `'b` as defined here... | ||
--> $DIR/issue-107090.rs:2:16 | ||
| | ||
LL | struct Foo<'a, 'b, T>(PhantomData<(&'a (), &'b (), T)>) | ||
| ^^ | ||
= note: ...does not necessarily outlive the static lifetime | ||
|
||
error[E0495]: cannot infer an appropriate lifetime for lifetime parameter `'long` due to conflicting requirements | ||
--> $DIR/issue-107090.rs:13:55 | ||
| | ||
LL | impl<'long: 'short, 'short, T> Convert<'long, 'b> for Foo<'short, 'out, T> { | ||
| ^^^^^^^^^^^^^^^^^^^^ | ||
| | ||
note: first, the lifetime cannot outlive the lifetime `'short` as defined here... | ||
--> $DIR/issue-107090.rs:13:21 | ||
| | ||
LL | impl<'long: 'short, 'short, T> Convert<'long, 'b> for Foo<'short, 'out, T> { | ||
| ^^^^^^ | ||
= note: ...but the lifetime must also be valid for the static lifetime... | ||
note: ...so that the types are compatible | ||
--> $DIR/issue-107090.rs:13:55 | ||
| | ||
LL | impl<'long: 'short, 'short, T> Convert<'long, 'b> for Foo<'short, 'out, T> { | ||
| ^^^^^^^^^^^^^^^^^^^^ | ||
= note: expected `Convert<'short, 'static>` | ||
found `Convert<'_, 'static>` | ||
|
||
error: incompatible lifetime on type | ||
--> $DIR/issue-107090.rs:24:29 | ||
| | ||
LL | fn badboi<'in_, 'out, T>(x: Foo<'in_, 'out, T>, sadness: &'in_ Foo<'short, 'out, T>) -> &'out T { | ||
| ^^^^^^^^^^^^^^^^^^ | ||
| | ||
note: because this has an unmet lifetime requirement | ||
--> $DIR/issue-107090.rs:4:27 | ||
| | ||
LL | Foo<'short, 'out, T>: Convert<'a, 'b>; | ||
| ^^^^^^^^^^^^^^^ introduces a `'static` lifetime requirement | ||
note: the lifetime `'out` as defined here... | ||
--> $DIR/issue-107090.rs:24:17 | ||
| | ||
LL | fn badboi<'in_, 'out, T>(x: Foo<'in_, 'out, T>, sadness: &'in_ Foo<'short, 'out, T>) -> &'out T { | ||
| ^^^^ | ||
note: ...does not necessarily outlive the static lifetime introduced by the compatible `impl` | ||
--> $DIR/issue-107090.rs:13:1 | ||
| | ||
LL | impl<'long: 'short, 'short, T> Convert<'long, 'b> for Foo<'short, 'out, T> { | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
|
||
error[E0759]: `x` has lifetime `'in_` but it needs to satisfy a `'static` lifetime requirement | ||
--> $DIR/issue-107090.rs:24:29 | ||
| | ||
LL | fn badboi<'in_, 'out, T>(x: Foo<'in_, 'out, T>, sadness: &'in_ Foo<'short, 'out, T>) -> &'out T { | ||
| ^^^^^^^^^^^^^^^^^^ | ||
| | | ||
| this data with lifetime `'in_`... | ||
| ...is used and required to live as long as `'static` here | ||
|
||
error[E0495]: cannot infer an appropriate lifetime for lifetime parameter `'long` due to conflicting requirements | ||
--> $DIR/issue-107090.rs:17:13 | ||
| | ||
LL | fn cast(&'long self) -> &'short Foo<'short, 'out, T> { | ||
| ^^^^^^^^^^^ | ||
| | ||
note: first, the lifetime cannot outlive the lifetime `'short` as defined here... | ||
--> $DIR/issue-107090.rs:13:21 | ||
| | ||
LL | impl<'long: 'short, 'short, T> Convert<'long, 'b> for Foo<'short, 'out, T> { | ||
| ^^^^^^ | ||
= note: ...but the lifetime must also be valid for the static lifetime... | ||
note: ...so that the types are compatible | ||
--> $DIR/issue-107090.rs:17:13 | ||
| | ||
LL | fn cast(&'long self) -> &'short Foo<'short, 'out, T> { | ||
| ^^^^^^^^^^^ | ||
= note: expected `Convert<'short, 'static>` | ||
found `Convert<'_, 'static>` | ||
|
||
error: aborting due to 12 previous errors | ||
|
||
Some errors have detailed explanations: E0261, E0308, E0495, E0759. | ||
For more information about an error, try `rustc --explain E0261`. |