Auto merge of #103671 - matthiaskrgr:rollup-iuugpep, r=matthiaskrgr
Rollup of 5 pull requests Successful merges: - #102642 (Add tests for static async functions in traits) - #103283 (Add suggestions for unsafe impl error codes) - #103523 (Fix unwanted merge of inline doc comments for impl blocks) - #103550 (diagnostics: do not suggest static candidates as traits to import) - #103641 (Don't carry MIR location in `ConstraintCategory::CallArgument`) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
This commit is contained in:
commit
a9ef10019f
62 changed files with 928 additions and 114 deletions
|
@ -26,6 +26,12 @@ pub(super) fn check_item(tcx: TyCtxt<'_>, def_id: LocalDefId) {
|
|||
"implementing the trait `{}` is not unsafe",
|
||||
trait_ref.print_only_trait_path()
|
||||
)
|
||||
.span_suggestion_verbose(
|
||||
item.span.with_hi(item.span.lo() + rustc_span::BytePos(7)),
|
||||
"remove `unsafe` from this trait implementation",
|
||||
"",
|
||||
rustc_errors::Applicability::MachineApplicable,
|
||||
)
|
||||
.emit();
|
||||
}
|
||||
|
||||
|
@ -37,6 +43,18 @@ pub(super) fn check_item(tcx: TyCtxt<'_>, def_id: LocalDefId) {
|
|||
"the trait `{}` requires an `unsafe impl` declaration",
|
||||
trait_ref.print_only_trait_path()
|
||||
)
|
||||
.note(format!(
|
||||
"the trait `{}` enforces invariants that the compiler can't check. \
|
||||
Review the trait documentation and make sure this implementation \
|
||||
upholds those invariants before adding the `unsafe` keyword",
|
||||
trait_ref.print_only_trait_path()
|
||||
))
|
||||
.span_suggestion_verbose(
|
||||
item.span.shrink_to_lo(),
|
||||
"add `unsafe` to this trait implementation",
|
||||
"unsafe ",
|
||||
rustc_errors::Applicability::MaybeIncorrect,
|
||||
)
|
||||
.emit();
|
||||
}
|
||||
|
||||
|
@ -48,6 +66,18 @@ pub(super) fn check_item(tcx: TyCtxt<'_>, def_id: LocalDefId) {
|
|||
"requires an `unsafe impl` declaration due to `#[{}]` attribute",
|
||||
attr_name
|
||||
)
|
||||
.note(format!(
|
||||
"the trait `{}` enforces invariants that the compiler can't check. \
|
||||
Review the trait documentation and make sure this implementation \
|
||||
upholds those invariants before adding the `unsafe` keyword",
|
||||
trait_ref.print_only_trait_path()
|
||||
))
|
||||
.span_suggestion_verbose(
|
||||
item.span.shrink_to_lo(),
|
||||
"add `unsafe` to this trait implementation",
|
||||
"unsafe ",
|
||||
rustc_errors::Applicability::MaybeIncorrect,
|
||||
)
|
||||
.emit();
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue