Auto merge of #95889 - Dylan-DPC:rollup-1cmywu4, r=Dylan-DPC
Rollup of 7 pull requests Successful merges: - #95566 (Avoid duplication of doc comments in `std::char` constants and functions) - #95784 (Suggest replacing `typeof(...)` with an actual type) - #95807 (Suggest adding a local for vector to fix borrowck errors) - #95849 (Check for git submodules in non-git source tree.) - #95852 (Fix missing space in lossy provenance cast lint) - #95857 (Allow multiple derefs to be splitted in deref_separator) - #95868 (rustdoc: Reduce allocations in a `html::markdown` function) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
This commit is contained in:
commit
1f7fb6413d
22 changed files with 333 additions and 235 deletions
|
@ -2460,8 +2460,16 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
|
|||
self.normalize_ty(ast_ty.span, array_ty)
|
||||
}
|
||||
hir::TyKind::Typeof(ref e) => {
|
||||
tcx.sess.emit_err(TypeofReservedKeywordUsed { span: ast_ty.span });
|
||||
tcx.type_of(tcx.hir().local_def_id(e.hir_id))
|
||||
let ty = tcx.type_of(tcx.hir().local_def_id(e.hir_id));
|
||||
let span = ast_ty.span;
|
||||
tcx.sess.emit_err(TypeofReservedKeywordUsed {
|
||||
span,
|
||||
ty,
|
||||
opt_sugg: Some((span, Applicability::MachineApplicable))
|
||||
.filter(|_| ty.is_suggestable()),
|
||||
});
|
||||
|
||||
ty
|
||||
}
|
||||
hir::TyKind::Infer => {
|
||||
// Infer also appears as the type of arguments or return
|
||||
|
|
|
@ -1012,7 +1012,7 @@ impl<'a, 'tcx> CastCheck<'tcx> {
|
|||
err.help(msg);
|
||||
}
|
||||
err.help(
|
||||
"if you can't comply with strict provenance and need to expose the pointer\
|
||||
"if you can't comply with strict provenance and need to expose the pointer \
|
||||
provenance you can use `.expose_addr()` instead"
|
||||
);
|
||||
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
//! Errors emitted by typeck.
|
||||
use rustc_errors::Applicability;
|
||||
use rustc_macros::SessionDiagnostic;
|
||||
use rustc_middle::ty::Ty;
|
||||
use rustc_span::{symbol::Ident, Span, Symbol};
|
||||
|
||||
#[derive(SessionDiagnostic)]
|
||||
|
@ -127,10 +129,13 @@ pub struct FunctionalRecordUpdateOnNonStruct {
|
|||
|
||||
#[derive(SessionDiagnostic)]
|
||||
#[error(code = "E0516", slug = "typeck-typeof-reserved-keyword-used")]
|
||||
pub struct TypeofReservedKeywordUsed {
|
||||
pub struct TypeofReservedKeywordUsed<'tcx> {
|
||||
pub ty: Ty<'tcx>,
|
||||
#[primary_span]
|
||||
#[label]
|
||||
pub span: Span,
|
||||
#[suggestion_verbose(message = "suggestion", code = "{ty}")]
|
||||
pub opt_sugg: Option<(Span, Applicability)>,
|
||||
}
|
||||
|
||||
#[derive(SessionDiagnostic)]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue