Skip to content

Commit

Permalink
mangling_v0: Add a test for mangling of foreign types
Browse files Browse the repository at this point in the history
  • Loading branch information
petrochenkov committed Jan 8, 2022
1 parent 6a1f9e6 commit 1b8daf8
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 0 deletions.
19 changes: 19 additions & 0 deletions src/test/ui/symbol-names/foreign-types.rs
@@ -0,0 +1,19 @@
// build-fail
// compile-flags: -Z symbol-mangling-version=v0

#![feature(extern_types)]
#![feature(rustc_attrs)]

extern "C" {
type ForeignType;
}

struct Check<T: ?Sized>(T);

#[rustc_symbol_name]
//~^ ERROR symbol-name(_RMCs
//~| ERROR demangling(<foreign_types[
//~| ERROR demangling-alt(<foreign_types::Check<foreign_types::ForeignType>>)
impl Check<ForeignType> {}

fn main() {}
20 changes: 20 additions & 0 deletions src/test/ui/symbol-names/foreign-types.stderr
@@ -0,0 +1,20 @@
error: symbol-name(_RMCsCRATE_HASH_13foreign_typesINtB<REF>_5CheckNvNtB<REF>_011ForeignTypeE)
--> $DIR/foreign-types.rs:13:1
|
LL | #[rustc_symbol_name]
| ^^^^^^^^^^^^^^^^^^^^

error: demangling(<foreign_types[HASH]::Check<foreign_types[HASH]::ForeignType>>)
--> $DIR/foreign-types.rs:13:1
|
LL | #[rustc_symbol_name]
| ^^^^^^^^^^^^^^^^^^^^

error: demangling-alt(<foreign_types::Check<foreign_types::ForeignType>>)
--> $DIR/foreign-types.rs:13:1
|
LL | #[rustc_symbol_name]
| ^^^^^^^^^^^^^^^^^^^^

error: aborting due to 3 previous errors

0 comments on commit 1b8daf8

Please sign in to comment.