]> git.lizzy.rs Git - rust.git/commitdiff
test: ensure #[track_caller] tests also test MIR inlining.
authorEduard-Mihai Burtescu <edy.burt@gmail.com>
Sat, 8 Feb 2020 21:46:57 +0000 (23:46 +0200)
committerEduard-Mihai Burtescu <edy.burt@gmail.com>
Wed, 21 Oct 2020 01:43:56 +0000 (04:43 +0300)
src/test/ui/rfc-2091-track-caller/caller-location-intrinsic.rs
src/test/ui/rfc-2091-track-caller/const-caller-location.rs
src/test/ui/rfc-2091-track-caller/intrinsic-wrapper.rs
src/test/ui/rfc-2091-track-caller/pass.rs
src/test/ui/rfc-2091-track-caller/std-panic-locations.rs
src/test/ui/rfc-2091-track-caller/track-caller-attribute.rs
src/test/ui/rfc-2091-track-caller/tracked-fn-ptr-with-arg.rs
src/test/ui/rfc-2091-track-caller/tracked-fn-ptr.rs

index f244b74e391ffa4a2d098947fffb0ca7a3638fc1..b2ed8a0d7da685c305460228cb18ac0c3992a61c 100644 (file)
@@ -1,4 +1,6 @@
 // run-pass
+// revisions: default mir-opt
+//[mir-opt] compile-flags: -Zmir-opt-level=3
 
 #[inline(never)]
 #[track_caller]
@@ -13,13 +15,13 @@ macro_rules! caller_location_from_macro {
 fn main() {
     let loc = codegen_caller_loc();
     assert_eq!(loc.file(), file!());
-    assert_eq!(loc.line(), 14);
+    assert_eq!(loc.line(), 16);
     assert_eq!(loc.column(), 15);
 
     // `Location::caller()` in a macro should behave similarly to `file!` and `line!`,
     // i.e. point to where the macro was invoked, instead of the macro itself.
     let loc2 = caller_location_from_macro!();
     assert_eq!(loc2.file(), file!());
-    assert_eq!(loc2.line(), 21);
+    assert_eq!(loc2.line(), 23);
     assert_eq!(loc2.column(), 16);
 }
index 8030a4d967a676dfe98eec70cb745ddd6677f647..89a42acafba782823dc52ae0519fd6600270c88b 100644 (file)
@@ -1,4 +1,6 @@
 // run-pass
+// revisions: default mir-opt
+//[mir-opt] compile-flags: -Zmir-opt-level=3
 
 #![feature(const_caller_location, const_fn)]
 
@@ -24,18 +26,18 @@ const fn contained() -> &'static Location<'static> {
 
 fn main() {
     assert_eq!(LOCATION.file(), file!());
-    assert_eq!(LOCATION.line(), 7);
+    assert_eq!(LOCATION.line(), 9);
     assert_eq!(LOCATION.column(), 29);
 
     assert_eq!(TRACKED.file(), file!());
-    assert_eq!(TRACKED.line(), 9);
+    assert_eq!(TRACKED.line(), 11);
     assert_eq!(TRACKED.column(), 28);
 
     assert_eq!(NESTED.file(), file!());
-    assert_eq!(NESTED.line(), 17);
+    assert_eq!(NESTED.line(), 19);
     assert_eq!(NESTED.column(), 5);
 
     assert_eq!(CONTAINED.file(), file!());
-    assert_eq!(CONTAINED.line(), 22);
+    assert_eq!(CONTAINED.line(), 24);
     assert_eq!(CONTAINED.column(), 5);
 }
index 74217f47084a33f2aee0bd8bbdae1be0c741ec26..d072fb76f10d8b74fc936894c43cf020eb52da3e 100644 (file)
@@ -1,4 +1,6 @@
 // run-pass
+// revisions: default mir-opt
+//[mir-opt] compile-flags: -Zmir-opt-level=3
 
 macro_rules! caller_location_from_macro {
     () => (core::panic::Location::caller());
@@ -7,13 +9,13 @@ macro_rules! caller_location_from_macro {
 fn main() {
     let loc = core::panic::Location::caller();
     assert_eq!(loc.file(), file!());
-    assert_eq!(loc.line(), 8);
+    assert_eq!(loc.line(), 10);
     assert_eq!(loc.column(), 15);
 
     // `Location::caller()` in a macro should behave similarly to `file!` and `line!`,
     // i.e. point to where the macro was invoked, instead of the macro itself.
     let loc2 = caller_location_from_macro!();
     assert_eq!(loc2.file(), file!());
-    assert_eq!(loc2.line(), 15);
+    assert_eq!(loc2.line(), 17);
     assert_eq!(loc2.column(), 16);
 }
index ada150b25cf2c6830dd363123574151f75d4faaa..4d548d4f0aa395e22e092371d4a4ce547480e3c3 100644 (file)
@@ -1,4 +1,7 @@
 // run-pass
+// revisions: default mir-opt
+//[mir-opt] compile-flags: -Zmir-opt-level=3
+
 #[track_caller]
 fn f() {}
 
index d6a3a760b3ee273c5372d45b6b4f71b088d40814..0d7a5c42532f1cd53f9a1134c4c9e8c4b942ed9d 100644 (file)
@@ -1,5 +1,7 @@
 // run-pass
 // ignore-wasm32-bare compiled with panic=abort by default
+// revisions: default mir-opt
+//[mir-opt] compile-flags: -Zmir-opt-level=3
 
 #![feature(option_expect_none, option_unwrap_none)]
 #![allow(unconditional_panic)]
index efcc1f6942de18f4dbb5033e68aff8daa7587a61..43135ebbf65df3e223ba26e2808d3f011ef1a589 100644 (file)
@@ -1,4 +1,6 @@
 // run-pass
+// revisions: default mir-opt
+//[mir-opt] compile-flags: -Zmir-opt-level=3
 
 use std::panic::Location;
 
@@ -18,21 +20,21 @@ fn nested_tracked() -> &'static Location<'static> {
 fn main() {
     let location = Location::caller();
     assert_eq!(location.file(), file!());
-    assert_eq!(location.line(), 19);
+    assert_eq!(location.line(), 21);
     assert_eq!(location.column(), 20);
 
     let tracked = tracked();
     assert_eq!(tracked.file(), file!());
-    assert_eq!(tracked.line(), 24);
+    assert_eq!(tracked.line(), 26);
     assert_eq!(tracked.column(), 19);
 
     let nested = nested_intrinsic();
     assert_eq!(nested.file(), file!());
-    assert_eq!(nested.line(), 11);
+    assert_eq!(nested.line(), 13);
     assert_eq!(nested.column(), 5);
 
     let contained = nested_tracked();
     assert_eq!(contained.file(), file!());
-    assert_eq!(contained.line(), 15);
+    assert_eq!(contained.line(), 17);
     assert_eq!(contained.column(), 5);
 }
index 5fcfea96d547ab79cb25fe5cb1378b3542a7f5b7..2122a4ca219250d18568283032fb4b2e1dd0601d 100644 (file)
@@ -1,4 +1,6 @@
 // run-pass
+// revisions: default mir-opt
+//[mir-opt] compile-flags: -Zmir-opt-level=3
 
 fn pass_to_ptr_call<T>(f: fn(T), x: T) {
     f(x);
index 4415d850c241ce9516b7f852e9fe38d423a46047..922d2d7b7021a9d7c187b91270c36f7a9adbb5e3 100644 (file)
@@ -1,4 +1,6 @@
 // run-pass
+// revisions: default mir-opt
+//[mir-opt] compile-flags: -Zmir-opt-level=3
 
 fn ptr_call(f: fn()) {
     f();