Skip to content

Commit be4b230

Browse files
committed
gcc/rust/ChangeLog:
* 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 <[email protected]>
1 parent 8a82b04 commit be4b230

File tree

5 files changed

+40
-13
lines changed

5 files changed

+40
-13
lines changed

gcc/rust/checks/errors/rust-feature-gate.cc

+1-7
Original file line numberDiff line numberDiff line change
@@ -275,15 +275,9 @@ FeatureGate::visit (AST::ImplTraitTypeOneBound &type)
275275
void
276276
FeatureGate::visit (AST::Attribute &attr)
277277
{
278-
if (attr.get_path().as_string() == "register_tool")
278+
if (attr.get_path ().as_string () == "register_tool")
279279
gate (Feature::Name::REGISTER_TOOL, attr.get_locus (),
280280
"register tool is an experimental feature");
281281
}
282282

283-
void
284-
FeatureGate::visit (AST::TypeAlias &type)
285-
{
286-
287-
}
288-
289283
} // namespace Rust

gcc/rust/checks/errors/rust-feature-gate.h

-1
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,6 @@ class FeatureGate : public AST::DefaultASTVisitor
5555
void visit (AST::ImplTraitType &type) override;
5656
void visit (AST::ImplTraitTypeOneBound &type) override;
5757
void visit (AST::Attribute &attr) override;
58-
void visit (AST::TypeAlias &attr) override;
5958

6059
private:
6160
void gate (Feature::Name name, location_t loc, const std::string &error_msg);

gcc/rust/checks/errors/rust-feature.cc

+10-5
Original file line numberDiff line numberDiff line change
@@ -59,17 +59,22 @@ Feature::create (Feature::Name f)
5959
return Feature (f, Feature::State::ACTIVE, "optin_builtin_traits",
6060
"1.0.0", 13231);
6161
case Feature::Name::ARBITRARY_SELF_TYPES:
62-
return Feature (f, Feature::State::ACCEPTED, "arbitrary_self_types", "1.49.0", 44874);
62+
return Feature (f, Feature::State::ACCEPTED, "arbitrary_self_types",
63+
"1.49.0", 44874);
6364
case Feature::Name::DOC_CFG:
6465
return Feature (f, Feature::State::ACCEPTED, "doc_cfg", "1.49.0", 43781);
6566
case Feature::Name::IMPL_TRAIT_IN_ASSOC_TYPE:
66-
return Feature (f, Feature::State::ACCEPTED, "impl_trait_in_assoc_type", "1.49.0", 63063);
67+
return Feature (f, Feature::State::ACCEPTED, "impl_trait_in_assoc_type",
68+
"1.49.0", 63063);
6769
case Feature::Name::REGISTER_TOOL:
68-
return Feature (f, Feature::State::ACCEPTED, "register_tool", "1.49.0", 66079);
70+
return Feature (f, Feature::State::ACCEPTED, "register_tool", "1.49.0",
71+
66079);
6972
case Feature::Name::ASSOCIATED_TYPE_DEFAULTS:
70-
return Feature (f, Feature::State::ACCEPTED, "associated_type_defaults", "1.49.0", 29661);
73+
return Feature (f, Feature::State::ACCEPTED, "associated_type_defaults",
74+
"1.49.0", 29661);
7175
case Feature::Name::CONST_TRAIT_IMPL:
72-
return Feature (f, Feature::State::ACCEPTED, "const_trait_impl", "1.49.0", 67792);
76+
return Feature (f, Feature::State::ACCEPTED, "const_trait_impl", "1.49.0",
77+
67792);
7378
default:
7479
rust_unreachable ();
7580
}
Original file line numberDiff line numberDiff line change
@@ -1 +1,15 @@
1+
// check-pass
2+
3+
// This is another instance of the "normalizations don't work" issue with
4+
// defaulted associated types.
5+
16
#![feature(associated_type_defaults)]
7+
8+
pub trait Emitter<'a> {
9+
type Ctxt: 'a;
10+
type CtxtBrw: 'a = &'a Self::Ctxt;
11+
12+
fn get_cx(&'a self) -> Self::CtxtBrw;
13+
}
14+
15+
fn main() {}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
// check-pass
2+
3+
// This is another instance of the "normalizations don't work" issue with
4+
// defaulted associated types.
5+
6+
// #![feature(associated_type_defaults)]
7+
8+
pub trait Emitter<'a> {
9+
type Ctxt: 'a;
10+
type CtxtBrw: 'a = &'a Self::Ctxt;
11+
12+
fn get_cx(&'a self) -> Self::CtxtBrw;
13+
}
14+
15+
fn main() {}

0 commit comments

Comments
 (0)