diff options
| author | Oli Scherer <git-spam-no-reply9815368754983@oli-obk.de> | 2024-06-11 15:32:38 +0000 |
|---|---|---|
| committer | Oli Scherer <git-spam-no-reply9815368754983@oli-obk.de> | 2024-06-12 08:53:59 +0000 |
| commit | 85f2ecab576d3f02619b4d4976a6d7827c65ed4b (patch) | |
| tree | 0217557692b284531ea689d26285e48f0df4f7db | |
| parent | 0bc2001879558ba0d51b6a246f5178853f9ff21e (diff) | |
| download | rust-85f2ecab576d3f02619b4d4976a6d7827c65ed4b.tar.gz rust-85f2ecab576d3f02619b4d4976a6d7827c65ed4b.zip | |
Add a `fn main() {}` to a doctest to prevent the test from being wrapped in a `fn main() {}` body
| -rw-r--r-- | compiler/rustc_error_codes/src/error_codes/E0792.md | 4 | ||||
| -rw-r--r-- | compiler/rustc_lint/src/opaque_hidden_inferred_bound.rs | 2 |
2 files changed, 6 insertions, 0 deletions
diff --git a/compiler/rustc_error_codes/src/error_codes/E0792.md b/compiler/rustc_error_codes/src/error_codes/E0792.md index bad2b5abfe4..5e3dcc4aa72 100644 --- a/compiler/rustc_error_codes/src/error_codes/E0792.md +++ b/compiler/rustc_error_codes/src/error_codes/E0792.md @@ -39,6 +39,8 @@ type Foo<T> = impl std::fmt::Debug; fn foo<U>() -> Foo<U> { 5u32 } + +fn main() {} ``` This means that no matter the generic parameter to `foo`, @@ -57,4 +59,6 @@ type Foo<T: Debug> = impl Debug; fn foo<U: Debug>() -> Foo<U> { Vec::<U>::new() } + +fn main() {} ``` diff --git a/compiler/rustc_lint/src/opaque_hidden_inferred_bound.rs b/compiler/rustc_lint/src/opaque_hidden_inferred_bound.rs index 6098da990c0..7aef6321eeb 100644 --- a/compiler/rustc_lint/src/opaque_hidden_inferred_bound.rs +++ b/compiler/rustc_lint/src/opaque_hidden_inferred_bound.rs @@ -46,6 +46,8 @@ declare_lint! { /// fn test() -> impl Trait<Assoc = Tait> { /// 42 /// } + /// + /// fn main() {} /// ``` /// /// {{produces}} |
