void
ResolveType::visit (AST::NeverType &)
{
- // FIXME
+ resolved_node = resolver->get_never_type_node_id ();
}
void
rust_unreachable ();
}
+void
+ResolveTypeToCanonicalPath::visit (AST::NeverType &type)
+{
+ result = CanonicalPath::new_seg (type.get_node_id (), "!");
+}
+
ResolveTypeToCanonicalPath::ResolveTypeToCanonicalPath ()
: ResolverBase (), result (CanonicalPath::create_empty ())
{}
void visit (AST::TraitObjectType &type) override;
+ void visit (AST::NeverType &type) override;
+
private:
ResolveTypeToCanonicalPath ();
setup_builtin ("isize", isize);
setup_builtin ("char", char_tyty);
setup_builtin ("str", str);
- setup_builtin ("!", never);
+
+ // never type
+ NodeId never_node_id = setup_builtin ("!", never);
+ set_never_type_node_id (never_node_id);
// unit type ()
TyTy::TupleType *unit_tyty
set_unit_type_node_id (unit_type->get_node_id ());
}
-void
+NodeId
Resolver::setup_builtin (const std::string &name, TyTy::BaseType *tyty)
{
AST::PathIdentSegment seg (name, BUILTINS_LOCATION);
mappings.insert_canonical_path (
builtin_type->get_node_id (),
CanonicalPath::new_seg (builtin_type->get_node_id (), name));
+
+ return builtin_type->get_node_id ();
}
void
Scope &get_macro_scope () { return macro_scope; }
NodeId get_global_type_node_id () { return global_type_node_id; }
+
void set_unit_type_node_id (NodeId id) { unit_ty_node_id = id; }
NodeId get_unit_type_node_id () { return unit_ty_node_id; }
+ void set_never_type_node_id (NodeId id) { never_ty_node_id = id; }
+ NodeId get_never_type_node_id () { return never_ty_node_id; }
+
void push_new_module_scope (NodeId module_id)
{
current_module_stack.push_back (module_id);
Resolver ();
void generate_builtins ();
- void setup_builtin (const std::string &name, TyTy::BaseType *tyty);
+ NodeId setup_builtin (const std::string &name, TyTy::BaseType *tyty);
Analysis::Mappings &mappings;
TypeCheckContext *tyctx;
NodeId global_type_node_id;
NodeId unit_ty_node_id;
+ NodeId never_ty_node_id;
// map a AST Node to a Rib
std::map<NodeId, Rib *> name_ribs;
--- /dev/null
+#[lang = "sized"]
+trait Sized {}
+
+// ---- gccrs additions
+
+#[lang = "clone"]
+pub trait Clone: Sized {
+ #[stable(feature = "rust1", since = "1.0.0")]
+ #[must_use = "cloning is often expensive and is not expected to have side effects"]
+ fn clone(&self) -> Self;
+
+ #[inline]
+ #[stable(feature = "rust1", since = "1.0.0")]
+ fn clone_from(&mut self, source: &Self) {
+ *self = source.clone()
+ }
+}
+
+#[unstable(feature = "never_type", issue = "35121")]
+impl Clone for ! {
+ #[inline]
+ fn clone(&self) -> Self {
+ *self
+ }
+}
box_syntax_feature_gate.rs
dropck_eyepatch_feature_gate.rs
inline_asm_parse_output_operand.rs
-issue-3030.rs
\ No newline at end of file
+issue-3030.rs
+issue-3035.rs