Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Required features for Rust For Linux #3309

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

MajoraSans
Copy link

Fixes #3233.

This PR is here to show the work done on the recognition of the required features for Rust for Linux mentioned in the #3210, and aims to implement all of them.

	* ast/rust-ast-visitor.cc (DefaultASTVisitor::visit):
	enabled a default visitor to be overrided
	* ast/rust-ast-visitor.h:
	passes a method virtual
	* checks/errors/rust-feature-gate.cc (FeatureGate::visit):
	implements all checks for the new features
	* checks/errors/rust-feature-gate.h:
	the prototypes of the new checkers
	* checks/errors/rust-feature.cc (Feature::create):
	implements the recognition and creation of some new features
	* checks/errors/rust-feature.h:
	creation of the features name in the enum

gcc/testsuite/ChangeLog:

	* rust/compile/feature_extern_types.rs: Move to...
	* rust/compile/features/extern_types.rs: ...here.
	* rust/compile/feature_intrinsics.rs: Move to...
	* rust/compile/features/intrinsics.rs: ...here.
	* rust/compile/features/arbitrary_self_types_activated.rs: New test.
	* rust/compile/features/arbitrary_self_types_not_activated.rs: New test.
	* rust/compile/features/associated_type_defaults_activated.rs: New test.
	* rust/compile/features/const_trait_impl_activated.rs: New test.
	* rust/compile/features/doc_cfg_activated.rs: New test.
	* rust/compile/features/doc_cfg_not_activated.rs: New test.
	* rust/compile/features/feature.exp: New test.
	* rust/compile/features/impl_trait_in_assoc_type_activated.rs: New test.
	* rust/compile/features/impl_trait_in_assoc_type_not_activated.rs: New test.
	* rust/compile/features/register_tool_activated.rs: New test.
	* rust/compile/features/register_tool_not_activated.rs: New test.
@MajoraSans
Copy link
Author

As for now, all features marked as "Required" in #3210 are recognized, except doc_cfg, where I did not understand what was required or checked, and what the feature was actually providing. Furthermore, the Nice to have features and more precisely the associated_type_defaults one required me to change how the syntax was previously made to allow type aliases in trait to have a definition ("=" after the declaration) which currently cause a syntax error, so I preferred making this PR before continuing.

	* checks/errors/rust-feature-gate.cc (FeatureGate::visit): cleaning file.
	* checks/errors/rust-feature-gate.h: cleaning file.
	* checks/errors/rust-feature.cc: cleaning file.

gcc/testsuite/ChangeLog:

	* rust/compile/features/associated_type_defaults_activated.rs:
	Changed test to code that used the tested feature.
	* rust/compile/features/associated_type_defaults_not_activated.rs: New test.
	Will be failing, but dg-error not set up yet.

Signed-off-by: lucas.plantrose <[email protected]>
#include "rust-path.h"
#include "rust-type.h"
#include "rust-tyty.h"
#include <iostream>
Copy link
Member

Choose a reason for hiding this comment

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

this should use rust-system.h i dont see why you need iostream and rust-tyty.h for the type abstractions

Copy link
Author

Choose a reason for hiding this comment

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

I do not need them actually, my lsp just went overboard with the includes ^^'

@@ -435,7 +435,7 @@ class DefaultASTVisitor : public ASTVisitor
virtual void visit (AST::StructPatternElements &spe);
virtual void visit (AST::MaybeNamedParam &param);

void visit (AST::Attribute &attribute) {}
virtual void visit (AST::Attribute &attribute) {}
Copy link
Member

Choose a reason for hiding this comment

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

does this need virtual i dont see where your overriding it

Copy link
Member

Choose a reason for hiding this comment

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

oh wait scratch that i see now sorry

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.

Implementation of the recognition of the required features for Rust for Linux
2 participants