#include "rust-ast-lower-type.h"
#include "rust-hir-map.h"
#include "rust-hir-path.h"
+#include "rust-hir-type.h"
#include "rust-path.h"
#include "rust-pattern.h"
type.get_locus (), type.is_dyn ());
}
+void
+ASTLoweringType::visit (AST::ParenthesisedType &type)
+{
+ auto *inner = ASTLoweringType::translate (*type.get_type_in_parens (),
+ default_to_static_lifetime);
+
+ auto crate_num = mappings.get_current_crate ();
+ Analysis::NodeMapping mapping (crate_num, type.get_node_id (),
+ mappings.get_next_hir_id (crate_num),
+ mappings.get_next_localdef_id (crate_num));
+
+ // FIXME: Do we actually need to know if a type is parenthesized in the HIR?
+ // or can we just use the type in parens?
+ translated
+ = new HIR::ParenthesisedType (mapping, std::unique_ptr<HIR::Type> (inner),
+ type.get_locus ());
+}
+
HIR::GenericParam *
ASTLowerGenericParam::translate (AST::GenericParam ¶m)
{
#include "rust-ast-lower-base.h"
#include "rust-ast-lower-expr.h"
#include "rust-hir-path.h"
+#include "rust-type.h"
namespace Rust {
namespace HIR {
void visit (AST::NeverType &type) override;
void visit (AST::TraitObjectTypeOneBound &type) override;
void visit (AST::TraitObjectType &type) override;
+ void visit (AST::ParenthesisedType &type) override;
private:
ASTLoweringType (bool default_to_static_lifetime)
--- /dev/null
+// { dg-additional-options "-frust-compile-until=typecheck" }
+
+#![feature(optin_builtin_traits)]
+
+pub unsafe auto trait Send {}
+#[lang = "sync"]
+pub unsafe auto trait Sync {}
+
+trait A {
+ fn a_method(&self) {}
+}
+
+fn foo(a: &(dyn A + Send + Sync)) {
+ a.a_method();
+}
+
+struct S;
+
+impl A for S {
+ fn a_method(&self) {}
+}
+
+fn main() {
+ let s = S;
+
+ foo(&s);
+}