Skip to content

Commit

Permalink
gcc/rust/ChangeLog:
Browse files Browse the repository at this point in the history
	* checks/errors/rust-feature-gate.cc (FeatureGate::visit): cleaning file.
	* checks/errors/rust-feature-gate.h: 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 <lucas.plantrose@epita.fr>
  • Loading branch information
MajoraSans committed Dec 18, 2024
1 parent 453a6fa commit 23df30c
Show file tree
Hide file tree
Showing 5 changed files with 40 additions and 13 deletions.
8 changes: 1 addition & 7 deletions gcc/rust/checks/errors/rust-feature-gate.cc
Original file line number Diff line number Diff line change
Expand Up @@ -275,15 +275,9 @@ FeatureGate::visit (AST::ImplTraitTypeOneBound &type)
void
FeatureGate::visit (AST::Attribute &attr)
{
if (attr.get_path().as_string() == "register_tool")
if (attr.get_path ().as_string () == "register_tool")
gate (Feature::Name::REGISTER_TOOL, attr.get_locus (),
"register tool is an experimental feature");
}

void
FeatureGate::visit (AST::TypeAlias &type)
{

}

} // namespace Rust
1 change: 0 additions & 1 deletion gcc/rust/checks/errors/rust-feature-gate.h
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@ class FeatureGate : public AST::DefaultASTVisitor
void visit (AST::ImplTraitType &type) override;
void visit (AST::ImplTraitTypeOneBound &type) override;
void visit (AST::Attribute &attr) override;
void visit (AST::TypeAlias &attr) override;

private:
void gate (Feature::Name name, location_t loc, const std::string &error_msg);
Expand Down
15 changes: 10 additions & 5 deletions gcc/rust/checks/errors/rust-feature.cc
Original file line number Diff line number Diff line change
Expand Up @@ -59,17 +59,22 @@ Feature::create (Feature::Name f)
return Feature (f, Feature::State::ACTIVE, "optin_builtin_traits",
"1.0.0", 13231);
case Feature::Name::ARBITRARY_SELF_TYPES:
return Feature (f, Feature::State::ACCEPTED, "arbitrary_self_types", "1.49.0", 44874);
return Feature (f, Feature::State::ACCEPTED, "arbitrary_self_types",
"1.49.0", 44874);
case Feature::Name::DOC_CFG:
return Feature (f, Feature::State::ACCEPTED, "doc_cfg", "1.49.0", 43781);
case Feature::Name::IMPL_TRAIT_IN_ASSOC_TYPE:
return Feature (f, Feature::State::ACCEPTED, "impl_trait_in_assoc_type", "1.49.0", 63063);
return Feature (f, Feature::State::ACCEPTED, "impl_trait_in_assoc_type",
"1.49.0", 63063);
case Feature::Name::REGISTER_TOOL:
return Feature (f, Feature::State::ACCEPTED, "register_tool", "1.49.0", 66079);
return Feature (f, Feature::State::ACCEPTED, "register_tool", "1.49.0",
66079);
case Feature::Name::ASSOCIATED_TYPE_DEFAULTS:
return Feature (f, Feature::State::ACCEPTED, "associated_type_defaults", "1.49.0", 29661);
return Feature (f, Feature::State::ACCEPTED, "associated_type_defaults",
"1.49.0", 29661);
case Feature::Name::CONST_TRAIT_IMPL:
return Feature (f, Feature::State::ACCEPTED, "const_trait_impl", "1.49.0", 67792);
return Feature (f, Feature::State::ACCEPTED, "const_trait_impl", "1.49.0",
67792);
default:
rust_unreachable ();
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1,15 @@
// check-pass

Check failure on line 1 in gcc/testsuite/rust/compile/features/associated_type_defaults_activated.rs

View workflow job for this annotation

GitHub Actions / build-alpine-32bit-and-check-alpine-32bit

Test failure (FAIL)

(test for excess errors)

Check failure on line 1 in gcc/testsuite/rust/compile/features/associated_type_defaults_activated.rs

View workflow job for this annotation

GitHub Actions / build-and-check-asan

Test failure (FAIL)

(test for excess errors)

Check failure on line 1 in gcc/testsuite/rust/compile/features/associated_type_defaults_activated.rs

View workflow job for this annotation

GitHub Actions / build-and-check-ubuntu-32bit

Test failure (FAIL)

(test for excess errors)

Check failure on line 1 in gcc/testsuite/rust/compile/features/associated_type_defaults_activated.rs

View workflow job for this annotation

GitHub Actions / build-and-check-ubuntu-64bit

Test failure (FAIL)

(test for excess errors)

Check failure on line 1 in gcc/testsuite/rust/compile/features/associated_type_defaults_activated.rs

View workflow job for this annotation

GitHub Actions / build-and-check-ubuntu-64bit-glibcxx

Test failure (FAIL)

(test for excess errors)

// This is another instance of the "normalizations don't work" issue with
// defaulted associated types.

#![feature(associated_type_defaults)]

pub trait Emitter<'a> {
type Ctxt: 'a;
type CtxtBrw: 'a = &'a Self::Ctxt;

fn get_cx(&'a self) -> Self::CtxtBrw;
}

fn main() {}
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
// check-pass

Check failure on line 1 in gcc/testsuite/rust/compile/features/associated_type_defaults_not_activated.rs

View workflow job for this annotation

GitHub Actions / build-alpine-32bit-and-check-alpine-32bit

Test failure (FAIL)

(test for excess errors)

Check failure on line 1 in gcc/testsuite/rust/compile/features/associated_type_defaults_not_activated.rs

View workflow job for this annotation

GitHub Actions / build-and-check-asan

Test failure (FAIL)

(test for excess errors)

Check failure on line 1 in gcc/testsuite/rust/compile/features/associated_type_defaults_not_activated.rs

View workflow job for this annotation

GitHub Actions / build-and-check-ubuntu-32bit

Test failure (FAIL)

(test for excess errors)

Check failure on line 1 in gcc/testsuite/rust/compile/features/associated_type_defaults_not_activated.rs

View workflow job for this annotation

GitHub Actions / build-and-check-ubuntu-64bit

Test failure (FAIL)

(test for excess errors)

Check failure on line 1 in gcc/testsuite/rust/compile/features/associated_type_defaults_not_activated.rs

View workflow job for this annotation

GitHub Actions / build-and-check-ubuntu-64bit-glibcxx

Test failure (FAIL)

(test for excess errors)

// This is another instance of the "normalizations don't work" issue with
// defaulted associated types.

// #![feature(associated_type_defaults)]

pub trait Emitter<'a> {
type Ctxt: 'a;
type CtxtBrw: 'a = &'a Self::Ctxt;

fn get_cx(&'a self) -> Self::CtxtBrw;
}

fn main() {}

0 comments on commit 23df30c

Please sign in to comment.