From 6d5170c960d1cf0ad1137bbf65e4d1c992cc21fe Mon Sep 17 00:00:00 2001 From: Camille GILLOT Date: Wed, 1 Jan 2020 19:10:11 +0100 Subject: [PATCH 01/16] Move some queries from rustc::ty to librustc_passes. --- src/librustc/ty/mod.rs | 356 +---------------------------------- src/librustc_passes/lib.rs | 3 + src/librustc_passes/ty.rs | 369 +++++++++++++++++++++++++++++++++++++ 3 files changed, 374 insertions(+), 354 deletions(-) create mode 100644 src/librustc_passes/ty.rs diff --git a/src/librustc/ty/mod.rs b/src/librustc/ty/mod.rs index d1e37a4ea1151..e6acb6b74dc63 100644 --- a/src/librustc/ty/mod.rs +++ b/src/librustc/ty/mod.rs @@ -18,7 +18,6 @@ use crate::middle::resolve_lifetime::ObjectLifetimeDefault; use crate::mir::interpret::ErrorHandled; use crate::mir::GeneratorLayout; use crate::mir::ReadOnlyBodyAndCache; -use crate::session::CrateDisambiguator; use crate::session::DataTypeKind; use crate::traits::{self, Reveal}; use crate::ty; @@ -31,7 +30,6 @@ use rustc_data_structures::captures::Captures; use rustc_data_structures::fx::FxHashMap; use rustc_data_structures::fx::FxIndexMap; use rustc_data_structures::stable_hasher::{HashStable, StableHasher}; -use rustc_data_structures::svh::Svh; use rustc_data_structures::sync::{self, par_iter, Lrc, ParallelIterator}; use rustc_hir as hir; use rustc_hir::def::{CtorKind, CtorOf, DefKind, Res}; @@ -2423,70 +2421,6 @@ impl<'tcx> AdtDef { pub fn sized_constraint(&self, tcx: TyCtxt<'tcx>) -> &'tcx [Ty<'tcx>] { tcx.adt_sized_constraint(self.did).0 } - - fn sized_constraint_for_ty(&self, tcx: TyCtxt<'tcx>, ty: Ty<'tcx>) -> Vec> { - let result = match ty.kind { - Bool | Char | Int(..) | Uint(..) | Float(..) | RawPtr(..) | Ref(..) | FnDef(..) - | FnPtr(_) | Array(..) | Closure(..) | Generator(..) | Never => vec![], - - Str | Dynamic(..) | Slice(_) | Foreign(..) | Error | GeneratorWitness(..) => { - // these are never sized - return the target type - vec![ty] - } - - Tuple(ref tys) => match tys.last() { - None => vec![], - Some(ty) => self.sized_constraint_for_ty(tcx, ty.expect_ty()), - }, - - Adt(adt, substs) => { - // recursive case - let adt_tys = adt.sized_constraint(tcx); - debug!("sized_constraint_for_ty({:?}) intermediate = {:?}", ty, adt_tys); - adt_tys - .iter() - .map(|ty| ty.subst(tcx, substs)) - .flat_map(|ty| self.sized_constraint_for_ty(tcx, ty)) - .collect() - } - - Projection(..) | Opaque(..) => { - // must calculate explicitly. - // FIXME: consider special-casing always-Sized projections - vec![ty] - } - - UnnormalizedProjection(..) => bug!("only used with chalk-engine"), - - Param(..) => { - // perf hack: if there is a `T: Sized` bound, then - // we know that `T` is Sized and do not need to check - // it on the impl. - - let sized_trait = match tcx.lang_items().sized_trait() { - Some(x) => x, - _ => return vec![ty], - }; - let sized_predicate = Binder::dummy(TraitRef { - def_id: sized_trait, - substs: tcx.mk_substs_trait(ty, &[]), - }) - .to_predicate(); - let predicates = tcx.predicates_of(self.did).predicates; - if predicates.iter().any(|(p, _)| *p == sized_predicate) { - vec![] - } else { - vec![ty] - } - } - - Placeholder(..) | Bound(..) | Infer(..) => { - bug!("unexpected type `{:?}` in sized_constraint_for_ty", ty) - } - }; - debug!("sized_constraint_for_ty({:?}) = {:?}", ty, result); - result - } } impl<'tcx> FieldDef { @@ -2742,57 +2676,6 @@ impl<'tcx> TyCtxt<'tcx> { is_associated_item.then(|| self.associated_item(def_id)) } - fn associated_item_from_trait_item_ref( - self, - parent_def_id: DefId, - parent_vis: &hir::Visibility<'_>, - trait_item_ref: &hir::TraitItemRef, - ) -> AssocItem { - let def_id = self.hir().local_def_id(trait_item_ref.id.hir_id); - let (kind, has_self) = match trait_item_ref.kind { - hir::AssocItemKind::Const => (ty::AssocKind::Const, false), - hir::AssocItemKind::Method { has_self } => (ty::AssocKind::Method, has_self), - hir::AssocItemKind::Type => (ty::AssocKind::Type, false), - hir::AssocItemKind::OpaqueTy => bug!("only impls can have opaque types"), - }; - - AssocItem { - ident: trait_item_ref.ident, - kind, - // Visibility of trait items is inherited from their traits. - vis: Visibility::from_hir(parent_vis, trait_item_ref.id.hir_id, self), - defaultness: trait_item_ref.defaultness, - def_id, - container: TraitContainer(parent_def_id), - method_has_self_argument: has_self, - } - } - - fn associated_item_from_impl_item_ref( - self, - parent_def_id: DefId, - impl_item_ref: &hir::ImplItemRef<'_>, - ) -> AssocItem { - let def_id = self.hir().local_def_id(impl_item_ref.id.hir_id); - let (kind, has_self) = match impl_item_ref.kind { - hir::AssocItemKind::Const => (ty::AssocKind::Const, false), - hir::AssocItemKind::Method { has_self } => (ty::AssocKind::Method, has_self), - hir::AssocItemKind::Type => (ty::AssocKind::Type, false), - hir::AssocItemKind::OpaqueTy => (ty::AssocKind::OpaqueTy, false), - }; - - AssocItem { - ident: impl_item_ref.ident, - kind, - // Visibility of trait impl items doesn't matter. - vis: ty::Visibility::from_hir(&impl_item_ref.vis, impl_item_ref.id.hir_id, self), - defaultness: impl_item_ref.defaultness, - def_id, - container: ImplContainer(parent_def_id), - method_has_self_argument: has_self, - } - } - pub fn field_index(self, hir_id: hir::HirId, tables: &TypeckTables<'_>) -> usize { tables.field_indices().get(hir_id).cloned().expect("no index for a field") } @@ -3070,105 +2953,9 @@ impl Iterator for AssocItemsIterator<'_> { } } -fn associated_item(tcx: TyCtxt<'_>, def_id: DefId) -> AssocItem { - let id = tcx.hir().as_local_hir_id(def_id).unwrap(); - let parent_id = tcx.hir().get_parent_item(id); - let parent_def_id = tcx.hir().local_def_id(parent_id); - let parent_item = tcx.hir().expect_item(parent_id); - match parent_item.kind { - hir::ItemKind::Impl(.., ref impl_item_refs) => { - if let Some(impl_item_ref) = impl_item_refs.iter().find(|i| i.id.hir_id == id) { - let assoc_item = - tcx.associated_item_from_impl_item_ref(parent_def_id, impl_item_ref); - debug_assert_eq!(assoc_item.def_id, def_id); - return assoc_item; - } - } - - hir::ItemKind::Trait(.., ref trait_item_refs) => { - if let Some(trait_item_ref) = trait_item_refs.iter().find(|i| i.id.hir_id == id) { - let assoc_item = tcx.associated_item_from_trait_item_ref( - parent_def_id, - &parent_item.vis, - trait_item_ref, - ); - debug_assert_eq!(assoc_item.def_id, def_id); - return assoc_item; - } - } - - _ => {} - } - - span_bug!( - parent_item.span, - "unexpected parent of trait or impl item or item not found: {:?}", - parent_item.kind - ) -} - #[derive(Clone, HashStable)] pub struct AdtSizedConstraint<'tcx>(pub &'tcx [Ty<'tcx>]); -/// Calculates the `Sized` constraint. -/// -/// In fact, there are only a few options for the types in the constraint: -/// - an obviously-unsized type -/// - a type parameter or projection whose Sizedness can't be known -/// - a tuple of type parameters or projections, if there are multiple -/// such. -/// - a Error, if a type contained itself. The representability -/// check should catch this case. -fn adt_sized_constraint(tcx: TyCtxt<'_>, def_id: DefId) -> AdtSizedConstraint<'_> { - let def = tcx.adt_def(def_id); - - let result = tcx.mk_type_list( - def.variants - .iter() - .flat_map(|v| v.fields.last()) - .flat_map(|f| def.sized_constraint_for_ty(tcx, tcx.type_of(f.did))), - ); - - debug!("adt_sized_constraint: {:?} => {:?}", def, result); - - AdtSizedConstraint(result) -} - -fn associated_item_def_ids(tcx: TyCtxt<'_>, def_id: DefId) -> &[DefId] { - let id = tcx.hir().as_local_hir_id(def_id).unwrap(); - let item = tcx.hir().expect_item(id); - match item.kind { - hir::ItemKind::Trait(.., ref trait_item_refs) => tcx.arena.alloc_from_iter( - trait_item_refs - .iter() - .map(|trait_item_ref| trait_item_ref.id) - .map(|id| tcx.hir().local_def_id(id.hir_id)), - ), - hir::ItemKind::Impl(.., ref impl_item_refs) => tcx.arena.alloc_from_iter( - impl_item_refs - .iter() - .map(|impl_item_ref| impl_item_ref.id) - .map(|id| tcx.hir().local_def_id(id.hir_id)), - ), - hir::ItemKind::TraitAlias(..) => &[], - _ => span_bug!(item.span, "associated_item_def_ids: not impl or trait"), - } -} - -fn def_span(tcx: TyCtxt<'_>, def_id: DefId) -> Span { - tcx.hir().span_if_local(def_id).unwrap() -} - -/// If the given `DefId` describes an item belonging to a trait, -/// returns the `DefId` of the trait that the trait item belongs to; -/// otherwise, returns `None`. -fn trait_of_item(tcx: TyCtxt<'_>, def_id: DefId) -> Option { - tcx.opt_associated_item(def_id).and_then(|associated_item| match associated_item.container { - TraitContainer(def_id) => Some(def_id), - ImplContainer(_) => None, - }) -} - /// Yields the parent function's `DefId` if `def_id` is an `impl Trait` definition. pub fn is_impl_trait_defn(tcx: TyCtxt<'_>, def_id: DefId) -> Option { if let Some(hir_id) = tcx.hir().as_local_hir_id(def_id) { @@ -3181,151 +2968,12 @@ pub fn is_impl_trait_defn(tcx: TyCtxt<'_>, def_id: DefId) -> Option { None } -/// See `ParamEnv` struct definition for details. -fn param_env(tcx: TyCtxt<'_>, def_id: DefId) -> ParamEnv<'_> { - // The param_env of an impl Trait type is its defining function's param_env - if let Some(parent) = is_impl_trait_defn(tcx, def_id) { - return param_env(tcx, parent); - } - // Compute the bounds on Self and the type parameters. - - let InstantiatedPredicates { predicates } = tcx.predicates_of(def_id).instantiate_identity(tcx); - - // Finally, we have to normalize the bounds in the environment, in - // case they contain any associated type projections. This process - // can yield errors if the put in illegal associated types, like - // `::Bar` where `i32` does not implement `Foo`. We - // report these errors right here; this doesn't actually feel - // right to me, because constructing the environment feels like a - // kind of a "idempotent" action, but I'm not sure where would be - // a better place. In practice, we construct environments for - // every fn once during type checking, and we'll abort if there - // are any errors at that point, so after type checking you can be - // sure that this will succeed without errors anyway. - - let unnormalized_env = ty::ParamEnv::new( - tcx.intern_predicates(&predicates), - traits::Reveal::UserFacing, - tcx.sess.opts.debugging_opts.chalk.then_some(def_id), - ); - - let body_id = tcx.hir().as_local_hir_id(def_id).map_or(hir::DUMMY_HIR_ID, |id| { - tcx.hir().maybe_body_owned_by(id).map_or(id, |body| body.hir_id) - }); - let cause = traits::ObligationCause::misc(tcx.def_span(def_id), body_id); - traits::normalize_param_env_or_error(tcx, def_id, unnormalized_env, cause) -} - -fn crate_disambiguator(tcx: TyCtxt<'_>, crate_num: CrateNum) -> CrateDisambiguator { - assert_eq!(crate_num, LOCAL_CRATE); - tcx.sess.local_crate_disambiguator() -} - -fn original_crate_name(tcx: TyCtxt<'_>, crate_num: CrateNum) -> Symbol { - assert_eq!(crate_num, LOCAL_CRATE); - tcx.crate_name.clone() -} - -fn crate_hash(tcx: TyCtxt<'_>, crate_num: CrateNum) -> Svh { - assert_eq!(crate_num, LOCAL_CRATE); - tcx.hir().crate_hash -} - -fn instance_def_size_estimate<'tcx>(tcx: TyCtxt<'tcx>, instance_def: InstanceDef<'tcx>) -> usize { - match instance_def { - InstanceDef::Item(..) | InstanceDef::DropGlue(..) => { - let mir = tcx.instance_mir(instance_def); - mir.basic_blocks().iter().map(|bb| bb.statements.len()).sum() - } - // Estimate the size of other compiler-generated shims to be 1. - _ => 1, - } -} - -/// If `def_id` is an issue 33140 hack impl, returns its self type; otherwise, returns `None`. -/// -/// See [`ImplOverlapKind::Issue33140`] for more details. -fn issue33140_self_ty(tcx: TyCtxt<'_>, def_id: DefId) -> Option> { - debug!("issue33140_self_ty({:?})", def_id); - - let trait_ref = tcx - .impl_trait_ref(def_id) - .unwrap_or_else(|| bug!("issue33140_self_ty called on inherent impl {:?}", def_id)); - - debug!("issue33140_self_ty({:?}), trait-ref={:?}", def_id, trait_ref); - - let is_marker_like = tcx.impl_polarity(def_id) == ty::ImplPolarity::Positive - && tcx.associated_item_def_ids(trait_ref.def_id).is_empty(); - - // Check whether these impls would be ok for a marker trait. - if !is_marker_like { - debug!("issue33140_self_ty - not marker-like!"); - return None; - } - - // impl must be `impl Trait for dyn Marker1 + Marker2 + ...` - if trait_ref.substs.len() != 1 { - debug!("issue33140_self_ty - impl has substs!"); - return None; - } - - let predicates = tcx.predicates_of(def_id); - if predicates.parent.is_some() || !predicates.predicates.is_empty() { - debug!("issue33140_self_ty - impl has predicates {:?}!", predicates); - return None; - } - - let self_ty = trait_ref.self_ty(); - let self_ty_matches = match self_ty.kind { - ty::Dynamic(ref data, ty::ReStatic) => data.principal().is_none(), - _ => false, - }; - - if self_ty_matches { - debug!("issue33140_self_ty - MATCHES!"); - Some(self_ty) - } else { - debug!("issue33140_self_ty - non-matching self type"); - None - } -} - -/// Check if a function is async. -fn asyncness(tcx: TyCtxt<'_>, def_id: DefId) -> hir::IsAsync { - let hir_id = tcx - .hir() - .as_local_hir_id(def_id) - .unwrap_or_else(|| bug!("asyncness: expected local `DefId`, got `{:?}`", def_id)); - - let node = tcx.hir().get(hir_id); - - let fn_like = hir_map::blocks::FnLikeNode::from_node(node).unwrap_or_else(|| { - bug!("asyncness: expected fn-like node but got `{:?}`", def_id); - }); - - fn_like.asyncness() -} - pub fn provide(providers: &mut ty::query::Providers<'_>) { context::provide(providers); erase_regions::provide(providers); layout::provide(providers); - *providers = ty::query::Providers { - asyncness, - associated_item, - associated_item_def_ids, - adt_sized_constraint, - def_span, - param_env, - trait_of_item, - crate_disambiguator, - original_crate_name, - crate_hash, - trait_impls_of: trait_def::trait_impls_of_provider, - instance_def_size_estimate, - issue33140_self_ty, - ..*providers - }; + *providers = + ty::query::Providers { trait_impls_of: trait_def::trait_impls_of_provider, ..*providers }; } /// A map for the local crate mapping each type to a vector of its diff --git a/src/librustc_passes/lib.rs b/src/librustc_passes/lib.rs index 65eb07b989d83..8bd06465628fa 100644 --- a/src/librustc_passes/lib.rs +++ b/src/librustc_passes/lib.rs @@ -5,6 +5,7 @@ //! This API is completely unstable and subject to change. #![doc(html_root_url = "https://doc.rust-lang.org/nightly/")] +#![feature(bool_to_option)] #![feature(in_band_lifetimes)] #![feature(nll)] #![feature(slice_patterns)] @@ -30,6 +31,7 @@ pub mod loops; mod reachable; mod region; pub mod stability; +mod ty; pub fn provide(providers: &mut Providers<'_>) { check_const::provide(providers); @@ -42,4 +44,5 @@ pub fn provide(providers: &mut Providers<'_>) { reachable::provide(providers); region::provide(providers); stability::provide(providers); + ty::provide(providers); } diff --git a/src/librustc_passes/ty.rs b/src/librustc_passes/ty.rs new file mode 100644 index 0000000000000..fc8beb67e4ada --- /dev/null +++ b/src/librustc_passes/ty.rs @@ -0,0 +1,369 @@ +use rustc::hir::map as hir_map; +use rustc::session::CrateDisambiguator; +use rustc::traits::{self}; +use rustc::ty::subst::Subst; +use rustc::ty::{self, ToPredicate, Ty, TyCtxt}; +use rustc_data_structures::svh::Svh; +use rustc_hir as hir; +use rustc_hir::def_id::{CrateNum, DefId, LOCAL_CRATE}; +use rustc_span::symbol::Symbol; +use rustc_span::Span; + +fn sized_constraint_for_ty(tcx: TyCtxt<'tcx>, adtdef: &ty::AdtDef, ty: Ty<'tcx>) -> Vec> { + use ty::TyKind::*; + + let result = match ty.kind { + Bool | Char | Int(..) | Uint(..) | Float(..) | RawPtr(..) | Ref(..) | FnDef(..) + | FnPtr(_) | Array(..) | Closure(..) | Generator(..) | Never => vec![], + + Str | Dynamic(..) | Slice(_) | Foreign(..) | Error | GeneratorWitness(..) => { + // these are never sized - return the target type + vec![ty] + } + + Tuple(ref tys) => match tys.last() { + None => vec![], + Some(ty) => sized_constraint_for_ty(tcx, adtdef, ty.expect_ty()), + }, + + Adt(adt, substs) => { + // recursive case + let adt_tys = adt.sized_constraint(tcx); + debug!("sized_constraint_for_ty({:?}) intermediate = {:?}", ty, adt_tys); + adt_tys + .iter() + .map(|ty| ty.subst(tcx, substs)) + .flat_map(|ty| sized_constraint_for_ty(tcx, adtdef, ty)) + .collect() + } + + Projection(..) | Opaque(..) => { + // must calculate explicitly. + // FIXME: consider special-casing always-Sized projections + vec![ty] + } + + UnnormalizedProjection(..) => bug!("only used with chalk-engine"), + + Param(..) => { + // perf hack: if there is a `T: Sized` bound, then + // we know that `T` is Sized and do not need to check + // it on the impl. + + let sized_trait = match tcx.lang_items().sized_trait() { + Some(x) => x, + _ => return vec![ty], + }; + let sized_predicate = ty::Binder::dummy(ty::TraitRef { + def_id: sized_trait, + substs: tcx.mk_substs_trait(ty, &[]), + }) + .to_predicate(); + let predicates = tcx.predicates_of(adtdef.did).predicates; + if predicates.iter().any(|(p, _)| *p == sized_predicate) { vec![] } else { vec![ty] } + } + + Placeholder(..) | Bound(..) | Infer(..) => { + bug!("unexpected type `{:?}` in sized_constraint_for_ty", ty) + } + }; + debug!("sized_constraint_for_ty({:?}) = {:?}", ty, result); + result +} + +fn associated_item_from_trait_item_ref( + tcx: TyCtxt<'_>, + parent_def_id: DefId, + parent_vis: &hir::Visibility<'_>, + trait_item_ref: &hir::TraitItemRef, +) -> ty::AssocItem { + let def_id = tcx.hir().local_def_id(trait_item_ref.id.hir_id); + let (kind, has_self) = match trait_item_ref.kind { + hir::AssocItemKind::Const => (ty::AssocKind::Const, false), + hir::AssocItemKind::Method { has_self } => (ty::AssocKind::Method, has_self), + hir::AssocItemKind::Type => (ty::AssocKind::Type, false), + hir::AssocItemKind::OpaqueTy => bug!("only impls can have opaque types"), + }; + + ty::AssocItem { + ident: trait_item_ref.ident, + kind, + // Visibility of trait items is inherited from their traits. + vis: ty::Visibility::from_hir(parent_vis, trait_item_ref.id.hir_id, tcx), + defaultness: trait_item_ref.defaultness, + def_id, + container: ty::TraitContainer(parent_def_id), + method_has_self_argument: has_self, + } +} + +fn associated_item_from_impl_item_ref( + tcx: TyCtxt<'_>, + parent_def_id: DefId, + impl_item_ref: &hir::ImplItemRef<'_>, +) -> ty::AssocItem { + let def_id = tcx.hir().local_def_id(impl_item_ref.id.hir_id); + let (kind, has_self) = match impl_item_ref.kind { + hir::AssocItemKind::Const => (ty::AssocKind::Const, false), + hir::AssocItemKind::Method { has_self } => (ty::AssocKind::Method, has_self), + hir::AssocItemKind::Type => (ty::AssocKind::Type, false), + hir::AssocItemKind::OpaqueTy => (ty::AssocKind::OpaqueTy, false), + }; + + ty::AssocItem { + ident: impl_item_ref.ident, + kind, + // Visibility of trait impl items doesn't matter. + vis: ty::Visibility::from_hir(&impl_item_ref.vis, impl_item_ref.id.hir_id, tcx), + defaultness: impl_item_ref.defaultness, + def_id, + container: ty::ImplContainer(parent_def_id), + method_has_self_argument: has_self, + } +} + +fn associated_item(tcx: TyCtxt<'_>, def_id: DefId) -> ty::AssocItem { + let id = tcx.hir().as_local_hir_id(def_id).unwrap(); + let parent_id = tcx.hir().get_parent_item(id); + let parent_def_id = tcx.hir().local_def_id(parent_id); + let parent_item = tcx.hir().expect_item(parent_id); + match parent_item.kind { + hir::ItemKind::Impl(.., ref impl_item_refs) => { + if let Some(impl_item_ref) = impl_item_refs.iter().find(|i| i.id.hir_id == id) { + let assoc_item = + associated_item_from_impl_item_ref(tcx, parent_def_id, impl_item_ref); + debug_assert_eq!(assoc_item.def_id, def_id); + return assoc_item; + } + } + + hir::ItemKind::Trait(.., ref trait_item_refs) => { + if let Some(trait_item_ref) = trait_item_refs.iter().find(|i| i.id.hir_id == id) { + let assoc_item = associated_item_from_trait_item_ref( + tcx, + parent_def_id, + &parent_item.vis, + trait_item_ref, + ); + debug_assert_eq!(assoc_item.def_id, def_id); + return assoc_item; + } + } + + _ => {} + } + + span_bug!( + parent_item.span, + "unexpected parent of trait or impl item or item not found: {:?}", + parent_item.kind + ) +} + +/// Calculates the `Sized` constraint. +/// +/// In fact, there are only a few options for the types in the constraint: +/// - an obviously-unsized type +/// - a type parameter or projection whose Sizedness can't be known +/// - a tuple of type parameters or projections, if there are multiple +/// such. +/// - a Error, if a type contained itself. The representability +/// check should catch this case. +fn adt_sized_constraint(tcx: TyCtxt<'_>, def_id: DefId) -> ty::AdtSizedConstraint<'_> { + let def = tcx.adt_def(def_id); + + let result = tcx.mk_type_list( + def.variants + .iter() + .flat_map(|v| v.fields.last()) + .flat_map(|f| sized_constraint_for_ty(tcx, def, tcx.type_of(f.did))), + ); + + debug!("adt_sized_constraint: {:?} => {:?}", def, result); + + ty::AdtSizedConstraint(result) +} + +fn associated_item_def_ids(tcx: TyCtxt<'_>, def_id: DefId) -> &[DefId] { + let id = tcx.hir().as_local_hir_id(def_id).unwrap(); + let item = tcx.hir().expect_item(id); + match item.kind { + hir::ItemKind::Trait(.., ref trait_item_refs) => tcx.arena.alloc_from_iter( + trait_item_refs + .iter() + .map(|trait_item_ref| trait_item_ref.id) + .map(|id| tcx.hir().local_def_id(id.hir_id)), + ), + hir::ItemKind::Impl(.., ref impl_item_refs) => tcx.arena.alloc_from_iter( + impl_item_refs + .iter() + .map(|impl_item_ref| impl_item_ref.id) + .map(|id| tcx.hir().local_def_id(id.hir_id)), + ), + hir::ItemKind::TraitAlias(..) => &[], + _ => span_bug!(item.span, "associated_item_def_ids: not impl or trait"), + } +} + +fn def_span(tcx: TyCtxt<'_>, def_id: DefId) -> Span { + tcx.hir().span_if_local(def_id).unwrap() +} + +/// If the given `DefId` describes an item belonging to a trait, +/// returns the `DefId` of the trait that the trait item belongs to; +/// otherwise, returns `None`. +fn trait_of_item(tcx: TyCtxt<'_>, def_id: DefId) -> Option { + tcx.opt_associated_item(def_id).and_then(|associated_item| match associated_item.container { + ty::TraitContainer(def_id) => Some(def_id), + ty::ImplContainer(_) => None, + }) +} + +/// See `ParamEnv` struct definition for details. +fn param_env(tcx: TyCtxt<'_>, def_id: DefId) -> ty::ParamEnv<'_> { + // The param_env of an impl Trait type is its defining function's param_env + if let Some(parent) = ty::is_impl_trait_defn(tcx, def_id) { + return param_env(tcx, parent); + } + // Compute the bounds on Self and the type parameters. + + let ty::InstantiatedPredicates { predicates } = + tcx.predicates_of(def_id).instantiate_identity(tcx); + + // Finally, we have to normalize the bounds in the environment, in + // case they contain any associated type projections. This process + // can yield errors if the put in illegal associated types, like + // `::Bar` where `i32` does not implement `Foo`. We + // report these errors right here; this doesn't actually feel + // right to me, because constructing the environment feels like a + // kind of a "idempotent" action, but I'm not sure where would be + // a better place. In practice, we construct environments for + // every fn once during type checking, and we'll abort if there + // are any errors at that point, so after type checking you can be + // sure that this will succeed without errors anyway. + + let unnormalized_env = ty::ParamEnv::new( + tcx.intern_predicates(&predicates), + traits::Reveal::UserFacing, + tcx.sess.opts.debugging_opts.chalk.then_some(def_id), + ); + + let body_id = tcx.hir().as_local_hir_id(def_id).map_or(hir::DUMMY_HIR_ID, |id| { + tcx.hir().maybe_body_owned_by(id).map_or(id, |body| body.hir_id) + }); + let cause = traits::ObligationCause::misc(tcx.def_span(def_id), body_id); + traits::normalize_param_env_or_error(tcx, def_id, unnormalized_env, cause) +} + +fn crate_disambiguator(tcx: TyCtxt<'_>, crate_num: CrateNum) -> CrateDisambiguator { + assert_eq!(crate_num, LOCAL_CRATE); + tcx.sess.local_crate_disambiguator() +} + +fn original_crate_name(tcx: TyCtxt<'_>, crate_num: CrateNum) -> Symbol { + assert_eq!(crate_num, LOCAL_CRATE); + tcx.crate_name.clone() +} + +fn crate_hash(tcx: TyCtxt<'_>, crate_num: CrateNum) -> Svh { + assert_eq!(crate_num, LOCAL_CRATE); + tcx.hir().crate_hash +} + +fn instance_def_size_estimate<'tcx>( + tcx: TyCtxt<'tcx>, + instance_def: ty::InstanceDef<'tcx>, +) -> usize { + use ty::InstanceDef; + + match instance_def { + InstanceDef::Item(..) | InstanceDef::DropGlue(..) => { + let mir = tcx.instance_mir(instance_def); + mir.basic_blocks().iter().map(|bb| bb.statements.len()).sum() + } + // Estimate the size of other compiler-generated shims to be 1. + _ => 1, + } +} + +/// If `def_id` is an issue 33140 hack impl, returns its self type; otherwise, returns `None`. +/// +/// See [`ImplOverlapKind::Issue33140`] for more details. +fn issue33140_self_ty(tcx: TyCtxt<'_>, def_id: DefId) -> Option> { + debug!("issue33140_self_ty({:?})", def_id); + + let trait_ref = tcx + .impl_trait_ref(def_id) + .unwrap_or_else(|| bug!("issue33140_self_ty called on inherent impl {:?}", def_id)); + + debug!("issue33140_self_ty({:?}), trait-ref={:?}", def_id, trait_ref); + + let is_marker_like = tcx.impl_polarity(def_id) == ty::ImplPolarity::Positive + && tcx.associated_item_def_ids(trait_ref.def_id).is_empty(); + + // Check whether these impls would be ok for a marker trait. + if !is_marker_like { + debug!("issue33140_self_ty - not marker-like!"); + return None; + } + + // impl must be `impl Trait for dyn Marker1 + Marker2 + ...` + if trait_ref.substs.len() != 1 { + debug!("issue33140_self_ty - impl has substs!"); + return None; + } + + let predicates = tcx.predicates_of(def_id); + if predicates.parent.is_some() || !predicates.predicates.is_empty() { + debug!("issue33140_self_ty - impl has predicates {:?}!", predicates); + return None; + } + + let self_ty = trait_ref.self_ty(); + let self_ty_matches = match self_ty.kind { + ty::Dynamic(ref data, ty::ReStatic) => data.principal().is_none(), + _ => false, + }; + + if self_ty_matches { + debug!("issue33140_self_ty - MATCHES!"); + Some(self_ty) + } else { + debug!("issue33140_self_ty - non-matching self type"); + None + } +} + +/// Check if a function is async. +fn asyncness(tcx: TyCtxt<'_>, def_id: DefId) -> hir::IsAsync { + let hir_id = tcx + .hir() + .as_local_hir_id(def_id) + .unwrap_or_else(|| bug!("asyncness: expected local `DefId`, got `{:?}`", def_id)); + + let node = tcx.hir().get(hir_id); + + let fn_like = hir_map::blocks::FnLikeNode::from_node(node).unwrap_or_else(|| { + bug!("asyncness: expected fn-like node but got `{:?}`", def_id); + }); + + fn_like.asyncness() +} + +pub fn provide(providers: &mut ty::query::Providers<'_>) { + *providers = ty::query::Providers { + asyncness, + associated_item, + associated_item_def_ids, + adt_sized_constraint, + def_span, + param_env, + trait_of_item, + crate_disambiguator, + original_crate_name, + crate_hash, + instance_def_size_estimate, + issue33140_self_ty, + ..*providers + }; +} From 0810210bcb2c1a50d815e8e71d6db3b6cb0aba7f Mon Sep 17 00:00:00 2001 From: varkor Date: Fri, 10 Jan 2020 14:13:05 +0000 Subject: [PATCH 02/16] Diagnostics should start lowercase --- src/librustc/traits/error_reporting.rs | 2 +- src/librustc_ast_passes/feature_gate.rs | 2 +- src/librustc_builtin_macros/test.rs | 2 +- src/librustc_lint/builtin.rs | 14 ++--- src/librustc_mir/borrow_check/nll.rs | 4 +- src/librustc_typeck/check/cast.rs | 2 +- src/test/ui/anon-params-deprecated.stderr | 6 +-- .../validate_uninhabited_zsts.stderr | 2 +- .../feature-gate-never_type.stderr | 10 ++-- .../ui/future-incompatible-lint-group.stderr | 2 +- src/test/ui/issues/issue-45730.stderr | 6 +-- src/test/ui/lint/uninitialized-zeroed.stderr | 54 +++++++++---------- .../escape-argument-callee.stderr | 4 +- .../escape-argument.stderr | 4 +- .../escape-upvar-nested.stderr | 6 +-- .../escape-upvar-ref.stderr | 4 +- ...pagate-approximated-fail-no-postdom.stderr | 4 +- .../propagate-approximated-ref.stderr | 4 +- ...er-to-static-comparing-against-free.stderr | 8 +-- ...oximated-shorter-to-static-no-bound.stderr | 4 +- ...mated-shorter-to-static-wrong-bound.stderr | 4 +- .../propagate-approximated-val.stderr | 4 +- .../propagate-despite-same-free-region.stderr | 4 +- ...ail-to-approximate-longer-no-bounds.stderr | 4 +- ...-to-approximate-longer-wrong-bounds.stderr | 4 +- .../propagate-from-trait-match.stderr | 4 +- .../return-wrong-bound-region.stderr | 4 +- .../projection-no-regions-closure.stderr | 16 +++--- .../projection-one-region-closure.stderr | 16 +++--- ...tion-one-region-trait-bound-closure.stderr | 20 +++---- ...e-region-trait-bound-static-closure.stderr | 20 +++---- ...tion-two-region-trait-bound-closure.stderr | 32 +++++------ ...ram-closure-approximate-lower-bound.stderr | 8 +-- ...m-closure-outlives-from-return-type.stderr | 4 +- ...-closure-outlives-from-where-clause.stderr | 16 +++--- .../ui/order-dependent-cast-inference.stderr | 2 +- .../test-attrs/test-should-panic-attr.stderr | 8 +-- .../ui/traits/trait-bounds-same-crate-name.rs | 2 +- .../trait-bounds-same-crate-name.stderr | 4 +- 39 files changed, 160 insertions(+), 160 deletions(-) diff --git a/src/librustc/traits/error_reporting.rs b/src/librustc/traits/error_reporting.rs index 0c9a73d78a5eb..5440cb7bdf4e5 100644 --- a/src/librustc/traits/error_reporting.rs +++ b/src/librustc/traits/error_reporting.rs @@ -1156,7 +1156,7 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> { err.span_help(impl_span, "trait impl with same name found"); let trait_crate = self.tcx.crate_name(trait_with_same_path.krate); let crate_msg = format!( - "Perhaps two different versions of crate `{}` are being used?", + "perhaps two different versions of crate `{}` are being used?", trait_crate ); err.note(&crate_msg); diff --git a/src/librustc_ast_passes/feature_gate.rs b/src/librustc_ast_passes/feature_gate.rs index e6f4535a38dba..1e4b1ae077762 100644 --- a/src/librustc_ast_passes/feature_gate.rs +++ b/src/librustc_ast_passes/feature_gate.rs @@ -413,7 +413,7 @@ impl<'a> Visitor<'a> for PostExpansionVisitor<'a> { self.check_extern(bare_fn_ty.ext); } ast::TyKind::Never => { - gate_feature_post!(&self, never_type, ty.span, "The `!` type is experimental"); + gate_feature_post!(&self, never_type, ty.span, "the `!` type is experimental"); } _ => {} } diff --git a/src/librustc_builtin_macros/test.rs b/src/librustc_builtin_macros/test.rs index 0eee212108e85..07715cdbcb5e9 100644 --- a/src/librustc_builtin_macros/test.rs +++ b/src/librustc_builtin_macros/test.rs @@ -325,7 +325,7 @@ fn should_panic(cx: &ExtCtxt<'_>, i: &ast::Item) -> ShouldPanic { `expected = \"error message\"`", ) .note( - "Errors in this attribute were erroneously \ + "errors in this attribute were erroneously \ allowed and will become a hard error in a \ future release.", ) diff --git a/src/librustc_lint/builtin.rs b/src/librustc_lint/builtin.rs index 15a8332a28492..7f55bcd4017ef 100644 --- a/src/librustc_lint/builtin.rs +++ b/src/librustc_lint/builtin.rs @@ -657,7 +657,7 @@ impl EarlyLintPass for AnonymousParameters { ) .span_suggestion( arg.pat.span, - "Try naming the parameter or explicitly \ + "try naming the parameter or explicitly \ ignoring it", format!("_: {}", ty_snip), appl, @@ -1934,21 +1934,21 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for InvalidValue { use rustc::ty::TyKind::*; match ty.kind { // Primitive types that don't like 0 as a value. - Ref(..) => Some((format!("References must be non-null"), None)), + Ref(..) => Some((format!("references must be non-null"), None)), Adt(..) if ty.is_box() => Some((format!("`Box` must be non-null"), None)), - FnPtr(..) => Some((format!("Function pointers must be non-null"), None)), - Never => Some((format!("The never type (`!`) has no valid value"), None)), + FnPtr(..) => Some((format!("function pointers must be non-null"), None)), + Never => Some((format!("the `!` type has no valid value"), None)), RawPtr(tm) if matches!(tm.ty.kind, Dynamic(..)) => // raw ptr to dyn Trait { - Some((format!("The vtable of a wide raw pointer must be non-null"), None)) + Some((format!("the vtable of a wide raw pointer must be non-null"), None)) } // Primitive types with other constraints. Bool if init == InitKind::Uninit => { - Some((format!("Booleans must be `true` or `false`"), None)) + Some((format!("booleans must be either `true` or `false`"), None)) } Char if init == InitKind::Uninit => { - Some((format!("Characters must be a valid unicode codepoint"), None)) + Some((format!("characters must be a valid Unicode codepoint"), None)) } // Recurse and checks for some compound types. Adt(adt_def, substs) if !adt_def.is_union() => { diff --git a/src/librustc_mir/borrow_check/nll.rs b/src/librustc_mir/borrow_check/nll.rs index 151a2c4c19a7d..73718d58346f1 100644 --- a/src/librustc_mir/borrow_check/nll.rs +++ b/src/librustc_mir/borrow_check/nll.rs @@ -360,7 +360,7 @@ pub(super) fn dump_annotation<'a, 'tcx>( // better. if let Some(closure_region_requirements) = closure_region_requirements { - let mut err = tcx.sess.diagnostic().span_note_diag(body.span, "External requirements"); + let mut err = tcx.sess.diagnostic().span_note_diag(body.span, "external requirements"); regioncx.annotate(tcx, &mut err); @@ -379,7 +379,7 @@ pub(super) fn dump_annotation<'a, 'tcx>( err.buffer(errors_buffer); } else { - let mut err = tcx.sess.diagnostic().span_note_diag(body.span, "No external requirements"); + let mut err = tcx.sess.diagnostic().span_note_diag(body.span, "no external requirements"); regioncx.annotate(tcx, &mut err); err.buffer(errors_buffer); diff --git a/src/librustc_typeck/check/cast.rs b/src/librustc_typeck/check/cast.rs index ba5e5fd8ac188..cbbfe2d627895 100644 --- a/src/librustc_typeck/check/cast.rs +++ b/src/librustc_typeck/check/cast.rs @@ -381,7 +381,7 @@ impl<'a, 'tcx> CastCheck<'tcx> { if unknown_cast_to { "to" } else { "from" } ); err.note( - "The type information given here is insufficient to check whether \ + "the type information given here is insufficient to check whether \ the pointer cast is valid", ); if unknown_cast_to { diff --git a/src/test/ui/anon-params-deprecated.stderr b/src/test/ui/anon-params-deprecated.stderr index e97dbc15f9cde..8e4fa70d342f2 100644 --- a/src/test/ui/anon-params-deprecated.stderr +++ b/src/test/ui/anon-params-deprecated.stderr @@ -2,7 +2,7 @@ warning: anonymous parameters are deprecated and will be removed in the next edi --> $DIR/anon-params-deprecated.rs:9:12 | LL | fn foo(i32); - | ^^^ help: Try naming the parameter or explicitly ignoring it: `_: i32` + | ^^^ help: try naming the parameter or explicitly ignoring it: `_: i32` | note: lint level defined here --> $DIR/anon-params-deprecated.rs:1:9 @@ -16,7 +16,7 @@ warning: anonymous parameters are deprecated and will be removed in the next edi --> $DIR/anon-params-deprecated.rs:12:30 | LL | fn bar_with_default_impl(String, String) {} - | ^^^^^^ help: Try naming the parameter or explicitly ignoring it: `_: String` + | ^^^^^^ help: try naming the parameter or explicitly ignoring it: `_: String` | = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in the 2018 edition! = note: for more information, see issue #41686 @@ -25,7 +25,7 @@ warning: anonymous parameters are deprecated and will be removed in the next edi --> $DIR/anon-params-deprecated.rs:12:38 | LL | fn bar_with_default_impl(String, String) {} - | ^^^^^^ help: Try naming the parameter or explicitly ignoring it: `_: String` + | ^^^^^^ help: try naming the parameter or explicitly ignoring it: `_: String` | = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in the 2018 edition! = note: for more information, see issue #41686 diff --git a/src/test/ui/consts/const-eval/validate_uninhabited_zsts.stderr b/src/test/ui/consts/const-eval/validate_uninhabited_zsts.stderr index bde7f2536fac1..040c568beb324 100644 --- a/src/test/ui/consts/const-eval/validate_uninhabited_zsts.stderr +++ b/src/test/ui/consts/const-eval/validate_uninhabited_zsts.stderr @@ -34,7 +34,7 @@ LL | unsafe { std::mem::transmute(()) } | help: use `MaybeUninit` instead, and only call `assume_init` after initialization is done | = note: `#[warn(invalid_value)]` on by default - = note: The never type (`!`) has no valid value + = note: the `!` type has no valid value warning: the type `Empty` does not permit zero-initialization --> $DIR/validate_uninhabited_zsts.rs:17:35 diff --git a/src/test/ui/feature-gates/feature-gate-never_type.stderr b/src/test/ui/feature-gates/feature-gate-never_type.stderr index d86ab99b82bd5..216615731e56f 100644 --- a/src/test/ui/feature-gates/feature-gate-never_type.stderr +++ b/src/test/ui/feature-gates/feature-gate-never_type.stderr @@ -1,4 +1,4 @@ -error[E0658]: The `!` type is experimental +error[E0658]: the `!` type is experimental --> $DIR/feature-gate-never_type.rs:7:17 | LL | type Ma = (u32, !, i32); @@ -7,7 +7,7 @@ LL | type Ma = (u32, !, i32); = note: for more information, see https://github.com/rust-lang/rust/issues/35121 = help: add `#![feature(never_type)]` to the crate attributes to enable -error[E0658]: The `!` type is experimental +error[E0658]: the `!` type is experimental --> $DIR/feature-gate-never_type.rs:8:20 | LL | type Meeshka = Vec; @@ -16,7 +16,7 @@ LL | type Meeshka = Vec; = note: for more information, see https://github.com/rust-lang/rust/issues/35121 = help: add `#![feature(never_type)]` to the crate attributes to enable -error[E0658]: The `!` type is experimental +error[E0658]: the `!` type is experimental --> $DIR/feature-gate-never_type.rs:9:24 | LL | type Mow = &'static fn(!) -> !; @@ -25,7 +25,7 @@ LL | type Mow = &'static fn(!) -> !; = note: for more information, see https://github.com/rust-lang/rust/issues/35121 = help: add `#![feature(never_type)]` to the crate attributes to enable -error[E0658]: The `!` type is experimental +error[E0658]: the `!` type is experimental --> $DIR/feature-gate-never_type.rs:10:27 | LL | type Skwoz = &'static mut !; @@ -34,7 +34,7 @@ LL | type Skwoz = &'static mut !; = note: for more information, see https://github.com/rust-lang/rust/issues/35121 = help: add `#![feature(never_type)]` to the crate attributes to enable -error[E0658]: The `!` type is experimental +error[E0658]: the `!` type is experimental --> $DIR/feature-gate-never_type.rs:13:16 | LL | type Wub = !; diff --git a/src/test/ui/future-incompatible-lint-group.stderr b/src/test/ui/future-incompatible-lint-group.stderr index 24e3a077ae6e3..1d958e5bfeb40 100644 --- a/src/test/ui/future-incompatible-lint-group.stderr +++ b/src/test/ui/future-incompatible-lint-group.stderr @@ -2,7 +2,7 @@ error: anonymous parameters are deprecated and will be removed in the next editi --> $DIR/future-incompatible-lint-group.rs:4:10 | LL | fn f(u8) {} - | ^^ help: Try naming the parameter or explicitly ignoring it: `_: u8` + | ^^ help: try naming the parameter or explicitly ignoring it: `_: u8` | note: lint level defined here --> $DIR/future-incompatible-lint-group.rs:1:9 diff --git a/src/test/ui/issues/issue-45730.stderr b/src/test/ui/issues/issue-45730.stderr index 3c400d6eefaa8..d4ddba52df14a 100644 --- a/src/test/ui/issues/issue-45730.stderr +++ b/src/test/ui/issues/issue-45730.stderr @@ -6,7 +6,7 @@ LL | let x: *const _ = 0 as _; | | | help: consider giving more type information | - = note: The type information given here is insufficient to check whether the pointer cast is valid + = note: the type information given here is insufficient to check whether the pointer cast is valid error[E0641]: cannot cast to a pointer of an unknown kind --> $DIR/issue-45730.rs:5:23 @@ -16,7 +16,7 @@ LL | let x: *const _ = 0 as *const _; | | | help: consider giving more type information | - = note: The type information given here is insufficient to check whether the pointer cast is valid + = note: the type information given here is insufficient to check whether the pointer cast is valid error[E0641]: cannot cast to a pointer of an unknown kind --> $DIR/issue-45730.rs:8:13 @@ -26,7 +26,7 @@ LL | let x = 0 as *const i32 as *const _ as *mut _; | | | help: consider giving more type information | - = note: The type information given here is insufficient to check whether the pointer cast is valid + = note: the type information given here is insufficient to check whether the pointer cast is valid error: aborting due to 3 previous errors diff --git a/src/test/ui/lint/uninitialized-zeroed.stderr b/src/test/ui/lint/uninitialized-zeroed.stderr index bdb5959953f50..d451b827598f4 100644 --- a/src/test/ui/lint/uninitialized-zeroed.stderr +++ b/src/test/ui/lint/uninitialized-zeroed.stderr @@ -12,7 +12,7 @@ note: lint level defined here | LL | #![deny(invalid_value)] | ^^^^^^^^^^^^^ - = note: References must be non-null + = note: references must be non-null error: the type `&'static T` does not permit being left uninitialized --> $DIR/uninitialized-zeroed.rs:30:32 @@ -23,7 +23,7 @@ LL | let _val: &'static T = mem::uninitialized(); | this code causes undefined behavior when executed | help: use `MaybeUninit` instead, and only call `assume_init` after initialization is done | - = note: References must be non-null + = note: references must be non-null error: the type `Wrap<&'static T>` does not permit zero-initialization --> $DIR/uninitialized-zeroed.rs:32:38 @@ -34,7 +34,7 @@ LL | let _val: Wrap<&'static T> = mem::zeroed(); | this code causes undefined behavior when executed | help: use `MaybeUninit` instead, and only call `assume_init` after initialization is done | -note: References must be non-null (in this struct field) +note: references must be non-null (in this struct field) --> $DIR/uninitialized-zeroed.rs:18:18 | LL | struct Wrap { wrapped: T } @@ -49,7 +49,7 @@ LL | let _val: Wrap<&'static T> = mem::uninitialized(); | this code causes undefined behavior when executed | help: use `MaybeUninit` instead, and only call `assume_init` after initialization is done | -note: References must be non-null (in this struct field) +note: references must be non-null (in this struct field) --> $DIR/uninitialized-zeroed.rs:18:18 | LL | struct Wrap { wrapped: T } @@ -64,7 +64,7 @@ LL | let _val: ! = mem::zeroed(); | this code causes undefined behavior when executed | help: use `MaybeUninit` instead, and only call `assume_init` after initialization is done | - = note: The never type (`!`) has no valid value + = note: the `!` type has no valid value error: the type `!` does not permit being left uninitialized --> $DIR/uninitialized-zeroed.rs:41:23 @@ -75,7 +75,7 @@ LL | let _val: ! = mem::uninitialized(); | this code causes undefined behavior when executed | help: use `MaybeUninit` instead, and only call `assume_init` after initialization is done | - = note: The never type (`!`) has no valid value + = note: the `!` type has no valid value error: the type `(i32, !)` does not permit zero-initialization --> $DIR/uninitialized-zeroed.rs:43:30 @@ -86,7 +86,7 @@ LL | let _val: (i32, !) = mem::zeroed(); | this code causes undefined behavior when executed | help: use `MaybeUninit` instead, and only call `assume_init` after initialization is done | - = note: The never type (`!`) has no valid value + = note: the `!` type has no valid value error: the type `(i32, !)` does not permit being left uninitialized --> $DIR/uninitialized-zeroed.rs:44:30 @@ -97,7 +97,7 @@ LL | let _val: (i32, !) = mem::uninitialized(); | this code causes undefined behavior when executed | help: use `MaybeUninit` instead, and only call `assume_init` after initialization is done | - = note: The never type (`!`) has no valid value + = note: the `!` type has no valid value error: the type `Void` does not permit zero-initialization --> $DIR/uninitialized-zeroed.rs:46:26 @@ -130,7 +130,7 @@ LL | let _val: &'static i32 = mem::zeroed(); | this code causes undefined behavior when executed | help: use `MaybeUninit` instead, and only call `assume_init` after initialization is done | - = note: References must be non-null + = note: references must be non-null error: the type `&'static i32` does not permit being left uninitialized --> $DIR/uninitialized-zeroed.rs:50:34 @@ -141,7 +141,7 @@ LL | let _val: &'static i32 = mem::uninitialized(); | this code causes undefined behavior when executed | help: use `MaybeUninit` instead, and only call `assume_init` after initialization is done | - = note: References must be non-null + = note: references must be non-null error: the type `Ref` does not permit zero-initialization --> $DIR/uninitialized-zeroed.rs:52:25 @@ -152,7 +152,7 @@ LL | let _val: Ref = mem::zeroed(); | this code causes undefined behavior when executed | help: use `MaybeUninit` instead, and only call `assume_init` after initialization is done | -note: References must be non-null (in this struct field) +note: references must be non-null (in this struct field) --> $DIR/uninitialized-zeroed.rs:15:12 | LL | struct Ref(&'static i32); @@ -167,7 +167,7 @@ LL | let _val: Ref = mem::uninitialized(); | this code causes undefined behavior when executed | help: use `MaybeUninit` instead, and only call `assume_init` after initialization is done | -note: References must be non-null (in this struct field) +note: references must be non-null (in this struct field) --> $DIR/uninitialized-zeroed.rs:15:12 | LL | struct Ref(&'static i32); @@ -182,7 +182,7 @@ LL | let _val: fn() = mem::zeroed(); | this code causes undefined behavior when executed | help: use `MaybeUninit` instead, and only call `assume_init` after initialization is done | - = note: Function pointers must be non-null + = note: function pointers must be non-null error: the type `fn()` does not permit being left uninitialized --> $DIR/uninitialized-zeroed.rs:56:26 @@ -193,7 +193,7 @@ LL | let _val: fn() = mem::uninitialized(); | this code causes undefined behavior when executed | help: use `MaybeUninit` instead, and only call `assume_init` after initialization is done | - = note: Function pointers must be non-null + = note: function pointers must be non-null error: the type `Wrap` does not permit zero-initialization --> $DIR/uninitialized-zeroed.rs:58:32 @@ -204,7 +204,7 @@ LL | let _val: Wrap = mem::zeroed(); | this code causes undefined behavior when executed | help: use `MaybeUninit` instead, and only call `assume_init` after initialization is done | -note: Function pointers must be non-null (in this struct field) +note: function pointers must be non-null (in this struct field) --> $DIR/uninitialized-zeroed.rs:18:18 | LL | struct Wrap { wrapped: T } @@ -219,7 +219,7 @@ LL | let _val: Wrap = mem::uninitialized(); | this code causes undefined behavior when executed | help: use `MaybeUninit` instead, and only call `assume_init` after initialization is done | -note: Function pointers must be non-null (in this struct field) +note: function pointers must be non-null (in this struct field) --> $DIR/uninitialized-zeroed.rs:18:18 | LL | struct Wrap { wrapped: T } @@ -234,7 +234,7 @@ LL | let _val: WrapEnum = mem::zeroed(); | this code causes undefined behavior when executed | help: use `MaybeUninit` instead, and only call `assume_init` after initialization is done | -note: Function pointers must be non-null (in this enum field) +note: function pointers must be non-null (in this enum field) --> $DIR/uninitialized-zeroed.rs:19:28 | LL | enum WrapEnum { Wrapped(T) } @@ -249,7 +249,7 @@ LL | let _val: WrapEnum = mem::uninitialized(); | this code causes undefined behavior when executed | help: use `MaybeUninit` instead, and only call `assume_init` after initialization is done | -note: Function pointers must be non-null (in this enum field) +note: function pointers must be non-null (in this enum field) --> $DIR/uninitialized-zeroed.rs:19:28 | LL | enum WrapEnum { Wrapped(T) } @@ -264,7 +264,7 @@ LL | let _val: Wrap<(RefPair, i32)> = mem::zeroed(); | this code causes undefined behavior when executed | help: use `MaybeUninit` instead, and only call `assume_init` after initialization is done | -note: References must be non-null (in this struct field) +note: references must be non-null (in this struct field) --> $DIR/uninitialized-zeroed.rs:16:16 | LL | struct RefPair((&'static i32, i32)); @@ -279,7 +279,7 @@ LL | let _val: Wrap<(RefPair, i32)> = mem::uninitialized(); | this code causes undefined behavior when executed | help: use `MaybeUninit` instead, and only call `assume_init` after initialization is done | -note: References must be non-null (in this struct field) +note: references must be non-null (in this struct field) --> $DIR/uninitialized-zeroed.rs:16:16 | LL | struct RefPair((&'static i32, i32)); @@ -316,7 +316,7 @@ LL | let _val: *const dyn Send = mem::zeroed(); | this code causes undefined behavior when executed | help: use `MaybeUninit` instead, and only call `assume_init` after initialization is done | - = note: The vtable of a wide raw pointer must be non-null + = note: the vtable of a wide raw pointer must be non-null error: the type `*const dyn std::marker::Send` does not permit being left uninitialized --> $DIR/uninitialized-zeroed.rs:71:37 @@ -327,7 +327,7 @@ LL | let _val: *const dyn Send = mem::uninitialized(); | this code causes undefined behavior when executed | help: use `MaybeUninit` instead, and only call `assume_init` after initialization is done | - = note: The vtable of a wide raw pointer must be non-null + = note: the vtable of a wide raw pointer must be non-null error: the type `bool` does not permit being left uninitialized --> $DIR/uninitialized-zeroed.rs:75:26 @@ -338,7 +338,7 @@ LL | let _val: bool = mem::uninitialized(); | this code causes undefined behavior when executed | help: use `MaybeUninit` instead, and only call `assume_init` after initialization is done | - = note: Booleans must be `true` or `false` + = note: booleans must be either `true` or `false` error: the type `Wrap` does not permit being left uninitialized --> $DIR/uninitialized-zeroed.rs:78:32 @@ -349,7 +349,7 @@ LL | let _val: Wrap = mem::uninitialized(); | this code causes undefined behavior when executed | help: use `MaybeUninit` instead, and only call `assume_init` after initialization is done | -note: Characters must be a valid unicode codepoint (in this struct field) +note: characters must be a valid Unicode codepoint (in this struct field) --> $DIR/uninitialized-zeroed.rs:18:18 | LL | struct Wrap { wrapped: T } @@ -375,7 +375,7 @@ LL | let _val: &'static i32 = mem::transmute(0usize); | this code causes undefined behavior when executed | help: use `MaybeUninit` instead, and only call `assume_init` after initialization is done | - = note: References must be non-null + = note: references must be non-null error: the type `&'static [i32]` does not permit zero-initialization --> $DIR/uninitialized-zeroed.rs:85:36 @@ -386,7 +386,7 @@ LL | let _val: &'static [i32] = mem::transmute((0usize, 0usize)); | this code causes undefined behavior when executed | help: use `MaybeUninit` instead, and only call `assume_init` after initialization is done | - = note: References must be non-null + = note: references must be non-null error: the type `std::num::NonZeroU32` does not permit zero-initialization --> $DIR/uninitialized-zeroed.rs:86:32 @@ -430,7 +430,7 @@ LL | let _val: bool = MaybeUninit::uninit().assume_init(); | this code causes undefined behavior when executed | help: use `MaybeUninit` instead, and only call `assume_init` after initialization is done | - = note: Booleans must be `true` or `false` + = note: booleans must be either `true` or `false` error: aborting due to 35 previous errors diff --git a/src/test/ui/nll/closure-requirements/escape-argument-callee.stderr b/src/test/ui/nll/closure-requirements/escape-argument-callee.stderr index 3d79ff0b706f5..b4e18c229fdfd 100644 --- a/src/test/ui/nll/closure-requirements/escape-argument-callee.stderr +++ b/src/test/ui/nll/closure-requirements/escape-argument-callee.stderr @@ -1,4 +1,4 @@ -note: No external requirements +note: no external requirements --> $DIR/escape-argument-callee.rs:26:38 | LL | let mut closure = expect_sig(|p, y| *p = y); @@ -18,7 +18,7 @@ LL | let mut closure = expect_sig(|p, y| *p = y); | | has type `&'1 i32` | has type `&'_#2r mut &'2 i32` -note: No external requirements +note: no external requirements --> $DIR/escape-argument-callee.rs:20:1 | LL | / fn test() { diff --git a/src/test/ui/nll/closure-requirements/escape-argument.stderr b/src/test/ui/nll/closure-requirements/escape-argument.stderr index 37f04af6378d9..533a17bdd128b 100644 --- a/src/test/ui/nll/closure-requirements/escape-argument.stderr +++ b/src/test/ui/nll/closure-requirements/escape-argument.stderr @@ -1,4 +1,4 @@ -note: No external requirements +note: no external requirements --> $DIR/escape-argument.rs:26:38 | LL | let mut closure = expect_sig(|p, y| *p = y); @@ -9,7 +9,7 @@ LL | let mut closure = expect_sig(|p, y| *p = y); for<'r, 's> extern "rust-call" fn((&ReLateBound(DebruijnIndex(0), BrNamed('r)) mut &ReLateBound(DebruijnIndex(0), BrNamed('s)) i32, &ReLateBound(DebruijnIndex(0), BrNamed('s)) i32)), ] -note: No external requirements +note: no external requirements --> $DIR/escape-argument.rs:20:1 | LL | / fn test() { diff --git a/src/test/ui/nll/closure-requirements/escape-upvar-nested.stderr b/src/test/ui/nll/closure-requirements/escape-upvar-nested.stderr index 810c0286cf218..60d02066e2676 100644 --- a/src/test/ui/nll/closure-requirements/escape-upvar-nested.stderr +++ b/src/test/ui/nll/closure-requirements/escape-upvar-nested.stderr @@ -1,4 +1,4 @@ -note: External requirements +note: external requirements --> $DIR/escape-upvar-nested.rs:21:32 | LL | let mut closure1 = || p = &y; @@ -13,7 +13,7 @@ LL | let mut closure1 = || p = &y; = note: number of external vids: 4 = note: where '_#1r: '_#3r -note: External requirements +note: external requirements --> $DIR/escape-upvar-nested.rs:20:27 | LL | let mut closure = || { @@ -32,7 +32,7 @@ LL | | }; = note: number of external vids: 4 = note: where '_#1r: '_#3r -note: No external requirements +note: no external requirements --> $DIR/escape-upvar-nested.rs:13:1 | LL | / fn test() { diff --git a/src/test/ui/nll/closure-requirements/escape-upvar-ref.stderr b/src/test/ui/nll/closure-requirements/escape-upvar-ref.stderr index bf042769a00e2..f64ccf14ac482 100644 --- a/src/test/ui/nll/closure-requirements/escape-upvar-ref.stderr +++ b/src/test/ui/nll/closure-requirements/escape-upvar-ref.stderr @@ -1,4 +1,4 @@ -note: External requirements +note: external requirements --> $DIR/escape-upvar-ref.rs:23:27 | LL | let mut closure = || p = &y; @@ -13,7 +13,7 @@ LL | let mut closure = || p = &y; = note: number of external vids: 4 = note: where '_#1r: '_#3r -note: No external requirements +note: no external requirements --> $DIR/escape-upvar-ref.rs:17:1 | LL | / fn test() { diff --git a/src/test/ui/nll/closure-requirements/propagate-approximated-fail-no-postdom.stderr b/src/test/ui/nll/closure-requirements/propagate-approximated-fail-no-postdom.stderr index 4e3aa352fffdb..e1e0cdc153a6c 100644 --- a/src/test/ui/nll/closure-requirements/propagate-approximated-fail-no-postdom.stderr +++ b/src/test/ui/nll/closure-requirements/propagate-approximated-fail-no-postdom.stderr @@ -1,4 +1,4 @@ -note: No external requirements +note: no external requirements --> $DIR/propagate-approximated-fail-no-postdom.rs:43:9 | LL | / |_outlives1, _outlives2, _outlives3, x, y| { @@ -27,7 +27,7 @@ LL | |_outlives1, _outlives2, _outlives3, x, y| { LL | demand_y(x, y, p) | ^^^^^^^^^^^^^^^^^ argument requires that `'1` must outlive `'2` -note: No external requirements +note: no external requirements --> $DIR/propagate-approximated-fail-no-postdom.rs:38:1 | LL | / fn supply<'a, 'b, 'c>(cell_a: Cell<&'a u32>, cell_b: Cell<&'b u32>, cell_c: Cell<&'c u32>) { diff --git a/src/test/ui/nll/closure-requirements/propagate-approximated-ref.stderr b/src/test/ui/nll/closure-requirements/propagate-approximated-ref.stderr index cd61b8b5e555e..b6535024a4a76 100644 --- a/src/test/ui/nll/closure-requirements/propagate-approximated-ref.stderr +++ b/src/test/ui/nll/closure-requirements/propagate-approximated-ref.stderr @@ -1,4 +1,4 @@ -note: External requirements +note: external requirements --> $DIR/propagate-approximated-ref.rs:43:47 | LL | establish_relationships(&cell_a, &cell_b, |_outlives1, _outlives2, x, y| { @@ -18,7 +18,7 @@ LL | | }); = note: number of external vids: 5 = note: where '_#1r: '_#2r -note: No external requirements +note: no external requirements --> $DIR/propagate-approximated-ref.rs:42:1 | LL | / fn supply<'a, 'b>(cell_a: Cell<&'a u32>, cell_b: Cell<&'b u32>) { diff --git a/src/test/ui/nll/closure-requirements/propagate-approximated-shorter-to-static-comparing-against-free.stderr b/src/test/ui/nll/closure-requirements/propagate-approximated-shorter-to-static-comparing-against-free.stderr index 259140c2e5a3d..708e50de570db 100644 --- a/src/test/ui/nll/closure-requirements/propagate-approximated-shorter-to-static-comparing-against-free.stderr +++ b/src/test/ui/nll/closure-requirements/propagate-approximated-shorter-to-static-comparing-against-free.stderr @@ -1,4 +1,4 @@ -note: No external requirements +note: no external requirements --> $DIR/propagate-approximated-shorter-to-static-comparing-against-free.rs:21:15 | LL | foo(cell, |cell_a, cell_x| { @@ -23,7 +23,7 @@ LL | foo(cell, |cell_a, cell_x| { LL | cell_a.set(cell_x.get()); // forces 'x: 'a, error in closure | ^^^^^^^^^^^^^^^^^^^^^^^^ `cell_x` escapes the closure body here -note: No external requirements +note: no external requirements --> $DIR/propagate-approximated-shorter-to-static-comparing-against-free.rs:18:1 | LL | / fn case1() { @@ -37,7 +37,7 @@ LL | | } | = note: defining type: case1 -note: External requirements +note: external requirements --> $DIR/propagate-approximated-shorter-to-static-comparing-against-free.rs:35:15 | LL | foo(cell, |cell_a, cell_x| { @@ -53,7 +53,7 @@ LL | | }) = note: number of external vids: 2 = note: where '_#1r: '_#0r -note: No external requirements +note: no external requirements --> $DIR/propagate-approximated-shorter-to-static-comparing-against-free.rs:28:1 | LL | / fn case2() { diff --git a/src/test/ui/nll/closure-requirements/propagate-approximated-shorter-to-static-no-bound.stderr b/src/test/ui/nll/closure-requirements/propagate-approximated-shorter-to-static-no-bound.stderr index b3dd682e4f0b7..17d33e82ba7e3 100644 --- a/src/test/ui/nll/closure-requirements/propagate-approximated-shorter-to-static-no-bound.stderr +++ b/src/test/ui/nll/closure-requirements/propagate-approximated-shorter-to-static-no-bound.stderr @@ -1,4 +1,4 @@ -note: External requirements +note: external requirements --> $DIR/propagate-approximated-shorter-to-static-no-bound.rs:32:47 | LL | establish_relationships(&cell_a, &cell_b, |_outlives, x, y| { @@ -19,7 +19,7 @@ LL | | }); = note: number of external vids: 4 = note: where '_#1r: '_#0r -note: No external requirements +note: no external requirements --> $DIR/propagate-approximated-shorter-to-static-no-bound.rs:31:1 | LL | / fn supply<'a, 'b>(cell_a: Cell<&'a u32>, cell_b: Cell<&'b u32>) { diff --git a/src/test/ui/nll/closure-requirements/propagate-approximated-shorter-to-static-wrong-bound.stderr b/src/test/ui/nll/closure-requirements/propagate-approximated-shorter-to-static-wrong-bound.stderr index ab12d08f7b74e..5dce8d087d6cd 100644 --- a/src/test/ui/nll/closure-requirements/propagate-approximated-shorter-to-static-wrong-bound.stderr +++ b/src/test/ui/nll/closure-requirements/propagate-approximated-shorter-to-static-wrong-bound.stderr @@ -1,4 +1,4 @@ -note: External requirements +note: external requirements --> $DIR/propagate-approximated-shorter-to-static-wrong-bound.rs:35:47 | LL | establish_relationships(&cell_a, &cell_b, |_outlives1, _outlives2, x, y| { @@ -19,7 +19,7 @@ LL | | }); = note: number of external vids: 5 = note: where '_#1r: '_#0r -note: No external requirements +note: no external requirements --> $DIR/propagate-approximated-shorter-to-static-wrong-bound.rs:34:1 | LL | / fn supply<'a, 'b>(cell_a: Cell<&'a u32>, cell_b: Cell<&'b u32>) { diff --git a/src/test/ui/nll/closure-requirements/propagate-approximated-val.stderr b/src/test/ui/nll/closure-requirements/propagate-approximated-val.stderr index b2209e9cab0c9..5c5d510805bdf 100644 --- a/src/test/ui/nll/closure-requirements/propagate-approximated-val.stderr +++ b/src/test/ui/nll/closure-requirements/propagate-approximated-val.stderr @@ -1,4 +1,4 @@ -note: External requirements +note: external requirements --> $DIR/propagate-approximated-val.rs:36:45 | LL | establish_relationships(cell_a, cell_b, |outlives1, outlives2, x, y| { @@ -18,7 +18,7 @@ LL | | }); = note: number of external vids: 5 = note: where '_#1r: '_#2r -note: No external requirements +note: no external requirements --> $DIR/propagate-approximated-val.rs:35:1 | LL | / fn test<'a, 'b>(cell_a: Cell<&'a u32>, cell_b: Cell<&'b u32>) { diff --git a/src/test/ui/nll/closure-requirements/propagate-despite-same-free-region.stderr b/src/test/ui/nll/closure-requirements/propagate-despite-same-free-region.stderr index 55ee515a3a821..c111e651832ba 100644 --- a/src/test/ui/nll/closure-requirements/propagate-despite-same-free-region.stderr +++ b/src/test/ui/nll/closure-requirements/propagate-despite-same-free-region.stderr @@ -1,4 +1,4 @@ -note: External requirements +note: external requirements --> $DIR/propagate-despite-same-free-region.rs:42:9 | LL | / |_outlives1, _outlives2, x, y| { @@ -16,7 +16,7 @@ LL | | }, = note: number of external vids: 4 = note: where '_#1r: '_#2r -note: No external requirements +note: no external requirements --> $DIR/propagate-despite-same-free-region.rs:39:1 | LL | / fn supply<'a>(cell_a: Cell<&'a u32>) { diff --git a/src/test/ui/nll/closure-requirements/propagate-fail-to-approximate-longer-no-bounds.stderr b/src/test/ui/nll/closure-requirements/propagate-fail-to-approximate-longer-no-bounds.stderr index 1c29af8c42210..52df46ed3453f 100644 --- a/src/test/ui/nll/closure-requirements/propagate-fail-to-approximate-longer-no-bounds.stderr +++ b/src/test/ui/nll/closure-requirements/propagate-fail-to-approximate-longer-no-bounds.stderr @@ -1,4 +1,4 @@ -note: No external requirements +note: no external requirements --> $DIR/propagate-fail-to-approximate-longer-no-bounds.rs:35:47 | LL | establish_relationships(&cell_a, &cell_b, |_outlives, x, y| { @@ -27,7 +27,7 @@ LL | // Only works if 'x: 'y: LL | demand_y(x, y, x.get()) | ^^^^^^^^^^^^^^^^^^^^^^^ argument requires that `'1` must outlive `'2` -note: No external requirements +note: no external requirements --> $DIR/propagate-fail-to-approximate-longer-no-bounds.rs:34:1 | LL | / fn supply<'a, 'b>(cell_a: Cell<&'a u32>, cell_b: Cell<&'b u32>) { diff --git a/src/test/ui/nll/closure-requirements/propagate-fail-to-approximate-longer-wrong-bounds.stderr b/src/test/ui/nll/closure-requirements/propagate-fail-to-approximate-longer-wrong-bounds.stderr index afa0e9f619ddc..0270cc40de6fc 100644 --- a/src/test/ui/nll/closure-requirements/propagate-fail-to-approximate-longer-wrong-bounds.stderr +++ b/src/test/ui/nll/closure-requirements/propagate-fail-to-approximate-longer-wrong-bounds.stderr @@ -1,4 +1,4 @@ -note: No external requirements +note: no external requirements --> $DIR/propagate-fail-to-approximate-longer-wrong-bounds.rs:39:47 | LL | establish_relationships(&cell_a, &cell_b, |_outlives1, _outlives2, x, y| { @@ -27,7 +27,7 @@ LL | // Only works if 'x: 'y: LL | demand_y(x, y, x.get()) | ^^^^^^^^^^^^^^^^^^^^^^^ argument requires that `'1` must outlive `'2` -note: No external requirements +note: no external requirements --> $DIR/propagate-fail-to-approximate-longer-wrong-bounds.rs:38:1 | LL | / fn supply<'a, 'b>(cell_a: Cell<&'a u32>, cell_b: Cell<&'b u32>) { diff --git a/src/test/ui/nll/closure-requirements/propagate-from-trait-match.stderr b/src/test/ui/nll/closure-requirements/propagate-from-trait-match.stderr index 0dbb530e698bb..5317bb6a1b13e 100644 --- a/src/test/ui/nll/closure-requirements/propagate-from-trait-match.stderr +++ b/src/test/ui/nll/closure-requirements/propagate-from-trait-match.stderr @@ -1,4 +1,4 @@ -note: External requirements +note: external requirements --> $DIR/propagate-from-trait-match.rs:32:36 | LL | establish_relationships(value, |value| { @@ -18,7 +18,7 @@ LL | | }); = note: number of external vids: 2 = note: where T: '_#1r -note: No external requirements +note: no external requirements --> $DIR/propagate-from-trait-match.rs:28:1 | LL | / fn supply<'a, T>(value: T) diff --git a/src/test/ui/nll/closure-requirements/return-wrong-bound-region.stderr b/src/test/ui/nll/closure-requirements/return-wrong-bound-region.stderr index ca794d92666f2..79ed1501524bd 100644 --- a/src/test/ui/nll/closure-requirements/return-wrong-bound-region.stderr +++ b/src/test/ui/nll/closure-requirements/return-wrong-bound-region.stderr @@ -1,4 +1,4 @@ -note: No external requirements +note: no external requirements --> $DIR/return-wrong-bound-region.rs:11:16 | LL | expect_sig(|a, b| b); // ought to return `a` @@ -18,7 +18,7 @@ LL | expect_sig(|a, b| b); // ought to return `a` | | has type `&'1 i32` | has type `&'2 i32` -note: No external requirements +note: no external requirements --> $DIR/return-wrong-bound-region.rs:10:1 | LL | / fn test() { diff --git a/src/test/ui/nll/ty-outlives/projection-no-regions-closure.stderr b/src/test/ui/nll/ty-outlives/projection-no-regions-closure.stderr index c825227cdad8e..bff8c662d0def 100644 --- a/src/test/ui/nll/ty-outlives/projection-no-regions-closure.stderr +++ b/src/test/ui/nll/ty-outlives/projection-no-regions-closure.stderr @@ -1,4 +1,4 @@ -note: External requirements +note: external requirements --> $DIR/projection-no-regions-closure.rs:25:23 | LL | with_signature(x, |mut y| Box::new(y.next())) @@ -11,7 +11,7 @@ LL | with_signature(x, |mut y| Box::new(y.next())) = note: number of external vids: 3 = note: where ::Item: '_#2r -note: No external requirements +note: no external requirements --> $DIR/projection-no-regions-closure.rs:21:1 | LL | / fn no_region<'a, T>(x: Box) -> Box @@ -33,7 +33,7 @@ LL | with_signature(x, |mut y| Box::new(y.next())) | = help: consider adding an explicit lifetime bound `::Item: ReEarlyBound(0, 'a)`... -note: External requirements +note: external requirements --> $DIR/projection-no-regions-closure.rs:34:23 | LL | with_signature(x, |mut y| Box::new(y.next())) @@ -46,7 +46,7 @@ LL | with_signature(x, |mut y| Box::new(y.next())) = note: number of external vids: 3 = note: where ::Item: '_#2r -note: No external requirements +note: no external requirements --> $DIR/projection-no-regions-closure.rs:30:1 | LL | / fn correct_region<'a, T>(x: Box) -> Box @@ -59,7 +59,7 @@ LL | | } | = note: defining type: correct_region::<'_#1r, T> -note: External requirements +note: external requirements --> $DIR/projection-no-regions-closure.rs:42:23 | LL | with_signature(x, |mut y| Box::new(y.next())) @@ -72,7 +72,7 @@ LL | with_signature(x, |mut y| Box::new(y.next())) = note: number of external vids: 4 = note: where ::Item: '_#3r -note: No external requirements +note: no external requirements --> $DIR/projection-no-regions-closure.rs:38:1 | LL | / fn wrong_region<'a, 'b, T>(x: Box) -> Box @@ -94,7 +94,7 @@ LL | with_signature(x, |mut y| Box::new(y.next())) | = help: consider adding an explicit lifetime bound `::Item: ReEarlyBound(0, 'a)`... -note: External requirements +note: external requirements --> $DIR/projection-no-regions-closure.rs:52:23 | LL | with_signature(x, |mut y| Box::new(y.next())) @@ -107,7 +107,7 @@ LL | with_signature(x, |mut y| Box::new(y.next())) = note: number of external vids: 4 = note: where ::Item: '_#3r -note: No external requirements +note: no external requirements --> $DIR/projection-no-regions-closure.rs:47:1 | LL | / fn outlives_region<'a, 'b, T>(x: Box) -> Box diff --git a/src/test/ui/nll/ty-outlives/projection-one-region-closure.stderr b/src/test/ui/nll/ty-outlives/projection-one-region-closure.stderr index 7226c520bf138..6d1fbcb8f5bfd 100644 --- a/src/test/ui/nll/ty-outlives/projection-one-region-closure.stderr +++ b/src/test/ui/nll/ty-outlives/projection-one-region-closure.stderr @@ -1,4 +1,4 @@ -note: External requirements +note: external requirements --> $DIR/projection-one-region-closure.rs:45:29 | LL | with_signature(cell, t, |cell, t| require(cell, t)); @@ -13,7 +13,7 @@ LL | with_signature(cell, t, |cell, t| require(cell, t)); = note: where T: '_#2r = note: where '_#1r: '_#2r -note: No external requirements +note: no external requirements --> $DIR/projection-one-region-closure.rs:41:1 | LL | / fn no_relationships_late<'a, 'b, T>(cell: Cell<&'a ()>, t: T) @@ -48,7 +48,7 @@ LL | with_signature(cell, t, |cell, t| require(cell, t)); | = help: consider adding the following bound: `'b: 'a` -note: External requirements +note: external requirements --> $DIR/projection-one-region-closure.rs:56:29 | LL | with_signature(cell, t, |cell, t| require(cell, t)); @@ -62,7 +62,7 @@ LL | with_signature(cell, t, |cell, t| require(cell, t)); = note: where T: '_#3r = note: where '_#2r: '_#3r -note: No external requirements +note: no external requirements --> $DIR/projection-one-region-closure.rs:51:1 | LL | / fn no_relationships_early<'a, 'b, T>(cell: Cell<&'a ()>, t: T) @@ -97,7 +97,7 @@ LL | with_signature(cell, t, |cell, t| require(cell, t)); | = help: consider adding the following bound: `'b: 'a` -note: External requirements +note: external requirements --> $DIR/projection-one-region-closure.rs:70:29 | LL | with_signature(cell, t, |cell, t| require(cell, t)); @@ -110,7 +110,7 @@ LL | with_signature(cell, t, |cell, t| require(cell, t)); = note: number of external vids: 4 = note: where >::AssocType: '_#3r -note: No external requirements +note: no external requirements --> $DIR/projection-one-region-closure.rs:62:1 | LL | / fn projection_outlives<'a, 'b, T>(cell: Cell<&'a ()>, t: T) @@ -124,7 +124,7 @@ LL | | } | = note: defining type: projection_outlives::<'_#1r, '_#2r, T> -note: External requirements +note: external requirements --> $DIR/projection-one-region-closure.rs:80:29 | LL | with_signature(cell, t, |cell, t| require(cell, t)); @@ -138,7 +138,7 @@ LL | with_signature(cell, t, |cell, t| require(cell, t)); = note: where T: '_#3r = note: where '_#2r: '_#3r -note: No external requirements +note: no external requirements --> $DIR/projection-one-region-closure.rs:74:1 | LL | / fn elements_outlive<'a, 'b, T>(cell: Cell<&'a ()>, t: T) diff --git a/src/test/ui/nll/ty-outlives/projection-one-region-trait-bound-closure.stderr b/src/test/ui/nll/ty-outlives/projection-one-region-trait-bound-closure.stderr index 655995c1b8029..59d8aa484bdac 100644 --- a/src/test/ui/nll/ty-outlives/projection-one-region-trait-bound-closure.stderr +++ b/src/test/ui/nll/ty-outlives/projection-one-region-trait-bound-closure.stderr @@ -1,4 +1,4 @@ -note: External requirements +note: external requirements --> $DIR/projection-one-region-trait-bound-closure.rs:37:29 | LL | with_signature(cell, t, |cell, t| require(cell, t)); @@ -12,7 +12,7 @@ LL | with_signature(cell, t, |cell, t| require(cell, t)); = note: number of external vids: 4 = note: where '_#1r: '_#2r -note: No external requirements +note: no external requirements --> $DIR/projection-one-region-trait-bound-closure.rs:33:1 | LL | / fn no_relationships_late<'a, 'b, T>(cell: Cell<&'a ()>, t: T) @@ -39,7 +39,7 @@ LL | with_signature(cell, t, |cell, t| require(cell, t)); | = help: consider adding the following bound: `'b: 'a` -note: External requirements +note: external requirements --> $DIR/projection-one-region-trait-bound-closure.rs:47:29 | LL | with_signature(cell, t, |cell, t| require(cell, t)); @@ -52,7 +52,7 @@ LL | with_signature(cell, t, |cell, t| require(cell, t)); = note: number of external vids: 4 = note: where '_#2r: '_#3r -note: No external requirements +note: no external requirements --> $DIR/projection-one-region-trait-bound-closure.rs:42:1 | LL | / fn no_relationships_early<'a, 'b, T>(cell: Cell<&'a ()>, t: T) @@ -79,7 +79,7 @@ LL | with_signature(cell, t, |cell, t| require(cell, t)); | = help: consider adding the following bound: `'b: 'a` -note: External requirements +note: external requirements --> $DIR/projection-one-region-trait-bound-closure.rs:60:29 | LL | with_signature(cell, t, |cell, t| require(cell, t)); @@ -92,7 +92,7 @@ LL | with_signature(cell, t, |cell, t| require(cell, t)); = note: number of external vids: 4 = note: where >::AssocType: '_#3r -note: No external requirements +note: no external requirements --> $DIR/projection-one-region-trait-bound-closure.rs:52:1 | LL | / fn projection_outlives<'a, 'b, T>(cell: Cell<&'a ()>, t: T) @@ -106,7 +106,7 @@ LL | | } | = note: defining type: projection_outlives::<'_#1r, '_#2r, T> -note: External requirements +note: external requirements --> $DIR/projection-one-region-trait-bound-closure.rs:69:29 | LL | with_signature(cell, t, |cell, t| require(cell, t)); @@ -119,7 +119,7 @@ LL | with_signature(cell, t, |cell, t| require(cell, t)); = note: number of external vids: 4 = note: where '_#2r: '_#3r -note: No external requirements +note: no external requirements --> $DIR/projection-one-region-trait-bound-closure.rs:64:1 | LL | / fn elements_outlive<'a, 'b, T>(cell: Cell<&'a ()>, t: T) @@ -133,7 +133,7 @@ LL | | } | = note: defining type: elements_outlive::<'_#1r, '_#2r, T> -note: External requirements +note: external requirements --> $DIR/projection-one-region-trait-bound-closure.rs:81:29 | LL | with_signature(cell, t, |cell, t| require(cell, t)); @@ -146,7 +146,7 @@ LL | with_signature(cell, t, |cell, t| require(cell, t)); = note: number of external vids: 3 = note: where '_#1r: '_#2r -note: No external requirements +note: no external requirements --> $DIR/projection-one-region-trait-bound-closure.rs:73:1 | LL | / fn one_region<'a, T>(cell: Cell<&'a ()>, t: T) diff --git a/src/test/ui/nll/ty-outlives/projection-one-region-trait-bound-static-closure.stderr b/src/test/ui/nll/ty-outlives/projection-one-region-trait-bound-static-closure.stderr index 2fb07b9279aa8..c3b924577ab47 100644 --- a/src/test/ui/nll/ty-outlives/projection-one-region-trait-bound-static-closure.stderr +++ b/src/test/ui/nll/ty-outlives/projection-one-region-trait-bound-static-closure.stderr @@ -1,4 +1,4 @@ -note: No external requirements +note: no external requirements --> $DIR/projection-one-region-trait-bound-static-closure.rs:36:29 | LL | with_signature(cell, t, |cell, t| require(cell, t)); @@ -10,7 +10,7 @@ LL | with_signature(cell, t, |cell, t| require(cell, t)); ] = note: late-bound region is '_#3r -note: No external requirements +note: no external requirements --> $DIR/projection-one-region-trait-bound-static-closure.rs:32:1 | LL | / fn no_relationships_late<'a, 'b, T>(cell: Cell<&'a ()>, t: T) @@ -23,7 +23,7 @@ LL | | } | = note: defining type: no_relationships_late::<'_#1r, T> -note: No external requirements +note: no external requirements --> $DIR/projection-one-region-trait-bound-static-closure.rs:45:29 | LL | with_signature(cell, t, |cell, t| require(cell, t)); @@ -34,7 +34,7 @@ LL | with_signature(cell, t, |cell, t| require(cell, t)); extern "rust-call" fn((std::cell::Cell<&'_#3r ()>, T)), ] -note: No external requirements +note: no external requirements --> $DIR/projection-one-region-trait-bound-static-closure.rs:40:1 | LL | / fn no_relationships_early<'a, 'b, T>(cell: Cell<&'a ()>, t: T) @@ -48,7 +48,7 @@ LL | | } | = note: defining type: no_relationships_early::<'_#1r, '_#2r, T> -note: No external requirements +note: no external requirements --> $DIR/projection-one-region-trait-bound-static-closure.rs:64:29 | LL | with_signature(cell, t, |cell, t| require(cell, t)); @@ -59,7 +59,7 @@ LL | with_signature(cell, t, |cell, t| require(cell, t)); extern "rust-call" fn((std::cell::Cell<&'_#3r ()>, T)), ] -note: No external requirements +note: no external requirements --> $DIR/projection-one-region-trait-bound-static-closure.rs:49:1 | LL | / fn projection_outlives<'a, 'b, T>(cell: Cell<&'a ()>, t: T) @@ -73,7 +73,7 @@ LL | | } | = note: defining type: projection_outlives::<'_#1r, '_#2r, T> -note: No external requirements +note: no external requirements --> $DIR/projection-one-region-trait-bound-static-closure.rs:73:29 | LL | with_signature(cell, t, |cell, t| require(cell, t)); @@ -84,7 +84,7 @@ LL | with_signature(cell, t, |cell, t| require(cell, t)); extern "rust-call" fn((std::cell::Cell<&'_#3r ()>, T)), ] -note: No external requirements +note: no external requirements --> $DIR/projection-one-region-trait-bound-static-closure.rs:68:1 | LL | / fn elements_outlive<'a, 'b, T>(cell: Cell<&'a ()>, t: T) @@ -98,7 +98,7 @@ LL | | } | = note: defining type: elements_outlive::<'_#1r, '_#2r, T> -note: No external requirements +note: no external requirements --> $DIR/projection-one-region-trait-bound-static-closure.rs:85:29 | LL | with_signature(cell, t, |cell, t| require(cell, t)); @@ -109,7 +109,7 @@ LL | with_signature(cell, t, |cell, t| require(cell, t)); extern "rust-call" fn((std::cell::Cell<&'_#2r ()>, T)), ] -note: No external requirements +note: no external requirements --> $DIR/projection-one-region-trait-bound-static-closure.rs:77:1 | LL | / fn one_region<'a, T>(cell: Cell<&'a ()>, t: T) diff --git a/src/test/ui/nll/ty-outlives/projection-two-region-trait-bound-closure.stderr b/src/test/ui/nll/ty-outlives/projection-two-region-trait-bound-closure.stderr index 501a55e3105db..1bd97c1caa4ae 100644 --- a/src/test/ui/nll/ty-outlives/projection-two-region-trait-bound-closure.stderr +++ b/src/test/ui/nll/ty-outlives/projection-two-region-trait-bound-closure.stderr @@ -1,4 +1,4 @@ -note: External requirements +note: external requirements --> $DIR/projection-two-region-trait-bound-closure.rs:38:29 | LL | with_signature(cell, t, |cell, t| require(cell, t)); @@ -12,7 +12,7 @@ LL | with_signature(cell, t, |cell, t| require(cell, t)); = note: number of external vids: 5 = note: where >::AssocType: '_#3r -note: No external requirements +note: no external requirements --> $DIR/projection-two-region-trait-bound-closure.rs:34:1 | LL | / fn no_relationships_late<'a, 'b, 'c, T>(cell: Cell<&'a ()>, t: T) @@ -34,7 +34,7 @@ LL | with_signature(cell, t, |cell, t| require(cell, t)); | = help: consider adding an explicit lifetime bound `>::AssocType: ReFree(DefId(0:17 ~ projection_two_region_trait_bound_closure[317d]::no_relationships_late[0]), BrNamed(DefId(0:18 ~ projection_two_region_trait_bound_closure[317d]::no_relationships_late[0]::'a[0]), 'a))`... -note: External requirements +note: external requirements --> $DIR/projection-two-region-trait-bound-closure.rs:48:29 | LL | with_signature(cell, t, |cell, t| require(cell, t)); @@ -47,7 +47,7 @@ LL | with_signature(cell, t, |cell, t| require(cell, t)); = note: number of external vids: 5 = note: where >::AssocType: '_#4r -note: No external requirements +note: no external requirements --> $DIR/projection-two-region-trait-bound-closure.rs:43:1 | LL | / fn no_relationships_early<'a, 'b, 'c, T>(cell: Cell<&'a ()>, t: T) @@ -69,7 +69,7 @@ LL | with_signature(cell, t, |cell, t| require(cell, t)); | = help: consider adding an explicit lifetime bound `>::AssocType: ReEarlyBound(0, 'a)`... -note: External requirements +note: external requirements --> $DIR/projection-two-region-trait-bound-closure.rs:61:29 | LL | with_signature(cell, t, |cell, t| require(cell, t)); @@ -82,7 +82,7 @@ LL | with_signature(cell, t, |cell, t| require(cell, t)); = note: number of external vids: 5 = note: where >::AssocType: '_#4r -note: No external requirements +note: no external requirements --> $DIR/projection-two-region-trait-bound-closure.rs:53:1 | LL | / fn projection_outlives<'a, 'b, 'c, T>(cell: Cell<&'a ()>, t: T) @@ -96,7 +96,7 @@ LL | | } | = note: defining type: projection_outlives::<'_#1r, '_#2r, '_#3r, T> -note: External requirements +note: external requirements --> $DIR/projection-two-region-trait-bound-closure.rs:70:29 | LL | with_signature(cell, t, |cell, t| require(cell, t)); @@ -109,7 +109,7 @@ LL | with_signature(cell, t, |cell, t| require(cell, t)); = note: number of external vids: 5 = note: where >::AssocType: '_#4r -note: No external requirements +note: no external requirements --> $DIR/projection-two-region-trait-bound-closure.rs:65:1 | LL | / fn elements_outlive1<'a, 'b, 'c, T>(cell: Cell<&'a ()>, t: T) @@ -123,7 +123,7 @@ LL | | } | = note: defining type: elements_outlive1::<'_#1r, '_#2r, '_#3r, T> -note: External requirements +note: external requirements --> $DIR/projection-two-region-trait-bound-closure.rs:79:29 | LL | with_signature(cell, t, |cell, t| require(cell, t)); @@ -136,7 +136,7 @@ LL | with_signature(cell, t, |cell, t| require(cell, t)); = note: number of external vids: 5 = note: where >::AssocType: '_#4r -note: No external requirements +note: no external requirements --> $DIR/projection-two-region-trait-bound-closure.rs:74:1 | LL | / fn elements_outlive2<'a, 'b, 'c, T>(cell: Cell<&'a ()>, t: T) @@ -150,7 +150,7 @@ LL | | } | = note: defining type: elements_outlive2::<'_#1r, '_#2r, '_#3r, T> -note: External requirements +note: external requirements --> $DIR/projection-two-region-trait-bound-closure.rs:87:29 | LL | with_signature(cell, t, |cell, t| require(cell, t)); @@ -164,7 +164,7 @@ LL | with_signature(cell, t, |cell, t| require(cell, t)); = note: number of external vids: 4 = note: where >::AssocType: '_#2r -note: No external requirements +note: no external requirements --> $DIR/projection-two-region-trait-bound-closure.rs:83:1 | LL | / fn two_regions<'a, 'b, T>(cell: Cell<&'a ()>, t: T) @@ -191,7 +191,7 @@ LL | with_signature(cell, t, |cell, t| require(cell, t)); | = help: consider adding the following bound: `'b: 'a` -note: External requirements +note: external requirements --> $DIR/projection-two-region-trait-bound-closure.rs:97:29 | LL | with_signature(cell, t, |cell, t| require(cell, t)); @@ -204,7 +204,7 @@ LL | with_signature(cell, t, |cell, t| require(cell, t)); = note: number of external vids: 4 = note: where >::AssocType: '_#3r -note: No external requirements +note: no external requirements --> $DIR/projection-two-region-trait-bound-closure.rs:92:1 | LL | / fn two_regions_outlive<'a, 'b, T>(cell: Cell<&'a ()>, t: T) @@ -218,7 +218,7 @@ LL | | } | = note: defining type: two_regions_outlive::<'_#1r, '_#2r, T> -note: External requirements +note: external requirements --> $DIR/projection-two-region-trait-bound-closure.rs:109:29 | LL | with_signature(cell, t, |cell, t| require(cell, t)); @@ -231,7 +231,7 @@ LL | with_signature(cell, t, |cell, t| require(cell, t)); = note: number of external vids: 3 = note: where >::AssocType: '_#2r -note: No external requirements +note: no external requirements --> $DIR/projection-two-region-trait-bound-closure.rs:101:1 | LL | / fn one_region<'a, T>(cell: Cell<&'a ()>, t: T) diff --git a/src/test/ui/nll/ty-outlives/ty-param-closure-approximate-lower-bound.stderr b/src/test/ui/nll/ty-outlives/ty-param-closure-approximate-lower-bound.stderr index db0bca1dec6f5..a213f423e3c8d 100644 --- a/src/test/ui/nll/ty-outlives/ty-param-closure-approximate-lower-bound.stderr +++ b/src/test/ui/nll/ty-outlives/ty-param-closure-approximate-lower-bound.stderr @@ -1,4 +1,4 @@ -note: External requirements +note: external requirements --> $DIR/ty-param-closure-approximate-lower-bound.rs:24:24 | LL | twice(cell, value, |a, b| invoke(a, b)); @@ -11,7 +11,7 @@ LL | twice(cell, value, |a, b| invoke(a, b)); = note: number of external vids: 2 = note: where T: '_#1r -note: No external requirements +note: no external requirements --> $DIR/ty-param-closure-approximate-lower-bound.rs:22:1 | LL | / fn generic(value: T) { @@ -22,7 +22,7 @@ LL | | } | = note: defining type: generic:: -note: External requirements +note: external requirements --> $DIR/ty-param-closure-approximate-lower-bound.rs:29:24 | LL | twice(cell, value, |a, b| invoke(a, b)); @@ -36,7 +36,7 @@ LL | twice(cell, value, |a, b| invoke(a, b)); = note: number of external vids: 3 = note: where T: '_#1r -note: No external requirements +note: no external requirements --> $DIR/ty-param-closure-approximate-lower-bound.rs:28:1 | LL | / fn generic_fail<'a, T>(cell: Cell<&'a ()>, value: T) { diff --git a/src/test/ui/nll/ty-outlives/ty-param-closure-outlives-from-return-type.stderr b/src/test/ui/nll/ty-outlives/ty-param-closure-outlives-from-return-type.stderr index 0021d730f85a1..a488637bbc5c2 100644 --- a/src/test/ui/nll/ty-outlives/ty-param-closure-outlives-from-return-type.stderr +++ b/src/test/ui/nll/ty-outlives/ty-param-closure-outlives-from-return-type.stderr @@ -1,4 +1,4 @@ -note: External requirements +note: external requirements --> $DIR/ty-param-closure-outlives-from-return-type.rs:26:23 | LL | with_signature(x, |y| y) @@ -11,7 +11,7 @@ LL | with_signature(x, |y| y) = note: number of external vids: 3 = note: where T: '_#2r -note: No external requirements +note: no external requirements --> $DIR/ty-param-closure-outlives-from-return-type.rs:15:1 | LL | / fn no_region<'a, T>(x: Box) -> Box diff --git a/src/test/ui/nll/ty-outlives/ty-param-closure-outlives-from-where-clause.stderr b/src/test/ui/nll/ty-outlives/ty-param-closure-outlives-from-where-clause.stderr index 46fef8ee5067b..62dfe94e38493 100644 --- a/src/test/ui/nll/ty-outlives/ty-param-closure-outlives-from-where-clause.stderr +++ b/src/test/ui/nll/ty-outlives/ty-param-closure-outlives-from-where-clause.stderr @@ -1,4 +1,4 @@ -note: External requirements +note: external requirements --> $DIR/ty-param-closure-outlives-from-where-clause.rs:27:26 | LL | with_signature(a, b, |x, y| { @@ -19,7 +19,7 @@ LL | | }) = note: number of external vids: 3 = note: where T: '_#1r -note: No external requirements +note: no external requirements --> $DIR/ty-param-closure-outlives-from-where-clause.rs:26:1 | LL | / fn no_region<'a, T>(a: Cell<&'a ()>, b: T) { @@ -48,7 +48,7 @@ LL | | }) | = help: consider adding an explicit lifetime bound `T: ReFree(DefId(0:11 ~ ty_param_closure_outlives_from_where_clause[317d]::no_region[0]), BrNamed(DefId(0:12 ~ ty_param_closure_outlives_from_where_clause[317d]::no_region[0]::'a[0]), 'a))`... -note: External requirements +note: external requirements --> $DIR/ty-param-closure-outlives-from-where-clause.rs:43:26 | LL | with_signature(a, b, |x, y| { @@ -68,7 +68,7 @@ LL | | }) = note: number of external vids: 3 = note: where T: '_#2r -note: No external requirements +note: no external requirements --> $DIR/ty-param-closure-outlives-from-where-clause.rs:39:1 | LL | / fn correct_region<'a, T>(a: Cell<&'a ()>, b: T) @@ -82,7 +82,7 @@ LL | | } | = note: defining type: correct_region::<'_#1r, T> -note: External requirements +note: external requirements --> $DIR/ty-param-closure-outlives-from-where-clause.rs:64:26 | LL | with_signature(a, b, |x, y| { @@ -101,7 +101,7 @@ LL | | }) = note: number of external vids: 4 = note: where T: '_#2r -note: No external requirements +note: no external requirements --> $DIR/ty-param-closure-outlives-from-where-clause.rs:60:1 | LL | / fn wrong_region<'a, 'b, T>(a: Cell<&'a ()>, b: T) @@ -128,7 +128,7 @@ LL | | }) | = help: consider adding an explicit lifetime bound `T: ReFree(DefId(0:19 ~ ty_param_closure_outlives_from_where_clause[317d]::wrong_region[0]), BrNamed(DefId(0:20 ~ ty_param_closure_outlives_from_where_clause[317d]::wrong_region[0]::'a[0]), 'a))`... -note: External requirements +note: external requirements --> $DIR/ty-param-closure-outlives-from-where-clause.rs:77:26 | LL | with_signature(a, b, |x, y| { @@ -145,7 +145,7 @@ LL | | }) = note: number of external vids: 4 = note: where T: '_#3r -note: No external requirements +note: no external requirements --> $DIR/ty-param-closure-outlives-from-where-clause.rs:72:1 | LL | / fn outlives_region<'a, 'b, T>(a: Cell<&'a ()>, b: T) diff --git a/src/test/ui/order-dependent-cast-inference.stderr b/src/test/ui/order-dependent-cast-inference.stderr index 081038c573acf..ad50b415869dd 100644 --- a/src/test/ui/order-dependent-cast-inference.stderr +++ b/src/test/ui/order-dependent-cast-inference.stderr @@ -6,7 +6,7 @@ LL | let mut y = 0 as *const _; | | | help: consider giving more type information | - = note: The type information given here is insufficient to check whether the pointer cast is valid + = note: the type information given here is insufficient to check whether the pointer cast is valid error: aborting due to previous error diff --git a/src/test/ui/test-attrs/test-should-panic-attr.stderr b/src/test/ui/test-attrs/test-should-panic-attr.stderr index 4b032eba5f8d5..d7d0d84432ce6 100644 --- a/src/test/ui/test-attrs/test-should-panic-attr.stderr +++ b/src/test/ui/test-attrs/test-should-panic-attr.stderr @@ -4,7 +4,7 @@ warning: argument must be of the form: `expected = "error message"` LL | #[should_panic(expected)] | ^^^^^^^^^^^^^^^^^^^^^^^^^ | - = note: Errors in this attribute were erroneously allowed and will become a hard error in a future release. + = note: errors in this attribute were erroneously allowed and will become a hard error in a future release. warning: argument must be of the form: `expected = "error message"` --> $DIR/test-should-panic-attr.rs:18:1 @@ -12,7 +12,7 @@ warning: argument must be of the form: `expected = "error message"` LL | #[should_panic(expect)] | ^^^^^^^^^^^^^^^^^^^^^^^ | - = note: Errors in this attribute were erroneously allowed and will become a hard error in a future release. + = note: errors in this attribute were erroneously allowed and will become a hard error in a future release. warning: argument must be of the form: `expected = "error message"` --> $DIR/test-should-panic-attr.rs:25:1 @@ -20,7 +20,7 @@ warning: argument must be of the form: `expected = "error message"` LL | #[should_panic(expected(foo, bar))] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | - = note: Errors in this attribute were erroneously allowed and will become a hard error in a future release. + = note: errors in this attribute were erroneously allowed and will become a hard error in a future release. warning: argument must be of the form: `expected = "error message"` --> $DIR/test-should-panic-attr.rs:32:1 @@ -28,5 +28,5 @@ warning: argument must be of the form: `expected = "error message"` LL | #[should_panic(expected = "foo", bar)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | - = note: Errors in this attribute were erroneously allowed and will become a hard error in a future release. + = note: errors in this attribute were erroneously allowed and will become a hard error in a future release. diff --git a/src/test/ui/traits/trait-bounds-same-crate-name.rs b/src/test/ui/traits/trait-bounds-same-crate-name.rs index af720ecfdc063..1012edb109336 100644 --- a/src/test/ui/traits/trait-bounds-same-crate-name.rs +++ b/src/test/ui/traits/trait-bounds-same-crate-name.rs @@ -31,7 +31,7 @@ fn main() { a::try_foo(foo); //~^ ERROR E0277 //~| trait impl with same name found - //~| Perhaps two different versions of crate `crate_a2` + //~| perhaps two different versions of crate `crate_a2` // We don't want to see the "version mismatch" help message here // because `implements_no_traits` has no impl for `Foo` diff --git a/src/test/ui/traits/trait-bounds-same-crate-name.stderr b/src/test/ui/traits/trait-bounds-same-crate-name.stderr index 8fd0bd13e54b3..8a6e059604d2b 100644 --- a/src/test/ui/traits/trait-bounds-same-crate-name.stderr +++ b/src/test/ui/traits/trait-bounds-same-crate-name.stderr @@ -14,7 +14,7 @@ help: trait impl with same name found | LL | impl Bar for Foo {} | ^^^^^^^^^^^^^^^^^^^ - = note: Perhaps two different versions of crate `crate_a2` are being used? + = note: perhaps two different versions of crate `crate_a2` are being used? error[E0277]: the trait bound `main::a::DoesNotImplementTrait: main::a::Bar` is not satisfied --> $DIR/trait-bounds-same-crate-name.rs:38:20 @@ -43,7 +43,7 @@ help: trait impl with same name found | LL | impl Bar for ImplementsWrongTraitConditionally {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - = note: Perhaps two different versions of crate `crate_a2` are being used? + = note: perhaps two different versions of crate `crate_a2` are being used? error[E0277]: the trait bound `main::a::ImplementsTraitForUsize: main::a::Bar` is not satisfied --> $DIR/trait-bounds-same-crate-name.rs:51:20 From 8461fa51198ad5db1d070620fe4186aaec648438 Mon Sep 17 00:00:00 2001 From: varkor Date: Fri, 10 Jan 2020 14:36:22 +0000 Subject: [PATCH 03/16] Diagnostics should not end with a full stop --- src/libcore/lib.rs | 2 +- src/librustc/middle/lang_items.rs | 6 +++--- src/librustc_passes/diagnostic_items.rs | 2 +- src/librustc_resolve/lib.rs | 2 +- src/librustc_typeck/check/mod.rs | 2 +- src/libstd/panicking.rs | 2 +- src/test/compile-fail/panic-handler-twice.rs | 2 +- .../mutually-recursive-async-impl-trait-type.stderr | 4 ++-- .../ui/async-await/recursive-async-impl-trait-type.stderr | 2 +- src/test/ui/consts/miri_unleashed/mutable_const2.stderr | 2 +- .../ui/consts/miri_unleashed/mutable_references_ice.stderr | 2 +- src/test/ui/duplicate_entry_error.rs | 2 +- src/test/ui/duplicate_entry_error.stderr | 4 ++-- src/test/ui/error-codes/E0152.stderr | 4 ++-- src/test/ui/keyword/keyword-super-as-identifier.rs | 2 +- src/test/ui/keyword/keyword-super-as-identifier.stderr | 4 ++-- src/test/ui/keyword/keyword-super.rs | 2 +- src/test/ui/keyword/keyword-super.stderr | 4 ++-- src/test/ui/multi-panic.rs | 2 +- src/test/ui/panic-handler/panic-handler-duplicate.rs | 2 +- src/test/ui/panic-handler/panic-handler-duplicate.stderr | 4 ++-- src/test/ui/panic-handler/panic-handler-std.rs | 2 +- src/test/ui/panic-handler/panic-handler-std.stderr | 4 ++-- src/test/ui/pattern/const-pat-ice.stderr | 2 +- src/test/ui/resolve/impl-items-vis-unresolved.rs | 2 +- src/test/ui/resolve/impl-items-vis-unresolved.stderr | 4 ++-- src/test/ui/super-at-top-level.rs | 2 +- src/test/ui/super-at-top-level.stderr | 4 ++-- src/test/ui/test-panic-abort.run.stdout | 2 +- 29 files changed, 40 insertions(+), 40 deletions(-) diff --git a/src/libcore/lib.rs b/src/libcore/lib.rs index 95ffe4f438f5f..15720ddcfc677 100644 --- a/src/libcore/lib.rs +++ b/src/libcore/lib.rs @@ -44,7 +44,7 @@ // Here we explicitly #[cfg]-out this whole crate when testing. If we don't do // this, both the generated test artifact and the linked libtest (which // transitively includes libcore) will both define the same set of lang items, -// and this will cause the E0152 "duplicate lang item found" error. See +// and this will cause the E0152 "found duplicate lang item" error. See // discussion in #50466 for details. // // This cfg won't affect doc tests. diff --git a/src/librustc/middle/lang_items.rs b/src/librustc/middle/lang_items.rs index 42fc3e030e7bb..643359f098b4d 100644 --- a/src/librustc/middle/lang_items.rs +++ b/src/librustc/middle/lang_items.rs @@ -184,7 +184,7 @@ impl LanguageItemCollector<'tcx> { self.tcx.sess, span, E0152, - "duplicate lang item found: `{}`.", + "found duplicate lang item `{}`", name ), None => { @@ -206,12 +206,12 @@ impl LanguageItemCollector<'tcx> { }, }; if let Some(span) = self.tcx.hir().span_if_local(original_def_id) { - err.span_note(span, "first defined here."); + err.span_note(span, "first defined here"); } else { match self.tcx.extern_crate(original_def_id) { Some(ExternCrate {dependency_of, ..}) => { err.note(&format!( - "first defined in crate `{}` (which `{}` depends on).", + "first defined in crate `{}` (which `{}` depends on)", self.tcx.crate_name(original_def_id.krate), self.tcx.crate_name(*dependency_of))); }, diff --git a/src/librustc_passes/diagnostic_items.rs b/src/librustc_passes/diagnostic_items.rs index c083830b730cc..8d220a3f695f2 100644 --- a/src/librustc_passes/diagnostic_items.rs +++ b/src/librustc_passes/diagnostic_items.rs @@ -73,7 +73,7 @@ fn collect_item( )), }; if let Some(span) = tcx.hir().span_if_local(original_def_id) { - err.span_note(span, "first defined here."); + err.span_note(span, "first defined here"); } else { err.note(&format!( "first defined in crate `{}`.", diff --git a/src/librustc_resolve/lib.rs b/src/librustc_resolve/lib.rs index 8e4630cf7d696..8d5afb194a175 100644 --- a/src/librustc_resolve/lib.rs +++ b/src/librustc_resolve/lib.rs @@ -2006,7 +2006,7 @@ impl<'a> Resolver<'a> { continue; } } - let msg = "there are too many initial `super`s.".to_string(); + let msg = "there are too many leading `super` keywords".to_string(); return PathResult::Failed { span: ident.span, label: msg, diff --git a/src/librustc_typeck/check/mod.rs b/src/librustc_typeck/check/mod.rs index 92a7e18a8600f..baf9ae1ac2911 100644 --- a/src/librustc_typeck/check/mod.rs +++ b/src/librustc_typeck/check/mod.rs @@ -1664,7 +1664,7 @@ fn check_opaque_for_cycles<'tcx>( if let hir::OpaqueTyOrigin::AsyncFn = origin { struct_span_err!(tcx.sess, span, E0733, "recursion in an `async fn` requires boxing",) .span_label(span, "recursive `async fn`") - .note("a recursive `async fn` must be rewritten to return a boxed `dyn Future`.") + .note("a recursive `async fn` must be rewritten to return a boxed `dyn Future`") .emit(); } else { let mut err = diff --git a/src/libstd/panicking.rs b/src/libstd/panicking.rs index 599ccc809be1f..f773a8276e354 100644 --- a/src/libstd/panicking.rs +++ b/src/libstd/panicking.rs @@ -199,7 +199,7 @@ fn default_hook(info: &PanicInfo<'_>) { let _ = writeln!( err, "note: run with `RUST_BACKTRACE=1` \ - environment variable to display a backtrace." + environment variable to display a backtrace" ); } } diff --git a/src/test/compile-fail/panic-handler-twice.rs b/src/test/compile-fail/panic-handler-twice.rs index c0f2c51397ed9..0c5359b9bd8c6 100644 --- a/src/test/compile-fail/panic-handler-twice.rs +++ b/src/test/compile-fail/panic-handler-twice.rs @@ -10,7 +10,7 @@ use core::panic::PanicInfo; #[panic_handler] fn panic(info: &PanicInfo) -> ! { - //~^ error duplicate lang item found: `panic_impl` + //~^ ERROR found duplicate lang item `panic_impl` loop {} } diff --git a/src/test/ui/async-await/mutually-recursive-async-impl-trait-type.stderr b/src/test/ui/async-await/mutually-recursive-async-impl-trait-type.stderr index 9249308936e54..f6e4c8be29260 100644 --- a/src/test/ui/async-await/mutually-recursive-async-impl-trait-type.stderr +++ b/src/test/ui/async-await/mutually-recursive-async-impl-trait-type.stderr @@ -4,7 +4,7 @@ error[E0733]: recursion in an `async fn` requires boxing LL | async fn rec_1() { | ^ recursive `async fn` | - = note: a recursive `async fn` must be rewritten to return a boxed `dyn Future`. + = note: a recursive `async fn` must be rewritten to return a boxed `dyn Future` error[E0733]: recursion in an `async fn` requires boxing --> $DIR/mutually-recursive-async-impl-trait-type.rs:9:18 @@ -12,7 +12,7 @@ error[E0733]: recursion in an `async fn` requires boxing LL | async fn rec_2() { | ^ recursive `async fn` | - = note: a recursive `async fn` must be rewritten to return a boxed `dyn Future`. + = note: a recursive `async fn` must be rewritten to return a boxed `dyn Future` error: aborting due to 2 previous errors diff --git a/src/test/ui/async-await/recursive-async-impl-trait-type.stderr b/src/test/ui/async-await/recursive-async-impl-trait-type.stderr index 9ee014021804e..892d91e3a4992 100644 --- a/src/test/ui/async-await/recursive-async-impl-trait-type.stderr +++ b/src/test/ui/async-await/recursive-async-impl-trait-type.stderr @@ -4,7 +4,7 @@ error[E0733]: recursion in an `async fn` requires boxing LL | async fn recursive_async_function() -> () { | ^^ recursive `async fn` | - = note: a recursive `async fn` must be rewritten to return a boxed `dyn Future`. + = note: a recursive `async fn` must be rewritten to return a boxed `dyn Future` error: aborting due to previous error diff --git a/src/test/ui/consts/miri_unleashed/mutable_const2.stderr b/src/test/ui/consts/miri_unleashed/mutable_const2.stderr index 88418e57acdda..655c31763ef44 100644 --- a/src/test/ui/consts/miri_unleashed/mutable_const2.stderr +++ b/src/test/ui/consts/miri_unleashed/mutable_const2.stderr @@ -11,7 +11,7 @@ LL | const MUTABLE_BEHIND_RAW: *mut i32 = &UnsafeCell::new(42) as *const _ as *m | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ thread 'rustc' panicked at 'no errors encountered even though `delay_span_bug` issued', src/librustc_errors/lib.rs:346:17 -note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace. +note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace error: internal compiler error: unexpected panic diff --git a/src/test/ui/consts/miri_unleashed/mutable_references_ice.stderr b/src/test/ui/consts/miri_unleashed/mutable_references_ice.stderr index c148842bcbc66..c292fcef7f660 100644 --- a/src/test/ui/consts/miri_unleashed/mutable_references_ice.stderr +++ b/src/test/ui/consts/miri_unleashed/mutable_references_ice.stderr @@ -7,7 +7,7 @@ LL | x: &UnsafeCell::new(42), thread 'rustc' panicked at 'assertion failed: `(left != right)` left: `Const`, right: `Const`: UnsafeCells are not allowed behind references in constants. This should have been prevented statically by const qualification. If this were allowed one would be able to change a constant at one use site and other use sites could observe that mutation.', src/librustc_mir/interpret/intern.rs:LL:CC -note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace. +note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace error: internal compiler error: unexpected panic diff --git a/src/test/ui/duplicate_entry_error.rs b/src/test/ui/duplicate_entry_error.rs index 62df42b1a6890..b8d98a8999b9d 100644 --- a/src/test/ui/duplicate_entry_error.rs +++ b/src/test/ui/duplicate_entry_error.rs @@ -8,7 +8,7 @@ use std::panic::PanicInfo; #[lang = "panic_impl"] fn panic_impl(info: &PanicInfo) -> ! { -//~^ ERROR: duplicate lang item found: `panic_impl`. +//~^ ERROR: found duplicate lang item `panic_impl` loop {} } diff --git a/src/test/ui/duplicate_entry_error.stderr b/src/test/ui/duplicate_entry_error.stderr index 02be11d1fd0e5..46b137b2cf9c0 100644 --- a/src/test/ui/duplicate_entry_error.stderr +++ b/src/test/ui/duplicate_entry_error.stderr @@ -1,4 +1,4 @@ -error[E0152]: duplicate lang item found: `panic_impl`. +error[E0152]: found duplicate lang item `panic_impl` --> $DIR/duplicate_entry_error.rs:10:1 | LL | / fn panic_impl(info: &PanicInfo) -> ! { @@ -7,7 +7,7 @@ LL | | loop {} LL | | } | |_^ | - = note: first defined in crate `std` (which `duplicate_entry_error` depends on). + = note: first defined in crate `std` (which `duplicate_entry_error` depends on) error: aborting due to previous error diff --git a/src/test/ui/error-codes/E0152.stderr b/src/test/ui/error-codes/E0152.stderr index d4b59a1148e60..c41a0430150a4 100644 --- a/src/test/ui/error-codes/E0152.stderr +++ b/src/test/ui/error-codes/E0152.stderr @@ -1,10 +1,10 @@ -error[E0152]: duplicate lang item found: `arc`. +error[E0152]: found duplicate lang item `arc` --> $DIR/E0152.rs:4:1 | LL | struct Foo; | ^^^^^^^^^^^ | - = note: first defined in crate `alloc` (which `std` depends on). + = note: first defined in crate `alloc` (which `std` depends on) error: aborting due to previous error diff --git a/src/test/ui/keyword/keyword-super-as-identifier.rs b/src/test/ui/keyword/keyword-super-as-identifier.rs index d728b4fe3e241..02c1b27b08a96 100644 --- a/src/test/ui/keyword/keyword-super-as-identifier.rs +++ b/src/test/ui/keyword/keyword-super-as-identifier.rs @@ -1,3 +1,3 @@ fn main() { - let super = 22; //~ ERROR failed to resolve: there are too many initial `super`s + let super = 22; //~ ERROR failed to resolve: there are too many leading `super` keywords } diff --git a/src/test/ui/keyword/keyword-super-as-identifier.stderr b/src/test/ui/keyword/keyword-super-as-identifier.stderr index bbeaed9428795..1f64f3b73d6cd 100644 --- a/src/test/ui/keyword/keyword-super-as-identifier.stderr +++ b/src/test/ui/keyword/keyword-super-as-identifier.stderr @@ -1,8 +1,8 @@ -error[E0433]: failed to resolve: there are too many initial `super`s. +error[E0433]: failed to resolve: there are too many leading `super` keywords --> $DIR/keyword-super-as-identifier.rs:2:9 | LL | let super = 22; - | ^^^^^ there are too many initial `super`s. + | ^^^^^ there are too many leading `super` keywords error: aborting due to previous error diff --git a/src/test/ui/keyword/keyword-super.rs b/src/test/ui/keyword/keyword-super.rs index a43e1e39b6797..c121a6c1050ea 100644 --- a/src/test/ui/keyword/keyword-super.rs +++ b/src/test/ui/keyword/keyword-super.rs @@ -1,3 +1,3 @@ fn main() { - let super: isize; //~ ERROR failed to resolve: there are too many initial `super`s + let super: isize; //~ ERROR failed to resolve: there are too many leading `super` keywords } diff --git a/src/test/ui/keyword/keyword-super.stderr b/src/test/ui/keyword/keyword-super.stderr index 63394c7852a5d..0e0d67cb97b1f 100644 --- a/src/test/ui/keyword/keyword-super.stderr +++ b/src/test/ui/keyword/keyword-super.stderr @@ -1,8 +1,8 @@ -error[E0433]: failed to resolve: there are too many initial `super`s. +error[E0433]: failed to resolve: there are too many leading `super` keywords --> $DIR/keyword-super.rs:2:9 | LL | let super: isize; - | ^^^^^ there are too many initial `super`s. + | ^^^^^ there are too many leading `super` keywords error: aborting due to previous error diff --git a/src/test/ui/multi-panic.rs b/src/test/ui/multi-panic.rs index e4b41e4180664..0f8bddf27fe08 100644 --- a/src/test/ui/multi-panic.rs +++ b/src/test/ui/multi-panic.rs @@ -10,7 +10,7 @@ fn check_for_no_backtrace(test: std::process::Output) { assert_eq!(it.next().map(|l| l.starts_with("thread '' panicked at")), Some(true)); assert_eq!(it.next(), Some("note: run with `RUST_BACKTRACE=1` \ - environment variable to display a backtrace.")); + environment variable to display a backtrace")); assert_eq!(it.next().map(|l| l.starts_with("thread 'main' panicked at")), Some(true)); assert_eq!(it.next(), None); } diff --git a/src/test/ui/panic-handler/panic-handler-duplicate.rs b/src/test/ui/panic-handler/panic-handler-duplicate.rs index caa130ef460f1..bd99af999c797 100644 --- a/src/test/ui/panic-handler/panic-handler-duplicate.rs +++ b/src/test/ui/panic-handler/panic-handler-duplicate.rs @@ -12,6 +12,6 @@ fn panic(info: &PanicInfo) -> ! { } #[lang = "panic_impl"] -fn panic2(info: &PanicInfo) -> ! { //~ ERROR duplicate lang item found: `panic_impl`. +fn panic2(info: &PanicInfo) -> ! { //~ ERROR found duplicate lang item `panic_impl` loop {} } diff --git a/src/test/ui/panic-handler/panic-handler-duplicate.stderr b/src/test/ui/panic-handler/panic-handler-duplicate.stderr index e9b1945364372..9999e3276469d 100644 --- a/src/test/ui/panic-handler/panic-handler-duplicate.stderr +++ b/src/test/ui/panic-handler/panic-handler-duplicate.stderr @@ -1,4 +1,4 @@ -error[E0152]: duplicate lang item found: `panic_impl`. +error[E0152]: found duplicate lang item `panic_impl` --> $DIR/panic-handler-duplicate.rs:15:1 | LL | / fn panic2(info: &PanicInfo) -> ! { @@ -6,7 +6,7 @@ LL | | loop {} LL | | } | |_^ | -note: first defined here. +note: first defined here --> $DIR/panic-handler-duplicate.rs:10:1 | LL | / fn panic(info: &PanicInfo) -> ! { diff --git a/src/test/ui/panic-handler/panic-handler-std.rs b/src/test/ui/panic-handler/panic-handler-std.rs index fffb5977871d8..0acc2722cb21f 100644 --- a/src/test/ui/panic-handler/panic-handler-std.rs +++ b/src/test/ui/panic-handler/panic-handler-std.rs @@ -1,4 +1,4 @@ -// error-pattern: duplicate lang item found: `panic_impl`. +// error-pattern: found duplicate lang item `panic_impl` use std::panic::PanicInfo; diff --git a/src/test/ui/panic-handler/panic-handler-std.stderr b/src/test/ui/panic-handler/panic-handler-std.stderr index e6d24348ca825..ac56513fd4706 100644 --- a/src/test/ui/panic-handler/panic-handler-std.stderr +++ b/src/test/ui/panic-handler/panic-handler-std.stderr @@ -1,4 +1,4 @@ -error[E0152]: duplicate lang item found: `panic_impl`. +error[E0152]: found duplicate lang item `panic_impl` --> $DIR/panic-handler-std.rs:7:1 | LL | / fn panic(info: PanicInfo) -> ! { @@ -6,7 +6,7 @@ LL | | loop {} LL | | } | |_^ | - = note: first defined in crate `std` (which `panic_handler_std` depends on). + = note: first defined in crate `std` (which `panic_handler_std` depends on) error: argument should be `&PanicInfo` --> $DIR/panic-handler-std.rs:7:16 diff --git a/src/test/ui/pattern/const-pat-ice.stderr b/src/test/ui/pattern/const-pat-ice.stderr index 7217fe1b02f4e..d0018cef5f033 100644 --- a/src/test/ui/pattern/const-pat-ice.stderr +++ b/src/test/ui/pattern/const-pat-ice.stderr @@ -1,5 +1,5 @@ thread 'rustc' panicked at 'assertion failed: rows.iter().all(|r| r.len() == v.len())', src/librustc_mir_build/hair/pattern/_match.rs:LL:CC -note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace. +note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace error: internal compiler error: unexpected panic diff --git a/src/test/ui/resolve/impl-items-vis-unresolved.rs b/src/test/ui/resolve/impl-items-vis-unresolved.rs index 9b4fe498239b6..a124b4eff8f69 100644 --- a/src/test/ui/resolve/impl-items-vis-unresolved.rs +++ b/src/test/ui/resolve/impl-items-vis-unresolved.rs @@ -18,7 +18,7 @@ mod state { pub struct RawFloatState; impl RawFloatState { perftools_inline! { - pub(super) fn new() {} //~ ERROR failed to resolve: there are too many initial `super`s + pub(super) fn new() {} //~ ERROR failed to resolve: there are too many leading `super` keywords } } diff --git a/src/test/ui/resolve/impl-items-vis-unresolved.stderr b/src/test/ui/resolve/impl-items-vis-unresolved.stderr index 8e285e5312400..62cffe55f9fb6 100644 --- a/src/test/ui/resolve/impl-items-vis-unresolved.stderr +++ b/src/test/ui/resolve/impl-items-vis-unresolved.stderr @@ -1,8 +1,8 @@ -error[E0433]: failed to resolve: there are too many initial `super`s. +error[E0433]: failed to resolve: there are too many leading `super` keywords --> $DIR/impl-items-vis-unresolved.rs:21:13 | LL | pub(super) fn new() {} - | ^^^^^ there are too many initial `super`s. + | ^^^^^ there are too many leading `super` keywords. error: aborting due to previous error diff --git a/src/test/ui/super-at-top-level.rs b/src/test/ui/super-at-top-level.rs index 41360df77994e..e4d587bc9effa 100644 --- a/src/test/ui/super-at-top-level.rs +++ b/src/test/ui/super-at-top-level.rs @@ -1,4 +1,4 @@ -use super::f; //~ ERROR there are too many initial `super`s +use super::f; //~ ERROR there are too many leading `super` keywords fn main() { } diff --git a/src/test/ui/super-at-top-level.stderr b/src/test/ui/super-at-top-level.stderr index d04ce384fe886..23613df6752fb 100644 --- a/src/test/ui/super-at-top-level.stderr +++ b/src/test/ui/super-at-top-level.stderr @@ -1,8 +1,8 @@ -error[E0433]: failed to resolve: there are too many initial `super`s. +error[E0433]: failed to resolve: there are too many leading `super` keywords --> $DIR/super-at-top-level.rs:1:5 | LL | use super::f; - | ^^^^^ there are too many initial `super`s. + | ^^^^^ there are too many leading `super` keywords error: aborting due to previous error diff --git a/src/test/ui/test-panic-abort.run.stdout b/src/test/ui/test-panic-abort.run.stdout index 0c8bc5020871b..46adcfbc2eb4a 100644 --- a/src/test/ui/test-panic-abort.run.stdout +++ b/src/test/ui/test-panic-abort.run.stdout @@ -18,7 +18,7 @@ testing321 thread 'main' panicked at 'assertion failed: `(left == right)` left: `2`, right: `5`', $DIR/test-panic-abort.rs:31:5 -note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace. +note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace failures: From e84248921b44c9fdf3d6638c170ffde733074ff8 Mon Sep 17 00:00:00 2001 From: varkor Date: Fri, 10 Jan 2020 14:57:36 +0000 Subject: [PATCH 04/16] Add backticks in appropriate places --- src/librustc_lint/builtin.rs | 9 ++-- src/librustc_parse/parser/attr.rs | 4 +- src/librustc_resolve/build_reduced_graph.rs | 6 +-- src/librustc_typeck/check/method/suggest.rs | 2 +- .../validate_uninhabited_zsts.stderr | 2 +- .../deprecated-macro_escape-inner.rs | 2 +- .../deprecated-macro_escape-inner.stderr | 2 +- .../ui/deprecation/deprecated-macro_escape.rs | 8 ++-- .../deprecated-macro_escape.stderr | 2 +- .../issue-43106-gating-of-builtin-attrs.rs | 4 +- ...issue-43106-gating-of-builtin-attrs.stderr | 4 +- .../issue-43106-gating-of-macro_escape.rs | 2 +- .../issue-43106-gating-of-macro_escape.stderr | 2 +- .../issue-43106-gating-of-macro_use.rs | 6 +-- .../issue-43106-gating-of-macro_use.stderr | 6 +-- .../extern-crate-self-fail.rs | 2 +- .../extern-crate-self-fail.stderr | 2 +- src/test/ui/issues/issue-29124.stderr | 4 +- src/test/ui/issues/issue-57362-1.stderr | 2 +- src/test/ui/lint/uninitialized-zeroed.stderr | 16 +++---- .../malformed/malformed-interpolated.stderr | 2 +- src/test/ui/module-macro_use-arguments.rs | 2 +- src/test/ui/module-macro_use-arguments.stderr | 2 +- src/test/ui/suffixed-literal-meta.stderr | 48 +++++++++---------- ...ed-closures-static-call-wrong-trait.stderr | 2 +- 25 files changed, 72 insertions(+), 71 deletions(-) diff --git a/src/librustc_lint/builtin.rs b/src/librustc_lint/builtin.rs index 7f55bcd4017ef..fea0b012f91b3 100644 --- a/src/librustc_lint/builtin.rs +++ b/src/librustc_lint/builtin.rs @@ -1959,13 +1959,16 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for InvalidValue { // return `Bound::Excluded`. (And we have tests checking that we // handle the attribute correctly.) (Bound::Included(lo), _) if lo > 0 => { - return Some((format!("{} must be non-null", ty), None)); + return Some((format!("`{}` must be non-null", ty), None)); } (Bound::Included(_), _) | (_, Bound::Included(_)) if init == InitKind::Uninit => { return Some(( - format!("{} must be initialized inside its custom valid range", ty), + format!( + "`{}` must be initialized inside its custom valid range", + ty, + ), None, )); } @@ -1973,7 +1976,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for InvalidValue { } // Now, recurse. match adt_def.variants.len() { - 0 => Some((format!("0-variant enums have no valid value"), None)), + 0 => Some((format!("enums with no variants have no valid value"), None)), 1 => { // Struct, or enum with exactly one variant. // Proceed recursively, check all fields. diff --git a/src/librustc_parse/parser/attr.rs b/src/librustc_parse/parser/attr.rs index 81f31b2eda1d4..3d40b91a7bdc8 100644 --- a/src/librustc_parse/parser/attr.rs +++ b/src/librustc_parse/parser/attr.rs @@ -236,8 +236,8 @@ impl<'a> Parser<'a> { self.struct_span_err(lit.span, msg) .help( "instead of using a suffixed literal \ - (1u8, 1.0f32, etc.), use an unsuffixed version \ - (1, 1.0, etc.).", + (`1u8`, `1.0f32`, etc.), use an unsuffixed version \ + (`1`, `1.0`, etc.)", ) .emit() } diff --git a/src/librustc_resolve/build_reduced_graph.rs b/src/librustc_resolve/build_reduced_graph.rs index 291386413d647..9c80df367c09c 100644 --- a/src/librustc_resolve/build_reduced_graph.rs +++ b/src/librustc_resolve/build_reduced_graph.rs @@ -963,7 +963,7 @@ impl<'a, 'b> BuildReducedGraphVisitor<'a, 'b> { .session .struct_span_err( attr.span, - "`macro_use` is not supported on `extern crate self`", + "`#[macro_use]` is not supported on `extern crate self`", ) .emit(); } @@ -1054,7 +1054,7 @@ impl<'a, 'b> BuildReducedGraphVisitor<'a, 'b> { fn contains_macro_use(&mut self, attrs: &[ast::Attribute]) -> bool { for attr in attrs { if attr.check_name(sym::macro_escape) { - let msg = "macro_escape is a deprecated synonym for macro_use"; + let msg = "`#[macro_escape]` is a deprecated synonym for `#[macro_use]`"; let mut err = self.r.session.struct_span_warn(attr.span, msg); if let ast::AttrStyle::Inner = attr.style { err.help("consider an outer attribute, `#[macro_use]` mod ...").emit(); @@ -1066,7 +1066,7 @@ impl<'a, 'b> BuildReducedGraphVisitor<'a, 'b> { } if !attr.is_word() { - self.r.session.span_err(attr.span, "arguments to macro_use are not allowed here"); + self.r.session.span_err(attr.span, "arguments to `macro_use` are not allowed here"); } return true; } diff --git a/src/librustc_typeck/check/method/suggest.rs b/src/librustc_typeck/check/method/suggest.rs index b84e1d37b06ff..d6c0d9c77b495 100644 --- a/src/librustc_typeck/check/method/suggest.rs +++ b/src/librustc_typeck/check/method/suggest.rs @@ -479,7 +479,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { macro_rules! report_function { ($span:expr, $name:expr) => { err.note(&format!( - "{} is a function, perhaps you wish to call it", + "`{}` is a function, perhaps you wish to call it", $name )); }; diff --git a/src/test/ui/consts/const-eval/validate_uninhabited_zsts.stderr b/src/test/ui/consts/const-eval/validate_uninhabited_zsts.stderr index 040c568beb324..51e80bb8b118b 100644 --- a/src/test/ui/consts/const-eval/validate_uninhabited_zsts.stderr +++ b/src/test/ui/consts/const-eval/validate_uninhabited_zsts.stderr @@ -45,7 +45,7 @@ LL | const BAR: [Empty; 3] = [unsafe { std::mem::transmute(()) }; 3]; | this code causes undefined behavior when executed | help: use `MaybeUninit` instead, and only call `assume_init` after initialization is done | - = note: 0-variant enums have no valid value + = note: enums with no variants have no valid value error: aborting due to previous error diff --git a/src/test/ui/deprecation/deprecated-macro_escape-inner.rs b/src/test/ui/deprecation/deprecated-macro_escape-inner.rs index 957e839013ec7..e2957c422f6d5 100644 --- a/src/test/ui/deprecation/deprecated-macro_escape-inner.rs +++ b/src/test/ui/deprecation/deprecated-macro_escape-inner.rs @@ -1,7 +1,7 @@ // run-pass mod foo { - #![macro_escape] //~ WARNING macro_escape is a deprecated synonym for macro_use + #![macro_escape] //~ WARN `#[macro_escape]` is a deprecated synonym for `#[macro_use]` } fn main() { diff --git a/src/test/ui/deprecation/deprecated-macro_escape-inner.stderr b/src/test/ui/deprecation/deprecated-macro_escape-inner.stderr index 1b69270d624f4..65db62ce26355 100644 --- a/src/test/ui/deprecation/deprecated-macro_escape-inner.stderr +++ b/src/test/ui/deprecation/deprecated-macro_escape-inner.stderr @@ -1,4 +1,4 @@ -warning: macro_escape is a deprecated synonym for macro_use +warning: `#[macro_escape]` is a deprecated synonym for `#[macro_use]` --> $DIR/deprecated-macro_escape-inner.rs:4:5 | LL | #![macro_escape] diff --git a/src/test/ui/deprecation/deprecated-macro_escape.rs b/src/test/ui/deprecation/deprecated-macro_escape.rs index 1b82a99f42eab..4a89b40625e68 100644 --- a/src/test/ui/deprecation/deprecated-macro_escape.rs +++ b/src/test/ui/deprecation/deprecated-macro_escape.rs @@ -1,8 +1,6 @@ // run-pass -#[macro_escape] //~ WARNING macro_escape is a deprecated synonym for macro_use -mod foo { -} +#[macro_escape] //~ WARNING `#[macro_escape]` is a deprecated synonym for `#[macro_use]` +mod foo {} -fn main() { -} +fn main() {} diff --git a/src/test/ui/deprecation/deprecated-macro_escape.stderr b/src/test/ui/deprecation/deprecated-macro_escape.stderr index b76d6d73d972b..70094083d4b34 100644 --- a/src/test/ui/deprecation/deprecated-macro_escape.stderr +++ b/src/test/ui/deprecation/deprecated-macro_escape.stderr @@ -1,4 +1,4 @@ -warning: macro_escape is a deprecated synonym for macro_use +warning: `#[macro_escape]` is a deprecated synonym for `#[macro_use]` --> $DIR/deprecated-macro_escape.rs:3:1 | LL | #[macro_escape] diff --git a/src/test/ui/feature-gate/issue-43106-gating-of-builtin-attrs.rs b/src/test/ui/feature-gate/issue-43106-gating-of-builtin-attrs.rs index 0d804f012bcc3..8609108831e7c 100644 --- a/src/test/ui/feature-gate/issue-43106-gating-of-builtin-attrs.rs +++ b/src/test/ui/feature-gate/issue-43106-gating-of-builtin-attrs.rs @@ -464,10 +464,10 @@ mod reexport_test_harness_main { // Cannot feed "2700" to `#[macro_escape]` without signaling an error. #[macro_escape] -//~^ WARN macro_escape is a deprecated synonym for macro_use +//~^ WARN `#[macro_escape]` is a deprecated synonym for `#[macro_use]` mod macro_escape { mod inner { #![macro_escape] } - //~^ WARN macro_escape is a deprecated synonym for macro_use + //~^ WARN `#[macro_escape]` is a deprecated synonym for `#[macro_use]` #[macro_escape] fn f() { } //~^ WARN unused attribute diff --git a/src/test/ui/feature-gate/issue-43106-gating-of-builtin-attrs.stderr b/src/test/ui/feature-gate/issue-43106-gating-of-builtin-attrs.stderr index 9ce90d89d22d2..6063aabd565bc 100644 --- a/src/test/ui/feature-gate/issue-43106-gating-of-builtin-attrs.stderr +++ b/src/test/ui/feature-gate/issue-43106-gating-of-builtin-attrs.stderr @@ -172,13 +172,13 @@ warning: unknown lint: `x5100` LL | #[deny(x5100)] impl S { } | ^^^^^ -warning: macro_escape is a deprecated synonym for macro_use +warning: `#[macro_escape]` is a deprecated synonym for `#[macro_use]` --> $DIR/issue-43106-gating-of-builtin-attrs.rs:466:1 | LL | #[macro_escape] | ^^^^^^^^^^^^^^^ -warning: macro_escape is a deprecated synonym for macro_use +warning: `#[macro_escape]` is a deprecated synonym for `#[macro_use]` --> $DIR/issue-43106-gating-of-builtin-attrs.rs:469:17 | LL | mod inner { #![macro_escape] } diff --git a/src/test/ui/feature-gate/issue-43106-gating-of-macro_escape.rs b/src/test/ui/feature-gate/issue-43106-gating-of-macro_escape.rs index 75a3d9124ebae..de00bc4cbac07 100644 --- a/src/test/ui/feature-gate/issue-43106-gating-of-macro_escape.rs +++ b/src/test/ui/feature-gate/issue-43106-gating-of-macro_escape.rs @@ -6,6 +6,6 @@ // check-pass #![macro_escape] -//~^ WARN macro_escape is a deprecated synonym for macro_use +//~^ WARN `#[macro_escape]` is a deprecated synonym for `#[macro_use]` fn main() {} diff --git a/src/test/ui/feature-gate/issue-43106-gating-of-macro_escape.stderr b/src/test/ui/feature-gate/issue-43106-gating-of-macro_escape.stderr index 8575c1660c5a1..f2cc2f74e53e4 100644 --- a/src/test/ui/feature-gate/issue-43106-gating-of-macro_escape.stderr +++ b/src/test/ui/feature-gate/issue-43106-gating-of-macro_escape.stderr @@ -1,4 +1,4 @@ -warning: macro_escape is a deprecated synonym for macro_use +warning: `#[macro_escape]` is a deprecated synonym for `#[macro_use]` --> $DIR/issue-43106-gating-of-macro_escape.rs:8:1 | LL | #![macro_escape] diff --git a/src/test/ui/feature-gate/issue-43106-gating-of-macro_use.rs b/src/test/ui/feature-gate/issue-43106-gating-of-macro_use.rs index 4ced941aad5d0..6a7ef793924a4 100644 --- a/src/test/ui/feature-gate/issue-43106-gating-of-macro_use.rs +++ b/src/test/ui/feature-gate/issue-43106-gating-of-macro_use.rs @@ -4,13 +4,13 @@ // get that warning; see issue-43106-gating-of-builtin-attrs.rs #![macro_use(my_macro)] -//~^ ERROR arguments to macro_use are not allowed here +//~^ ERROR arguments to `macro_use` are not allowed here #[macro_use(my_macro)] -//~^ ERROR arguments to macro_use are not allowed here +//~^ ERROR arguments to `macro_use` are not allowed here mod macro_escape { mod inner { #![macro_use(my_macro)] } - //~^ ERROR arguments to macro_use are not allowed here + //~^ ERROR arguments to `macro_use` are not allowed here #[macro_use = "2700"] struct S; //~^ ERROR malformed `macro_use` attribute diff --git a/src/test/ui/feature-gate/issue-43106-gating-of-macro_use.stderr b/src/test/ui/feature-gate/issue-43106-gating-of-macro_use.stderr index 3181d62298cad..52a682e4bfa87 100644 --- a/src/test/ui/feature-gate/issue-43106-gating-of-macro_use.stderr +++ b/src/test/ui/feature-gate/issue-43106-gating-of-macro_use.stderr @@ -1,16 +1,16 @@ -error: arguments to macro_use are not allowed here +error: arguments to `macro_use` are not allowed here --> $DIR/issue-43106-gating-of-macro_use.rs:6:1 | LL | #![macro_use(my_macro)] | ^^^^^^^^^^^^^^^^^^^^^^^ -error: arguments to macro_use are not allowed here +error: arguments to `macro_use` are not allowed here --> $DIR/issue-43106-gating-of-macro_use.rs:9:1 | LL | #[macro_use(my_macro)] | ^^^^^^^^^^^^^^^^^^^^^^ -error: arguments to macro_use are not allowed here +error: arguments to `macro_use` are not allowed here --> $DIR/issue-43106-gating-of-macro_use.rs:12:17 | LL | mod inner { #![macro_use(my_macro)] } diff --git a/src/test/ui/imports/extern-crate-self/extern-crate-self-fail.rs b/src/test/ui/imports/extern-crate-self/extern-crate-self-fail.rs index defa0e294bd74..1c0d3b4b964d6 100644 --- a/src/test/ui/imports/extern-crate-self/extern-crate-self-fail.rs +++ b/src/test/ui/imports/extern-crate-self/extern-crate-self-fail.rs @@ -1,6 +1,6 @@ extern crate self; //~ ERROR `extern crate self;` requires renaming -#[macro_use] //~ ERROR `macro_use` is not supported on `extern crate self` +#[macro_use] //~ ERROR `#[macro_use]` is not supported on `extern crate self` extern crate self as foo; fn main() {} diff --git a/src/test/ui/imports/extern-crate-self/extern-crate-self-fail.stderr b/src/test/ui/imports/extern-crate-self/extern-crate-self-fail.stderr index f26bb2f5a0ec4..8f369f1b03831 100644 --- a/src/test/ui/imports/extern-crate-self/extern-crate-self-fail.stderr +++ b/src/test/ui/imports/extern-crate-self/extern-crate-self-fail.stderr @@ -4,7 +4,7 @@ error: `extern crate self;` requires renaming LL | extern crate self; | ^^^^^^^^^^^^^^^^^^ help: try: `extern crate self as name;` -error: `macro_use` is not supported on `extern crate self` +error: `#[macro_use]` is not supported on `extern crate self` --> $DIR/extern-crate-self-fail.rs:3:1 | LL | #[macro_use] diff --git a/src/test/ui/issues/issue-29124.stderr b/src/test/ui/issues/issue-29124.stderr index fff20248b70d5..42d89cd01a48e 100644 --- a/src/test/ui/issues/issue-29124.stderr +++ b/src/test/ui/issues/issue-29124.stderr @@ -4,7 +4,7 @@ error[E0599]: no method named `x` found for fn item `fn() -> Ret {Obj::func}` in LL | Obj::func.x(); | ^ method not found in `fn() -> Ret {Obj::func}` | - = note: Obj::func is a function, perhaps you wish to call it + = note: `Obj::func` is a function, perhaps you wish to call it error[E0599]: no method named `x` found for fn item `fn() -> Ret {func}` in the current scope --> $DIR/issue-29124.rs:17:10 @@ -12,7 +12,7 @@ error[E0599]: no method named `x` found for fn item `fn() -> Ret {func}` in the LL | func.x(); | ^ method not found in `fn() -> Ret {func}` | - = note: func is a function, perhaps you wish to call it + = note: `func` is a function, perhaps you wish to call it error: aborting due to 2 previous errors diff --git a/src/test/ui/issues/issue-57362-1.stderr b/src/test/ui/issues/issue-57362-1.stderr index e762b7bc0c899..ad596db13ccfd 100644 --- a/src/test/ui/issues/issue-57362-1.stderr +++ b/src/test/ui/issues/issue-57362-1.stderr @@ -4,7 +4,7 @@ error[E0599]: no method named `f` found for fn pointer `fn(&u8)` in the current LL | a.f(); | ^ method not found in `fn(&u8)` | - = note: a is a function, perhaps you wish to call it + = note: `a` is a function, perhaps you wish to call it = help: items from traits can only be used if the trait is implemented and in scope = note: the following trait defines an item `f`, perhaps you need to implement it: candidate #1: `Trait` diff --git a/src/test/ui/lint/uninitialized-zeroed.stderr b/src/test/ui/lint/uninitialized-zeroed.stderr index d451b827598f4..169e77c8fa05d 100644 --- a/src/test/ui/lint/uninitialized-zeroed.stderr +++ b/src/test/ui/lint/uninitialized-zeroed.stderr @@ -108,7 +108,7 @@ LL | let _val: Void = mem::zeroed(); | this code causes undefined behavior when executed | help: use `MaybeUninit` instead, and only call `assume_init` after initialization is done | - = note: 0-variant enums have no valid value + = note: enums with no variants have no valid value error: the type `Void` does not permit being left uninitialized --> $DIR/uninitialized-zeroed.rs:47:26 @@ -119,7 +119,7 @@ LL | let _val: Void = mem::uninitialized(); | this code causes undefined behavior when executed | help: use `MaybeUninit` instead, and only call `assume_init` after initialization is done | - = note: 0-variant enums have no valid value + = note: enums with no variants have no valid value error: the type `&'static i32` does not permit zero-initialization --> $DIR/uninitialized-zeroed.rs:49:34 @@ -294,7 +294,7 @@ LL | let _val: NonNull = mem::zeroed(); | this code causes undefined behavior when executed | help: use `MaybeUninit` instead, and only call `assume_init` after initialization is done | - = note: std::ptr::NonNull must be non-null + = note: `std::ptr::NonNull` must be non-null error: the type `std::ptr::NonNull` does not permit being left uninitialized --> $DIR/uninitialized-zeroed.rs:68:34 @@ -305,7 +305,7 @@ LL | let _val: NonNull = mem::uninitialized(); | this code causes undefined behavior when executed | help: use `MaybeUninit` instead, and only call `assume_init` after initialization is done | - = note: std::ptr::NonNull must be non-null + = note: `std::ptr::NonNull` must be non-null error: the type `*const dyn std::marker::Send` does not permit zero-initialization --> $DIR/uninitialized-zeroed.rs:70:37 @@ -364,7 +364,7 @@ LL | let _val: NonBig = mem::uninitialized(); | this code causes undefined behavior when executed | help: use `MaybeUninit` instead, and only call `assume_init` after initialization is done | - = note: NonBig must be initialized inside its custom valid range + = note: `NonBig` must be initialized inside its custom valid range error: the type `&'static i32` does not permit zero-initialization --> $DIR/uninitialized-zeroed.rs:84:34 @@ -397,7 +397,7 @@ LL | let _val: NonZeroU32 = mem::transmute(0); | this code causes undefined behavior when executed | help: use `MaybeUninit` instead, and only call `assume_init` after initialization is done | - = note: std::num::NonZeroU32 must be non-null + = note: `std::num::NonZeroU32` must be non-null error: the type `std::ptr::NonNull` does not permit zero-initialization --> $DIR/uninitialized-zeroed.rs:89:34 @@ -408,7 +408,7 @@ LL | let _val: NonNull = MaybeUninit::zeroed().assume_init(); | this code causes undefined behavior when executed | help: use `MaybeUninit` instead, and only call `assume_init` after initialization is done | - = note: std::ptr::NonNull must be non-null + = note: `std::ptr::NonNull` must be non-null error: the type `std::ptr::NonNull` does not permit being left uninitialized --> $DIR/uninitialized-zeroed.rs:90:34 @@ -419,7 +419,7 @@ LL | let _val: NonNull = MaybeUninit::uninit().assume_init(); | this code causes undefined behavior when executed | help: use `MaybeUninit` instead, and only call `assume_init` after initialization is done | - = note: std::ptr::NonNull must be non-null + = note: `std::ptr::NonNull` must be non-null error: the type `bool` does not permit being left uninitialized --> $DIR/uninitialized-zeroed.rs:91:26 diff --git a/src/test/ui/malformed/malformed-interpolated.stderr b/src/test/ui/malformed/malformed-interpolated.stderr index bcd2ef545d815..6f6ad4508be01 100644 --- a/src/test/ui/malformed/malformed-interpolated.stderr +++ b/src/test/ui/malformed/malformed-interpolated.stderr @@ -4,7 +4,7 @@ error: suffixed literals are not allowed in attributes LL | check!(0u8); | ^^^ | - = help: instead of using a suffixed literal (1u8, 1.0f32, etc.), use an unsuffixed version (1, 1.0, etc.). + = help: instead of using a suffixed literal (`1u8`, `1.0f32`, etc.), use an unsuffixed version (`1`, `1.0`, etc.) error: unexpected token: `-0` --> $DIR/malformed-interpolated.rs:5:25 diff --git a/src/test/ui/module-macro_use-arguments.rs b/src/test/ui/module-macro_use-arguments.rs index 6627b48eb6a2c..121b492e25437 100644 --- a/src/test/ui/module-macro_use-arguments.rs +++ b/src/test/ui/module-macro_use-arguments.rs @@ -1,4 +1,4 @@ -#[macro_use(foo, bar)] //~ ERROR arguments to macro_use are not allowed here +#[macro_use(foo, bar)] //~ ERROR arguments to `macro_use` are not allowed here mod foo { } diff --git a/src/test/ui/module-macro_use-arguments.stderr b/src/test/ui/module-macro_use-arguments.stderr index 2a75736a2c69f..af799cb6ddf3e 100644 --- a/src/test/ui/module-macro_use-arguments.stderr +++ b/src/test/ui/module-macro_use-arguments.stderr @@ -1,4 +1,4 @@ -error: arguments to macro_use are not allowed here +error: arguments to `macro_use` are not allowed here --> $DIR/module-macro_use-arguments.rs:1:1 | LL | #[macro_use(foo, bar)] diff --git a/src/test/ui/suffixed-literal-meta.stderr b/src/test/ui/suffixed-literal-meta.stderr index ee35b53abe111..84fe91d662a8b 100644 --- a/src/test/ui/suffixed-literal-meta.stderr +++ b/src/test/ui/suffixed-literal-meta.stderr @@ -4,7 +4,7 @@ error: suffixed literals are not allowed in attributes LL | #[rustc_dummy = 1usize] | ^^^^^^ | - = help: instead of using a suffixed literal (1u8, 1.0f32, etc.), use an unsuffixed version (1, 1.0, etc.). + = help: instead of using a suffixed literal (`1u8`, `1.0f32`, etc.), use an unsuffixed version (`1`, `1.0`, etc.) error: suffixed literals are not allowed in attributes --> $DIR/suffixed-literal-meta.rs:5:17 @@ -12,7 +12,7 @@ error: suffixed literals are not allowed in attributes LL | #[rustc_dummy = 1u8] | ^^^ | - = help: instead of using a suffixed literal (1u8, 1.0f32, etc.), use an unsuffixed version (1, 1.0, etc.). + = help: instead of using a suffixed literal (`1u8`, `1.0f32`, etc.), use an unsuffixed version (`1`, `1.0`, etc.) error: suffixed literals are not allowed in attributes --> $DIR/suffixed-literal-meta.rs:7:17 @@ -20,7 +20,7 @@ error: suffixed literals are not allowed in attributes LL | #[rustc_dummy = 1u16] | ^^^^ | - = help: instead of using a suffixed literal (1u8, 1.0f32, etc.), use an unsuffixed version (1, 1.0, etc.). + = help: instead of using a suffixed literal (`1u8`, `1.0f32`, etc.), use an unsuffixed version (`1`, `1.0`, etc.) error: suffixed literals are not allowed in attributes --> $DIR/suffixed-literal-meta.rs:9:17 @@ -28,7 +28,7 @@ error: suffixed literals are not allowed in attributes LL | #[rustc_dummy = 1u32] | ^^^^ | - = help: instead of using a suffixed literal (1u8, 1.0f32, etc.), use an unsuffixed version (1, 1.0, etc.). + = help: instead of using a suffixed literal (`1u8`, `1.0f32`, etc.), use an unsuffixed version (`1`, `1.0`, etc.) error: suffixed literals are not allowed in attributes --> $DIR/suffixed-literal-meta.rs:11:17 @@ -36,7 +36,7 @@ error: suffixed literals are not allowed in attributes LL | #[rustc_dummy = 1u64] | ^^^^ | - = help: instead of using a suffixed literal (1u8, 1.0f32, etc.), use an unsuffixed version (1, 1.0, etc.). + = help: instead of using a suffixed literal (`1u8`, `1.0f32`, etc.), use an unsuffixed version (`1`, `1.0`, etc.) error: suffixed literals are not allowed in attributes --> $DIR/suffixed-literal-meta.rs:13:17 @@ -44,7 +44,7 @@ error: suffixed literals are not allowed in attributes LL | #[rustc_dummy = 1isize] | ^^^^^^ | - = help: instead of using a suffixed literal (1u8, 1.0f32, etc.), use an unsuffixed version (1, 1.0, etc.). + = help: instead of using a suffixed literal (`1u8`, `1.0f32`, etc.), use an unsuffixed version (`1`, `1.0`, etc.) error: suffixed literals are not allowed in attributes --> $DIR/suffixed-literal-meta.rs:15:17 @@ -52,7 +52,7 @@ error: suffixed literals are not allowed in attributes LL | #[rustc_dummy = 1i8] | ^^^ | - = help: instead of using a suffixed literal (1u8, 1.0f32, etc.), use an unsuffixed version (1, 1.0, etc.). + = help: instead of using a suffixed literal (`1u8`, `1.0f32`, etc.), use an unsuffixed version (`1`, `1.0`, etc.) error: suffixed literals are not allowed in attributes --> $DIR/suffixed-literal-meta.rs:17:17 @@ -60,7 +60,7 @@ error: suffixed literals are not allowed in attributes LL | #[rustc_dummy = 1i16] | ^^^^ | - = help: instead of using a suffixed literal (1u8, 1.0f32, etc.), use an unsuffixed version (1, 1.0, etc.). + = help: instead of using a suffixed literal (`1u8`, `1.0f32`, etc.), use an unsuffixed version (`1`, `1.0`, etc.) error: suffixed literals are not allowed in attributes --> $DIR/suffixed-literal-meta.rs:19:17 @@ -68,7 +68,7 @@ error: suffixed literals are not allowed in attributes LL | #[rustc_dummy = 1i32] | ^^^^ | - = help: instead of using a suffixed literal (1u8, 1.0f32, etc.), use an unsuffixed version (1, 1.0, etc.). + = help: instead of using a suffixed literal (`1u8`, `1.0f32`, etc.), use an unsuffixed version (`1`, `1.0`, etc.) error: suffixed literals are not allowed in attributes --> $DIR/suffixed-literal-meta.rs:21:17 @@ -76,7 +76,7 @@ error: suffixed literals are not allowed in attributes LL | #[rustc_dummy = 1i64] | ^^^^ | - = help: instead of using a suffixed literal (1u8, 1.0f32, etc.), use an unsuffixed version (1, 1.0, etc.). + = help: instead of using a suffixed literal (`1u8`, `1.0f32`, etc.), use an unsuffixed version (`1`, `1.0`, etc.) error: suffixed literals are not allowed in attributes --> $DIR/suffixed-literal-meta.rs:23:17 @@ -84,7 +84,7 @@ error: suffixed literals are not allowed in attributes LL | #[rustc_dummy = 1.0f32] | ^^^^^^ | - = help: instead of using a suffixed literal (1u8, 1.0f32, etc.), use an unsuffixed version (1, 1.0, etc.). + = help: instead of using a suffixed literal (`1u8`, `1.0f32`, etc.), use an unsuffixed version (`1`, `1.0`, etc.) error: suffixed literals are not allowed in attributes --> $DIR/suffixed-literal-meta.rs:25:17 @@ -92,7 +92,7 @@ error: suffixed literals are not allowed in attributes LL | #[rustc_dummy = 1.0f64] | ^^^^^^ | - = help: instead of using a suffixed literal (1u8, 1.0f32, etc.), use an unsuffixed version (1, 1.0, etc.). + = help: instead of using a suffixed literal (`1u8`, `1.0f32`, etc.), use an unsuffixed version (`1`, `1.0`, etc.) error: suffixed literals are not allowed in attributes --> $DIR/suffixed-literal-meta.rs:3:17 @@ -100,7 +100,7 @@ error: suffixed literals are not allowed in attributes LL | #[rustc_dummy = 1usize] | ^^^^^^ | - = help: instead of using a suffixed literal (1u8, 1.0f32, etc.), use an unsuffixed version (1, 1.0, etc.). + = help: instead of using a suffixed literal (`1u8`, `1.0f32`, etc.), use an unsuffixed version (`1`, `1.0`, etc.) error: suffixed literals are not allowed in attributes --> $DIR/suffixed-literal-meta.rs:5:17 @@ -108,7 +108,7 @@ error: suffixed literals are not allowed in attributes LL | #[rustc_dummy = 1u8] | ^^^ | - = help: instead of using a suffixed literal (1u8, 1.0f32, etc.), use an unsuffixed version (1, 1.0, etc.). + = help: instead of using a suffixed literal (`1u8`, `1.0f32`, etc.), use an unsuffixed version (`1`, `1.0`, etc.) error: suffixed literals are not allowed in attributes --> $DIR/suffixed-literal-meta.rs:7:17 @@ -116,7 +116,7 @@ error: suffixed literals are not allowed in attributes LL | #[rustc_dummy = 1u16] | ^^^^ | - = help: instead of using a suffixed literal (1u8, 1.0f32, etc.), use an unsuffixed version (1, 1.0, etc.). + = help: instead of using a suffixed literal (`1u8`, `1.0f32`, etc.), use an unsuffixed version (`1`, `1.0`, etc.) error: suffixed literals are not allowed in attributes --> $DIR/suffixed-literal-meta.rs:9:17 @@ -124,7 +124,7 @@ error: suffixed literals are not allowed in attributes LL | #[rustc_dummy = 1u32] | ^^^^ | - = help: instead of using a suffixed literal (1u8, 1.0f32, etc.), use an unsuffixed version (1, 1.0, etc.). + = help: instead of using a suffixed literal (`1u8`, `1.0f32`, etc.), use an unsuffixed version (`1`, `1.0`, etc.) error: suffixed literals are not allowed in attributes --> $DIR/suffixed-literal-meta.rs:11:17 @@ -132,7 +132,7 @@ error: suffixed literals are not allowed in attributes LL | #[rustc_dummy = 1u64] | ^^^^ | - = help: instead of using a suffixed literal (1u8, 1.0f32, etc.), use an unsuffixed version (1, 1.0, etc.). + = help: instead of using a suffixed literal (`1u8`, `1.0f32`, etc.), use an unsuffixed version (`1`, `1.0`, etc.) error: suffixed literals are not allowed in attributes --> $DIR/suffixed-literal-meta.rs:13:17 @@ -140,7 +140,7 @@ error: suffixed literals are not allowed in attributes LL | #[rustc_dummy = 1isize] | ^^^^^^ | - = help: instead of using a suffixed literal (1u8, 1.0f32, etc.), use an unsuffixed version (1, 1.0, etc.). + = help: instead of using a suffixed literal (`1u8`, `1.0f32`, etc.), use an unsuffixed version (`1`, `1.0`, etc.) error: suffixed literals are not allowed in attributes --> $DIR/suffixed-literal-meta.rs:15:17 @@ -148,7 +148,7 @@ error: suffixed literals are not allowed in attributes LL | #[rustc_dummy = 1i8] | ^^^ | - = help: instead of using a suffixed literal (1u8, 1.0f32, etc.), use an unsuffixed version (1, 1.0, etc.). + = help: instead of using a suffixed literal (`1u8`, `1.0f32`, etc.), use an unsuffixed version (`1`, `1.0`, etc.) error: suffixed literals are not allowed in attributes --> $DIR/suffixed-literal-meta.rs:17:17 @@ -156,7 +156,7 @@ error: suffixed literals are not allowed in attributes LL | #[rustc_dummy = 1i16] | ^^^^ | - = help: instead of using a suffixed literal (1u8, 1.0f32, etc.), use an unsuffixed version (1, 1.0, etc.). + = help: instead of using a suffixed literal (`1u8`, `1.0f32`, etc.), use an unsuffixed version (`1`, `1.0`, etc.) error: suffixed literals are not allowed in attributes --> $DIR/suffixed-literal-meta.rs:19:17 @@ -164,7 +164,7 @@ error: suffixed literals are not allowed in attributes LL | #[rustc_dummy = 1i32] | ^^^^ | - = help: instead of using a suffixed literal (1u8, 1.0f32, etc.), use an unsuffixed version (1, 1.0, etc.). + = help: instead of using a suffixed literal (`1u8`, `1.0f32`, etc.), use an unsuffixed version (`1`, `1.0`, etc.) error: suffixed literals are not allowed in attributes --> $DIR/suffixed-literal-meta.rs:21:17 @@ -172,7 +172,7 @@ error: suffixed literals are not allowed in attributes LL | #[rustc_dummy = 1i64] | ^^^^ | - = help: instead of using a suffixed literal (1u8, 1.0f32, etc.), use an unsuffixed version (1, 1.0, etc.). + = help: instead of using a suffixed literal (`1u8`, `1.0f32`, etc.), use an unsuffixed version (`1`, `1.0`, etc.) error: suffixed literals are not allowed in attributes --> $DIR/suffixed-literal-meta.rs:23:17 @@ -180,7 +180,7 @@ error: suffixed literals are not allowed in attributes LL | #[rustc_dummy = 1.0f32] | ^^^^^^ | - = help: instead of using a suffixed literal (1u8, 1.0f32, etc.), use an unsuffixed version (1, 1.0, etc.). + = help: instead of using a suffixed literal (`1u8`, `1.0f32`, etc.), use an unsuffixed version (`1`, `1.0`, etc.) error: suffixed literals are not allowed in attributes --> $DIR/suffixed-literal-meta.rs:25:17 @@ -188,7 +188,7 @@ error: suffixed literals are not allowed in attributes LL | #[rustc_dummy = 1.0f64] | ^^^^^^ | - = help: instead of using a suffixed literal (1u8, 1.0f32, etc.), use an unsuffixed version (1, 1.0, etc.). + = help: instead of using a suffixed literal (`1u8`, `1.0f32`, etc.), use an unsuffixed version (`1`, `1.0`, etc.) error: aborting due to 24 previous errors diff --git a/src/test/ui/unboxed-closures/unboxed-closures-static-call-wrong-trait.stderr b/src/test/ui/unboxed-closures/unboxed-closures-static-call-wrong-trait.stderr index 2d058521e4ef6..0b6d94e71f0c7 100644 --- a/src/test/ui/unboxed-closures/unboxed-closures-static-call-wrong-trait.stderr +++ b/src/test/ui/unboxed-closures/unboxed-closures-static-call-wrong-trait.stderr @@ -4,7 +4,7 @@ error[E0599]: no method named `call` found for closure `[closure@$DIR/unboxed-cl LL | mut_.call((0, )); | ^^^^ method not found in `[closure@$DIR/unboxed-closures-static-call-wrong-trait.rs:6:26: 6:31]` | - = note: mut_ is a function, perhaps you wish to call it + = note: `mut_` is a function, perhaps you wish to call it error: aborting due to previous error From 3de9b8a3b7963b2eb03d570b54055b0a895662f1 Mon Sep 17 00:00:00 2001 From: varkor Date: Fri, 10 Jan 2020 15:13:56 +0000 Subject: [PATCH 05/16] Fix formatting ellipses at the end of some diagnostics --- src/librustc_parse/parser/pat.rs | 4 ++-- src/librustc_resolve/build_reduced_graph.rs | 2 +- .../deprecated-macro_escape-inner.stderr | 2 +- ...92-tuple-destructure-missing-parens.stderr | 24 +++++++++---------- ...issue-43106-gating-of-builtin-attrs.stderr | 2 +- .../issue-43106-gating-of-macro_escape.stderr | 2 +- 6 files changed, 18 insertions(+), 18 deletions(-) diff --git a/src/librustc_parse/parser/pat.rs b/src/librustc_parse/parser/pat.rs index 0c2cfc20daf0f..549acf67d3824 100644 --- a/src/librustc_parse/parser/pat.rs +++ b/src/librustc_parse/parser/pat.rs @@ -209,13 +209,13 @@ impl<'a> Parser<'a> { if let Ok(seq_snippet) = self.span_to_snippet(seq_span) { err.span_suggestion( seq_span, - "try adding parentheses to match on a tuple..", + "try adding parentheses to match on a tuple...", format!("({})", seq_snippet), Applicability::MachineApplicable, ) .span_suggestion( seq_span, - "..or a vertical bar to match on multiple alternatives", + "...or a vertical bar to match on multiple alternatives", format!("{}", seq_snippet.replace(",", " |")), Applicability::MachineApplicable, ); diff --git a/src/librustc_resolve/build_reduced_graph.rs b/src/librustc_resolve/build_reduced_graph.rs index 9c80df367c09c..e8ed64a18702d 100644 --- a/src/librustc_resolve/build_reduced_graph.rs +++ b/src/librustc_resolve/build_reduced_graph.rs @@ -1057,7 +1057,7 @@ impl<'a, 'b> BuildReducedGraphVisitor<'a, 'b> { let msg = "`#[macro_escape]` is a deprecated synonym for `#[macro_use]`"; let mut err = self.r.session.struct_span_warn(attr.span, msg); if let ast::AttrStyle::Inner = attr.style { - err.help("consider an outer attribute, `#[macro_use]` mod ...").emit(); + err.help("try an outer attribute: `#[macro_use]`").emit(); } else { err.emit(); } diff --git a/src/test/ui/deprecation/deprecated-macro_escape-inner.stderr b/src/test/ui/deprecation/deprecated-macro_escape-inner.stderr index 65db62ce26355..4b0fc07463a99 100644 --- a/src/test/ui/deprecation/deprecated-macro_escape-inner.stderr +++ b/src/test/ui/deprecation/deprecated-macro_escape-inner.stderr @@ -4,5 +4,5 @@ warning: `#[macro_escape]` is a deprecated synonym for `#[macro_use]` LL | #![macro_escape] | ^^^^^^^^^^^^^^^^ | - = help: consider an outer attribute, `#[macro_use]` mod ... + = help: try an outer attribute: `#[macro_use]` diff --git a/src/test/ui/did_you_mean/issue-48492-tuple-destructure-missing-parens.stderr b/src/test/ui/did_you_mean/issue-48492-tuple-destructure-missing-parens.stderr index 705c90985d547..d05d6d120b084 100644 --- a/src/test/ui/did_you_mean/issue-48492-tuple-destructure-missing-parens.stderr +++ b/src/test/ui/did_you_mean/issue-48492-tuple-destructure-missing-parens.stderr @@ -4,11 +4,11 @@ error: unexpected `,` in pattern LL | while let b1, b2, b3 = reading_frame.next().expect("there should be a start codon") { | ^ | -help: try adding parentheses to match on a tuple.. +help: try adding parentheses to match on a tuple... | LL | while let (b1, b2, b3) = reading_frame.next().expect("there should be a start codon") { | ^^^^^^^^^^^^ -help: ..or a vertical bar to match on multiple alternatives +help: ...or a vertical bar to match on multiple alternatives | LL | while let b1 | b2 | b3 = reading_frame.next().expect("there should be a start codon") { | ^^^^^^^^^^^^ @@ -19,11 +19,11 @@ error: unexpected `,` in pattern LL | if let b1, b2, b3 = reading_frame.next().unwrap() { | ^ | -help: try adding parentheses to match on a tuple.. +help: try adding parentheses to match on a tuple... | LL | if let (b1, b2, b3) = reading_frame.next().unwrap() { | ^^^^^^^^^^^^ -help: ..or a vertical bar to match on multiple alternatives +help: ...or a vertical bar to match on multiple alternatives | LL | if let b1 | b2 | b3 = reading_frame.next().unwrap() { | ^^^^^^^^^^^^ @@ -34,11 +34,11 @@ error: unexpected `,` in pattern LL | Nucleotide::Adenine, Nucleotide::Cytosine, _ => true | ^ | -help: try adding parentheses to match on a tuple.. +help: try adding parentheses to match on a tuple... | LL | (Nucleotide::Adenine, Nucleotide::Cytosine, _) => true | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -help: ..or a vertical bar to match on multiple alternatives +help: ...or a vertical bar to match on multiple alternatives | LL | Nucleotide::Adenine | Nucleotide::Cytosine | _ => true | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -49,11 +49,11 @@ error: unexpected `,` in pattern LL | for x, _barr_body in women.iter().map(|woman| woman.allosomes.clone()) { | ^ | -help: try adding parentheses to match on a tuple.. +help: try adding parentheses to match on a tuple... | LL | for (x, _barr_body) in women.iter().map(|woman| woman.allosomes.clone()) { | ^^^^^^^^^^^^^^^ -help: ..or a vertical bar to match on multiple alternatives +help: ...or a vertical bar to match on multiple alternatives | LL | for x | _barr_body in women.iter().map(|woman| woman.allosomes.clone()) { | ^^^^^^^^^^^^^^ @@ -64,11 +64,11 @@ error: unexpected `,` in pattern LL | for x, y @ Allosome::Y(_) in men.iter().map(|man| man.allosomes.clone()) { | ^ | -help: try adding parentheses to match on a tuple.. +help: try adding parentheses to match on a tuple... | LL | for (x, y @ Allosome::Y(_)) in men.iter().map(|man| man.allosomes.clone()) { | ^^^^^^^^^^^^^^^^^^^^^^^ -help: ..or a vertical bar to match on multiple alternatives +help: ...or a vertical bar to match on multiple alternatives | LL | for x | y @ Allosome::Y(_) in men.iter().map(|man| man.allosomes.clone()) { | ^^^^^^^^^^^^^^^^^^^^^^ @@ -79,11 +79,11 @@ error: unexpected `,` in pattern LL | let women, men: (Vec, Vec) = genomes.iter().cloned() | ^ | -help: try adding parentheses to match on a tuple.. +help: try adding parentheses to match on a tuple... | LL | let (women, men): (Vec, Vec) = genomes.iter().cloned() | ^^^^^^^^^^^^ -help: ..or a vertical bar to match on multiple alternatives +help: ...or a vertical bar to match on multiple alternatives | LL | let women | men: (Vec, Vec) = genomes.iter().cloned() | ^^^^^^^^^^^ diff --git a/src/test/ui/feature-gate/issue-43106-gating-of-builtin-attrs.stderr b/src/test/ui/feature-gate/issue-43106-gating-of-builtin-attrs.stderr index 6063aabd565bc..da7d8f9bee5c5 100644 --- a/src/test/ui/feature-gate/issue-43106-gating-of-builtin-attrs.stderr +++ b/src/test/ui/feature-gate/issue-43106-gating-of-builtin-attrs.stderr @@ -184,7 +184,7 @@ warning: `#[macro_escape]` is a deprecated synonym for `#[macro_use]` LL | mod inner { #![macro_escape] } | ^^^^^^^^^^^^^^^^ | - = help: consider an outer attribute, `#[macro_use]` mod ... + = help: try an outer attribute: `#[macro_use]` warning: use of deprecated attribute `plugin_registrar`: compiler plugins are deprecated. See https://github.com/rust-lang/rust/pull/64675 --> $DIR/issue-43106-gating-of-builtin-attrs.rs:221:17 diff --git a/src/test/ui/feature-gate/issue-43106-gating-of-macro_escape.stderr b/src/test/ui/feature-gate/issue-43106-gating-of-macro_escape.stderr index f2cc2f74e53e4..402dc4e540925 100644 --- a/src/test/ui/feature-gate/issue-43106-gating-of-macro_escape.stderr +++ b/src/test/ui/feature-gate/issue-43106-gating-of-macro_escape.stderr @@ -4,5 +4,5 @@ warning: `#[macro_escape]` is a deprecated synonym for `#[macro_use]` LL | #![macro_escape] | ^^^^^^^^^^^^^^^^ | - = help: consider an outer attribute, `#[macro_use]` mod ... + = help: try an outer attribute: `#[macro_use]` From 117443ec0ad7aefabbc20c3f23f90e14b2b43c05 Mon Sep 17 00:00:00 2001 From: varkor Date: Fri, 10 Jan 2020 16:27:37 +0000 Subject: [PATCH 06/16] Appease tidy --- src/test/ui/resolve/impl-items-vis-unresolved.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/test/ui/resolve/impl-items-vis-unresolved.rs b/src/test/ui/resolve/impl-items-vis-unresolved.rs index a124b4eff8f69..1494c1cf96800 100644 --- a/src/test/ui/resolve/impl-items-vis-unresolved.rs +++ b/src/test/ui/resolve/impl-items-vis-unresolved.rs @@ -18,7 +18,8 @@ mod state { pub struct RawFloatState; impl RawFloatState { perftools_inline! { - pub(super) fn new() {} //~ ERROR failed to resolve: there are too many leading `super` keywords + pub(super) fn new() {} + //~^ ERROR failed to resolve: there are too many leading `super` keywords } } From 1faa05daac8069503a0ffbba735db3b259424296 Mon Sep 17 00:00:00 2001 From: varkor Date: Fri, 10 Jan 2020 18:24:34 +0000 Subject: [PATCH 07/16] Update `output-default.json` and rustdoc test --- src/test/run-make-fulldeps/libtest-json/output-default.json | 2 +- .../run-make-fulldeps/libtest-json/output-stdout-success.json | 2 +- src/test/rustdoc-ui/failed-doctest-output.stdout | 2 +- src/test/ui/resolve/impl-items-vis-unresolved.stderr | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/test/run-make-fulldeps/libtest-json/output-default.json b/src/test/run-make-fulldeps/libtest-json/output-default.json index 8046d72221703..0cd9ab79e32f3 100644 --- a/src/test/run-make-fulldeps/libtest-json/output-default.json +++ b/src/test/run-make-fulldeps/libtest-json/output-default.json @@ -2,7 +2,7 @@ { "type": "test", "event": "started", "name": "a" } { "type": "test", "name": "a", "event": "ok" } { "type": "test", "event": "started", "name": "b" } -{ "type": "test", "name": "b", "event": "failed", "stdout": "thread 'main' panicked at 'assertion failed: false', f.rs:9:5\nnote: run with `RUST_BACKTRACE=1` environment variable to display a backtrace.\n" } +{ "type": "test", "name": "b", "event": "failed", "stdout": "thread 'main' panicked at 'assertion failed: false', f.rs:9:5\nnote: run with `RUST_BACKTRACE=1` environment variable to display a backtrace\n" } { "type": "test", "event": "started", "name": "c" } { "type": "test", "name": "c", "event": "ok" } { "type": "test", "event": "started", "name": "d" } diff --git a/src/test/run-make-fulldeps/libtest-json/output-stdout-success.json b/src/test/run-make-fulldeps/libtest-json/output-stdout-success.json index 303316278d8ab..dfaf005052e55 100644 --- a/src/test/run-make-fulldeps/libtest-json/output-stdout-success.json +++ b/src/test/run-make-fulldeps/libtest-json/output-stdout-success.json @@ -2,7 +2,7 @@ { "type": "test", "event": "started", "name": "a" } { "type": "test", "name": "a", "event": "ok", "stdout": "print from successful test\n" } { "type": "test", "event": "started", "name": "b" } -{ "type": "test", "name": "b", "event": "failed", "stdout": "thread 'main' panicked at 'assertion failed: false', f.rs:9:5\nnote: run with `RUST_BACKTRACE=1` environment variable to display a backtrace.\n" } +{ "type": "test", "name": "b", "event": "failed", "stdout": "thread 'main' panicked at 'assertion failed: false', f.rs:9:5\nnote: run with `RUST_BACKTRACE=1` environment variable to display a backtrace\n" } { "type": "test", "event": "started", "name": "c" } { "type": "test", "name": "c", "event": "ok", "stdout": "thread 'main' panicked at 'assertion failed: false', f.rs:15:5\n" } { "type": "test", "event": "started", "name": "d" } diff --git a/src/test/rustdoc-ui/failed-doctest-output.stdout b/src/test/rustdoc-ui/failed-doctest-output.stdout index 9887d07a3eb6e..ee79ae1a690ec 100644 --- a/src/test/rustdoc-ui/failed-doctest-output.stdout +++ b/src/test/rustdoc-ui/failed-doctest-output.stdout @@ -27,7 +27,7 @@ stderr: stderr 1 stderr 2 thread 'main' panicked at 'oh no', $DIR/failed-doctest-output.rs:7:1 -note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace. +note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace diff --git a/src/test/ui/resolve/impl-items-vis-unresolved.stderr b/src/test/ui/resolve/impl-items-vis-unresolved.stderr index 62cffe55f9fb6..f2293d28ea151 100644 --- a/src/test/ui/resolve/impl-items-vis-unresolved.stderr +++ b/src/test/ui/resolve/impl-items-vis-unresolved.stderr @@ -2,7 +2,7 @@ error[E0433]: failed to resolve: there are too many leading `super` keywords --> $DIR/impl-items-vis-unresolved.rs:21:13 | LL | pub(super) fn new() {} - | ^^^^^ there are too many leading `super` keywords. + | ^^^^^ there are too many leading `super` keywords error: aborting due to previous error From 9908a8736736fe3b7c416eb4560de87c15d10f47 Mon Sep 17 00:00:00 2001 From: Camille GILLOT Date: Mon, 13 Jan 2020 13:40:30 +0100 Subject: [PATCH 08/16] Move to new crate rustc_ty. --- Cargo.lock | 12 +++++++++++ src/librustc_interface/Cargo.toml | 1 + src/librustc_passes/lib.rs | 2 -- src/librustc_ty/Cargo.toml | 16 ++++++++++++++ src/librustc_ty/lib.rs | 25 ++++++++++++++++++++++ src/{librustc_passes => librustc_ty}/ty.rs | 0 6 files changed, 54 insertions(+), 2 deletions(-) create mode 100644 src/librustc_ty/Cargo.toml create mode 100644 src/librustc_ty/lib.rs rename src/{librustc_passes => librustc_ty}/ty.rs (100%) diff --git a/Cargo.lock b/Cargo.lock index 54ad60e71506b..14e41ca209625 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3642,6 +3642,7 @@ dependencies = [ "rustc_span", "rustc_target", "rustc_traits", + "rustc_ty", "rustc_typeck", "serialize", "smallvec 1.0.0", @@ -3918,6 +3919,17 @@ dependencies = [ "syntax", ] +[[package]] +name = "rustc_ty" +version = "0.0.0" +dependencies = [ + "log", + "rustc", + "rustc_data_structures", + "rustc_hir", + "rustc_span", +] + [[package]] name = "rustc_typeck" version = "0.0.0" diff --git a/src/librustc_interface/Cargo.toml b/src/librustc_interface/Cargo.toml index eb0551c606548..c7d387caa2d1d 100644 --- a/src/librustc_interface/Cargo.toml +++ b/src/librustc_interface/Cargo.toml @@ -39,6 +39,7 @@ rustc_errors = { path = "../librustc_errors" } rustc_plugin_impl = { path = "../librustc_plugin_impl" } rustc_privacy = { path = "../librustc_privacy" } rustc_resolve = { path = "../librustc_resolve" } +rustc_ty = { path = "../librustc_ty" } tempfile = "3.0.5" once_cell = "1" diff --git a/src/librustc_passes/lib.rs b/src/librustc_passes/lib.rs index 8bd06465628fa..c45f83f213078 100644 --- a/src/librustc_passes/lib.rs +++ b/src/librustc_passes/lib.rs @@ -31,7 +31,6 @@ pub mod loops; mod reachable; mod region; pub mod stability; -mod ty; pub fn provide(providers: &mut Providers<'_>) { check_const::provide(providers); @@ -44,5 +43,4 @@ pub fn provide(providers: &mut Providers<'_>) { reachable::provide(providers); region::provide(providers); stability::provide(providers); - ty::provide(providers); } diff --git a/src/librustc_ty/Cargo.toml b/src/librustc_ty/Cargo.toml new file mode 100644 index 0000000000000..fb0d93fe5ebb6 --- /dev/null +++ b/src/librustc_ty/Cargo.toml @@ -0,0 +1,16 @@ +[package] +authors = ["The Rust Project Developers"] +name = "rustc_ty" +version = "0.0.0" +edition = "2018" + +[lib] +name = "rustc_ty" +path = "lib.rs" + +[dependencies] +log = "0.4" +rustc = { path = "../librustc" } +rustc_data_structures = { path = "../librustc_data_structures" } +rustc_hir = { path = "../librustc_hir" } +rustc_span = { path = "../librustc_span" } diff --git a/src/librustc_ty/lib.rs b/src/librustc_ty/lib.rs new file mode 100644 index 0000000000000..2548d2cff9766 --- /dev/null +++ b/src/librustc_ty/lib.rs @@ -0,0 +1,25 @@ +//! Various checks +//! +//! # Note +//! +//! This API is completely unstable and subject to change. + +#![doc(html_root_url = "https://doc.rust-lang.org/nightly/")] +#![feature(bool_to_option)] +#![feature(in_band_lifetimes)] +#![feature(nll)] +#![feature(slice_patterns)] +#![recursion_limit = "256"] + +#[macro_use] +extern crate rustc; +#[macro_use] +extern crate log; + +use rustc::ty::query::Providers; + +mod ty; + +pub fn provide(providers: &mut Providers<'_>) { + ty::provide(providers); +} diff --git a/src/librustc_passes/ty.rs b/src/librustc_ty/ty.rs similarity index 100% rename from src/librustc_passes/ty.rs rename to src/librustc_ty/ty.rs From 894dc2d3d2b96e1f992324aa95125e0d161ab681 Mon Sep 17 00:00:00 2001 From: Camille GILLOT Date: Mon, 13 Jan 2020 15:36:05 +0100 Subject: [PATCH 09/16] Do not forget to provide queries. --- src/librustc_interface/passes.rs | 1 + src/librustc_passes/lib.rs | 1 - 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/src/librustc_interface/passes.rs b/src/librustc_interface/passes.rs index 9119466cbc048..787d9a8ed77d7 100644 --- a/src/librustc_interface/passes.rs +++ b/src/librustc_interface/passes.rs @@ -677,6 +677,7 @@ pub fn default_provide(providers: &mut ty::query::Providers<'_>) { rustc_passes::provide(providers); rustc_resolve::provide(providers); rustc_traits::provide(providers); + rustc_ty::provide(providers); rustc_metadata::provide(providers); rustc_lint::provide(providers); rustc_codegen_utils::provide(providers); diff --git a/src/librustc_passes/lib.rs b/src/librustc_passes/lib.rs index c45f83f213078..65eb07b989d83 100644 --- a/src/librustc_passes/lib.rs +++ b/src/librustc_passes/lib.rs @@ -5,7 +5,6 @@ //! This API is completely unstable and subject to change. #![doc(html_root_url = "https://doc.rust-lang.org/nightly/")] -#![feature(bool_to_option)] #![feature(in_band_lifetimes)] #![feature(nll)] #![feature(slice_patterns)] From 33bc9ef513d632825ea600cfb4bb6d89f4a09269 Mon Sep 17 00:00:00 2001 From: SOFe Date: Wed, 15 Jan 2020 02:07:39 +0800 Subject: [PATCH 10/16] Use 3.6 instead of 3.5 in float fract() documentation MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit It is not self-explanatory whether the fract() function inverts the fractional part of negative numbers. Co-Authored-By: Mateusz MikuĊ‚a --- src/libstd/f32.rs | 8 ++++---- src/libstd/f64.rs | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/libstd/f32.rs b/src/libstd/f32.rs index 267d7013b1e42..209eea4a5ff73 100644 --- a/src/libstd/f32.rs +++ b/src/libstd/f32.rs @@ -131,10 +131,10 @@ impl f32 { /// ``` /// use std::f32; /// - /// let x = 3.5_f32; - /// let y = -3.5_f32; - /// let abs_difference_x = (x.fract() - 0.5).abs(); - /// let abs_difference_y = (y.fract() - (-0.5)).abs(); + /// let x = 3.6_f32; + /// let y = -3.6_f32; + /// let abs_difference_x = (x.fract() - 0.6).abs(); + /// let abs_difference_y = (y.fract() - (-0.6)).abs(); /// /// assert!(abs_difference_x <= f32::EPSILON); /// assert!(abs_difference_y <= f32::EPSILON); diff --git a/src/libstd/f64.rs b/src/libstd/f64.rs index 61ce7b29e26fc..15fbb911d043a 100644 --- a/src/libstd/f64.rs +++ b/src/libstd/f64.rs @@ -109,10 +109,10 @@ impl f64 { /// # Examples /// /// ``` - /// let x = 3.5_f64; - /// let y = -3.5_f64; - /// let abs_difference_x = (x.fract() - 0.5).abs(); - /// let abs_difference_y = (y.fract() - (-0.5)).abs(); + /// let x = 3.6_f64; + /// let y = -3.6_f64; + /// let abs_difference_x = (x.fract() - 0.6).abs(); + /// let abs_difference_y = (y.fract() - (-0.6)).abs(); /// /// assert!(abs_difference_x < 1e-10); /// assert!(abs_difference_y < 1e-10); From bf0a7845d7860c681a6d273697dd1ca9d1cda81a Mon Sep 17 00:00:00 2001 From: Yuki Okushi Date: Thu, 16 Jan 2020 10:55:29 +0900 Subject: [PATCH 11/16] Fix issue number of `member_constraints` --- .../unstable-book/src/language-features/member-constraints.md | 4 ++-- src/librustc_feature/active.rs | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/doc/unstable-book/src/language-features/member-constraints.md b/src/doc/unstable-book/src/language-features/member-constraints.md index 0d11c31aca6e9..3ba4a3e6b1f02 100644 --- a/src/doc/unstable-book/src/language-features/member-constraints.md +++ b/src/doc/unstable-book/src/language-features/member-constraints.md @@ -1,8 +1,8 @@ # `member_constraints` -The tracking issue for this feature is: [#61977] +The tracking issue for this feature is: [#61997] -[#61977]: https://github.com/rust-lang/rust/issues/61977 +[#61997]: https://github.com/rust-lang/rust/issues/61997 ------------------------ diff --git a/src/librustc_feature/active.rs b/src/librustc_feature/active.rs index 319cd88f24586..0d1d1f8254439 100644 --- a/src/librustc_feature/active.rs +++ b/src/librustc_feature/active.rs @@ -481,7 +481,7 @@ declare_features! ( (active, arbitrary_enum_discriminant, "1.37.0", Some(60553), None), /// Allows `impl Trait` with multiple unrelated lifetimes. - (active, member_constraints, "1.37.0", Some(61977), None), + (active, member_constraints, "1.37.0", Some(61997), None), /// Allows `async || body` closures. (active, async_closure, "1.37.0", Some(62290), None), From 54b961658ba73f04d3603c8f839c1e36a7f989e5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Str=C3=B8mberg?= Date: Thu, 16 Jan 2020 03:30:27 +0100 Subject: [PATCH 12/16] Update f32.rs --- src/libstd/f32.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libstd/f32.rs b/src/libstd/f32.rs index 267d7013b1e42..375624e6797a7 100644 --- a/src/libstd/f32.rs +++ b/src/libstd/f32.rs @@ -355,7 +355,7 @@ impl f32 { return unsafe { intrinsics::powf32(self, n) }; } - /// Takes the square root of a number. + /// Returns the square root of a number. /// /// Returns NaN if `self` is a negative number. /// From 3f337b312d0cfec712fc56539a08b3ea9923bbf7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Str=C3=B8mberg?= Date: Thu, 16 Jan 2020 03:34:23 +0100 Subject: [PATCH 13/16] Update f64.rs --- src/libstd/f64.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/libstd/f64.rs b/src/libstd/f64.rs index 61ce7b29e26fc..2dbd942f3324d 100644 --- a/src/libstd/f64.rs +++ b/src/libstd/f64.rs @@ -323,7 +323,7 @@ impl f64 { unsafe { intrinsics::powf64(self, n) } } - /// Takes the square root of a number. + /// Returns the square root of a number. /// /// Returns NaN if `self` is a negative number. /// @@ -506,7 +506,7 @@ impl f64 { unsafe { cmath::fdim(self, other) } } - /// Takes the cubic root of a number. + /// Returns the cubic root of a number. /// /// # Examples /// From d0db6d5791a75bb6e6f7ebe98067e78753fc1986 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Str=C3=B8mberg?= Date: Thu, 16 Jan 2020 03:35:31 +0100 Subject: [PATCH 14/16] Update f32.rs --- src/libstd/f32.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libstd/f32.rs b/src/libstd/f32.rs index 375624e6797a7..171891b5dabc0 100644 --- a/src/libstd/f32.rs +++ b/src/libstd/f32.rs @@ -564,7 +564,7 @@ impl f32 { unsafe { cmath::fdimf(self, other) } } - /// Takes the cubic root of a number. + /// Returns the cubic root of a number. /// /// # Examples /// From 49d8aebbf36a254f1d527b90c72f07b4d23b2687 Mon Sep 17 00:00:00 2001 From: Yuki Okushi Date: Thu, 16 Jan 2020 11:58:28 +0900 Subject: [PATCH 15/16] Fix issue number of `repr128` --- src/doc/unstable-book/src/language-features/repr128.md | 4 ++-- src/librustc_feature/active.rs | 2 +- src/test/ui/error-codes/E0658.stderr | 2 +- src/test/ui/feature-gates/feature-gate-repr128.stderr | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/doc/unstable-book/src/language-features/repr128.md b/src/doc/unstable-book/src/language-features/repr128.md index 0858988952c10..146f50ee67b50 100644 --- a/src/doc/unstable-book/src/language-features/repr128.md +++ b/src/doc/unstable-book/src/language-features/repr128.md @@ -1,8 +1,8 @@ # `repr128` -The tracking issue for this feature is: [#35118] +The tracking issue for this feature is: [#56071] -[#35118]: https://github.com/rust-lang/rust/issues/35118 +[#56071]: https://github.com/rust-lang/rust/issues/56071 ------------------------ diff --git a/src/librustc_feature/active.rs b/src/librustc_feature/active.rs index 0d1d1f8254439..4c8c47a567113 100644 --- a/src/librustc_feature/active.rs +++ b/src/librustc_feature/active.rs @@ -333,7 +333,7 @@ declare_features! ( (active, abi_ptx, "1.15.0", Some(38788), None), /// Allows the `#[repr(i128)]` attribute for enums. - (active, repr128, "1.16.0", Some(35118), None), + (active, repr128, "1.16.0", Some(56071), None), /// Allows `#[link(kind="static-nobundle"...)]`. (active, static_nobundle, "1.16.0", Some(37403), None), diff --git a/src/test/ui/error-codes/E0658.stderr b/src/test/ui/error-codes/E0658.stderr index 071dbccd80ba0..1cb81c8d778ec 100644 --- a/src/test/ui/error-codes/E0658.stderr +++ b/src/test/ui/error-codes/E0658.stderr @@ -6,7 +6,7 @@ LL | | Bar(u64), LL | | } | |_^ | - = note: for more information, see https://github.com/rust-lang/rust/issues/35118 + = note: for more information, see https://github.com/rust-lang/rust/issues/56071 = help: add `#![feature(repr128)]` to the crate attributes to enable error: aborting due to previous error diff --git a/src/test/ui/feature-gates/feature-gate-repr128.stderr b/src/test/ui/feature-gates/feature-gate-repr128.stderr index 2139a5da600df..e108d74e9c6cc 100644 --- a/src/test/ui/feature-gates/feature-gate-repr128.stderr +++ b/src/test/ui/feature-gates/feature-gate-repr128.stderr @@ -6,7 +6,7 @@ LL | | A(u64) LL | | } | |_^ | - = note: for more information, see https://github.com/rust-lang/rust/issues/35118 + = note: for more information, see https://github.com/rust-lang/rust/issues/56071 = help: add `#![feature(repr128)]` to the crate attributes to enable error: aborting due to previous error From 91c6a5aaeebacf444aba8d99cba0da945c0ce732 Mon Sep 17 00:00:00 2001 From: Yuki Okushi Date: Thu, 16 Jan 2020 11:59:04 +0900 Subject: [PATCH 16/16] Fix issue number of `infer_static_outlives_requirements` --- .../language-features/infer-static-outlives-requirements.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/doc/unstable-book/src/language-features/infer-static-outlives-requirements.md b/src/doc/unstable-book/src/language-features/infer-static-outlives-requirements.md index 6187f395b0498..53e01091f754e 100644 --- a/src/doc/unstable-book/src/language-features/infer-static-outlives-requirements.md +++ b/src/doc/unstable-book/src/language-features/infer-static-outlives-requirements.md @@ -1,8 +1,8 @@ # `infer_static_outlives_requirements` -The tracking issue for this feature is: [#44493] +The tracking issue for this feature is: [#54185] -[#44493]: https://github.com/rust-lang/rust/issues/44493 +[#54185]: https://github.com/rust-lang/rust/issues/54185 ------------------------ The `infer_static_outlives_requirements` feature indicates that certain