]> git.proxmox.com Git - rustc.git/blobdiff - src/test/incremental/change_add_field/struct_point.rs
New upstream version 1.23.0+dfsg1
[rustc.git] / src / test / incremental / change_add_field / struct_point.rs
index e18b30a8c72428100e6f220f26cb2dfef54169ea..b1c566e1739ef8a355aedf5865944f8607d6aa34 100644 (file)
 // Fns with that type used only in their body are also recompiled, but
 // their callers are not.
 
-// revisions:rpass1 rpass2
+// revisions:cfail1 cfail2
 // compile-flags: -Z query-dep-graph
+// must-compile-successfully
 
 #![feature(rustc_attrs)]
 #![feature(stmt_expr_attributes)]
-#![feature(static_in_const)]
 #![allow(dead_code)]
+#![crate_type = "rlib"]
 
 // These are expected to require translation.
-#![rustc_partition_translated(module="struct_point-point", cfg="rpass2")]
-#![rustc_partition_translated(module="struct_point-fn_with_type_in_sig", cfg="rpass2")]
-#![rustc_partition_translated(module="struct_point-call_fn_with_type_in_sig", cfg="rpass2")]
-#![rustc_partition_translated(module="struct_point-fn_with_type_in_body", cfg="rpass2")]
-#![rustc_partition_translated(module="struct_point-fn_make_struct", cfg="rpass2")]
-#![rustc_partition_translated(module="struct_point-fn_read_field", cfg="rpass2")]
-#![rustc_partition_translated(module="struct_point-fn_write_field", cfg="rpass2")]
-
-#![rustc_partition_reused(module="struct_point-call_fn_with_type_in_body", cfg="rpass2")]
-
-mod point {
-    #[cfg(rpass1)]
+#![rustc_partition_translated(module="struct_point-point", cfg="cfail2")]
+#![rustc_partition_translated(module="struct_point-fn_with_type_in_sig", cfg="cfail2")]
+#![rustc_partition_translated(module="struct_point-call_fn_with_type_in_sig", cfg="cfail2")]
+#![rustc_partition_translated(module="struct_point-fn_with_type_in_body", cfg="cfail2")]
+#![rustc_partition_translated(module="struct_point-fn_make_struct", cfg="cfail2")]
+#![rustc_partition_translated(module="struct_point-fn_read_field", cfg="cfail2")]
+#![rustc_partition_translated(module="struct_point-fn_write_field", cfg="cfail2")]
+
+#![rustc_partition_reused(module="struct_point-call_fn_with_type_in_body", cfg="cfail2")]
+
+pub mod point {
+    #[cfg(cfail1)]
     pub struct Point {
         pub x: f32,
         pub y: f32,
     }
 
-    #[cfg(rpass2)]
+    #[cfg(cfail2)]
     pub struct Point {
         pub x: f32,
         pub y: f32,
@@ -48,18 +49,18 @@ mod point {
 
     impl Point {
         pub fn origin() -> Point {
-            #[cfg(rpass1)]
+            #[cfg(cfail1)]
             return Point { x: 0.0, y: 0.0 };
 
-            #[cfg(rpass2)]
+            #[cfg(cfail2)]
             return Point { x: 0.0, y: 0.0, z: 0.0 };
         }
 
         pub fn total(&self) -> f32 {
-            #[cfg(rpass1)]
+            #[cfg(cfail1)]
             return self.x + self.y;
 
-            #[cfg(rpass2)]
+            #[cfg(cfail2)]
             return self.x + self.y + self.z;
         }
 
@@ -76,10 +77,10 @@ mod point {
 /// sufficiently "private", we might not need to type-check again.
 /// Rebuilding is probably always necessary since the layout may be
 /// affected.
-mod fn_with_type_in_sig {
+pub mod fn_with_type_in_sig {
     use point::Point;
 
-    #[rustc_dirty(label="TypeckTables", cfg="rpass2")]
+    #[rustc_dirty(label="TypeckTables", cfg="cfail2")]
     pub fn boop(p: Option<&Point>) -> f32 {
         p.map(|p| p.total()).unwrap_or(0.0)
     }
@@ -92,10 +93,10 @@ mod fn_with_type_in_sig {
 /// sufficiently "private", we might not need to type-check again.
 /// Rebuilding is probably always necessary since the layout may be
 /// affected.
-mod call_fn_with_type_in_sig {
+pub mod call_fn_with_type_in_sig {
     use fn_with_type_in_sig;
 
-    #[rustc_dirty(label="TypeckTables", cfg="rpass2")]
+    #[rustc_dirty(label="TypeckTables", cfg="cfail2")]
     pub fn bip() -> f32 {
         fn_with_type_in_sig::boop(None)
     }
@@ -108,10 +109,10 @@ mod call_fn_with_type_in_sig {
 /// sufficiently "private", we might not need to type-check again.
 /// Rebuilding is probably always necessary since the layout may be
 /// affected.
-mod fn_with_type_in_body {
+pub mod fn_with_type_in_body {
     use point::Point;
 
-    #[rustc_dirty(label="TypeckTables", cfg="rpass2")]
+    #[rustc_dirty(label="TypeckTables", cfg="cfail2")]
     pub fn boop() -> f32 {
         Point::origin().total()
     }
@@ -121,44 +122,41 @@ mod fn_with_type_in_body {
 /// body. In this case, the effects of the change should be contained
 /// to Y; X should not have to be rebuilt, nor should it need to be
 /// typechecked again.
-mod call_fn_with_type_in_body {
+pub mod call_fn_with_type_in_body {
     use fn_with_type_in_body;
 
-    #[rustc_clean(label="TypeckTables", cfg="rpass2")]
+    #[rustc_clean(label="TypeckTables", cfg="cfail2")]
     pub fn bip() -> f32 {
         fn_with_type_in_body::boop()
     }
 }
 
 /// A fn item that makes an instance of `Point` but does not invoke methods
-mod fn_make_struct {
+pub mod fn_make_struct {
     use point::Point;
 
-    #[rustc_dirty(label="TypeckTables", cfg="rpass2")]
+    #[rustc_dirty(label="TypeckTables", cfg="cfail2")]
     pub fn make_origin(p: Point) -> Point {
         Point { ..p }
     }
 }
 
 /// A fn item that reads fields from `Point` but does not invoke methods
-mod fn_read_field {
+pub mod fn_read_field {
     use point::Point;
 
-    #[rustc_dirty(label="TypeckTables", cfg="rpass2")]
+    #[rustc_dirty(label="TypeckTables", cfg="cfail2")]
     pub fn get_x(p: Point) -> f32 {
         p.x
     }
 }
 
 /// A fn item that writes to a field of `Point` but does not invoke methods
-mod fn_write_field {
+pub mod fn_write_field {
     use point::Point;
 
-    #[rustc_dirty(label="TypeckTables", cfg="rpass2")]
+    #[rustc_dirty(label="TypeckTables", cfg="cfail2")]
     pub fn inc_x(p: &mut Point) {
         p.x += 1.0;
     }
 }
-
-fn main() {
-}