-
-
Notifications
You must be signed in to change notification settings - Fork 14.9k
rustc_on_unimplemented is not std-agnostic #112923
Copy link
Copy link
Open
Labels
A-diagnosticsArea: Messages for errors, warnings, and lintsArea: Messages for errors, warnings, and lintsC-bugCategory: This is a bug.Category: This is a bug.D-confusingDiagnostics: Confusing error or lint that should be reworked.Diagnostics: Confusing error or lint that should be reworked.D-diagnostic-infraDiagnostics: Issues that affect all diagnostics, or relate to the diagnostic machinery itself.Diagnostics: Issues that affect all diagnostics, or relate to the diagnostic machinery itself.
Metadata
Metadata
Assignees
Labels
A-diagnosticsArea: Messages for errors, warnings, and lintsArea: Messages for errors, warnings, and lintsC-bugCategory: This is a bug.Category: This is a bug.D-confusingDiagnostics: Confusing error or lint that should be reworked.Diagnostics: Confusing error or lint that should be reworked.D-diagnostic-infraDiagnostics: Issues that affect all diagnostics, or relate to the diagnostic machinery itself.Diagnostics: Issues that affect all diagnostics, or relate to the diagnostic machinery itself.
Type
Fields
Give feedbackNo fields configured for issues without a type.
If
rustc_on_unimplementedcontains a path mentioningstd::, it won't work in#![no_std]crates, even if the type exists in thecore. Similarly if you usecore::path instead, the diagnostic will only work in#![no_std]crates.As an example take this annotation for
?desugaring:rust/library/core/src/ops/try_trait.rs
Lines 250 to 260 in fa06a37
It should (and does) trigger for the following code:
(play;note the use
.ok()?label)However, if you add
#![no_std]the label disappears:(play; the error message is also misleading, the function does return option)
rustc in general is not great at being std-agnostic in diagnostics, and this is just another annoying example of that.
Meta
rustc --version --verbose: