Fix static string lints
This commit is contained in:
@@ -65,8 +65,8 @@
|
||||
//! cause use after frees with purely safe code in the same way as specializing
|
||||
//! on traits with methods can.
|
||||
|
||||
use crate::constrained_generic_params as cgp;
|
||||
use crate::errors::SubstsOnOverriddenImpl;
|
||||
use crate::{constrained_generic_params as cgp, errors};
|
||||
|
||||
use rustc_data_structures::fx::FxHashSet;
|
||||
use rustc_hir as hir;
|
||||
@@ -137,9 +137,7 @@ fn check_constness(tcx: TyCtxt<'_>, impl1_def_id: LocalDefId, impl2_node: Node,
|
||||
|
||||
if let hir::Constness::Const = impl2_constness {
|
||||
if let hir::Constness::NotConst = impl1_constness {
|
||||
tcx.sess
|
||||
.struct_span_err(span, "cannot specialize on const impl with non-const impl")
|
||||
.emit();
|
||||
tcx.sess.emit_err(errors::ConstSpecialize { span });
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -293,7 +291,7 @@ fn check_static_lifetimes<'tcx>(
|
||||
span: Span,
|
||||
) {
|
||||
if tcx.any_free_region_meets(parent_substs, |r| r.is_static()) {
|
||||
tcx.sess.struct_span_err(span, "cannot specialize on `'static` lifetime").emit();
|
||||
tcx.sess.emit_err(errors::StaticSpecialize { span });
|
||||
}
|
||||
}
|
||||
|
||||
@@ -438,7 +436,7 @@ fn trait_predicates_eq<'tcx>(
|
||||
// the one on the base.
|
||||
match (trait_pred2.constness, trait_pred1.constness) {
|
||||
(ty::BoundConstness::ConstIfConst, ty::BoundConstness::NotConst) => {
|
||||
tcx.sess.struct_span_err(span, "missing `~const` qualifier for specialization").emit();
|
||||
tcx.sess.emit_err(errors::MissingTildeConst { span });
|
||||
}
|
||||
_ => {}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user