Skip to content

Commit 65ddf28

Browse files
authored
Rollup merge of rust-lang#61111 - Cerberuser:patch-1, r=steveklabnik
Fixed type-alias-bounds lint doc The example code under type-alias-bounds lint produced two warnings - one from the lint itself and another from the dead_code lint, and only the second one was in the doc. This looked like an error, so I've added `#[allow(dead_code)]` and replaced the example output with the expected one. [Playground](https://play.rust-lang.org/?version=stable&mode=debug&edition=2018&code=%23%5Ballow(dead_code)%5D%0Atype%20SendVec%3CT%3A%20Send%3E%20%3D%20Vec%3CT%3E%3B) According to guidelines, r? @steveklabnik
2 parents f8b3ebe + 9be8b7e commit 65ddf28

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

src/doc/rustc/src/lints/listing/warn-by-default.md

+7-4
Original file line numberDiff line numberDiff line change
@@ -529,18 +529,21 @@ This lint detects bounds in type aliases. These are not currently enforced.
529529
Some example code that triggers this lint:
530530

531531
```rust
532+
#[allow(dead_code)]
532533
type SendVec<T: Send> = Vec<T>;
533534
```
534535

535536
This will produce:
536537

537538
```text
538-
warning: type alias is never used: `SendVec`
539-
--> src/main.rs:1:1
539+
warning: bounds on generic parameters are not enforced in type aliases
540+
--> src/lib.rs:2:17
540541
|
541-
1 | type SendVec<T: Send> = Vec<T>;
542-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
542+
2 | type SendVec<T: Send> = Vec<T>;
543+
| ^^^^
543544
|
545+
= note: #[warn(type_alias_bounds)] on by default
546+
= help: the bound will not be checked when the type alias is used, and should be removed
544547
```
545548

546549
## tyvar-behind-raw-pointer

0 commit comments

Comments
 (0)