diff options
| author | Georg Semmler <github@weiznich.de> | 2023-12-21 14:02:58 +0100 |
|---|---|---|
| committer | Georg Semmler <github@weiznich.de> | 2024-01-05 15:23:09 +0100 |
| commit | ddfcf86867e4a8f29ea235ee700aa89a8b6ddf21 (patch) | |
| tree | 382aa9e349fb606a39b70f27194013198292bbfa | |
| parent | 8d39ec1825024f3014e1f847942ac5bbfcf055b0 (diff) | |
| download | rust-ddfcf86867e4a8f29ea235ee700aa89a8b6ddf21.tar.gz rust-ddfcf86867e4a8f29ea235ee700aa89a8b6ddf21.zip | |
Allow emitting diagnostics from the `#[diagnostic]` namespace without a
nightly feature (Using this attribute still requires a nightly feature, this just enables that this feature does not need to be enabled on the child crate as well)
| -rw-r--r-- | compiler/rustc_trait_selection/src/traits/error_reporting/on_unimplemented.rs | 4 |
1 files changed, 1 insertions, 3 deletions
diff --git a/compiler/rustc_trait_selection/src/traits/error_reporting/on_unimplemented.rs b/compiler/rustc_trait_selection/src/traits/error_reporting/on_unimplemented.rs index 52f91d282f0..c9e8b30c4c4 100644 --- a/compiler/rustc_trait_selection/src/traits/error_reporting/on_unimplemented.rs +++ b/compiler/rustc_trait_selection/src/traits/error_reporting/on_unimplemented.rs @@ -521,7 +521,7 @@ impl<'tcx> OnUnimplementedDirective { pub fn of_item(tcx: TyCtxt<'tcx>, item_def_id: DefId) -> Result<Option<Self>, ErrorGuaranteed> { if let Some(attr) = tcx.get_attr(item_def_id, sym::rustc_on_unimplemented) { return Self::parse_attribute(attr, false, tcx, item_def_id); - } else if tcx.features().diagnostic_namespace { + } else { tcx.get_attrs_by_path(item_def_id, &[sym::diagnostic, sym::on_unimplemented]) .filter_map(|attr| Self::parse_attribute(attr, true, tcx, item_def_id).transpose()) .try_fold(None, |aggr: Option<Self>, directive| { @@ -592,8 +592,6 @@ impl<'tcx> OnUnimplementedDirective { Ok(Some(directive)) } }) - } else { - Ok(None) } } |
