Auto merge of #111671 - Dylan-DPC:rollup-1jy5r16, r=Dylan-DPC
Rollup of 6 pull requests Successful merges: - #110145 (Share slice of bytes) - #111043 (Stabilize feature `cstr_is_empty`) - #111648 (Remove `LangItems::require`) - #111649 (Add derive for `core::marker::ConstParamTy`) - #111654 (Add a conversion from `&mut T` to `&mut UnsafeCell<T>`) - #111661 (Erase regions of type in `offset_of!`) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
This commit is contained in:
commit
c2ccc855e7
34 changed files with 232 additions and 83 deletions
|
@ -1,5 +1,5 @@
|
|||
use rustc_macros::Diagnostic;
|
||||
use rustc_span::Span;
|
||||
use rustc_span::{Span, Symbol};
|
||||
|
||||
use crate::ty::Ty;
|
||||
|
||||
|
@ -73,6 +73,14 @@ pub(crate) struct StrictCoherenceNeedsNegativeCoherence {
|
|||
pub attr_span: Option<Span>,
|
||||
}
|
||||
|
||||
#[derive(Diagnostic)]
|
||||
#[diag(middle_requires_lang_item)]
|
||||
pub(crate) struct RequiresLangItem {
|
||||
#[primary_span]
|
||||
pub span: Option<Span>,
|
||||
pub name: Symbol,
|
||||
}
|
||||
|
||||
#[derive(Diagnostic)]
|
||||
#[diag(middle_const_not_used_in_type_alias)]
|
||||
pub(super) struct ConstNotUsedTraitAlias {
|
||||
|
|
|
@ -18,12 +18,8 @@ impl<'tcx> TyCtxt<'tcx> {
|
|||
/// Returns the `DefId` for a given `LangItem`.
|
||||
/// If not found, fatally aborts compilation.
|
||||
pub fn require_lang_item(self, lang_item: LangItem, span: Option<Span>) -> DefId {
|
||||
self.lang_items().require(lang_item).unwrap_or_else(|err| {
|
||||
if let Some(span) = span {
|
||||
self.sess.span_fatal(span, err.to_string())
|
||||
} else {
|
||||
self.sess.fatal(err.to_string())
|
||||
}
|
||||
self.lang_items().get(lang_item).unwrap_or_else(|| {
|
||||
self.sess.emit_fatal(crate::error::RequiresLangItem { span, name: lang_item.name() });
|
||||
})
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue