Open CohenArthur opened 1 year ago
Done @DrMahad! Thank you :)
struct GTY (()) lang_type
from rust-tree.h
to rust-lang.cc
, I get the following error.
-S ../../gccrs/gcc -I gtyp-input.list -w tmp-gtype.state
../../gccrs/gcc/rust/rust-lang.cc:164: duplicate definition of 'struct lang_type'
../../gccrs/gcc/rust/rust-lang.cc:159: previous definition here
make[2]: *** [Makefile:2853: s-gtype] Error 1
make[2]: Leaving directory '/home/mahad/Desktop/DrMahad/gccrs-build/gcc'
make[1]: *** [Makefile:4571: all-gcc] Error 2
make[1]: Leaving directory '/home/mahad/Desktop/DrMahad/gccrs-build'
make: *** [Makefile:1006: all] Error 2
struct GTY (()) lang_type
from rust-tree.h, I get the following error:
In file included from ../../gccrs/gcc/rust/backend/rust-constexpr.cc:20:
../../gccrs/gcc/rust/backend/rust-constexpr.cc: In function ‘bool Rust::Compile::build_data_member_initialization(tree, vec<constructor_elt, va_gc>**)’:
../../gccrs/gcc/rust/backend/rust-tree.h:1324:55: error: invalid use of incomplete type ‘struct lang_type’
1324 | (CLASS_TYPE_P (NODE) && LANG_TYPE_CLASS_CHECK (NODE)->anon_aggr)
| ^~
../../gccrs/gcc/rust/backend/rust-constexpr.cc:3833:16: note: in expansion of macro ‘ANON_AGGR_TYPE_P’
3833 | else if (ANON_AGGR_TYPE_P (TREE_TYPE (aggr)))
| ^~~~~~~~~~~~~~~~
In file included from ../../gccrs/gcc/tree.h:23,
from ../../gccrs/gcc/rust/backend/rust-constexpr.h:21,
from ../../gccrs/gcc/rust/backend/rust-constexpr.cc:17:
../../gccrs/gcc/tree-core.h:1740:10: note: forward declaration of ‘struct lang_type’
1740 | struct lang_type *lang_specific;
| ^~~~~~~~~
make[2]: *** [../../gccrs/gcc/rust/Make-lang.in:360: rust/rust-constexpr.o] Error 1
make[2]: Leaving directory '/home/mahad/Desktop/DrMahad/gccrs-build/gcc'
make[1]: *** [Makefile:4571: all-gcc] Error 2
make[1]: Leaving directory '/home/mahad/Desktop/DrMahad/gccrs-build'
make: *** [Makefile:1006: all] Error 2
struct GTY (()) lang_type
from rust-lang.cc
, I get the following error:
/usr/bin/ld: rust/rust-lang.o: in function `gt_ggc_mx_lang_tree_node(void*)':
/home/mahad/Desktop/DrMahad/gccrs-build/gcc/./gt-rust-rust-lang.h:369: undefined reference to `gt_ggc_mx_lang_type(void*)'
/usr/bin/ld: /home/mahad/Desktop/DrMahad/gccrs-build/gcc/./gt-rust-rust-lang.h:344: undefined reference to `gt_ggc_mx_lang_type(void*)'
/usr/bin/ld: rust/rust-lang.o: in function `gt_pch_nx_lang_tree_node(void*)':
/home/mahad/Desktop/DrMahad/gccrs-build/gcc/./gt-rust-rust-lang.h:830: undefined reference to `gt_pch_nx_lang_type(void*)'
/usr/bin/ld: /home/mahad/Desktop/DrMahad/gccrs-build/gcc/./gt-rust-rust-lang.h:855: undefined reference to `gt_pch_nx_lang_type(void*)'
collect2: error: ld returned 1 exit status
make[2]: *** [../../gccrs/gcc/rust/Make-lang.in:175: rust1] Error 1
make[2]: Leaving directory '/home/mahad/Desktop/DrMahad/gccrs-build/gcc'
make[1]: *** [Makefile:4571: all-gcc] Error 2
make[1]: Leaving directory '/home/mahad/Desktop/DrMahad/gccrs-build'
make: *** [Makefile:1006: all] Error 2
gccrs/gcc/rust/backend/rust-tree.h
to lang_type2. So, I get the following error:
/gcc/rust/util -I ../../gccrs/gcc/rust/metadata ../../gccrs/gcc/rust/backend/rust-constexpr.cc
In file included from ../../gccrs/gcc/rust/backend/rust-constexpr.cc:20:
../../gccrs/gcc/rust/backend/rust-constexpr.cc: In function ‘bool Rust::Compile::build_data_member_initialization(tree, vec<constructor_elt, va_gc>**)’:
../../gccrs/gcc/rust/backend/rust-tree.h:1324:55: error: invalid use of incomplete type ‘struct lang_type’
1324 | (CLASS_TYPE_P (NODE) && LANG_TYPE_CLASS_CHECK (NODE)->anon_aggr)
| ^~
../../gccrs/gcc/rust/backend/rust-constexpr.cc:3833:16: note: in expansion of macro ‘ANON_AGGR_TYPE_P’
3833 | else if (ANON_AGGR_TYPE_P (TREE_TYPE (aggr)))
| ^~~~~~~~~~~~~~~~
In file included from ../../gccrs/gcc/tree.h:23,
from ../../gccrs/gcc/rust/backend/rust-constexpr.h:21,
from ../../gccrs/gcc/rust/backend/rust-constexpr.cc:17:
../../gccrs/gcc/tree-core.h:1740:10: note: forward declaration of ‘struct lang_type’
1740 | struct lang_type *lang_specific;
| ^~~~~~~~~
make[2]: *** [../../gccrs/gcc/rust/Make-lang.in:360: rust/rust-constexpr.o] Error 1
make[2]: Leaving directory '/home/mahad/Desktop/DrMahad/gccrs-build/gcc'
make[1]: *** [Makefile:4571: all-gcc] Error 2
make[1]: Leaving directory '/home/mahad/Desktop/DrMahad/gccrs-build'
make: *** [Makefile:1006: all] Error 2
---
As a non-gccrs person, just the person who filed the bug:
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108087#c4 makes it sound like it's not the same, just similar.
Thank you @thesamesam for helping me in this issue.
The issue is that we have ported over constexpr support from C++ as Rust compiles time constant evaluation. But this meant porting over some of the C++ custom GCC bits. Its an awkward issue, probably one for me to sort out in a few weeks unless someone can extract it out into a shared header like @thesamesam has suggested and we talked about on zulip.
Quoting myself on BZ:
I think this was fixed by https://github.com/Rust-GCC/gccrs/pull/2586 -> r14-7947-g9048f08f4e9459.
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108087