Skip to content

Conversation

@CohenArthur
Copy link
Member

Add a specific flag for compiling core which changes compiler generated paths. This is important for derives, and especially for core, where we want to implement crate::marker::Copy rather than core::marker::Copy.

gcc/rust/ChangeLog:

* lang.opt: Add -frust-compile-core option.
* ast/rust-ast-builder.h: Add get_path_start method which depends on -frust-compile-core
* ast/rust-ast-builder.cc (Builder::discriminant_value): Use it.
* expand/rust-derive-debug.cc (DeriveDebug::stub_debug_fn): Likewise.
* expand/rust-derive-default.cc (DeriveDefault::default_call): Likewise.
* expand/rust-derive-eq.cc (DeriveEq::assert_param_is_eq): Likewise.
* expand/rust-derive-hash.cc (DeriveHash::hash_call): Likewise. (DeriveHash::hash_fn): Likewise.
* expand/rust-derive-ord.cc (DeriveOrd::cmp_call): Likewise. (DeriveOrd::cmp_fn): Likewise. (DeriveOrd::make_equal): Likewise. (DeriveOrd::recursive_match): Likewise.
* expand/rust-expand-format-args.cc (format_arg): Likewise. (expand_format_args): Likewise.

Add a specific flag for compiling core which changes compiler generated paths.
This is important for derives, and especially for core, where we want to implement
crate::marker::Copy rather than core::marker::Copy.

gcc/rust/ChangeLog:

	* lang.opt: Add -frust-compile-core option.
	* ast/rust-ast-builder.h: Add get_path_start method which depends on
	-frust-compile-core
	* ast/rust-ast-builder.cc (Builder::discriminant_value): Use it.
	* expand/rust-derive-debug.cc (DeriveDebug::stub_debug_fn): Likewise.
	* expand/rust-derive-default.cc (DeriveDefault::default_call): Likewise.
	* expand/rust-derive-eq.cc (DeriveEq::assert_param_is_eq): Likewise.
	* expand/rust-derive-hash.cc (DeriveHash::hash_call): Likewise.
	(DeriveHash::hash_fn): Likewise.
	* expand/rust-derive-ord.cc (DeriveOrd::cmp_call): Likewise.
	(DeriveOrd::cmp_fn): Likewise.
	(DeriveOrd::make_equal): Likewise.
	(DeriveOrd::recursive_match): Likewise.
	* expand/rust-expand-format-args.cc (format_arg): Likewise.
	(expand_format_args): Likewise.
Rust Var(flag_unused_check_2_0)
Use the new unused variable check implementation.

frust-compile-core
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We could maybe rely on #[no_core] instead.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants