Skip to content

Commit

Permalink
Add a fn main() {} to a doctest to prevent the test from being wrap…
Browse files Browse the repository at this point in the history
…ped in a `fn main() {}` body
  • Loading branch information
oli-obk committed Jun 12, 2024
1 parent 0bc2001 commit 85f2eca
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
4 changes: 4 additions & 0 deletions compiler/rustc_error_codes/src/error_codes/E0792.md
Original file line number Diff line number Diff line change
Expand Up @@ -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`,
Expand All @@ -57,4 +59,6 @@ type Foo<T: Debug> = impl Debug;
fn foo<U: Debug>() -> Foo<U> {
Vec::<U>::new()
}
fn main() {}
```
2 changes: 2 additions & 0 deletions compiler/rustc_lint/src/opaque_hidden_inferred_bound.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@ declare_lint! {
/// fn test() -> impl Trait<Assoc = Tait> {
/// 42
/// }
///
/// fn main() {}
/// ```
///
/// {{produces}}
Expand Down

0 comments on commit 85f2eca

Please sign in to comment.