diff --git a/Cargo.lock b/Cargo.lock index f33d7ff12febf..48bc269ebb654 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3092,7 +3092,6 @@ dependencies = [ "rustc-rayon-core", "rustc_apfloat", "rustc_data_structures", - "rustc_error_codes", "rustc_errors", "rustc_feature", "rustc_hir", @@ -3358,7 +3357,6 @@ dependencies = [ "log", "rustc", "rustc_data_structures", - "rustc_error_codes", "rustc_errors", "rustc_hir", "rustc_index", @@ -3375,7 +3373,6 @@ version = "0.0.0" dependencies = [ "log", "rustc_data_structures", - "rustc_error_codes", "rustc_errors", "rustc_feature", "rustc_parse", @@ -3391,7 +3388,6 @@ dependencies = [ "fmt_macros", "log", "rustc_data_structures", - "rustc_error_codes", "rustc_errors", "rustc_expand", "rustc_feature", @@ -3445,7 +3441,6 @@ dependencies = [ "rustc_apfloat", "rustc_codegen_utils", "rustc_data_structures", - "rustc_error_codes", "rustc_errors", "rustc_fs_util", "rustc_hir", @@ -3675,7 +3670,6 @@ dependencies = [ "log", "rustc", "rustc_data_structures", - "rustc_error_codes", "rustc_errors", "rustc_feature", "rustc_hir", @@ -3716,7 +3710,6 @@ dependencies = [ "memmap", "rustc", "rustc_data_structures", - "rustc_error_codes", "rustc_errors", "rustc_expand", "rustc_hir", @@ -3744,7 +3737,6 @@ dependencies = [ "rustc", "rustc_apfloat", "rustc_data_structures", - "rustc_error_codes", "rustc_errors", "rustc_hir", "rustc_index", @@ -3767,7 +3759,6 @@ dependencies = [ "rustc", "rustc_apfloat", "rustc_data_structures", - "rustc_error_codes", "rustc_errors", "rustc_hir", "rustc_index", @@ -3786,7 +3777,6 @@ dependencies = [ "bitflags", "log", "rustc_data_structures", - "rustc_error_codes", "rustc_errors", "rustc_feature", "rustc_lexer", @@ -3804,7 +3794,6 @@ dependencies = [ "log", "rustc", "rustc_data_structures", - "rustc_error_codes", "rustc_errors", "rustc_feature", "rustc_hir", @@ -3820,7 +3809,6 @@ name = "rustc_plugin_impl" version = "0.0.0" dependencies = [ "rustc", - "rustc_error_codes", "rustc_errors", "rustc_hir", "rustc_lint", @@ -3836,7 +3824,6 @@ dependencies = [ "log", "rustc", "rustc_data_structures", - "rustc_error_codes", "rustc_errors", "rustc_hir", "rustc_span", @@ -3854,7 +3841,6 @@ dependencies = [ "rustc", "rustc_ast_lowering", "rustc_data_structures", - "rustc_error_codes", "rustc_errors", "rustc_expand", "rustc_feature", @@ -3890,7 +3876,6 @@ dependencies = [ "log", "num_cpus", "rustc_data_structures", - "rustc_error_codes", "rustc_errors", "rustc_feature", "rustc_fs_util", @@ -3973,7 +3958,6 @@ dependencies = [ "log", "rustc", "rustc_data_structures", - "rustc_error_codes", "rustc_errors", "rustc_hir", "rustc_index", @@ -4493,7 +4477,6 @@ version = "0.0.0" dependencies = [ "log", "rustc_data_structures", - "rustc_error_codes", "rustc_errors", "rustc_feature", "rustc_index", diff --git a/src/libcore/ptr/mod.rs b/src/libcore/ptr/mod.rs index d7b351f13458a..c1976868bf760 100644 --- a/src/libcore/ptr/mod.rs +++ b/src/libcore/ptr/mod.rs @@ -169,22 +169,12 @@ mod mut_ptr; /// i.e., you do not usually have to worry about such issues unless you call `drop_in_place` /// manually. #[stable(feature = "drop_in_place", since = "1.8.0")] -#[inline(always)] -pub unsafe fn drop_in_place(to_drop: *mut T) { - real_drop_in_place(&mut *to_drop) -} - -// The real `drop_in_place` -- the one that gets called implicitly when variables go -// out of scope -- should have a safe reference and not a raw pointer as argument -// type. When we drop a local variable, we access it with a pointer that behaves -// like a safe reference; transmuting that to a raw pointer does not mean we can -// actually access it with raw pointers. #[lang = "drop_in_place"] #[allow(unconditional_recursion)] -unsafe fn real_drop_in_place(to_drop: &mut T) { +pub unsafe fn drop_in_place(to_drop: *mut T) { // Code here does not matter - this is replaced by the // real drop glue by the compiler. - real_drop_in_place(to_drop) + drop_in_place(to_drop) } /// Creates a null raw pointer. diff --git a/src/librustc/Cargo.toml b/src/librustc/Cargo.toml index 323ce3b6cbb6d..b65635be54a3f 100644 --- a/src/librustc/Cargo.toml +++ b/src/librustc/Cargo.toml @@ -37,5 +37,4 @@ byteorder = { version = "1.3" } chalk-engine = { version = "0.9.0", default-features=false } smallvec = { version = "1.0", features = ["union", "may_dangle"] } measureme = "0.7.1" -rustc_error_codes = { path = "../librustc_error_codes" } rustc_session = { path = "../librustc_session" } diff --git a/src/librustc/hir/check_attr.rs b/src/librustc/hir/check_attr.rs index 5a4d7ceea2734..86eab3d92d366 100644 --- a/src/librustc/hir/check_attr.rs +++ b/src/librustc/hir/check_attr.rs @@ -8,7 +8,6 @@ use crate::hir::map::Map; use crate::ty::query::Providers; use crate::ty::TyCtxt; -use rustc_error_codes::*; use rustc_errors::struct_span_err; use rustc_hir as hir; use rustc_hir::def_id::DefId; diff --git a/src/librustc/infer/error_reporting/mod.rs b/src/librustc/infer/error_reporting/mod.rs index a2009461fa568..77182b97fd450 100644 --- a/src/librustc/infer/error_reporting/mod.rs +++ b/src/librustc/infer/error_reporting/mod.rs @@ -65,7 +65,6 @@ use crate::ty::{ Region, Ty, TyCtxt, TypeFoldable, }; use rustc_data_structures::fx::{FxHashMap, FxHashSet}; -use rustc_error_codes::*; use rustc_errors::{pluralize, struct_span_err}; use rustc_errors::{Applicability, DiagnosticBuilder, DiagnosticStyledString}; use rustc_hir as hir; diff --git a/src/librustc/infer/error_reporting/need_type_info.rs b/src/librustc/infer/error_reporting/need_type_info.rs index 70f7987faf4cc..9947dea234096 100644 --- a/src/librustc/infer/error_reporting/need_type_info.rs +++ b/src/librustc/infer/error_reporting/need_type_info.rs @@ -13,8 +13,6 @@ use rustc_span::symbol::kw; use rustc_span::Span; use std::borrow::Cow; -use rustc_error_codes::*; - struct FindLocalByTypeVisitor<'a, 'tcx> { infcx: &'a InferCtxt<'a, 'tcx>, target_ty: Ty<'tcx>, diff --git a/src/librustc/infer/error_reporting/nice_region_error/different_lifetimes.rs b/src/librustc/infer/error_reporting/nice_region_error/different_lifetimes.rs index d6e50209f72dd..8f4c643992001 100644 --- a/src/librustc/infer/error_reporting/nice_region_error/different_lifetimes.rs +++ b/src/librustc/infer/error_reporting/nice_region_error/different_lifetimes.rs @@ -5,7 +5,6 @@ use crate::infer::error_reporting::nice_region_error::util::AnonymousParamInfo; use crate::infer::error_reporting::nice_region_error::NiceRegionError; use crate::util::common::ErrorReported; -use rustc_error_codes::*; use rustc_errors::struct_span_err; impl<'a, 'tcx> NiceRegionError<'a, 'tcx> { diff --git a/src/librustc/infer/error_reporting/nice_region_error/named_anon_conflict.rs b/src/librustc/infer/error_reporting/nice_region_error/named_anon_conflict.rs index 2344d408a43a5..df37f53606b37 100644 --- a/src/librustc/infer/error_reporting/nice_region_error/named_anon_conflict.rs +++ b/src/librustc/infer/error_reporting/nice_region_error/named_anon_conflict.rs @@ -5,8 +5,6 @@ use crate::ty; use rustc_errors::{struct_span_err, Applicability, DiagnosticBuilder}; use rustc_hir::{FunctionRetTy, TyKind}; -use rustc_error_codes::*; - impl<'a, 'tcx> NiceRegionError<'a, 'tcx> { /// When given a `ConcreteFailure` for a function with parameters containing a named region and /// an anonymous region, emit an descriptive diagnostic error. diff --git a/src/librustc/infer/error_reporting/note.rs b/src/librustc/infer/error_reporting/note.rs index 6303104e39dd3..11dda71b8cb89 100644 --- a/src/librustc/infer/error_reporting/note.rs +++ b/src/librustc/infer/error_reporting/note.rs @@ -5,8 +5,6 @@ use crate::ty::error::TypeError; use crate::ty::{self, Region}; use rustc_errors::{struct_span_err, DiagnosticBuilder}; -use rustc_error_codes::*; - impl<'a, 'tcx> InferCtxt<'a, 'tcx> { pub(super) fn note_region_origin( &self, diff --git a/src/librustc/infer/opaque_types/mod.rs b/src/librustc/infer/opaque_types/mod.rs index ee214bea7b8fc..fe3a5d149f676 100644 --- a/src/librustc/infer/opaque_types/mod.rs +++ b/src/librustc/infer/opaque_types/mod.rs @@ -15,8 +15,6 @@ use rustc_hir::def_id::{DefId, DefIdMap}; use rustc_hir::Node; use rustc_span::Span; -use rustc_error_codes::*; - pub type OpaqueTypeMap<'tcx> = DefIdMap>; /// Information about the opaque types whose values we diff --git a/src/librustc/middle/lang_items.rs b/src/librustc/middle/lang_items.rs index 643359f098b4d..27b769742a9fc 100644 --- a/src/librustc/middle/lang_items.rs +++ b/src/librustc/middle/lang_items.rs @@ -24,8 +24,6 @@ use rustc_span::symbol::{sym, Symbol}; use rustc_span::Span; use syntax::ast; -use rustc_error_codes::*; - // 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. macro_rules! language_item_table { diff --git a/src/librustc/middle/weak_lang_items.rs b/src/librustc/middle/weak_lang_items.rs index fdffd1251ce8f..5571f8f2313d5 100644 --- a/src/librustc/middle/weak_lang_items.rs +++ b/src/librustc/middle/weak_lang_items.rs @@ -15,8 +15,6 @@ use rustc_span::Span; use rustc_target::spec::PanicStrategy; use syntax::ast; -use rustc_error_codes::*; - macro_rules! weak_lang_items { ($($name:ident, $item:ident, $sym:ident;)*) => ( diff --git a/src/librustc/mir/interpret/error.rs b/src/librustc/mir/interpret/error.rs index 42d896af8014d..349dbd74ad1c9 100644 --- a/src/librustc/mir/interpret/error.rs +++ b/src/librustc/mir/interpret/error.rs @@ -16,8 +16,6 @@ use rustc_span::{Pos, Span}; use rustc_target::spec::abi::Abi; use std::{any::Any, env, fmt}; -use rustc_error_codes::*; - #[derive(Debug, Copy, Clone, PartialEq, Eq, HashStable, RustcEncodable, RustcDecodable)] pub enum ErrorHandled { /// Already reported a lint or an error for this evaluation. diff --git a/src/librustc/traits/error_reporting/mod.rs b/src/librustc/traits/error_reporting/mod.rs index db3173989ac60..646cb80bffd94 100644 --- a/src/librustc/traits/error_reporting/mod.rs +++ b/src/librustc/traits/error_reporting/mod.rs @@ -30,8 +30,6 @@ use rustc_span::{ExpnKind, Span, DUMMY_SP}; use std::fmt; use syntax::ast; -use rustc_error_codes::*; - impl<'a, 'tcx> InferCtxt<'a, 'tcx> { pub fn report_fulfillment_errors( &self, diff --git a/src/librustc/traits/error_reporting/suggestions.rs b/src/librustc/traits/error_reporting/suggestions.rs index c09fd3079731c..c18e17581ceb6 100644 --- a/src/librustc/traits/error_reporting/suggestions.rs +++ b/src/librustc/traits/error_reporting/suggestions.rs @@ -20,8 +20,6 @@ use rustc_span::symbol::{kw, sym}; use rustc_span::{MultiSpan, Span, DUMMY_SP}; use std::fmt; -use rustc_error_codes::*; - impl<'a, 'tcx> InferCtxt<'a, 'tcx> { crate fn suggest_restricting_param_bound( &self, diff --git a/src/librustc/traits/on_unimplemented.rs b/src/librustc/traits/on_unimplemented.rs index 1afe153bb1361..669ec5ccc9b98 100644 --- a/src/librustc/traits/on_unimplemented.rs +++ b/src/librustc/traits/on_unimplemented.rs @@ -11,8 +11,6 @@ use rustc_span::Span; use syntax::ast::{MetaItem, NestedMetaItem}; use syntax::attr; -use rustc_error_codes::*; - #[derive(Clone, Debug)] pub struct OnUnimplementedFormatString(Symbol); diff --git a/src/librustc/traits/query/dropck_outlives.rs b/src/librustc/traits/query/dropck_outlives.rs index 34866b684de01..2e5ef5adcd30e 100644 --- a/src/librustc/traits/query/dropck_outlives.rs +++ b/src/librustc/traits/query/dropck_outlives.rs @@ -6,8 +6,6 @@ use crate::ty::{self, Ty, TyCtxt}; use rustc_span::source_map::Span; use std::iter::FromIterator; -use rustc_error_codes::*; - impl<'cx, 'tcx> At<'cx, 'tcx> { /// Given a type `ty` of some value being dropped, computes a set /// of "kinds" (types, regions) that must be outlive the execution diff --git a/src/librustc/traits/specialize/mod.rs b/src/librustc/traits/specialize/mod.rs index f5199dbdabb2f..e559ea391cde0 100644 --- a/src/librustc/traits/specialize/mod.rs +++ b/src/librustc/traits/specialize/mod.rs @@ -25,8 +25,6 @@ use rustc_span::DUMMY_SP; use super::util::impl_trait_ref_and_oblig; use super::{FulfillmentContext, SelectionContext}; -use rustc_error_codes::*; - /// Information pertinent to an overlapping impl error. #[derive(Debug)] pub struct OverlapError { diff --git a/src/librustc/ty/query/plumbing.rs b/src/librustc/ty/query/plumbing.rs index 84efbe21f10aa..117a38c655eaa 100644 --- a/src/librustc/ty/query/plumbing.rs +++ b/src/librustc/ty/query/plumbing.rs @@ -25,8 +25,6 @@ use std::hash::{Hash, Hasher}; use std::mem; use std::ptr; -use rustc_error_codes::*; - pub struct QueryCache<'tcx, D: QueryConfig<'tcx> + ?Sized> { pub(super) results: FxHashMap>, pub(super) active: FxHashMap>, diff --git a/src/librustc_ast_lowering/Cargo.toml b/src/librustc_ast_lowering/Cargo.toml index 408e9a75d93dd..4b786d6245fc4 100644 --- a/src/librustc_ast_lowering/Cargo.toml +++ b/src/librustc_ast_lowering/Cargo.toml @@ -17,7 +17,6 @@ rustc_target = { path = "../librustc_target" } rustc_data_structures = { path = "../librustc_data_structures" } rustc_index = { path = "../librustc_index" } rustc_span = { path = "../librustc_span" } -rustc_error_codes = { path = "../librustc_error_codes" } rustc_errors = { path = "../librustc_errors" } rustc_session = { path = "../librustc_session" } syntax = { path = "../libsyntax" } diff --git a/src/librustc_ast_lowering/expr.rs b/src/librustc_ast_lowering/expr.rs index 2866a1624de5b..a24bb52150a72 100644 --- a/src/librustc_ast_lowering/expr.rs +++ b/src/librustc_ast_lowering/expr.rs @@ -2,7 +2,6 @@ use super::{ImplTraitContext, LoweringContext, ParamMode, ParenthesizedGenericAr use rustc::bug; use rustc_data_structures::thin_vec::ThinVec; -use rustc_error_codes::*; use rustc_errors::struct_span_err; use rustc_hir as hir; use rustc_hir::def::Res; diff --git a/src/librustc_ast_lowering/item.rs b/src/librustc_ast_lowering/item.rs index 6da2d457f3c3b..bcc40b0c9c9c9 100644 --- a/src/librustc_ast_lowering/item.rs +++ b/src/librustc_ast_lowering/item.rs @@ -3,7 +3,6 @@ use super::{ImplTraitContext, ImplTraitPosition, ImplTraitTypeIdVisitor}; use rustc::arena::Arena; use rustc::bug; -use rustc_error_codes::*; use rustc_errors::struct_span_err; use rustc_hir as hir; use rustc_hir::def::{DefKind, Res}; diff --git a/src/librustc_ast_lowering/lib.rs b/src/librustc_ast_lowering/lib.rs index 76a0889c376a2..2cd4a6eb7e21b 100644 --- a/src/librustc_ast_lowering/lib.rs +++ b/src/librustc_ast_lowering/lib.rs @@ -41,7 +41,6 @@ use rustc::{bug, span_bug}; use rustc_data_structures::captures::Captures; use rustc_data_structures::fx::FxHashSet; use rustc_data_structures::sync::Lrc; -use rustc_error_codes::*; use rustc_errors::struct_span_err; use rustc_hir as hir; use rustc_hir::def::{DefKind, Namespace, PartialRes, PerNS, Res}; diff --git a/src/librustc_ast_lowering/path.rs b/src/librustc_ast_lowering/path.rs index 65347d379bd6a..e5f7df6dbf9e4 100644 --- a/src/librustc_ast_lowering/path.rs +++ b/src/librustc_ast_lowering/path.rs @@ -3,7 +3,6 @@ use super::{GenericArgsCtor, ParenthesizedGenericArgs}; use rustc::lint::builtin::ELIDED_LIFETIMES_IN_PATHS; use rustc::span_bug; -use rustc_error_codes::*; use rustc_errors::{struct_span_err, Applicability}; use rustc_hir as hir; use rustc_hir::def::{DefKind, PartialRes, Res}; diff --git a/src/librustc_ast_passes/Cargo.toml b/src/librustc_ast_passes/Cargo.toml index 2d45e28044495..25b1acebd2a08 100644 --- a/src/librustc_ast_passes/Cargo.toml +++ b/src/librustc_ast_passes/Cargo.toml @@ -12,7 +12,6 @@ path = "lib.rs" log = "0.4" rustc_data_structures = { path = "../librustc_data_structures" } rustc_errors = { path = "../librustc_errors" } -rustc_error_codes = { path = "../librustc_error_codes" } rustc_feature = { path = "../librustc_feature" } rustc_parse = { path = "../librustc_parse" } rustc_session = { path = "../librustc_session" } diff --git a/src/librustc_ast_passes/ast_validation.rs b/src/librustc_ast_passes/ast_validation.rs index 23701459025ae..bc02406aa2158 100644 --- a/src/librustc_ast_passes/ast_validation.rs +++ b/src/librustc_ast_passes/ast_validation.rs @@ -23,8 +23,6 @@ use syntax::print::pprust; use syntax::visit::{self, Visitor}; use syntax::walk_list; -use rustc_error_codes::*; - /// A syntactic context that disallows certain kinds of bounds (e.g., `?Trait` or `?const Trait`). #[derive(Clone, Copy)] enum BoundContext { diff --git a/src/librustc_ast_passes/feature_gate.rs b/src/librustc_ast_passes/feature_gate.rs index 461072873bb52..953127429d5aa 100644 --- a/src/librustc_ast_passes/feature_gate.rs +++ b/src/librustc_ast_passes/feature_gate.rs @@ -1,4 +1,3 @@ -use rustc_error_codes::*; use rustc_errors::{struct_span_err, Handler}; use rustc_feature::{AttributeGate, BUILTIN_ATTRIBUTE_MAP}; use rustc_feature::{Features, GateIssue, UnstableFeatures}; diff --git a/src/librustc_builtin_macros/Cargo.toml b/src/librustc_builtin_macros/Cargo.toml index f291eaf93580b..3ce7f5d770ed1 100644 --- a/src/librustc_builtin_macros/Cargo.toml +++ b/src/librustc_builtin_macros/Cargo.toml @@ -22,4 +22,3 @@ smallvec = { version = "1.0", features = ["union", "may_dangle"] } syntax = { path = "../libsyntax" } rustc_expand = { path = "../librustc_expand" } rustc_span = { path = "../librustc_span" } -rustc_error_codes = { path = "../librustc_error_codes" } diff --git a/src/librustc_builtin_macros/asm.rs b/src/librustc_builtin_macros/asm.rs index a6b45e0567c72..4723544316faf 100644 --- a/src/librustc_builtin_macros/asm.rs +++ b/src/librustc_builtin_macros/asm.rs @@ -12,8 +12,6 @@ use syntax::ptr::P; use syntax::token::{self, Token}; use syntax::tokenstream::{self, TokenStream}; -use rustc_error_codes::*; - enum State { Asm, Outputs, diff --git a/src/librustc_builtin_macros/deriving/default.rs b/src/librustc_builtin_macros/deriving/default.rs index 72c41ad9745c1..b4f059e94c15e 100644 --- a/src/librustc_builtin_macros/deriving/default.rs +++ b/src/librustc_builtin_macros/deriving/default.rs @@ -9,8 +9,6 @@ use rustc_span::Span; use syntax::ast::{Expr, MetaItem}; use syntax::ptr::P; -use rustc_error_codes::*; - pub fn expand_deriving_default( cx: &mut ExtCtxt<'_>, span: Span, diff --git a/src/librustc_codegen_ssa/Cargo.toml b/src/librustc_codegen_ssa/Cargo.toml index eb192b27405e9..9f8b4e72a9cbf 100644 --- a/src/librustc_codegen_ssa/Cargo.toml +++ b/src/librustc_codegen_ssa/Cargo.toml @@ -32,5 +32,4 @@ rustc_hir = { path = "../librustc_hir" } rustc_incremental = { path = "../librustc_incremental" } rustc_index = { path = "../librustc_index" } rustc_target = { path = "../librustc_target" } -rustc_error_codes = { path = "../librustc_error_codes" } rustc_session = { path = "../librustc_session" } diff --git a/src/librustc_codegen_ssa/common.rs b/src/librustc_codegen_ssa/common.rs index e4531a77656a3..28b61e0b36d64 100644 --- a/src/librustc_codegen_ssa/common.rs +++ b/src/librustc_codegen_ssa/common.rs @@ -13,8 +13,6 @@ use rustc_hir::def_id::DefId; use crate::traits::BuilderMethods; use rustc_hir as hir; -use rustc_error_codes::*; - pub enum IntPredicate { IntEQ, IntNE, diff --git a/src/librustc_codegen_ssa/mir/statement.rs b/src/librustc_codegen_ssa/mir/statement.rs index 574c06d9ceb41..8422c625d634e 100644 --- a/src/librustc_codegen_ssa/mir/statement.rs +++ b/src/librustc_codegen_ssa/mir/statement.rs @@ -7,8 +7,6 @@ use super::OperandValue; use crate::traits::BuilderMethods; use crate::traits::*; -use rustc_error_codes::*; - impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> { pub fn codegen_statement(&mut self, mut bx: Bx, statement: &mir::Statement<'tcx>) -> Bx { debug!("codegen_statement(statement={:?})", statement); diff --git a/src/librustc_error_codes/error_codes/E0201.md b/src/librustc_error_codes/error_codes/E0201.md index bdbf02f0033ab..0e1a7b7b7deb1 100644 --- a/src/librustc_error_codes/error_codes/E0201.md +++ b/src/librustc_error_codes/error_codes/E0201.md @@ -1,7 +1,7 @@ -It is an error to define two associated items (like methods, associated types, -associated functions, etc.) with the same identifier. +Two associated items (like methods, associated types, associated functions, +etc.) were defined with the same identifier. -For example: +Erroneous code example: ```compile_fail,E0201 struct Foo(u8); diff --git a/src/librustc_error_codes/error_codes/E0204.md b/src/librustc_error_codes/error_codes/E0204.md index 315690111359f..96e44758be4fd 100644 --- a/src/librustc_error_codes/error_codes/E0204.md +++ b/src/librustc_error_codes/error_codes/E0204.md @@ -1,21 +1,24 @@ -An attempt to implement the `Copy` trait for a struct failed because one of the -fields does not implement `Copy`. To fix this, you must implement `Copy` for the -mentioned field. Note that this may not be possible, as in the example of +The `Copy` trait was implemented on a type which contains a field that doesn't +implement the `Copy` trait. + +Erroneous code example: ```compile_fail,E0204 struct Foo { - foo : Vec, + foo: Vec, } -impl Copy for Foo { } +impl Copy for Foo { } // error! ``` -This fails because `Vec` does not implement `Copy` for any `T`. +The `Copy` trait is implemented by default only on primitive types. If your +type only contains primitive types, you'll be able to implement `Copy` on it. +Otherwise, it won't be possible. Here's another example that will fail: ```compile_fail,E0204 -#[derive(Copy)] +#[derive(Copy)] // error! struct Foo<'a> { ty: &'a mut bool, } diff --git a/src/librustc_error_codes/lib.rs b/src/librustc_error_codes/lib.rs index 14210fd69ad51..f051fdd11b807 100644 --- a/src/librustc_error_codes/lib.rs +++ b/src/librustc_error_codes/lib.rs @@ -6,16 +6,8 @@ macro_rules! register_diagnostics { pub static DIAGNOSTICS: &[(&str, &str)] = &[ $( (stringify!($ecode), $message), )* ]; - - $( - pub const $ecode: () = (); - )* - $( - pub const $code: () = (); - )* ) } mod error_codes; - -pub use error_codes::*; +pub use error_codes::DIAGNOSTICS; diff --git a/src/librustc_errors/diagnostic_builder.rs b/src/librustc_errors/diagnostic_builder.rs index 73f66d5503740..3c217c1d64373 100644 --- a/src/librustc_errors/diagnostic_builder.rs +++ b/src/librustc_errors/diagnostic_builder.rs @@ -399,8 +399,5 @@ macro_rules! struct_span_err { #[macro_export] macro_rules! error_code { - ($code:ident) => {{ - let _ = $code; - $crate::DiagnosticId::Error(stringify!($code).to_owned()) - }}; + ($code:ident) => {{ $crate::DiagnosticId::Error(stringify!($code).to_owned()) }}; } diff --git a/src/librustc_lint/Cargo.toml b/src/librustc_lint/Cargo.toml index abf9f96e6475b..7e23e70577975 100644 --- a/src/librustc_lint/Cargo.toml +++ b/src/librustc_lint/Cargo.toml @@ -13,7 +13,6 @@ log = "0.4" unicode-security = "0.0.2" rustc = { path = "../librustc" } rustc_errors = { path = "../librustc_errors" } -rustc_error_codes = { path = "../librustc_error_codes" } rustc_hir = { path = "../librustc_hir" } rustc_target = { path = "../librustc_target" } syntax = { path = "../libsyntax" } diff --git a/src/librustc_lint/context.rs b/src/librustc_lint/context.rs index 42ec8787cb287..3b8cce5635d07 100644 --- a/src/librustc_lint/context.rs +++ b/src/librustc_lint/context.rs @@ -26,7 +26,6 @@ use rustc::ty::layout::{LayoutError, LayoutOf, TyLayout}; use rustc::ty::{self, print::Printer, subst::GenericArg, Ty, TyCtxt}; use rustc_data_structures::fx::FxHashMap; use rustc_data_structures::sync; -use rustc_error_codes::*; use rustc_errors::{struct_span_err, Applicability, DiagnosticBuilder}; use rustc_hir as hir; use rustc_hir::def_id::{CrateNum, DefId}; diff --git a/src/librustc_lint/levels.rs b/src/librustc_lint/levels.rs index bbc3e57f5dd01..d5bbdc53160f6 100644 --- a/src/librustc_lint/levels.rs +++ b/src/librustc_lint/levels.rs @@ -6,7 +6,6 @@ use rustc::lint::{LintLevelMap, LintLevelSets, LintSet, LintSource}; use rustc::ty::query::Providers; use rustc::ty::TyCtxt; use rustc_data_structures::fx::FxHashMap; -use rustc_error_codes::*; use rustc_errors::{struct_span_err, Applicability, DiagnosticBuilder}; use rustc_hir as hir; use rustc_hir::def_id::{CrateNum, LOCAL_CRATE}; diff --git a/src/librustc_metadata/Cargo.toml b/src/librustc_metadata/Cargo.toml index 0a0bcb190bea7..6da584733aea0 100644 --- a/src/librustc_metadata/Cargo.toml +++ b/src/librustc_metadata/Cargo.toml @@ -26,7 +26,6 @@ syntax = { path = "../libsyntax" } rustc_expand = { path = "../librustc_expand" } rustc_parse = { path = "../librustc_parse" } rustc_span = { path = "../librustc_span" } -rustc_error_codes = { path = "../librustc_error_codes" } [target.'cfg(windows)'.dependencies] winapi = { version = "0.3", features = ["errhandlingapi", "libloaderapi"] } diff --git a/src/librustc_metadata/creader.rs b/src/librustc_metadata/creader.rs index 181f872154c51..351e72d4678f2 100644 --- a/src/librustc_metadata/creader.rs +++ b/src/librustc_metadata/creader.rs @@ -12,7 +12,6 @@ use rustc::session::{CrateDisambiguator, Session}; use rustc::ty::TyCtxt; use rustc_data_structures::svh::Svh; use rustc_data_structures::sync::Lrc; -use rustc_error_codes::*; use rustc_errors::struct_span_err; use rustc_expand::base::SyntaxExtension; use rustc_hir::def_id::{CrateNum, LOCAL_CRATE}; diff --git a/src/librustc_metadata/locator.rs b/src/librustc_metadata/locator.rs index 4745ad02a3aa4..578216454f9dc 100644 --- a/src/librustc_metadata/locator.rs +++ b/src/librustc_metadata/locator.rs @@ -241,8 +241,6 @@ use rustc_data_structures::owning_ref::OwningRef; use log::{debug, info, warn}; -use rustc_error_codes::*; - #[derive(Clone)] struct CrateMismatch { path: PathBuf, diff --git a/src/librustc_metadata/native_libs.rs b/src/librustc_metadata/native_libs.rs index 9426d5e26f5e5..bbf6973be51a7 100644 --- a/src/librustc_metadata/native_libs.rs +++ b/src/librustc_metadata/native_libs.rs @@ -3,7 +3,6 @@ use rustc::session::parse::feature_err; use rustc::session::Session; use rustc::ty::TyCtxt; use rustc_data_structures::fx::FxHashSet; -use rustc_error_codes::*; use rustc_errors::struct_span_err; use rustc_hir as hir; use rustc_hir::itemlikevisit::ItemLikeVisitor; diff --git a/src/librustc_mir/Cargo.toml b/src/librustc_mir/Cargo.toml index f9b61b9e2c9d8..00881e3ea6f19 100644 --- a/src/librustc_mir/Cargo.toml +++ b/src/librustc_mir/Cargo.toml @@ -29,4 +29,3 @@ syntax = { path = "../libsyntax" } rustc_span = { path = "../librustc_span" } rustc_apfloat = { path = "../librustc_apfloat" } smallvec = { version = "1.0", features = ["union", "may_dangle"] } -rustc_error_codes = { path = "../librustc_error_codes" } diff --git a/src/librustc_mir/borrow_check/type_check/mod.rs b/src/librustc_mir/borrow_check/type_check/mod.rs index 947bbef4379f5..a92abc98cf4c1 100644 --- a/src/librustc_mir/borrow_check/type_check/mod.rs +++ b/src/librustc_mir/borrow_check/type_check/mod.rs @@ -27,7 +27,6 @@ use rustc::ty::{ TyCtxt, UserType, UserTypeAnnotationIndex, }; use rustc_data_structures::fx::{FxHashMap, FxHashSet}; -use rustc_error_codes::*; use rustc_errors::struct_span_err; use rustc_hir as hir; use rustc_hir::def_id::DefId; diff --git a/src/librustc_mir/transform/check_consts/ops.rs b/src/librustc_mir/transform/check_consts/ops.rs index edb4eb4d7c344..3263905eadb81 100644 --- a/src/librustc_mir/transform/check_consts/ops.rs +++ b/src/librustc_mir/transform/check_consts/ops.rs @@ -10,8 +10,6 @@ use rustc_span::{Span, Symbol}; use super::{ConstKind, Item}; -use rustc_error_codes::*; - /// An operation that is not *always* allowed in a const context. pub trait NonConstOp: std::fmt::Debug { /// Whether this operation can be evaluated by miri. diff --git a/src/librustc_mir/transform/check_consts/validation.rs b/src/librustc_mir/transform/check_consts/validation.rs index 10a4b7d92b764..1d5fb33ee8e81 100644 --- a/src/librustc_mir/transform/check_consts/validation.rs +++ b/src/librustc_mir/transform/check_consts/validation.rs @@ -6,7 +6,6 @@ use rustc::mir::*; use rustc::traits::{self, TraitEngine}; use rustc::ty::cast::CastTy; use rustc::ty::{self, TyCtxt}; -use rustc_error_codes::*; use rustc_errors::struct_span_err; use rustc_hir::{def_id::DefId, HirId}; use rustc_index::bit_set::BitSet; diff --git a/src/librustc_mir/transform/check_unsafety.rs b/src/librustc_mir/transform/check_unsafety.rs index 072cdf2ebba3a..4e943547f07f5 100644 --- a/src/librustc_mir/transform/check_unsafety.rs +++ b/src/librustc_mir/transform/check_unsafety.rs @@ -18,8 +18,6 @@ use std::ops::Bound; use crate::const_eval::{is_const_fn, is_min_const_fn}; use crate::util; -use rustc_error_codes::*; - pub struct UnsafetyChecker<'a, 'tcx> { body: &'a Body<'tcx>, const_context: bool, diff --git a/src/librustc_mir/util/borrowck_errors.rs b/src/librustc_mir/util/borrowck_errors.rs index c275eecfb33b6..d8ee059f1a6b6 100644 --- a/src/librustc_mir/util/borrowck_errors.rs +++ b/src/librustc_mir/util/borrowck_errors.rs @@ -1,5 +1,4 @@ use rustc::ty::{self, Ty, TyCtxt}; -use rustc_error_codes::*; use rustc_errors::{struct_span_err, DiagnosticBuilder, DiagnosticId}; use rustc_span::{MultiSpan, Span}; diff --git a/src/librustc_mir_build/Cargo.toml b/src/librustc_mir_build/Cargo.toml index 79c7303275597..f0d1d4c6515ce 100644 --- a/src/librustc_mir_build/Cargo.toml +++ b/src/librustc_mir_build/Cargo.toml @@ -25,4 +25,3 @@ rustc_span = { path = "../librustc_span" } rustc_target = { path = "../librustc_target" } syntax = { path = "../libsyntax" } smallvec = { version = "1.0", features = ["union", "may_dangle"] } -rustc_error_codes = { path = "../librustc_error_codes" } diff --git a/src/librustc_mir_build/hair/pattern/check_match.rs b/src/librustc_mir_build/hair/pattern/check_match.rs index 84d57a89c983e..eac52da7ba4ae 100644 --- a/src/librustc_mir_build/hair/pattern/check_match.rs +++ b/src/librustc_mir_build/hair/pattern/check_match.rs @@ -9,7 +9,6 @@ use rustc::lint; use rustc::session::parse::feature_err; use rustc::session::Session; use rustc::ty::{self, Ty, TyCtxt}; -use rustc_error_codes::*; use rustc_errors::{error_code, struct_span_err, Applicability, DiagnosticBuilder}; use rustc_hir as hir; use rustc_hir::def::*; diff --git a/src/librustc_mir_build/hair/pattern/mod.rs b/src/librustc_mir_build/hair/pattern/mod.rs index 205e25f7f8f0c..2657050583071 100644 --- a/src/librustc_mir_build/hair/pattern/mod.rs +++ b/src/librustc_mir_build/hair/pattern/mod.rs @@ -28,8 +28,6 @@ use syntax::ast; use std::cmp::Ordering; use std::fmt; -use rustc_error_codes::*; - #[derive(Clone, Debug)] crate enum PatternError { AssocConstInPattern(Span), diff --git a/src/librustc_parse/Cargo.toml b/src/librustc_parse/Cargo.toml index aa159c55ff284..8071bc6312b36 100644 --- a/src/librustc_parse/Cargo.toml +++ b/src/librustc_parse/Cargo.toml @@ -16,7 +16,6 @@ rustc_data_structures = { path = "../librustc_data_structures" } rustc_feature = { path = "../librustc_feature" } rustc_lexer = { path = "../librustc_lexer" } rustc_errors = { path = "../librustc_errors" } -rustc_error_codes = { path = "../librustc_error_codes" } smallvec = { version = "1.0", features = ["union", "may_dangle"] } rustc_session = { path = "../librustc_session" } rustc_span = { path = "../librustc_span" } diff --git a/src/librustc_parse/config.rs b/src/librustc_parse/config.rs index 8467acc759c2b..bf696faf2f3f4 100644 --- a/src/librustc_parse/config.rs +++ b/src/librustc_parse/config.rs @@ -10,7 +10,6 @@ use crate::{parse_in, validate_attr}; use rustc_data_structures::fx::FxHashMap; -use rustc_error_codes::*; use rustc_errors::{error_code, struct_span_err, Applicability, Handler}; use rustc_feature::{Feature, Features, State as FeatureState}; use rustc_feature::{ diff --git a/src/librustc_parse/parser/diagnostics.rs b/src/librustc_parse/parser/diagnostics.rs index 6a18c63017ed6..80bc5c158a64f 100644 --- a/src/librustc_parse/parser/diagnostics.rs +++ b/src/librustc_parse/parser/diagnostics.rs @@ -1,7 +1,6 @@ use super::{BlockMode, Parser, PathStyle, SemiColonMode, SeqSep, TokenExpectType, TokenType}; use rustc_data_structures::fx::FxHashSet; -use rustc_error_codes::*; use rustc_errors::{pluralize, struct_span_err}; use rustc_errors::{Applicability, DiagnosticBuilder, Handler, PResult}; use rustc_span::source_map::Spanned; diff --git a/src/librustc_parse/parser/item.rs b/src/librustc_parse/parser/item.rs index 1921a6c850689..5076aafe4ebd5 100644 --- a/src/librustc_parse/parser/item.rs +++ b/src/librustc_parse/parser/item.rs @@ -3,7 +3,6 @@ use super::{FollowedByType, Parser, PathStyle}; use crate::maybe_whole; -use rustc_error_codes::*; use rustc_errors::{struct_span_err, Applicability, DiagnosticBuilder, PResult, StashKey}; use rustc_span::source_map::{self, respan, Span, Spanned}; use rustc_span::symbol::{kw, sym, Symbol}; diff --git a/src/librustc_parse/parser/mod.rs b/src/librustc_parse/parser/mod.rs index 1368230168e07..4a9016394d258 100644 --- a/src/librustc_parse/parser/mod.rs +++ b/src/librustc_parse/parser/mod.rs @@ -33,8 +33,6 @@ use std::borrow::Cow; use std::path::PathBuf; use std::{cmp, mem, slice}; -use rustc_error_codes::*; - bitflags::bitflags! { struct Restrictions: u8 { const STMT_EXPR = 1 << 0; diff --git a/src/librustc_parse/parser/pat.rs b/src/librustc_parse/parser/pat.rs index 549acf67d3824..edb9044df9206 100644 --- a/src/librustc_parse/parser/pat.rs +++ b/src/librustc_parse/parser/pat.rs @@ -659,7 +659,6 @@ impl<'a> Parser<'a> { } pub(super) fn error_inclusive_range_with_no_end(&self, span: Span) { - use rustc_error_codes::E0586; struct_span_err!(self.sess.span_diagnostic, span, E0586, "inclusive range with no end") .span_suggestion_short( span, diff --git a/src/librustc_parse/parser/ty.rs b/src/librustc_parse/parser/ty.rs index 065a3b14428c7..d1875a6c940b1 100644 --- a/src/librustc_parse/parser/ty.rs +++ b/src/librustc_parse/parser/ty.rs @@ -3,7 +3,6 @@ use super::{Parser, PathStyle, PrevTokenKind, TokenType}; use crate::{maybe_recover_from_interpolated_ty_qpath, maybe_whole}; -use rustc_error_codes::*; use rustc_errors::{pluralize, struct_span_err, Applicability, PResult}; use rustc_span::source_map::Span; use rustc_span::symbol::{kw, sym}; diff --git a/src/librustc_passes/Cargo.toml b/src/librustc_passes/Cargo.toml index 639d8639c4bb2..338808f6d4a0f 100644 --- a/src/librustc_passes/Cargo.toml +++ b/src/librustc_passes/Cargo.toml @@ -20,4 +20,3 @@ rustc_session = { path = "../librustc_session" } rustc_target = { path = "../librustc_target" } syntax = { path = "../libsyntax" } rustc_span = { path = "../librustc_span" } -rustc_error_codes = { path = "../librustc_error_codes" } diff --git a/src/librustc_passes/check_const.rs b/src/librustc_passes/check_const.rs index 39ba2fbc63b43..faa85f68fab86 100644 --- a/src/librustc_passes/check_const.rs +++ b/src/librustc_passes/check_const.rs @@ -12,7 +12,6 @@ use rustc::session::config::nightly_options; use rustc::session::parse::feature_err; use rustc::ty::query::Providers; use rustc::ty::TyCtxt; -use rustc_error_codes::*; use rustc_errors::struct_span_err; use rustc_hir as hir; use rustc_hir::def_id::DefId; diff --git a/src/librustc_passes/entry.rs b/src/librustc_passes/entry.rs index 028d7c662758a..d36114fd3b5b5 100644 --- a/src/librustc_passes/entry.rs +++ b/src/librustc_passes/entry.rs @@ -12,8 +12,6 @@ use rustc_span::{Span, DUMMY_SP}; use syntax::attr; use syntax::entry::EntryPointType; -use rustc_error_codes::*; - struct EntryContext<'a, 'tcx> { session: &'a Session, diff --git a/src/librustc_passes/intrinsicck.rs b/src/librustc_passes/intrinsicck.rs index 2c26707a51850..782199003c72a 100644 --- a/src/librustc_passes/intrinsicck.rs +++ b/src/librustc_passes/intrinsicck.rs @@ -11,8 +11,6 @@ use rustc_index::vec::Idx; use rustc_span::{sym, Span}; use rustc_target::spec::abi::Abi::RustIntrinsic; -use rustc_error_codes::*; - fn check_mod_intrinsics(tcx: TyCtxt<'_>, module_def_id: DefId) { tcx.hir().visit_item_likes_in_module(module_def_id, &mut ItemVisitor { tcx }.as_deep_visitor()); } diff --git a/src/librustc_passes/lib_features.rs b/src/librustc_passes/lib_features.rs index 8ae7291289786..2e306a1b4f2a1 100644 --- a/src/librustc_passes/lib_features.rs +++ b/src/librustc_passes/lib_features.rs @@ -15,8 +15,6 @@ use rustc_span::symbol::Symbol; use rustc_span::{sym, Span}; use syntax::ast::{Attribute, MetaItem, MetaItemKind}; -use rustc_error_codes::*; - fn new_lib_features() -> LibFeatures { LibFeatures { stable: Default::default(), unstable: Default::default() } } diff --git a/src/librustc_passes/loops.rs b/src/librustc_passes/loops.rs index 5ad5795c777d4..69d6b38005c4c 100644 --- a/src/librustc_passes/loops.rs +++ b/src/librustc_passes/loops.rs @@ -1,7 +1,5 @@ use Context::*; -use rustc::session::Session; - use rustc::hir::map::Map; use rustc::ty::query::Providers; use rustc::ty::TyCtxt; @@ -10,10 +8,9 @@ use rustc_hir as hir; use rustc_hir::def_id::DefId; use rustc_hir::intravisit::{self, NestedVisitorMap, Visitor}; use rustc_hir::{Destination, Movability, Node}; +use rustc_session::Session; use rustc_span::Span; -use rustc_error_codes::*; - #[derive(Clone, Copy, Debug, PartialEq)] enum Context { Normal, diff --git a/src/librustc_passes/stability.rs b/src/librustc_passes/stability.rs index b649f36f2fc58..320b433190e5e 100644 --- a/src/librustc_passes/stability.rs +++ b/src/librustc_passes/stability.rs @@ -26,8 +26,6 @@ use std::cmp::Ordering; use std::mem::replace; use std::num::NonZeroU32; -use rustc_error_codes::*; - #[derive(PartialEq)] enum AnnotationKind { // Annotation is required if not inherited from unstable parents diff --git a/src/librustc_plugin_impl/Cargo.toml b/src/librustc_plugin_impl/Cargo.toml index 41e6c699c340e..2214838c84683 100644 --- a/src/librustc_plugin_impl/Cargo.toml +++ b/src/librustc_plugin_impl/Cargo.toml @@ -18,4 +18,3 @@ rustc_lint = { path = "../librustc_lint" } rustc_metadata = { path = "../librustc_metadata" } syntax = { path = "../libsyntax" } rustc_span = { path = "../librustc_span" } -rustc_error_codes = { path = "../librustc_error_codes" } diff --git a/src/librustc_plugin_impl/load.rs b/src/librustc_plugin_impl/load.rs index 65661ec24f07f..84549c0dd4554 100644 --- a/src/librustc_plugin_impl/load.rs +++ b/src/librustc_plugin_impl/load.rs @@ -3,7 +3,6 @@ use crate::Registry; use rustc::middle::cstore::MetadataLoader; use rustc::session::Session; -use rustc_error_codes::*; use rustc_errors::struct_span_err; use rustc_metadata::locator; use rustc_span::symbol::sym; diff --git a/src/librustc_privacy/Cargo.toml b/src/librustc_privacy/Cargo.toml index 795b6c107fe94..4f341b545156c 100644 --- a/src/librustc_privacy/Cargo.toml +++ b/src/librustc_privacy/Cargo.toml @@ -16,5 +16,4 @@ rustc_typeck = { path = "../librustc_typeck" } syntax = { path = "../libsyntax" } rustc_span = { path = "../librustc_span" } rustc_data_structures = { path = "../librustc_data_structures" } -rustc_error_codes = { path = "../librustc_error_codes" } log = "0.4" diff --git a/src/librustc_privacy/lib.rs b/src/librustc_privacy/lib.rs index 90a422a4dcf6c..634905450d4ed 100644 --- a/src/librustc_privacy/lib.rs +++ b/src/librustc_privacy/lib.rs @@ -27,8 +27,6 @@ use syntax::attr; use std::marker::PhantomData; use std::{cmp, fmt, mem}; -use rustc_error_codes::*; - //////////////////////////////////////////////////////////////////////////////// /// Generic infrastructure used to implement specific visitors below. //////////////////////////////////////////////////////////////////////////////// diff --git a/src/librustc_resolve/Cargo.toml b/src/librustc_resolve/Cargo.toml index af37e7b5b76ac..c4cc6b09c736e 100644 --- a/src/librustc_resolve/Cargo.toml +++ b/src/librustc_resolve/Cargo.toml @@ -23,7 +23,6 @@ rustc_expand = { path = "../librustc_expand" } rustc_feature = { path = "../librustc_feature" } rustc_hir = { path = "../librustc_hir" } rustc_metadata = { path = "../librustc_metadata" } -rustc_error_codes = { path = "../librustc_error_codes" } rustc_session = { path = "../librustc_session" } rustc_span = { path = "../librustc_span" } smallvec = { version = "1.0", features = ["union", "may_dangle"] } diff --git a/src/librustc_resolve/build_reduced_graph.rs b/src/librustc_resolve/build_reduced_graph.rs index 40a89ef067458..7ff076268ab82 100644 --- a/src/librustc_resolve/build_reduced_graph.rs +++ b/src/librustc_resolve/build_reduced_graph.rs @@ -21,7 +21,6 @@ use rustc::hir::exports::Export; use rustc::middle::cstore::CrateStore; use rustc::ty; use rustc_data_structures::sync::Lrc; -use rustc_error_codes::*; use rustc_errors::{struct_span_err, Applicability}; use rustc_expand::base::SyntaxExtension; use rustc_expand::expand::AstFragment; diff --git a/src/librustc_resolve/diagnostics.rs b/src/librustc_resolve/diagnostics.rs index a433ae8ed676a..3d4384cabe204 100644 --- a/src/librustc_resolve/diagnostics.rs +++ b/src/librustc_resolve/diagnostics.rs @@ -25,8 +25,6 @@ use crate::{BindingError, CrateLint, HasGenericParams, LegacyScope, Module, Modu use crate::{NameBinding, NameBindingKind, PrivacyError, VisResolutionError}; use crate::{ParentScope, PathResult, ResolutionError, Resolver, Scope, ScopeSet, Segment}; -use rustc_error_codes::*; - type Res = def::Res; /// A vector of spans and replacements, a message and applicability. diff --git a/src/librustc_resolve/imports.rs b/src/librustc_resolve/imports.rs index 9f459834175c1..55ce51e0ff057 100644 --- a/src/librustc_resolve/imports.rs +++ b/src/librustc_resolve/imports.rs @@ -29,8 +29,6 @@ use syntax::ast::{Ident, Name, NodeId}; use syntax::unwrap_or; use syntax::util::lev_distance::find_best_match_for_name; -use rustc_error_codes::*; - use log::*; use std::cell::Cell; diff --git a/src/librustc_resolve/late.rs b/src/librustc_resolve/late.rs index 08cd9c4d1d53a..5e08ac8e2c38a 100644 --- a/src/librustc_resolve/late.rs +++ b/src/librustc_resolve/late.rs @@ -31,8 +31,6 @@ use log::debug; use std::collections::BTreeSet; use std::mem::replace; -use rustc_error_codes::*; - mod diagnostics; type Res = def::Res; diff --git a/src/librustc_resolve/late/diagnostics.rs b/src/librustc_resolve/late/diagnostics.rs index 151f3e834e5de..6a98c9e59a9ce 100644 --- a/src/librustc_resolve/late/diagnostics.rs +++ b/src/librustc_resolve/late/diagnostics.rs @@ -6,7 +6,6 @@ use crate::{PathResult, PathSource, Segment}; use rustc::session::config::nightly_options; use rustc_data_structures::fx::FxHashSet; -use rustc_error_codes::*; use rustc_errors::{Applicability, DiagnosticBuilder}; use rustc_hir::def::Namespace::{self, *}; use rustc_hir::def::{self, CtorKind, DefKind}; diff --git a/src/librustc_resolve/lib.rs b/src/librustc_resolve/lib.rs index 60a0049f5da37..5d132191f9208 100644 --- a/src/librustc_resolve/lib.rs +++ b/src/librustc_resolve/lib.rs @@ -61,8 +61,6 @@ use imports::{ImportDirective, ImportDirectiveSubclass, ImportResolver, NameReso use late::{HasGenericParams, PathSource, Rib, RibKind::*}; use macros::{LegacyBinding, LegacyScope}; -use rustc_error_codes::*; - type Res = def::Res; mod build_reduced_graph; diff --git a/src/librustc_resolve/lifetimes.rs b/src/librustc_resolve/lifetimes.rs index 5fae8f3318743..a2ca80cf5f30a 100644 --- a/src/librustc_resolve/lifetimes.rs +++ b/src/librustc_resolve/lifetimes.rs @@ -30,8 +30,6 @@ use syntax::walk_list; use log::debug; -use rustc_error_codes::*; - // This counts the no of times a lifetime is used #[derive(Clone, Copy, Debug)] pub enum LifetimeUseSet<'tcx> { diff --git a/src/librustc_session/Cargo.toml b/src/librustc_session/Cargo.toml index 377ea141ed57c..47c23bc4dcf98 100644 --- a/src/librustc_session/Cargo.toml +++ b/src/librustc_session/Cargo.toml @@ -10,7 +10,6 @@ path = "lib.rs" [dependencies] log = "0.4" -rustc_error_codes = { path = "../librustc_error_codes" } rustc_errors = { path = "../librustc_errors" } rustc_feature = { path = "../librustc_feature" } rustc_target = { path = "../librustc_target" } diff --git a/src/librustc_session/parse.rs b/src/librustc_session/parse.rs index a98cf929095ea..72c68fcb244c9 100644 --- a/src/librustc_session/parse.rs +++ b/src/librustc_session/parse.rs @@ -6,7 +6,6 @@ use crate::node_id::NodeId; use rustc_data_structures::fx::{FxHashMap, FxHashSet}; use rustc_data_structures::sync::{Lock, Lrc, Once}; -use rustc_error_codes::E0658; use rustc_errors::{emitter::SilentEmitter, ColorConfig, Handler}; use rustc_errors::{error_code, Applicability, DiagnosticBuilder}; use rustc_feature::{find_feature_issue, GateIssue, UnstableFeatures}; diff --git a/src/librustc_typeck/Cargo.toml b/src/librustc_typeck/Cargo.toml index 84e5f56d9c208..4b27d86dd02a7 100644 --- a/src/librustc_typeck/Cargo.toml +++ b/src/librustc_typeck/Cargo.toml @@ -22,4 +22,3 @@ smallvec = { version = "1.0", features = ["union", "may_dangle"] } syntax = { path = "../libsyntax" } rustc_span = { path = "../librustc_span" } rustc_index = { path = "../librustc_index" } -rustc_error_codes = { path = "../librustc_error_codes" } diff --git a/src/librustc_typeck/astconv.rs b/src/librustc_typeck/astconv.rs index 173bb29e964d1..047c14cfbcff7 100644 --- a/src/librustc_typeck/astconv.rs +++ b/src/librustc_typeck/astconv.rs @@ -39,7 +39,6 @@ use std::iter; use std::slice; use rustc::mir::interpret::LitToConstInput; -use rustc_error_codes::*; #[derive(Debug)] pub struct PathSeg(pub DefId, pub usize); diff --git a/src/librustc_typeck/check/autoderef.rs b/src/librustc_typeck/check/autoderef.rs index 8d6b74c3015c9..3ea5de9a8375d 100644 --- a/src/librustc_typeck/check/autoderef.rs +++ b/src/librustc_typeck/check/autoderef.rs @@ -13,8 +13,6 @@ use rustc_hir as hir; use rustc_span::Span; use syntax::ast::Ident; -use rustc_error_codes::*; - use std::iter; #[derive(Copy, Clone, Debug)] diff --git a/src/librustc_typeck/check/callee.rs b/src/librustc_typeck/check/callee.rs index 58f407b890278..b33cc52b238e3 100644 --- a/src/librustc_typeck/check/callee.rs +++ b/src/librustc_typeck/check/callee.rs @@ -8,7 +8,6 @@ use rustc::ty::adjustment::{Adjust, Adjustment, AllowTwoPhase, AutoBorrow, AutoB use rustc::ty::subst::SubstsRef; use rustc::ty::{self, Ty, TyCtxt, TypeFoldable}; use rustc::{infer, traits}; -use rustc_error_codes::*; use rustc_errors::{struct_span_err, Applicability, DiagnosticBuilder}; use rustc_hir as hir; use rustc_hir::def::Res; diff --git a/src/librustc_typeck/check/cast.rs b/src/librustc_typeck/check/cast.rs index cbbfe2d627895..d254a84df72ce 100644 --- a/src/librustc_typeck/check/cast.rs +++ b/src/librustc_typeck/check/cast.rs @@ -49,8 +49,6 @@ use rustc_hir as hir; use rustc_span::Span; use syntax::ast; -use rustc_error_codes::*; - /// Reifies a cast check to be checked once we have full type information for /// a function context. pub struct CastCheck<'tcx> { diff --git a/src/librustc_typeck/check/coercion.rs b/src/librustc_typeck/check/coercion.rs index a32fbff7bfe2d..8c8e0642dffce 100644 --- a/src/librustc_typeck/check/coercion.rs +++ b/src/librustc_typeck/check/coercion.rs @@ -65,7 +65,6 @@ use rustc::ty::fold::TypeFoldable; use rustc::ty::relate::RelateResult; use rustc::ty::subst::SubstsRef; use rustc::ty::{self, Ty, TypeAndMut}; -use rustc_error_codes::*; use rustc_errors::{struct_span_err, DiagnosticBuilder}; use rustc_hir as hir; use rustc_hir::def_id::DefId; diff --git a/src/librustc_typeck/check/compare_method.rs b/src/librustc_typeck/check/compare_method.rs index c35661ac649fc..414f80d84b672 100644 --- a/src/librustc_typeck/check/compare_method.rs +++ b/src/librustc_typeck/check/compare_method.rs @@ -15,8 +15,6 @@ use rustc_span::Span; use super::{potentially_plural_count, FnCtxt, Inherited}; -use rustc_error_codes::*; - /// Checks that a method from an impl conforms to the signature of /// the same method as declared in the trait. /// diff --git a/src/librustc_typeck/check/dropck.rs b/src/librustc_typeck/check/dropck.rs index 88e7a265ebbcf..f4aa53a5a9389 100644 --- a/src/librustc_typeck/check/dropck.rs +++ b/src/librustc_typeck/check/dropck.rs @@ -14,8 +14,6 @@ use rustc_errors::struct_span_err; use rustc_span::Span; -use rustc_error_codes::*; - /// This function confirms that the `Drop` implementation identified by /// `drop_impl_did` is not any more specialized than the type it is /// attached to (Issue #8142). diff --git a/src/librustc_typeck/check/expr.rs b/src/librustc_typeck/check/expr.rs index 35342de59a082..201a09fdc63fa 100644 --- a/src/librustc_typeck/check/expr.rs +++ b/src/librustc_typeck/check/expr.rs @@ -38,8 +38,6 @@ use rustc_span::symbol::{kw, sym, Symbol}; use syntax::ast; use syntax::util::lev_distance::find_best_match_for_name; -use rustc_error_codes::*; - use std::fmt::Display; impl<'a, 'tcx> FnCtxt<'a, 'tcx> { diff --git a/src/librustc_typeck/check/intrinsic.rs b/src/librustc_typeck/check/intrinsic.rs index 0441514c83c9d..3572eda5c1399 100644 --- a/src/librustc_typeck/check/intrinsic.rs +++ b/src/librustc_typeck/check/intrinsic.rs @@ -6,7 +6,6 @@ use crate::require_same_types; use rustc::traits::{ObligationCause, ObligationCauseCode}; use rustc::ty::subst::Subst; use rustc::ty::{self, Ty, TyCtxt}; -use rustc_error_codes::*; use rustc_errors::struct_span_err; use rustc_hir as hir; use rustc_span::symbol::Symbol; diff --git a/src/librustc_typeck/check/method/probe.rs b/src/librustc_typeck/check/method/probe.rs index b2542cc27a551..9d8f57119ddde 100644 --- a/src/librustc_typeck/check/method/probe.rs +++ b/src/librustc_typeck/check/method/probe.rs @@ -38,8 +38,6 @@ use std::ops::Deref; use syntax::ast; use syntax::util::lev_distance::{find_best_match_for_name, lev_distance}; -use rustc_error_codes::*; - use smallvec::{smallvec, SmallVec}; use self::CandidateKind::*; diff --git a/src/librustc_typeck/check/method/suggest.rs b/src/librustc_typeck/check/method/suggest.rs index d6c0d9c77b495..88de2654cea54 100644 --- a/src/librustc_typeck/check/method/suggest.rs +++ b/src/librustc_typeck/check/method/suggest.rs @@ -21,8 +21,6 @@ use rustc_span::{source_map, FileName, Span}; use syntax::ast; use syntax::util::lev_distance; -use rustc_error_codes::*; - use std::cmp::Ordering; use super::probe::Mode; diff --git a/src/librustc_typeck/check/mod.rs b/src/librustc_typeck/check/mod.rs index 4affdc4a9d64e..f7df630fb90b1 100644 --- a/src/librustc_typeck/check/mod.rs +++ b/src/librustc_typeck/check/mod.rs @@ -133,8 +133,6 @@ use syntax::ast; use syntax::attr; use syntax::util::parser::ExprPrecedence; -use rustc_error_codes::*; - use std::cell::{Cell, Ref, RefCell, RefMut}; use std::cmp; use std::collections::hash_map::Entry; diff --git a/src/librustc_typeck/check/op.rs b/src/librustc_typeck/check/op.rs index edf9d19dea377..91e1731ac458b 100644 --- a/src/librustc_typeck/check/op.rs +++ b/src/librustc_typeck/check/op.rs @@ -11,8 +11,6 @@ use rustc_hir as hir; use rustc_span::Span; use syntax::ast::Ident; -use rustc_error_codes::*; - impl<'a, 'tcx> FnCtxt<'a, 'tcx> { /// Checks a `a = b` pub fn check_binop_assign( diff --git a/src/librustc_typeck/check/pat.rs b/src/librustc_typeck/check/pat.rs index 1478b35a25ddc..f9dee0e477f79 100644 --- a/src/librustc_typeck/check/pat.rs +++ b/src/librustc_typeck/check/pat.rs @@ -15,8 +15,6 @@ use rustc_span::Span; use syntax::ast; use syntax::util::lev_distance::find_best_match_for_name; -use rustc_error_codes::*; - use std::cmp; use std::collections::hash_map::Entry::{Occupied, Vacant}; diff --git a/src/librustc_typeck/check/wfcheck.rs b/src/librustc_typeck/check/wfcheck.rs index 5e91e98a7dfa5..910e680de69dc 100644 --- a/src/librustc_typeck/check/wfcheck.rs +++ b/src/librustc_typeck/check/wfcheck.rs @@ -18,8 +18,6 @@ use syntax::ast; use rustc_hir as hir; use rustc_hir::itemlikevisit::ParItemLikeVisitor; -use rustc_error_codes::*; - /// Helper type of a temporary returned by `.for_item(...)`. /// This is necessary because we can't write the following bound: /// diff --git a/src/librustc_typeck/coherence/builtin.rs b/src/librustc_typeck/coherence/builtin.rs index 516dc16d46bd8..79a006a898a89 100644 --- a/src/librustc_typeck/coherence/builtin.rs +++ b/src/librustc_typeck/coherence/builtin.rs @@ -12,7 +12,6 @@ use rustc::traits::{self, ObligationCause, TraitEngine}; use rustc::ty::adjustment::CoerceUnsizedInfo; use rustc::ty::TypeFoldable; use rustc::ty::{self, Ty, TyCtxt}; -use rustc_error_codes::*; use rustc_errors::struct_span_err; use rustc_hir as hir; use rustc_hir::def_id::DefId; diff --git a/src/librustc_typeck/coherence/inherent_impls.rs b/src/librustc_typeck/coherence/inherent_impls.rs index d313e32fc20e0..d4c89b7e03793 100644 --- a/src/librustc_typeck/coherence/inherent_impls.rs +++ b/src/librustc_typeck/coherence/inherent_impls.rs @@ -16,8 +16,6 @@ use rustc_hir::itemlikevisit::ItemLikeVisitor; use rustc_span::Span; use syntax::ast; -use rustc_error_codes::*; - /// On-demand query: yields a map containing all types mapped to their inherent impls. pub fn crate_inherent_impls(tcx: TyCtxt<'_>, crate_num: CrateNum) -> &CrateInherentImpls { assert_eq!(crate_num, LOCAL_CRATE); diff --git a/src/librustc_typeck/coherence/inherent_impls_overlap.rs b/src/librustc_typeck/coherence/inherent_impls_overlap.rs index a9228c7f6bb4c..d60c3cfba9a5b 100644 --- a/src/librustc_typeck/coherence/inherent_impls_overlap.rs +++ b/src/librustc_typeck/coherence/inherent_impls_overlap.rs @@ -6,8 +6,6 @@ use rustc_hir as hir; use rustc_hir::def_id::{CrateNum, DefId, LOCAL_CRATE}; use rustc_hir::itemlikevisit::ItemLikeVisitor; -use rustc_error_codes::*; - pub fn crate_inherent_impls_overlap_check(tcx: TyCtxt<'_>, crate_num: CrateNum) { assert_eq!(crate_num, LOCAL_CRATE); let krate = tcx.hir().krate(); diff --git a/src/librustc_typeck/coherence/mod.rs b/src/librustc_typeck/coherence/mod.rs index fd685e77b418c..5583e3418b2a8 100644 --- a/src/librustc_typeck/coherence/mod.rs +++ b/src/librustc_typeck/coherence/mod.rs @@ -8,7 +8,6 @@ use rustc::traits; use rustc::ty::query::Providers; use rustc::ty::{self, TyCtxt, TypeFoldable}; -use rustc_error_codes::*; use rustc_errors::struct_span_err; use rustc_hir::def_id::{DefId, LOCAL_CRATE}; use rustc_hir::HirId; diff --git a/src/librustc_typeck/coherence/orphan.rs b/src/librustc_typeck/coherence/orphan.rs index 9ba8fa4247f26..80521666476e6 100644 --- a/src/librustc_typeck/coherence/orphan.rs +++ b/src/librustc_typeck/coherence/orphan.rs @@ -7,8 +7,6 @@ use rustc_errors::struct_span_err; use rustc_hir as hir; use rustc_hir::itemlikevisit::ItemLikeVisitor; -use rustc_error_codes::*; - pub fn check(tcx: TyCtxt<'_>) { let mut orphan = OrphanChecker { tcx }; tcx.hir().krate().visit_all_item_likes(&mut orphan); diff --git a/src/librustc_typeck/coherence/unsafety.rs b/src/librustc_typeck/coherence/unsafety.rs index 48b96886d3a71..a604421740363 100644 --- a/src/librustc_typeck/coherence/unsafety.rs +++ b/src/librustc_typeck/coherence/unsafety.rs @@ -7,8 +7,6 @@ use rustc_hir as hir; use rustc_hir::itemlikevisit::ItemLikeVisitor; use rustc_hir::Unsafety; -use rustc_error_codes::*; - pub fn check(tcx: TyCtxt<'_>) { let mut unsafety = UnsafetyChecker { tcx }; tcx.hir().krate().visit_all_item_likes(&mut unsafety); diff --git a/src/librustc_typeck/collect.rs b/src/librustc_typeck/collect.rs index a03b9f747372e..9eee31c3a5763 100644 --- a/src/librustc_typeck/collect.rs +++ b/src/librustc_typeck/collect.rs @@ -47,8 +47,6 @@ use syntax::ast; use syntax::ast::{Ident, MetaItemKind}; use syntax::attr::{list_contains_name, mark_used, InlineAttr, OptimizeAttr}; -use rustc_error_codes::*; - struct OnlySelfBounds(bool); /////////////////////////////////////////////////////////////////////////// diff --git a/src/librustc_typeck/impl_wf_check.rs b/src/librustc_typeck/impl_wf_check.rs index 9ee4e7c48190d..e9c18b59da982 100644 --- a/src/librustc_typeck/impl_wf_check.rs +++ b/src/librustc_typeck/impl_wf_check.rs @@ -20,8 +20,6 @@ use std::collections::hash_map::Entry::{Occupied, Vacant}; use rustc_span::Span; -use rustc_error_codes::*; - /// Checks that all the type/lifetime parameters on an impl also /// appear in the trait ref or self type (or are constrained by a /// where-clause). These rules are needed to ensure that, given a diff --git a/src/librustc_typeck/lib.rs b/src/librustc_typeck/lib.rs index 95cd3c631ed22..7e63a0254e845 100644 --- a/src/librustc_typeck/lib.rs +++ b/src/librustc_typeck/lib.rs @@ -109,8 +109,6 @@ use rustc_hir::Node; use rustc_span::{Span, DUMMY_SP}; use rustc_target::spec::abi::Abi; -use rustc_error_codes::*; - use std::iter; use astconv::{AstConv, Bounds}; diff --git a/src/librustc_typeck/outlives/test.rs b/src/librustc_typeck/outlives/test.rs index 908429c8dc48a..980d58ad939d7 100644 --- a/src/librustc_typeck/outlives/test.rs +++ b/src/librustc_typeck/outlives/test.rs @@ -4,8 +4,6 @@ use rustc_hir as hir; use rustc_hir::itemlikevisit::ItemLikeVisitor; use rustc_span::symbol::sym; -use rustc_error_codes::*; - pub fn test_inferred_outlives(tcx: TyCtxt<'_>) { tcx.hir().krate().visit_all_item_likes(&mut OutlivesTest { tcx }); } diff --git a/src/librustc_typeck/structured_errors.rs b/src/librustc_typeck/structured_errors.rs index 068814723f52d..99b7b2001a9e9 100644 --- a/src/librustc_typeck/structured_errors.rs +++ b/src/librustc_typeck/structured_errors.rs @@ -3,8 +3,6 @@ use rustc::ty::{Ty, TypeFoldable}; use rustc_errors::{Applicability, DiagnosticBuilder, DiagnosticId}; use rustc_span::Span; -use rustc_error_codes::*; - pub trait StructuredDiagnostic<'tcx> { fn session(&self) -> &Session; diff --git a/src/librustc_typeck/variance/test.rs b/src/librustc_typeck/variance/test.rs index 2f41bee1819cd..ee94b1015a1f4 100644 --- a/src/librustc_typeck/variance/test.rs +++ b/src/librustc_typeck/variance/test.rs @@ -4,8 +4,6 @@ use rustc_hir as hir; use rustc_hir::itemlikevisit::ItemLikeVisitor; use rustc_span::symbol::sym; -use rustc_error_codes::*; - pub fn test_variance(tcx: TyCtxt<'_>) { tcx.hir().krate().visit_all_item_likes(&mut VarianceTest { tcx }); } diff --git a/src/librustdoc/html/highlight.rs b/src/librustdoc/html/highlight.rs index aa52b769c38ed..5bea1b5614159 100644 --- a/src/librustdoc/html/highlight.rs +++ b/src/librustdoc/html/highlight.rs @@ -41,7 +41,7 @@ pub fn render_with_highlighting( let fm = sess .source_map() .new_source_file(FileName::Custom(String::from("rustdoc-highlighting")), src.to_owned()); - let highlight_result = { + let highlight_result = rustc_driver::catch_fatal_errors(|| { let lexer = lexer::StringReader::new(&sess, fm, None); let mut classifier = Classifier::new(lexer, sess.source_map()); @@ -51,7 +51,8 @@ pub fn render_with_highlighting( } else { Ok(String::from_utf8_lossy(&highlighted_source).into_owned()) } - }; + }) + .unwrap_or(Err(())); match highlight_result { Ok(highlighted_source) => { diff --git a/src/librustdoc/lib.rs b/src/librustdoc/lib.rs index 1da00e3a47b82..403c8d0160d8a 100644 --- a/src/librustdoc/lib.rs +++ b/src/librustdoc/lib.rs @@ -23,7 +23,6 @@ extern crate getopts; extern crate rustc; extern crate rustc_data_structures; extern crate rustc_driver; -extern crate rustc_error_codes; extern crate rustc_errors; extern crate rustc_expand; extern crate rustc_feature; diff --git a/src/librustdoc/passes/check_code_block_syntax.rs b/src/librustdoc/passes/check_code_block_syntax.rs index 0bab4423b3dfd..2903fd9dcd660 100644 --- a/src/librustdoc/passes/check_code_block_syntax.rs +++ b/src/librustdoc/passes/check_code_block_syntax.rs @@ -40,7 +40,7 @@ impl<'a, 'tcx> SyntaxChecker<'a, 'tcx> { dox[code_block.code].to_owned(), ); - let validation_status = { + let validation_status = rustc_driver::catch_fatal_errors(|| { let mut has_syntax_errors = false; let mut only_whitespace = true; // even if there is a syntax error, we need to run the lexer over the whole file @@ -61,7 +61,8 @@ impl<'a, 'tcx> SyntaxChecker<'a, 'tcx> { } else { None } - }; + }) + .unwrap_or(Some(CodeBlockInvalid::SyntaxError)); if let Some(code_block_invalid) = validation_status { let mut diag = if let Some(sp) = diff --git a/src/librustdoc/test.rs b/src/librustdoc/test.rs index 05d4141568981..d89dc2adafeb3 100644 --- a/src/librustdoc/test.rs +++ b/src/librustdoc/test.rs @@ -43,7 +43,7 @@ pub fn run(options: Options) -> i32 { let crate_types = if options.proc_macro_crate { vec![config::CrateType::ProcMacro] } else { - vec![config::CrateType::Dylib] + vec![config::CrateType::Rlib] }; let sessopts = config::Options { @@ -117,12 +117,16 @@ pub fn run(options: Options) -> i32 { intravisit::walk_crate(this, krate); }); }); + compiler.session().abort_if_errors(); let ret: Result<_, ErrorReported> = Ok(collector.tests); ret }) - }) - .expect("compiler aborted in rustdoc!"); + }); + let tests = match tests { + Ok(tests) => tests, + Err(ErrorReported) => return 1, + }; test_args.insert(0, "rustdoctest".to_string()); diff --git a/src/libsyntax/Cargo.toml b/src/libsyntax/Cargo.toml index 7d9f715e9feb8..2e647d2a1e081 100644 --- a/src/libsyntax/Cargo.toml +++ b/src/libsyntax/Cargo.toml @@ -21,5 +21,4 @@ rustc_index = { path = "../librustc_index" } rustc_lexer = { path = "../librustc_lexer" } rustc_macros = { path = "../librustc_macros" } smallvec = { version = "1.0", features = ["union", "may_dangle"] } -rustc_error_codes = { path = "../librustc_error_codes" } rustc_session = { path = "../librustc_session" } diff --git a/src/libsyntax/attr/builtin.rs b/src/libsyntax/attr/builtin.rs index 70f4f47621a34..6cfe4f2de1e96 100644 --- a/src/libsyntax/attr/builtin.rs +++ b/src/libsyntax/attr/builtin.rs @@ -12,8 +12,6 @@ use rustc_span::hygiene::Transparency; use rustc_span::{symbol::sym, symbol::Symbol, Span}; use std::num::NonZeroU32; -use rustc_error_codes::*; - pub fn is_builtin_attr(attr: &Attribute) -> bool { attr.is_doc_comment() || attr.ident().filter(|ident| is_builtin_attr_name(ident.name)).is_some() } diff --git a/src/test/codegen-units/item-collection/drop_in_place_intrinsic.rs b/src/test/codegen-units/item-collection/drop_in_place_intrinsic.rs index d5ddfb5e1c24c..27fb3cb1380d3 100644 --- a/src/test/codegen-units/item-collection/drop_in_place_intrinsic.rs +++ b/src/test/codegen-units/item-collection/drop_in_place_intrinsic.rs @@ -4,7 +4,7 @@ #![feature(start)] -//~ MONO_ITEM fn core::ptr[0]::real_drop_in_place[0] @@ drop_in_place_intrinsic-cgu.0[Internal] +//~ MONO_ITEM fn core::ptr[0]::drop_in_place[0] @@ drop_in_place_intrinsic-cgu.0[Internal] struct StructWithDtor(u32); impl Drop for StructWithDtor { @@ -16,7 +16,7 @@ impl Drop for StructWithDtor { #[start] fn start(_: isize, _: *const *const u8) -> isize { - //~ MONO_ITEM fn core::ptr[0]::real_drop_in_place[0]<[drop_in_place_intrinsic::StructWithDtor[0]; 2]> @@ drop_in_place_intrinsic-cgu.0[Internal] + //~ MONO_ITEM fn core::ptr[0]::drop_in_place[0]<[drop_in_place_intrinsic::StructWithDtor[0]; 2]> @@ drop_in_place_intrinsic-cgu.0[Internal] let x = [StructWithDtor(0), StructWithDtor(1)]; drop_slice_in_place(&x); @@ -31,7 +31,6 @@ fn drop_slice_in_place(x: &[StructWithDtor]) { // not have drop-glue for the unsized [StructWithDtor]. This has to be // generated though when the drop_in_place() intrinsic is used. //~ MONO_ITEM fn core::ptr[0]::drop_in_place[0]<[drop_in_place_intrinsic::StructWithDtor[0]]> @@ drop_in_place_intrinsic-cgu.0[Internal] - //~ MONO_ITEM fn core::ptr[0]::real_drop_in_place[0]<[drop_in_place_intrinsic::StructWithDtor[0]]> @@ drop_in_place_intrinsic-cgu.0[Internal] ::std::ptr::drop_in_place(x as *const _ as *mut [StructWithDtor]); } } diff --git a/src/test/codegen-units/item-collection/generic-drop-glue.rs b/src/test/codegen-units/item-collection/generic-drop-glue.rs index 94e79f0b32044..675bdfdb4d250 100644 --- a/src/test/codegen-units/item-collection/generic-drop-glue.rs +++ b/src/test/codegen-units/item-collection/generic-drop-glue.rs @@ -37,7 +37,7 @@ enum EnumNoDrop { struct NonGenericNoDrop(i32); struct NonGenericWithDrop(i32); -//~ MONO_ITEM fn core::ptr[0]::real_drop_in_place[0] @@ generic_drop_glue-cgu.0[Internal] +//~ MONO_ITEM fn core::ptr[0]::drop_in_place[0] @@ generic_drop_glue-cgu.0[Internal] impl Drop for NonGenericWithDrop { //~ MONO_ITEM fn generic_drop_glue::{{impl}}[2]::drop[0] @@ -47,11 +47,11 @@ impl Drop for NonGenericWithDrop { //~ MONO_ITEM fn generic_drop_glue::start[0] #[start] fn start(_: isize, _: *const *const u8) -> isize { - //~ MONO_ITEM fn core::ptr[0]::real_drop_in_place[0]> @@ generic_drop_glue-cgu.0[Internal] + //~ MONO_ITEM fn core::ptr[0]::drop_in_place[0]> @@ generic_drop_glue-cgu.0[Internal] //~ MONO_ITEM fn generic_drop_glue::{{impl}}[0]::drop[0] let _ = StructWithDrop { x: 0i8, y: 'a' }.x; - //~ MONO_ITEM fn core::ptr[0]::real_drop_in_place[0]> @@ generic_drop_glue-cgu.0[Internal] + //~ MONO_ITEM fn core::ptr[0]::drop_in_place[0]> @@ generic_drop_glue-cgu.0[Internal] //~ MONO_ITEM fn generic_drop_glue::{{impl}}[0]::drop[0]<&str, generic_drop_glue::NonGenericNoDrop[0]> let _ = StructWithDrop { x: "&str", y: NonGenericNoDrop(0) }.y; @@ -60,17 +60,17 @@ fn start(_: isize, _: *const *const u8) -> isize { // This is supposed to generate drop-glue because it contains a field that // needs to be dropped. - //~ MONO_ITEM fn core::ptr[0]::real_drop_in_place[0]> @@ generic_drop_glue-cgu.0[Internal] + //~ MONO_ITEM fn core::ptr[0]::drop_in_place[0]> @@ generic_drop_glue-cgu.0[Internal] let _ = StructNoDrop { x: NonGenericWithDrop(0), y: 0f64 }.y; - //~ MONO_ITEM fn core::ptr[0]::real_drop_in_place[0]> @@ generic_drop_glue-cgu.0[Internal] + //~ MONO_ITEM fn core::ptr[0]::drop_in_place[0]> @@ generic_drop_glue-cgu.0[Internal] //~ MONO_ITEM fn generic_drop_glue::{{impl}}[1]::drop[0] let _ = match EnumWithDrop::A::(0) { EnumWithDrop::A(x) => x, EnumWithDrop::B(x) => x as i32 }; - //~MONO_ITEM fn core::ptr[0]::real_drop_in_place[0]> @@ generic_drop_glue-cgu.0[Internal] + //~MONO_ITEM fn core::ptr[0]::drop_in_place[0]> @@ generic_drop_glue-cgu.0[Internal] //~ MONO_ITEM fn generic_drop_glue::{{impl}}[1]::drop[0] let _ = match EnumWithDrop::B::(1.0) { EnumWithDrop::A(x) => x, diff --git a/src/test/codegen-units/item-collection/instantiation-through-vtable.rs b/src/test/codegen-units/item-collection/instantiation-through-vtable.rs index e79b069b25c13..db0390b58c84a 100644 --- a/src/test/codegen-units/item-collection/instantiation-through-vtable.rs +++ b/src/test/codegen-units/item-collection/instantiation-through-vtable.rs @@ -24,13 +24,13 @@ impl Trait for Struct { fn start(_: isize, _: *const *const u8) -> isize { let s1 = Struct { _a: 0u32 }; - //~ MONO_ITEM fn core::ptr[0]::real_drop_in_place[0]> @@ instantiation_through_vtable-cgu.0[Internal] + //~ MONO_ITEM fn core::ptr[0]::drop_in_place[0]> @@ instantiation_through_vtable-cgu.0[Internal] //~ MONO_ITEM fn instantiation_through_vtable::{{impl}}[0]::foo[0] //~ MONO_ITEM fn instantiation_through_vtable::{{impl}}[0]::bar[0] let _ = &s1 as &Trait; let s1 = Struct { _a: 0u64 }; - //~ MONO_ITEM fn core::ptr[0]::real_drop_in_place[0]> @@ instantiation_through_vtable-cgu.0[Internal] + //~ MONO_ITEM fn core::ptr[0]::drop_in_place[0]> @@ instantiation_through_vtable-cgu.0[Internal] //~ MONO_ITEM fn instantiation_through_vtable::{{impl}}[0]::foo[0] //~ MONO_ITEM fn instantiation_through_vtable::{{impl}}[0]::bar[0] let _ = &s1 as &Trait; diff --git a/src/test/codegen-units/item-collection/non-generic-drop-glue.rs b/src/test/codegen-units/item-collection/non-generic-drop-glue.rs index f13952bb7810e..a899b8b2c8b9c 100644 --- a/src/test/codegen-units/item-collection/non-generic-drop-glue.rs +++ b/src/test/codegen-units/item-collection/non-generic-drop-glue.rs @@ -5,7 +5,7 @@ #![deny(dead_code)] #![feature(start)] -//~ MONO_ITEM fn core::ptr[0]::real_drop_in_place[0] @@ non_generic_drop_glue-cgu.0[Internal] +//~ MONO_ITEM fn core::ptr[0]::drop_in_place[0] @@ non_generic_drop_glue-cgu.0[Internal] struct StructWithDrop { x: i32 } @@ -19,7 +19,7 @@ struct StructNoDrop { x: i32 } -//~ MONO_ITEM fn core::ptr[0]::real_drop_in_place[0] @@ non_generic_drop_glue-cgu.0[Internal] +//~ MONO_ITEM fn core::ptr[0]::drop_in_place[0] @@ non_generic_drop_glue-cgu.0[Internal] enum EnumWithDrop { A(i32) } diff --git a/src/test/codegen-units/item-collection/transitive-drop-glue.rs b/src/test/codegen-units/item-collection/transitive-drop-glue.rs index 14545a33b5945..7e29af43538fd 100644 --- a/src/test/codegen-units/item-collection/transitive-drop-glue.rs +++ b/src/test/codegen-units/item-collection/transitive-drop-glue.rs @@ -5,11 +5,11 @@ #![deny(dead_code)] #![feature(start)] -//~ MONO_ITEM fn core::ptr[0]::real_drop_in_place[0] @@ transitive_drop_glue-cgu.0[Internal] +//~ MONO_ITEM fn core::ptr[0]::drop_in_place[0] @@ transitive_drop_glue-cgu.0[Internal] struct Root(Intermediate); -//~ MONO_ITEM fn core::ptr[0]::real_drop_in_place[0] @@ transitive_drop_glue-cgu.0[Internal] +//~ MONO_ITEM fn core::ptr[0]::drop_in_place[0] @@ transitive_drop_glue-cgu.0[Internal] struct Intermediate(Leaf); -//~ MONO_ITEM fn core::ptr[0]::real_drop_in_place[0] @@ transitive_drop_glue-cgu.0[Internal] +//~ MONO_ITEM fn core::ptr[0]::drop_in_place[0] @@ transitive_drop_glue-cgu.0[Internal] struct Leaf; impl Drop for Leaf { @@ -30,15 +30,15 @@ impl Drop for LeafGen { fn start(_: isize, _: *const *const u8) -> isize { let _ = Root(Intermediate(Leaf)); - //~ MONO_ITEM fn core::ptr[0]::real_drop_in_place[0]> @@ transitive_drop_glue-cgu.0[Internal] - //~ MONO_ITEM fn core::ptr[0]::real_drop_in_place[0]> @@ transitive_drop_glue-cgu.0[Internal] - //~ MONO_ITEM fn core::ptr[0]::real_drop_in_place[0]> @@ transitive_drop_glue-cgu.0[Internal] + //~ MONO_ITEM fn core::ptr[0]::drop_in_place[0]> @@ transitive_drop_glue-cgu.0[Internal] + //~ MONO_ITEM fn core::ptr[0]::drop_in_place[0]> @@ transitive_drop_glue-cgu.0[Internal] + //~ MONO_ITEM fn core::ptr[0]::drop_in_place[0]> @@ transitive_drop_glue-cgu.0[Internal] //~ MONO_ITEM fn transitive_drop_glue::{{impl}}[1]::drop[0] let _ = RootGen(IntermediateGen(LeafGen(0u32))); - //~ MONO_ITEM fn core::ptr[0]::real_drop_in_place[0]> @@ transitive_drop_glue-cgu.0[Internal] - //~ MONO_ITEM fn core::ptr[0]::real_drop_in_place[0]> @@ transitive_drop_glue-cgu.0[Internal] - //~ MONO_ITEM fn core::ptr[0]::real_drop_in_place[0]> @@ transitive_drop_glue-cgu.0[Internal] + //~ MONO_ITEM fn core::ptr[0]::drop_in_place[0]> @@ transitive_drop_glue-cgu.0[Internal] + //~ MONO_ITEM fn core::ptr[0]::drop_in_place[0]> @@ transitive_drop_glue-cgu.0[Internal] + //~ MONO_ITEM fn core::ptr[0]::drop_in_place[0]> @@ transitive_drop_glue-cgu.0[Internal] //~ MONO_ITEM fn transitive_drop_glue::{{impl}}[1]::drop[0] let _ = RootGen(IntermediateGen(LeafGen(0i16))); diff --git a/src/test/codegen-units/item-collection/tuple-drop-glue.rs b/src/test/codegen-units/item-collection/tuple-drop-glue.rs index 54aff575f9117..d77de53ce010d 100644 --- a/src/test/codegen-units/item-collection/tuple-drop-glue.rs +++ b/src/test/codegen-units/item-collection/tuple-drop-glue.rs @@ -5,7 +5,7 @@ #![deny(dead_code)] #![feature(start)] -//~ MONO_ITEM fn core::ptr[0]::real_drop_in_place[0] @@ tuple_drop_glue-cgu.0[Internal] +//~ MONO_ITEM fn core::ptr[0]::drop_in_place[0] @@ tuple_drop_glue-cgu.0[Internal] struct Dropped; impl Drop for Dropped { @@ -16,11 +16,11 @@ impl Drop for Dropped { //~ MONO_ITEM fn tuple_drop_glue::start[0] #[start] fn start(_: isize, _: *const *const u8) -> isize { - //~ MONO_ITEM fn core::ptr[0]::real_drop_in_place[0]<(u32, tuple_drop_glue::Dropped[0])> @@ tuple_drop_glue-cgu.0[Internal] + //~ MONO_ITEM fn core::ptr[0]::drop_in_place[0]<(u32, tuple_drop_glue::Dropped[0])> @@ tuple_drop_glue-cgu.0[Internal] let x = (0u32, Dropped); - //~ MONO_ITEM fn core::ptr[0]::real_drop_in_place[0]<(i16, (tuple_drop_glue::Dropped[0], bool))> @@ tuple_drop_glue-cgu.0[Internal] - //~ MONO_ITEM fn core::ptr[0]::real_drop_in_place[0]<(tuple_drop_glue::Dropped[0], bool)> @@ tuple_drop_glue-cgu.0[Internal] + //~ MONO_ITEM fn core::ptr[0]::drop_in_place[0]<(i16, (tuple_drop_glue::Dropped[0], bool))> @@ tuple_drop_glue-cgu.0[Internal] + //~ MONO_ITEM fn core::ptr[0]::drop_in_place[0]<(tuple_drop_glue::Dropped[0], bool)> @@ tuple_drop_glue-cgu.0[Internal] let x = (0i16, (Dropped, true)); 0 diff --git a/src/test/codegen-units/item-collection/unsizing.rs b/src/test/codegen-units/item-collection/unsizing.rs index fd794df37608b..1ed60dcf265ff 100644 --- a/src/test/codegen-units/item-collection/unsizing.rs +++ b/src/test/codegen-units/item-collection/unsizing.rs @@ -48,13 +48,13 @@ impl, U: ?Sized> CoerceUnsized> for Wrapper fn start(_: isize, _: *const *const u8) -> isize { // simple case let bool_sized = &true; - //~ MONO_ITEM fn core::ptr[0]::real_drop_in_place[0] @@ unsizing-cgu.0[Internal] + //~ MONO_ITEM fn core::ptr[0]::drop_in_place[0] @@ unsizing-cgu.0[Internal] //~ MONO_ITEM fn unsizing::{{impl}}[0]::foo[0] let _bool_unsized = bool_sized as &Trait; let char_sized = &'a'; - //~ MONO_ITEM fn core::ptr[0]::real_drop_in_place[0] @@ unsizing-cgu.0[Internal] + //~ MONO_ITEM fn core::ptr[0]::drop_in_place[0] @@ unsizing-cgu.0[Internal] //~ MONO_ITEM fn unsizing::{{impl}}[1]::foo[0] let _char_unsized = char_sized as &Trait; @@ -64,13 +64,13 @@ fn start(_: isize, _: *const *const u8) -> isize { _b: 2, _c: 3.0f64 }; - //~ MONO_ITEM fn core::ptr[0]::real_drop_in_place[0] @@ unsizing-cgu.0[Internal] + //~ MONO_ITEM fn core::ptr[0]::drop_in_place[0] @@ unsizing-cgu.0[Internal] //~ MONO_ITEM fn unsizing::{{impl}}[2]::foo[0] let _struct_unsized = struct_sized as &Struct; // custom coercion let wrapper_sized = Wrapper(&0u32); - //~ MONO_ITEM fn core::ptr[0]::real_drop_in_place[0] @@ unsizing-cgu.0[Internal] + //~ MONO_ITEM fn core::ptr[0]::drop_in_place[0] @@ unsizing-cgu.0[Internal] //~ MONO_ITEM fn unsizing::{{impl}}[3]::foo[0] let _wrapper_sized = wrapper_sized as Wrapper; diff --git a/src/test/codegen-units/partitioning/extern-drop-glue.rs b/src/test/codegen-units/partitioning/extern-drop-glue.rs index 0f3d72d16a96e..f85ae0c077486 100644 --- a/src/test/codegen-units/partitioning/extern-drop-glue.rs +++ b/src/test/codegen-units/partitioning/extern-drop-glue.rs @@ -11,14 +11,14 @@ // aux-build:cgu_extern_drop_glue.rs extern crate cgu_extern_drop_glue; -//~ MONO_ITEM fn core::ptr[0]::real_drop_in_place[0] @@ extern_drop_glue[Internal] extern_drop_glue-mod1[Internal] +//~ MONO_ITEM fn core::ptr[0]::drop_in_place[0] @@ extern_drop_glue[Internal] extern_drop_glue-mod1[Internal] struct LocalStruct(cgu_extern_drop_glue::Struct); //~ MONO_ITEM fn extern_drop_glue::user[0] @@ extern_drop_glue[External] pub fn user() { - //~ MONO_ITEM fn core::ptr[0]::real_drop_in_place[0] @@ extern_drop_glue[Internal] + //~ MONO_ITEM fn core::ptr[0]::drop_in_place[0] @@ extern_drop_glue[Internal] let _ = LocalStruct(cgu_extern_drop_glue::Struct(0)); } @@ -30,7 +30,7 @@ pub mod mod1 { //~ MONO_ITEM fn extern_drop_glue::mod1[0]::user[0] @@ extern_drop_glue-mod1[External] pub fn user() { - //~ MONO_ITEM fn core::ptr[0]::real_drop_in_place[0] @@ extern_drop_glue-mod1[Internal] + //~ MONO_ITEM fn core::ptr[0]::drop_in_place[0] @@ extern_drop_glue-mod1[Internal] let _ = LocalStruct(cgu_extern_drop_glue::Struct(0)); } } diff --git a/src/test/codegen-units/partitioning/local-drop-glue.rs b/src/test/codegen-units/partitioning/local-drop-glue.rs index 938d4ffb693c9..366af4d4c386b 100644 --- a/src/test/codegen-units/partitioning/local-drop-glue.rs +++ b/src/test/codegen-units/partitioning/local-drop-glue.rs @@ -7,7 +7,7 @@ #![allow(dead_code)] #![crate_type="rlib"] -//~ MONO_ITEM fn core::ptr[0]::real_drop_in_place[0] @@ local_drop_glue[Internal] local_drop_glue-mod1[Internal] +//~ MONO_ITEM fn core::ptr[0]::drop_in_place[0] @@ local_drop_glue[Internal] local_drop_glue-mod1[Internal] struct Struct { _a: u32 } @@ -17,7 +17,7 @@ impl Drop for Struct { fn drop(&mut self) {} } -//~ MONO_ITEM fn core::ptr[0]::real_drop_in_place[0] @@ local_drop_glue[Internal] +//~ MONO_ITEM fn core::ptr[0]::drop_in_place[0] @@ local_drop_glue[Internal] struct Outer { _a: Struct } @@ -36,10 +36,10 @@ pub mod mod1 { use super::Struct; - //~ MONO_ITEM fn core::ptr[0]::real_drop_in_place[0] @@ local_drop_glue-mod1[Internal] + //~ MONO_ITEM fn core::ptr[0]::drop_in_place[0] @@ local_drop_glue-mod1[Internal] struct Struct2 { _a: Struct, - //~ MONO_ITEM fn core::ptr[0]::real_drop_in_place[0]<(u32, local_drop_glue::Struct[0])> @@ local_drop_glue-mod1[Internal] + //~ MONO_ITEM fn core::ptr[0]::drop_in_place[0]<(u32, local_drop_glue::Struct[0])> @@ local_drop_glue-mod1[Internal] _b: (u32, Struct), } diff --git a/src/test/codegen-units/partitioning/vtable-through-const.rs b/src/test/codegen-units/partitioning/vtable-through-const.rs index 5d23a4e13cbad..06e2ef6bb2257 100644 --- a/src/test/codegen-units/partitioning/vtable-through-const.rs +++ b/src/test/codegen-units/partitioning/vtable-through-const.rs @@ -66,7 +66,7 @@ mod mod1 { //~ MONO_ITEM fn vtable_through_const::start[0] #[start] fn start(_: isize, _: *const *const u8) -> isize { - //~ MONO_ITEM fn core::ptr[0]::real_drop_in_place[0] @@ vtable_through_const[Internal] + //~ MONO_ITEM fn core::ptr[0]::drop_in_place[0] @@ vtable_through_const[Internal] // Since Trait1::do_something() is instantiated via its default implementation, // it is considered a generic and is instantiated here only because it is diff --git a/src/test/codegen/drop.rs b/src/test/codegen/drop.rs index 959929fbafbf1..0c7f3bb2020a9 100644 --- a/src/test/codegen/drop.rs +++ b/src/test/codegen/drop.rs @@ -21,7 +21,7 @@ pub fn droppy() { // regular function exit. We used to have problems with quadratic growths of drop calls in such // functions. // FIXME(eddyb) the `void @` forces a match on the instruction, instead of the -// comment, that's `; call core::ptr::real_drop_in_place::` +// comment, that's `; call core::intrinsics::drop_in_place::` // for the `v0` mangling, should switch to matching on that once `legacy` is gone. // CHECK-NOT: invoke void @{{.*}}drop_in_place{{.*}}SomeUniqueName // CHECK: call void @{{.*}}drop_in_place{{.*}}SomeUniqueName diff --git a/src/test/mir-opt/retag.rs b/src/test/mir-opt/retag.rs index ccecaeac96b83..1c88a9e4d5a32 100644 --- a/src/test/mir-opt/retag.rs +++ b/src/test/mir-opt/retag.rs @@ -113,8 +113,8 @@ fn main() { // } // } // END rustc.main-{{closure}}.EraseRegions.after.mir -// START rustc.ptr-real_drop_in_place.Test.SimplifyCfg-make_shim.after.mir -// fn std::ptr::real_drop_in_place(_1: &mut Test) -> () { +// START rustc.ptr-drop_in_place.Test.SimplifyCfg-make_shim.after.mir +// fn std::intrinsics::drop_in_place(_1: *mut Test) -> () { // ... // bb0: { // Retag([raw] _1); @@ -126,4 +126,4 @@ fn main() { // return; // } // } -// END rustc.ptr-real_drop_in_place.Test.SimplifyCfg-make_shim.after.mir +// END rustc.ptr-drop_in_place.Test.SimplifyCfg-make_shim.after.mir diff --git a/src/test/mir-opt/slice-drop-shim.rs b/src/test/mir-opt/slice-drop-shim.rs index 5a37b67229c37..a25375594d3e1 100644 --- a/src/test/mir-opt/slice-drop-shim.rs +++ b/src/test/mir-opt/slice-drop-shim.rs @@ -6,7 +6,7 @@ fn main() { // END RUST SOURCE -// START rustc.ptr-real_drop_in_place.[std__string__String].AddMovesForPackedDrops.before.mir +// START rustc.ptr-drop_in_place.[std__string__String].AddMovesForPackedDrops.before.mir // let mut _2: usize; // let mut _3: usize; // let mut _4: usize; @@ -87,4 +87,4 @@ fn main() { // _3 = Len((*_1)); // switchInt(move _2) -> [0usize: bb8, otherwise: bb14]; // } -// END rustc.ptr-real_drop_in_place.[std__string__String].AddMovesForPackedDrops.before.mir +// END rustc.ptr-drop_in_place.[std__string__String].AddMovesForPackedDrops.before.mir diff --git a/src/test/mir-opt/unusual-item-types.rs b/src/test/mir-opt/unusual-item-types.rs index f4d848dfc7ad1..88cfb62a0d094 100644 --- a/src/test/mir-opt/unusual-item-types.rs +++ b/src/test/mir-opt/unusual-item-types.rs @@ -45,7 +45,7 @@ fn main() { // } // END rustc.E-V-{{constant}}.mir_map.0.mir -// START rustc.ptr-real_drop_in_place.std__vec__Vec_i32_.AddMovesForPackedDrops.before.mir +// START rustc.ptr-drop_in_place.std__vec__Vec_i32_.AddMovesForPackedDrops.before.mir // bb0: { // goto -> bb7; // } @@ -71,7 +71,7 @@ fn main() { // _2 = &mut (*_1); // _3 = const as std::ops::Drop>::drop(move _2) -> [return: bb6, unwind: bb5]; // } -// END rustc.ptr-real_drop_in_place.std__vec__Vec_i32_.AddMovesForPackedDrops.before.mir +// END rustc.ptr-drop_in_place.std__vec__Vec_i32_.AddMovesForPackedDrops.before.mir // START rustc.Test-X-{{constructor}}.mir_map.0.mir // fn Test::X(_1: usize) -> Test { diff --git a/src/test/rustdoc-ui/invalid-syntax.rs b/src/test/rustdoc-ui/invalid-syntax.rs index 34e92c421047d..72037dd74be35 100644 --- a/src/test/rustdoc-ui/invalid-syntax.rs +++ b/src/test/rustdoc-ui/invalid-syntax.rs @@ -93,3 +93,9 @@ pub fn empty_rust_with_whitespace() {} /// pub fn indent_after_fenced() {} //~^^^ WARNING could not parse code block as Rust code + +/// ``` +/// "invalid +/// ``` +pub fn invalid() {} +//~^^^^ WARNING could not parse code block as Rust code diff --git a/src/test/rustdoc-ui/invalid-syntax.stderr b/src/test/rustdoc-ui/invalid-syntax.stderr index 32cc20755ecf4..a90d3bbb979f6 100644 --- a/src/test/rustdoc-ui/invalid-syntax.stderr +++ b/src/test/rustdoc-ui/invalid-syntax.stderr @@ -132,3 +132,18 @@ LL | /// \____/ | = note: error from rustc: unknown start of token: \ +warning: could not parse code block as Rust code + --> $DIR/invalid-syntax.rs:97:5 + | +LL | /// ``` + | _____^ +LL | | /// "invalid +LL | | /// ``` + | |_______^ + | + = note: error from rustc: unterminated double quote string +help: mark blocks that do not contain Rust code as text + | +LL | /// ```text + | ^^^^^^^ + diff --git a/src/test/rustdoc-ui/test-compile-fail1.rs b/src/test/rustdoc-ui/test-compile-fail1.rs new file mode 100644 index 0000000000000..a05390238784d --- /dev/null +++ b/src/test/rustdoc-ui/test-compile-fail1.rs @@ -0,0 +1,8 @@ +// compile-flags:--test + +/// ``` +/// assert!(true) +/// ``` +pub fn f() {} + +pub fn f() {} diff --git a/src/test/rustdoc-ui/test-compile-fail1.stderr b/src/test/rustdoc-ui/test-compile-fail1.stderr new file mode 100644 index 0000000000000..2b38ba9e973d1 --- /dev/null +++ b/src/test/rustdoc-ui/test-compile-fail1.stderr @@ -0,0 +1,14 @@ +error[E0428]: the name `f` is defined multiple times + --> $DIR/test-compile-fail1.rs:8:1 + | +6 | pub fn f() {} + | ---------- previous definition of the value `f` here +7 | +8 | pub fn f() {} + | ^^^^^^^^^^ `f` redefined here + | + = note: `f` must be defined only once in the value namespace of this module + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0428`. diff --git a/src/test/rustdoc-ui/test-compile-fail2.rs b/src/test/rustdoc-ui/test-compile-fail2.rs new file mode 100644 index 0000000000000..651ded0a04793 --- /dev/null +++ b/src/test/rustdoc-ui/test-compile-fail2.rs @@ -0,0 +1,3 @@ +// compile-flags:--test + +fail diff --git a/src/test/rustdoc-ui/test-compile-fail2.stderr b/src/test/rustdoc-ui/test-compile-fail2.stderr new file mode 100644 index 0000000000000..cee5b63cf5097 --- /dev/null +++ b/src/test/rustdoc-ui/test-compile-fail2.stderr @@ -0,0 +1,8 @@ +error: expected one of `!` or `::`, found `` + --> $DIR/test-compile-fail2.rs:3:1 + | +3 | fail + | ^^^^ expected one of `!` or `::` + +error: aborting due to previous error + diff --git a/src/test/rustdoc-ui/test-compile-fail3.rs b/src/test/rustdoc-ui/test-compile-fail3.rs new file mode 100644 index 0000000000000..faa30ad836712 --- /dev/null +++ b/src/test/rustdoc-ui/test-compile-fail3.rs @@ -0,0 +1,3 @@ +// compile-flags:--test + +"fail diff --git a/src/test/rustdoc-ui/test-compile-fail3.stderr b/src/test/rustdoc-ui/test-compile-fail3.stderr new file mode 100644 index 0000000000000..7a2f1815ed8e5 --- /dev/null +++ b/src/test/rustdoc-ui/test-compile-fail3.stderr @@ -0,0 +1,8 @@ +error: unterminated double quote string + --> $DIR/test-compile-fail3.rs:3:1 + | +3 | "fail + | ^^^^^^ + +error: aborting due to previous error + diff --git a/src/test/rustdoc-ui/test-no_std.rs b/src/test/rustdoc-ui/test-no_std.rs new file mode 100644 index 0000000000000..166a87382cb65 --- /dev/null +++ b/src/test/rustdoc-ui/test-no_std.rs @@ -0,0 +1,12 @@ +// compile-flags:--test +// normalize-stdout-test: "src/test/rustdoc-ui" -> "$$DIR" +// build-pass + +#![no_std] + +extern crate alloc; + +/// ``` +/// assert!(true) +/// ``` +pub fn f() {} diff --git a/src/test/rustdoc-ui/test-no_std.stdout b/src/test/rustdoc-ui/test-no_std.stdout new file mode 100644 index 0000000000000..9cdcac2a483ab --- /dev/null +++ b/src/test/rustdoc-ui/test-no_std.stdout @@ -0,0 +1,6 @@ + +running 1 test +test $DIR/test-no_std.rs - f (line 9) ... ok + +test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out + diff --git a/src/test/rustdoc/bad-codeblock-syntax.rs b/src/test/rustdoc/bad-codeblock-syntax.rs index ae8fbe4a2a800..afef86ec9c77f 100644 --- a/src/test/rustdoc/bad-codeblock-syntax.rs +++ b/src/test/rustdoc/bad-codeblock-syntax.rs @@ -33,3 +33,10 @@ pub fn ok() {} /// /// ``` pub fn escape() {} + +// @has bad_codeblock_syntax/fn.unterminated.html +// @has - '//*[@class="docblock"]/pre/code' '"unterminated' +/// ``` +/// "unterminated +/// ``` +pub fn unterminated() {} diff --git a/src/test/ui/consts/miri_unleashed/drop.stderr b/src/test/ui/consts/miri_unleashed/drop.stderr index 2cdeb598c8cc6..2439d527bd197 100644 --- a/src/test/ui/consts/miri_unleashed/drop.stderr +++ b/src/test/ui/consts/miri_unleashed/drop.stderr @@ -7,17 +7,17 @@ LL | let _v: Vec = Vec::new(); error[E0080]: could not evaluate static initializer --> $SRC_DIR/libcore/ptr/mod.rs:LL:COL | -LL | / unsafe fn real_drop_in_place(to_drop: &mut T) { +LL | / pub unsafe fn drop_in_place(to_drop: *mut T) { LL | | // Code here does not matter - this is replaced by the LL | | // real drop glue by the compiler. -LL | | real_drop_in_place(to_drop) +LL | | drop_in_place(to_drop) LL | | } | |_^ calling non-const function ` as std::ops::Drop>::drop` | ::: $DIR/drop.rs:23:1 | LL | }; - | - inside call to `std::ptr::real_drop_in_place::> - shim(Some(std::vec::Vec))` at $DIR/drop.rs:23:1 + | - inside call to `std::intrinsics::drop_in_place::> - shim(Some(std::vec::Vec))` at $DIR/drop.rs:23:1 error: aborting due to previous error diff --git a/src/test/ui/recursion/issue-38591-non-regular-dropck-recursion.rs b/src/test/ui/recursion/issue-38591-non-regular-dropck-recursion.rs index 0fcf77d8722d6..d9996b80ac09d 100644 --- a/src/test/ui/recursion/issue-38591-non-regular-dropck-recursion.rs +++ b/src/test/ui/recursion/issue-38591-non-regular-dropck-recursion.rs @@ -1,6 +1,6 @@ // Dropck shouldn't hit a recursion limit from checking `S` since it has // no free regions or type parameters. -// Codegen however, has to error for the infinitely many `real_drop_in_place` +// Codegen however, has to error for the infinitely many `drop_in_place` // functions it has been asked to create. // build-fail diff --git a/src/test/ui/recursion/issue-38591-non-regular-dropck-recursion.stderr b/src/test/ui/recursion/issue-38591-non-regular-dropck-recursion.stderr index 77309a82a0fa7..de6df4cd0268c 100644 --- a/src/test/ui/recursion/issue-38591-non-regular-dropck-recursion.stderr +++ b/src/test/ui/recursion/issue-38591-non-regular-dropck-recursion.stderr @@ -1,4 +1,4 @@ -error: reached the recursion limit while instantiating `std::ptr::real_drop_in_place::> - shim(Some(S))` +error: reached the recursion limit while instantiating `std::intrinsics::drop_in_place::> - shim(Some(S))` error: aborting due to previous error