This repository was archived by the owner on May 28, 2025. It is now read-only.
Commit f415c07
committed
Auto merge of rust-lang#133522 - estebank:dont-suggest-unstable-trait, r=compiler-errors
Don't suggest restricting bound with unstable traits on stable and mention it's unstable on nightly
On nightly, we mention the trait is unstable
```
error[E0277]: the trait bound `T: Unstable` is not satisfied
--> $DIR/unstable-trait-suggestion.rs:13:9
|
LL | foo(t)
| --- ^ the trait `Unstable` is not implemented for `T`
| |
| required by a bound introduced by this call
|
note: required by a bound in `foo`
--> $DIR/unstable-trait-suggestion.rs:9:11
|
LL | fn foo<T: Unstable>(_: T) {}
| ^^^^^^^^ required by this bound in `foo`
help: consider restricting type parameter `T` but it is an `unstable` trait
|
LL | pub fn demo<T: Unstable>(t: T) {
| ++++++++++
```
On stable, we don't suggest the trait at all
```
error[E0277]: the trait bound `T: Unstable` is not satisfied
--> $DIR/unstable-trait-suggestion.rs:13:9
|
LL | foo(t)
| --- ^ the trait `Unstable` is not implemented for `T`
| |
| required by a bound introduced by this call
|
note: required by a bound in `foo`
--> $DIR/unstable-trait-suggestion.rs:9:11
|
LL | fn foo<T: Unstable>(_: T) {}
| ^^^^^^^^ required by this bound in `foo`
```
Fix rust-lang#133511.File tree
160 files changed
+486
-374
lines changed- compiler
- rustc_borrowck/src/diagnostics
- rustc_const_eval/src/check_consts
- rustc_hir_analysis/src/hir_ty_lowering
- rustc_middle/src/ty
- tests
- run-make/missing-unstable-trait-bound
- rustdoc-ui
- issues
- synthetic-auto-trait-impls
- ui
- associated-types
- async-await
- auto-traits
- binop
- borrowck
- builtin-superkinds
- closures
- coherence/fuzzing
- const-generics/issues
- consts
- dropck
- error-codes
- errors
- trait-bound-error-spans
- traits
- generic-associated-types
- higher-ranked
- trait-bounds
- normalize-under-binder
- impl-trait
- in-trait
- issues
- kindck
- layout
- lazy-type-alias
- methods
- mir/validate
- missing-trait-bounds
- moves
- regions
- resolve
- specialization
- defaultimpl
- min_specialization
- suggestions
- trait-bounds
- traits
- alias
- bound
- const-traits
- inductive-overflow
- inheritance
- next-solver
- diagnostics
- tuple
- type-alias-impl-trait
- type-alias
- typeck
- type
- type-check
- union
- unop
- wf
- where-clauses
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
160 files changed
+486
-374
lines changedLines changed: 4 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1450 | 1450 | | |
1451 | 1451 | | |
1452 | 1452 | | |
| 1453 | + | |
1453 | 1454 | | |
1454 | 1455 | | |
1455 | 1456 | | |
| |||
1463 | 1464 | | |
1464 | 1465 | | |
1465 | 1466 | | |
1466 | | - | |
1467 | | - | |
1468 | | - | |
| 1467 | + | |
| 1468 | + | |
| 1469 | + | |
1469 | 1470 | | |
1470 | 1471 | | |
1471 | 1472 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
140 | 140 | | |
141 | 141 | | |
142 | 142 | | |
143 | | - | |
| 143 | + | |
144 | 144 | | |
145 | 145 | | |
146 | 146 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
279 | 279 | | |
280 | 280 | | |
281 | 281 | | |
282 | | - | |
| 282 | + | |
| 283 | + | |
| 284 | + | |
| 285 | + | |
| 286 | + | |
| 287 | + | |
| 288 | + | |
283 | 289 | | |
284 | 290 | | |
285 | 291 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | | - | |
4 | 3 | | |
5 | 4 | | |
6 | 5 | | |
7 | 6 | | |
8 | | - | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
9 | 10 | | |
10 | 11 | | |
11 | 12 | | |
| |||
161 | 162 | | |
162 | 163 | | |
163 | 164 | | |
164 | | - | |
| 165 | + | |
165 | 166 | | |
166 | 167 | | |
167 | 168 | | |
| |||
172 | 173 | | |
173 | 174 | | |
174 | 175 | | |
175 | | - | |
| 176 | + | |
176 | 177 | | |
177 | 178 | | |
178 | 179 | | |
| |||
207 | 208 | | |
208 | 209 | | |
209 | 210 | | |
210 | | - | |
| 211 | + | |
| 212 | + | |
211 | 213 | | |
212 | 214 | | |
213 | 215 | | |
| |||
278 | 280 | | |
279 | 281 | | |
280 | 282 | | |
| 283 | + | |
281 | 284 | | |
282 | | - | |
| 285 | + | |
| 286 | + | |
| 287 | + | |
| 288 | + | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
| 298 | + | |
| 299 | + | |
| 300 | + | |
| 301 | + | |
283 | 302 | | |
284 | 303 | | |
285 | 304 | | |
| |||
290 | 309 | | |
291 | 310 | | |
292 | 311 | | |
293 | | - | |
| 312 | + | |
294 | 313 | | |
295 | 314 | | |
296 | | - | |
| 315 | + | |
297 | 316 | | |
298 | 317 | | |
299 | 318 | | |
300 | 319 | | |
301 | 320 | | |
302 | 321 | | |
| 322 | + | |
| 323 | + | |
| 324 | + | |
| 325 | + | |
| 326 | + | |
303 | 327 | | |
304 | 328 | | |
305 | 329 | | |
| |||
312 | 336 | | |
313 | 337 | | |
314 | 338 | | |
315 | | - | |
| 339 | + | |
316 | 340 | | |
317 | 341 | | |
318 | 342 | | |
319 | 343 | | |
320 | 344 | | |
321 | | - | |
| 345 | + | |
322 | 346 | | |
323 | 347 | | |
| 348 | + | |
| 349 | + | |
| 350 | + | |
| 351 | + | |
| 352 | + | |
| 353 | + | |
| 354 | + | |
| 355 | + | |
| 356 | + | |
| 357 | + | |
| 358 | + | |
| 359 | + | |
| 360 | + | |
| 361 | + | |
| 362 | + | |
| 363 | + | |
| 364 | + | |
| 365 | + | |
| 366 | + | |
| 367 | + | |
| 368 | + | |
| 369 | + | |
| 370 | + | |
| 371 | + | |
| 372 | + | |
| 373 | + | |
| 374 | + | |
| 375 | + | |
| 376 | + | |
| 377 | + | |
| 378 | + | |
| 379 | + | |
| 380 | + | |
| 381 | + | |
| 382 | + | |
| 383 | + | |
| 384 | + | |
| 385 | + | |
| 386 | + | |
324 | 387 | | |
325 | 388 | | |
326 | 389 | | |
| |||
333 | 396 | | |
334 | 397 | | |
335 | 398 | | |
336 | | - | |
337 | | - | |
338 | 399 | | |
339 | | - | |
340 | | - | |
| 400 | + | |
| 401 | + | |
341 | 402 | | |
342 | | - | |
| 403 | + | |
343 | 404 | | |
344 | 405 | | |
345 | 406 | | |
| |||
397 | 458 | | |
398 | 459 | | |
399 | 460 | | |
400 | | - | |
| 461 | + | |
| 462 | + | |
401 | 463 | | |
402 | 464 | | |
403 | 465 | | |
| |||
426 | 488 | | |
427 | 489 | | |
428 | 490 | | |
| 491 | + | |
429 | 492 | | |
430 | 493 | | |
431 | 494 | | |
| |||
439 | 502 | | |
440 | 503 | | |
441 | 504 | | |
| 505 | + | |
442 | 506 | | |
443 | 507 | | |
444 | 508 | | |
| |||
451 | 515 | | |
452 | 516 | | |
453 | 517 | | |
| 518 | + | |
454 | 519 | | |
455 | 520 | | |
456 | 521 | | |
| |||
459 | 524 | | |
460 | 525 | | |
461 | 526 | | |
462 | | - | |
| 527 | + | |
463 | 528 | | |
464 | | - | |
| 529 | + | |
465 | 530 | | |
466 | | - | |
| 531 | + | |
467 | 532 | | |
468 | 533 | | |
469 | | - | |
| 534 | + | |
| 535 | + | |
| 536 | + | |
| 537 | + | |
| 538 | + | |
| 539 | + | |
| 540 | + | |
470 | 541 | | |
471 | 542 | | |
472 | | - | |
| 543 | + | |
473 | 544 | | |
474 | 545 | | |
475 | | - | |
| 546 | + | |
476 | 547 | | |
477 | 548 | | |
478 | | - | |
| 549 | + | |
479 | 550 | | |
480 | 551 | | |
481 | | - | |
| 552 | + | |
482 | 553 | | |
483 | 554 | | |
484 | 555 | | |
485 | 556 | | |
486 | 557 | | |
| 558 | + | |
487 | 559 | | |
488 | | - | |
489 | | - | |
| 560 | + | |
| 561 | + | |
490 | 562 | | |
491 | 563 | | |
492 | 564 | | |
493 | 565 | | |
494 | | - | |
| 566 | + | |
495 | 567 | | |
496 | 568 | | |
497 | 569 | | |
| |||
Lines changed: 4 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
Lines changed: 12 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
7 | | - | |
| 7 | + | |
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
| |||
16 | 16 | | |
17 | 17 | | |
18 | 18 | | |
19 | | - | |
| 19 | + | |
20 | 20 | | |
21 | 21 | | |
22 | 22 | | |
| |||
Lines changed: 2 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
7 | | - | |
| 7 | + | |
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
| |||
15 | 15 | | |
16 | 16 | | |
17 | 17 | | |
18 | | - | |
| 18 | + | |
19 | 19 | | |
20 | 20 | | |
21 | 21 | | |
| |||
0 commit comments