mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-25 08:13:41 +00:00
Migrate DropCheckOverflow
This commit is contained in:
parent
4f9898a794
commit
3e834a7a62
3
compiler/rustc_error_messages/locales/en-US/middle.ftl
Normal file
3
compiler/rustc_error_messages/locales/en-US/middle.ftl
Normal file
@ -0,0 +1,3 @@
|
||||
middle_drop_check_overflow =
|
||||
overflow while adding drop-check rules for {$ty}
|
||||
.note = {$note}
|
@ -45,6 +45,7 @@ fluent_messages! {
|
||||
interface => "../locales/en-US/interface.ftl",
|
||||
infer => "../locales/en-US/infer.ftl",
|
||||
lint => "../locales/en-US/lint.ftl",
|
||||
middle => "../locales/en-US/middle.ftl",
|
||||
monomorphize => "../locales/en-US/monomorphize.ftl",
|
||||
parser => "../locales/en-US/parser.ftl",
|
||||
passes => "../locales/en-US/passes.ftl",
|
||||
|
14
compiler/rustc_middle/src/error.rs
Normal file
14
compiler/rustc_middle/src/error.rs
Normal file
@ -0,0 +1,14 @@
|
||||
use rustc_macros::SessionDiagnostic;
|
||||
use rustc_span::Span;
|
||||
|
||||
use crate::ty::Ty;
|
||||
|
||||
#[derive(SessionDiagnostic)]
|
||||
#[diag(middle::drop_check_overflow, code = "E0320")]
|
||||
#[note]
|
||||
pub struct DropCheckOverflow<'tcx> {
|
||||
#[primary_span]
|
||||
pub span: Span,
|
||||
pub ty: Ty<'tcx>,
|
||||
pub note: String,
|
||||
}
|
@ -86,6 +86,7 @@ pub mod query;
|
||||
pub mod arena;
|
||||
#[macro_use]
|
||||
pub mod dep_graph;
|
||||
pub(crate) mod error;
|
||||
pub mod hir;
|
||||
pub mod infer;
|
||||
pub mod lint;
|
||||
|
@ -5,11 +5,11 @@
|
||||
//! The providers for the queries defined here can be found in
|
||||
//! `rustc_traits`.
|
||||
|
||||
use crate::error::DropCheckOverflow;
|
||||
use crate::infer::canonical::{Canonical, QueryResponse};
|
||||
use crate::ty::error::TypeError;
|
||||
use crate::ty::subst::GenericArg;
|
||||
use crate::ty::{self, Ty, TyCtxt};
|
||||
use rustc_errors::struct_span_err;
|
||||
use rustc_span::source_map::Span;
|
||||
use std::iter::FromIterator;
|
||||
|
||||
@ -117,15 +117,8 @@ pub struct DropckOutlivesResult<'tcx> {
|
||||
impl<'tcx> DropckOutlivesResult<'tcx> {
|
||||
pub fn report_overflows(&self, tcx: TyCtxt<'tcx>, span: Span, ty: Ty<'tcx>) {
|
||||
if let Some(overflow_ty) = self.overflows.get(0) {
|
||||
let mut err = struct_span_err!(
|
||||
tcx.sess,
|
||||
span,
|
||||
E0320,
|
||||
"overflow while adding drop-check rules for {}",
|
||||
ty,
|
||||
);
|
||||
err.note(&format!("overflowed on {}", overflow_ty));
|
||||
err.emit();
|
||||
let note = format!("overflowed on {}", overflow_ty);
|
||||
tcx.sess.emit_err(DropCheckOverflow { span, ty, note });
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user