gcc/rust/ChangeLog:
* util/rust-lang-item.h: Add handling for `phantom_data` lang item.
gcc/testsuite/ChangeLog:
* rust/compile/torture/phantom_data.rs: New test.
MUT_PTR,
CONST_SLICE_PTR,
+ // https://github.com/rust-lang/rust/blob/master/library/core/src/marker.rs
+ PHANTOM_DATA,
+
// functions
FN_ONCE,
FN_ONCE_OUTPUT,
{
return ItemType::CONST_SLICE_PTR;
}
+ else if (item.compare ("phantom_data") == 0)
+ {
+ return ItemType::PHANTOM_DATA;
+ }
else if (item.compare ("fn_once") == 0)
{
return ItemType::FN_ONCE;
return "mut_ptr";
case CONST_SLICE_PTR:
return "const_slice_ptr";
+ case PHANTOM_DATA:
+ return "phantom_data";
case FN_ONCE:
return "fn_once";
case FN_ONCE_OUTPUT:
--- /dev/null
+// { dg-options "-w" }
+#[lang = "phantom_data"]
+struct PhantomData<T>;
+
+trait Hash {
+ fn hash<H>(&self, state: &mut H);
+}
+
+impl<T> Hash for PhantomData<T> {
+ fn hash<H>(&self, state: &mut H) {}
+}