diff options
| author | bors <bors@rust-lang.org> | 2021-12-29 12:07:33 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2021-12-29 12:07:33 +0000 |
| commit | 2b67c30bfece00357d5fc09d99b49f21066f04ba (patch) | |
| tree | ad36e3e5492f2cd163e10b47db2b0bc3359ef337 /compiler/rustc_error_codes | |
| parent | 6211dd7250e9b8e80733f74911ca88c661adb1a9 (diff) | |
| parent | 949769cf3bb3f81293fbdaaac64d38bd97942158 (diff) | |
| download | rust-2b67c30bfece00357d5fc09d99b49f21066f04ba.tar.gz rust-2b67c30bfece00357d5fc09d99b49f21066f04ba.zip | |
Auto merge of #92397 - matthiaskrgr:rollup-xnfou17, r=matthiaskrgr
Rollup of 7 pull requests Successful merges: - #92075 (rustdoc: Only special case struct fields for intra-doc links, not enum variants) - #92118 (Parse and suggest moving where clauses after equals for type aliases) - #92237 (Visit expressions in-order when resolving pattern bindings) - #92340 (rustdoc: Start cleaning up search index generation) - #92351 (Add long error explanation for E0227) - #92371 (Remove pretty printer space inside block with only outer attrs) - #92372 (Print space after formal generic params in fn type) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
Diffstat (limited to 'compiler/rustc_error_codes')
| -rw-r--r-- | compiler/rustc_error_codes/src/error_codes.rs | 2 | ||||
| -rw-r--r-- | compiler/rustc_error_codes/src/error_codes/E0227.md | 33 |
2 files changed, 34 insertions, 1 deletions
diff --git a/compiler/rustc_error_codes/src/error_codes.rs b/compiler/rustc_error_codes/src/error_codes.rs index ce26ff62235..79d9c55b547 100644 --- a/compiler/rustc_error_codes/src/error_codes.rs +++ b/compiler/rustc_error_codes/src/error_codes.rs @@ -120,6 +120,7 @@ E0223: include_str!("./error_codes/E0223.md"), E0224: include_str!("./error_codes/E0224.md"), E0225: include_str!("./error_codes/E0225.md"), E0226: include_str!("./error_codes/E0226.md"), +E0227: include_str!("./error_codes/E0227.md"), E0228: include_str!("./error_codes/E0228.md"), E0229: include_str!("./error_codes/E0229.md"), E0230: include_str!("./error_codes/E0230.md"), @@ -530,7 +531,6 @@ E0786: include_str!("./error_codes/E0786.md"), // E0217, // ambiguous associated type, defined in multiple supertraits // E0218, // no associated type defined // E0219, // associated type defined in higher-ranked supertrait - E0227, // ambiguous lifetime bound, explicit lifetime bound required // E0233, // E0234, // E0235, // structure constructor specifies a structure of type but diff --git a/compiler/rustc_error_codes/src/error_codes/E0227.md b/compiler/rustc_error_codes/src/error_codes/E0227.md new file mode 100644 index 00000000000..f68614723d4 --- /dev/null +++ b/compiler/rustc_error_codes/src/error_codes/E0227.md @@ -0,0 +1,33 @@ +This error indicates that the compiler is unable to determine whether there is +exactly one unique region in the set of derived region bounds. + +Example of erroneous code: + +```compile_fail,E0227 +trait Foo<'foo>: 'foo {} +trait Bar<'bar>: 'bar {} + +trait FooBar<'foo, 'bar>: Foo<'foo> + Bar<'bar> {} + +struct Baz<'foo, 'bar> { + baz: dyn FooBar<'foo, 'bar>, +} +``` + +Here, `baz` can have either `'foo` or `'bar` lifetimes. + +To resolve this error, provide an explicit lifetime: + +```rust +trait Foo<'foo>: 'foo {} +trait Bar<'bar>: 'bar {} + +trait FooBar<'foo, 'bar>: Foo<'foo> + Bar<'bar> {} + +struct Baz<'foo, 'bar, 'baz> +where + 'baz: 'foo + 'bar, +{ + obj: dyn FooBar<'foo, 'bar> + 'baz, +} +``` |
