From a7a20860537ddd05f802598866681a6f9cc3413c Mon Sep 17 00:00:00 2001 From: Avi Dessauer Date: Sun, 17 May 2020 23:00:19 -0400 Subject: Stability annotations on generic trait parameters --- compiler/rustc_passes/src/stability.rs | 68 ++++++++++++++++++++++++++-------- 1 file changed, 52 insertions(+), 16 deletions(-) (limited to 'compiler/rustc_passes/src') diff --git a/compiler/rustc_passes/src/stability.rs b/compiler/rustc_passes/src/stability.rs index 4ca52f405fb..d658a58aeab 100644 --- a/compiler/rustc_passes/src/stability.rs +++ b/compiler/rustc_passes/src/stability.rs @@ -56,6 +56,7 @@ impl<'a, 'tcx> Annotator<'a, 'tcx> { attrs: &[Attribute], item_sp: Span, kind: AnnotationKind, + inherit_deprecation: bool, visit_children: F, ) where F: FnOnce(&mut Self), @@ -63,7 +64,7 @@ impl<'a, 'tcx> Annotator<'a, 'tcx> { debug!("annotate(id = {:?}, attrs = {:?})", hir_id, attrs); let mut did_error = false; if !self.tcx.features().staged_api { - did_error = self.forbid_staged_api_attrs(hir_id, attrs); + did_error = self.forbid_staged_api_attrs(hir_id, attrs, inherit_deprecation); } let depr = @@ -80,9 +81,11 @@ impl<'a, 'tcx> Annotator<'a, 'tcx> { let depr_entry = DeprecationEntry::local(depr.clone(), hir_id); self.index.depr_map.insert(hir_id, depr_entry); } else if let Some(parent_depr) = self.parent_depr.clone() { - is_deprecated = true; - info!("tagging child {:?} as deprecated from parent", hir_id); - self.index.depr_map.insert(hir_id, parent_depr); + if inherit_deprecation { + is_deprecated = true; + info!("tagging child {:?} as deprecated from parent", hir_id); + self.index.depr_map.insert(hir_id, parent_depr); + } } if self.tcx.features().staged_api { @@ -186,7 +189,7 @@ impl<'a, 'tcx> Annotator<'a, 'tcx> { if stab.is_none() { debug!("annotate: stab not found, parent = {:?}", self.parent_stab); if let Some(stab) = self.parent_stab { - if stab.level.is_unstable() { + if inherit_deprecation && stab.level.is_unstable() { self.index.stab_map.insert(hir_id, stab); } } @@ -237,7 +240,7 @@ impl<'a, 'tcx> Annotator<'a, 'tcx> { } // returns true if an error occurred, used to suppress some spurious errors - fn forbid_staged_api_attrs(&mut self, hir_id: HirId, attrs: &[Attribute]) -> bool { + fn forbid_staged_api_attrs(&mut self, hir_id: HirId, attrs: &[Attribute], inherit_deprecation: bool) -> bool { // Emit errors for non-staged-api crates. let unstable_attrs = [ sym::unstable, @@ -265,7 +268,7 @@ impl<'a, 'tcx> Annotator<'a, 'tcx> { // Propagate unstability. This can happen even for non-staged-api crates in case // -Zforce-unstable-if-unmarked is set. if let Some(stab) = self.parent_stab { - if stab.level.is_unstable() { + if inherit_deprecation && stab.level.is_unstable() { self.index.stab_map.insert(hir_id, stab); } } @@ -301,18 +304,25 @@ impl<'a, 'tcx> Visitor<'tcx> for Annotator<'a, 'tcx> { } hir::ItemKind::Struct(ref sd, _) => { if let Some(ctor_hir_id) = sd.ctor_hir_id() { - self.annotate(ctor_hir_id, &i.attrs, i.span, AnnotationKind::Required, |_| {}) + self.annotate( + ctor_hir_id, + &i.attrs, + i.span, + AnnotationKind::Required, + true, + |_| {}, + ) } } _ => {} } - self.annotate(i.hir_id, &i.attrs, i.span, kind, |v| intravisit::walk_item(v, i)); + self.annotate(i.hir_id, &i.attrs, i.span, kind, true, |v| intravisit::walk_item(v, i)); self.in_trait_impl = orig_in_trait_impl; } fn visit_trait_item(&mut self, ti: &'tcx hir::TraitItem<'tcx>) { - self.annotate(ti.hir_id, &ti.attrs, ti.span, AnnotationKind::Required, |v| { + self.annotate(ti.hir_id, &ti.attrs, ti.span, AnnotationKind::Required, true, |v| { intravisit::walk_trait_item(v, ti); }); } @@ -320,15 +330,22 @@ impl<'a, 'tcx> Visitor<'tcx> for Annotator<'a, 'tcx> { fn visit_impl_item(&mut self, ii: &'tcx hir::ImplItem<'tcx>) { let kind = if self.in_trait_impl { AnnotationKind::Prohibited } else { AnnotationKind::Required }; - self.annotate(ii.hir_id, &ii.attrs, ii.span, kind, |v| { + self.annotate(ii.hir_id, &ii.attrs, ii.span, kind, true, |v| { intravisit::walk_impl_item(v, ii); }); } fn visit_variant(&mut self, var: &'tcx Variant<'tcx>, g: &'tcx Generics<'tcx>, item_id: HirId) { - self.annotate(var.id, &var.attrs, var.span, AnnotationKind::Required, |v| { + self.annotate(var.id, &var.attrs, var.span, AnnotationKind::Required, true, |v| { if let Some(ctor_hir_id) = var.data.ctor_hir_id() { - v.annotate(ctor_hir_id, &var.attrs, var.span, AnnotationKind::Required, |_| {}); + v.annotate( + ctor_hir_id, + &var.attrs, + var.span, + AnnotationKind::Required, + true, + |_| {}, + ); } intravisit::walk_variant(v, var, g, item_id) @@ -336,19 +353,33 @@ impl<'a, 'tcx> Visitor<'tcx> for Annotator<'a, 'tcx> { } fn visit_struct_field(&mut self, s: &'tcx StructField<'tcx>) { - self.annotate(s.hir_id, &s.attrs, s.span, AnnotationKind::Required, |v| { + self.annotate(s.hir_id, &s.attrs, s.span, AnnotationKind::Required, true, |v| { intravisit::walk_struct_field(v, s); }); } fn visit_foreign_item(&mut self, i: &'tcx hir::ForeignItem<'tcx>) { - self.annotate(i.hir_id, &i.attrs, i.span, AnnotationKind::Required, |v| { + self.annotate(i.hir_id, &i.attrs, i.span, AnnotationKind::Required, true, |v| { intravisit::walk_foreign_item(v, i); }); } fn visit_macro_def(&mut self, md: &'tcx hir::MacroDef<'tcx>) { - self.annotate(md.hir_id, &md.attrs, md.span, AnnotationKind::Required, |_| {}); + self.annotate(md.hir_id, &md.attrs, md.span, AnnotationKind::Required, true, |_| {}); + } + + fn visit_generic_param(&mut self, p: &'tcx hir::GenericParam<'tcx>) { + let kind = match &p.kind { + // FIXME(const_generics:defaults) + hir::GenericParamKind::Type { default, .. } if default.is_some() => { + AnnotationKind::Container + } + _ => AnnotationKind::Prohibited, + }; + + self.annotate(p.hir_id, &p.attrs, p.span, kind, false, |v| { + intravisit::walk_generic_param(v, p); + }); } } @@ -422,6 +453,10 @@ impl<'tcx> Visitor<'tcx> for MissingStabilityAnnotations<'tcx> { fn visit_macro_def(&mut self, md: &'tcx hir::MacroDef<'tcx>) { self.check_missing_stability(md.hir_id, md.span); } + + // Note that we don't need to `check_missing_stability` for default generic parameters, + // as we assume that any default generic parameters without attributes are automatically + // stable (assuming they have not inherited instability from their parent). } fn new_index(tcx: TyCtxt<'tcx>) -> Index<'tcx> { @@ -484,6 +519,7 @@ fn new_index(tcx: TyCtxt<'tcx>) -> Index<'tcx> { &krate.item.attrs, krate.item.span, AnnotationKind::Required, + true, |v| intravisit::walk_crate(v, krate), ); } -- cgit 1.4.1-3-g733a5 From 19e90843a4eb99d528dea62f793ad6d523c4af6c Mon Sep 17 00:00:00 2001 From: Avi Dessauer Date: Sun, 5 Jul 2020 19:02:30 -0400 Subject: Add documentation --- compiler/rustc_middle/src/middle/stability.rs | 7 +- compiler/rustc_passes/src/stability.rs | 117 ++++++++++++++++++-------- compiler/rustc_typeck/src/astconv/mod.rs | 2 +- 3 files changed, 90 insertions(+), 36 deletions(-) (limited to 'compiler/rustc_passes/src') diff --git a/compiler/rustc_middle/src/middle/stability.rs b/compiler/rustc_middle/src/middle/stability.rs index 0fb73db83e8..28d139faa59 100644 --- a/compiler/rustc_middle/src/middle/stability.rs +++ b/compiler/rustc_middle/src/middle/stability.rs @@ -395,7 +395,7 @@ impl<'tcx> TyCtxt<'tcx> { /// This function will also check if the item is deprecated. /// If so, and `id` is not `None`, a deprecated lint attached to `id` will be emitted. pub fn check_stability(self, def_id: DefId, id: Option, span: Span) { - self.check_stability_internal(def_id, id, span, |span, def_id| { + self.check_optional_stability(def_id, id, span, |span, def_id| { // The API could be uncallable for other reasons, for example when a private module // was referenced. self.sess.delay_span_bug(span, &format!("encountered unmarked API: {:?}", def_id)); @@ -409,7 +409,10 @@ impl<'tcx> TyCtxt<'tcx> { /// /// This function will also check if the item is deprecated. /// If so, and `id` is not `None`, a deprecated lint attached to `id` will be emitted. - pub fn check_stability_internal( + /// + /// The `unmarked` closure is called definitions without a stability annotation. + /// This is needed for generic parameters, since they may not be marked when used in a staged_api crate. + pub fn check_optional_stability( self, def_id: DefId, id: Option, diff --git a/compiler/rustc_passes/src/stability.rs b/compiler/rustc_passes/src/stability.rs index d658a58aeab..d34363e0577 100644 --- a/compiler/rustc_passes/src/stability.rs +++ b/compiler/rustc_passes/src/stability.rs @@ -37,6 +37,20 @@ enum AnnotationKind { Container, } +/// Inheriting deprecations Nested items causes duplicate warnings. +/// Inheriting the deprecation of `Foo` onto the parameter `T`, would cause a duplicate warnings. +#[derive(PartialEq, Copy, Clone)] +enum InheritDeprecation { + Yes, + No, +} + +impl InheritDeprecation { + fn yes(&self) -> bool { + *self == InheritDeprecation::Yes + } +} + // A private tree-walker for producing an Index. struct Annotator<'a, 'tcx> { tcx: TyCtxt<'tcx>, @@ -56,7 +70,7 @@ impl<'a, 'tcx> Annotator<'a, 'tcx> { attrs: &[Attribute], item_sp: Span, kind: AnnotationKind, - inherit_deprecation: bool, + inherit_deprecation: InheritDeprecation, visit_children: F, ) where F: FnOnce(&mut Self), @@ -81,7 +95,7 @@ impl<'a, 'tcx> Annotator<'a, 'tcx> { let depr_entry = DeprecationEntry::local(depr.clone(), hir_id); self.index.depr_map.insert(hir_id, depr_entry); } else if let Some(parent_depr) = self.parent_depr.clone() { - if inherit_deprecation { + if inherit_deprecation.yes() { is_deprecated = true; info!("tagging child {:?} as deprecated from parent", hir_id); self.index.depr_map.insert(hir_id, parent_depr); @@ -189,7 +203,7 @@ impl<'a, 'tcx> Annotator<'a, 'tcx> { if stab.is_none() { debug!("annotate: stab not found, parent = {:?}", self.parent_stab); if let Some(stab) = self.parent_stab { - if inherit_deprecation && stab.level.is_unstable() { + if inherit_deprecation.yes() && stab.level.is_unstable() { self.index.stab_map.insert(hir_id, stab); } } @@ -240,7 +254,7 @@ impl<'a, 'tcx> Annotator<'a, 'tcx> { } // returns true if an error occurred, used to suppress some spurious errors - fn forbid_staged_api_attrs(&mut self, hir_id: HirId, attrs: &[Attribute], inherit_deprecation: bool) -> bool { + fn forbid_staged_api_attrs(&mut self, hir_id: HirId, attrs: &[Attribute], inherit_deprecation: InheritDeprecation) -> bool { // Emit errors for non-staged-api crates. let unstable_attrs = [ sym::unstable, @@ -268,7 +282,7 @@ impl<'a, 'tcx> Annotator<'a, 'tcx> { // Propagate unstability. This can happen even for non-staged-api crates in case // -Zforce-unstable-if-unmarked is set. if let Some(stab) = self.parent_stab { - if inherit_deprecation && stab.level.is_unstable() { + if inherit_deprecation.yes() && stab.level.is_unstable() { self.index.stab_map.insert(hir_id, stab); } } @@ -309,7 +323,7 @@ impl<'a, 'tcx> Visitor<'tcx> for Annotator<'a, 'tcx> { &i.attrs, i.span, AnnotationKind::Required, - true, + InheritDeprecation::Yes, |_| {}, ) } @@ -317,55 +331,92 @@ impl<'a, 'tcx> Visitor<'tcx> for Annotator<'a, 'tcx> { _ => {} } - self.annotate(i.hir_id, &i.attrs, i.span, kind, true, |v| intravisit::walk_item(v, i)); + self.annotate(i.hir_id, &i.attrs, i.span, kind, InheritDeprecation::Yes, |v| { + intravisit::walk_item(v, i) + }); self.in_trait_impl = orig_in_trait_impl; } fn visit_trait_item(&mut self, ti: &'tcx hir::TraitItem<'tcx>) { - self.annotate(ti.hir_id, &ti.attrs, ti.span, AnnotationKind::Required, true, |v| { - intravisit::walk_trait_item(v, ti); - }); + self.annotate( + ti.hir_id, + &ti.attrs, + ti.span, + AnnotationKind::Required, + InheritDeprecation::Yes, + |v| { + intravisit::walk_trait_item(v, ti); + }, + ); } fn visit_impl_item(&mut self, ii: &'tcx hir::ImplItem<'tcx>) { let kind = if self.in_trait_impl { AnnotationKind::Prohibited } else { AnnotationKind::Required }; - self.annotate(ii.hir_id, &ii.attrs, ii.span, kind, true, |v| { + self.annotate(ii.hir_id, &ii.attrs, ii.span, kind, InheritDeprecation::Yes, |v| { intravisit::walk_impl_item(v, ii); }); } fn visit_variant(&mut self, var: &'tcx Variant<'tcx>, g: &'tcx Generics<'tcx>, item_id: HirId) { - self.annotate(var.id, &var.attrs, var.span, AnnotationKind::Required, true, |v| { - if let Some(ctor_hir_id) = var.data.ctor_hir_id() { - v.annotate( - ctor_hir_id, - &var.attrs, - var.span, - AnnotationKind::Required, - true, - |_| {}, - ); - } + self.annotate( + var.id, + &var.attrs, + var.span, + AnnotationKind::Required, + InheritDeprecation::Yes, + |v| { + if let Some(ctor_hir_id) = var.data.ctor_hir_id() { + v.annotate( + ctor_hir_id, + &var.attrs, + var.span, + AnnotationKind::Required, + InheritDeprecation::Yes, + |_| {}, + ); + } - intravisit::walk_variant(v, var, g, item_id) - }) + intravisit::walk_variant(v, var, g, item_id) + }, + ) } fn visit_struct_field(&mut self, s: &'tcx StructField<'tcx>) { - self.annotate(s.hir_id, &s.attrs, s.span, AnnotationKind::Required, true, |v| { - intravisit::walk_struct_field(v, s); - }); + self.annotate( + s.hir_id, + &s.attrs, + s.span, + AnnotationKind::Required, + InheritDeprecation::Yes, + |v| { + intravisit::walk_struct_field(v, s); + }, + ); } fn visit_foreign_item(&mut self, i: &'tcx hir::ForeignItem<'tcx>) { - self.annotate(i.hir_id, &i.attrs, i.span, AnnotationKind::Required, true, |v| { - intravisit::walk_foreign_item(v, i); - }); + self.annotate( + i.hir_id, + &i.attrs, + i.span, + AnnotationKind::Required, + InheritDeprecation::Yes, + |v| { + intravisit::walk_foreign_item(v, i); + }, + ); } fn visit_macro_def(&mut self, md: &'tcx hir::MacroDef<'tcx>) { - self.annotate(md.hir_id, &md.attrs, md.span, AnnotationKind::Required, true, |_| {}); + self.annotate( + md.hir_id, + &md.attrs, + md.span, + AnnotationKind::Required, + InheritDeprecation::Yes, + |_| {}, + ); } fn visit_generic_param(&mut self, p: &'tcx hir::GenericParam<'tcx>) { @@ -377,7 +428,7 @@ impl<'a, 'tcx> Visitor<'tcx> for Annotator<'a, 'tcx> { _ => AnnotationKind::Prohibited, }; - self.annotate(p.hir_id, &p.attrs, p.span, kind, false, |v| { + self.annotate(p.hir_id, &p.attrs, p.span, kind, InheritDeprecation::No, |v| { intravisit::walk_generic_param(v, p); }); } @@ -519,7 +570,7 @@ fn new_index(tcx: TyCtxt<'tcx>) -> Index<'tcx> { &krate.item.attrs, krate.item.span, AnnotationKind::Required, - true, + InheritDeprecation::Yes, |v| intravisit::walk_crate(v, krate), ); } diff --git a/compiler/rustc_typeck/src/astconv/mod.rs b/compiler/rustc_typeck/src/astconv/mod.rs index ad4c28928fc..3c95184c35f 100644 --- a/compiler/rustc_typeck/src/astconv/mod.rs +++ b/compiler/rustc_typeck/src/astconv/mod.rs @@ -362,7 +362,7 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o { } (GenericParamDefKind::Type { has_default, .. }, GenericArg::Type(ty)) => { if *has_default { - tcx.check_stability_internal( + tcx.check_optional_stability( param.def_id, Some(arg.id()), arg.span(), -- cgit 1.4.1-3-g733a5 From 41eec9065aef513cc41d8e2297c4f469fd7029b7 Mon Sep 17 00:00:00 2001 From: Avi Dessauer Date: Wed, 8 Jul 2020 15:31:48 -0400 Subject: Update src/librustc_passes/stability.rs Co-authored-by: varkor --- compiler/rustc_passes/src/stability.rs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'compiler/rustc_passes/src') diff --git a/compiler/rustc_passes/src/stability.rs b/compiler/rustc_passes/src/stability.rs index d34363e0577..dd453f28554 100644 --- a/compiler/rustc_passes/src/stability.rs +++ b/compiler/rustc_passes/src/stability.rs @@ -37,8 +37,12 @@ enum AnnotationKind { Container, } -/// Inheriting deprecations Nested items causes duplicate warnings. -/// Inheriting the deprecation of `Foo` onto the parameter `T`, would cause a duplicate warnings. +/// Whether to inherit deprecation flags for nested items. In most cases, we do want to inherit +/// deprecation, because nested items rarely have individual deprecation attributes, and so +/// should be treated as deprecated if their parent is. However, default generic parameters +/// have separate deprecation attributes from their parents, so we do not wish to inherit +/// deprecation in this case. For example, inheriting deprecation for `T` in `Foo` +/// would cause a duplicate warning arising from both `Foo` and `T` being deprecated. #[derive(PartialEq, Copy, Clone)] enum InheritDeprecation { Yes, -- cgit 1.4.1-3-g733a5 From 2793da3f39033d7f0b2c07a3556d68ccd4d03d4e Mon Sep 17 00:00:00 2001 From: Avi Dessauer Date: Wed, 8 Jul 2020 15:51:31 -0400 Subject: Update src/librustc_passes/stability.rs Co-authored-by: varkor --- compiler/rustc_passes/src/stability.rs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'compiler/rustc_passes/src') diff --git a/compiler/rustc_passes/src/stability.rs b/compiler/rustc_passes/src/stability.rs index dd453f28554..5b0df9e884f 100644 --- a/compiler/rustc_passes/src/stability.rs +++ b/compiler/rustc_passes/src/stability.rs @@ -43,7 +43,6 @@ enum AnnotationKind { /// have separate deprecation attributes from their parents, so we do not wish to inherit /// deprecation in this case. For example, inheriting deprecation for `T` in `Foo` /// would cause a duplicate warning arising from both `Foo` and `T` being deprecated. -#[derive(PartialEq, Copy, Clone)] enum InheritDeprecation { Yes, No, @@ -51,7 +50,7 @@ enum InheritDeprecation { impl InheritDeprecation { fn yes(&self) -> bool { - *self == InheritDeprecation::Yes + matches!(self, InheritDeprecation::Yes) } } -- cgit 1.4.1-3-g733a5 From 3f1b4b39e3dbff49d3298af1acaa526310b255a7 Mon Sep 17 00:00:00 2001 From: Jacob Hughes Date: Tue, 22 Sep 2020 22:54:52 -0400 Subject: Fix compilation & test failures --- compiler/rustc_passes/src/stability.rs | 10 +++++-- .../generics-default-stability.rs | 32 +++++++++++----------- .../generics-default-stability.stderr | 32 +++++++++++----------- 3 files changed, 40 insertions(+), 34 deletions(-) (limited to 'compiler/rustc_passes/src') diff --git a/compiler/rustc_passes/src/stability.rs b/compiler/rustc_passes/src/stability.rs index 5b0df9e884f..b807dff5fd2 100644 --- a/compiler/rustc_passes/src/stability.rs +++ b/compiler/rustc_passes/src/stability.rs @@ -43,6 +43,7 @@ enum AnnotationKind { /// have separate deprecation attributes from their parents, so we do not wish to inherit /// deprecation in this case. For example, inheriting deprecation for `T` in `Foo` /// would cause a duplicate warning arising from both `Foo` and `T` being deprecated. +#[derive(Clone)] enum InheritDeprecation { Yes, No, @@ -81,7 +82,7 @@ impl<'a, 'tcx> Annotator<'a, 'tcx> { debug!("annotate(id = {:?}, attrs = {:?})", hir_id, attrs); let mut did_error = false; if !self.tcx.features().staged_api { - did_error = self.forbid_staged_api_attrs(hir_id, attrs, inherit_deprecation); + did_error = self.forbid_staged_api_attrs(hir_id, attrs, inherit_deprecation.clone()); } let depr = @@ -257,7 +258,12 @@ impl<'a, 'tcx> Annotator<'a, 'tcx> { } // returns true if an error occurred, used to suppress some spurious errors - fn forbid_staged_api_attrs(&mut self, hir_id: HirId, attrs: &[Attribute], inherit_deprecation: InheritDeprecation) -> bool { + fn forbid_staged_api_attrs( + &mut self, + hir_id: HirId, + attrs: &[Attribute], + inherit_deprecation: InheritDeprecation, + ) -> bool { // Emit errors for non-staged-api crates. let unstable_attrs = [ sym::unstable, diff --git a/src/test/ui/stability-attribute/generics-default-stability.rs b/src/test/ui/stability-attribute/generics-default-stability.rs index b68336da1a5..461b1d405cb 100644 --- a/src/test/ui/stability-attribute/generics-default-stability.rs +++ b/src/test/ui/stability-attribute/generics-default-stability.rs @@ -82,30 +82,30 @@ fn main() { let _ = STRUCT4; let _: Struct4 = Struct4 { field: 1 }; - //~^ use of deprecated item 'unstable_generic_param::Struct4': test [deprecated] - //~^^ use of deprecated item 'unstable_generic_param::Struct4': test [deprecated] - //~^^^ use of deprecated item 'unstable_generic_param::Struct4::field': test [deprecated] + //~^ use of deprecated struct `unstable_generic_param::Struct4`: test [deprecated] + //~^^ use of deprecated struct `unstable_generic_param::Struct4`: test [deprecated] + //~^^^ use of deprecated field `unstable_generic_param::Struct4::field`: test [deprecated] let _ = STRUCT4; - let _: Struct4 = STRUCT4; //~ use of deprecated item 'unstable_generic_param::Struct4': test [deprecated] - let _: Struct4 = STRUCT4; //~ use of deprecated item 'unstable_generic_param::Struct4': test [deprecated] + let _: Struct4 = STRUCT4; //~ use of deprecated struct `unstable_generic_param::Struct4`: test [deprecated] + let _: Struct4 = STRUCT4; //~ use of deprecated struct `unstable_generic_param::Struct4`: test [deprecated] let _: Struct4 = Struct4 { field: 0 }; - //~^ use of deprecated item 'unstable_generic_param::Struct4': test [deprecated] - //~^^ use of deprecated item 'unstable_generic_param::Struct4': test [deprecated] - //~^^^ use of deprecated item 'unstable_generic_param::Struct4::field': test [deprecated] + //~^ use of deprecated struct `unstable_generic_param::Struct4`: test [deprecated] + //~^^ use of deprecated struct `unstable_generic_param::Struct4`: test [deprecated] + //~^^^ use of deprecated field `unstable_generic_param::Struct4::field`: test [deprecated] let _ = STRUCT5; let _: Struct5 = Struct5 { field: 1 }; //~ ERROR use of unstable library feature 'unstable_default' - //~^ use of deprecated item 'unstable_generic_param::Struct5': test [deprecated] - //~^^ use of deprecated item 'unstable_generic_param::Struct5': test [deprecated] - //~^^^ use of deprecated item 'unstable_generic_param::Struct5::field': test [deprecated] + //~^ use of deprecated struct `unstable_generic_param::Struct5`: test [deprecated] + //~^^ use of deprecated struct `unstable_generic_param::Struct5`: test [deprecated] + //~^^^ use of deprecated field `unstable_generic_param::Struct5::field`: test [deprecated] let _ = STRUCT5; - let _: Struct5 = STRUCT5; //~ use of deprecated item 'unstable_generic_param::Struct5': test [deprecated] + let _: Struct5 = STRUCT5; //~ use of deprecated struct `unstable_generic_param::Struct5`: test [deprecated] let _: Struct5 = STRUCT5; //~ ERROR use of unstable library feature 'unstable_default' - //~^ use of deprecated item 'unstable_generic_param::Struct5': test [deprecated] + //~^ use of deprecated struct `unstable_generic_param::Struct5`: test [deprecated] let _: Struct5 = Struct5 { field: 0 }; //~ ERROR use of unstable library feature 'unstable_default' - //~^ use of deprecated item 'unstable_generic_param::Struct5': test [deprecated] - //~^^ use of deprecated item 'unstable_generic_param::Struct5': test [deprecated] - //~^^^ use of deprecated item 'unstable_generic_param::Struct5::field': test [deprecated] + //~^ use of deprecated struct `unstable_generic_param::Struct5`: test [deprecated] + //~^^ use of deprecated struct `unstable_generic_param::Struct5`: test [deprecated] + //~^^^ use of deprecated field `unstable_generic_param::Struct5::field`: test [deprecated] let _: Struct6 = Struct6 { field: 1 }; // ok let _: Struct6 = Struct6 { field: 0 }; // ok diff --git a/src/test/ui/stability-attribute/generics-default-stability.stderr b/src/test/ui/stability-attribute/generics-default-stability.stderr index 37a809f8bca..d9b238f8841 100644 --- a/src/test/ui/stability-attribute/generics-default-stability.stderr +++ b/src/test/ui/stability-attribute/generics-default-stability.stderr @@ -22,7 +22,7 @@ LL | impl Trait2 for S { | = help: add `#![feature(unstable_default)]` to the crate attributes to enable -warning: use of deprecated item 'unstable_generic_param::Struct4': test +warning: use of deprecated struct `unstable_generic_param::Struct4`: test --> $DIR/generics-default-stability.rs:84:29 | LL | let _: Struct4 = Struct4 { field: 1 }; @@ -30,67 +30,67 @@ LL | let _: Struct4 = Struct4 { field: 1 }; | = note: `#[warn(deprecated)]` on by default -warning: use of deprecated item 'unstable_generic_param::Struct4': test +warning: use of deprecated struct `unstable_generic_param::Struct4`: test --> $DIR/generics-default-stability.rs:84:12 | LL | let _: Struct4 = Struct4 { field: 1 }; | ^^^^^^^^^^^^^^ -warning: use of deprecated item 'unstable_generic_param::Struct4': test +warning: use of deprecated struct `unstable_generic_param::Struct4`: test --> $DIR/generics-default-stability.rs:89:12 | LL | let _: Struct4 = STRUCT4; | ^^^^^^^ -warning: use of deprecated item 'unstable_generic_param::Struct4': test +warning: use of deprecated struct `unstable_generic_param::Struct4`: test --> $DIR/generics-default-stability.rs:90:12 | LL | let _: Struct4 = STRUCT4; | ^^^^^^^^^^^^^^ -warning: use of deprecated item 'unstable_generic_param::Struct4': test +warning: use of deprecated struct `unstable_generic_param::Struct4`: test --> $DIR/generics-default-stability.rs:91:29 | LL | let _: Struct4 = Struct4 { field: 0 }; | ^^^^^^^ -warning: use of deprecated item 'unstable_generic_param::Struct4': test +warning: use of deprecated struct `unstable_generic_param::Struct4`: test --> $DIR/generics-default-stability.rs:91:12 | LL | let _: Struct4 = Struct4 { field: 0 }; | ^^^^^^^^^^^^^^ -warning: use of deprecated item 'unstable_generic_param::Struct5': test +warning: use of deprecated struct `unstable_generic_param::Struct5`: test --> $DIR/generics-default-stability.rs:97:29 | LL | let _: Struct5 = Struct5 { field: 1 }; | ^^^^^^^ -warning: use of deprecated item 'unstable_generic_param::Struct5': test +warning: use of deprecated struct `unstable_generic_param::Struct5`: test --> $DIR/generics-default-stability.rs:97:12 | LL | let _: Struct5 = Struct5 { field: 1 }; | ^^^^^^^^^^^^^^ -warning: use of deprecated item 'unstable_generic_param::Struct5': test +warning: use of deprecated struct `unstable_generic_param::Struct5`: test --> $DIR/generics-default-stability.rs:102:12 | LL | let _: Struct5 = STRUCT5; | ^^^^^^^ -warning: use of deprecated item 'unstable_generic_param::Struct5': test +warning: use of deprecated struct `unstable_generic_param::Struct5`: test --> $DIR/generics-default-stability.rs:103:12 | LL | let _: Struct5 = STRUCT5; | ^^^^^^^^^^^^^^ -warning: use of deprecated item 'unstable_generic_param::Struct5': test +warning: use of deprecated struct `unstable_generic_param::Struct5`: test --> $DIR/generics-default-stability.rs:105:29 | LL | let _: Struct5 = Struct5 { field: 0 }; | ^^^^^^^ -warning: use of deprecated item 'unstable_generic_param::Struct5': test +warning: use of deprecated struct `unstable_generic_param::Struct5`: test --> $DIR/generics-default-stability.rs:105:12 | LL | let _: Struct5 = Struct5 { field: 0 }; @@ -176,25 +176,25 @@ LL | let _: Box1 = Box1::new(1); | = help: add `#![feature(box_alloc_param)]` to the crate attributes to enable -warning: use of deprecated item 'unstable_generic_param::Struct4::field': test +warning: use of deprecated field `unstable_generic_param::Struct4::field`: test --> $DIR/generics-default-stability.rs:84:39 | LL | let _: Struct4 = Struct4 { field: 1 }; | ^^^^^^^^ -warning: use of deprecated item 'unstable_generic_param::Struct4::field': test +warning: use of deprecated field `unstable_generic_param::Struct4::field`: test --> $DIR/generics-default-stability.rs:91:39 | LL | let _: Struct4 = Struct4 { field: 0 }; | ^^^^^^^^ -warning: use of deprecated item 'unstable_generic_param::Struct5::field': test +warning: use of deprecated field `unstable_generic_param::Struct5::field`: test --> $DIR/generics-default-stability.rs:97:39 | LL | let _: Struct5 = Struct5 { field: 1 }; | ^^^^^^^^ -warning: use of deprecated item 'unstable_generic_param::Struct5::field': test +warning: use of deprecated field `unstable_generic_param::Struct5::field`: test --> $DIR/generics-default-stability.rs:105:39 | LL | let _: Struct5 = Struct5 { field: 0 }; -- cgit 1.4.1-3-g733a5