about summary refs log tree commit diff
path: root/tests/run-make/json-error-no-offset
diff options
context:
space:
mode:
authorOneirical <manchot@videotron.ca>2024-07-11 15:52:04 -0400
committerOneirical <manchot@videotron.ca>2024-07-26 14:17:11 -0400
commit61a6afe60ced9a6120403158dd8caf40f8a583a4 (patch)
treefbd8895c0791bdbb5d9dbd66a84e44b558638b09 /tests/run-make/json-error-no-offset
parent83234a0f21a46536cedfd46dc8d0f2d447565541 (diff)
downloadrust-61a6afe60ced9a6120403158dd8caf40f8a583a4.tar.gz
rust-61a6afe60ced9a6120403158dd8caf40f8a583a4.zip
Rewrite and rename issue-35164 to rmake
Diffstat (limited to 'tests/run-make/json-error-no-offset')
-rw-r--r--tests/run-make/json-error-no-offset/main.rs5
-rw-r--r--tests/run-make/json-error-no-offset/rmake.rs15
-rw-r--r--tests/run-make/json-error-no-offset/submodule/mod.rs3
3 files changed, 23 insertions, 0 deletions
diff --git a/tests/run-make/json-error-no-offset/main.rs b/tests/run-make/json-error-no-offset/main.rs
new file mode 100644
index 00000000000..1333d63224c
--- /dev/null
+++ b/tests/run-make/json-error-no-offset/main.rs
@@ -0,0 +1,5 @@
+mod submodule;
+
+fn main() {
+    submodule::foo();
+}
diff --git a/tests/run-make/json-error-no-offset/rmake.rs b/tests/run-make/json-error-no-offset/rmake.rs
new file mode 100644
index 00000000000..629d9c4c16e
--- /dev/null
+++ b/tests/run-make/json-error-no-offset/rmake.rs
@@ -0,0 +1,15 @@
+// The byte positions in json format error logging used to have a small, difficult
+// to predict offset. This was changed to be the top of the file every time in #42973,
+// and this test checks that the measurements appearing in the standard error are correct.
+// See https://github.com/rust-lang/rust/issues/35164
+
+use run_make_support::rustc;
+
+fn main() {
+    rustc()
+        .input("main.rs")
+        .error_format("json")
+        .run()
+        .assert_stderr_contains(r#""byte_start":23"#)
+        .assert_stderr_contains(r#""byte_end":29"#);
+}
diff --git a/tests/run-make/json-error-no-offset/submodule/mod.rs b/tests/run-make/json-error-no-offset/submodule/mod.rs
new file mode 100644
index 00000000000..a9045b242fb
--- /dev/null
+++ b/tests/run-make/json-error-no-offset/submodule/mod.rs
@@ -0,0 +1,3 @@
+pub fn foo() {
+    let _MyFoo = 2;
+}