about summary refs log tree commit diff
path: root/src/test
diff options
context:
space:
mode:
authorMichael Goulet <michael@errs.io>2022-11-09 21:53:34 -0800
committerGitHub <noreply@github.com>2022-11-09 21:53:34 -0800
commit0c4a81c97b6309e7239eb0000bc46a5d348a2230 (patch)
tree7f4b833cca7635b5f1cb5479c388108171204375 /src/test
parente5ecf629dd0e36e0aab9c664c7a3d11d592268c9 (diff)
parentaa5a3266f408bc82dc0c1e8e9e30841c208e8228 (diff)
downloadrust-0c4a81c97b6309e7239eb0000bc46a5d348a2230.tar.gz
rust-0c4a81c97b6309e7239eb0000bc46a5d348a2230.zip
Rollup merge of #103443 - mucinoab:recover-colon-as-path-separetor, r=compiler-errors
Parser: Recover from using colon as path separator in imports

I don't know if this is the right approach, any feedback is welcome.

r? ```@compiler-errors```

Fixes #103269
Diffstat (limited to 'src/test')
-rw-r--r--src/test/ui/parser/use-colon-as-mod-sep.rs11
-rw-r--r--src/test/ui/parser/use-colon-as-mod-sep.stderr28
2 files changed, 39 insertions, 0 deletions
diff --git a/src/test/ui/parser/use-colon-as-mod-sep.rs b/src/test/ui/parser/use-colon-as-mod-sep.rs
new file mode 100644
index 00000000000..e1e8756b03c
--- /dev/null
+++ b/src/test/ui/parser/use-colon-as-mod-sep.rs
@@ -0,0 +1,11 @@
+// Recover from using a colon as a path separator.
+
+use std::process:Command;
+//~^ ERROR expected `::`, found `:`
+use std:fs::File;
+//~^ ERROR expected `::`, found `:`
+use std:collections:HashMap;
+//~^ ERROR expected `::`, found `:`
+//~| ERROR expected `::`, found `:`
+
+fn main() { }
diff --git a/src/test/ui/parser/use-colon-as-mod-sep.stderr b/src/test/ui/parser/use-colon-as-mod-sep.stderr
new file mode 100644
index 00000000000..e825dfed111
--- /dev/null
+++ b/src/test/ui/parser/use-colon-as-mod-sep.stderr
@@ -0,0 +1,28 @@
+error: expected `::`, found `:`
+  --> $DIR/use-colon-as-mod-sep.rs:3:17
+   |
+LL | use std::process:Command;
+   |                 ^ help: use double colon
+   |
+   = note: import paths are delimited using `::`
+
+error: expected `::`, found `:`
+  --> $DIR/use-colon-as-mod-sep.rs:5:8
+   |
+LL | use std:fs::File;
+   |        ^ help: use double colon
+
+error: expected `::`, found `:`
+  --> $DIR/use-colon-as-mod-sep.rs:7:8
+   |
+LL | use std:collections:HashMap;
+   |        ^ help: use double colon
+
+error: expected `::`, found `:`
+  --> $DIR/use-colon-as-mod-sep.rs:7:20
+   |
+LL | use std:collections:HashMap;
+   |                    ^ help: use double colon
+
+error: aborting due to 4 previous errors
+