mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-25 08:13:41 +00:00
Use bool in favor of Option<()> for diagnostics
This commit is contained in:
parent
4d5b3b1962
commit
25ff9b6bcb
@ -86,9 +86,8 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
|
|||||||
// Multiple different abi names may actually be the same ABI
|
// Multiple different abi names may actually be the same ABI
|
||||||
// If the specified ABIs are not the same name, alert the user that they resolve to the same ABI
|
// If the specified ABIs are not the same name, alert the user that they resolve to the same ABI
|
||||||
let source_map = self.tcx.sess.source_map();
|
let source_map = self.tcx.sess.source_map();
|
||||||
let equivalent = (source_map.span_to_snippet(*prev_sp)
|
let equivalent = source_map.span_to_snippet(*prev_sp)
|
||||||
!= source_map.span_to_snippet(*abi_span))
|
!= source_map.span_to_snippet(*abi_span);
|
||||||
.then_some(());
|
|
||||||
|
|
||||||
self.dcx().emit_err(AbiSpecifiedMultipleTimes {
|
self.dcx().emit_err(AbiSpecifiedMultipleTimes {
|
||||||
abi_span: *abi_span,
|
abi_span: *abi_span,
|
||||||
|
@ -184,7 +184,7 @@ pub struct AbiSpecifiedMultipleTimes {
|
|||||||
#[label]
|
#[label]
|
||||||
pub prev_span: Span,
|
pub prev_span: Span,
|
||||||
#[note]
|
#[note]
|
||||||
pub equivalent: Option<()>,
|
pub equivalent: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Diagnostic)]
|
#[derive(Diagnostic)]
|
||||||
|
@ -963,14 +963,13 @@ impl<'a> Visitor<'a> for AstValidator<'a> {
|
|||||||
self_ty,
|
self_ty,
|
||||||
items,
|
items,
|
||||||
}) => {
|
}) => {
|
||||||
let error =
|
let error = |annotation_span, annotation, only_trait| errors::InherentImplCannot {
|
||||||
|annotation_span, annotation, only_trait: bool| errors::InherentImplCannot {
|
span: self_ty.span,
|
||||||
span: self_ty.span,
|
annotation_span,
|
||||||
annotation_span,
|
annotation,
|
||||||
annotation,
|
self_ty: self_ty.span,
|
||||||
self_ty: self_ty.span,
|
only_trait,
|
||||||
only_trait: only_trait.then_some(()),
|
};
|
||||||
};
|
|
||||||
|
|
||||||
self.with_in_trait_impl(None, |this| {
|
self.with_in_trait_impl(None, |this| {
|
||||||
this.visibility_not_permitted(
|
this.visibility_not_permitted(
|
||||||
@ -1195,7 +1194,7 @@ impl<'a> Visitor<'a> for AstValidator<'a> {
|
|||||||
} else if where_clauses.after.has_where_token {
|
} else if where_clauses.after.has_where_token {
|
||||||
self.dcx().emit_err(errors::WhereClauseAfterTypeAlias {
|
self.dcx().emit_err(errors::WhereClauseAfterTypeAlias {
|
||||||
span: where_clauses.after.span,
|
span: where_clauses.after.span,
|
||||||
help: self.session.is_nightly_build().then_some(()),
|
help: self.session.is_nightly_build(),
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -484,7 +484,7 @@ pub struct InherentImplCannot<'a> {
|
|||||||
#[label(ast_passes_type)]
|
#[label(ast_passes_type)]
|
||||||
pub self_ty: Span,
|
pub self_ty: Span,
|
||||||
#[note(ast_passes_only_trait)]
|
#[note(ast_passes_only_trait)]
|
||||||
pub only_trait: Option<()>,
|
pub only_trait: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Diagnostic)]
|
#[derive(Diagnostic)]
|
||||||
@ -528,7 +528,7 @@ pub struct WhereClauseAfterTypeAlias {
|
|||||||
#[primary_span]
|
#[primary_span]
|
||||||
pub span: Span,
|
pub span: Span,
|
||||||
#[help]
|
#[help]
|
||||||
pub help: Option<()>,
|
pub help: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Diagnostic)]
|
#[derive(Diagnostic)]
|
||||||
|
@ -846,7 +846,7 @@ pub fn find_deprecation(
|
|||||||
sess.dcx().emit_err(
|
sess.dcx().emit_err(
|
||||||
session_diagnostics::DeprecatedItemSuggestion {
|
session_diagnostics::DeprecatedItemSuggestion {
|
||||||
span: mi.span,
|
span: mi.span,
|
||||||
is_nightly: sess.is_nightly_build().then_some(()),
|
is_nightly: sess.is_nightly_build(),
|
||||||
details: (),
|
details: (),
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
@ -342,7 +342,7 @@ pub(crate) struct DeprecatedItemSuggestion {
|
|||||||
pub span: Span,
|
pub span: Span,
|
||||||
|
|
||||||
#[help]
|
#[help]
|
||||||
pub is_nightly: Option<()>,
|
pub is_nightly: bool,
|
||||||
|
|
||||||
#[note]
|
#[note]
|
||||||
pub details: (),
|
pub details: (),
|
||||||
|
@ -384,7 +384,7 @@ impl<'tcx> NonConstOp<'tcx> for HeapAllocation {
|
|||||||
ccx.dcx().create_err(errors::UnallowedHeapAllocations {
|
ccx.dcx().create_err(errors::UnallowedHeapAllocations {
|
||||||
span,
|
span,
|
||||||
kind: ccx.const_kind(),
|
kind: ccx.const_kind(),
|
||||||
teach: ccx.tcx.sess.teach(E0010).then_some(()),
|
teach: ccx.tcx.sess.teach(E0010),
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -444,16 +444,16 @@ impl<'tcx> NonConstOp<'tcx> for CellBorrow {
|
|||||||
if let hir::ConstContext::Static(_) = ccx.const_kind() {
|
if let hir::ConstContext::Static(_) = ccx.const_kind() {
|
||||||
ccx.dcx().create_err(errors::InteriorMutableDataRefer {
|
ccx.dcx().create_err(errors::InteriorMutableDataRefer {
|
||||||
span,
|
span,
|
||||||
opt_help: Some(()),
|
opt_help: true,
|
||||||
kind: ccx.const_kind(),
|
kind: ccx.const_kind(),
|
||||||
teach: ccx.tcx.sess.teach(E0492).then_some(()),
|
teach: ccx.tcx.sess.teach(E0492),
|
||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
ccx.dcx().create_err(errors::InteriorMutableDataRefer {
|
ccx.dcx().create_err(errors::InteriorMutableDataRefer {
|
||||||
span,
|
span,
|
||||||
opt_help: None,
|
opt_help: false,
|
||||||
kind: ccx.const_kind(),
|
kind: ccx.const_kind(),
|
||||||
teach: ccx.tcx.sess.teach(E0492).then_some(()),
|
teach: ccx.tcx.sess.teach(E0492),
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -481,12 +481,12 @@ impl<'tcx> NonConstOp<'tcx> for MutBorrow {
|
|||||||
hir::BorrowKind::Raw => ccx.tcx.dcx().create_err(errors::UnallowedMutableRaw {
|
hir::BorrowKind::Raw => ccx.tcx.dcx().create_err(errors::UnallowedMutableRaw {
|
||||||
span,
|
span,
|
||||||
kind: ccx.const_kind(),
|
kind: ccx.const_kind(),
|
||||||
teach: ccx.tcx.sess.teach(E0764).then_some(()),
|
teach: ccx.tcx.sess.teach(E0764),
|
||||||
}),
|
}),
|
||||||
hir::BorrowKind::Ref => ccx.dcx().create_err(errors::UnallowedMutableRefs {
|
hir::BorrowKind::Ref => ccx.dcx().create_err(errors::UnallowedMutableRefs {
|
||||||
span,
|
span,
|
||||||
kind: ccx.const_kind(),
|
kind: ccx.const_kind(),
|
||||||
teach: ccx.tcx.sess.teach(E0764).then_some(()),
|
teach: ccx.tcx.sess.teach(E0764),
|
||||||
}),
|
}),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -151,7 +151,7 @@ pub(crate) struct UnallowedMutableRefs {
|
|||||||
pub span: Span,
|
pub span: Span,
|
||||||
pub kind: ConstContext,
|
pub kind: ConstContext,
|
||||||
#[note(const_eval_teach_note)]
|
#[note(const_eval_teach_note)]
|
||||||
pub teach: Option<()>,
|
pub teach: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Diagnostic)]
|
#[derive(Diagnostic)]
|
||||||
@ -161,7 +161,7 @@ pub(crate) struct UnallowedMutableRaw {
|
|||||||
pub span: Span,
|
pub span: Span,
|
||||||
pub kind: ConstContext,
|
pub kind: ConstContext,
|
||||||
#[note(const_eval_teach_note)]
|
#[note(const_eval_teach_note)]
|
||||||
pub teach: Option<()>,
|
pub teach: bool,
|
||||||
}
|
}
|
||||||
#[derive(Diagnostic)]
|
#[derive(Diagnostic)]
|
||||||
#[diag(const_eval_non_const_fmt_macro_call, code = E0015)]
|
#[diag(const_eval_non_const_fmt_macro_call, code = E0015)]
|
||||||
@ -196,7 +196,7 @@ pub(crate) struct UnallowedHeapAllocations {
|
|||||||
pub span: Span,
|
pub span: Span,
|
||||||
pub kind: ConstContext,
|
pub kind: ConstContext,
|
||||||
#[note(const_eval_teach_note)]
|
#[note(const_eval_teach_note)]
|
||||||
pub teach: Option<()>,
|
pub teach: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Diagnostic)]
|
#[derive(Diagnostic)]
|
||||||
@ -214,10 +214,10 @@ pub(crate) struct InteriorMutableDataRefer {
|
|||||||
#[label]
|
#[label]
|
||||||
pub span: Span,
|
pub span: Span,
|
||||||
#[help]
|
#[help]
|
||||||
pub opt_help: Option<()>,
|
pub opt_help: bool,
|
||||||
pub kind: ConstContext,
|
pub kind: ConstContext,
|
||||||
#[note(const_eval_teach_note)]
|
#[note(const_eval_teach_note)]
|
||||||
pub teach: Option<()>,
|
pub teach: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Diagnostic)]
|
#[derive(Diagnostic)]
|
||||||
|
@ -281,7 +281,7 @@ pub(crate) struct IncompleteParse<'a> {
|
|||||||
pub macro_path: &'a ast::Path,
|
pub macro_path: &'a ast::Path,
|
||||||
pub kind_name: &'a str,
|
pub kind_name: &'a str,
|
||||||
#[note(expand_macro_expands_to_match_arm)]
|
#[note(expand_macro_expands_to_match_arm)]
|
||||||
pub expands_to_match_arm: Option<()>,
|
pub expands_to_match_arm: bool,
|
||||||
|
|
||||||
#[suggestion(
|
#[suggestion(
|
||||||
expand_suggestion_add_semi,
|
expand_suggestion_add_semi,
|
||||||
|
@ -1031,7 +1031,7 @@ pub(crate) fn ensure_complete_parse<'a>(
|
|||||||
label_span: span,
|
label_span: span,
|
||||||
macro_path,
|
macro_path,
|
||||||
kind_name,
|
kind_name,
|
||||||
expands_to_match_arm: expands_to_match_arm.then_some(()),
|
expands_to_match_arm,
|
||||||
add_semicolon,
|
add_semicolon,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -1564,7 +1564,7 @@ fn check_type_alias_type_params_are_used<'tcx>(tcx: TyCtxt<'tcx>, def_id: LocalD
|
|||||||
// * compare the param span to the pred span to detect lone user-written `Sized` bounds
|
// * compare the param span to the pred span to detect lone user-written `Sized` bounds
|
||||||
let has_explicit_bounds = bounded_params.is_empty()
|
let has_explicit_bounds = bounded_params.is_empty()
|
||||||
|| (*bounded_params).get(¶m.index).is_some_and(|&&pred_sp| pred_sp != span);
|
|| (*bounded_params).get(¶m.index).is_some_and(|&&pred_sp| pred_sp != span);
|
||||||
let const_param_help = (!has_explicit_bounds).then_some(());
|
let const_param_help = !has_explicit_bounds;
|
||||||
|
|
||||||
let mut diag = tcx.dcx().create_err(errors::UnusedGenericParameter {
|
let mut diag = tcx.dcx().create_err(errors::UnusedGenericParameter {
|
||||||
span,
|
span,
|
||||||
|
@ -1972,8 +1972,7 @@ fn report_bivariance<'tcx>(
|
|||||||
}
|
}
|
||||||
|
|
||||||
let const_param_help =
|
let const_param_help =
|
||||||
matches!(param.kind, hir::GenericParamKind::Type { .. } if !has_explicit_bounds)
|
matches!(param.kind, hir::GenericParamKind::Type { .. } if !has_explicit_bounds);
|
||||||
.then_some(());
|
|
||||||
|
|
||||||
let mut diag = tcx.dcx().create_err(errors::UnusedGenericParameter {
|
let mut diag = tcx.dcx().create_err(errors::UnusedGenericParameter {
|
||||||
span: param.span,
|
span: param.span,
|
||||||
|
@ -1606,7 +1606,7 @@ pub(crate) struct UnusedGenericParameter {
|
|||||||
#[subdiagnostic]
|
#[subdiagnostic]
|
||||||
pub help: UnusedGenericParameterHelp,
|
pub help: UnusedGenericParameterHelp,
|
||||||
#[help(hir_analysis_const_param_help)]
|
#[help(hir_analysis_const_param_help)]
|
||||||
pub const_param_help: Option<()>,
|
pub const_param_help: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Diagnostic)]
|
#[derive(Diagnostic)]
|
||||||
@ -1643,9 +1643,9 @@ pub(crate) struct UnconstrainedGenericParameter {
|
|||||||
pub param_name: Symbol,
|
pub param_name: Symbol,
|
||||||
pub param_def_kind: &'static str,
|
pub param_def_kind: &'static str,
|
||||||
#[note(hir_analysis_const_param_note)]
|
#[note(hir_analysis_const_param_note)]
|
||||||
pub const_param_note: Option<()>,
|
pub const_param_note: bool,
|
||||||
#[note(hir_analysis_const_param_note2)]
|
#[note(hir_analysis_const_param_note2)]
|
||||||
pub const_param_note2: Option<()>,
|
pub const_param_note2: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Diagnostic)]
|
#[derive(Diagnostic)]
|
||||||
|
@ -137,8 +137,7 @@ fn enforce_impl_params_are_constrained(
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
if err {
|
if err {
|
||||||
let const_param_note =
|
let const_param_note = matches!(param.kind, ty::GenericParamDefKind::Const { .. });
|
||||||
matches!(param.kind, ty::GenericParamDefKind::Const { .. }).then_some(());
|
|
||||||
let mut diag = tcx.dcx().create_err(UnconstrainedGenericParameter {
|
let mut diag = tcx.dcx().create_err(UnconstrainedGenericParameter {
|
||||||
span: tcx.def_span(param.def_id),
|
span: tcx.def_span(param.def_id),
|
||||||
param_name: param.name,
|
param_name: param.name,
|
||||||
|
@ -505,7 +505,7 @@ impl<'a, 'tcx> CastCheck<'tcx> {
|
|||||||
span: self.span,
|
span: self.span,
|
||||||
expr_ty: self.expr_ty,
|
expr_ty: self.expr_ty,
|
||||||
cast_ty: fcx.ty_to_string(self.cast_ty),
|
cast_ty: fcx.ty_to_string(self.cast_ty),
|
||||||
teach: fcx.tcx.sess.teach(E0607).then_some(()),
|
teach: fcx.tcx.sess.teach(E0607),
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
CastError::IntToFatCast(known_metadata) => {
|
CastError::IntToFatCast(known_metadata) => {
|
||||||
|
@ -706,7 +706,7 @@ pub(crate) struct CastThinPointerToFatPointer<'tcx> {
|
|||||||
pub expr_ty: Ty<'tcx>,
|
pub expr_ty: Ty<'tcx>,
|
||||||
pub cast_ty: String,
|
pub cast_ty: String,
|
||||||
#[note(hir_typeck_teach_help)]
|
#[note(hir_typeck_teach_help)]
|
||||||
pub(crate) teach: Option<()>,
|
pub(crate) teach: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Diagnostic)]
|
#[derive(Diagnostic)]
|
||||||
@ -720,7 +720,7 @@ pub(crate) struct PassToVariadicFunction<'tcx, 'a> {
|
|||||||
pub sugg_span: Option<Span>,
|
pub sugg_span: Option<Span>,
|
||||||
pub replace: String,
|
pub replace: String,
|
||||||
#[help]
|
#[help]
|
||||||
pub help: Option<()>,
|
pub help: bool,
|
||||||
#[note(hir_typeck_teach_help)]
|
#[note(hir_typeck_teach_help)]
|
||||||
pub(crate) teach: Option<()>,
|
pub(crate) teach: bool,
|
||||||
}
|
}
|
||||||
|
@ -406,9 +406,9 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
|||||||
) {
|
) {
|
||||||
let (sugg_span, replace, help) =
|
let (sugg_span, replace, help) =
|
||||||
if let Ok(snippet) = sess.source_map().span_to_snippet(span) {
|
if let Ok(snippet) = sess.source_map().span_to_snippet(span) {
|
||||||
(Some(span), format!("{snippet} as {cast_ty}"), None)
|
(Some(span), format!("{snippet} as {cast_ty}"), false)
|
||||||
} else {
|
} else {
|
||||||
(None, "".to_string(), Some(()))
|
(None, "".to_string(), true)
|
||||||
};
|
};
|
||||||
|
|
||||||
sess.dcx().emit_err(errors::PassToVariadicFunction {
|
sess.dcx().emit_err(errors::PassToVariadicFunction {
|
||||||
@ -418,7 +418,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
|||||||
help,
|
help,
|
||||||
replace,
|
replace,
|
||||||
sugg_span,
|
sugg_span,
|
||||||
teach: sess.teach(E0617).then_some(()),
|
teach: sess.teach(E0617),
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -189,10 +189,10 @@ pub struct CreateLock<'a> {
|
|||||||
pub lock_err: std::io::Error,
|
pub lock_err: std::io::Error,
|
||||||
pub session_dir: &'a Path,
|
pub session_dir: &'a Path,
|
||||||
#[note(incremental_lock_unsupported)]
|
#[note(incremental_lock_unsupported)]
|
||||||
pub is_unsupported_lock: Option<()>,
|
pub is_unsupported_lock: bool,
|
||||||
#[help(incremental_cargo_help_1)]
|
#[help(incremental_cargo_help_1)]
|
||||||
#[help(incremental_cargo_help_2)]
|
#[help(incremental_cargo_help_2)]
|
||||||
pub is_cargo: Option<()>,
|
pub is_cargo: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Diagnostic)]
|
#[derive(Diagnostic)]
|
||||||
|
@ -486,12 +486,12 @@ fn lock_directory(
|
|||||||
// the lock should be exclusive
|
// the lock should be exclusive
|
||||||
Ok(lock) => Ok((lock, lock_file_path)),
|
Ok(lock) => Ok((lock, lock_file_path)),
|
||||||
Err(lock_err) => {
|
Err(lock_err) => {
|
||||||
let is_unsupported_lock = flock::Lock::error_unsupported(&lock_err).then_some(());
|
let is_unsupported_lock = flock::Lock::error_unsupported(&lock_err);
|
||||||
Err(sess.dcx().emit_err(errors::CreateLock {
|
Err(sess.dcx().emit_err(errors::CreateLock {
|
||||||
lock_err,
|
lock_err,
|
||||||
session_dir,
|
session_dir,
|
||||||
is_unsupported_lock,
|
is_unsupported_lock,
|
||||||
is_cargo: rustc_session::utils::was_invoked_from_cargo().then_some(()),
|
is_cargo: rustc_session::utils::was_invoked_from_cargo(),
|
||||||
}))
|
}))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1330,7 +1330,7 @@ impl UnreachablePub {
|
|||||||
BuiltinUnreachablePub {
|
BuiltinUnreachablePub {
|
||||||
what,
|
what,
|
||||||
suggestion: (vis_span, applicability),
|
suggestion: (vis_span, applicability),
|
||||||
help: exportable.then_some(()),
|
help: exportable,
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -77,7 +77,7 @@ pub struct UnknownToolInScopedLint {
|
|||||||
pub tool_name: Symbol,
|
pub tool_name: Symbol,
|
||||||
pub lint_name: String,
|
pub lint_name: String,
|
||||||
#[help]
|
#[help]
|
||||||
pub is_nightly_build: Option<()>,
|
pub is_nightly_build: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Diagnostic)]
|
#[derive(Diagnostic)]
|
||||||
|
@ -24,7 +24,7 @@ fn check_expectations(tcx: TyCtxt<'_>, tool_filter: Option<Symbol>) {
|
|||||||
&& tool_filter.map_or(true, |filter| expectation.lint_tool == Some(filter))
|
&& tool_filter.map_or(true, |filter| expectation.lint_tool == Some(filter))
|
||||||
{
|
{
|
||||||
let rationale = expectation.reason.map(|rationale| ExpectationNote { rationale });
|
let rationale = expectation.reason.map(|rationale| ExpectationNote { rationale });
|
||||||
let note = expectation.is_unfulfilled_lint_expectations.then_some(());
|
let note = expectation.is_unfulfilled_lint_expectations;
|
||||||
tcx.emit_node_span_lint(
|
tcx.emit_node_span_lint(
|
||||||
UNFULFILLED_LINT_EXPECTATIONS,
|
UNFULFILLED_LINT_EXPECTATIONS,
|
||||||
*hir_id,
|
*hir_id,
|
||||||
|
@ -936,7 +936,7 @@ impl<'s, P: LintLevelsProvider> LintLevelsBuilder<'s, P> {
|
|||||||
span: tool_ident.map(|ident| ident.span),
|
span: tool_ident.map(|ident| ident.span),
|
||||||
tool_name: tool_name.unwrap(),
|
tool_name: tool_name.unwrap(),
|
||||||
lint_name: pprust::path_to_string(&meta_item.path),
|
lint_name: pprust::path_to_string(&meta_item.path),
|
||||||
is_nightly_build: sess.is_nightly_build().then_some(()),
|
is_nightly_build: sess.is_nightly_build(),
|
||||||
});
|
});
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -257,7 +257,7 @@ pub struct BuiltinUnreachablePub<'a> {
|
|||||||
#[suggestion(code = "pub(crate)")]
|
#[suggestion(code = "pub(crate)")]
|
||||||
pub suggestion: (Span, Applicability),
|
pub suggestion: (Span, Applicability),
|
||||||
#[help]
|
#[help]
|
||||||
pub help: Option<()>,
|
pub help: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(LintDiagnostic)]
|
#[derive(LintDiagnostic)]
|
||||||
@ -572,7 +572,7 @@ pub struct Expectation {
|
|||||||
#[subdiagnostic]
|
#[subdiagnostic]
|
||||||
pub rationale: Option<ExpectationNote>,
|
pub rationale: Option<ExpectationNote>,
|
||||||
#[note]
|
#[note]
|
||||||
pub note: Option<()>,
|
pub note: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Subdiagnostic)]
|
#[derive(Subdiagnostic)]
|
||||||
@ -756,7 +756,7 @@ pub enum InvalidReferenceCastingDiag<'tcx> {
|
|||||||
#[label]
|
#[label]
|
||||||
orig_cast: Option<Span>,
|
orig_cast: Option<Span>,
|
||||||
#[note(lint_invalid_reference_casting_note_ty_has_interior_mutability)]
|
#[note(lint_invalid_reference_casting_note_ty_has_interior_mutability)]
|
||||||
ty_has_interior_mutability: Option<()>,
|
ty_has_interior_mutability: bool,
|
||||||
},
|
},
|
||||||
#[diag(lint_invalid_reference_casting_assign_to_ref)]
|
#[diag(lint_invalid_reference_casting_assign_to_ref)]
|
||||||
#[note(lint_invalid_reference_casting_note_book)]
|
#[note(lint_invalid_reference_casting_note_book)]
|
||||||
@ -764,7 +764,7 @@ pub enum InvalidReferenceCastingDiag<'tcx> {
|
|||||||
#[label]
|
#[label]
|
||||||
orig_cast: Option<Span>,
|
orig_cast: Option<Span>,
|
||||||
#[note(lint_invalid_reference_casting_note_ty_has_interior_mutability)]
|
#[note(lint_invalid_reference_casting_note_ty_has_interior_mutability)]
|
||||||
ty_has_interior_mutability: Option<()>,
|
ty_has_interior_mutability: bool,
|
||||||
},
|
},
|
||||||
#[diag(lint_invalid_reference_casting_bigger_layout)]
|
#[diag(lint_invalid_reference_casting_bigger_layout)]
|
||||||
#[note(lint_layout)]
|
#[note(lint_layout)]
|
||||||
|
@ -54,8 +54,6 @@ impl<'tcx> LateLintPass<'tcx> for InvalidReferenceCasting {
|
|||||||
&& let Some(ty_has_interior_mutability) =
|
&& let Some(ty_has_interior_mutability) =
|
||||||
is_cast_from_ref_to_mut_ptr(cx, init, &mut peel_casts)
|
is_cast_from_ref_to_mut_ptr(cx, init, &mut peel_casts)
|
||||||
{
|
{
|
||||||
let ty_has_interior_mutability = ty_has_interior_mutability.then_some(());
|
|
||||||
|
|
||||||
cx.emit_span_lint(
|
cx.emit_span_lint(
|
||||||
INVALID_REFERENCE_CASTING,
|
INVALID_REFERENCE_CASTING,
|
||||||
expr.span,
|
expr.span,
|
||||||
|
@ -160,7 +160,7 @@ pub struct TypeLengthLimit {
|
|||||||
pub span: Span,
|
pub span: Span,
|
||||||
pub shrunk: String,
|
pub shrunk: String,
|
||||||
#[note(middle_written_to_path)]
|
#[note(middle_written_to_path)]
|
||||||
pub was_written: Option<()>,
|
pub was_written: bool,
|
||||||
pub path: PathBuf,
|
pub path: PathBuf,
|
||||||
pub type_length: usize,
|
pub type_length: usize,
|
||||||
}
|
}
|
||||||
|
@ -581,9 +581,9 @@ impl<'tcx> Instance<'tcx> {
|
|||||||
let mut path = PathBuf::new();
|
let mut path = PathBuf::new();
|
||||||
let was_written = if let Some(path2) = written_to_path {
|
let was_written = if let Some(path2) = written_to_path {
|
||||||
path = path2;
|
path = path2;
|
||||||
Some(())
|
true
|
||||||
} else {
|
} else {
|
||||||
None
|
false
|
||||||
};
|
};
|
||||||
tcx.dcx().emit_fatal(error::TypeLengthLimit {
|
tcx.dcx().emit_fatal(error::TypeLengthLimit {
|
||||||
// We don't use `def_span(def_id)` so that diagnostics point
|
// We don't use `def_span(def_id)` so that diagnostics point
|
||||||
|
@ -793,7 +793,7 @@ impl UnsafeOpKind {
|
|||||||
missing.iter().map(|feature| Cow::from(feature.to_string())).collect(),
|
missing.iter().map(|feature| Cow::from(feature.to_string())).collect(),
|
||||||
),
|
),
|
||||||
missing_target_features_count: missing.len(),
|
missing_target_features_count: missing.len(),
|
||||||
note: if build_enabled.is_empty() { None } else { Some(()) },
|
note: !build_enabled.is_empty(),
|
||||||
build_target_features: DiagArgValue::StrListSepByAnd(
|
build_target_features: DiagArgValue::StrListSepByAnd(
|
||||||
build_enabled
|
build_enabled
|
||||||
.iter()
|
.iter()
|
||||||
@ -958,7 +958,7 @@ impl UnsafeOpKind {
|
|||||||
missing.iter().map(|feature| Cow::from(feature.to_string())).collect(),
|
missing.iter().map(|feature| Cow::from(feature.to_string())).collect(),
|
||||||
),
|
),
|
||||||
missing_target_features_count: missing.len(),
|
missing_target_features_count: missing.len(),
|
||||||
note: if build_enabled.is_empty() { None } else { Some(()) },
|
note: !build_enabled.is_empty(),
|
||||||
build_target_features: DiagArgValue::StrListSepByAnd(
|
build_target_features: DiagArgValue::StrListSepByAnd(
|
||||||
build_enabled
|
build_enabled
|
||||||
.iter()
|
.iter()
|
||||||
@ -977,7 +977,7 @@ impl UnsafeOpKind {
|
|||||||
missing.iter().map(|feature| Cow::from(feature.to_string())).collect(),
|
missing.iter().map(|feature| Cow::from(feature.to_string())).collect(),
|
||||||
),
|
),
|
||||||
missing_target_features_count: missing.len(),
|
missing_target_features_count: missing.len(),
|
||||||
note: if build_enabled.is_empty() { None } else { Some(()) },
|
note: !build_enabled.is_empty(),
|
||||||
build_target_features: DiagArgValue::StrListSepByAnd(
|
build_target_features: DiagArgValue::StrListSepByAnd(
|
||||||
build_enabled
|
build_enabled
|
||||||
.iter()
|
.iter()
|
||||||
|
@ -161,7 +161,7 @@ pub(crate) struct UnsafeOpInUnsafeFnCallToFunctionWithRequiresUnsafe {
|
|||||||
pub(crate) missing_target_features: DiagArgValue,
|
pub(crate) missing_target_features: DiagArgValue,
|
||||||
pub(crate) missing_target_features_count: usize,
|
pub(crate) missing_target_features_count: usize,
|
||||||
#[note]
|
#[note]
|
||||||
pub(crate) note: Option<()>,
|
pub(crate) note: bool,
|
||||||
pub(crate) build_target_features: DiagArgValue,
|
pub(crate) build_target_features: DiagArgValue,
|
||||||
pub(crate) build_target_features_count: usize,
|
pub(crate) build_target_features_count: usize,
|
||||||
#[subdiagnostic]
|
#[subdiagnostic]
|
||||||
@ -413,7 +413,7 @@ pub(crate) struct CallToFunctionWithRequiresUnsafe {
|
|||||||
pub(crate) missing_target_features: DiagArgValue,
|
pub(crate) missing_target_features: DiagArgValue,
|
||||||
pub(crate) missing_target_features_count: usize,
|
pub(crate) missing_target_features_count: usize,
|
||||||
#[note]
|
#[note]
|
||||||
pub(crate) note: Option<()>,
|
pub(crate) note: bool,
|
||||||
pub(crate) build_target_features: DiagArgValue,
|
pub(crate) build_target_features: DiagArgValue,
|
||||||
pub(crate) build_target_features_count: usize,
|
pub(crate) build_target_features_count: usize,
|
||||||
#[subdiagnostic]
|
#[subdiagnostic]
|
||||||
@ -431,7 +431,7 @@ pub(crate) struct CallToFunctionWithRequiresUnsafeUnsafeOpInUnsafeFnAllowed {
|
|||||||
pub(crate) missing_target_features: DiagArgValue,
|
pub(crate) missing_target_features: DiagArgValue,
|
||||||
pub(crate) missing_target_features_count: usize,
|
pub(crate) missing_target_features_count: usize,
|
||||||
#[note]
|
#[note]
|
||||||
pub(crate) note: Option<()>,
|
pub(crate) note: bool,
|
||||||
pub(crate) build_target_features: DiagArgValue,
|
pub(crate) build_target_features: DiagArgValue,
|
||||||
pub(crate) build_target_features_count: usize,
|
pub(crate) build_target_features_count: usize,
|
||||||
#[subdiagnostic]
|
#[subdiagnostic]
|
||||||
@ -623,7 +623,7 @@ pub(crate) struct LowerRangeBoundMustBeLessThanOrEqualToUpper {
|
|||||||
#[label]
|
#[label]
|
||||||
pub(crate) span: Span,
|
pub(crate) span: Span,
|
||||||
#[note(mir_build_teach_note)]
|
#[note(mir_build_teach_note)]
|
||||||
pub(crate) teach: Option<()>,
|
pub(crate) teach: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Diagnostic)]
|
#[derive(Diagnostic)]
|
||||||
@ -865,7 +865,7 @@ pub(crate) struct PatternNotCovered<'s, 'tcx> {
|
|||||||
#[subdiagnostic]
|
#[subdiagnostic]
|
||||||
pub(crate) adt_defined_here: Option<AdtDefinedHere<'tcx>>,
|
pub(crate) adt_defined_here: Option<AdtDefinedHere<'tcx>>,
|
||||||
#[note(mir_build_privately_uninhabited)]
|
#[note(mir_build_privately_uninhabited)]
|
||||||
pub(crate) witness_1_is_privately_uninhabited: Option<()>,
|
pub(crate) witness_1_is_privately_uninhabited: bool,
|
||||||
#[note(mir_build_pattern_ty)]
|
#[note(mir_build_pattern_ty)]
|
||||||
pub(crate) _p: (),
|
pub(crate) _p: (),
|
||||||
pub(crate) pattern_ty: Ty<'tcx>,
|
pub(crate) pattern_ty: Ty<'tcx>,
|
||||||
|
@ -718,7 +718,7 @@ impl<'p, 'tcx> MatchVisitor<'p, 'tcx> {
|
|||||||
uncovered: Uncovered::new(pat.span, &cx, witnesses),
|
uncovered: Uncovered::new(pat.span, &cx, witnesses),
|
||||||
inform,
|
inform,
|
||||||
interpreted_as_const,
|
interpreted_as_const,
|
||||||
witness_1_is_privately_uninhabited: witness_1_is_privately_uninhabited.then_some(()),
|
witness_1_is_privately_uninhabited,
|
||||||
_p: (),
|
_p: (),
|
||||||
pattern_ty,
|
pattern_ty,
|
||||||
let_suggestion,
|
let_suggestion,
|
||||||
|
@ -256,7 +256,7 @@ impl<'a, 'tcx> PatCtxt<'a, 'tcx> {
|
|||||||
RangeEnd::Included => {
|
RangeEnd::Included => {
|
||||||
self.tcx.dcx().emit_err(LowerRangeBoundMustBeLessThanOrEqualToUpper {
|
self.tcx.dcx().emit_err(LowerRangeBoundMustBeLessThanOrEqualToUpper {
|
||||||
span,
|
span,
|
||||||
teach: self.tcx.sess.teach(E0030).then_some(()),
|
teach: self.tcx.sess.teach(E0030),
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
RangeEnd::Excluded => {
|
RangeEnd::Excluded => {
|
||||||
|
@ -580,9 +580,9 @@ fn check_recursion_limit<'tcx>(
|
|||||||
let mut path = PathBuf::new();
|
let mut path = PathBuf::new();
|
||||||
let was_written = if let Some(written_to_path) = written_to_path {
|
let was_written = if let Some(written_to_path) = written_to_path {
|
||||||
path = written_to_path;
|
path = written_to_path;
|
||||||
Some(())
|
true
|
||||||
} else {
|
} else {
|
||||||
None
|
false
|
||||||
};
|
};
|
||||||
tcx.dcx().emit_fatal(RecursionLimit {
|
tcx.dcx().emit_fatal(RecursionLimit {
|
||||||
span,
|
span,
|
||||||
|
@ -16,7 +16,7 @@ pub struct RecursionLimit {
|
|||||||
pub def_span: Span,
|
pub def_span: Span,
|
||||||
pub def_path_str: String,
|
pub def_path_str: String,
|
||||||
#[note(monomorphize_written_to_path)]
|
#[note(monomorphize_written_to_path)]
|
||||||
pub was_written: Option<()>,
|
pub was_written: bool,
|
||||||
pub path: PathBuf,
|
pub path: PathBuf,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -913,7 +913,7 @@ pub(crate) struct InvalidLiteralSuffixOnTupleIndex {
|
|||||||
#[help(parse_tuple_exception_line_1)]
|
#[help(parse_tuple_exception_line_1)]
|
||||||
#[help(parse_tuple_exception_line_2)]
|
#[help(parse_tuple_exception_line_2)]
|
||||||
#[help(parse_tuple_exception_line_3)]
|
#[help(parse_tuple_exception_line_3)]
|
||||||
pub exception: Option<()>,
|
pub exception: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Diagnostic)]
|
#[derive(Diagnostic)]
|
||||||
@ -1299,7 +1299,7 @@ pub(crate) struct ComparisonOperatorsCannotBeChained {
|
|||||||
pub suggest_turbofish: Option<Span>,
|
pub suggest_turbofish: Option<Span>,
|
||||||
#[help(parse_sugg_turbofish_syntax)]
|
#[help(parse_sugg_turbofish_syntax)]
|
||||||
#[help(parse_sugg_parentheses_for_function_args)]
|
#[help(parse_sugg_parentheses_for_function_args)]
|
||||||
pub help_turbofish: Option<()>,
|
pub help_turbofish: bool,
|
||||||
#[subdiagnostic]
|
#[subdiagnostic]
|
||||||
pub chaining_sugg: Option<ComparisonOperatorsCannotBeChainedSugg>,
|
pub chaining_sugg: Option<ComparisonOperatorsCannotBeChainedSugg>,
|
||||||
}
|
}
|
||||||
@ -1578,7 +1578,7 @@ pub(crate) struct PathSingleColon {
|
|||||||
pub suggestion: Span,
|
pub suggestion: Span,
|
||||||
|
|
||||||
#[note(parse_type_ascription_removed)]
|
#[note(parse_type_ascription_removed)]
|
||||||
pub type_ascription: Option<()>,
|
pub type_ascription: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Diagnostic)]
|
#[derive(Diagnostic)]
|
||||||
@ -1589,7 +1589,7 @@ pub(crate) struct ColonAsSemi {
|
|||||||
pub span: Span,
|
pub span: Span,
|
||||||
|
|
||||||
#[note(parse_type_ascription_removed)]
|
#[note(parse_type_ascription_removed)]
|
||||||
pub type_ascription: Option<()>,
|
pub type_ascription: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Diagnostic)]
|
#[derive(Diagnostic)]
|
||||||
@ -2462,7 +2462,7 @@ pub(crate) struct TrailingVertNotAllowed {
|
|||||||
pub start: Option<Span>,
|
pub start: Option<Span>,
|
||||||
pub token: Token,
|
pub token: Token,
|
||||||
#[note(parse_note_pattern_alternatives_use_single_vert)]
|
#[note(parse_note_pattern_alternatives_use_single_vert)]
|
||||||
pub note_double_vert: Option<()>,
|
pub note_double_vert: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Diagnostic)]
|
#[derive(Diagnostic)]
|
||||||
@ -2894,7 +2894,7 @@ pub(crate) struct BadItemKind {
|
|||||||
pub descr: &'static str,
|
pub descr: &'static str,
|
||||||
pub ctx: &'static str,
|
pub ctx: &'static str,
|
||||||
#[help]
|
#[help]
|
||||||
pub help: Option<()>,
|
pub help: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Diagnostic)]
|
#[derive(Diagnostic)]
|
||||||
|
@ -1403,7 +1403,7 @@ impl<'a> Parser<'a> {
|
|||||||
let mut err = ComparisonOperatorsCannotBeChained {
|
let mut err = ComparisonOperatorsCannotBeChained {
|
||||||
span: vec![op.span, self.prev_token.span],
|
span: vec![op.span, self.prev_token.span],
|
||||||
suggest_turbofish: None,
|
suggest_turbofish: None,
|
||||||
help_turbofish: None,
|
help_turbofish: false,
|
||||||
chaining_sugg: None,
|
chaining_sugg: None,
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -1436,7 +1436,7 @@ impl<'a> Parser<'a> {
|
|||||||
{
|
{
|
||||||
err.suggest_turbofish = Some(op.span.shrink_to_lo());
|
err.suggest_turbofish = Some(op.span.shrink_to_lo());
|
||||||
} else {
|
} else {
|
||||||
err.help_turbofish = Some(());
|
err.help_turbofish = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
let snapshot = self.create_snapshot_for_diagnostic();
|
let snapshot = self.create_snapshot_for_diagnostic();
|
||||||
@ -1468,7 +1468,7 @@ impl<'a> Parser<'a> {
|
|||||||
{
|
{
|
||||||
err.suggest_turbofish = Some(op.span.shrink_to_lo());
|
err.suggest_turbofish = Some(op.span.shrink_to_lo());
|
||||||
} else {
|
} else {
|
||||||
err.help_turbofish = Some(());
|
err.help_turbofish = true;
|
||||||
}
|
}
|
||||||
// Consume the fn call arguments.
|
// Consume the fn call arguments.
|
||||||
match self.consume_fn_args() {
|
match self.consume_fn_args() {
|
||||||
@ -1487,7 +1487,7 @@ impl<'a> Parser<'a> {
|
|||||||
{
|
{
|
||||||
// All we know is that this is `foo < bar >` and *nothing* else. Try to
|
// All we know is that this is `foo < bar >` and *nothing* else. Try to
|
||||||
// be helpful, but don't attempt to recover.
|
// be helpful, but don't attempt to recover.
|
||||||
err.help_turbofish = Some(());
|
err.help_turbofish = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// If it looks like a genuine attempt to chain operators (as opposed to a
|
// If it looks like a genuine attempt to chain operators (as opposed to a
|
||||||
@ -1895,7 +1895,7 @@ impl<'a> Parser<'a> {
|
|||||||
{
|
{
|
||||||
self.dcx().emit_err(ColonAsSemi {
|
self.dcx().emit_err(ColonAsSemi {
|
||||||
span: self.token.span,
|
span: self.token.span,
|
||||||
type_ascription: self.psess.unstable_features.is_nightly_build().then_some(()),
|
type_ascription: self.psess.unstable_features.is_nightly_build(),
|
||||||
});
|
});
|
||||||
self.bump();
|
self.bump();
|
||||||
return true;
|
return true;
|
||||||
|
@ -2162,13 +2162,13 @@ impl<'a> Parser<'a> {
|
|||||||
self.dcx().emit_warn(errors::InvalidLiteralSuffixOnTupleIndex {
|
self.dcx().emit_warn(errors::InvalidLiteralSuffixOnTupleIndex {
|
||||||
span,
|
span,
|
||||||
suffix,
|
suffix,
|
||||||
exception: Some(()),
|
exception: true,
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
self.dcx().emit_err(errors::InvalidLiteralSuffixOnTupleIndex {
|
self.dcx().emit_err(errors::InvalidLiteralSuffixOnTupleIndex {
|
||||||
span,
|
span,
|
||||||
suffix,
|
suffix,
|
||||||
exception: None,
|
exception: false,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1248,8 +1248,8 @@ impl<'a> Parser<'a> {
|
|||||||
let span = self.psess.source_map().guess_head_span(span);
|
let span = self.psess.source_map().guess_head_span(span);
|
||||||
let descr = kind.descr();
|
let descr = kind.descr();
|
||||||
let help = match kind {
|
let help = match kind {
|
||||||
ItemKind::DelegationMac(deleg) if deleg.suffixes.is_none() => None,
|
ItemKind::DelegationMac(deleg) if deleg.suffixes.is_none() => false,
|
||||||
_ => Some(()),
|
_ => true,
|
||||||
};
|
};
|
||||||
self.dcx().emit_err(errors::BadItemKind { span, descr, ctx, help });
|
self.dcx().emit_err(errors::BadItemKind { span, descr, ctx, help });
|
||||||
None
|
None
|
||||||
|
@ -333,7 +333,7 @@ impl<'a> Parser<'a> {
|
|||||||
span: self.token.span,
|
span: self.token.span,
|
||||||
start: lo,
|
start: lo,
|
||||||
token: self.token.clone(),
|
token: self.token.clone(),
|
||||||
note_double_vert: matches!(self.token.kind, token::OrOr).then_some(()),
|
note_double_vert: matches!(self.token.kind, token::OrOr),
|
||||||
});
|
});
|
||||||
self.bump();
|
self.bump();
|
||||||
true
|
true
|
||||||
|
@ -261,11 +261,7 @@ impl<'a> Parser<'a> {
|
|||||||
self.dcx().emit_err(PathSingleColon {
|
self.dcx().emit_err(PathSingleColon {
|
||||||
span: self.prev_token.span,
|
span: self.prev_token.span,
|
||||||
suggestion: self.prev_token.span.shrink_to_hi(),
|
suggestion: self.prev_token.span.shrink_to_hi(),
|
||||||
type_ascription: self
|
type_ascription: self.psess.unstable_features.is_nightly_build(),
|
||||||
.psess
|
|
||||||
.unstable_features
|
|
||||||
.is_nightly_build()
|
|
||||||
.then_some(()),
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
continue;
|
continue;
|
||||||
@ -334,11 +330,7 @@ impl<'a> Parser<'a> {
|
|||||||
err = self.dcx().create_err(PathSingleColon {
|
err = self.dcx().create_err(PathSingleColon {
|
||||||
span: self.token.span,
|
span: self.token.span,
|
||||||
suggestion: self.prev_token.span.shrink_to_hi(),
|
suggestion: self.prev_token.span.shrink_to_hi(),
|
||||||
type_ascription: self
|
type_ascription: self.psess.unstable_features.is_nightly_build(),
|
||||||
.psess
|
|
||||||
.unstable_features
|
|
||||||
.is_nightly_build()
|
|
||||||
.then_some(()),
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
// Attempt to find places where a missing `>` might belong.
|
// Attempt to find places where a missing `>` might belong.
|
||||||
|
@ -2619,8 +2619,7 @@ fn check_duplicates(
|
|||||||
warning: matches!(
|
warning: matches!(
|
||||||
duplicates,
|
duplicates,
|
||||||
FutureWarnFollowing | FutureWarnPreceding
|
FutureWarnFollowing | FutureWarnPreceding
|
||||||
)
|
),
|
||||||
.then_some(()),
|
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -49,7 +49,7 @@ fn report_duplicate_item(
|
|||||||
orig_span,
|
orig_span,
|
||||||
crate_name: tcx.crate_name(item_def_id.krate),
|
crate_name: tcx.crate_name(item_def_id.krate),
|
||||||
orig_crate_name: tcx.crate_name(original_def_id.krate),
|
orig_crate_name: tcx.crate_name(original_def_id.krate),
|
||||||
different_crates: (item_def_id.krate != original_def_id.krate).then_some(()),
|
different_crates: (item_def_id.krate != original_def_id.krate),
|
||||||
name,
|
name,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -752,7 +752,7 @@ pub struct UnusedDuplicate {
|
|||||||
#[note]
|
#[note]
|
||||||
pub other: Span,
|
pub other: Span,
|
||||||
#[warning]
|
#[warning]
|
||||||
pub warning: Option<()>,
|
pub warning: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Diagnostic)]
|
#[derive(Diagnostic)]
|
||||||
@ -911,7 +911,7 @@ pub struct DuplicateDiagnosticItemInCrate {
|
|||||||
#[note(passes_diagnostic_item_first_defined)]
|
#[note(passes_diagnostic_item_first_defined)]
|
||||||
pub orig_span: Option<Span>,
|
pub orig_span: Option<Span>,
|
||||||
#[note]
|
#[note]
|
||||||
pub different_crates: Option<()>,
|
pub different_crates: bool,
|
||||||
pub crate_name: Symbol,
|
pub crate_name: Symbol,
|
||||||
pub orig_crate_name: Symbol,
|
pub orig_crate_name: Symbol,
|
||||||
pub name: Symbol,
|
pub name: Symbol,
|
||||||
|
@ -1150,7 +1150,7 @@ impl<'a, 'b, 'tcx> BuildReducedGraphVisitor<'a, 'b, 'tcx> {
|
|||||||
fn contains_macro_use(&mut self, attrs: &[ast::Attribute]) -> bool {
|
fn contains_macro_use(&mut self, attrs: &[ast::Attribute]) -> bool {
|
||||||
for attr in attrs {
|
for attr in attrs {
|
||||||
if attr.has_name(sym::macro_escape) {
|
if attr.has_name(sym::macro_escape) {
|
||||||
let inner_attribute = matches!(attr.style, ast::AttrStyle::Inner).then_some(());
|
let inner_attribute = matches!(attr.style, ast::AttrStyle::Inner);
|
||||||
self.r
|
self.r
|
||||||
.dcx()
|
.dcx()
|
||||||
.emit_warn(errors::MacroExternDeprecated { span: attr.span, inner_attribute });
|
.emit_warn(errors::MacroExternDeprecated { span: attr.span, inner_attribute });
|
||||||
|
@ -850,7 +850,7 @@ pub(crate) struct MacroExternDeprecated {
|
|||||||
#[primary_span]
|
#[primary_span]
|
||||||
pub(crate) span: Span,
|
pub(crate) span: Span,
|
||||||
#[help]
|
#[help]
|
||||||
pub inner_attribute: Option<()>,
|
pub inner_attribute: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Diagnostic)]
|
#[derive(Diagnostic)]
|
||||||
|
@ -382,7 +382,7 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> {
|
|||||||
infer_subdiags,
|
infer_subdiags,
|
||||||
multi_suggestions,
|
multi_suggestions,
|
||||||
bad_label,
|
bad_label,
|
||||||
was_written: None,
|
was_written: false,
|
||||||
path: Default::default(),
|
path: Default::default(),
|
||||||
}),
|
}),
|
||||||
TypeAnnotationNeeded::E0283 => self.dcx().create_err(AmbiguousImpl {
|
TypeAnnotationNeeded::E0283 => self.dcx().create_err(AmbiguousImpl {
|
||||||
@ -393,7 +393,7 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> {
|
|||||||
infer_subdiags,
|
infer_subdiags,
|
||||||
multi_suggestions,
|
multi_suggestions,
|
||||||
bad_label,
|
bad_label,
|
||||||
was_written: None,
|
was_written: false,
|
||||||
path: Default::default(),
|
path: Default::default(),
|
||||||
}),
|
}),
|
||||||
TypeAnnotationNeeded::E0284 => self.dcx().create_err(AmbiguousReturn {
|
TypeAnnotationNeeded::E0284 => self.dcx().create_err(AmbiguousReturn {
|
||||||
@ -404,7 +404,7 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> {
|
|||||||
infer_subdiags,
|
infer_subdiags,
|
||||||
multi_suggestions,
|
multi_suggestions,
|
||||||
bad_label,
|
bad_label,
|
||||||
was_written: None,
|
was_written: false,
|
||||||
path: Default::default(),
|
path: Default::default(),
|
||||||
}),
|
}),
|
||||||
}
|
}
|
||||||
@ -586,7 +586,7 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> {
|
|||||||
infer_subdiags,
|
infer_subdiags,
|
||||||
multi_suggestions,
|
multi_suggestions,
|
||||||
bad_label: None,
|
bad_label: None,
|
||||||
was_written: path.as_ref().map(|_| ()),
|
was_written: path.is_some(),
|
||||||
path: path.unwrap_or_default(),
|
path: path.unwrap_or_default(),
|
||||||
}),
|
}),
|
||||||
TypeAnnotationNeeded::E0283 => self.dcx().create_err(AmbiguousImpl {
|
TypeAnnotationNeeded::E0283 => self.dcx().create_err(AmbiguousImpl {
|
||||||
@ -597,7 +597,7 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> {
|
|||||||
infer_subdiags,
|
infer_subdiags,
|
||||||
multi_suggestions,
|
multi_suggestions,
|
||||||
bad_label: None,
|
bad_label: None,
|
||||||
was_written: path.as_ref().map(|_| ()),
|
was_written: path.is_some(),
|
||||||
path: path.unwrap_or_default(),
|
path: path.unwrap_or_default(),
|
||||||
}),
|
}),
|
||||||
TypeAnnotationNeeded::E0284 => self.dcx().create_err(AmbiguousReturn {
|
TypeAnnotationNeeded::E0284 => self.dcx().create_err(AmbiguousReturn {
|
||||||
@ -608,7 +608,7 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> {
|
|||||||
infer_subdiags,
|
infer_subdiags,
|
||||||
multi_suggestions,
|
multi_suggestions,
|
||||||
bad_label: None,
|
bad_label: None,
|
||||||
was_written: path.as_ref().map(|_| ()),
|
was_written: path.is_some(),
|
||||||
path: path.unwrap_or_default(),
|
path: path.unwrap_or_default(),
|
||||||
}),
|
}),
|
||||||
}
|
}
|
||||||
|
@ -203,7 +203,7 @@ pub struct AnnotationRequired<'a> {
|
|||||||
#[subdiagnostic]
|
#[subdiagnostic]
|
||||||
pub multi_suggestions: Vec<SourceKindMultiSuggestion<'a>>,
|
pub multi_suggestions: Vec<SourceKindMultiSuggestion<'a>>,
|
||||||
#[note(trait_selection_full_type_written)]
|
#[note(trait_selection_full_type_written)]
|
||||||
pub was_written: Option<()>,
|
pub was_written: bool,
|
||||||
pub path: PathBuf,
|
pub path: PathBuf,
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -224,7 +224,7 @@ pub struct AmbiguousImpl<'a> {
|
|||||||
#[subdiagnostic]
|
#[subdiagnostic]
|
||||||
pub multi_suggestions: Vec<SourceKindMultiSuggestion<'a>>,
|
pub multi_suggestions: Vec<SourceKindMultiSuggestion<'a>>,
|
||||||
#[note(trait_selection_full_type_written)]
|
#[note(trait_selection_full_type_written)]
|
||||||
pub was_written: Option<()>,
|
pub was_written: bool,
|
||||||
pub path: PathBuf,
|
pub path: PathBuf,
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -245,7 +245,7 @@ pub struct AmbiguousReturn<'a> {
|
|||||||
#[subdiagnostic]
|
#[subdiagnostic]
|
||||||
pub multi_suggestions: Vec<SourceKindMultiSuggestion<'a>>,
|
pub multi_suggestions: Vec<SourceKindMultiSuggestion<'a>>,
|
||||||
#[note(trait_selection_full_type_written)]
|
#[note(trait_selection_full_type_written)]
|
||||||
pub was_written: Option<()>,
|
pub was_written: bool,
|
||||||
pub path: PathBuf,
|
pub path: PathBuf,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -284,7 +284,7 @@ fn error(
|
|||||||
) -> Result<!, ErrorGuaranteed> {
|
) -> Result<!, ErrorGuaranteed> {
|
||||||
let reported = tcx.dcx().emit_err(GenericConstantTooComplex {
|
let reported = tcx.dcx().emit_err(GenericConstantTooComplex {
|
||||||
span: root_span,
|
span: root_span,
|
||||||
maybe_supported: None,
|
maybe_supported: false,
|
||||||
sub,
|
sub,
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -298,7 +298,7 @@ fn maybe_supported_error(
|
|||||||
) -> Result<!, ErrorGuaranteed> {
|
) -> Result<!, ErrorGuaranteed> {
|
||||||
let reported = tcx.dcx().emit_err(GenericConstantTooComplex {
|
let reported = tcx.dcx().emit_err(GenericConstantTooComplex {
|
||||||
span: root_span,
|
span: root_span,
|
||||||
maybe_supported: Some(()),
|
maybe_supported: true,
|
||||||
sub,
|
sub,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -18,7 +18,7 @@ pub struct GenericConstantTooComplex {
|
|||||||
#[primary_span]
|
#[primary_span]
|
||||||
pub span: Span,
|
pub span: Span,
|
||||||
#[note(ty_utils_maybe_supported)]
|
#[note(ty_utils_maybe_supported)]
|
||||||
pub maybe_supported: Option<()>,
|
pub maybe_supported: bool,
|
||||||
#[subdiagnostic]
|
#[subdiagnostic]
|
||||||
pub sub: GenericConstantTooComplexSub,
|
pub sub: GenericConstantTooComplexSub,
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user