]> git.lizzy.rs Git - rust.git/commitdiff
don't special case `DefKind::Ctor` in encoding
authorlcnr <rust@lcnr.de>
Tue, 22 Feb 2022 09:53:45 +0000 (10:53 +0100)
committerlcnr <rust@lcnr.de>
Thu, 24 Feb 2022 13:46:11 +0000 (14:46 +0100)
compiler/rustc_metadata/src/rmeta/encoder.rs
src/test/ui/deprecation/deprecation-lint.rs
src/test/ui/deprecation/deprecation-lint.stderr
src/test/ui/lint/lint-stability-deprecated.rs
src/test/ui/lint/lint-stability-deprecated.stderr
src/test/ui/lint/lint-stability-fields-deprecated.rs
src/test/ui/lint/lint-stability-fields-deprecated.stderr
src/test/ui/stability-attribute/generics-default-stability.rs
src/test/ui/stability-attribute/generics-default-stability.stderr

index da8995df1ac9e43b24b142afed566950ffac3c66..a7fbbb184f7c5e11834f75ebaa5a933416fe61da 100644 (file)
@@ -6,7 +6,7 @@
 use rustc_data_structures::stable_hasher::StableHasher;
 use rustc_data_structures::sync::{join, par_iter, Lrc, ParallelIterator};
 use rustc_hir as hir;
-use rustc_hir::def::{CtorOf, DefKind};
+use rustc_hir::def::DefKind;
 use rustc_hir::def_id::{
     CrateNum, DefId, DefIndex, LocalDefId, CRATE_DEF_ID, CRATE_DEF_INDEX, LOCAL_CRATE,
 };
@@ -983,12 +983,7 @@ fn encode_def_ids(&mut self) {
             let def_id = local_id.to_def_id();
             let def_kind = tcx.opt_def_kind(local_id);
             let Some(def_kind) = def_kind else { continue };
-            record!(self.tables.opt_def_kind[def_id] <- match def_kind {
-                // Replace Ctor by the enclosing object to avoid leaking details in children crates.
-                DefKind::Ctor(CtorOf::Struct, _) => DefKind::Struct,
-                DefKind::Ctor(CtorOf::Variant, _) => DefKind::Variant,
-                def_kind => def_kind,
-            });
+            record!(self.tables.opt_def_kind[def_id] <- def_kind);
             record!(self.tables.def_span[def_id] <- tcx.def_span(def_id));
             record!(self.tables.attributes[def_id] <- tcx.get_attrs(def_id));
             record!(self.tables.expn_that_defined[def_id] <- self.tcx.expn_that_defined(def_id));
index 9bde2ca1942e64c09a188bc4d2a58f835ffaa762..a1a149ab3a0e1c7386f67e8baf786b13c6300d98 100644 (file)
@@ -35,21 +35,21 @@ fn test() {
             i: 0 //~ ERROR use of deprecated field `deprecation_lint::DeprecatedStruct::i`: text
         };
 
-        let _ = DeprecatedUnitStruct; //~ ERROR use of deprecated struct `deprecation_lint::DeprecatedUnitStruct`: text
+        let _ = DeprecatedUnitStruct; //~ ERROR use of deprecated unit struct `deprecation_lint::DeprecatedUnitStruct`: text
 
-        let _ = Enum::DeprecatedVariant; //~ ERROR use of deprecated variant `deprecation_lint::Enum::DeprecatedVariant`: text
+        let _ = Enum::DeprecatedVariant; //~ ERROR use of deprecated unit variant `deprecation_lint::Enum::DeprecatedVariant`: text
 
-        let _ = DeprecatedTupleStruct (1); //~ ERROR use of deprecated struct `deprecation_lint::DeprecatedTupleStruct`: text
+        let _ = DeprecatedTupleStruct (1); //~ ERROR use of deprecated tuple struct `deprecation_lint::DeprecatedTupleStruct`: text
 
         let _ = nested::DeprecatedStruct { //~ ERROR use of deprecated struct `deprecation_lint::nested::DeprecatedStruct`: text
             i: 0 //~ ERROR use of deprecated field `deprecation_lint::nested::DeprecatedStruct::i`: text
         };
 
-        let _ = nested::DeprecatedUnitStruct; //~ ERROR use of deprecated struct `deprecation_lint::nested::DeprecatedUnitStruct`: text
+        let _ = nested::DeprecatedUnitStruct; //~ ERROR use of deprecated unit struct `deprecation_lint::nested::DeprecatedUnitStruct`: text
 
-        let _ = nested::Enum::DeprecatedVariant; //~ ERROR use of deprecated variant `deprecation_lint::nested::Enum::DeprecatedVariant`: text
+        let _ = nested::Enum::DeprecatedVariant; //~ ERROR use of deprecated unit variant `deprecation_lint::nested::Enum::DeprecatedVariant`: text
 
-        let _ = nested::DeprecatedTupleStruct (1); //~ ERROR use of deprecated struct `deprecation_lint::nested::DeprecatedTupleStruct`: text
+        let _ = nested::DeprecatedTupleStruct (1); //~ ERROR use of deprecated tuple struct `deprecation_lint::nested::DeprecatedTupleStruct`: text
 
         // At the moment, the lint checker only checks stability in
         // in the arguments of macros.
@@ -130,7 +130,7 @@ pub fn foo() {
             { .. } = x;
 
         let x = Deprecated2(1, 2, 3);
-        //~^ ERROR use of deprecated struct `deprecation_lint::Deprecated2`: text
+        //~^ ERROR use of deprecated tuple struct `deprecation_lint::Deprecated2`: text
 
         let _ = x.0;
         //~^ ERROR use of deprecated field `deprecation_lint::Deprecated2::0`: text
@@ -140,7 +140,7 @@ pub fn foo() {
         //~^ ERROR use of deprecated field `deprecation_lint::Deprecated2::2`: text
 
         let Deprecated2
-        //~^ ERROR use of deprecated struct `deprecation_lint::Deprecated2`: text
+        //~^ ERROR use of deprecated tuple struct `deprecation_lint::Deprecated2`: text
             (_,
              //~^ ERROR use of deprecated field `deprecation_lint::Deprecated2::0`: text
              _,
@@ -149,7 +149,7 @@ pub fn foo() {
              //~^ ERROR use of deprecated field `deprecation_lint::Deprecated2::2`: text
             = x;
         let Deprecated2
-        //~^ ERROR use of deprecated struct `deprecation_lint::Deprecated2`: text
+        //~^ ERROR use of deprecated tuple struct `deprecation_lint::Deprecated2`: text
             // the patterns are all fine:
             (..) = x;
     }
index 5d716fa625e5d47793dd0a2e878be4296b3a627f..3842f8492956033a6caff4416e73280f5ead0da7 100644 (file)
@@ -46,19 +46,19 @@ error: use of deprecated struct `deprecation_lint::DeprecatedStruct`: text
 LL |         let _ = DeprecatedStruct {
    |                 ^^^^^^^^^^^^^^^^
 
-error: use of deprecated struct `deprecation_lint::DeprecatedUnitStruct`: text
+error: use of deprecated unit struct `deprecation_lint::DeprecatedUnitStruct`: text
   --> $DIR/deprecation-lint.rs:38:17
    |
 LL |         let _ = DeprecatedUnitStruct;
    |                 ^^^^^^^^^^^^^^^^^^^^
 
-error: use of deprecated variant `deprecation_lint::Enum::DeprecatedVariant`: text
+error: use of deprecated unit variant `deprecation_lint::Enum::DeprecatedVariant`: text
   --> $DIR/deprecation-lint.rs:40:23
    |
 LL |         let _ = Enum::DeprecatedVariant;
    |                       ^^^^^^^^^^^^^^^^^
 
-error: use of deprecated struct `deprecation_lint::DeprecatedTupleStruct`: text
+error: use of deprecated tuple struct `deprecation_lint::DeprecatedTupleStruct`: text
   --> $DIR/deprecation-lint.rs:42:17
    |
 LL |         let _ = DeprecatedTupleStruct (1);
@@ -70,19 +70,19 @@ error: use of deprecated struct `deprecation_lint::nested::DeprecatedStruct`: te
 LL |         let _ = nested::DeprecatedStruct {
    |                         ^^^^^^^^^^^^^^^^
 
-error: use of deprecated struct `deprecation_lint::nested::DeprecatedUnitStruct`: text
+error: use of deprecated unit struct `deprecation_lint::nested::DeprecatedUnitStruct`: text
   --> $DIR/deprecation-lint.rs:48:25
    |
 LL |         let _ = nested::DeprecatedUnitStruct;
    |                         ^^^^^^^^^^^^^^^^^^^^
 
-error: use of deprecated variant `deprecation_lint::nested::Enum::DeprecatedVariant`: text
+error: use of deprecated unit variant `deprecation_lint::nested::Enum::DeprecatedVariant`: text
   --> $DIR/deprecation-lint.rs:50:31
    |
 LL | ...   let _ = nested::Enum::DeprecatedVariant;
    |                             ^^^^^^^^^^^^^^^^^
 
-error: use of deprecated struct `deprecation_lint::nested::DeprecatedTupleStruct`: text
+error: use of deprecated tuple struct `deprecation_lint::nested::DeprecatedTupleStruct`: text
   --> $DIR/deprecation-lint.rs:52:25
    |
 LL | ...   let _ = nested::DeprecatedTupleStruct (1);
@@ -154,19 +154,19 @@ error: use of deprecated struct `deprecation_lint::Deprecated`: text
 LL |         let Deprecated
    |             ^^^^^^^^^^
 
-error: use of deprecated struct `deprecation_lint::Deprecated2`: text
+error: use of deprecated tuple struct `deprecation_lint::Deprecated2`: text
   --> $DIR/deprecation-lint.rs:132:17
    |
 LL |         let x = Deprecated2(1, 2, 3);
    |                 ^^^^^^^^^^^
 
-error: use of deprecated struct `deprecation_lint::Deprecated2`: text
+error: use of deprecated tuple struct `deprecation_lint::Deprecated2`: text
   --> $DIR/deprecation-lint.rs:142:13
    |
 LL |         let Deprecated2
    |             ^^^^^^^^^^^
 
-error: use of deprecated struct `deprecation_lint::Deprecated2`: text
+error: use of deprecated tuple struct `deprecation_lint::Deprecated2`: text
   --> $DIR/deprecation-lint.rs:151:13
    |
 LL |         let Deprecated2
index 5bdddf714186c2140aebdc5525e3c702ecef4046..2f600971da113acd640856ae8b87374acd0833b9 100644 (file)
@@ -115,18 +115,18 @@ fn test() {
         let _ = UnstableStruct { i: 0 };
         let _ = StableStruct { i: 0 };
 
-        let _ = DeprecatedUnitStruct; //~ WARN use of deprecated struct `lint_stability::DeprecatedUnitStruct`
-        let _ = DeprecatedUnstableUnitStruct; //~ WARN use of deprecated struct `lint_stability::DeprecatedUnstableUnitStruct`
+        let _ = DeprecatedUnitStruct; //~ WARN use of deprecated unit struct `lint_stability::DeprecatedUnitStruct`
+        let _ = DeprecatedUnstableUnitStruct; //~ WARN use of deprecated unit struct `lint_stability::DeprecatedUnstableUnitStruct`
         let _ = UnstableUnitStruct;
         let _ = StableUnitStruct;
 
-        let _ = Enum::DeprecatedVariant; //~ WARN use of deprecated variant `lint_stability::Enum::DeprecatedVariant`
-        let _ = Enum::DeprecatedUnstableVariant; //~ WARN use of deprecated variant `lint_stability::Enum::DeprecatedUnstableVariant`
+        let _ = Enum::DeprecatedVariant; //~ WARN use of deprecated unit variant `lint_stability::Enum::DeprecatedVariant`
+        let _ = Enum::DeprecatedUnstableVariant; //~ WARN use of deprecated unit variant `lint_stability::Enum::DeprecatedUnstableVariant`
         let _ = Enum::UnstableVariant;
         let _ = Enum::StableVariant;
 
-        let _ = DeprecatedTupleStruct (1); //~ WARN use of deprecated struct `lint_stability::DeprecatedTupleStruct`
-        let _ = DeprecatedUnstableTupleStruct (1); //~ WARN use of deprecated struct `lint_stability::DeprecatedUnstableTupleStruct`
+        let _ = DeprecatedTupleStruct (1); //~ WARN use of deprecated tuple struct `lint_stability::DeprecatedTupleStruct`
+        let _ = DeprecatedUnstableTupleStruct (1); //~ WARN use of deprecated tuple struct `lint_stability::DeprecatedUnstableTupleStruct`
         let _ = UnstableTupleStruct (1);
         let _ = StableTupleStruct (1);
 
index 4b082fcd35951147a71aa9e01b9bb94c9590fd8a..9f1e7b281e982a76e3dead827d7f574a4cdfc276 100644 (file)
@@ -88,37 +88,37 @@ warning: use of deprecated struct `lint_stability::DeprecatedUnstableStruct`: te
 LL |         let _ = DeprecatedUnstableStruct {
    |                 ^^^^^^^^^^^^^^^^^^^^^^^^
 
-warning: use of deprecated struct `lint_stability::DeprecatedUnitStruct`: text
+warning: use of deprecated unit struct `lint_stability::DeprecatedUnitStruct`: text
   --> $DIR/lint-stability-deprecated.rs:118:17
    |
 LL |         let _ = DeprecatedUnitStruct;
    |                 ^^^^^^^^^^^^^^^^^^^^
 
-warning: use of deprecated struct `lint_stability::DeprecatedUnstableUnitStruct`: text
+warning: use of deprecated unit struct `lint_stability::DeprecatedUnstableUnitStruct`: text
   --> $DIR/lint-stability-deprecated.rs:119:17
    |
 LL |         let _ = DeprecatedUnstableUnitStruct;
    |                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 
-warning: use of deprecated variant `lint_stability::Enum::DeprecatedVariant`: text
+warning: use of deprecated unit variant `lint_stability::Enum::DeprecatedVariant`: text
   --> $DIR/lint-stability-deprecated.rs:123:23
    |
 LL |         let _ = Enum::DeprecatedVariant;
    |                       ^^^^^^^^^^^^^^^^^
 
-warning: use of deprecated variant `lint_stability::Enum::DeprecatedUnstableVariant`: text
+warning: use of deprecated unit variant `lint_stability::Enum::DeprecatedUnstableVariant`: text
   --> $DIR/lint-stability-deprecated.rs:124:23
    |
 LL |         let _ = Enum::DeprecatedUnstableVariant;
    |                       ^^^^^^^^^^^^^^^^^^^^^^^^^
 
-warning: use of deprecated struct `lint_stability::DeprecatedTupleStruct`: text
+warning: use of deprecated tuple struct `lint_stability::DeprecatedTupleStruct`: text
   --> $DIR/lint-stability-deprecated.rs:128:17
    |
 LL |         let _ = DeprecatedTupleStruct (1);
    |                 ^^^^^^^^^^^^^^^^^^^^^
 
-warning: use of deprecated struct `lint_stability::DeprecatedUnstableTupleStruct`: text
+warning: use of deprecated tuple struct `lint_stability::DeprecatedUnstableTupleStruct`: text
   --> $DIR/lint-stability-deprecated.rs:129:17
    |
 LL |         let _ = DeprecatedUnstableTupleStruct (1);
index 2024cf15ab0a1339cca9b0f0974a19ff90aacfa8..a44eb1ce10a22aea4734f6dfe69f687a1c7e42bf 100644 (file)
@@ -129,7 +129,7 @@ pub fn foo() {
             { .. } = x;
 
         let x = Deprecated2(1, 2, 3);
-        //~^ ERROR use of deprecated struct
+        //~^ ERROR use of deprecated tuple struct
 
         let _ = x.0;
         //~^ ERROR use of deprecated field
@@ -139,7 +139,7 @@ pub fn foo() {
         //~^ ERROR use of deprecated field
 
         let Deprecated2
-        //~^ ERROR use of deprecated struct
+        //~^ ERROR use of deprecated tuple struct
             (_,
              //~^ ERROR use of deprecated field
              _,
@@ -148,7 +148,7 @@ pub fn foo() {
              //~^ ERROR use of deprecated field
             = x;
         let Deprecated2
-        //~^ ERROR use of deprecated struct
+        //~^ ERROR use of deprecated tuple struct
             // the patterns are all fine:
             (..) = x;
     }
index 151b3e59b9130115e89cf23e00629a73aa8dee8a..2d83260206f81084fe8e486a7b7ccd8069009dc1 100644 (file)
@@ -22,19 +22,19 @@ error: use of deprecated struct `cross_crate::lint_stability_fields::Deprecated`
 LL |         let Deprecated
    |             ^^^^^^^^^^
 
-error: use of deprecated struct `cross_crate::lint_stability_fields::Deprecated2`: text
+error: use of deprecated tuple struct `cross_crate::lint_stability_fields::Deprecated2`: text
   --> $DIR/lint-stability-fields-deprecated.rs:131:17
    |
 LL |         let x = Deprecated2(1, 2, 3);
    |                 ^^^^^^^^^^^
 
-error: use of deprecated struct `cross_crate::lint_stability_fields::Deprecated2`: text
+error: use of deprecated tuple struct `cross_crate::lint_stability_fields::Deprecated2`: text
   --> $DIR/lint-stability-fields-deprecated.rs:141:13
    |
 LL |         let Deprecated2
    |             ^^^^^^^^^^^
 
-error: use of deprecated struct `cross_crate::lint_stability_fields::Deprecated2`: text
+error: use of deprecated tuple struct `cross_crate::lint_stability_fields::Deprecated2`: text
   --> $DIR/lint-stability-fields-deprecated.rs:150:13
    |
 LL |         let Deprecated2
index c5132861f855c07463965259b8e8eb7739cd9acd..300cc34d63df205e8a0c056dc90ddfbc03a9200e 100644 (file)
@@ -217,25 +217,25 @@ fn main() {
 
     let _ = ENUM4;
     let _: Enum4<isize> = Enum4::Some(1);
-    //~^ use of deprecated variant `unstable_generic_param::Enum4::Some`: test [deprecated]
+    //~^ use of deprecated tuple variant `unstable_generic_param::Enum4::Some`: test [deprecated]
     //~^^ use of deprecated enum `unstable_generic_param::Enum4`: test [deprecated]
     let _ = ENUM4;
     let _: Enum4 = ENUM4; //~ use of deprecated enum `unstable_generic_param::Enum4`: test [deprecated]
     let _: Enum4<usize> = ENUM4; //~ use of deprecated enum `unstable_generic_param::Enum4`: test [deprecated]
     let _: Enum4<isize> = Enum4::Some(0);
-    //~^ use of deprecated variant `unstable_generic_param::Enum4::Some`: test [deprecated]
+    //~^ use of deprecated tuple variant `unstable_generic_param::Enum4::Some`: test [deprecated]
     //~^^ use of deprecated enum `unstable_generic_param::Enum4`: test [deprecated]
 
     let _ = ENUM5;
     let _: Enum5<isize> = Enum5::Some(1); //~ ERROR use of unstable library feature 'unstable_default'
-    //~^ use of deprecated variant `unstable_generic_param::Enum5::Some`: test [deprecated]
+    //~^ use of deprecated tuple variant `unstable_generic_param::Enum5::Some`: test [deprecated]
     //~^^ use of deprecated enum `unstable_generic_param::Enum5`: test [deprecated]
     let _ = ENUM5;
     let _: Enum5 = ENUM5; //~ use of deprecated enum `unstable_generic_param::Enum5`: test [deprecated]
     let _: Enum5<usize> = ENUM5; //~ ERROR use of unstable library feature 'unstable_default'
     //~^ use of deprecated enum `unstable_generic_param::Enum5`: test [deprecated]
     let _: Enum5<isize> = Enum5::Some(0); //~ ERROR use of unstable library feature 'unstable_default'
-    //~^ use of deprecated variant `unstable_generic_param::Enum5::Some`: test [deprecated]
+    //~^ use of deprecated tuple variant `unstable_generic_param::Enum5::Some`: test [deprecated]
     //~^^ use of deprecated enum `unstable_generic_param::Enum5`: test [deprecated]
 
     let _: Enum6<isize> = Enum6::Some(1); // ok
index 2a9d34a15c4924cba69ddc9c8e616f69d06721eb..e094a10c8e7b474ceaa7de3a8a042df2eb0514a9 100644 (file)
@@ -144,7 +144,7 @@ warning: use of deprecated type alias `unstable_generic_param::Alias5`: test
 LL |     let _: Alias5<isize> = Alias5::Some(0);
    |            ^^^^^^
 
-warning: use of deprecated variant `unstable_generic_param::Enum4::Some`: test
+warning: use of deprecated tuple variant `unstable_generic_param::Enum4::Some`: test
   --> $DIR/generics-default-stability.rs:219:34
    |
 LL |     let _: Enum4<isize> = Enum4::Some(1);
@@ -168,7 +168,7 @@ warning: use of deprecated enum `unstable_generic_param::Enum4`: test
 LL |     let _: Enum4<usize> = ENUM4;
    |            ^^^^^
 
-warning: use of deprecated variant `unstable_generic_param::Enum4::Some`: test
+warning: use of deprecated tuple variant `unstable_generic_param::Enum4::Some`: test
   --> $DIR/generics-default-stability.rs:225:34
    |
 LL |     let _: Enum4<isize> = Enum4::Some(0);
@@ -180,7 +180,7 @@ warning: use of deprecated enum `unstable_generic_param::Enum4`: test
 LL |     let _: Enum4<isize> = Enum4::Some(0);
    |            ^^^^^
 
-warning: use of deprecated variant `unstable_generic_param::Enum5::Some`: test
+warning: use of deprecated tuple variant `unstable_generic_param::Enum5::Some`: test
   --> $DIR/generics-default-stability.rs:230:34
    |
 LL |     let _: Enum5<isize> = Enum5::Some(1);
@@ -204,7 +204,7 @@ warning: use of deprecated enum `unstable_generic_param::Enum5`: test
 LL |     let _: Enum5<usize> = ENUM5;
    |            ^^^^^
 
-warning: use of deprecated variant `unstable_generic_param::Enum5::Some`: test
+warning: use of deprecated tuple variant `unstable_generic_param::Enum5::Some`: test
   --> $DIR/generics-default-stability.rs:237:34
    |
 LL |     let _: Enum5<isize> = Enum5::Some(0);