about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorMatthew Jasper <mjjasper1@gmail.com>2021-10-28 21:48:39 +0100
committerMatthew Jasper <mjjasper1@gmail.com>2021-10-28 21:48:39 +0100
commita76a2d4ef986ec69e4ffb81c35dfb8dc91effee9 (patch)
tree55c1844799728e18804db3b71936939060ac4ab3 /src
parentd8426ea6369e88b4de12eed1ba8ecd6be5dc6559 (diff)
downloadrust-a76a2d4ef986ec69e4ffb81c35dfb8dc91effee9.tar.gz
rust-a76a2d4ef986ec69e4ffb81c35dfb8dc91effee9.zip
Add comments to hygiene tests
Diffstat (limited to 'src')
-rw-r--r--src/test/ui/hygiene/cross-crate-define-and-use.rs5
-rw-r--r--src/test/ui/hygiene/cross-crate-fields.rs3
-rw-r--r--src/test/ui/hygiene/cross-crate-glob-hygiene.rs5
-rw-r--r--src/test/ui/hygiene/cross-crate-glob-hygiene.stderr2
-rw-r--r--src/test/ui/hygiene/cross-crate-methods.rs4
-rw-r--r--src/test/ui/hygiene/cross-crate-name-collision.rs4
-rw-r--r--src/test/ui/hygiene/cross-crate-name-hiding-2.rs3
-rw-r--r--src/test/ui/hygiene/cross-crate-name-hiding-2.stderr2
-rw-r--r--src/test/ui/hygiene/cross-crate-name-hiding.rs3
-rw-r--r--src/test/ui/hygiene/cross-crate-name-hiding.stderr2
-rw-r--r--src/test/ui/hygiene/cross-crate-redefine.rs3
-rw-r--r--src/test/ui/hygiene/cross-crate-redefine.stderr2
-rw-r--r--src/test/ui/hygiene/cross-crate-variants.rs3
13 files changed, 37 insertions, 4 deletions
diff --git a/src/test/ui/hygiene/cross-crate-define-and-use.rs b/src/test/ui/hygiene/cross-crate-define-and-use.rs
index 9bb8d804940..94f1adff626 100644
--- a/src/test/ui/hygiene/cross-crate-define-and-use.rs
+++ b/src/test/ui/hygiene/cross-crate-define-and-use.rs
@@ -1,3 +1,8 @@
+// Check that a marco from another crate can define an item in one expansion
+// and use it from another, without it being visible to everyone.
+// This requires that the definition of `my_struct` preserves the hygiene
+// information for the tokens in its definition.
+
 // check-pass
 // aux-build:use_by_macro.rs
 
diff --git a/src/test/ui/hygiene/cross-crate-fields.rs b/src/test/ui/hygiene/cross-crate-fields.rs
index 96ed412a625..1bcd64573ac 100644
--- a/src/test/ui/hygiene/cross-crate-fields.rs
+++ b/src/test/ui/hygiene/cross-crate-fields.rs
@@ -1,3 +1,6 @@
+// Test that fields on a struct defined in another crate are resolved correctly
+// their names differ only in `SyntaxContext`.
+
 // run-pass
 // aux-build:fields.rs
 
diff --git a/src/test/ui/hygiene/cross-crate-glob-hygiene.rs b/src/test/ui/hygiene/cross-crate-glob-hygiene.rs
index ebd632d2f66..de5576682a6 100644
--- a/src/test/ui/hygiene/cross-crate-glob-hygiene.rs
+++ b/src/test/ui/hygiene/cross-crate-glob-hygiene.rs
@@ -1,3 +1,8 @@
+// Check that globs cannot import hygienic identifiers from a macro expansion
+// in another crate. `my_struct` is a `macro_rules` macro, so the struct it
+// defines is only not imported because `my_struct` is defined by a macros 2.0
+// macro.
+
 // aux-build:use_by_macro.rs
 
 extern crate use_by_macro;
diff --git a/src/test/ui/hygiene/cross-crate-glob-hygiene.stderr b/src/test/ui/hygiene/cross-crate-glob-hygiene.stderr
index 8f8ed8307b9..7369e77d070 100644
--- a/src/test/ui/hygiene/cross-crate-glob-hygiene.stderr
+++ b/src/test/ui/hygiene/cross-crate-glob-hygiene.stderr
@@ -1,5 +1,5 @@
 error[E0422]: cannot find struct, variant or union type `MyStruct` in this scope
-  --> $DIR/cross-crate-glob-hygiene.rs:16:13
+  --> $DIR/cross-crate-glob-hygiene.rs:21:13
    |
 LL |     let x = my_struct!(create);
    |             ^^^^^^^^^^^^^^^^^^ not found in this scope
diff --git a/src/test/ui/hygiene/cross-crate-methods.rs b/src/test/ui/hygiene/cross-crate-methods.rs
index f27ad893a1e..0e6f57c33f6 100644
--- a/src/test/ui/hygiene/cross-crate-methods.rs
+++ b/src/test/ui/hygiene/cross-crate-methods.rs
@@ -1,3 +1,7 @@
+// Test that methods defined in another crate are resolved correctly their
+// names differ only in `SyntaxContext`. This also checks that any name
+// resolution done when monomorphizing is correct.
+
 // run-pass
 // aux-build:methods.rs
 
diff --git a/src/test/ui/hygiene/cross-crate-name-collision.rs b/src/test/ui/hygiene/cross-crate-name-collision.rs
index 75742960b7e..8f118782f23 100644
--- a/src/test/ui/hygiene/cross-crate-name-collision.rs
+++ b/src/test/ui/hygiene/cross-crate-name-collision.rs
@@ -1,3 +1,7 @@
+// Check that two items defined in another crate that have identifiers that
+// only differ by `SyntaxContext` do not cause name collisions when imported
+// in another crate.
+
 // check-pass
 // aux-build:needs_hygiene.rs
 
diff --git a/src/test/ui/hygiene/cross-crate-name-hiding-2.rs b/src/test/ui/hygiene/cross-crate-name-hiding-2.rs
index 8d416b02104..3eacd775c9e 100644
--- a/src/test/ui/hygiene/cross-crate-name-hiding-2.rs
+++ b/src/test/ui/hygiene/cross-crate-name-hiding-2.rs
@@ -1,3 +1,6 @@
+// Check that an identifier from a 2.0 macro in another crate cannot be
+// resolved with an identifier that's not from a macro expansion.
+
 // aux-build:use_by_macro.rs
 
 extern crate use_by_macro;
diff --git a/src/test/ui/hygiene/cross-crate-name-hiding-2.stderr b/src/test/ui/hygiene/cross-crate-name-hiding-2.stderr
index 1a7e4900b8f..46314cdd5ab 100644
--- a/src/test/ui/hygiene/cross-crate-name-hiding-2.stderr
+++ b/src/test/ui/hygiene/cross-crate-name-hiding-2.stderr
@@ -1,5 +1,5 @@
 error[E0422]: cannot find struct, variant or union type `MyStruct` in this scope
-  --> $DIR/cross-crate-name-hiding-2.rs:10:13
+  --> $DIR/cross-crate-name-hiding-2.rs:13:13
    |
 LL |     let x = MyStruct {};
    |             ^^^^^^^^ not found in this scope
diff --git a/src/test/ui/hygiene/cross-crate-name-hiding.rs b/src/test/ui/hygiene/cross-crate-name-hiding.rs
index 87d011dfe87..dd76ecc5762 100644
--- a/src/test/ui/hygiene/cross-crate-name-hiding.rs
+++ b/src/test/ui/hygiene/cross-crate-name-hiding.rs
@@ -1,3 +1,6 @@
+// Check that an item defined by a 2.0 macro in another crate cannot be used in
+// another crate.
+
 // aux-build:pub_hygiene.rs
 
 extern crate pub_hygiene;
diff --git a/src/test/ui/hygiene/cross-crate-name-hiding.stderr b/src/test/ui/hygiene/cross-crate-name-hiding.stderr
index 149d7eec4ef..f8840c8f85a 100644
--- a/src/test/ui/hygiene/cross-crate-name-hiding.stderr
+++ b/src/test/ui/hygiene/cross-crate-name-hiding.stderr
@@ -1,5 +1,5 @@
 error[E0422]: cannot find struct, variant or union type `MyStruct` in this scope
-  --> $DIR/cross-crate-name-hiding.rs:8:13
+  --> $DIR/cross-crate-name-hiding.rs:11:13
    |
 LL |     let x = MyStruct {};
    |             ^^^^^^^^ not found in this scope
diff --git a/src/test/ui/hygiene/cross-crate-redefine.rs b/src/test/ui/hygiene/cross-crate-redefine.rs
index c79a6be5133..3cb06b4bad8 100644
--- a/src/test/ui/hygiene/cross-crate-redefine.rs
+++ b/src/test/ui/hygiene/cross-crate-redefine.rs
@@ -1,3 +1,6 @@
+// Check that items with identical `SyntaxContext` conflict even when that
+// context involves a mark from another crate.
+
 // aux-build:use_by_macro.rs
 
 extern crate use_by_macro;
diff --git a/src/test/ui/hygiene/cross-crate-redefine.stderr b/src/test/ui/hygiene/cross-crate-redefine.stderr
index 6d0c95117dd..4f1419de426 100644
--- a/src/test/ui/hygiene/cross-crate-redefine.stderr
+++ b/src/test/ui/hygiene/cross-crate-redefine.stderr
@@ -1,5 +1,5 @@
 error[E0428]: the name `MyStruct` is defined multiple times
-  --> $DIR/cross-crate-redefine.rs:7:1
+  --> $DIR/cross-crate-redefine.rs:10:1
    |
 LL | my_struct!(define);
    | ^^^^^^^^^^^^^^^^^^ `MyStruct` redefined here
diff --git a/src/test/ui/hygiene/cross-crate-variants.rs b/src/test/ui/hygiene/cross-crate-variants.rs
index 6c5671f3249..efc73a21f16 100644
--- a/src/test/ui/hygiene/cross-crate-variants.rs
+++ b/src/test/ui/hygiene/cross-crate-variants.rs
@@ -1,3 +1,6 @@
+// Test that variants of an enum defined in another crate are resolved
+// correctly when their names differ only in `SyntaxContext`.
+
 // run-pass
 // aux-build:variants.rs