Rollup merge of #119216 - weiznich:use_diagnostic_namespace_in_stdlib, r=compiler-errors

Use diagnostic namespace in stdlib

This required a minor fix to have the diagnostics shown in third party crates when the `diagnostic_namespace` feature is not enabled. See 5d63f5d8d1 for details. I've opted for having a single PR for both changes as it's really not that much code. If it is required it should be easy to split up the change into several PR's.

r? `@compiler-errors`
This commit is contained in:
Michael Goulet 2024-01-05 23:41:41 -05:00 committed by GitHub
commit d90c702566
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
14 changed files with 80 additions and 33 deletions

View file

@ -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)
}
}