Add comments to hygiene tests

This commit is contained in:
Matthew Jasper 2021-10-28 21:48:39 +01:00
parent d8426ea636
commit a76a2d4ef9
13 changed files with 37 additions and 4 deletions

View File

@ -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

View File

@ -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

View File

@ -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;

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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;

View File

@ -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

View File

@ -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;

View File

@ -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

View File

@ -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;

View File

@ -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

View File

@ -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