summaryrefslogtreecommitdiffstats
path: root/tests/run-make-fulldeps/save-analysis-rfc2126
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-17 12:18:58 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-17 12:18:58 +0000
commita4b7ed7a42c716ab9f05e351f003d589124fd55d (patch)
treeb620cd3f223850b28716e474e80c58059dca5dd4 /tests/run-make-fulldeps/save-analysis-rfc2126
parentAdding upstream version 1.67.1+dfsg1. (diff)
downloadrustc-a4b7ed7a42c716ab9f05e351f003d589124fd55d.tar.xz
rustc-a4b7ed7a42c716ab9f05e351f003d589124fd55d.zip
Adding upstream version 1.68.2+dfsg1.upstream/1.68.2+dfsg1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'tests/run-make-fulldeps/save-analysis-rfc2126')
-rw-r--r--tests/run-make-fulldeps/save-analysis-rfc2126/Makefile8
-rw-r--r--tests/run-make-fulldeps/save-analysis-rfc2126/extern_absolute_paths.rs6
-rw-r--r--tests/run-make-fulldeps/save-analysis-rfc2126/krate2.rs5
-rw-r--r--tests/run-make-fulldeps/save-analysis-rfc2126/validate_json.py7
4 files changed, 26 insertions, 0 deletions
diff --git a/tests/run-make-fulldeps/save-analysis-rfc2126/Makefile b/tests/run-make-fulldeps/save-analysis-rfc2126/Makefile
new file mode 100644
index 000000000..30f57034b
--- /dev/null
+++ b/tests/run-make-fulldeps/save-analysis-rfc2126/Makefile
@@ -0,0 +1,8 @@
+include ../tools.mk
+
+all: extern_absolute_paths.rs krate2
+ $(RUSTC) extern_absolute_paths.rs -Zsave-analysis --edition=2018 --extern krate2
+ cat $(TMPDIR)/save-analysis/extern_absolute_paths.json | "$(PYTHON)" validate_json.py
+
+krate2: krate2.rs
+ $(RUSTC) $<
diff --git a/tests/run-make-fulldeps/save-analysis-rfc2126/extern_absolute_paths.rs b/tests/run-make-fulldeps/save-analysis-rfc2126/extern_absolute_paths.rs
new file mode 100644
index 000000000..7a8e3fff0
--- /dev/null
+++ b/tests/run-make-fulldeps/save-analysis-rfc2126/extern_absolute_paths.rs
@@ -0,0 +1,6 @@
+use krate2::hello;
+
+fn main() {
+ hello();
+ ::krate2::hello();
+}
diff --git a/tests/run-make-fulldeps/save-analysis-rfc2126/krate2.rs b/tests/run-make-fulldeps/save-analysis-rfc2126/krate2.rs
new file mode 100644
index 000000000..d24c68862
--- /dev/null
+++ b/tests/run-make-fulldeps/save-analysis-rfc2126/krate2.rs
@@ -0,0 +1,5 @@
+#![crate_name = "krate2"]
+#![crate_type = "lib"]
+
+pub fn hello() {
+}
diff --git a/tests/run-make-fulldeps/save-analysis-rfc2126/validate_json.py b/tests/run-make-fulldeps/save-analysis-rfc2126/validate_json.py
new file mode 100644
index 000000000..882d29a8b
--- /dev/null
+++ b/tests/run-make-fulldeps/save-analysis-rfc2126/validate_json.py
@@ -0,0 +1,7 @@
+#!/usr/bin/env python
+
+import sys
+import json
+
+crates = json.loads(sys.stdin.readline().strip())["prelude"]["external_crates"]
+assert any(map(lambda c: c["id"]["name"] == "krate2", crates))