1
Fork 0

Update to use new librustc_error_codes library

This commit is contained in:
Guillaume Gomez 2019-11-11 22:46:56 +01:00
parent 3816fce76c
commit 798e389e57
106 changed files with 179 additions and 59 deletions

View file

@ -40,3 +40,5 @@ byteorder = { version = "1.3" }
chalk-engine = { version = "0.9.0", default-features=false } chalk-engine = { version = "0.9.0", default-features=false }
rustc_fs_util = { path = "../librustc_fs_util" } rustc_fs_util = { path = "../librustc_fs_util" }
smallvec = { version = "1.0", features = ["union", "may_dangle"] } smallvec = { version = "1.0", features = ["union", "may_dangle"] }
measureme = "0.4"
rustc_error_codes = { path = "../librustc_error_codes" }

View file

@ -16,6 +16,8 @@ use std::fmt::{self, Display};
use syntax::{attr, symbol::sym}; use syntax::{attr, symbol::sym};
use syntax_pos::Span; use syntax_pos::Span;
use rustc_error_codes::*;
#[derive(Copy, Clone, PartialEq)] #[derive(Copy, Clone, PartialEq)]
pub(crate) enum MethodKind { pub(crate) enum MethodKind {
Trait { body: bool }, Trait { body: bool },

View file

@ -74,6 +74,8 @@ use syntax::visit::{self, Visitor};
use syntax_pos::hygiene::ExpnId; use syntax_pos::hygiene::ExpnId;
use syntax_pos::Span; use syntax_pos::Span;
use rustc_error_codes::*;
const HIR_ID_COUNTER_LOCKED: u32 = 0xFFFFFFFF; const HIR_ID_COUNTER_LOCKED: u32 = 0xFFFFFFFF;
pub struct LoweringContext<'a> { pub struct LoweringContext<'a> {

View file

@ -11,6 +11,8 @@ use syntax::ast::*;
use syntax::source_map::{respan, DesugaringKind, Span, Spanned}; use syntax::source_map::{respan, DesugaringKind, Span, Spanned};
use syntax::symbol::{sym, Symbol}; use syntax::symbol::{sym, Symbol};
use rustc_error_codes::*;
impl LoweringContext<'_> { impl LoweringContext<'_> {
fn lower_exprs(&mut self, exprs: &[AstP<Expr>]) -> HirVec<hir::Expr> { fn lower_exprs(&mut self, exprs: &[AstP<Expr>]) -> HirVec<hir::Expr> {
exprs.iter().map(|x| self.lower_expr(x)).collect() exprs.iter().map(|x| self.lower_expr(x)).collect()

View file

@ -23,6 +23,8 @@ use syntax::source_map::{respan, DesugaringKind};
use syntax::symbol::{kw, sym}; use syntax::symbol::{kw, sym};
use syntax_pos::Span; use syntax_pos::Span;
use rustc_error_codes::*;
pub(super) struct ItemLowerer<'tcx, 'interner> { pub(super) struct ItemLowerer<'tcx, 'interner> {
pub(super) lctx: &'tcx mut LoweringContext<'interner>, pub(super) lctx: &'tcx mut LoweringContext<'interner>,
} }

View file

@ -63,6 +63,8 @@ use errors::{Applicability, DiagnosticBuilder, DiagnosticStyledString};
use std::{cmp, fmt}; use std::{cmp, fmt};
use syntax_pos::{Pos, Span}; use syntax_pos::{Pos, Span};
use rustc_error_codes::*;
mod note; mod note;
mod need_type_info; mod need_type_info;

View file

@ -9,6 +9,8 @@ use syntax::source_map::DesugaringKind;
use syntax_pos::Span; use syntax_pos::Span;
use errors::{Applicability, DiagnosticBuilder}; use errors::{Applicability, DiagnosticBuilder};
use rustc_error_codes::*;
struct FindLocalByTypeVisitor<'a, 'tcx> { struct FindLocalByTypeVisitor<'a, 'tcx> {
infcx: &'a InferCtxt<'a, 'tcx>, infcx: &'a InferCtxt<'a, 'tcx>,
target_ty: Ty<'tcx>, target_ty: Ty<'tcx>,

View file

@ -5,6 +5,8 @@ use crate::infer::error_reporting::nice_region_error::NiceRegionError;
use crate::infer::error_reporting::nice_region_error::util::AnonymousParamInfo; use crate::infer::error_reporting::nice_region_error::util::AnonymousParamInfo;
use crate::util::common::ErrorReported; use crate::util::common::ErrorReported;
use rustc_error_codes::*;
impl<'a, 'tcx> NiceRegionError<'a, 'tcx> { impl<'a, 'tcx> NiceRegionError<'a, 'tcx> {
/// Print the error message for lifetime errors when both the concerned regions are anonymous. /// Print the error message for lifetime errors when both the concerned regions are anonymous.
/// ///

View file

@ -5,6 +5,8 @@ use crate::hir::{FunctionRetTy, TyKind};
use crate::ty; use crate::ty;
use errors::{Applicability, DiagnosticBuilder}; use errors::{Applicability, DiagnosticBuilder};
use rustc_error_codes::*;
impl<'a, 'tcx> NiceRegionError<'a, 'tcx> { impl<'a, 'tcx> NiceRegionError<'a, 'tcx> {
/// When given a `ConcreteFailure` for a function with parameters containing a named region and /// When given a `ConcreteFailure` for a function with parameters containing a named region and
/// an anonymous region, emit an descriptive diagnostic error. /// an anonymous region, emit an descriptive diagnostic error.

View file

@ -4,6 +4,8 @@ use crate::ty::{self, Region};
use crate::ty::error::TypeError; use crate::ty::error::TypeError;
use errors::DiagnosticBuilder; use errors::DiagnosticBuilder;
use rustc_error_codes::*;
impl<'a, 'tcx> InferCtxt<'a, 'tcx> { impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
pub(super) fn note_region_origin(&self, pub(super) fn note_region_origin(&self,
err: &mut DiagnosticBuilder<'_>, err: &mut DiagnosticBuilder<'_>,

View file

@ -15,6 +15,8 @@ use rustc_data_structures::fx::FxHashMap;
use rustc_data_structures::sync::Lrc; use rustc_data_structures::sync::Lrc;
use syntax_pos::Span; use syntax_pos::Span;
use rustc_error_codes::*;
pub type OpaqueTypeMap<'tcx> = DefIdMap<OpaqueTypeDecl<'tcx>>; pub type OpaqueTypeMap<'tcx> = DefIdMap<OpaqueTypeDecl<'tcx>>;
/// Information about the opaque types whose values we /// Information about the opaque types whose values we

View file

@ -83,8 +83,6 @@ mod tests;
#[macro_use] #[macro_use]
mod macros; mod macros;
pub mod error_codes;
#[macro_use] #[macro_use]
pub mod query; pub mod query;

View file

@ -40,6 +40,8 @@ use syntax::util::lev_distance::find_best_match_for_name;
use syntax::visit as ast_visit; use syntax::visit as ast_visit;
use syntax_pos::{MultiSpan, Span, symbol::Symbol}; use syntax_pos::{MultiSpan, Span, symbol::Symbol};
use rustc_error_codes::*;
/// Information about the registered lints. /// Information about the registered lints.
/// ///
/// This is basically the subset of `Context` that we can /// This is basically the subset of `Context` that we can

View file

@ -16,6 +16,8 @@ use syntax::print::pprust;
use syntax::source_map::MultiSpan; use syntax::source_map::MultiSpan;
use syntax::symbol::{Symbol, sym}; use syntax::symbol::{Symbol, sym};
use rustc_error_codes::*;
pub struct LintLevelSets { pub struct LintLevelSets {
list: Vec<LintSet>, list: Vec<LintSet>,
lint_cap: Level, lint_cap: Level,

View file

@ -23,6 +23,8 @@ use rustc_macros::HashStable;
use crate::hir::itemlikevisit::ItemLikeVisitor; use crate::hir::itemlikevisit::ItemLikeVisitor;
use crate::hir; use crate::hir;
use rustc_error_codes::*;
// The actual lang items defined come at the end of this file in one handy table. // The actual lang items defined come at the end of this file in one handy table.
// So you probably just want to nip down to the end. // So you probably just want to nip down to the end.
macro_rules! language_item_table { macro_rules! language_item_table {

View file

@ -30,6 +30,8 @@ use syntax_pos::Span;
use crate::hir::intravisit::{self, NestedVisitorMap, Visitor}; use crate::hir::intravisit::{self, NestedVisitorMap, Visitor};
use crate::hir::{self, GenericParamKind, LifetimeParamKind}; use crate::hir::{self, GenericParamKind, LifetimeParamKind};
use rustc_error_codes::*;
/// The origin of a named lifetime definition. /// The origin of a named lifetime definition.
/// ///
/// This is used to prevent the usage of in-band lifetimes in `Fn`/`fn` syntax. /// This is used to prevent the usage of in-band lifetimes in `Fn`/`fn` syntax.

View file

@ -26,6 +26,9 @@ use std::cmp::Ordering;
use std::mem::replace; use std::mem::replace;
use std::num::NonZeroU32; use std::num::NonZeroU32;
use rustc_error_codes::*;
#[derive(PartialEq, Clone, Copy, Debug)] #[derive(PartialEq, Clone, Copy, Debug)]
pub enum StabilityLevel { pub enum StabilityLevel {
Unstable, Unstable,

View file

@ -14,6 +14,8 @@ use crate::hir::intravisit;
use crate::hir; use crate::hir;
use crate::ty::TyCtxt; use crate::ty::TyCtxt;
use rustc_error_codes::*;
macro_rules! weak_lang_items { macro_rules! weak_lang_items {
($($name:ident, $item:ident, $sym:ident;)*) => ( ($($name:ident, $item:ident, $sym:ident;)*) => (

View file

@ -16,6 +16,8 @@ use syntax::symbol::Symbol;
use std::{fmt, env}; use std::{fmt, env};
use rustc_error_codes::*;
#[derive(Debug, Copy, Clone, PartialEq, Eq, HashStable, RustcEncodable, RustcDecodable)] #[derive(Debug, Copy, Clone, PartialEq, Eq, HashStable, RustcEncodable, RustcDecodable)]
pub enum ErrorHandled { pub enum ErrorHandled {
/// Already reported a lint or an error for this evaluation. /// Already reported a lint or an error for this evaluation.

View file

@ -39,6 +39,8 @@ use syntax::ast;
use syntax::symbol::{sym, kw}; use syntax::symbol::{sym, kw};
use syntax_pos::{DUMMY_SP, Span, ExpnKind, MultiSpan}; use syntax_pos::{DUMMY_SP, Span, ExpnKind, MultiSpan};
use rustc_error_codes::*;
impl<'a, 'tcx> InferCtxt<'a, 'tcx> { impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
pub fn report_fulfillment_errors( pub fn report_fulfillment_errors(
&self, &self,

View file

@ -10,6 +10,8 @@ use syntax::attr;
use syntax::symbol::{Symbol, kw, sym}; use syntax::symbol::{Symbol, kw, sym};
use syntax_pos::Span; use syntax_pos::Span;
use rustc_error_codes::*;
#[derive(Clone, Debug)] #[derive(Clone, Debug)]
pub struct OnUnimplementedFormatString(Symbol); pub struct OnUnimplementedFormatString(Symbol);

View file

@ -6,6 +6,8 @@ use syntax::source_map::Span;
use crate::ty::subst::GenericArg; use crate::ty::subst::GenericArg;
use crate::ty::{self, Ty, TyCtxt}; use crate::ty::{self, Ty, TyCtxt};
use rustc_error_codes::*;
impl<'cx, 'tcx> At<'cx, 'tcx> { impl<'cx, 'tcx> At<'cx, 'tcx> {
/// Given a type `ty` of some value being dropped, computes a set /// Given a type `ty` of some value being dropped, computes a set
/// of "kinds" (types, regions) that must be outlive the execution /// of "kinds" (types, regions) that must be outlive the execution

View file

@ -24,6 +24,8 @@ use crate::ty::subst::{Subst, InternalSubsts, SubstsRef};
use super::{SelectionContext, FulfillmentContext}; use super::{SelectionContext, FulfillmentContext};
use super::util::impl_trait_ref_and_oblig; use super::util::impl_trait_ref_and_oblig;
use rustc_error_codes::*;
/// Information pertinent to an overlapping impl error. /// Information pertinent to an overlapping impl error.
#[derive(Debug)] #[derive(Debug)]
pub struct OverlapError { pub struct OverlapError {

View file

@ -26,6 +26,8 @@ use std::collections::hash_map::Entry;
use syntax_pos::Span; use syntax_pos::Span;
use syntax::source_map::DUMMY_SP; use syntax::source_map::DUMMY_SP;
use rustc_error_codes::*;
pub struct QueryCache<'tcx, D: QueryConfig<'tcx> + ?Sized> { pub struct QueryCache<'tcx, D: QueryConfig<'tcx> + ?Sized> {
pub(super) results: FxHashMap<D::Key, QueryValue<D::Value>>, pub(super) results: FxHashMap<D::Key, QueryValue<D::Value>>,
pub(super) active: FxHashMap<D::Key, QueryResult<'tcx>>, pub(super) active: FxHashMap<D::Key, QueryResult<'tcx>>,

View file

@ -31,3 +31,4 @@ rustc_fs_util = { path = "../librustc_fs_util" }
rustc_incremental = { path = "../librustc_incremental" } rustc_incremental = { path = "../librustc_incremental" }
rustc_index = { path = "../librustc_index" } rustc_index = { path = "../librustc_index" }
rustc_target = { path = "../librustc_target" } rustc_target = { path = "../librustc_target" }
rustc_error_codes = { path = "../librustc_error_codes" }

View file

@ -12,6 +12,8 @@ use crate::traits::*;
use rustc::hir; use rustc::hir;
use crate::traits::BuilderMethods; use crate::traits::BuilderMethods;
use rustc_error_codes::*;
pub enum IntPredicate { pub enum IntPredicate {
IntEQ, IntEQ,
IntNE, IntNE,

View file

@ -35,8 +35,6 @@ use rustc::middle::cstore::{LibSource, CrateSource, NativeLibrary};
use rustc::middle::dependency_format::Dependencies; use rustc::middle::dependency_format::Dependencies;
use syntax_pos::symbol::Symbol; use syntax_pos::symbol::Symbol;
mod error_codes;
pub mod common; pub mod common;
pub mod traits; pub mod traits;
pub mod mir; pub mod mir;

View file

@ -6,6 +6,8 @@ use super::LocalRef;
use super::OperandValue; use super::OperandValue;
use crate::traits::*; use crate::traits::*;
use rustc_error_codes::*;
impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> { impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
pub fn codegen_statement( pub fn codegen_statement(
&mut self, &mut self,

View file

@ -34,6 +34,7 @@ rustc_errors = { path = "../librustc_errors" }
rustc_plugin = { path = "../librustc_plugin", package = "rustc_plugin_impl" } rustc_plugin = { path = "../librustc_plugin", package = "rustc_plugin_impl" }
rustc_privacy = { path = "../librustc_privacy" } rustc_privacy = { path = "../librustc_privacy" }
rustc_resolve = { path = "../librustc_resolve" } rustc_resolve = { path = "../librustc_resolve" }
rustc_error_codes = { path = "../librustc_error_codes" }
tempfile = "3.0.5" tempfile = "3.0.5"
once_cell = "1" once_cell = "1"

View file

@ -14,12 +14,8 @@ use rustc_data_structures::thin_vec::ThinVec;
use rustc_data_structures::fx::{FxHashSet, FxHashMap}; use rustc_data_structures::fx::{FxHashSet, FxHashMap};
use rustc_errors::registry::Registry; use rustc_errors::registry::Registry;
use rustc_metadata::dynamic_lib::DynamicLibrary; use rustc_metadata::dynamic_lib::DynamicLibrary;
use rustc_mir;
use rustc_passes;
use rustc_plugin;
use rustc_privacy;
use rustc_resolve::{self, Resolver}; use rustc_resolve::{self, Resolver};
use rustc_typeck; use rustc_error_codes;
use std::env; use std::env;
use std::env::consts::{DLL_PREFIX, DLL_SUFFIX}; use std::env::consts::{DLL_PREFIX, DLL_SUFFIX};
use std::io::{self, Write}; use std::io::{self, Write};
@ -43,18 +39,9 @@ use std::{thread, panic};
pub fn diagnostics_registry() -> Registry { pub fn diagnostics_registry() -> Registry {
let mut all_errors = Vec::new(); let mut all_errors = Vec::new();
all_errors.extend_from_slice(&rustc::error_codes::DIAGNOSTICS); all_errors.extend_from_slice(&rustc_error_codes::DIAGNOSTICS);
all_errors.extend_from_slice(&rustc_typeck::error_codes::DIAGNOSTICS);
all_errors.extend_from_slice(&rustc_resolve::error_codes::DIAGNOSTICS);
all_errors.extend_from_slice(&rustc_privacy::error_codes::DIAGNOSTICS);
// FIXME: need to figure out a way to get these back in here // FIXME: need to figure out a way to get these back in here
// all_errors.extend_from_slice(get_codegen_backend(sess).diagnostics()); // all_errors.extend_from_slice(get_codegen_backend(sess).diagnostics());
all_errors.extend_from_slice(&rustc_metadata::error_codes::DIAGNOSTICS);
all_errors.extend_from_slice(&rustc_parse::error_codes::DIAGNOSTICS);
all_errors.extend_from_slice(&rustc_passes::error_codes::DIAGNOSTICS);
all_errors.extend_from_slice(&rustc_plugin::error_codes::DIAGNOSTICS);
all_errors.extend_from_slice(&rustc_mir::error_codes::DIAGNOSTICS);
all_errors.extend_from_slice(&syntax::error_codes::DIAGNOSTICS);
Registry::new(&all_errors) Registry::new(&all_errors)
} }

View file

@ -16,3 +16,4 @@ syntax = { path = "../libsyntax" }
syntax_pos = { path = "../libsyntax_pos" } syntax_pos = { path = "../libsyntax_pos" }
rustc_data_structures = { path = "../librustc_data_structures" } rustc_data_structures = { path = "../librustc_data_structures" }
rustc_index = { path = "../librustc_index" } rustc_index = { path = "../librustc_index" }
rustc_error_codes = { path = "../librustc_error_codes" }

View file

@ -23,7 +23,6 @@
extern crate rustc; extern crate rustc;
mod array_into_iter; mod array_into_iter;
mod error_codes;
mod nonstandard_style; mod nonstandard_style;
mod redundant_semicolon; mod redundant_semicolon;
pub mod builtin; pub mod builtin;

View file

@ -25,3 +25,4 @@ syntax = { path = "../libsyntax" }
syntax_expand = { path = "../libsyntax_expand" } syntax_expand = { path = "../libsyntax_expand" }
rustc_parse = { path = "../librustc_parse" } rustc_parse = { path = "../librustc_parse" }
syntax_pos = { path = "../libsyntax_pos" } syntax_pos = { path = "../libsyntax_pos" }
rustc_error_codes = { path = "../librustc_error_codes" }

View file

@ -32,6 +32,8 @@ use syntax_pos::{Span, DUMMY_SP};
use log::{debug, info, log_enabled}; use log::{debug, info, log_enabled};
use proc_macro::bridge::client::ProcMacro; use proc_macro::bridge::client::ProcMacro;
use rustc_error_codes::*;
crate struct Library { crate struct Library {
pub source: CrateSource, pub source: CrateSource,
pub metadata: MetadataBlob, pub metadata: MetadataBlob,

View file

@ -24,8 +24,6 @@ extern crate rustc;
#[macro_use] #[macro_use]
extern crate rustc_data_structures; extern crate rustc_data_structures;
pub mod error_codes;
mod dependency_format; mod dependency_format;
mod foreign_modules; mod foreign_modules;
mod link_args; mod link_args;

View file

@ -246,6 +246,8 @@ use rustc_data_structures::owning_ref::OwningRef;
use log::{debug, info, warn}; use log::{debug, info, warn};
use rustc_error_codes::*;
#[derive(Clone)] #[derive(Clone)]
crate struct CrateMismatch { crate struct CrateMismatch {
path: PathBuf, path: PathBuf,

View file

@ -11,6 +11,8 @@ use syntax::feature_gate::{self, GateIssue};
use syntax::symbol::{kw, sym, Symbol}; use syntax::symbol::{kw, sym, Symbol};
use syntax::{span_err, struct_span_err}; use syntax::{span_err, struct_span_err};
use rustc_error_codes::*;
crate fn collect(tcx: TyCtxt<'_>) -> Vec<NativeLibrary> { crate fn collect(tcx: TyCtxt<'_>) -> Vec<NativeLibrary> {
let mut collector = Collector { let mut collector = Collector {
tcx, tcx,

View file

@ -27,3 +27,4 @@ syntax = { path = "../libsyntax" }
syntax_pos = { path = "../libsyntax_pos" } syntax_pos = { path = "../libsyntax_pos" }
rustc_apfloat = { path = "../librustc_apfloat" } rustc_apfloat = { path = "../librustc_apfloat" }
smallvec = { version = "1.0", features = ["union", "may_dangle"] } smallvec = { version = "1.0", features = ["union", "may_dangle"] }
rustc_error_codes = { path = "../librustc_error_codes" }

View file

@ -51,6 +51,8 @@ use std::rc::Rc;
use std::{fmt, iter, mem}; use std::{fmt, iter, mem};
use syntax_pos::{Span, DUMMY_SP}; use syntax_pos::{Span, DUMMY_SP};
use rustc_error_codes::*;
macro_rules! span_mirbug { macro_rules! span_mirbug {
($context:expr, $elem:expr, $($message:tt)*) => ({ ($context:expr, $elem:expr, $($message:tt)*) => ({
$crate::borrow_check::nll::type_check::mirbug( $crate::borrow_check::nll::type_check::mirbug(

View file

@ -20,6 +20,8 @@ use std::slice;
use syntax_pos::{MultiSpan, Span}; use syntax_pos::{MultiSpan, Span};
use rustc_error_codes::*;
crate fn check_match(tcx: TyCtxt<'_>, def_id: DefId) { crate fn check_match(tcx: TyCtxt<'_>, def_id: DefId) {
let body_id = match tcx.hir().as_local_hir_id(def_id) { let body_id = match tcx.hir().as_local_hir_id(def_id) {
None => return, None => return,

View file

@ -28,6 +28,8 @@ use std::fmt;
use syntax::ast; use syntax::ast;
use syntax_pos::{Span, DUMMY_SP}; use syntax_pos::{Span, DUMMY_SP};
use rustc_error_codes::*;
#[derive(Clone, Debug)] #[derive(Clone, Debug)]
pub enum PatternError { pub enum PatternError {
AssocConstInPattern(Span), AssocConstInPattern(Span),

View file

@ -35,8 +35,6 @@ Rust MIR: a lowered representation of Rust. Also: an experiment!
#[macro_use] extern crate rustc_data_structures; #[macro_use] extern crate rustc_data_structures;
#[macro_use] extern crate syntax; #[macro_use] extern crate syntax;
pub mod error_codes;
mod borrow_check; mod borrow_check;
mod build; mod build;
pub mod dataflow; pub mod dataflow;

View file

@ -10,6 +10,8 @@ use syntax_pos::{Span, Symbol};
use super::{ConstKind, Item}; use super::{ConstKind, Item};
use rustc_error_codes::*;
/// An operation that is not *always* allowed in a const context. /// An operation that is not *always* allowed in a const context.
pub trait NonConstOp: std::fmt::Debug { pub trait NonConstOp: std::fmt::Debug {
/// Whether this operation can be evaluated by miri. /// Whether this operation can be evaluated by miri.

View file

@ -18,6 +18,8 @@ use std::ops::Bound;
use crate::util; use crate::util;
use rustc_error_codes::*;
pub struct UnsafetyChecker<'a, 'tcx> { pub struct UnsafetyChecker<'a, 'tcx> {
body: &'a Body<'tcx>, body: &'a Body<'tcx>,
const_context: bool, const_context: bool,

View file

@ -31,6 +31,8 @@ use rustc::hir::HirId;
use crate::transform::{MirPass, MirSource}; use crate::transform::{MirPass, MirSource};
use crate::transform::check_consts::ops::{self, NonConstOp}; use crate::transform::check_consts::ops::{self, NonConstOp};
use rustc_error_codes::*;
/// What kind of item we are in. /// What kind of item we are in.
#[derive(Copy, Clone, Debug, PartialEq, Eq)] #[derive(Copy, Clone, Debug, PartialEq, Eq)]
enum Mode { enum Mode {

View file

@ -2,6 +2,8 @@ use rustc::ty::{self, Ty, TyCtxt};
use rustc_errors::{DiagnosticBuilder, DiagnosticId}; use rustc_errors::{DiagnosticBuilder, DiagnosticId};
use syntax_pos::{MultiSpan, Span}; use syntax_pos::{MultiSpan, Span};
use rustc_error_codes::*;
impl<'cx, 'tcx> crate::borrow_check::MirBorrowckCtxt<'cx, 'tcx> { impl<'cx, 'tcx> crate::borrow_check::MirBorrowckCtxt<'cx, 'tcx> {
crate fn cannot_move_when_borrowed( crate fn cannot_move_when_borrowed(
&self, &self,

View file

@ -19,3 +19,4 @@ rustc_data_structures = { path = "../librustc_data_structures" }
rustc_lexer = { path = "../librustc_lexer" } rustc_lexer = { path = "../librustc_lexer" }
rustc_target = { path = "../librustc_target" } rustc_target = { path = "../librustc_target" }
smallvec = { version = "1.0", features = ["union", "may_dangle"] } smallvec = { version = "1.0", features = ["union", "may_dangle"] }
rustc_error_codes = { path = "../librustc_error_codes" }

View file

@ -25,7 +25,6 @@ pub mod parser;
use parser::{Parser, emit_unclosed_delims, make_unclosed_delims_error}; use parser::{Parser, emit_unclosed_delims, make_unclosed_delims_error};
pub mod lexer; pub mod lexer;
pub mod validate_attr; pub mod validate_attr;
pub mod error_codes;
#[derive(Clone)] #[derive(Clone)]
pub struct Directory<'a> { pub struct Directory<'a> {

View file

@ -18,6 +18,8 @@ use syntax_pos::{Span, DUMMY_SP, MultiSpan, SpanSnippetError};
use log::{debug, trace}; use log::{debug, trace};
use std::mem; use std::mem;
use rustc_error_codes::*;
const TURBOFISH: &'static str = "use `::<...>` instead of `<...>` to specify type arguments"; const TURBOFISH: &'static str = "use `::<...>` instead of `<...>` to specify type arguments";
/// Creates a placeholder argument. /// Creates a placeholder argument.

View file

@ -37,6 +37,8 @@ use std::borrow::Cow;
use std::{cmp, mem, slice}; use std::{cmp, mem, slice};
use std::path::PathBuf; use std::path::PathBuf;
use rustc_error_codes::*;
bitflags::bitflags! { bitflags::bitflags! {
struct Restrictions: u8 { struct Restrictions: u8 {
const STMT_EXPR = 1 << 0; const STMT_EXPR = 1 << 0;

View file

@ -14,6 +14,8 @@ use syntax_pos::symbol::kw;
use errors::{PResult, Applicability, pluralize}; use errors::{PResult, Applicability, pluralize};
use rustc_error_codes::*;
/// Returns `true` if `IDENT t` can start a type -- `IDENT::a::b`, `IDENT<u8, u8>`, /// Returns `true` if `IDENT t` can start a type -- `IDENT::a::b`, `IDENT<u8, u8>`,
/// `IDENT<<u8 as Trait>::AssocTy>`. /// `IDENT<<u8 as Trait>::AssocTy>`.
/// ///

View file

@ -18,3 +18,4 @@ rustc_target = { path = "../librustc_target" }
syntax = { path = "../libsyntax" } syntax = { path = "../libsyntax" }
syntax_pos = { path = "../libsyntax_pos" } syntax_pos = { path = "../libsyntax_pos" }
errors = { path = "../librustc_errors", package = "rustc_errors" } errors = { path = "../librustc_errors", package = "rustc_errors" }
rustc_error_codes = { path = "../librustc_error_codes" }

View file

@ -23,6 +23,8 @@ use syntax::{span_err, struct_span_err, walk_list};
use syntax_pos::{Span, MultiSpan}; use syntax_pos::{Span, MultiSpan};
use errors::{Applicability, FatalError}; use errors::{Applicability, FatalError};
use rustc_error_codes::*;
struct AstValidator<'a> { struct AstValidator<'a> {
session: &'a Session, session: &'a Session,
has_proc_macro_decls: bool, has_proc_macro_decls: bool,

View file

@ -11,6 +11,8 @@ use rustc::hir::itemlikevisit::ItemLikeVisitor;
use rustc::ty::TyCtxt; use rustc::ty::TyCtxt;
use rustc::ty::query::Providers; use rustc::ty::query::Providers;
use rustc_error_codes::*;
struct EntryContext<'a, 'tcx> { struct EntryContext<'a, 'tcx> {
session: &'a Session, session: &'a Session,

View file

@ -10,6 +10,8 @@ use syntax_pos::{Span, sym};
use rustc::hir::intravisit::{self, Visitor, NestedVisitorMap}; use rustc::hir::intravisit::{self, Visitor, NestedVisitorMap};
use rustc::hir; use rustc::hir;
use rustc_error_codes::*;
fn check_mod_intrinsics(tcx: TyCtxt<'_>, module_def_id: DefId) { fn check_mod_intrinsics(tcx: TyCtxt<'_>, module_def_id: DefId) {
tcx.hir().visit_item_likes_in_module( tcx.hir().visit_item_likes_in_module(
module_def_id, module_def_id,

View file

@ -20,8 +20,6 @@ extern crate syntax;
use rustc::ty::query::Providers; use rustc::ty::query::Providers;
pub mod error_codes;
pub mod ast_validation; pub mod ast_validation;
mod check_const; mod check_const;
pub mod hir_stats; pub mod hir_stats;

View file

@ -12,6 +12,8 @@ use syntax::struct_span_err;
use syntax_pos::Span; use syntax_pos::Span;
use errors::Applicability; use errors::Applicability;
use rustc_error_codes::*;
#[derive(Clone, Copy, Debug, PartialEq)] #[derive(Clone, Copy, Debug, PartialEq)]
enum Context { enum Context {
Normal, Normal,

View file

@ -16,3 +16,4 @@ rustc_metadata = { path = "../librustc_metadata" }
syntax = { path = "../libsyntax" } syntax = { path = "../libsyntax" }
syntax_expand = { path = "../libsyntax_expand" } syntax_expand = { path = "../libsyntax_expand" }
syntax_pos = { path = "../libsyntax_pos" } syntax_pos = { path = "../libsyntax_pos" }
rustc_error_codes = { path = "../librustc_error_codes" }

View file

@ -59,7 +59,6 @@
pub use registry::Registry; pub use registry::Registry;
pub mod error_codes;
pub mod registry; pub mod registry;
pub mod load; pub mod load;
pub mod build; pub mod build;

View file

@ -14,6 +14,8 @@ use syntax::struct_span_err;
use syntax::symbol::{Symbol, kw, sym}; use syntax::symbol::{Symbol, kw, sym};
use syntax_pos::{Span, DUMMY_SP}; use syntax_pos::{Span, DUMMY_SP};
use rustc_error_codes::*;
/// Pointer to a registrar function. /// Pointer to a registrar function.
pub type PluginRegistrarFun = pub type PluginRegistrarFun =
fn(&mut Registry<'_>); fn(&mut Registry<'_>);

View file

@ -14,4 +14,5 @@ rustc_typeck = { path = "../librustc_typeck" }
syntax = { path = "../libsyntax" } syntax = { path = "../libsyntax" }
syntax_pos = { path = "../libsyntax_pos" } syntax_pos = { path = "../libsyntax_pos" }
rustc_data_structures = { path = "../librustc_data_structures" } rustc_data_structures = { path = "../librustc_data_structures" }
rustc_error_codes = { path = "../librustc_error_codes" }
log = "0.4" log = "0.4"

View file

@ -30,7 +30,7 @@ use syntax_pos::Span;
use std::{cmp, fmt, mem}; use std::{cmp, fmt, mem};
use std::marker::PhantomData; use std::marker::PhantomData;
pub mod error_codes; use rustc_error_codes::*;
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
/// Generic infrastructure used to implement specific visitors below. /// Generic infrastructure used to implement specific visitors below.

View file

@ -21,4 +21,5 @@ errors = { path = "../librustc_errors", package = "rustc_errors" }
syntax_pos = { path = "../libsyntax_pos" } syntax_pos = { path = "../libsyntax_pos" }
rustc_data_structures = { path = "../librustc_data_structures" } rustc_data_structures = { path = "../librustc_data_structures" }
rustc_metadata = { path = "../librustc_metadata" } rustc_metadata = { path = "../librustc_metadata" }
rustc_error_codes = { path = "../librustc_error_codes" }
smallvec = { version = "1.0", features = ["union", "may_dangle"] } smallvec = { version = "1.0", features = ["union", "may_dangle"] }

View file

@ -46,6 +46,8 @@ use syntax_pos::{Span, DUMMY_SP};
use log::debug; use log::debug;
use rustc_error_codes::*;
type Res = def::Res<NodeId>; type Res = def::Res<NodeId>;
impl<'a> ToNameBinding<'a> for (Module<'a>, ty::Visibility, Span, ExpnId) { impl<'a> ToNameBinding<'a> for (Module<'a>, ty::Visibility, Span, ExpnId) {

View file

@ -23,6 +23,8 @@ use crate::path_names_to_string;
use crate::{BindingError, CrateLint, HasGenericParams, LegacyScope, Module, ModuleOrUniformRoot}; use crate::{BindingError, CrateLint, HasGenericParams, LegacyScope, Module, ModuleOrUniformRoot};
use crate::{PathResult, ParentScope, ResolutionError, Resolver, Scope, ScopeSet, Segment}; use crate::{PathResult, ParentScope, ResolutionError, Resolver, Scope, ScopeSet, Segment};
use rustc_error_codes::*;
type Res = def::Res<ast::NodeId>; type Res = def::Res<ast::NodeId>;
/// A vector of spans and replacements, a message and applicability. /// A vector of spans and replacements, a message and applicability.

View file

@ -30,6 +30,8 @@ use syntax_pos::Span;
use std::collections::BTreeSet; use std::collections::BTreeSet;
use std::mem::replace; use std::mem::replace;
use rustc_error_codes::*;
mod diagnostics; mod diagnostics;
type Res = def::Res<NodeId>; type Res = def::Res<NodeId>;

View file

@ -18,6 +18,8 @@ use syntax::util::lev_distance::find_best_match_for_name;
use syntax_pos::hygiene::MacroKind; use syntax_pos::hygiene::MacroKind;
use syntax_pos::Span; use syntax_pos::Span;
use rustc_error_codes::*;
type Res = def::Res<ast::NodeId>; type Res = def::Res<ast::NodeId>;
/// A field or associated item from self type suggested in case of resolution failure. /// A field or associated item from self type suggested in case of resolution failure.

View file

@ -64,9 +64,10 @@ use late::{HasGenericParams, PathSource, Rib, RibKind::*};
use resolve_imports::{ImportDirective, ImportDirectiveSubclass, NameResolution, ImportResolver}; use resolve_imports::{ImportDirective, ImportDirectiveSubclass, NameResolution, ImportResolver};
use macros::{LegacyBinding, LegacyScope}; use macros::{LegacyBinding, LegacyScope};
use rustc_error_codes::*;
type Res = def::Res<NodeId>; type Res = def::Res<NodeId>;
pub mod error_codes;
mod diagnostics; mod diagnostics;
mod late; mod late;
mod macros; mod macros;

View file

@ -30,6 +30,8 @@ use syntax::{struct_span_err, unwrap_or};
use syntax_pos::hygiene::ExpnId; use syntax_pos::hygiene::ExpnId;
use syntax_pos::{MultiSpan, Span}; use syntax_pos::{MultiSpan, Span};
use rustc_error_codes::*;
use log::*; use log::*;
use std::cell::Cell; use std::cell::Cell;

View file

@ -21,3 +21,4 @@ smallvec = { version = "1.0", features = ["union", "may_dangle"] }
syntax = { path = "../libsyntax" } syntax = { path = "../libsyntax" }
syntax_pos = { path = "../libsyntax_pos" } syntax_pos = { path = "../libsyntax_pos" }
rustc_index = { path = "../librustc_index" } rustc_index = { path = "../librustc_index" }
rustc_error_codes = { path = "../librustc_error_codes" }

View file

@ -36,6 +36,8 @@ use std::slice;
use rustc_data_structures::fx::FxHashSet; use rustc_data_structures::fx::FxHashSet;
use rustc_error_codes::*;
#[derive(Debug)] #[derive(Debug)]
pub struct PathSeg(pub DefId, pub usize); pub struct PathSeg(pub DefId, pub usize);

View file

@ -12,6 +12,8 @@ use rustc::ty::adjustment::{Adjustment, Adjust, OverloadedDeref};
use syntax_pos::Span; use syntax_pos::Span;
use syntax::ast::Ident; use syntax::ast::Ident;
use rustc_error_codes::*;
use std::iter; use std::iter;
#[derive(Copy, Clone, Debug)] #[derive(Copy, Clone, Debug)]

View file

@ -16,6 +16,8 @@ use syntax_pos::Span;
use rustc::hir; use rustc::hir;
use rustc_error_codes::*;
/// Checks that it is legal to call methods of the trait corresponding /// Checks that it is legal to call methods of the trait corresponding
/// to `trait_id` (this only cares about the trait, not the specific /// to `trait_id` (this only cares about the trait, not the specific
/// method that is called). /// method that is called).

View file

@ -46,6 +46,8 @@ use syntax::ast;
use syntax_pos::Span; use syntax_pos::Span;
use crate::util::common::ErrorReported; use crate::util::common::ErrorReported;
use rustc_error_codes::*;
/// Reifies a cast check to be checked once we have full type information for /// Reifies a cast check to be checked once we have full type information for
/// a function context. /// a function context.
pub struct CastCheck<'tcx> { pub struct CastCheck<'tcx> {

View file

@ -73,6 +73,8 @@ use syntax::symbol::sym;
use syntax_pos; use syntax_pos;
use rustc_target::spec::abi::Abi; use rustc_target::spec::abi::Abi;
use rustc_error_codes::*;
struct Coerce<'a, 'tcx> { struct Coerce<'a, 'tcx> {
fcx: &'a FnCtxt<'a, 'tcx>, fcx: &'a FnCtxt<'a, 'tcx>,
cause: ObligationCause<'tcx>, cause: ObligationCause<'tcx>,

View file

@ -14,6 +14,8 @@ use syntax::errors::pluralize;
use super::{Inherited, FnCtxt, potentially_plural_count}; use super::{Inherited, FnCtxt, potentially_plural_count};
use rustc_error_codes::*;
/// Checks that a method from an impl conforms to the signature of /// Checks that a method from an impl conforms to the signature of
/// the same method as declared in the trait. /// the same method as declared in the trait.
/// ///

View file

@ -12,6 +12,8 @@ use crate::util::common::ErrorReported;
use syntax_pos::Span; use syntax_pos::Span;
use rustc_error_codes::*;
/// This function confirms that the `Drop` implementation identified by /// This function confirms that the `Drop` implementation identified by
/// `drop_impl_did` is not any more specialized than the type it is /// `drop_impl_did` is not any more specialized than the type it is
/// attached to (Issue #8142). /// attached to (Issue #8142).

View file

@ -42,6 +42,8 @@ use rustc::ty::TypeFoldable;
use rustc::ty::subst::InternalSubsts; use rustc::ty::subst::InternalSubsts;
use rustc::traits::{self, ObligationCauseCode}; use rustc::traits::{self, ObligationCauseCode};
use rustc_error_codes::*;
use std::fmt::Display; use std::fmt::Display;
impl<'a, 'tcx> FnCtxt<'a, 'tcx> { impl<'a, 'tcx> FnCtxt<'a, 'tcx> {

View file

@ -12,6 +12,8 @@ use syntax::symbol::Symbol;
use rustc::hir; use rustc::hir;
use rustc_error_codes::*;
use std::iter; use std::iter;
fn equate_intrinsic_type<'tcx>( fn equate_intrinsic_type<'tcx>(

View file

@ -35,6 +35,8 @@ use std::mem;
use std::ops::Deref; use std::ops::Deref;
use std::cmp::max; use std::cmp::max;
use rustc_error_codes::*;
use smallvec::{smallvec, SmallVec}; use smallvec::{smallvec, SmallVec};
use self::CandidateKind::*; use self::CandidateKind::*;

View file

@ -18,6 +18,8 @@ use syntax_pos::{Span, FileName};
use syntax::ast; use syntax::ast;
use syntax::util::lev_distance; use syntax::util::lev_distance;
use rustc_error_codes::*;
use std::cmp::Ordering; use std::cmp::Ordering;
use super::{MethodError, NoMatchData, CandidateSource}; use super::{MethodError, NoMatchData, CandidateSource};

View file

@ -130,6 +130,8 @@ use syntax::source_map::{DUMMY_SP, original_sp};
use syntax::symbol::{kw, sym, Ident}; use syntax::symbol::{kw, sym, Ident};
use syntax::util::parser::ExprPrecedence; use syntax::util::parser::ExprPrecedence;
use rustc_error_codes::*;
use std::cell::{Cell, RefCell, Ref, RefMut}; use std::cell::{Cell, RefCell, Ref, RefMut};
use std::collections::hash_map::Entry; use std::collections::hash_map::Entry;
use std::cmp; use std::cmp;

View file

@ -11,6 +11,8 @@ use syntax_pos::Span;
use syntax::ast::Ident; use syntax::ast::Ident;
use rustc::hir; use rustc::hir;
use rustc_error_codes::*;
impl<'a, 'tcx> FnCtxt<'a, 'tcx> { impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
/// Checks a `a <op>= b` /// Checks a `a <op>= b`
pub fn check_binop_assign( pub fn check_binop_assign(

View file

@ -14,6 +14,8 @@ use syntax::util::lev_distance::find_best_match_for_name;
use syntax_pos::Span; use syntax_pos::Span;
use syntax_pos::hygiene::DesugaringKind; use syntax_pos::hygiene::DesugaringKind;
use rustc_error_codes::*;
use std::collections::hash_map::Entry::{Occupied, Vacant}; use std::collections::hash_map::Entry::{Occupied, Vacant};
use std::cmp; use std::cmp;

View file

@ -18,6 +18,8 @@ use errors::{DiagnosticBuilder, DiagnosticId};
use rustc::hir::itemlikevisit::ParItemLikeVisitor; use rustc::hir::itemlikevisit::ParItemLikeVisitor;
use rustc::hir; use rustc::hir;
use rustc_error_codes::*;
/// Helper type of a temporary returned by `.for_item(...)`. /// Helper type of a temporary returned by `.for_item(...)`.
/// This is necessary because we can't write the following bound: /// This is necessary because we can't write the following bound:
/// ///

View file

@ -17,6 +17,8 @@ use rustc::hir::def_id::DefId;
use hir::Node; use hir::Node;
use rustc::hir::{self, ItemKind}; use rustc::hir::{self, ItemKind};
use rustc_error_codes::*;
pub fn check_trait(tcx: TyCtxt<'_>, trait_def_id: DefId) { pub fn check_trait(tcx: TyCtxt<'_>, trait_def_id: DefId) {
Checker { tcx, trait_def_id } Checker { tcx, trait_def_id }
.check(tcx.lang_items().drop_trait(), visit_implementation_of_drop) .check(tcx.lang_items().drop_trait(), visit_implementation_of_drop)

View file

@ -15,6 +15,8 @@ use rustc::ty::{self, CrateInherentImpls, TyCtxt};
use syntax::ast; use syntax::ast;
use syntax_pos::Span; use syntax_pos::Span;
use rustc_error_codes::*;
/// On-demand query: yields a map containing all types mapped to their inherent impls. /// On-demand query: yields a map containing all types mapped to their inherent impls.
pub fn crate_inherent_impls( pub fn crate_inherent_impls(
tcx: TyCtxt<'_>, tcx: TyCtxt<'_>,

View file

@ -5,6 +5,8 @@ use rustc::hir::itemlikevisit::ItemLikeVisitor;
use rustc::traits::{self, IntercrateMode}; use rustc::traits::{self, IntercrateMode};
use rustc::ty::TyCtxt; use rustc::ty::TyCtxt;
use rustc_error_codes::*;
pub fn crate_inherent_impls_overlap_check(tcx: TyCtxt<'_>, crate_num: CrateNum) { pub fn crate_inherent_impls_overlap_check(tcx: TyCtxt<'_>, crate_num: CrateNum) {
assert_eq!(crate_num, LOCAL_CRATE); assert_eq!(crate_num, LOCAL_CRATE);
let krate = tcx.hir().krate(); let krate = tcx.hir().krate();

View file

@ -12,6 +12,8 @@ use rustc::ty::{self, TyCtxt, TypeFoldable};
use rustc::ty::query::Providers; use rustc::ty::query::Providers;
use rustc::util::common::time; use rustc::util::common::time;
use rustc_error_codes::*;
mod builtin; mod builtin;
mod inherent_impls; mod inherent_impls;
mod inherent_impls_overlap; mod inherent_impls_overlap;

View file

@ -6,6 +6,8 @@ use rustc::ty::{self, TyCtxt};
use rustc::hir::itemlikevisit::ItemLikeVisitor; use rustc::hir::itemlikevisit::ItemLikeVisitor;
use rustc::hir; use rustc::hir;
use rustc_error_codes::*;
pub fn check(tcx: TyCtxt<'_>) { pub fn check(tcx: TyCtxt<'_>) {
let mut orphan = OrphanChecker { tcx }; let mut orphan = OrphanChecker { tcx };
tcx.hir().krate().visit_all_item_likes(&mut orphan); tcx.hir().krate().visit_all_item_likes(&mut orphan);

View file

@ -5,6 +5,8 @@ use rustc::ty::TyCtxt;
use rustc::hir::itemlikevisit::ItemLikeVisitor; use rustc::hir::itemlikevisit::ItemLikeVisitor;
use rustc::hir::{self, Unsafety}; use rustc::hir::{self, Unsafety};
use rustc_error_codes::*;
pub fn check(tcx: TyCtxt<'_>) { pub fn check(tcx: TyCtxt<'_>) {
let mut unsafety = UnsafetyChecker { tcx }; let mut unsafety = UnsafetyChecker { tcx };
tcx.hir().krate().visit_all_item_likes(&mut unsafety); tcx.hir().krate().visit_all_item_likes(&mut unsafety);

View file

@ -48,6 +48,8 @@ use rustc::hir::{self, CodegenFnAttrFlags, CodegenFnAttrs, Unsafety};
use errors::{Applicability, DiagnosticId, StashKey}; use errors::{Applicability, DiagnosticId, StashKey};
use rustc_error_codes::*;
struct OnlySelfBounds(bool); struct OnlySelfBounds(bool);
/////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////

View file

@ -19,6 +19,8 @@ use std::collections::hash_map::Entry::{Occupied, Vacant};
use syntax_pos::Span; use syntax_pos::Span;
use rustc_error_codes::*;
/// Checks that all the type/lifetime parameters on an impl also /// Checks that all the type/lifetime parameters on an impl also
/// appear in the trait ref or self type (or are constrained by a /// appear in the trait ref or self type (or are constrained by a
/// where-clause). These rules are needed to ensure that, given a /// where-clause). These rules are needed to ensure that, given a

View file

@ -75,8 +75,6 @@ This API is completely unstable and subject to change.
#[macro_use] extern crate rustc; #[macro_use] extern crate rustc;
pub mod error_codes;
mod astconv; mod astconv;
mod check; mod check;
mod check_unused; mod check_unused;
@ -106,6 +104,8 @@ use rustc::util;
use syntax_pos::{DUMMY_SP, Span}; use syntax_pos::{DUMMY_SP, Span};
use util::common::time; use util::common::time;
use rustc_error_codes::*;
use std::iter; use std::iter;
use astconv::{AstConv, Bounds}; use astconv::{AstConv, Bounds};

View file

@ -3,6 +3,8 @@ use rustc::hir::itemlikevisit::ItemLikeVisitor;
use rustc::ty::TyCtxt; use rustc::ty::TyCtxt;
use syntax::symbol::sym; use syntax::symbol::sym;
use rustc_error_codes::*;
pub fn test_inferred_outlives(tcx: TyCtxt<'_>) { pub fn test_inferred_outlives(tcx: TyCtxt<'_>) {
tcx.hir() tcx.hir()
.krate() .krate()

View file

@ -3,6 +3,8 @@ use syntax_pos::Span;
use errors::{Applicability, DiagnosticId, DiagnosticBuilder}; use errors::{Applicability, DiagnosticId, DiagnosticBuilder};
use rustc::ty::{Ty, TypeFoldable}; use rustc::ty::{Ty, TypeFoldable};
use rustc_error_codes::*;
pub trait StructuredDiagnostic<'tcx> { pub trait StructuredDiagnostic<'tcx> {
fn session(&self) -> &Session; fn session(&self) -> &Session;

View file

@ -3,6 +3,8 @@ use rustc::hir::itemlikevisit::ItemLikeVisitor;
use rustc::ty::TyCtxt; use rustc::ty::TyCtxt;
use syntax::symbol::sym; use syntax::symbol::sym;
use rustc_error_codes::*;
pub fn test_variance(tcx: TyCtxt<'_>) { pub fn test_variance(tcx: TyCtxt<'_>) {
tcx.hir().krate().visit_all_item_likes(&mut VarianceTest { tcx }); tcx.hir().krate().visit_all_item_likes(&mut VarianceTest { tcx });
} }

View file

@ -21,3 +21,4 @@ rustc_data_structures = { path = "../librustc_data_structures" }
rustc_index = { path = "../librustc_index" } rustc_index = { path = "../librustc_index" }
rustc_lexer = { path = "../librustc_lexer" } rustc_lexer = { path = "../librustc_lexer" }
smallvec = { version = "1.0", features = ["union", "may_dangle"] } smallvec = { version = "1.0", features = ["union", "may_dangle"] }
rustc_error_codes = { path = "../librustc_error_codes" }

View file

@ -12,6 +12,8 @@ use syntax_pos::{symbol::Symbol, symbol::sym, Span};
use super::{mark_used, MetaItemKind}; use super::{mark_used, MetaItemKind};
use rustc_error_codes::*;
enum AttrError { enum AttrError {
MultipleItem(String), MultipleItem(String),
UnknownMetaItem(String, &'static [&'static str]), UnknownMetaItem(String, &'static [&'static str]),

View file

@ -1,7 +1,7 @@
#[macro_export] #[macro_export]
macro_rules! diagnostic_used { macro_rules! diagnostic_used {
($code:ident) => ( ($code:ident) => (
let _ = crate::error_codes::$code; let _ = $code;
) )
} }
@ -167,25 +167,3 @@ macro_rules! help {
($err).help(&format!($($message)*)); ($err).help(&format!($($message)*));
}) })
} }
#[macro_export]
macro_rules! register_diagnostics {
($($ecode:ident: $message:expr,)*) => (
$crate::register_diagnostics!{$($ecode:$message,)* ;}
);
($($ecode:ident: $message:expr,)* ; $($code:ident,)*) => (
pub static DIAGNOSTICS: &[(&str, &str)] = &[
$( (stringify!($ecode), $message), )*
];
$(
#[deny(unused)]
pub(crate) const $ecode: &str = $message;
)*
$(
#[deny(unused)]
pub(crate) const $code: () = ();
)*
)
}

Some files were not shown because too many files have changed in this diff Show more