Auto merge of #125077 - spastorino:add-new-fnsafety-enum2, r=jackh726
Rename Unsafe to Safety Alternative to #124455, which is to just have one Safety enum to use everywhere, this opens the posibility of adding `ast::Safety::Safe` that's useful for unsafe extern blocks. This leaves us today with: ```rust enum ast::Safety { Unsafe(Span), Default, // Safe (going to be added for unsafe extern blocks) } enum hir::Safety { Unsafe, Safe, } ``` We would convert from `ast::Safety::Default` into the right Safety level according the context.
This commit is contained in:
commit
eb1a5c9bb3
115 changed files with 460 additions and 494 deletions
|
@ -205,9 +205,9 @@ impl<'tcx> TypeErrCtxt<'_, 'tcx> {
|
|||
|
||||
if self_ty.is_fn() {
|
||||
let fn_sig = self_ty.fn_sig(self.tcx);
|
||||
let shortname = match fn_sig.unsafety() {
|
||||
hir::Unsafety::Normal => "fn",
|
||||
hir::Unsafety::Unsafe => "unsafe fn",
|
||||
let shortname = match fn_sig.safety() {
|
||||
hir::Safety::Safe => "fn",
|
||||
hir::Safety::Unsafe => "unsafe fn",
|
||||
};
|
||||
flags.push((sym::_Self, Some(shortname.to_owned())));
|
||||
}
|
||||
|
|
|
@ -1897,7 +1897,7 @@ impl<'tcx> TypeErrCtxt<'_, 'tcx> {
|
|||
*inputs,
|
||||
infcx.next_ty_var(DUMMY_SP),
|
||||
false,
|
||||
hir::Unsafety::Normal,
|
||||
hir::Safety::Safe,
|
||||
abi::Abi::Rust,
|
||||
)
|
||||
}
|
||||
|
@ -1905,7 +1905,7 @@ impl<'tcx> TypeErrCtxt<'_, 'tcx> {
|
|||
[inputs],
|
||||
infcx.next_ty_var(DUMMY_SP),
|
||||
false,
|
||||
hir::Unsafety::Normal,
|
||||
hir::Safety::Safe,
|
||||
abi::Abi::Rust,
|
||||
),
|
||||
};
|
||||
|
@ -3925,7 +3925,7 @@ impl<'tcx> TypeErrCtxt<'_, 'tcx> {
|
|||
&& let fn_sig @ ty::FnSig {
|
||||
abi: abi::Abi::Rust,
|
||||
c_variadic: false,
|
||||
unsafety: hir::Unsafety::Normal,
|
||||
safety: hir::Safety::Safe,
|
||||
..
|
||||
} = fn_ty.fn_sig(tcx).skip_binder()
|
||||
|
||||
|
|
|
@ -1712,7 +1712,7 @@ fn confirm_closure_candidate<'cx, 'tcx>(
|
|||
[sig.tupled_inputs_ty],
|
||||
output_ty,
|
||||
sig.c_variadic,
|
||||
sig.unsafety,
|
||||
sig.safety,
|
||||
sig.abi,
|
||||
)
|
||||
})
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue