]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
gccrs: Reindent using last clang-format configuration
authorMarc Poulhiès <dkm@kataplop.net>
Sat, 10 May 2025 18:51:38 +0000 (20:51 +0200)
committerArthur Cohen <arthur.cohen@embecosm.com>
Tue, 5 Aug 2025 14:36:42 +0000 (16:36 +0200)
It changes declaration and switch case indentation to follow GNU coding
style.

gcc/rust/ChangeLog:

* ast/rust-ast-builder-type.cc (ASTTypeBuilder::visit): Reindent.
* ast/rust-ast-builder.cc (Builder::new_generic_args): Likewise.
* ast/rust-ast-collector.cc (TokenCollector::visit): Likewise.
* ast/rust-ast-dump.h (debug): Likewise.
* ast/rust-ast-formatting.h (indent_spaces): Likewise.
(get_string_in_delims): Likewise.
(get_mode_dump_desc): Likewise.
(append_attributes): Likewise.
(unquote_string): Likewise.
* ast/rust-ast-visitor.cc (DefaultASTVisitor::visit): Likewise.
* ast/rust-ast.cc (Attribute::get_traits_to_derive): Likewise.
(UseTreeGlob::as_string): Likewise.
(UseTreeList::as_string): Likewise.
(AttributeParser::parse_path_meta_item): Likewise.
(FormatArgs::set_outer_attrs): Likewise.
* ast/rust-ast.h (operator<<): Likewise.
* ast/rust-cond-compilation.h: Likewise.
* ast/rust-desugar-apit.cc: Likewise.
* ast/rust-fmt.h (collect_pieces): Likewise.
(clone_pieces): Likewise.
* ast/rust-pattern.h (tokenid_to_rangekind): Likewise.
* backend/rust-compile-context.cc (Context::type_hasher): Likewise.
* backend/rust-compile-expr.cc (CompileExpr::visit): Likewise.
* backend/rust-compile-intrinsic.cc (get_identifier): Likewise.
(offset_handler): Likewise.
(sizeof_handler): Likewise.
(transmute_handler): Likewise.
(rotate_handler): Likewise.
(wrapping_op_handler_inner): Likewise.
(op_with_overflow_inner): Likewise.
(uninit_handler): Likewise.
(move_val_init_handler): Likewise.
(assume_handler): Likewise.
(discriminant_value_handler): Likewise.
(variant_count_handler): Likewise.
(prefetch_data_handler): Likewise.
(atomic_store_handler_inner): Likewise.
(atomic_load_handler_inner): Likewise.
(unchecked_op_inner): Likewise.
(copy_handler_inner): Likewise.
(expect_handler_inner): Likewise.
(try_handler_inner): Likewise.
* backend/rust-compile-pattern.cc (compile_range_pattern_bound): Likewise.
(CompilePatternCheckExpr::visit): Likewise.
(CompilePatternBindings::visit): Likewise.
(CompilePatternLet::visit): Likewise.
* backend/rust-compile-var-decl.h: Likewise.
* backend/rust-constexpr.cc (verify_constant): Likewise.
(find_array_ctor_elt): Likewise.
(array_index_cmp): Likewise.
(potential_constant_expression_1): Likewise.
(unshare_constructor): Likewise.
(maybe_save_constexpr_fundef): Likewise.
(returns): Likewise.
(breaks): Likewise.
(continues): Likewise.
(switches): Likewise.
(constant_value_1): Likewise.
(decl_constant_value): Likewise.
(non_const_var_error): Likewise.
(eval_constant_expression): Likewise.
(constexpr_fn_retval): Likewise.
(eval_store_expression): Likewise.
(eval_call_expression): Likewise.
(eval_binary_expression): Likewise.
(get_function_named_in_call): Likewise.
(eval_statement_list): Likewise.
(extract_string_elt): Likewise.
(eval_conditional_expression): Likewise.
(eval_bit_field_ref): Likewise.
(eval_loop_expr): Likewise.
(eval_switch_expr): Likewise.
(eval_unary_expression): Likewise.
(get_or_insert_ctor_field): Likewise.
(eval_and_check_array_index): Likewise.
* backend/rust-constexpr.h (maybe_save_constexpr_fundef): Likewise.
* backend/rust-mangle-v0.cc (v0_path): Likewise.
(v0_complex_type_prefix): Likewise.
* backend/rust-mangle.h (legacy_mangle_item): Likewise.
(v0_mangle_item): Likewise.
* backend/rust-tree.cc (convert_to_void): Likewise.
(find_parameter_packs_r): Likewise.
(rs_tree_equal): Likewise.
(publicly_uniquely_derived_p): Likewise.
(instantiation_dependent_expression_p): Likewise.
(type_has_nontrivial_copy_init): Likewise.
(is_normal_capture_proxy): Likewise.
(is_bitfield_expr_with_lowered_type): Likewise.
(undeduced_auto_decl): Likewise.
(require_deduced_type): Likewise.
(gt_pch_nx): Likewise.
(lvalue_kind): Likewise.
* backend/rust-tree.h (LANG_DECL_MIN_CHECK): Likewise.
(LANG_DECL_FN_CHECK): Likewise.
(LANG_DECL_NS_CHECK): Likewise.
(LANG_DECL_PARM_CHECK): Likewise.
(LANG_DECL_DECOMP_CHECK): Likewise.
(resort_type_member_vec): Likewise.
(convert_to_void): Likewise.
(mark_discarded_use): Likewise.
(mark_exp_read): Likewise.
(mark_use): Likewise.
(mark_rvalue_use): Likewise.
(mark_lvalue_use): Likewise.
(mark_lvalue_use_nonread): Likewise.
(convert_from_reference): Likewise.
(maybe_warn_nodiscard): Likewise.
(expr_loc_or_loc): Likewise.
(expr_loc_or_input_loc): Likewise.
(get_fndecl_from_callee): Likewise.
(pointer_offset_expression): Likewise.
(is_empty_class): Likewise.
(is_really_empty_class): Likewise.
(rs_type_quals): Likewise.
(init_modules): Likewise.
(lookup_add): Likewise.
(ovl_make): Likewise.
(struct c_fileinfo): Likewise.
(get_fileinfo): Likewise.
(cxx_make_type): Likewise.
(build_cplus_array_type): Likewise.
(comptypes): Likewise.
(rs_build_qualified_type_real): Likewise.
(vector_targets_convertible_p): Likewise.
(get_class_binding_direct): Likewise.
(lang_check_failed): Likewise.
(check_for_uninitialized_const_var): Likewise.
(cp_fold_maybe_rvalue): Likewise.
(fold_offsetof): Likewise.
(fold_non_dependent_expr): Likewise.
(in_immediate_context): Likewise.
(cxx_mark_addressable): Likewise.
(decl_constant_value): Likewise.
(is_class_type): Likewise.
(fold_builtin_is_pointer_inverconvertible_with_class): Likewise.
(c_common_type_for_mode): Likewise.
(next_common_initial_seqence): Likewise.
(fold_builtin_is_corresponding_member): Likewise.
(maybe_constant_value): Likewise.
(rs_walk_subtrees): Likewise.
(make_tree_vector): Likewise.
(release_tree_vector): Likewise.
(location_of): Likewise.
(maybe_constant_init): Likewise.
(explain_invalid_constexpr_fn): Likewise.
(literal_type_p): Likewise.
(maybe_constexpr_fn): Likewise.
(fold_non_dependent_init): Likewise.
* checks/errors/borrowck/polonius/rust-polonius.h (polonius_run): Likewise.
(FFIVector__new): Likewise.
(FFIVector__new_vec_pair): Likewise.
(FFIVector__new_vec_triple): Likewise.
(FFIVector__push): Likewise.
(FFIVector__push_vec_triple): Likewise.
* checks/errors/borrowck/rust-bir-builder-expr-stmt.cc
(ExprStmtBuilder::visit): Likewise.
* checks/errors/borrowck/rust-bir-builder-pattern.cc
(PatternBindingBuilder::visit): Likewise.
* checks/errors/borrowck/rust-bir-dump.cc (Dump::visit): Likewise.
* checks/errors/borrowck/rust-bir-fact-collector.h (points): Likewise.
* checks/errors/borrowck/rust-bir-place.h: Likewise.
* checks/errors/borrowck/rust-bir-visitor.h: Likewise.
* checks/errors/privacy/rust-privacy-check.cc (saw_errors): Likewise.
* checks/errors/privacy/rust-privacy-ctx.h (rust_privacy_ctx_test): Likewise.
* checks/errors/privacy/rust-privacy-reporter.cc
(PrivacyReporter::check_for_privacy_violation): Likewise.
(PrivacyReporter::check_base_type_privacy): Likewise.
(PrivacyReporter::visit): Likewise.
* checks/errors/privacy/rust-reachability.cc (ReachabilityVisitor::visit): Likewise.
* checks/errors/privacy/rust-visibility-resolver.cc
(VisibilityResolver::resolve_visibility): Likewise.
* checks/errors/rust-hir-pattern-analysis.cc (Constructor::is_covered_by): Likewise.
(PlaceInfo::specialize): Likewise.
(WitnessPat::to_string): Likewise.
(WitnessMatrix::apply_constructor): Likewise.
(lower_pattern): Likewise.
(lower_tuple_pattern): Likewise.
(lower_struct_pattern): Likewise.
* checks/errors/rust-hir-pattern-analysis.h (check_match_usefulness): Likewise.
* expand/rust-cfg-strip.cc (CfgStrip::maybe_strip_generic_args): Likewise.
* expand/rust-derive-eq.cc (DeriveEq::visit_enum): Likewise.
* expand/rust-derive.cc: Likewise.
* expand/rust-expand-format-args.cc (expand_format_args): Likewise.
* expand/rust-expand-visitor.h (is_derive): Likewise.
(is_builtin): Likewise.
* expand/rust-macro-builtins-asm.cc (expand_inline_asm_strings): Likewise.
* expand/rust-macro-builtins-asm.h (parse_asm): Likewise.
(check_identifier): Likewise.
(check_and_set): Likewise.
(parse_label): Likewise.
(parse_llvm_outputs): Likewise.
(parse_llvm_inputs): Likewise.
(parse_llvm_clobbers): Likewise.
(parse_llvm_options): Likewise.
* expand/rust-macro-builtins-helpers.h (make_macro_path_str): Likewise.
(make_token): Likewise.
(make_string): Likewise.
(macro_end_token): Likewise.
(parse_single_string_literal): Likewise.
(source_relative_path): Likewise.
(load_file_bytes): Likewise.
* expand/rust-macro-expand.cc (MacroExpander::match_fragment): Likewise.
(MacroExpander::match_matcher): Likewise.
(MacroExpander::match_n_matches): Likewise.
* expand/rust-macro-substitute-ctx.cc (SubstituteCtx::substitute_token): Likewise.
* expand/rust-proc-macro.h (load_macros): Likewise.
(generate_proc_macro_decls_symbol): Likewise.
* hir/rust-ast-lower-base.cc (ASTLoweringBase::lower_generic_args): Likewise.
(ASTLoweringBase::lower_range_pattern_bound): Likewise.
* hir/rust-ast-lower-item.cc (ASTLoweringItem::visit): Likewise.
* hir/rust-ast-lower-pattern.cc (ASTLoweringPattern::visit): Likewise.
* hir/rust-ast-lower.h (struct_field_name_exists): Likewise.
(translate_visibility): Likewise.
* hir/rust-hir-dump.cc (Dump::visit): Likewise.
* hir/rust-hir-dump.h (debug): Likewise.
* hir/tree/rust-hir.cc (UseTreeGlob::as_string): Likewise.
(UseTreeList::as_string): Likewise.
* lex/rust-lex.cc (Lexer::parse_escape): Likewise.
(Lexer::parse_utf8_escape): Likewise.
* lex/rust-lex.h (rust_input_source_test): Likewise.
* lex/rust-token.cc (RS_TOKEN_KEYWORD_2015): Likewise.
* lex/rust-token.h (get_token_description): Likewise.
(token_id_to_str): Likewise.
(token_id_is_keyword): Likewise.
(token_id_keyword_string): Likewise.
(get_type_hint_string): Likewise.
(nfc_normalize_token_string): Likewise.
* metadata/rust-export-metadata.cc (PublicInterface::write_to_path): Likewise.
* metadata/rust-import-archive.cc: Likewise.
* metadata/rust-imports.h (add_search_path): Likewise.
* parse/rust-cfg-parser.h (parse_cfg_option): Likewise.
(rust_cfg_parser_test): Likewise.
* parse/rust-parse-impl.h (Parser::skip_generics_right_angle): Likewise.
(Parser::parse_attr_input): Likewise.
(Parser::parse_macro_match): Likewise.
(Parser::parse_visibility): Likewise.
(Parser::parse_module): Likewise.
(Parser::parse_use_tree): Likewise.
(Parser::parse_generic_param): Likewise.
(Parser::parse_struct): Likewise.
(Parser::parse_enum_item): Likewise.
(Parser::parse_inherent_impl_item): Likewise.
(Parser::parse_external_item): Likewise.
(Parser::parse_generic_arg): Likewise.
(Parser::parse_type_path_segment): Likewise.
(Parser::parse_expr_stmt): Likewise.
(Parser::parse_if_expr): Likewise.
(Parser::parse_if_let_expr): Likewise.
(Parser::parse_type): Likewise.
(Parser::parse_for_prefixed_type): Likewise.
(Parser::parse_slice_or_array_type): Likewise.
(Parser::parse_type_no_bounds): Likewise.
(Parser::parse_range_pattern_bound): Likewise.
(Parser::parse_pattern_no_alt): Likewise.
(Parser::parse_grouped_or_tuple_pattern): Likewise.
(Parser::parse_ident_leading_pattern): Likewise.
(Parser::parse_tuple_struct_items): Likewise.
(Parser::parse_stmt_or_expr): Likewise.
(Parser::parse_struct_expr_field): Likewise.
(Parser::null_denotation): Likewise.
(Parser::left_denotation): Likewise.
(Parser::parse_closure_expr_pratt): Likewise.
* parse/rust-parse.cc (peculiar_fragment_match_compatible): Likewise.
(is_match_compatible): Likewise.
* parse/rust-parse.h (extract_module_path): Likewise.
(is_match_compatible): Likewise.
* resolve/rust-ast-resolve-expr.cc (translate_operand): Likewise.
* resolve/rust-ast-resolve-item.cc (flatten_glob): Likewise.
(flatten_rebind): Likewise.
(flatten_list): Likewise.
(flatten): Likewise.
* resolve/rust-ast-resolve-item.h (rust_simple_path_resolve_test): Likewise.
* resolve/rust-ast-resolve-pattern.cc (PatternDeclaration::visit): Likewise.
(resolve_range_pattern_bound): Likewise.
* resolve/rust-ast-resolve-type.cc (ResolveRelativeTypePath::go): Likewise.
(ResolveTypeToCanonicalPath::visit): Likewise.
* resolve/rust-ast-resolve.cc (saw_errors): Likewise.
* resolve/rust-early-name-resolver-2.0.cc (Early::finalize_rebind_import): Likewise.
* resolve/rust-late-name-resolver-2.0.cc (Late::visit): Likewise.
* resolve/rust-toplevel-name-resolver-2.0.cc (flatten_glob): Likewise.
* rust-backend.h (init): Likewise.
(debug): Likewise.
(get_identifier_node): Likewise.
(wchar_type): Likewise.
(get_pointer_size): Likewise.
(raw_str_type): Likewise.
(integer_type): Likewise.
(float_type): Likewise.
(pointer_type): Likewise.
(reference_type): Likewise.
(immutable_type): Likewise.
(function_type): Likewise.
(function_type_variadic): Likewise.
(function_ptr_type): Likewise.
(struct_type): Likewise.
(union_type): Likewise.
(array_type): Likewise.
(named_type): Likewise.
(type_field_offset): Likewise.
(var_expression): Likewise.
(float_constant_expression): Likewise.
(string_constant_expression): Likewise.
(char_constant_expression): Likewise.
(wchar_constant_expression): Likewise.
(boolean_constant_expression): Likewise.
(convert_expression): Likewise.
(struct_field_expression): Likewise.
(compound_expression): Likewise.
(conditional_expression): Likewise.
(negation_expression): Likewise.
(arithmetic_or_logical_expression): Likewise.
(arithmetic_or_logical_expression_checked): Likewise.
(comparison_expression): Likewise.
(lazy_boolean_expression): Likewise.
(constructor_expression): Likewise.
(array_constructor_expression): Likewise.
(array_initializer): Likewise.
(array_index_expression): Likewise.
(call_expression): Likewise.
(init_statement): Likewise.
(assignment_statement): Likewise.
(return_statement): Likewise.
(if_statement): Likewise.
(loop_expression): Likewise.
(exit_expression): Likewise.
(statement_list): Likewise.
(exception_handler_statement): Likewise.
(block): Likewise.
(block_add_statements): Likewise.
(global_variable): Likewise.
(global_variable_set_init): Likewise.
(local_variable): Likewise.
(parameter_variable): Likewise.
(static_chain_variable): Likewise.
(temporary_variable): Likewise.
(label): Likewise.
(function): Likewise.
(function_defer_statement): Likewise.
(function_set_parameters): Likewise.
(write_global_definitions): Likewise.
(fill_in_fields): Likewise.
* rust-diagnostics.cc (expand_format): Likewise.
(expand_message): Likewise.
(va_constructor): Likewise.
* rust-diagnostics.h (RUST_ATTRIBUTE_GCC_DIAG): Likewise.
(rust_open_quote): Likewise.
(rust_close_quote): Likewise.
(rust_debug_loc): Likewise.
* rust-gcc.cc (non_zero_size_type): Likewise.
* rust-object-export.h (rust_field_alignment): Likewise.
(rust_read_export_data): Likewise.
(rust_write_export_data): Likewise.
* rust-session-manager.cc (saw_errors): Likewise.
(rust_get_linemap): Likewise.
(validate_crate_name): Likewise.
(Session::load_extern_crate): Likewise.
* rust-session-manager.h (rust_crate_name_validation_test): Likewise.
* rust-system.h (rust_preserve_from_gc): Likewise.
(rust_localize_identifier): Likewise.
* rust-target.h (rust_add_target_info): Likewise.
* typecheck/rust-autoderef.cc:
* typecheck/rust-casts.cc (TypeCastRules::cast_rules): Likewise.
* typecheck/rust-coercion.cc (TypeCoercionRules::do_coercion): Likewise.
(TypeCoercionRules::coerce_unsafe_ptr): Likewise.
(TypeCoercionRules::coerce_borrowed_pointer): Likewise.
* typecheck/rust-hir-trait-resolve.cc (TraitResolver::resolve_trait): Likewise.
(TraitItemReference::is_object_safe): Likewise.
* typecheck/rust-hir-type-check-base.cc (TypeCheckBase::resolve_literal): Likewise.
* typecheck/rust-hir-type-check-expr.cc (TypeCheckExpr::visit): Likewise.
(typecheck_inline_asm_operand): Likewise.
* typecheck/rust-hir-type-check-implitem.cc (TypeCheckImplItem::visit): Likewise.
(TypeCheckImplItemWithTrait::visit): Likewise.
* typecheck/rust-hir-type-check-pattern.cc (TypeCheckPattern::visit): Likewise.
* typecheck/rust-hir-type-check-struct.cc (TypeCheckStructExpr::visit): Likewise.
* typecheck/rust-hir-type-check-type.cc
(TypeResolveGenericParam::apply_trait_bounds): Likewise.
(ResolveWhereClauseItem::visit): Likewise.
* typecheck/rust-hir-type-check.cc (saw_errors): Likewise.
(TraitItemReference::get_type_from_fn): Likewise.
* typecheck/rust-type-util.h (query_type): Likewise.
(types_compatable): Likewise.
(unify_site): Likewise.
(unify_site_and): Likewise.
(coercion_site): Likewise.
(try_coercion): Likewise.
(cast_site): Likewise.
* typecheck/rust-tyty-bounds.cc:
* typecheck/rust-tyty-call.cc (TypeCheckCallExpr::visit): Likewise.
* typecheck/rust-tyty-cmp.h:
* typecheck/rust-tyty-variance-analysis.h (query_field_regions): Likewise.
* typecheck/rust-tyty.cc (BaseType::is_unit): Likewise.
(BaseType::has_substitutions_defined): Likewise.
(BaseType::needs_generic_substitutions): Likewise.
(BaseType::get_subst_argument_mappings): Likewise.
(InferType::default_type): Likewise.
(InferType::apply_primitive_type_hint): Likewise.
* typecheck/rust-tyty.h (is_primitive_type_kind): Likewise.
* typecheck/rust-unify.cc (UnifyRules::expect_inference_variable): Likewise.
(UnifyRules::expect_adt): Likewise.
(UnifyRules::expect_str): Likewise.
(UnifyRules::expect_reference): Likewise.
(UnifyRules::expect_pointer): Likewise.
(UnifyRules::expect_param): Likewise.
(UnifyRules::expect_array): Likewise.
(UnifyRules::expect_slice): Likewise.
(UnifyRules::expect_fndef): Likewise.
(UnifyRules::expect_fnptr): Likewise.
(UnifyRules::expect_tuple): Likewise.
(UnifyRules::expect_bool): Likewise.
(UnifyRules::expect_char): Likewise.
(UnifyRules::expect_int): Likewise.
(UnifyRules::expect_uint): Likewise.
(UnifyRules::expect_float): Likewise.
(UnifyRules::expect_isize): Likewise.
(UnifyRules::expect_usize): Likewise.
(UnifyRules::expect_never): Likewise.
(UnifyRules::expect_placeholder): Likewise.
(UnifyRules::expect_projection): Likewise.
(UnifyRules::expect_dyn): Likewise.
(UnifyRules::expect_closure): Likewise.
(UnifyRules::expect_opaque): Likewise.
* util/rust-abi.h (get_abi_from_string): Likewise.
(get_string_from_abi): Likewise.
* util/rust-attributes.cc (check_doc_attribute): Likewise.
* util/rust-base62.h (base62_integer): Likewise.
* util/rust-dir-owner.h (get_file_subdir): Likewise.
* util/rust-edition.h (get_rust_edition): Likewise.
* util/rust-punycode.h (encode_punycode): Likewise.
(rust_punycode_encode_test): Likewise.
* util/rust-token-converter.cc (convert): Likewise.
(from_tokenstream): Likewise.
* util/rust-token-converter.h (convert): Likewise.
(convert_literal): Likewise.
* util/rust-unicode.h (is_alphabetic): Likewise.
(is_ascii_only): Likewise.
(is_numeric): Likewise.
(is_nfc_qc_no): Likewise.
(is_nfc_qc_maybe): Likewise.
(nfc_quick_check): Likewise.
(rust_nfc_qc_test): Likewise.
(rust_utf8_normalize_test): Likewise.
(rust_utf8_property_test): Likewise.
* util/rust-unwrap-segment.h (unwrap_segment_node_id): Likewise.

libgrust/ChangeLog:

* libproc_macro_internal/ffistring.h (FFIString__new): Likewise.
(FFIString__drop): Likewise.
* libproc_macro_internal/ident.h (Ident__new): Likewise.
(Ident__new_raw): Likewise.
(Ident__drop): Likewise.
(Ident__clone): Likewise.
* libproc_macro_internal/literal.h (Literal__from_string): Likewise.
* libproc_macro_internal/proc_macro.h (bridge_is_available): Likewise.
* libproc_macro_internal/tokenstream.h (TokenStream__new): Likewise.
(TokenStream__with_capacity): Likewise.
(TokenSream__push): Likewise.
(TokenStream__from_string): Likewise.
(TokenStream__clone): Likewise.
(TokenStream__drop): Likewise.

118 files changed:
gcc/rust/ast/rust-ast-builder-type.cc
gcc/rust/ast/rust-ast-builder.cc
gcc/rust/ast/rust-ast-collector.cc
gcc/rust/ast/rust-ast-dump.h
gcc/rust/ast/rust-ast-formatting.h
gcc/rust/ast/rust-ast-visitor.cc
gcc/rust/ast/rust-ast.cc
gcc/rust/ast/rust-ast.h
gcc/rust/ast/rust-cond-compilation.h
gcc/rust/ast/rust-desugar-apit.cc
gcc/rust/ast/rust-fmt.h
gcc/rust/ast/rust-pattern.h
gcc/rust/backend/rust-compile-context.cc
gcc/rust/backend/rust-compile-expr.cc
gcc/rust/backend/rust-compile-intrinsic.cc
gcc/rust/backend/rust-compile-pattern.cc
gcc/rust/backend/rust-compile-var-decl.h
gcc/rust/backend/rust-constexpr.cc
gcc/rust/backend/rust-constexpr.h
gcc/rust/backend/rust-mangle-v0.cc
gcc/rust/backend/rust-mangle.h
gcc/rust/backend/rust-tree.cc
gcc/rust/backend/rust-tree.h
gcc/rust/checks/errors/borrowck/polonius/rust-polonius.h
gcc/rust/checks/errors/borrowck/rust-bir-builder-expr-stmt.cc
gcc/rust/checks/errors/borrowck/rust-bir-builder-pattern.cc
gcc/rust/checks/errors/borrowck/rust-bir-dump.cc
gcc/rust/checks/errors/borrowck/rust-bir-fact-collector.h
gcc/rust/checks/errors/borrowck/rust-bir-place.h
gcc/rust/checks/errors/borrowck/rust-bir-visitor.h
gcc/rust/checks/errors/privacy/rust-privacy-check.cc
gcc/rust/checks/errors/privacy/rust-privacy-ctx.h
gcc/rust/checks/errors/privacy/rust-privacy-reporter.cc
gcc/rust/checks/errors/privacy/rust-reachability.cc
gcc/rust/checks/errors/privacy/rust-visibility-resolver.cc
gcc/rust/checks/errors/rust-hir-pattern-analysis.cc
gcc/rust/checks/errors/rust-hir-pattern-analysis.h
gcc/rust/expand/rust-cfg-strip.cc
gcc/rust/expand/rust-derive-eq.cc
gcc/rust/expand/rust-derive.cc
gcc/rust/expand/rust-expand-format-args.cc
gcc/rust/expand/rust-expand-visitor.h
gcc/rust/expand/rust-macro-builtins-asm.cc
gcc/rust/expand/rust-macro-builtins-asm.h
gcc/rust/expand/rust-macro-builtins-helpers.h
gcc/rust/expand/rust-macro-expand.cc
gcc/rust/expand/rust-macro-substitute-ctx.cc
gcc/rust/expand/rust-proc-macro.h
gcc/rust/hir/rust-ast-lower-base.cc
gcc/rust/hir/rust-ast-lower-item.cc
gcc/rust/hir/rust-ast-lower-pattern.cc
gcc/rust/hir/rust-ast-lower.h
gcc/rust/hir/rust-hir-dump.cc
gcc/rust/hir/rust-hir-dump.h
gcc/rust/hir/tree/rust-hir.cc
gcc/rust/lex/rust-lex.cc
gcc/rust/lex/rust-lex.h
gcc/rust/lex/rust-token.cc
gcc/rust/lex/rust-token.h
gcc/rust/metadata/rust-export-metadata.cc
gcc/rust/metadata/rust-import-archive.cc
gcc/rust/metadata/rust-imports.h
gcc/rust/parse/rust-cfg-parser.h
gcc/rust/parse/rust-parse-impl.h
gcc/rust/parse/rust-parse.cc
gcc/rust/parse/rust-parse.h
gcc/rust/resolve/rust-ast-resolve-expr.cc
gcc/rust/resolve/rust-ast-resolve-item.cc
gcc/rust/resolve/rust-ast-resolve-item.h
gcc/rust/resolve/rust-ast-resolve-pattern.cc
gcc/rust/resolve/rust-ast-resolve-type.cc
gcc/rust/resolve/rust-ast-resolve.cc
gcc/rust/resolve/rust-early-name-resolver-2.0.cc
gcc/rust/resolve/rust-late-name-resolver-2.0.cc
gcc/rust/resolve/rust-toplevel-name-resolver-2.0.cc
gcc/rust/rust-backend.h
gcc/rust/rust-diagnostics.cc
gcc/rust/rust-diagnostics.h
gcc/rust/rust-gcc.cc
gcc/rust/rust-object-export.h
gcc/rust/rust-session-manager.cc
gcc/rust/rust-session-manager.h
gcc/rust/rust-system.h
gcc/rust/rust-target.h
gcc/rust/typecheck/rust-autoderef.cc
gcc/rust/typecheck/rust-casts.cc
gcc/rust/typecheck/rust-coercion.cc
gcc/rust/typecheck/rust-hir-trait-resolve.cc
gcc/rust/typecheck/rust-hir-type-check-base.cc
gcc/rust/typecheck/rust-hir-type-check-expr.cc
gcc/rust/typecheck/rust-hir-type-check-implitem.cc
gcc/rust/typecheck/rust-hir-type-check-pattern.cc
gcc/rust/typecheck/rust-hir-type-check-struct.cc
gcc/rust/typecheck/rust-hir-type-check-type.cc
gcc/rust/typecheck/rust-hir-type-check.cc
gcc/rust/typecheck/rust-type-util.h
gcc/rust/typecheck/rust-tyty-bounds.cc
gcc/rust/typecheck/rust-tyty-call.cc
gcc/rust/typecheck/rust-tyty-cmp.h
gcc/rust/typecheck/rust-tyty-variance-analysis.h
gcc/rust/typecheck/rust-tyty.cc
gcc/rust/typecheck/rust-tyty.h
gcc/rust/typecheck/rust-unify.cc
gcc/rust/util/rust-abi.h
gcc/rust/util/rust-attributes.cc
gcc/rust/util/rust-base62.h
gcc/rust/util/rust-dir-owner.h
gcc/rust/util/rust-edition.h
gcc/rust/util/rust-punycode.h
gcc/rust/util/rust-token-converter.cc
gcc/rust/util/rust-token-converter.h
gcc/rust/util/rust-unicode.h
gcc/rust/util/rust-unwrap-segment.h
libgrust/libproc_macro_internal/ffistring.h
libgrust/libproc_macro_internal/ident.h
libgrust/libproc_macro_internal/literal.h
libgrust/libproc_macro_internal/proc_macro.h
libgrust/libproc_macro_internal/tokenstream.h

index 13126b440571e984e6190584c73154628b0b3cfd..7f8571ac89f15ccb7d3eb1c293e3be8b139b688b 100644 (file)
@@ -62,7 +62,8 @@ ASTTypeBuilder::visit (TypePath &path)
     {
       switch (seg->get_type ())
        {
-         case TypePathSegment::REG: {
+       case TypePathSegment::REG:
+         {
            const TypePathSegment &segment
              = (const TypePathSegment &) (*seg.get ());
            TypePathSegment *s
@@ -74,7 +75,8 @@ ASTTypeBuilder::visit (TypePath &path)
          }
          break;
 
-         case TypePathSegment::GENERIC: {
+       case TypePathSegment::GENERIC:
+         {
            TypePathSegmentGeneric &generic
              = (TypePathSegmentGeneric &) (*seg.get ());
 
@@ -89,7 +91,8 @@ ASTTypeBuilder::visit (TypePath &path)
          }
          break;
 
-         case TypePathSegment::FUNCTION: {
+       case TypePathSegment::FUNCTION:
+         {
            rust_unreachable ();
            // TODO
            // const TypePathSegmentFunction &fn
index ef0f92f14ce0857b7113a3419e10bfd60b108764..fbc8f273d8124c8e605420d0d33a22118750d522 100644 (file)
@@ -574,7 +574,8 @@ Builder::new_type_param (
     {
       switch (b->get_bound_type ())
        {
-         case TypeParamBound::TypeParamBoundType::TRAIT: {
+       case TypeParamBound::TypeParamBoundType::TRAIT:
+         {
            const TraitBound &tb = (const TraitBound &) *b.get ();
            const TypePath &path = tb.get_type_path ();
 
@@ -599,7 +600,8 @@ Builder::new_type_param (
              {
                switch (seg->get_type ())
                  {
-                   case TypePathSegment::REG: {
+                 case TypePathSegment::REG:
+                   {
                      const TypePathSegment &segment
                        = (const TypePathSegment &) (*seg.get ());
                      TypePathSegment *s = new TypePathSegment (
@@ -611,7 +613,8 @@ Builder::new_type_param (
                    }
                    break;
 
-                   case TypePathSegment::GENERIC: {
+                 case TypePathSegment::GENERIC:
+                   {
                      TypePathSegmentGeneric &generic
                        = (TypePathSegmentGeneric &) (*seg.get ());
 
@@ -625,7 +628,8 @@ Builder::new_type_param (
                    }
                    break;
 
-                   case TypePathSegment::FUNCTION: {
+                 case TypePathSegment::FUNCTION:
+                   {
                      rust_unreachable ();
                      // TODO
                      // const TypePathSegmentFunction &fn
@@ -647,7 +651,8 @@ Builder::new_type_param (
          }
          break;
 
-         case TypeParamBound::TypeParamBoundType::LIFETIME: {
+       case TypeParamBound::TypeParamBoundType::LIFETIME:
+         {
            const Lifetime &l = (const Lifetime &) *b.get ();
 
            auto bl = new Lifetime (l.get_lifetime_type (),
@@ -700,7 +705,8 @@ Builder::new_generic_args (GenericArgs &args)
     {
       switch (arg.get_kind ())
        {
-         case GenericArg::Kind::Type: {
+       case GenericArg::Kind::Type:
+         {
            std::unique_ptr<Type> ty = new_type (arg.get_type ());
            GenericArg arg = GenericArg::create_type (std::move (ty));
          }
index 538c6a411d1cd0e71cf2aa5ba1626a9336c0f6c4..cab763964154c2a9f4f814e6471aaaf38792f2c3 100644 (file)
@@ -154,20 +154,24 @@ TokenCollector::visit (Attribute &attrib)
     {
       switch (attrib.get_attr_input ().get_attr_input_type ())
        {
-         case AST::AttrInput::AttrInputType::LITERAL: {
+       case AST::AttrInput::AttrInputType::LITERAL:
+         {
            visit (static_cast<AttrInputLiteral &> (attrib.get_attr_input ()));
            break;
          }
-         case AST::AttrInput::AttrInputType::MACRO: {
+       case AST::AttrInput::AttrInputType::MACRO:
+         {
            visit (static_cast<AttrInputMacro &> (attrib.get_attr_input ()));
            break;
          }
-         case AST::AttrInput::AttrInputType::META_ITEM: {
+       case AST::AttrInput::AttrInputType::META_ITEM:
+         {
            visit (static_cast<AttrInputMetaItemContainer &> (
              attrib.get_attr_input ()));
            break;
          }
-         case AST::AttrInput::AttrInputType::TOKEN_TREE: {
+       case AST::AttrInput::AttrInputType::TOKEN_TREE:
+         {
            visit (static_cast<DelimTokenTree &> (attrib.get_attr_input ()));
            break;
          }
@@ -634,7 +638,8 @@ TokenCollector::visit (GenericArg &arg)
     case GenericArg::Kind::Type:
       visit (arg.get_type ());
       break;
-      case GenericArg::Kind::Either: {
+    case GenericArg::Kind::Either:
+      {
        auto path = arg.get_path ();
        push (Rust::Token::make_identifier (UNDEF_LOCATION, std::move (path)));
       }
@@ -789,7 +794,8 @@ TokenCollector::visit (Literal &lit, location_t locus)
       push (Rust::Token::make_float (locus, std::move (value),
                                     lit.get_type_hint ()));
       break;
-      case Literal::LitType::BOOL: {
+    case Literal::LitType::BOOL:
+      {
        if (value == Values::Keywords::FALSE_LITERAL)
          push (Rust::Token::make (FALSE_LITERAL, locus));
        else if (value == Values::Keywords::TRUE_LITERAL)
@@ -1534,33 +1540,40 @@ TokenCollector::visit (InlineAsm &expr)
       using RegisterType = AST::InlineAsmOperand::RegisterType;
       switch (operand.get_register_type ())
        {
-         case RegisterType::In: {
+       case RegisterType::In:
+         {
            visit (operand.get_in ().expr);
            break;
          }
-         case RegisterType::Out: {
+       case RegisterType::Out:
+         {
            visit (operand.get_out ().expr);
            break;
          }
-         case RegisterType::InOut: {
+       case RegisterType::InOut:
+         {
            visit (operand.get_in_out ().expr);
            break;
          }
-         case RegisterType::SplitInOut: {
+       case RegisterType::SplitInOut:
+         {
            auto split = operand.get_split_in_out ();
            visit (split.in_expr);
            visit (split.out_expr);
            break;
          }
-         case RegisterType::Const: {
+       case RegisterType::Const:
+         {
            visit (operand.get_const ().anon_const.expr);
            break;
          }
-         case RegisterType::Sym: {
+       case RegisterType::Sym:
+         {
            visit (operand.get_sym ().expr);
            break;
          }
-         case RegisterType::Label: {
+       case RegisterType::Label:
+         {
            visit (operand.get_label ().expr);
            break;
          }
@@ -1776,7 +1789,8 @@ TokenCollector::visit (UseTreeGlob &use_tree)
 {
   switch (use_tree.get_glob_type ())
     {
-      case UseTreeGlob::PathType::PATH_PREFIXED: {
+    case UseTreeGlob::PathType::PATH_PREFIXED:
+      {
        auto path = use_tree.get_path ();
        visit (path);
        push (Rust::Token::make (SCOPE_RESOLUTION, UNDEF_LOCATION));
@@ -1796,7 +1810,8 @@ TokenCollector::visit (UseTreeList &use_tree)
 {
   switch (use_tree.get_path_type ())
     {
-      case UseTreeList::PathType::PATH_PREFIXED: {
+    case UseTreeList::PathType::PATH_PREFIXED:
+      {
        auto path = use_tree.get_path ();
        visit (path);
        push (Rust::Token::make (SCOPE_RESOLUTION, UNDEF_LOCATION));
@@ -1824,7 +1839,8 @@ TokenCollector::visit (UseTreeRebind &use_tree)
   visit (path);
   switch (use_tree.get_new_bind_type ())
     {
-      case UseTreeRebind::NewBindType::IDENTIFIER: {
+    case UseTreeRebind::NewBindType::IDENTIFIER:
+      {
        push (Rust::Token::make (AS, UNDEF_LOCATION));
        auto id = use_tree.get_identifier ().as_string ();
        push (
index 02c99b7ae1ecb622f9966dd1e8df9ac8f98951e7..0c3875e2823317ca4f4bca7f3678d557d6f5baf8 100644 (file)
@@ -49,7 +49,8 @@ public:
       {
        switch (item.get_kind ())
          {
-           case AST::CollectItem::Kind::Token: {
+         case AST::CollectItem::Kind::Token:
+           {
              TokenPtr current = item.get_token ();
              if (require_spacing (previous, current))
                stream << " ";
@@ -90,7 +91,6 @@ private:
 } // namespace Rust
 
 // In the global namespace to make it easier to call from debugger
-void
-debug (Rust::AST::Visitable &v);
+void debug (Rust::AST::Visitable &v);
 
 #endif // !RUST_AST_DUMP_H
index 3dfabbcccc600f97262fcb06aac1e647ba4db009..aace93f7fae8a7d9925e76e9121ecc665f17a4c1 100644 (file)
@@ -35,23 +35,18 @@ enum AttrMode
   INNER
 };
 
-std::string
-indent_spaces (enum indent_mode mode);
+std::string indent_spaces (enum indent_mode mode);
 
 // Gets a string in a certain delim type.
-std::string
-get_string_in_delims (std::string str_input, DelimType delim_type);
+std::string get_string_in_delims (std::string str_input, DelimType delim_type);
 
-std::string
-get_mode_dump_desc (AttrMode mode);
+std::string get_mode_dump_desc (AttrMode mode);
 
 // Adds lines below adding attributes
-std::string
-append_attributes (std::vector<Attribute> attrs, AttrMode mode);
+std::string append_attributes (std::vector<Attribute> attrs, AttrMode mode);
 
 // Removes the beginning and end quotes of a quoted string.
-std::string
-unquote_string (std::string input);
+std::string unquote_string (std::string input);
 
 } // namespace AST
 } // namespace Rust
index 3dfcf5ace025428a9c874d54e03dcf1e43d43a79..8c1d9ff61356538698564030d52942bb5d250950 100644 (file)
@@ -680,33 +680,40 @@ DefaultASTVisitor::visit (AST::InlineAsm &expr)
     {
       switch (operand.get_register_type ())
        {
-         case RegisterType::In: {
+       case RegisterType::In:
+         {
            visit (operand.get_in ().expr);
            break;
          }
-         case RegisterType::Out: {
+       case RegisterType::Out:
+         {
            visit (operand.get_out ().expr);
            break;
          }
-         case RegisterType::InOut: {
+       case RegisterType::InOut:
+         {
            visit (operand.get_in_out ().expr);
            break;
          }
-         case RegisterType::SplitInOut: {
+       case RegisterType::SplitInOut:
+         {
            auto split = operand.get_split_in_out ();
            visit (split.in_expr);
            visit (split.out_expr);
            break;
          }
-         case RegisterType::Const: {
+       case RegisterType::Const:
+         {
            visit (operand.get_const ().anon_const.expr);
            break;
          }
-         case RegisterType::Sym: {
+       case RegisterType::Sym:
+         {
            visit (operand.get_sym ().expr);
            break;
          }
-         case RegisterType::Label: {
+       case RegisterType::Label:
+         {
            visit (operand.get_label ().expr);
            break;
          }
index d921353bf6abf10a50e8260dd0eeb47ca605895c..86e700091f369b12bf097bd4cf5bfcb3cd7ac520 100644 (file)
@@ -249,27 +249,31 @@ Attribute::get_traits_to_derive ()
   auto &input = get_attr_input ();
   switch (input.get_attr_input_type ())
     {
-      case AST::AttrInput::META_ITEM: {
+    case AST::AttrInput::META_ITEM:
+      {
        auto &meta = static_cast<AST::AttrInputMetaItemContainer &> (input);
        for (auto &current : meta.get_items ())
          {
            // HACK: Find a better way to achieve the downcast.
            switch (current->get_kind ())
              {
-               case AST::MetaItemInner::Kind::MetaItem: {
+             case AST::MetaItemInner::Kind::MetaItem:
+               {
                  // Let raw pointer go out of scope without freeing, it doesn't
                  // own the data anyway
                  auto meta_item
                    = static_cast<AST::MetaItem *> (current.get ());
                  switch (meta_item->get_item_kind ())
                    {
-                     case AST::MetaItem::ItemKind::Path: {
+                   case AST::MetaItem::ItemKind::Path:
+                     {
                        auto path
                          = static_cast<AST::MetaItemPath *> (meta_item);
                        result.push_back (path->get_path ());
                      }
                      break;
-                     case AST::MetaItem::ItemKind::Word: {
+                   case AST::MetaItem::ItemKind::Word:
+                     {
                        auto word = static_cast<AST::MetaWord *> (meta_item);
                        // Convert current word to path
                        current = std::make_unique<AST::MetaItemPath> (
@@ -782,7 +786,8 @@ UseTreeGlob::as_string () const
       return "*";
     case GLOBAL:
       return "::*";
-      case PATH_PREFIXED: {
+    case PATH_PREFIXED:
+      {
        std::string path_str = path.as_string ();
        return path_str + "::*";
       }
@@ -805,7 +810,8 @@ UseTreeList::as_string () const
     case GLOBAL:
       path_str = "::{";
       break;
-      case PATH_PREFIXED: {
+    case PATH_PREFIXED:
+      {
        path_str = path.as_string () + "::{";
        break;
       }
@@ -3653,14 +3659,16 @@ AttributeParser::parse_path_meta_item ()
 
   switch (peek_token ()->get_id ())
     {
-      case LEFT_PAREN: {
+    case LEFT_PAREN:
+      {
        std::vector<std::unique_ptr<MetaItemInner>> meta_items
          = parse_meta_item_seq ();
 
        return std::unique_ptr<MetaItemSeq> (
          new MetaItemSeq (std::move (path), std::move (meta_items)));
       }
-      case EQUAL: {
+    case EQUAL:
+      {
        skip_token ();
 
        location_t locus = peek_token ()->get_locus ();
@@ -5047,7 +5055,8 @@ FormatArgs::get_outer_attrs ()
   rust_unreachable ();
 }
 
-void FormatArgs::set_outer_attrs (std::vector<Attribute>)
+void
+FormatArgs::set_outer_attrs (std::vector<Attribute>)
 {
   rust_unreachable ();
 }
index aa6ad5066aa136d5cc2d2da0b42710517a703228..5ce92231434d30feb86ba415faf222e1e4905b17 100644 (file)
@@ -67,8 +67,7 @@ private:
   location_t loc;
 };
 
-std::ostream &
-operator<< (std::ostream &os, Identifier const &i);
+std::ostream &operator<< (std::ostream &os, Identifier const &i);
 
 namespace AST {
 // foward decl: ast visitor
index 610b9046f45552e0f7560ac3fd62148d43a528f9..56a5646704a8b8ff9fab2b8166cf0fb55b8e501b 100644 (file)
@@ -42,8 +42,8 @@ public:
 
 protected:
   // Clone function impl to be overriden in base classes
-  virtual ConfigurationPredicate *
-  clone_configuration_predicate_impl () const = 0;
+  virtual ConfigurationPredicate *clone_configuration_predicate_impl () const
+    = 0;
 };
 
 // A configuration option - true if option is set, false if option is not set.
index 5b9486ea6714c11228581bab78b644742b3e491b..bca14eef1eaba924f37e02fabd49176da4682d9f 100644 (file)
@@ -297,7 +297,8 @@ public:
       {
        switch (implicit_generic->get_kind ())
          {
-           case GenericParam::Kind::Type: {
+         case GenericParam::Kind::Type:
+           {
              TypeParam &p
                = *static_cast<TypeParam *> (implicit_generic.get ());
 
@@ -326,7 +327,8 @@ private:
        auto &tb = bounds[i];
        switch (tb->get_bound_type ())
          {
-           case TypeParamBound::TypeParamBoundType::TRAIT: {
+         case TypeParamBound::TypeParamBoundType::TRAIT:
+           {
              TraitBound &ttb = *static_cast<TraitBound *> (tb.get ());
              TypePath &path = ttb.get_type_path ();
              bool deusgared = process_type_path (p, ttb, path);
@@ -350,7 +352,8 @@ private:
       {
        switch (segment->get_type ())
          {
-           case TypePathSegment::SegmentType::GENERIC: {
+         case TypePathSegment::SegmentType::GENERIC:
+           {
              TypePathSegmentGeneric &seg
                = *static_cast<TypePathSegmentGeneric *> (segment.get ());
              desugared |= process_generic_segment (p, parent, path, seg);
@@ -397,7 +400,8 @@ private:
          {
            switch (implicit_generic->get_kind ())
              {
-               case GenericParam::Kind::Type: {
+             case GenericParam::Kind::Type:
+               {
                  TypeParam &tp
                    = *static_cast<TypeParam *> (implicit_generic.get ());
 
index a54faec6381a818ffe0daa26b0d03952159ad1af..3722db291ab8681a584a6a4095105e2ef7611173 100644 (file)
@@ -266,11 +266,10 @@ enum ParseMode
 
 extern "C" {
 
-FormatArgsHandle
-collect_pieces (const char *input, bool append_newline, ParseMode parse_mode);
+FormatArgsHandle collect_pieces (const char *input, bool append_newline,
+                                ParseMode parse_mode);
 
-FormatArgsHandle
-clone_pieces (const FormatArgsHandle &);
+FormatArgsHandle clone_pieces (const FormatArgsHandle &);
 
 void destroy_pieces (FormatArgsHandle);
 
index 69dbd98a1d3224b1cf07fb9e9d4e17bdd7106322..e6cd8f1eb047ff4c2dd234d3389c89aae468e453 100644 (file)
@@ -375,8 +375,7 @@ enum class RangeKind
   EXCLUDED,
 };
 
-RangeKind
-tokenid_to_rangekind (TokenId id);
+RangeKind tokenid_to_rangekind (TokenId id);
 // AST node for matching within a certain range (range pattern)
 class RangePattern : public Pattern
 {
index 86f089440ac02dd723c1ae79e2c452c80957c0c9..284a5aa4ca7cea16be740ebf7d0d3ab876e60b91 100644 (file)
@@ -70,7 +70,8 @@ Context::type_hasher (tree type)
       hstate.add_object (TYPE_HASH (TYPE_OFFSET_BASETYPE (type)));
       break;
 
-      case ARRAY_TYPE: {
+    case ARRAY_TYPE:
+      {
        if (TYPE_DOMAIN (type))
          hstate.add_object (TYPE_HASH (TYPE_DOMAIN (type)));
        if (!AGGREGATE_TYPE_P (TREE_TYPE (type)))
@@ -81,7 +82,8 @@ Context::type_hasher (tree type)
       }
       break;
 
-      case INTEGER_TYPE: {
+    case INTEGER_TYPE:
+      {
        tree t = TYPE_MAX_VALUE (type);
        if (!t)
          t = TYPE_MIN_VALUE (type);
@@ -91,7 +93,8 @@ Context::type_hasher (tree type)
       }
 
     case REAL_TYPE:
-      case FIXED_POINT_TYPE: {
+    case FIXED_POINT_TYPE:
+      {
        unsigned prec = TYPE_PRECISION (type);
        hstate.add_object (prec);
        break;
@@ -103,7 +106,8 @@ Context::type_hasher (tree type)
 
     case RECORD_TYPE:
     case UNION_TYPE:
-      case QUAL_UNION_TYPE: {
+    case QUAL_UNION_TYPE:
+      {
        for (tree t = TYPE_FIELDS (type); t; t = TREE_CHAIN (t))
          {
            hashval_t name_hash = IDENTIFIER_HASH_VALUE (DECL_NAME (t));
@@ -118,7 +122,8 @@ Context::type_hasher (tree type)
       break;
 
     case REFERENCE_TYPE:
-      case POINTER_TYPE: {
+    case POINTER_TYPE:
+      {
        hashval_t type_hash = type_hasher (TREE_TYPE (type));
        hstate.add_object (type_hash);
       }
index dd3420f9f2fa055b789a94c2ae276ac5317d8e2e..cace059f7426e4830fcccdd99255f1c2d6a0955e 100644 (file)
@@ -1883,7 +1883,8 @@ CompileExpr::visit (HIR::ArrayExpr &expr)
   HIR::ArrayElems &elements = expr.get_internal_elements ();
   switch (elements.get_array_expr_type ())
     {
-      case HIR::ArrayElems::ArrayExprType::VALUES: {
+    case HIR::ArrayElems::ArrayExprType::VALUES:
+      {
        HIR::ArrayElemsValues &elems
          = static_cast<HIR::ArrayElemsValues &> (elements);
        translated
@@ -2032,7 +2033,8 @@ HIRCompileBase::resolve_adjustements (
          return error_mark_node;
 
        case Resolver::Adjustment::AdjustmentType::IMM_REF:
-         case Resolver::Adjustment::AdjustmentType::MUT_REF: {
+       case Resolver::Adjustment::AdjustmentType::MUT_REF:
+         {
            if (!RS_DST_FLAG (TREE_TYPE (e)))
              {
                e = address_expression (e, locus);
index 4888e23ed1ef79c86aed572640d4bfa81b86fb35..7627620c4713f36ab658899aa78bba9deaf318eb 100644 (file)
@@ -32,8 +32,7 @@
 
 // declaration taken from "stringpool.h"
 // the get_identifier macro causes compilation issues
-extern tree
-get_identifier (const char *);
+extern tree get_identifier (const char *);
 
 namespace Rust {
 namespace Compile {
@@ -70,28 +69,19 @@ check_for_basic_integer_type (const std::string &intrinsic_str,
   return is_basic_integer;
 }
 
-static tree
-offset_handler (Context *ctx, TyTy::FnType *fntype);
-static tree
-sizeof_handler (Context *ctx, TyTy::FnType *fntype);
-static tree
-transmute_handler (Context *ctx, TyTy::FnType *fntype);
-static tree
-rotate_handler (Context *ctx, TyTy::FnType *fntype, tree_code op);
-static tree
-wrapping_op_handler_inner (Context *ctx, TyTy::FnType *fntype, tree_code op);
-static tree
-op_with_overflow_inner (Context *ctx, TyTy::FnType *fntype, tree_code op);
-static tree
-uninit_handler (Context *ctx, TyTy::FnType *fntype);
-static tree
-move_val_init_handler (Context *ctx, TyTy::FnType *fntype);
-static tree
-assume_handler (Context *ctx, TyTy::FnType *fntype);
-static tree
-discriminant_value_handler (Context *ctx, TyTy::FnType *fntype);
-static tree
-variant_count_handler (Context *ctx, TyTy::FnType *fntype);
+static tree offset_handler (Context *ctx, TyTy::FnType *fntype);
+static tree sizeof_handler (Context *ctx, TyTy::FnType *fntype);
+static tree transmute_handler (Context *ctx, TyTy::FnType *fntype);
+static tree rotate_handler (Context *ctx, TyTy::FnType *fntype, tree_code op);
+static tree wrapping_op_handler_inner (Context *ctx, TyTy::FnType *fntype,
+                                      tree_code op);
+static tree op_with_overflow_inner (Context *ctx, TyTy::FnType *fntype,
+                                   tree_code op);
+static tree uninit_handler (Context *ctx, TyTy::FnType *fntype);
+static tree move_val_init_handler (Context *ctx, TyTy::FnType *fntype);
+static tree assume_handler (Context *ctx, TyTy::FnType *fntype);
+static tree discriminant_value_handler (Context *ctx, TyTy::FnType *fntype);
+static tree variant_count_handler (Context *ctx, TyTy::FnType *fntype);
 
 enum class Prefetch
 {
@@ -99,8 +89,8 @@ enum class Prefetch
   Write
 };
 
-static tree
-prefetch_data_handler (Context *ctx, TyTy::FnType *fntype, Prefetch kind);
+static tree prefetch_data_handler (Context *ctx, TyTy::FnType *fntype,
+                                  Prefetch kind);
 
 static inline tree
 rotate_left_handler (Context *ctx, TyTy::FnType *fntype)
@@ -140,10 +130,10 @@ prefetch_write_data (Context *ctx, TyTy::FnType *fntype)
   return prefetch_data_handler (ctx, fntype, Prefetch::Write);
 }
 
-static tree
-atomic_store_handler_inner (Context *ctx, TyTy::FnType *fntype, int ordering);
-static tree
-atomic_load_handler_inner (Context *ctx, TyTy::FnType *fntype, int ordering);
+static tree atomic_store_handler_inner (Context *ctx, TyTy::FnType *fntype,
+                                       int ordering);
+static tree atomic_load_handler_inner (Context *ctx, TyTy::FnType *fntype,
+                                      int ordering);
 
 static inline std::function<tree (Context *, TyTy::FnType *)>
 atomic_store_handler (int ordering)
@@ -161,8 +151,8 @@ atomic_load_handler (int ordering)
   };
 }
 
-static inline tree
-unchecked_op_inner (Context *ctx, TyTy::FnType *fntype, tree_code op);
+static inline tree unchecked_op_inner (Context *ctx, TyTy::FnType *fntype,
+                                      tree_code op);
 
 const static std::function<tree (Context *, TyTy::FnType *)>
 unchecked_op_handler (tree_code op)
@@ -172,8 +162,8 @@ unchecked_op_handler (tree_code op)
   };
 }
 
-static inline tree
-copy_handler_inner (Context *ctx, TyTy::FnType *fntype, bool overlaps);
+static inline tree copy_handler_inner (Context *ctx, TyTy::FnType *fntype,
+                                      bool overlaps);
 
 const static std::function<tree (Context *, TyTy::FnType *)>
 copy_handler (bool overlaps)
@@ -183,8 +173,8 @@ copy_handler (bool overlaps)
   };
 }
 
-static inline tree
-expect_handler_inner (Context *ctx, TyTy::FnType *fntype, bool likely);
+static inline tree expect_handler_inner (Context *ctx, TyTy::FnType *fntype,
+                                        bool likely);
 
 const static std::function<tree (Context *, TyTy::FnType *)>
 expect_handler (bool likely)
@@ -194,8 +184,8 @@ expect_handler (bool likely)
   };
 }
 
-static tree
-try_handler_inner (Context *ctx, TyTy::FnType *fntype, bool is_new_api);
+static tree try_handler_inner (Context *ctx, TyTy::FnType *fntype,
+                              bool is_new_api);
 
 const static std::function<tree (Context *, TyTy::FnType *)>
 try_handler (bool is_new_api)
index afde2a61f82d4d3302ba9bb89decc7a4199e10be..7b937c766e2aa9a2278775a3958d0716feb1bd48 100644 (file)
@@ -112,7 +112,8 @@ compile_range_pattern_bound (HIR::RangePatternBound &bound,
   tree result = NULL_TREE;
   switch (bound.get_bound_type ())
     {
-      case HIR::RangePatternBound::RangePatternBoundType::LITERAL: {
+    case HIR::RangePatternBound::RangePatternBoundType::LITERAL:
+      {
        auto &ref = static_cast<HIR::RangePatternBoundLiteral &> (bound);
 
        HIR::LiteralExpr litexpr (mappings, ref.get_literal (), locus,
@@ -122,7 +123,8 @@ compile_range_pattern_bound (HIR::RangePatternBound &bound,
       }
       break;
 
-      case HIR::RangePatternBound::RangePatternBoundType::PATH: {
+    case HIR::RangePatternBound::RangePatternBoundType::PATH:
+      {
        auto &ref = static_cast<HIR::RangePatternBoundPath &> (bound);
 
        result = ResolvePathRef::Compile (ref.get_path (), ctx);
@@ -132,7 +134,8 @@ compile_range_pattern_bound (HIR::RangePatternBound &bound,
       }
       break;
 
-      case HIR::RangePatternBound::RangePatternBoundType::QUALPATH: {
+    case HIR::RangePatternBound::RangePatternBoundType::QUALPATH:
+      {
        auto &ref = static_cast<HIR::RangePatternBoundQualPath &> (bound);
 
        result = ResolvePathRef::Compile (ref.get_qualified_path (), ctx);
@@ -261,13 +264,15 @@ CompilePatternCheckExpr::visit (HIR::StructPattern &pattern)
     {
       switch (field->get_item_type ())
        {
-         case HIR::StructPatternField::ItemType::TUPLE_PAT: {
+       case HIR::StructPatternField::ItemType::TUPLE_PAT:
+         {
            // TODO
            rust_unreachable ();
          }
          break;
 
-         case HIR::StructPatternField::ItemType::IDENT_PAT: {
+       case HIR::StructPatternField::ItemType::IDENT_PAT:
+         {
            HIR::StructPatternFieldIdentPat &ident
              = static_cast<HIR::StructPatternFieldIdentPat &> (*field.get ());
 
@@ -289,7 +294,8 @@ CompilePatternCheckExpr::visit (HIR::StructPattern &pattern)
          }
          break;
 
-         case HIR::StructPatternField::ItemType::IDENT: {
+       case HIR::StructPatternField::ItemType::IDENT:
+         {
            // ident pattern always matches - do nothing
          }
          break;
@@ -348,13 +354,15 @@ CompilePatternCheckExpr::visit (HIR::TupleStructPattern &pattern)
   HIR::TupleStructItems &items = pattern.get_items ();
   switch (items.get_item_type ())
     {
-      case HIR::TupleStructItems::RANGED: {
+    case HIR::TupleStructItems::RANGED:
+      {
        // TODO
        rust_unreachable ();
       }
       break;
 
-      case HIR::TupleStructItems::MULTIPLE: {
+    case HIR::TupleStructItems::MULTIPLE:
+      {
        HIR::TupleStructItemsNoRange &items_no_range
          = static_cast<HIR::TupleStructItemsNoRange &> (items);
 
@@ -396,13 +404,15 @@ CompilePatternCheckExpr::visit (HIR::TuplePattern &pattern)
 
   switch (pattern.get_items ().get_item_type ())
     {
-      case HIR::TuplePatternItems::RANGED: {
+    case HIR::TuplePatternItems::RANGED:
+      {
        // TODO
        gcc_unreachable ();
       }
       break;
 
-      case HIR::TuplePatternItems::MULTIPLE: {
+    case HIR::TuplePatternItems::MULTIPLE:
+      {
        auto &items = static_cast<HIR::TuplePatternItemsMultiple &> (
          pattern.get_items ());
        size_t tuple_field_index = 0;
@@ -459,13 +469,15 @@ CompilePatternBindings::visit (HIR::TupleStructPattern &pattern)
   HIR::TupleStructItems &items = pattern.get_items ();
   switch (items.get_item_type ())
     {
-      case HIR::TupleStructItems::RANGED: {
+    case HIR::TupleStructItems::RANGED:
+      {
        // TODO
        rust_unreachable ();
       }
       break;
 
-      case HIR::TupleStructItems::MULTIPLE: {
+    case HIR::TupleStructItems::MULTIPLE:
+      {
        HIR::TupleStructItemsNoRange &items_no_range
          = static_cast<HIR::TupleStructItemsNoRange &> (items);
 
@@ -666,7 +678,8 @@ CompilePatternBindings::visit (HIR::TuplePattern &pattern)
 
   switch (pattern.get_items ().get_item_type ())
     {
-      case HIR::TuplePatternItems::ItemType::RANGED: {
+    case HIR::TuplePatternItems::ItemType::RANGED:
+      {
        size_t tuple_idx = 0;
        auto &items
          = static_cast<HIR::TuplePatternItemsRanged &> (pattern.get_items ());
@@ -709,7 +722,8 @@ CompilePatternBindings::visit (HIR::TuplePattern &pattern)
 
        return;
       }
-      case HIR::TuplePatternItems::ItemType::MULTIPLE: {
+    case HIR::TuplePatternItems::ItemType::MULTIPLE:
+      {
        size_t tuple_idx = 0;
        auto &items = static_cast<HIR::TuplePatternItemsMultiple &> (
          pattern.get_items ());
@@ -730,7 +744,8 @@ CompilePatternBindings::visit (HIR::TuplePattern &pattern)
 
        return;
       }
-      default: {
+    default:
+      {
        rust_unreachable ();
       }
     }
@@ -790,7 +805,8 @@ CompilePatternLet::visit (HIR::TuplePattern &pattern)
 
   switch (pattern.get_items ().get_item_type ())
     {
-      case HIR::TuplePatternItems::ItemType::RANGED: {
+    case HIR::TuplePatternItems::ItemType::RANGED:
+      {
        size_t tuple_idx = 0;
        auto &items
          = static_cast<HIR::TuplePatternItemsRanged &> (pattern.get_items ());
@@ -834,7 +850,8 @@ CompilePatternLet::visit (HIR::TuplePattern &pattern)
 
        return;
       }
-      case HIR::TuplePatternItems::ItemType::MULTIPLE: {
+    case HIR::TuplePatternItems::ItemType::MULTIPLE:
+      {
        size_t tuple_idx = 0;
        auto &items = static_cast<HIR::TuplePatternItemsMultiple &> (
          pattern.get_items ());
@@ -856,7 +873,8 @@ CompilePatternLet::visit (HIR::TuplePattern &pattern)
 
        return;
       }
-      default: {
+    default:
+      {
        rust_unreachable ();
       }
     }
index 4c46a7b17d6dd38ad595871c14b4b1a323e68360..5c6d1459c39b38196ce118bc26121696d597e920 100644 (file)
@@ -70,7 +70,8 @@ public:
   {
     switch (pattern.get_items ().get_item_type ())
       {
-       case HIR::TuplePatternItems::ItemType::MULTIPLE: {
+      case HIR::TuplePatternItems::ItemType::MULTIPLE:
+       {
          rust_assert (TREE_CODE (translated_type) == RECORD_TYPE);
          auto &items = static_cast<HIR::TuplePatternItemsMultiple &> (
            pattern.get_items ());
index 0ed56c71ad305d7e6c39df911484826de0dc2367..d524d09f88ecbd5fd3ee52d6dd6a6d588f9ba9d5 100644 (file)
@@ -68,32 +68,24 @@ literal_type_p (tree t)
   return false;
 }
 
-static bool
-verify_constant (tree, bool, bool *, bool *);
-
-static HOST_WIDE_INT
-find_array_ctor_elt (tree ary, tree dindex, bool insert = false);
-static int
-array_index_cmp (tree key, tree index);
-static bool
-potential_constant_expression_1 (tree t, bool want_rval, bool strict, bool now,
-                                tsubst_flags_t flags, tree *jump_target);
-bool
-potential_constant_expression_1 (tree t, bool want_rval, bool strict, bool now,
-                                tsubst_flags_t flags);
-tree
-unshare_constructor (tree t MEM_STAT_DECL);
-void
-maybe_save_constexpr_fundef (tree fun);
-
-static bool
-returns (tree *jump_target);
-static bool
-breaks (tree *jump_target);
-static bool
-continues (tree *jump_target);
-static bool
-switches (tree *jump_target);
+static bool verify_constant (tree, bool, bool *, bool *);
+
+static HOST_WIDE_INT find_array_ctor_elt (tree ary, tree dindex,
+                                         bool insert = false);
+static int array_index_cmp (tree key, tree index);
+static bool potential_constant_expression_1 (tree t, bool want_rval,
+                                            bool strict, bool now,
+                                            tsubst_flags_t flags,
+                                            tree *jump_target);
+bool potential_constant_expression_1 (tree t, bool want_rval, bool strict,
+                                     bool now, tsubst_flags_t flags);
+tree unshare_constructor (tree t MEM_STAT_DECL);
+void maybe_save_constexpr_fundef (tree fun);
+
+static bool returns (tree *jump_target);
+static bool breaks (tree *jump_target);
+static bool continues (tree *jump_target);
+static bool switches (tree *jump_target);
 
 struct constexpr_global_ctx
 {
@@ -463,60 +455,52 @@ save_fundef_copy (tree fun, tree copy)
   *slot = copy;
 }
 
-static tree
-constant_value_1 (tree decl, bool strict_p, bool return_aggregate_cst_ok_p,
-                 bool unshare_p);
-tree
-decl_constant_value (tree decl, bool unshare_p);
+static tree constant_value_1 (tree decl, bool strict_p,
+                             bool return_aggregate_cst_ok_p, bool unshare_p);
+tree decl_constant_value (tree decl, bool unshare_p);
 
-static void
-non_const_var_error (location_t loc, tree r);
+static void non_const_var_error (location_t loc, tree r);
 
-static tree
-eval_constant_expression (const constexpr_ctx *ctx, tree, bool, bool *, bool *,
-                         tree * = NULL);
+static tree eval_constant_expression (const constexpr_ctx *ctx, tree, bool,
+                                     bool *, bool *, tree * = NULL);
 
-static tree
-constexpr_fn_retval (const constexpr_ctx *ctx, tree r);
+static tree constexpr_fn_retval (const constexpr_ctx *ctx, tree r);
 
-static tree
-eval_store_expression (const constexpr_ctx *ctx, tree r, bool, bool *, bool *);
+static tree eval_store_expression (const constexpr_ctx *ctx, tree r, bool,
+                                  bool *, bool *);
 
-static tree
-eval_call_expression (const constexpr_ctx *ctx, tree r, bool, bool *, bool *);
+static tree eval_call_expression (const constexpr_ctx *ctx, tree r, bool,
+                                 bool *, bool *);
 
-static tree
-eval_binary_expression (const constexpr_ctx *ctx, tree r, bool, bool *, bool *);
+static tree eval_binary_expression (const constexpr_ctx *ctx, tree r, bool,
+                                   bool *, bool *);
 
-static tree
-get_function_named_in_call (tree t);
+static tree get_function_named_in_call (tree t);
 
-static tree
-eval_statement_list (const constexpr_ctx *ctx, tree t, bool *non_constant_p,
-                    bool *overflow_p, tree *jump_target);
-static tree
-extract_string_elt (tree string, unsigned chars_per_elt, unsigned index);
+static tree eval_statement_list (const constexpr_ctx *ctx, tree t,
+                                bool *non_constant_p, bool *overflow_p,
+                                tree *jump_target);
+static tree extract_string_elt (tree string, unsigned chars_per_elt,
+                               unsigned index);
 
-static tree
-eval_conditional_expression (const constexpr_ctx *ctx, tree t, bool lval,
-                            bool *non_constant_p, bool *overflow_p,
-                            tree *jump_target);
+static tree eval_conditional_expression (const constexpr_ctx *ctx, tree t,
+                                        bool lval, bool *non_constant_p,
+                                        bool *overflow_p, tree *jump_target);
 
-static tree
-eval_bit_field_ref (const constexpr_ctx *ctx, tree t, bool lval,
-                   bool *non_constant_p, bool *overflow_p);
+static tree eval_bit_field_ref (const constexpr_ctx *ctx, tree t, bool lval,
+                               bool *non_constant_p, bool *overflow_p);
 
-static tree
-eval_loop_expr (const constexpr_ctx *ctx, tree t, bool *non_constant_p,
-               bool *overflow_p, tree *jump_target);
+static tree eval_loop_expr (const constexpr_ctx *ctx, tree t,
+                           bool *non_constant_p, bool *overflow_p,
+                           tree *jump_target);
 
-static tree
-eval_switch_expr (const constexpr_ctx *ctx, tree t, bool *non_constant_p,
-                 bool *overflow_p, tree *jump_target);
+static tree eval_switch_expr (const constexpr_ctx *ctx, tree t,
+                             bool *non_constant_p, bool *overflow_p,
+                             tree *jump_target);
 
-static tree
-eval_unary_expression (const constexpr_ctx *ctx, tree t, bool /*lval*/,
-                      bool *non_constant_p, bool *overflow_p);
+static tree eval_unary_expression (const constexpr_ctx *ctx, tree t,
+                                  bool /*lval*/, bool *non_constant_p,
+                                  bool *overflow_p);
 
 /* Variables and functions to manage constexpr call expansion context.
    These do not need to be marked for PCH or GC.  */
@@ -1235,7 +1219,8 @@ get_or_insert_ctor_field (tree ctor, tree index, int pos_hint = -1)
       /* We fell off the end of the CONSTRUCTOR, so insert a new
         entry at the end.  */
 
-      insert : {
+    insert:
+      {
        constructor_elt ce = {index, NULL_TREE};
 
        vec_safe_insert (CONSTRUCTOR_ELTS (ctor), idx, ce);
@@ -1568,10 +1553,9 @@ free_constructor (tree t)
     }
 }
 
-static tree
-eval_and_check_array_index (const constexpr_ctx *ctx, tree t,
-                           bool allow_one_past, bool *non_constant_p,
-                           bool *overflow_p);
+static tree eval_and_check_array_index (const constexpr_ctx *ctx, tree t,
+                                       bool allow_one_past,
+                                       bool *non_constant_p, bool *overflow_p);
 
 // forked from gcc/cp/constexpr.cc cxx_eval_array_reference
 
@@ -1939,8 +1923,9 @@ eval_constant_expression (const constexpr_ctx *ctx, tree t, bool lval,
          return eval_constant_expression (ctx, r, lval, non_constant_p,
                                           overflow_p);
        }
-      /* fall through */
-      case CONST_DECL: {
+    /* fall through */
+    case CONST_DECL:
+      {
        /* We used to not check lval for CONST_DECL, but darwin.cc uses
           CONST_DECL for aggregate constants.  */
        if (lval)
@@ -2048,7 +2033,8 @@ eval_constant_expression (const constexpr_ctx *ctx, tree t, bool lval,
                                   overflow_p);
       break;
 
-      case TARGET_EXPR: {
+    case TARGET_EXPR:
+      {
        tree type = TREE_TYPE (t);
 
        if (!literal_type_p (type))
@@ -2132,7 +2118,8 @@ eval_constant_expression (const constexpr_ctx *ctx, tree t, bool lval,
        }
       break;
 
-      case DECL_EXPR: {
+    case DECL_EXPR:
+      {
        r = DECL_EXPR_DECL (t);
 
        if (AGGREGATE_TYPE_P (TREE_TYPE (r)) || VECTOR_TYPE_P (TREE_TYPE (r)))
@@ -2204,7 +2191,8 @@ eval_constant_expression (const constexpr_ctx *ctx, tree t, bool lval,
       return eval_constant_expression (ctx, OBJ_TYPE_REF_EXPR (t), lval,
                                       non_constant_p, overflow_p);
 
-      case EXIT_EXPR: {
+    case EXIT_EXPR:
+      {
        tree cond = TREE_OPERAND (t, 0);
        cond = eval_constant_expression (ctx, cond, /*lval*/ false,
                                         non_constant_p, overflow_p);
@@ -2246,7 +2234,8 @@ eval_constant_expression (const constexpr_ctx *ctx, tree t, bool lval,
        }
       break;
 
-      case ADDR_EXPR: {
+    case ADDR_EXPR:
+      {
        tree oldop = TREE_OPERAND (t, 0);
        tree op = eval_constant_expression (ctx, oldop,
                                            /*lval*/ true, non_constant_p,
@@ -2264,7 +2253,8 @@ eval_constant_expression (const constexpr_ctx *ctx, tree t, bool lval,
        break;
       }
 
-      case COMPOUND_EXPR: {
+    case COMPOUND_EXPR:
+      {
        /* check_return_expr sometimes wraps a TARGET_EXPR in a
           COMPOUND_EXPR; don't get confused.  Also handle EMPTY_CLASS_EXPR
           introduced by build_call_a.  */
@@ -2404,7 +2394,8 @@ eval_constant_expression (const constexpr_ctx *ctx, tree t, bool lval,
                                    non_constant_p, overflow_p, jump_target);
       break;
 
-      case CLEANUP_POINT_EXPR: {
+    case CLEANUP_POINT_EXPR:
+      {
        auto_vec<tree, 2> cleanups;
        vec<tree> *prev_cleanups = ctx->global->cleanups;
        ctx->global->cleanups = &cleanups;
@@ -2444,7 +2435,8 @@ eval_constant_expression (const constexpr_ctx *ctx, tree t, bool lval,
       /* FALLTHROUGH.  */
     case NOP_EXPR:
     case CONVERT_EXPR:
-      case VIEW_CONVERT_EXPR: {
+    case VIEW_CONVERT_EXPR:
+      {
        tree oldop = TREE_OPERAND (t, 0);
 
        tree op = eval_constant_expression (ctx, oldop, lval, non_constant_p,
@@ -2691,7 +2683,8 @@ eval_store_expression (const constexpr_ctx *ctx, tree t, bool lval,
        {
        case BIT_FIELD_REF:
        case COMPONENT_REF:
-         case ARRAY_REF: {
+       case ARRAY_REF:
+         {
            tree ob = TREE_OPERAND (probe, 0);
            tree elt = TREE_OPERAND (probe, 1);
            if (TREE_CODE (elt) == FIELD_DECL /*&& DECL_MUTABLE_P (elt)*/)
@@ -3943,7 +3936,8 @@ constexpr_fn_retval (const constexpr_ctx *ctx, tree body)
 {
   switch (TREE_CODE (body))
     {
-      case STATEMENT_LIST: {
+    case STATEMENT_LIST:
+      {
        tree expr = NULL_TREE;
        for (tree stmt : tsi_range (body))
          {
@@ -3961,13 +3955,15 @@ constexpr_fn_retval (const constexpr_ctx *ctx, tree body)
        return expr;
       }
 
-      case RETURN_EXPR: {
+    case RETURN_EXPR:
+      {
        bool non_constant_p = false;
        bool overflow_p = false;
        return eval_constant_expression (ctx, body, false, &non_constant_p,
                                         &overflow_p);
       }
-      case DECL_EXPR: {
+    case DECL_EXPR:
+      {
        tree decl = DECL_EXPR_DECL (body);
        if (TREE_CODE (decl) == USING_DECL
            /* Accept __func__, __FUNCTION__, and __PRETTY_FUNCTION__.  */
@@ -3979,7 +3975,8 @@ constexpr_fn_retval (const constexpr_ctx *ctx, tree body)
     case CLEANUP_POINT_EXPR:
       return constexpr_fn_retval (ctx, TREE_OPERAND (body, 0));
 
-      case BIND_EXPR: {
+    case BIND_EXPR:
+      {
        tree b = BIND_EXPR_BODY (body);
        return constexpr_fn_retval (ctx, b);
       }
@@ -4139,7 +4136,8 @@ array_index_cmp (tree key, tree index)
     {
     case INTEGER_CST:
       return tree_int_cst_compare (key, index);
-      case RANGE_EXPR: {
+    case RANGE_EXPR:
+      {
        tree lo = TREE_OPERAND (index, 0);
        tree hi = TREE_OPERAND (index, 1);
        if (tree_int_cst_lt (key, lo))
@@ -5946,7 +5944,8 @@ potential_constant_expression_1 (tree t, bool want_rval, bool strict, bool now,
     case BIT_FIELD_REF:
       return RECUR (TREE_OPERAND (t, 0), want_rval);
 
-      case INDIRECT_REF: {
+    case INDIRECT_REF:
+      {
        tree x = TREE_OPERAND (t, 0);
        STRIP_NOPS (x);
        return RECUR (x, rval);
@@ -6217,7 +6216,8 @@ potential_constant_expression_1 (tree t, bool want_rval, bool strict, bool now,
     case INIT_EXPR:
       return RECUR (TREE_OPERAND (t, 1), rval);
 
-      case CONSTRUCTOR: {
+    case CONSTRUCTOR:
+      {
        vec<constructor_elt, va_gc> *v = CONSTRUCTOR_ELTS (t);
        constructor_elt *ce;
        for (i = 0; vec_safe_iterate (v, i, &ce); ++i)
@@ -6226,7 +6226,8 @@ potential_constant_expression_1 (tree t, bool want_rval, bool strict, bool now,
        return true;
       }
 
-      case TREE_LIST: {
+    case TREE_LIST:
+      {
        gcc_assert (TREE_PURPOSE (t) == NULL_TREE || DECL_P (TREE_PURPOSE (t)));
        if (!RECUR (TREE_VALUE (t), want_rval))
          return false;
@@ -6241,7 +6242,8 @@ potential_constant_expression_1 (tree t, bool want_rval, bool strict, bool now,
     case ROUND_DIV_EXPR:
     case TRUNC_MOD_EXPR:
     case CEIL_MOD_EXPR:
-      case ROUND_MOD_EXPR: {
+    case ROUND_MOD_EXPR:
+      {
        tree denom = TREE_OPERAND (t, 1);
        if (!RECUR (denom, rval))
          return false;
@@ -6261,7 +6263,8 @@ potential_constant_expression_1 (tree t, bool want_rval, bool strict, bool now,
          }
       }
 
-      case COMPOUND_EXPR: {
+    case COMPOUND_EXPR:
+      {
        /* check_return_expr sometimes wraps a TARGET_EXPR in a
           COMPOUND_EXPR; don't get confused.  */
        tree op0 = TREE_OPERAND (t, 0);
@@ -6283,7 +6286,8 @@ potential_constant_expression_1 (tree t, bool want_rval, bool strict, bool now,
     case TRUTH_OR_EXPR:
     case TRUTH_ORIF_EXPR:
       tmp = boolean_false_node;
-      truth : {
+    truth:
+      {
        tree op0 = TREE_OPERAND (t, 0);
        tree op1 = TREE_OPERAND (t, 1);
        if (!RECUR (op0, rval))
index 77a0797a019da5ac273187dee6fe0ab145f54530..27f0a2e7fc5e1ffe5c6b3c777d2994ba0bb8e739 100644 (file)
@@ -24,8 +24,7 @@ namespace Rust {
 namespace Compile {
 
 extern tree fold_expr (tree);
-extern void
-maybe_save_constexpr_fundef (tree fun);
+extern void maybe_save_constexpr_fundef (tree fun);
 
 } // namespace Compile
 } // namespace Rust
index d0df4aba27c335597eb019c4ed491d27f28deaba..f6b1a4cb54e6d5c707b257e5e87bc7633914f0bd 100644 (file)
@@ -62,9 +62,9 @@ struct V0Path
   }
 };
 
-static std::string
-v0_path (Rust::Compile::Context *ctx, const TyTy::BaseType *ty,
-        const Resolver::CanonicalPath &path);
+static std::string v0_path (Rust::Compile::Context *ctx,
+                           const TyTy::BaseType *ty,
+                           const Resolver::CanonicalPath &path);
 
 static std::string
 v0_tuple_prefix (const TyTy::BaseType *ty)
@@ -148,7 +148,8 @@ v0_complex_type_prefix (Context *ctx, const TyTy::BaseType *ty)
   // TODO: generics
   switch (ty->get_kind ())
     {
-      case TyTy::TypeKind::ADT: {
+    case TyTy::TypeKind::ADT:
+      {
        const TyTy::ADTType *adt = static_cast<const TyTy::ADTType *> (ty);
        return v0_path (ctx, ty, adt->get_ident ().path);
       }
@@ -387,7 +388,8 @@ v0_path (Rust::Compile::Context *ctx, const TyTy::BaseType *ty,
       {
        switch (impl_item->first->get_impl_item_type ())
          {
-           case HIR::ImplItem::FUNCTION: {
+         case HIR::ImplItem::FUNCTION:
+           {
              HIR::Function *fn
                = static_cast<HIR::Function *> (impl_item->first);
              v0path
@@ -408,7 +410,8 @@ v0_path (Rust::Compile::Context *ctx, const TyTy::BaseType *ty,
       {
        switch (trait_item.value ()->get_item_kind ())
          {
-           case HIR::TraitItem::FUNC: {
+         case HIR::TraitItem::FUNC:
+           {
              auto fn = static_cast<HIR::TraitItemFunc *> (*trait_item);
              rust_unreachable ();
              v0path = v0_function_path (v0path, ctx, ty,
@@ -428,7 +431,8 @@ v0_path (Rust::Compile::Context *ctx, const TyTy::BaseType *ty,
     else if (auto item = mappings.lookup_hir_item (hir_id))
       switch (item.value ()->get_item_kind ())
        {
-         case HIR::Item::ItemKind::Function: {
+       case HIR::Item::ItemKind::Function:
+         {
            HIR::Function *fn = static_cast<HIR::Function *> (*item);
            v0path
              = v0_function_path (v0path, ctx, ty, fn->get_generic_params (),
index 2a84b6b1deaaf2018883efab23d7ed808098dc40..418f2bdca8811bed1151dd1cf5242171c0b01880 100644 (file)
@@ -49,13 +49,12 @@ private:
   static enum MangleVersion version;
 };
 
-std::string
-legacy_mangle_item (const TyTy::BaseType *ty,
-                   const Resolver::CanonicalPath &path);
+std::string legacy_mangle_item (const TyTy::BaseType *ty,
+                               const Resolver::CanonicalPath &path);
 
-std::string
-v0_mangle_item (Rust::Compile::Context *ctx, const TyTy::BaseType *ty,
-               const Resolver::CanonicalPath &path);
+std::string v0_mangle_item (Rust::Compile::Context *ctx,
+                           const TyTy::BaseType *ty,
+                           const Resolver::CanonicalPath &path);
 
 } // namespace Compile
 } // namespace Rust
index 2302ffb55f2f2ed4a29751423d604c4158e07474..b86c3c81125b3ab8b54cd955bed42ef4582911fb 100644 (file)
@@ -268,7 +268,8 @@ convert_to_void (tree expr, impl_conv_void implicit)
     return expr;
   switch (TREE_CODE (expr))
     {
-      case COND_EXPR: {
+    case COND_EXPR:
+      {
        /* The two parts of a cond expr might be separate lvalues.  */
        tree op1 = TREE_OPERAND (expr, 1);
        tree op2 = TREE_OPERAND (expr, 2);
@@ -294,7 +295,8 @@ convert_to_void (tree expr, impl_conv_void implicit)
        break;
       }
 
-      case COMPOUND_EXPR: {
+    case COMPOUND_EXPR:
+      {
        /* The second part of a compound expr contains the value.  */
        tree op1 = TREE_OPERAND (expr, 1);
        tree new_op1;
@@ -323,7 +325,8 @@ convert_to_void (tree expr, impl_conv_void implicit)
       maybe_warn_nodiscard (expr, implicit);
       break;
 
-      case INDIRECT_REF: {
+    case INDIRECT_REF:
+      {
        tree type = TREE_TYPE (expr);
        int is_reference = TYPE_REF_P (TREE_TYPE (TREE_OPERAND (expr, 0)));
        int is_volatile = TYPE_VOLATILE (type);
@@ -518,7 +521,8 @@ convert_to_void (tree expr, impl_conv_void implicit)
        break;
       }
 
-      case VAR_DECL: {
+    case VAR_DECL:
+      {
        /* External variables might be incomplete.  */
        tree type = TREE_TYPE (expr);
        int is_complete = COMPLETE_TYPE_P (type);
@@ -1485,7 +1489,8 @@ find_parameter_packs_r (tree *tp, int *walk_subtrees, void *data)
      parameter pack.  ??? Should some of these be in cp_walk_subtrees?  */
   switch (TREE_CODE (t))
     {
-      case DECL_EXPR: {
+    case DECL_EXPR:
+      {
        tree decl = DECL_EXPR_DECL (t);
        if (is_typedef_decl (decl))
          /* Since we stop at typedefs above, we need to look through them at
@@ -1506,7 +1511,8 @@ find_parameter_packs_r (tree *tp, int *walk_subtrees, void *data)
       *walk_subtrees = 0;
       return NULL_TREE;
 
-      case DECLTYPE_TYPE: {
+    case DECLTYPE_TYPE:
+      {
        /* When traversing a DECLTYPE_TYPE_EXPR, we need to set
           type_pack_expansion_p to false so that any placeholders
           within the expression don't get marked as parameter packs.  */
@@ -1970,7 +1976,8 @@ rs_tree_equal (tree t1, tree t2)
     case SAVE_EXPR:
       return rs_tree_equal (TREE_OPERAND (t1, 0), TREE_OPERAND (t2, 0));
 
-      case CALL_EXPR: {
+    case CALL_EXPR:
+      {
        if (KOENIG_LOOKUP_P (t1) != KOENIG_LOOKUP_P (t2))
          return false;
 
@@ -1996,7 +2003,8 @@ rs_tree_equal (tree t1, tree t2)
        return true;
       }
 
-      case TARGET_EXPR: {
+    case TARGET_EXPR:
+      {
        tree o1 = TREE_OPERAND (t1, 0);
        tree o2 = TREE_OPERAND (t2, 0);
 
@@ -2067,7 +2075,8 @@ rs_tree_equal (tree t1, tree t2)
     case tcc_expression:
     case tcc_vl_exp:
     case tcc_reference:
-      case tcc_statement: {
+    case tcc_statement:
+      {
        int n = rs_tree_operand_length (t1);
        if (TREE_CODE_CLASS (code1) == tcc_vl_exp
            && n != TREE_OPERAND_LENGTH (t2))
@@ -2095,7 +2104,11 @@ rs_tree_equal (tree t1, tree t2)
 
 /* TRUE iff TYPE is publicly & uniquely derived from PARENT.  */
 
-bool publicly_uniquely_derived_p (tree, tree) { return false; }
+bool
+publicly_uniquely_derived_p (tree, tree)
+{
+  return false;
+}
 
 // forked from gcc/cp/typeck.cc comp_except_types
 
@@ -3375,7 +3388,11 @@ release_tree_vector (vec<tree, va_gc> *vec)
 
 /* As above, but also check value-dependence of the expression as a whole.  */
 
-bool instantiation_dependent_expression_p (tree) { return false; }
+bool
+instantiation_dependent_expression_p (tree)
+{
+  return false;
+}
 
 // forked from gcc/cp/cvt.cc cp_get_callee
 
@@ -3425,7 +3442,11 @@ scalarish_type_p (const_tree t)
    constructors are deleted.  This function implements the ABI notion of
    non-trivial copy, which has diverged from the one in the standard.  */
 
-bool type_has_nontrivial_copy_init (const_tree) { return false; }
+bool
+type_has_nontrivial_copy_init (const_tree)
+{
+  return false;
+}
 
 // forked from gcc/cp/tree.cc build_local_temp
 
@@ -3448,7 +3469,11 @@ build_local_temp (tree type)
 /* Returns true iff DECL is a capture proxy for a normal capture
    (i.e. without explicit initializer).  */
 
-bool is_normal_capture_proxy (tree) { return false; }
+bool
+is_normal_capture_proxy (tree)
+{
+  return false;
+}
 
 // forked from gcc/cp/c-common.cc reject_gcc_builtin
 
@@ -3522,7 +3547,8 @@ is_bitfield_expr_with_lowered_type (const_tree exp)
     case BIT_NOT_EXPR:
       return is_bitfield_expr_with_lowered_type (TREE_OPERAND (exp, 0));
 
-      case COMPONENT_REF: {
+    case COMPONENT_REF:
+      {
        tree field;
 
        field = TREE_OPERAND (exp, 1);
@@ -3909,7 +3935,8 @@ retry:
       break;
 
     case OFFSET_TYPE:
-      bad_member : {
+    bad_member:
+      {
        tree member = TREE_OPERAND (value, 1);
        if (is_overloaded_fn (member))
          member = get_first_fn (member);
@@ -3994,13 +4021,21 @@ decl_constant_var_p (tree decl)
 /* Returns true iff DECL is a variable or function declared with an auto type
    that has not yet been deduced to a real type.  */
 
-bool undeduced_auto_decl (tree) { return false; }
+bool
+undeduced_auto_decl (tree)
+{
+  return false;
+}
 
 // forked from gcc/cp/decl.cc require_deduced_type
 
 /* Complain if DECL has an undeduced return type.  */
 
-bool require_deduced_type (tree, tsubst_flags_t) { return true; }
+bool
+require_deduced_type (tree, tsubst_flags_t)
+{
+  return true;
+}
 
 /* Return the location of a tree passed to %+ formats.  */
 
@@ -4290,10 +4325,9 @@ struct GTY ((for_user)) source_location_table_entry
 
 } // namespace Rust
 
-extern void
-gt_pch_nx (Rust::source_location_table_entry &);
-extern void
-gt_pch_nx (Rust::source_location_table_entry *, gt_pointer_operator, void *);
+extern void gt_pch_nx (Rust::source_location_table_entry &);
+extern void gt_pch_nx (Rust::source_location_table_entry *, gt_pointer_operator,
+                      void *);
 
 namespace Rust {
 
@@ -4421,7 +4455,8 @@ lvalue_kind (const_tree ref)
     case VIEW_CONVERT_EXPR:
       return lvalue_kind (TREE_OPERAND (ref, 0));
 
-      case ARRAY_REF: {
+    case ARRAY_REF:
+      {
        tree op1 = TREE_OPERAND (ref, 0);
        if (TREE_CODE (TREE_TYPE (op1)) == ARRAY_TYPE)
          {
@@ -4518,7 +4553,8 @@ lvalue_kind (const_tree ref)
       op2_lvalue_kind = lvalue_kind (TREE_OPERAND (ref, 1));
       break;
 
-      case COND_EXPR: {
+    case COND_EXPR:
+      {
        tree op1 = TREE_OPERAND (ref, 1);
        if (!op1)
          op1 = TREE_OPERAND (ref, 0);
index 3630b0e6bdeb5ac1de55a882bdf7bd27f8fbd654..9e859d4873a0fe4bcad70ab38c810f121fa28834 100644 (file)
@@ -1543,7 +1543,7 @@ extern GTY (()) tree cp_global_trees[CPTI_MAX];
 #if defined ENABLE_TREE_CHECKING
 
 #define LANG_DECL_MIN_CHECK(NODE)                                              \
-  __extension__({                                                              \
+  __extension__ ({                                                             \
     struct lang_decl *lt = DECL_LANG_SPECIFIC (NODE);                          \
     if (!LANG_DECL_HAS_MIN (NODE))                                             \
       lang_check_failed (__FILE__, __LINE__, __FUNCTION__);                    \
@@ -1554,7 +1554,7 @@ extern GTY (()) tree cp_global_trees[CPTI_MAX];
    template, not just on a FUNCTION_DECL.  So when looking for things in
    lang_decl_fn, look down through a TEMPLATE_DECL into its result.  */
 #define LANG_DECL_FN_CHECK(NODE)                                               \
-  __extension__({                                                              \
+  __extension__ ({                                                             \
     struct lang_decl *lt = DECL_LANG_SPECIFIC (NODE);                          \
     if (!DECL_DECLARES_FUNCTION_P (NODE) || lt->u.base.selector != lds_fn)     \
       lang_check_failed (__FILE__, __LINE__, __FUNCTION__);                    \
@@ -1562,7 +1562,7 @@ extern GTY (()) tree cp_global_trees[CPTI_MAX];
   })
 
 #define LANG_DECL_NS_CHECK(NODE)                                               \
-  __extension__({                                                              \
+  __extension__ ({                                                             \
     struct lang_decl *lt = DECL_LANG_SPECIFIC (NODE);                          \
     if (TREE_CODE (NODE) != NAMESPACE_DECL || lt->u.base.selector != lds_ns)   \
       lang_check_failed (__FILE__, __LINE__, __FUNCTION__);                    \
@@ -1570,7 +1570,7 @@ extern GTY (()) tree cp_global_trees[CPTI_MAX];
   })
 
 #define LANG_DECL_PARM_CHECK(NODE)                                             \
-  __extension__({                                                              \
+  __extension__ ({                                                             \
     struct lang_decl *lt = DECL_LANG_SPECIFIC (NODE);                          \
     if (TREE_CODE (NODE) != PARM_DECL || lt->u.base.selector != lds_parm)      \
       lang_check_failed (__FILE__, __LINE__, __FUNCTION__);                    \
@@ -1578,7 +1578,7 @@ extern GTY (()) tree cp_global_trees[CPTI_MAX];
   })
 
 #define LANG_DECL_DECOMP_CHECK(NODE)                                           \
-  __extension__({                                                              \
+  __extension__ ({                                                             \
     struct lang_decl *lt = DECL_LANG_SPECIFIC (NODE);                          \
     if (!VAR_P (NODE) || lt->u.base.selector != lds_decomp)                    \
       lang_check_failed (__FILE__, __LINE__, __FUNCTION__);                    \
@@ -2060,8 +2060,8 @@ struct GTY (()) rust_cxx_saved_binding
 // forked from gcc/cp/name-lookup.h resort_type_member_vec
 
 /* needed for GTY annotation */
-extern void
-resort_type_member_vec (void *, void *, gt_pointer_operator, void *);
+extern void resort_type_member_vec (void *, void *, gt_pointer_operator,
+                                   void *);
 
 // forked from gcc/cp/cp-tree.h saved_scope
 
@@ -2895,8 +2895,7 @@ enum compare_bounds_t
   bounds_first
 };
 
-extern tree
-convert_to_void (tree expr, impl_conv_void implicit);
+extern tree convert_to_void (tree expr, impl_conv_void implicit);
 
 // The lvalue-to-rvalue conversion (7.1) is applied if and only if the
 // expression is a glvalue of volatile-qualified type and it is one of the
@@ -2911,63 +2910,52 @@ convert_to_void (tree expr, impl_conv_void implicit);
 //   operands are one of these expressions, or
 // * comma expression (8.19) where the right operand is one of these
 //   expressions.
-extern tree
-mark_discarded_use (tree expr);
+extern tree mark_discarded_use (tree expr);
 
 // Mark EXP as read, not just set, for set but not used -Wunused warning
 // purposes.
-extern void
-mark_exp_read (tree exp);
+extern void mark_exp_read (tree exp);
 
 // We've seen an actual use of EXPR.  Possibly replace an outer variable
 // reference inside with its constant value or a lambda capture.
-extern tree
-mark_use (tree expr, bool rvalue_p, bool read_p, location_t loc,
-         bool reject_builtin);
+extern tree mark_use (tree expr, bool rvalue_p, bool read_p, location_t loc,
+                     bool reject_builtin);
 
 // Called whenever the expression EXPR is used in an rvalue context.
 // When REJECT_BUILTIN is true the expression is checked to make sure
 // it doesn't make it possible to obtain the address of a GCC built-in
 // function with no library fallback (or any of its bits, such as in
 // a conversion to bool).
-extern tree
-mark_rvalue_use (tree, location_t = UNKNOWN_LOCATION,
-                bool reject_builtin = true);
+extern tree mark_rvalue_use (tree, location_t = UNKNOWN_LOCATION,
+                            bool reject_builtin = true);
 
 // Called whenever an expression is used in an lvalue context.
-extern tree
-mark_lvalue_use (tree expr);
+extern tree mark_lvalue_use (tree expr);
 
 // As above, but don't consider this use a read.
-extern tree
-mark_lvalue_use_nonread (tree expr);
+extern tree mark_lvalue_use_nonread (tree expr);
 
 // We are using a reference VAL for its value. Bash that reference all the way
 // down to its lowest form.
-extern tree
-convert_from_reference (tree val);
+extern tree convert_from_reference (tree val);
 
 // Subroutine of convert_to_void.  Warn if we're discarding something with
 // attribute [[nodiscard]].
-extern void
-maybe_warn_nodiscard (tree expr, impl_conv_void implicit);
+extern void maybe_warn_nodiscard (tree expr, impl_conv_void implicit);
 
-extern location_t
-expr_loc_or_loc (const_tree t, location_t or_loc);
+extern location_t expr_loc_or_loc (const_tree t, location_t or_loc);
 
-extern location_t
-expr_loc_or_input_loc (const_tree t);
+extern location_t expr_loc_or_input_loc (const_tree t);
 
 // FN is the callee of a CALL_EXPR or AGGR_INIT_EXPR; return the FUNCTION_DECL
 // if we can.
-extern tree
-get_fndecl_from_callee (tree fn);
+extern tree get_fndecl_from_callee (tree fn);
 
 // FIXME some helpers from HIRCompileBase could probably be moved here over time
 
 // Return an expression for the address of BASE[INDEX], used in offset intrinsic
-extern tree
-pointer_offset_expression (tree base_tree, tree index_tree, location_t locus);
+extern tree pointer_offset_expression (tree base_tree, tree index_tree,
+                                      location_t locus);
 
 /* A tree node, together with a location, so that we can track locations
    (and ranges) during parsing.
@@ -2978,11 +2966,9 @@ pointer_offset_expression (tree base_tree, tree index_tree, location_t locus);
 
 extern location_t rs_expr_location (const_tree);
 
-extern int
-is_empty_class (tree type);
+extern int is_empty_class (tree type);
 
-extern bool
-is_really_empty_class (tree, bool);
+extern bool is_really_empty_class (tree, bool);
 
 extern bool builtin_valid_in_constant_expr_p (const_tree);
 
@@ -2990,15 +2976,13 @@ extern bool maybe_constexpr_fn (tree);
 
 extern bool var_in_maybe_constexpr_fn (tree);
 
-extern int
-rs_type_quals (const_tree type);
+extern int rs_type_quals (const_tree type);
 
 inline bool type_unknown_p (const_tree);
 
 extern bool decl_maybe_constant_var_p (tree);
 
-extern void
-init_modules ();
+extern void init_modules ();
 
 extern bool var_in_constexpr_fn (tree);
 
@@ -3006,11 +2990,9 @@ inline tree ovl_first (tree) ATTRIBUTE_PURE;
 
 inline bool type_unknown_p (const_tree);
 
-extern tree
-lookup_add (tree fns, tree lookup);
+extern tree lookup_add (tree fns, tree lookup);
 
-extern tree
-ovl_make (tree fn, tree next = NULL_TREE);
+extern tree ovl_make (tree fn, tree next = NULL_TREE);
 
 extern int is_overloaded_fn (tree) ATTRIBUTE_PURE;
 
@@ -3024,19 +3006,15 @@ extern tree make_conv_op_name (tree);
 
 extern int type_memfn_quals (const_tree);
 
-struct c_fileinfo *
-get_fileinfo (const char *);
+struct c_fileinfo *get_fileinfo (const char *);
 
-extern tree
-cxx_make_type (enum tree_code CXX_MEM_STAT_INFO);
+extern tree cxx_make_type (enum tree_code CXX_MEM_STAT_INFO);
 
-extern tree
-build_cplus_array_type (tree, tree, int is_dep = -1);
+extern tree build_cplus_array_type (tree, tree, int is_dep = -1);
 
 extern bool is_byte_access_type (tree);
 
-extern bool
-comptypes (tree, tree, int);
+extern bool comptypes (tree, tree, int);
 
 extern tree canonical_eh_spec (tree);
 
@@ -3046,8 +3024,7 @@ extern bool rs_tree_equal (tree, tree);
 
 extern bool compparms (const_tree, const_tree);
 
-extern tree
-rs_build_qualified_type_real (tree, int, tsubst_flags_t);
+extern tree rs_build_qualified_type_real (tree, int, tsubst_flags_t);
 #define rs_build_qualified_type(TYPE, QUALS)                                   \
   rs_build_qualified_type_real ((TYPE), (QUALS), tf_warning_or_error)
 extern bool cv_qualified_p (const_tree);
@@ -3056,21 +3033,18 @@ extern bool similar_type_p (tree, tree);
 
 extern bool rs_tree_equal (tree, tree);
 
-extern bool
-vector_targets_convertible_p (const_tree t1, const_tree t2);
+extern bool vector_targets_convertible_p (const_tree t1, const_tree t2);
 
 extern bool same_type_ignoring_top_level_qualifiers_p (tree, tree);
 
 extern bool comp_ptr_ttypes_const (tree, tree, compare_bounds_t);
 
-extern tree
-get_class_binding_direct (tree, tree, bool want_type = false);
+extern tree get_class_binding_direct (tree, tree, bool want_type = false);
 
 extern tree skip_artificial_parms_for (const_tree, tree);
 
-extern void
-lang_check_failed (const char *, int,
-                  const char *) ATTRIBUTE_NORETURN ATTRIBUTE_COLD;
+extern void lang_check_failed (const char *, int,
+                              const char *) ATTRIBUTE_NORETURN ATTRIBUTE_COLD;
 
 extern tree default_init_uninitialized_part (tree);
 
@@ -3088,8 +3062,7 @@ extern tree in_class_defaulted_default_constructor (tree);
 
 extern bool is_instantiation_of_constexpr (tree);
 
-extern bool
-check_for_uninitialized_const_var (tree, bool, tsubst_flags_t);
+extern bool check_for_uninitialized_const_var (tree, bool, tsubst_flags_t);
 
 extern bool reduced_constant_expression_p (tree);
 
@@ -3108,19 +3081,17 @@ extern tree is_bitfield_expr_with_lowered_type (const_tree);
 
 extern tree convert_bitfield_to_declared_type (tree);
 
-extern tree
-cp_fold_maybe_rvalue (tree, bool);
+extern tree cp_fold_maybe_rvalue (tree, bool);
 
 extern tree maybe_undo_parenthesized_ref (tree);
 
-extern tree
-fold_offsetof (tree, tree = size_type_node, tree_code ctx = ERROR_MARK);
+extern tree fold_offsetof (tree, tree = size_type_node,
+                          tree_code ctx = ERROR_MARK);
 
 extern tree cp_truthvalue_conversion (tree, tsubst_flags_t);
 
-extern tree
-fold_non_dependent_expr (tree, tsubst_flags_t = tf_warning_or_error,
-                        bool = false, tree = NULL_TREE);
+extern tree fold_non_dependent_expr (tree, tsubst_flags_t = tf_warning_or_error,
+                                    bool = false, tree = NULL_TREE);
 
 extern int char_type_p (tree);
 
@@ -3163,13 +3134,11 @@ extern tree build_new_constexpr_heap_type (tree, tree, tree);
 
 extern bool is_empty_field (tree);
 
-extern bool
-in_immediate_context ();
+extern bool in_immediate_context ();
 
 extern tree cp_get_callee_fndecl_nofold (tree);
 
-extern bool
-cxx_mark_addressable (tree, bool = false);
+extern bool cxx_mark_addressable (tree, bool = false);
 
 extern tree fold_builtin_source_location (location_t);
 
@@ -3183,25 +3152,22 @@ extern bool glvalue_p (const_tree);
 
 extern cp_lvalue_kind lvalue_kind (const_tree);
 
-extern tree
-decl_constant_value (tree, bool);
+extern tree decl_constant_value (tree, bool);
 
 extern tree lookup_enumerator (tree, tree);
 
-extern int
-is_class_type (tree, int);
+extern int is_class_type (tree, int);
 
 extern tree braced_lists_to_strings (tree, tree);
 
-extern tree
-fold_builtin_is_pointer_inverconvertible_with_class (location_t, int, tree *);
+extern tree fold_builtin_is_pointer_inverconvertible_with_class (location_t,
+                                                                int, tree *);
 
 extern bool layout_compatible_type_p (tree, tree);
 
 extern tree finish_underlying_type (tree);
 
-extern tree
-c_common_type_for_mode (machine_mode, int);
+extern tree c_common_type_for_mode (machine_mode, int);
 
 extern bool std_layout_type_p (const_tree);
 
@@ -3213,25 +3179,21 @@ extern void note_failed_type_completion_for_satisfaction (tree);
 
 extern tree complete_type_or_maybe_complain (tree, tree, tsubst_flags_t);
 
-extern bool
-next_common_initial_seqence (tree &, tree &);
+extern bool next_common_initial_seqence (tree &, tree &);
 
 extern bool null_member_pointer_value_p (tree);
 
-extern tree
-fold_builtin_is_corresponding_member (location_t, int, tree *);
+extern tree fold_builtin_is_corresponding_member (location_t, int, tree *);
 
 extern tree cp_fold_rvalue (tree);
 
-extern tree
-maybe_constant_value (tree, tree = NULL_TREE, bool = false);
+extern tree maybe_constant_value (tree, tree = NULL_TREE, bool = false);
 
 extern tree lvalue_type (tree);
 
 extern void lvalue_error (location_t, enum lvalue_use);
 
-extern tree
-cp_fold_maybe_rvalue (tree, bool);
+extern tree cp_fold_maybe_rvalue (tree, bool);
 
 extern tree get_first_fn (tree) ATTRIBUTE_PURE;
 
@@ -3253,13 +3215,12 @@ enum
   ce_exact
 };
 
-extern tree
-rs_build_qualified_type_real (tree, int, tsubst_flags_t);
+extern tree rs_build_qualified_type_real (tree, int, tsubst_flags_t);
 #define rs_build_qualified_type(TYPE, QUALS)                                   \
   rs_build_qualified_type_real ((TYPE), (QUALS), tf_warning_or_error)
 
-extern tree
-rs_walk_subtrees (tree *, int *, walk_tree_fn, void *, hash_set<tree> *);
+extern tree rs_walk_subtrees (tree *, int *, walk_tree_fn, void *,
+                             hash_set<tree> *);
 #define rs_walk_tree(tp, func, data, pset)                                     \
   walk_tree_1 (tp, func, data, pset, rs_walk_subtrees)
 #define rs_walk_tree_without_duplicates(tp, func, data)                        \
@@ -3351,11 +3312,9 @@ gnu_vector_type_p (const_tree type)
   return TREE_CODE (type) == VECTOR_TYPE && !TYPE_INDIVISIBLE_P (type);
 }
 
-extern vec<tree, va_gc> *
-make_tree_vector (void);
+extern vec<tree, va_gc> *make_tree_vector (void);
 
-extern void
-release_tree_vector (vec<tree, va_gc> *);
+extern void release_tree_vector (vec<tree, va_gc> *);
 
 /* Simplified unique_ptr clone to release a tree vec on exit.  */
 
@@ -3373,7 +3332,7 @@ public:
   releasing_vec &operator= (const releasing_vec &);
 
   vec_t &operator* () const { return *v; }
-  vec_t *operator-> () const { return v; }
+  vec_t *operator->() const { return v; }
   vec_t *get () const { return v; }
   operator vec_t * () const { return v; }
   vec_t **operator& () { return &v; }
@@ -3442,8 +3401,7 @@ cxx_incomplete_type_error (const_tree value, const_tree type)
   cxx_incomplete_type_diagnostic (value, type, diagnostics::kind::error);
 }
 
-extern location_t
-location_of (tree t);
+extern location_t location_of (tree t);
 
 /* Helpers for IMPLICIT_RVALUE_P to look through automatic dereference.  */
 
@@ -3465,23 +3423,18 @@ set_implicit_rvalue_p (tree ot)
 }
 
 namespace Compile {
-extern tree
-maybe_constant_init (tree, tree = NULL_TREE, bool = false);
+extern tree maybe_constant_init (tree, tree = NULL_TREE, bool = false);
 
-extern void
-explain_invalid_constexpr_fn (tree fun);
+extern void explain_invalid_constexpr_fn (tree fun);
 
 extern bool potential_constant_expression (tree);
 
-extern bool
-literal_type_p (tree t);
+extern bool literal_type_p (tree t);
 
-extern bool
-maybe_constexpr_fn (tree t);
+extern bool maybe_constexpr_fn (tree t);
 
-extern tree
-fold_non_dependent_init (tree, tsubst_flags_t = tf_warning_or_error,
-                        bool = false, tree = NULL_TREE);
+extern tree fold_non_dependent_init (tree, tsubst_flags_t = tf_warning_or_error,
+                                    bool = false, tree = NULL_TREE);
 } // namespace Compile
 
 } // namespace Rust
index 0ce21421821233cf793cec0a2818adbc26f527cf..0434bcfed03421460089a540971ce61c9b7f931f 100644 (file)
@@ -239,31 +239,25 @@ struct Facts
  *
  * Output is not yet implemented and is only dumped to stdout.
  */
-extern "C" FFI::Output
-polonius_run (FFI::FactsView input, bool dump_enabled);
+extern "C" FFI::Output polonius_run (FFI::FactsView input, bool dump_enabled);
 
 // Helper functions for FFIVector to be used on Rust side
 extern "C" {
 
-FFI::FFIVector<size_t> *
-FFIVector__new ();
+FFI::FFIVector<size_t> *FFIVector__new ();
 
-FFI::FFIVectorPair *
-FFIVector__new_vec_pair ();
+FFI::FFIVectorPair *FFIVector__new_vec_pair ();
 
-FFI::FFIVectorTriple *
-FFIVector__new_vec_triple ();
+FFI::FFIVectorTriple *FFIVector__new_vec_triple ();
 
-void
-FFIVector__push (FFI::FFIVector<size_t> *vector, size_t element);
+void FFIVector__push (FFI::FFIVector<size_t> *vector, size_t element);
 
 void
 FFIVector__push_vec_pair (FFI::FFIVectorPair *vector,
                          FFI::Pair<size_t, FFI::FFIVector<size_t> *> element);
 
-void
-FFIVector__push_vec_triple (FFI::FFIVectorTriple *vector,
-                           FFI::Triple<size_t, size_t, size_t> element);
+void FFIVector__push_vec_triple (FFI::FFIVectorTriple *vector,
+                                FFI::Triple<size_t, size_t, size_t> element);
 }
 
 } // namespace Polonius
index 6b8b2e97ba74926e616aa0a15d1e9f8abf7cd7ae..c59aba40d1cfaf69744629740a220763520313e0 100644 (file)
@@ -240,7 +240,8 @@ ExprStmtBuilder::visit (HIR::ArrayExpr &expr)
   auto &elems = expr.get_internal_elements ();
   switch (elems.get_array_expr_type ())
     {
-      case HIR::ArrayElems::VALUES: {
+    case HIR::ArrayElems::VALUES:
+      {
        auto &elem_vals = (static_cast<HIR::ArrayElemsValues &> (elems));
        auto init_values = visit_list (elem_vals.get_values ());
        // collect locations
@@ -254,7 +255,8 @@ ExprStmtBuilder::visit (HIR::ArrayExpr &expr)
                     lookup_type (expr), expr.get_locus ());
        break;
       }
-      case HIR::ArrayElems::COPIED: {
+    case HIR::ArrayElems::COPIED:
+      {
        auto &elem_copied = (static_cast<HIR::ArrayElemsCopied &> (elems));
        auto init = visit_expr (elem_copied.get_elem_to_copy ());
        return_expr (new InitializerExpr ({init}), lookup_type (expr),
index ee37bb09bc43c19e810453623020d0cfe9652cae..2d655f910342f68cc0ec8350597b5b91d3142f5c 100644 (file)
@@ -101,7 +101,8 @@ PatternBindingBuilder::visit (HIR::StructPattern &pattern)
     {
       switch (field->get_item_type ())
        {
-         case HIR::StructPatternField::TUPLE_PAT: {
+       case HIR::StructPatternField::TUPLE_PAT:
+         {
            auto tuple
              = static_cast<HIR::StructPatternFieldTuplePat *> (field.get ());
 
@@ -123,7 +124,8 @@ PatternBindingBuilder::visit (HIR::StructPattern &pattern)
            tuple->get_tuple_pattern ().accept_vis (*this);
            break;
          }
-         case HIR::StructPatternField::IDENT_PAT: {
+       case HIR::StructPatternField::IDENT_PAT:
+         {
            auto ident_field
              = static_cast<HIR::StructPatternFieldIdentPat *> (field.get ());
            TyTy::StructFieldType *field_ty = nullptr;
@@ -139,7 +141,8 @@ PatternBindingBuilder::visit (HIR::StructPattern &pattern)
            ident_field->get_pattern ().accept_vis (*this);
            break;
          }
-         case HIR::StructPatternField::IDENT: {
+       case HIR::StructPatternField::IDENT:
+         {
            auto ident_field
              = static_cast<HIR::StructPatternFieldIdent *> (field.get ());
            TyTy::StructFieldType *field_ty = nullptr;
@@ -199,13 +202,15 @@ PatternBindingBuilder::visit (HIR::TuplePattern &pattern)
   size_t index = 0;
   switch (pattern.get_items ().get_item_type ())
     {
-      case HIR::TuplePatternItems::MULTIPLE: {
+    case HIR::TuplePatternItems::MULTIPLE:
+      {
        auto &items = static_cast<HIR::TuplePatternItemsMultiple &> (
          pattern.get_items ());
        visit_tuple_fields (items.get_patterns (), saved, index);
        break;
       }
-      case HIR::TuplePatternItems::RANGED: {
+    case HIR::TuplePatternItems::RANGED:
+      {
        auto &items
          = static_cast<HIR::TuplePatternItemsRanged &> (pattern.get_items ());
 
@@ -244,7 +249,8 @@ PatternBindingBuilder::visit (HIR::TupleStructPattern &pattern)
   size_t index = 0;
   switch (pattern.get_items ().get_item_type ())
     {
-      case HIR::TupleStructItems::RANGED: {
+    case HIR::TupleStructItems::RANGED:
+      {
        auto &items
          = static_cast<HIR::TupleStructItemsRange &> (pattern.get_items ());
 
@@ -261,7 +267,8 @@ PatternBindingBuilder::visit (HIR::TupleStructPattern &pattern)
        visit_tuple_fields (items.get_upper_patterns (), saved, index);
        break;
       }
-      case HIR::TupleStructItems::MULTIPLE: {
+    case HIR::TupleStructItems::MULTIPLE:
+      {
        auto &items
          = static_cast<HIR::TupleStructItemsNoRange &> (pattern.get_items ());
        visit_tuple_fields (items.get_patterns (), saved, index);
index 3864b81a4d9e33d63e511f6a325ab2be01588480..9a7bb2054aeb2daaca6f62c90d949859ae1114c0 100644 (file)
@@ -182,7 +182,8 @@ Dump::visit (const Statement &stmt)
   statement_place = stmt.get_place ();
   switch (stmt.get_kind ())
     {
-      case Statement::Kind::ASSIGNMENT: {
+    case Statement::Kind::ASSIGNMENT:
+      {
        visit_place (stmt.get_place ());
        stream << " = ";
        stmt.get_expr ().accept_vis (*this);
index 32a4cd7b76c89a1acdd8f795570e717099f3146d..e3a1247206d6fa561d8d360be1e227298dbc5020 100644 (file)
@@ -232,42 +232,50 @@ protected: // Main collection entry points (for different categories).
   {
     switch (stmt.get_kind ())
       {
-       case Statement::Kind::ASSIGNMENT: {
+      case Statement::Kind::ASSIGNMENT:
+       {
          // TODO: for unwind, must had hadning for non-panic-only assignements
          issue_write_deep (stmt.get_place ());
          visit_assignment_expr (stmt.get_place (), stmt.get_expr ());
          break;
        }
-       case Statement::Kind::SWITCH: {
+      case Statement::Kind::SWITCH:
+       {
          issue_read_move (stmt.get_place ());
          issue_jumps ();
        }
        break;
-       case Statement::Kind::GOTO: {
+      case Statement::Kind::GOTO:
+       {
          issue_jumps ();
        }
        break;
-       case Statement::Kind::RETURN: {
+      case Statement::Kind::RETURN:
+       {
          issue_place_access (RETURN_VALUE_PLACE);
          issue_locals_dealloc ();
          break;
        }
-       case Statement::Kind::STORAGE_DEAD: {
+      case Statement::Kind::STORAGE_DEAD:
+       {
          facts.path_moved_at_base.emplace_back (stmt.get_place ().value,
                                                 get_current_point_mid ());
          facts.var_defined_at.emplace_back (stmt.get_place ().value,
                                             get_current_point_mid ());
          break;
        }
-       case Statement::Kind::STORAGE_LIVE: {
+      case Statement::Kind::STORAGE_LIVE:
+       {
          issue_write_deep (stmt.get_place (), true);
          break;
        }
-       case Statement::Kind::USER_TYPE_ASCRIPTION: {
+      case Statement::Kind::USER_TYPE_ASCRIPTION:
+       {
          issue_user_type_constraints (stmt.get_place (), stmt.get_type ());
          break;
        }
-       case Statement::Kind::FAKE_READ: {
+      case Statement::Kind::FAKE_READ:
+       {
          issue_place_access (stmt.get_place ());
          break;
        }
@@ -791,7 +799,8 @@ protected: // Subset helpers.
          type->as<const TyTy::SliceType> ()->get_element_type (), region_start,
          regions);
       case TyTy::FNDEF:
-       case TyTy::TUPLE: {
+      case TyTy::TUPLE:
+       {
          for (auto &field : type->as<const TyTy::TupleType> ()->get_fields ())
            sanitize_constraints (field.get_tyty (), region_start, regions);
        }
index dd9e672f41208b858edcdaeb188017cb2163a9ad..14f1dd660b0e68d8e18cce865b444411d4bccafd 100644 (file)
@@ -217,7 +217,7 @@ public:
   const T &operator[] (I pid) const { return internal_vector[pid.value]; }
 
   void push_back (T &&param) { internal_vector.push_back (std::move (param)); }
-  template <typename... Args> void emplace_back (Args &&... args)
+  template <typename... Args> void emplace_back (Args &&...args)
   {
     internal_vector.emplace_back (std::forward<Args> (args)...);
   }
@@ -471,14 +471,16 @@ private:
       case TyTy::FNDEF:
       case TyTy::NEVER:
        return true;
-       case TyTy::TUPLE: {
+      case TyTy::TUPLE:
+       {
          auto &fields = ty->as<TyTy::TupleType> ()->get_fields ();
          return std::all_of (fields.begin (), fields.end (),
                              [] (const TyTy::TyVar &field) {
                                return is_type_copy (field.get_tyty ());
                              });
        }
-       case TyTy::ARRAY: {
+      case TyTy::ARRAY:
+       {
          return is_type_copy (ty->as<TyTy::ArrayType> ()->get_element_type ());
        }
       case TyTy::INFER:
index 5dac89e51170e260936064623c2cf9a023eaa2fc..d405569b566dbe95f6e7fb90c927101be3f1b1a6 100644 (file)
@@ -51,7 +51,7 @@ template <typename BASE, typename T> class VisitableImpl : public BASE
 {
 public:
   template <typename... Args>
-  explicit VisitableImpl (Args &&... args) : BASE (std::forward<Args> (args)...)
+  explicit VisitableImpl (Args &&...args) : BASE (std::forward<Args> (args)...)
   {}
 
   void accept_vis (Visitor &visitor) override
index 3d25459d9cfd0454cefee0d60f0f1badaa432539..5291276a7a378cf9606ff298c311e1925524158d 100644 (file)
@@ -25,8 +25,7 @@
 #include "rust-pub-restricted-visitor.h"
 #include "rust-privacy-reporter.h"
 
-extern bool
-saw_errors (void);
+extern bool saw_errors (void);
 
 namespace Rust {
 namespace Privacy {
index a506613f64e8b3f554e39b661033aa5ab2d46e56..9699ac4f98c78dd116a85093d283516562b66a1d 100644 (file)
@@ -71,8 +71,7 @@ private:
 
 #if CHECKING_P
 namespace selftest {
-void
-rust_privacy_ctx_test (void);
+void rust_privacy_ctx_test (void);
 }
 #endif // !CHECKING_P
 
index 2a1005343a15c17e3457d419edbe51a4180cb2e0..3faa3b404e69ee4939b6e53ce5c65247d5795c97 100644 (file)
@@ -157,7 +157,8 @@ PrivacyReporter::check_for_privacy_violation (const NodeId &use_id,
     {
     case ModuleVisibility::Public:
       break;
-      case ModuleVisibility::Restricted: {
+    case ModuleVisibility::Restricted:
+      {
        // If we are in the crate, everything is restricted correctly, but we
        // can't get a module for it
        if (!current_module.has_value ())
@@ -215,7 +216,8 @@ PrivacyReporter::check_base_type_privacy (Analysis::NodeMapping &node_mappings,
     case TyTy::USIZE:
     case TyTy::ISIZE:
     case TyTy::ADT:
-      case TyTy::STR: {
+    case TyTy::STR:
+      {
        auto ref_id = ty->get_ref ();
        if (auto lookup_id = mappings.lookup_hir_to_node (ref_id))
          return check_for_privacy_violation (*lookup_id, locus);
@@ -243,7 +245,8 @@ PrivacyReporter::check_base_type_privacy (Analysis::NodeMapping &node_mappings,
           static_cast<const TyTy::TupleType *> (ty)->get_fields ())
        recursive_check (param.get_tyty ());
       return;
-      case TyTy::PLACEHOLDER: {
+    case TyTy::PLACEHOLDER:
+      {
        const auto p = static_cast<const TyTy::PlaceholderType *> (ty);
        if (!p->can_resolve ())
          return;
@@ -413,7 +416,8 @@ PrivacyReporter::visit (HIR::ArrayExpr &expr)
   HIR::ArrayElems &elements = expr.get_internal_elements ();
   switch (elements.get_array_expr_type ())
     {
-      case HIR::ArrayElems::ArrayExprType::VALUES: {
+    case HIR::ArrayElems::ArrayExprType::VALUES:
+      {
        auto &elems = static_cast<HIR::ArrayElemsValues &> (elements);
        for (auto &value : elems.get_values ())
          value->accept_vis (*this);
index 1e57674b4024ed670e712b5c116e543d25d0048a..223c77b5f71f80da766f8ec135e6c18476591b69 100644 (file)
@@ -158,7 +158,8 @@ ReachabilityVisitor::visit (HIR::Enum &enum_item)
 
       switch (variant->get_enum_item_kind ())
        {
-         case HIR::EnumItem::Tuple: {
+       case HIR::EnumItem::Tuple:
+         {
            // Should we update the fields only if they are public? Similarly to
            // what we do in the ReachabilityVisitor for HIR::TupleStruct?
            auto tuple_variant
@@ -167,7 +168,8 @@ ReachabilityVisitor::visit (HIR::Enum &enum_item)
              ctx.update_reachability (field.get_mappings (), variant_reach);
            break;
          }
-         case HIR::EnumItem::Struct: {
+       case HIR::EnumItem::Struct:
+         {
            // Should we update the fields only if they are public? Similarly to
            // what we do in the ReachabilityVisitor for HIR::StructStruct?
            auto struct_variant
index f0da745607682b7176219dbe2c3c8410d87feb62..c59763d73782bdfa5609376b3c16103a3e423436 100644 (file)
@@ -127,7 +127,8 @@ VisibilityResolver::resolve_visibility (const HIR::Visibility &visibility,
     case HIR::Visibility::PUBLIC:
       to_resolve = ModuleVisibility::create_public ();
       return true;
-      case HIR::Visibility::RESTRICTED: {
+    case HIR::Visibility::RESTRICTED:
+      {
        // FIXME: We also need to handle 2015 vs 2018 edition conflicts
        auto id = UNKNOWN_DEFID;
        auto result = resolve_module_path (visibility.get_path (), id);
index 648bc07762db7c4e034442b4bc76b9131c237b7b..6db769f2f63ae25d0116b66c53c03224afeafaa0 100644 (file)
@@ -728,23 +728,27 @@ Constructor::is_covered_by (const Constructor &o) const
 
   switch (kind)
     {
-      case ConstructorKind::VARIANT: {
+    case ConstructorKind::VARIANT:
+      {
        rust_assert (kind == ConstructorKind::VARIANT);
        return variant_idx == o.variant_idx;
       }
       break;
-      case ConstructorKind::INT_RANGE: {
+    case ConstructorKind::INT_RANGE:
+      {
        rust_assert (kind == ConstructorKind::INT_RANGE);
        return int_range.lo >= o.int_range.lo && int_range.hi <= o.int_range.hi;
       }
       break;
-      case ConstructorKind::WILDCARD: {
+    case ConstructorKind::WILDCARD:
+      {
        // TODO: wildcard is covered by a variant of enum with a single
        // variant
        return false;
       }
       break;
-      case ConstructorKind::STRUCT: {
+    case ConstructorKind::STRUCT:
+      {
        // Struct pattern is always covered by a other struct constructor.
        return true;
       }
@@ -900,19 +904,22 @@ PlaceInfo::specialize (const Constructor &c) const
   switch (c.get_kind ())
     {
     case Constructor::ConstructorKind::WILDCARD:
-      case Constructor::ConstructorKind::INT_RANGE: {
+    case Constructor::ConstructorKind::INT_RANGE:
+      {
        return {};
       }
       break;
     case Constructor::ConstructorKind::STRUCT:
-      case Constructor::ConstructorKind::VARIANT: {
+    case Constructor::ConstructorKind::VARIANT:
+      {
        rust_assert (ty->get_kind () == TyTy::TypeKind::ADT);
        TyTy::ADTType *adt = static_cast<TyTy::ADTType *> (ty);
        switch (adt->get_adt_kind ())
          {
          case TyTy::ADTType::ADTKind::ENUM:
          case TyTy::ADTType::ADTKind::STRUCT_STRUCT:
-           case TyTy::ADTType::ADTKind::TUPLE_STRUCT: {
+         case TyTy::ADTType::ADTKind::TUPLE_STRUCT:
+           {
              TyTy::VariantDef *variant
                = adt->get_variants ().at (c.get_variant_index ());
              if (variant->get_variant_type ()
@@ -926,14 +933,16 @@ PlaceInfo::specialize (const Constructor &c) const
              return new_place_infos;
            }
            break;
-           case TyTy::ADTType::ADTKind::UNION: {
+         case TyTy::ADTType::ADTKind::UNION:
+           {
              // TODO: support unions
              rust_unreachable ();
            }
          }
       }
       break;
-      default: {
+    default:
+      {
        rust_unreachable ();
       }
       break;
@@ -991,7 +1000,8 @@ WitnessPat::to_string () const
 {
   switch (ctor.get_kind ())
     {
-      case Constructor::ConstructorKind::STRUCT: {
+    case Constructor::ConstructorKind::STRUCT:
+      {
        TyTy::ADTType *adt = static_cast<TyTy::ADTType *> (ty);
        TyTy::VariantDef *variant
          = adt->get_variants ().at (ctor.get_variant_index ());
@@ -1016,7 +1026,8 @@ WitnessPat::to_string () const
        return buf;
       }
       break;
-      case Constructor::ConstructorKind::VARIANT: {
+    case Constructor::ConstructorKind::VARIANT:
+      {
        std::string buf;
        TyTy::ADTType *adt = static_cast<TyTy::ADTType *> (ty);
        buf += adt->get_identifier ();
@@ -1026,11 +1037,13 @@ WitnessPat::to_string () const
 
        switch (variant->get_variant_type ())
          {
-           case TyTy::VariantDef::VariantType::NUM: {
+         case TyTy::VariantDef::VariantType::NUM:
+           {
              return buf;
            }
            break;
-           case TyTy::VariantDef::VariantType::TUPLE: {
+         case TyTy::VariantDef::VariantType::TUPLE:
+           {
              buf += "(";
              for (size_t i = 0; i < fields.size (); i++)
                {
@@ -1042,7 +1055,8 @@ WitnessPat::to_string () const
              return buf;
            }
            break;
-           case TyTy::VariantDef::VariantType::STRUCT: {
+         case TyTy::VariantDef::VariantType::STRUCT:
+           {
              buf += " {";
              if (!fields.empty ())
                buf += " ";
@@ -1061,7 +1075,8 @@ WitnessPat::to_string () const
              buf += "}";
            }
            break;
-           default: {
+         default:
+           {
              rust_unreachable ();
            }
            break;
@@ -1069,21 +1084,25 @@ WitnessPat::to_string () const
        return buf;
       }
       break;
-      case Constructor::ConstructorKind::INT_RANGE: {
+    case Constructor::ConstructorKind::INT_RANGE:
+      {
        // TODO: implement
        rust_unreachable ();
       }
       break;
-      case Constructor::ConstructorKind::WILDCARD: {
+    case Constructor::ConstructorKind::WILDCARD:
+      {
        return "_";
       }
       break;
-      case Constructor::ConstructorKind::REFERENCE: {
+    case Constructor::ConstructorKind::REFERENCE:
+      {
        // TODO: implement
        rust_unreachable ();
       }
       break;
-      default: {
+    default:
+      {
        rust_unreachable ();
       }
       break;
@@ -1100,12 +1119,14 @@ WitnessMatrix::apply_constructor (const Constructor &ctor,
   // TODO: only support struct and variant ctor for now.
   switch (ctor.get_kind ())
     {
-      case Constructor::ConstructorKind::WILDCARD: {
+    case Constructor::ConstructorKind::WILDCARD:
+      {
        arity = 0;
       }
       break;
     case Constructor::ConstructorKind::STRUCT:
-      case Constructor::ConstructorKind::VARIANT: {
+    case Constructor::ConstructorKind::VARIANT:
+      {
        if (ty->get_kind () == TyTy::TypeKind::ADT)
          {
            TyTy::ADTType *adt = static_cast<TyTy::ADTType *> (ty);
@@ -1118,7 +1139,8 @@ WitnessMatrix::apply_constructor (const Constructor &ctor,
          }
       }
       break;
-      default: {
+    default:
+      {
        rust_unreachable ();
       }
     }
@@ -1160,9 +1182,9 @@ WitnessMatrix::extend (const WitnessMatrix &other)
 }
 
 // forward declarations
-static DeconstructedPat
-lower_pattern (Resolver::TypeCheckContext *ctx, HIR::Pattern &pattern,
-              TyTy::BaseType *scrutinee_ty);
+static DeconstructedPat lower_pattern (Resolver::TypeCheckContext *ctx,
+                                      HIR::Pattern &pattern,
+                                      TyTy::BaseType *scrutinee_ty);
 
 static DeconstructedPat
 lower_tuple_pattern (Resolver::TypeCheckContext *ctx,
@@ -1175,7 +1197,8 @@ lower_tuple_pattern (Resolver::TypeCheckContext *ctx,
   std::vector<DeconstructedPat> fields;
   switch (elems.get_item_type ())
     {
-      case HIR::TupleStructItems::ItemType::MULTIPLE: {
+    case HIR::TupleStructItems::ItemType::MULTIPLE:
+      {
        HIR::TupleStructItemsNoRange &multiple
          = static_cast<HIR::TupleStructItemsNoRange &> (elems);
 
@@ -1191,12 +1214,14 @@ lower_tuple_pattern (Resolver::TypeCheckContext *ctx,
        return DeconstructedPat (ctor, arity, fields, pattern.get_locus ());
       }
       break;
-      case HIR::TupleStructItems::ItemType::RANGED: {
+    case HIR::TupleStructItems::ItemType::RANGED:
+      {
        // TODO: ranged tuple struct items
        rust_unreachable ();
       }
       break;
-      default: {
+    default:
+      {
        rust_unreachable ();
       }
     }
@@ -1227,7 +1252,8 @@ lower_struct_pattern (Resolver::TypeCheckContext *ctx,
     {
       switch (elem->get_item_type ())
        {
-         case HIR::StructPatternField::ItemType::IDENT: {
+       case HIR::StructPatternField::ItemType::IDENT:
+         {
            HIR::StructPatternFieldIdent *ident
              = static_cast<HIR::StructPatternFieldIdent *> (elem.get ());
            int field_idx
@@ -1236,7 +1262,8 @@ lower_struct_pattern (Resolver::TypeCheckContext *ctx,
              = DeconstructedPat::make_wildcard (pattern.get_locus ());
          }
          break;
-         case HIR::StructPatternField::ItemType::IDENT_PAT: {
+       case HIR::StructPatternField::ItemType::IDENT_PAT:
+         {
            HIR::StructPatternFieldIdentPat *ident_pat
              = static_cast<HIR::StructPatternFieldIdentPat *> (elem.get ());
            int field_idx
@@ -1246,12 +1273,14 @@ lower_struct_pattern (Resolver::TypeCheckContext *ctx,
              variant->get_fields ().at (field_idx)->get_field_type ());
          }
          break;
-         case HIR::StructPatternField::ItemType::TUPLE_PAT: {
+       case HIR::StructPatternField::ItemType::TUPLE_PAT:
+         {
            // TODO: tuple: pat
            rust_unreachable ();
          }
          break;
-         default: {
+       default:
+         {
            rust_unreachable ();
          }
        }
@@ -1268,11 +1297,13 @@ lower_pattern (Resolver::TypeCheckContext *ctx, HIR::Pattern &pattern,
   switch (pat_type)
     {
     case HIR::Pattern::PatternType::WILDCARD:
-      case HIR::Pattern::PatternType::IDENTIFIER: {
+    case HIR::Pattern::PatternType::IDENTIFIER:
+      {
        return DeconstructedPat::make_wildcard (pattern.get_locus ());
       }
       break;
-      case HIR::Pattern::PatternType::PATH: {
+    case HIR::Pattern::PatternType::PATH:
+      {
        // TODO: support constants, associated constants, enum variants and
        // structs
        // https://doc.rust-lang.org/reference/patterns.html#path-patterns
@@ -1280,13 +1311,15 @@ lower_pattern (Resolver::TypeCheckContext *ctx, HIR::Pattern &pattern,
        return DeconstructedPat::make_wildcard (pattern.get_locus ());
       }
       break;
-      case HIR::Pattern::PatternType::REFERENCE: {
+    case HIR::Pattern::PatternType::REFERENCE:
+      {
        // TODO: unimplemented. Treat this pattern as wildcard for now.
        return DeconstructedPat::make_wildcard (pattern.get_locus ());
       }
       break;
     case HIR::Pattern::PatternType::STRUCT:
-      case HIR::Pattern::PatternType::TUPLE_STRUCT: {
+    case HIR::Pattern::PatternType::TUPLE_STRUCT:
+      {
        HirId path_id = UNKNOWN_HIRID;
        if (pat_type == HIR::Pattern::PatternType::STRUCT)
          {
@@ -1343,37 +1376,44 @@ lower_pattern (Resolver::TypeCheckContext *ctx, HIR::Pattern &pattern,
          }
       }
       break;
-      case HIR::Pattern::PatternType::TUPLE: {
+    case HIR::Pattern::PatternType::TUPLE:
+      {
        // TODO: unimplemented. Treat this pattern as wildcard for now.
        return DeconstructedPat::make_wildcard (pattern.get_locus ());
       }
       break;
-      case HIR::Pattern::PatternType::SLICE: {
+    case HIR::Pattern::PatternType::SLICE:
+      {
        // TODO: unimplemented. Treat this pattern as wildcard for now.
        return DeconstructedPat::make_wildcard (pattern.get_locus ());
       }
       break;
-      case HIR::Pattern::PatternType::ALT: {
+    case HIR::Pattern::PatternType::ALT:
+      {
        // TODO: unimplemented. Treat this pattern as wildcard for now.
        return DeconstructedPat::make_wildcard (pattern.get_locus ());
       }
       break;
-      case HIR::Pattern::PatternType::LITERAL: {
+    case HIR::Pattern::PatternType::LITERAL:
+      {
        // TODO: unimplemented. Treat this pattern as wildcard for now.
        return DeconstructedPat::make_wildcard (pattern.get_locus ());
       }
       break;
-      case HIR::Pattern::PatternType::RANGE: {
+    case HIR::Pattern::PatternType::RANGE:
+      {
        // TODO: unimplemented. Treat this pattern as wildcard for now.
        return DeconstructedPat::make_wildcard (pattern.get_locus ());
       }
       break;
-      case HIR::Pattern::PatternType::GROUPED: {
+    case HIR::Pattern::PatternType::GROUPED:
+      {
        // TODO: unimplemented. Treat this pattern as wildcard for now.
        return DeconstructedPat::make_wildcard (pattern.get_locus ());
       }
       break;
-      default: {
+    default:
+      {
        rust_unreachable ();
       }
     }
index 6d60ceda538456fcd958a5d900ce9ea8f5842ed4..62107e1d27f552fd9666e23d2e161960fe07cafd 100644 (file)
@@ -33,9 +33,9 @@ namespace Analysis {
 
 using namespace HIR;
 
-void
-check_match_usefulness (Resolver::TypeCheckContext *ctx,
-                       TyTy::BaseType *scrutinee_ty, HIR::MatchExpr &expr);
+void check_match_usefulness (Resolver::TypeCheckContext *ctx,
+                            TyTy::BaseType *scrutinee_ty,
+                            HIR::MatchExpr &expr);
 
 class PatternChecker : public HIR::HIRFullVisitor
 {
index a8c3ca5bfc98df03b1bf6c870664e6bb8fe4c8f7..f761f9916c9a268619b4d756c7355f244b903f73 100644 (file)
@@ -289,7 +289,8 @@ CfgStrip::maybe_strip_generic_args (AST::GenericArgs &args)
     {
       switch (arg.get_kind ())
        {
-         case AST::GenericArg::Kind::Type: {
+       case AST::GenericArg::Kind::Type:
+         {
            auto &type = arg.get_type ();
            type.accept_vis (*this);
 
@@ -298,7 +299,8 @@ CfgStrip::maybe_strip_generic_args (AST::GenericArgs &args)
                             "cannot strip type in this position");
            break;
          }
-         case AST::GenericArg::Kind::Const: {
+       case AST::GenericArg::Kind::Const:
+         {
            auto &expr = arg.get_expression ();
            expr.accept_vis (*this);
 
index 04c987dc96e375f64c4bd89232cae63453ba71cb..97651270bc55782b479438b1f26aea2a54c8fa55 100644 (file)
@@ -181,7 +181,8 @@ DeriveEq::visit_enum (Enum &item)
        case EnumItem::Kind::Discriminant:
          // nothing to do as they contain no inner types
          continue;
-         case EnumItem::Kind::Tuple: {
+       case EnumItem::Kind::Tuple:
+         {
            auto &tuple = static_cast<EnumItemTuple &> (*variant);
 
            for (auto &field : tuple.get_tuple_fields ())
@@ -191,7 +192,8 @@ DeriveEq::visit_enum (Enum &item)
              }
            break;
          }
-         case EnumItem::Kind::Struct: {
+       case EnumItem::Kind::Struct:
+         {
            auto &tuple = static_cast<EnumItemStruct &> (*variant);
 
            for (auto &field : tuple.get_struct_fields ())
index 015b81e90df203ab31726cf67c99f9cd4957ec12..0e8a67c17a34b33cf1cb72d0bffbcc2289cb2058 100644 (file)
@@ -79,7 +79,8 @@ DeriveVisitor::setup_impl_generics (
     {
       switch (generic->get_kind ())
        {
-         case GenericParam::Kind::Lifetime: {
+       case GenericParam::Kind::Lifetime:
+         {
            LifetimeParam &lifetime_param = (LifetimeParam &) *generic.get ();
 
            Lifetime l = builder.new_lifetime (lifetime_param.get_lifetime ());
@@ -91,7 +92,8 @@ DeriveVisitor::setup_impl_generics (
          }
          break;
 
-         case GenericParam::Kind::Type: {
+       case GenericParam::Kind::Type:
+         {
            TypeParam &type_param = (TypeParam &) *generic.get ();
 
            std::unique_ptr<Type> associated_type = builder.single_type_path (
@@ -113,7 +115,8 @@ DeriveVisitor::setup_impl_generics (
          }
          break;
 
-         case GenericParam::Kind::Const: {
+       case GenericParam::Kind::Const:
+         {
            rust_unreachable ();
 
            // TODO
index af6182f627f82d8ed7b00e3547035d266571d15d..bda28dd61ce821067e0736387cdbfdcb3e17f65e 100644 (file)
@@ -85,11 +85,13 @@ expand_format_args (AST::FormatArgs &fmt,
          static_pieces.emplace_back (
            builder.literal_string (node.string._0.to_string ()));
          break;
-         case ffi::Piece::Tag::NextArgument: {
+       case ffi::Piece::Tag::NextArgument:
+         {
            auto next_argument = node.next_argument._0;
            switch (node.next_argument._0.position.tag)
              {
-               case ffi::Position::Tag::ArgumentImplicitlyIs: {
+             case ffi::Position::Tag::ArgumentImplicitlyIs:
+               {
                  auto idx = next_argument.position.argument_implicitly_is._0;
                  auto trait = next_argument.format;
                  auto arg = arguments.at (idx);
index ad237c07c2f4e542f8a938e1b359d61e553d459d..b82040c0878a92b43089e9604bb8ae4fed4f4032 100644 (file)
@@ -28,14 +28,12 @@ namespace Rust {
 /**
  * Whether or not an attribute is a derive attribute
  */
-bool
-is_derive (AST::Attribute &attr);
+bool is_derive (AST::Attribute &attr);
 
 /**
  * Whether or not an attribute is builtin
  */
-bool
-is_builtin (AST::Attribute &attr);
+bool is_builtin (AST::Attribute &attr);
 
 class ExpandVisitor : public AST::DefaultASTVisitor
 {
index ca3c22e7f8b0273489188db35d7f721df9037042..850c8ddb753bfff732ee020e8e9aa2b60c03ff63 100644 (file)
@@ -796,7 +796,8 @@ expand_inline_asm_strings (InlineAsmContext inline_asm_ctx)
              auto next_argument = piece.next_argument._0;
              switch (piece.next_argument._0.position.tag)
                {
-                 case Fmt::ffi::Position::Tag::ArgumentImplicitlyIs: {
+               case Fmt::ffi::Position::Tag::ArgumentImplicitlyIs:
+                 {
                    auto idx = next_argument.position.argument_implicitly_is._0;
                    /*auto trait = next_argument.format;*/
                    /*auto arg = arguments.at (idx);*/
index 2bdaed5e08fbb520b657990d5da102b72fc3e0ee..3196a5ae184ca3a4222949606e8db4e6e9d1e8b3 100644 (file)
@@ -142,16 +142,16 @@ tl::expected<InlineAsmContext, InlineAsmParseError>
 parse_reg_operand_unexpected (InlineAsmContext inline_asm_ctx);
 
 WARN_UNUSED_RESULT
-tl::optional<AST::Fragment>
-parse_asm (location_t invoc_locus, AST::MacroInvocData &invoc,
-          AST::InvocKind semicolon, AST::AsmKind is_global_asm);
+tl::optional<AST::Fragment> parse_asm (location_t invoc_locus,
+                                      AST::MacroInvocData &invoc,
+                                      AST::InvocKind semicolon,
+                                      AST::AsmKind is_global_asm);
 
 WARN_UNUSED_RESULT
-bool
-check_identifier (Parser<MacroInvocLexer> &parser, std::string ident);
+bool check_identifier (Parser<MacroInvocLexer> &parser, std::string ident);
 
-void
-check_and_set (InlineAsmContext &inline_asm_ctx, AST::InlineAsm::Option option);
+void check_and_set (InlineAsmContext &inline_asm_ctx,
+                   AST::InlineAsm::Option option);
 
 // From rustc
 WARN_UNUSED_RESULT
@@ -168,9 +168,9 @@ tl::optional<std::string>
 parse_format_string (InlineAsmContext &inline_asm_ctx);
 
 WARN_UNUSED_RESULT
-tl::optional<std::string>
-parse_label (Parser<MacroInvocLexer> &parser, TokenId last_token_id,
-            InlineAsmContext &inline_asm_ctx);
+tl::optional<std::string> parse_label (Parser<MacroInvocLexer> &parser,
+                                      TokenId last_token_id,
+                                      InlineAsmContext &inline_asm_ctx);
 
 // LLVM ASM bits
 
@@ -188,17 +188,13 @@ public:
   {}
 };
 
-void
-parse_llvm_outputs (LlvmAsmContext &ctx);
+void parse_llvm_outputs (LlvmAsmContext &ctx);
 
-void
-parse_llvm_inputs (LlvmAsmContext &ctx);
+void parse_llvm_inputs (LlvmAsmContext &ctx);
 
-void
-parse_llvm_clobbers (LlvmAsmContext &ctx);
+void parse_llvm_clobbers (LlvmAsmContext &ctx);
 
-void
-parse_llvm_options (LlvmAsmContext &ctx);
+void parse_llvm_options (LlvmAsmContext &ctx);
 
 WARN_UNUSED_RESULT tl::optional<AST::Fragment>
 parse_llvm_asm (location_t invoc_locus, AST::MacroInvocData &invoc,
index 429537e210a82a3efe964f3af838272e252b51e1..32cf58fd1bed2bd492ad12ee9959642b26285ae2 100644 (file)
 #include "rust-token.h"
 namespace Rust {
 
-std::string
-make_macro_path_str (BuiltinMacro kind);
+std::string make_macro_path_str (BuiltinMacro kind);
 
-std::vector<std::unique_ptr<AST::MacroInvocation>>
-check_for_eager_invocations (
+std::vector<std::unique_ptr<AST::MacroInvocation>> check_for_eager_invocations (
   std::vector<std::unique_ptr<AST::Expr>> &expressions);
 
 // Shorthand function for creating unique_ptr tokens
 
-std::unique_ptr<AST::Token>
-make_token (const TokenPtr tok);
+std::unique_ptr<AST::Token> make_token (const TokenPtr tok);
 
-std::unique_ptr<AST::Expr>
-make_string (location_t locus, std::string value);
+std::unique_ptr<AST::Expr> make_string (location_t locus, std::string value);
 // TODO: Is this correct?
-AST::Fragment
-make_eager_builtin_invocation (
+AST::Fragment make_eager_builtin_invocation (
   BuiltinMacro kind, location_t locus, AST::DelimTokenTree arguments,
   std::vector<std::unique_ptr<AST::MacroInvocation>> &&pending_invocations);
 // Match the end token of a macro given the start delimiter of the macro
-TokenId
-macro_end_token (AST::DelimTokenTree &invoc_token_tree,
-                Parser<MacroInvocLexer> &parser);
+TokenId macro_end_token (AST::DelimTokenTree &invoc_token_tree,
+                        Parser<MacroInvocLexer> &parser);
 // Expand and then extract a string literal from the macro
 std::unique_ptr<AST::LiteralExpr>
 try_extract_string_literal_from_fragment (const location_t &parent_locus,
@@ -70,21 +64,18 @@ try_expand_many_expr (Parser<MacroInvocLexer> &parser,
 //   and return the LiteralExpr for it. Allow for an optional trailing comma,
 //   but otherwise enforce that these are the only tokens.
 
-std::unique_ptr<AST::Expr>
-parse_single_string_literal (BuiltinMacro kind,
-                            AST::DelimTokenTree &invoc_token_tree,
-                            location_t invoc_locus, MacroExpander *expander,
-                            bool is_semicoloned = false);
+std::unique_ptr<AST::Expr> parse_single_string_literal (
+  BuiltinMacro kind, AST::DelimTokenTree &invoc_token_tree,
+  location_t invoc_locus, MacroExpander *expander, bool is_semicoloned = false);
 
 // Treat PATH as a path relative to the source file currently being
 // compiled, and return the absolute path for it.
 
-std::string
-source_relative_path (std::string path, location_t locus);
+std::string source_relative_path (std::string path, location_t locus);
 
 // Read the full contents of the file FILENAME and return them in a vector.
 // FIXME: platform specific.
-tl::optional<std::vector<uint8_t>>
-load_file_bytes (location_t invoc_locus, const char *filename);
+tl::optional<std::vector<uint8_t>> load_file_bytes (location_t invoc_locus,
+                                                   const char *filename);
 } // namespace Rust
 #endif // GCCRS_RUST_MACRO_BUILTINS_HELPERS_H
index 673b8fb20fa355bf0345fa966fff2a1a540c27f2..475ad56a3640c0d4ce2dde08cb0ee6485b13fefc 100644 (file)
@@ -430,7 +430,8 @@ MacroExpander::match_fragment (Parser<MacroInvocLexer> &parser,
       parser.parse_visibility ();
       break;
 
-      case AST::MacroFragSpec::STMT: {
+    case AST::MacroFragSpec::STMT:
+      {
        auto restrictions = ParseRestrictions ();
        restrictions.consume_semi = false;
        parser.parse_stmt (restrictions);
@@ -480,19 +481,22 @@ MacroExpander::match_matcher (Parser<MacroInvocLexer> &parser,
   // this is used so we can check that we delimit the stream correctly.
   switch (delimiter->get_id ())
     {
-      case LEFT_PAREN: {
+    case LEFT_PAREN:
+      {
        if (!check_delim (AST::DelimType::PARENS))
          return false;
       }
       break;
 
-      case LEFT_SQUARE: {
+    case LEFT_SQUARE:
+      {
        if (!check_delim (AST::DelimType::SQUARE))
          return false;
       }
       break;
 
-      case LEFT_CURLY: {
+    case LEFT_CURLY:
+      {
        if (!check_delim (AST::DelimType::CURLY))
          return false;
       }
@@ -510,7 +514,8 @@ MacroExpander::match_matcher (Parser<MacroInvocLexer> &parser,
 
       switch (match->get_macro_match_type ())
        {
-         case AST::MacroMatch::MacroMatchType::Fragment: {
+       case AST::MacroMatch::MacroMatchType::Fragment:
+         {
            AST::MacroMatchFragment *fragment
              = static_cast<AST::MacroMatchFragment *> (match.get ());
            if (!match_fragment (parser, *fragment))
@@ -524,14 +529,16 @@ MacroExpander::match_matcher (Parser<MacroInvocLexer> &parser,
          }
          break;
 
-         case AST::MacroMatch::MacroMatchType::Tok: {
+       case AST::MacroMatch::MacroMatchType::Tok:
+         {
            AST::Token *tok = static_cast<AST::Token *> (match.get ());
            if (!match_token (parser, *tok))
              return false;
          }
          break;
 
-         case AST::MacroMatch::MacroMatchType::Repetition: {
+       case AST::MacroMatch::MacroMatchType::Repetition:
+         {
            AST::MacroMatchRepetition *rep
              = static_cast<AST::MacroMatchRepetition *> (match.get ());
            if (!match_repetition (parser, *rep))
@@ -539,7 +546,8 @@ MacroExpander::match_matcher (Parser<MacroInvocLexer> &parser,
          }
          break;
 
-         case AST::MacroMatch::MacroMatchType::Matcher: {
+       case AST::MacroMatch::MacroMatchType::Matcher:
+         {
            AST::MacroMatcher *m
              = static_cast<AST::MacroMatcher *> (match.get ());
            expansion_depth++;
@@ -556,19 +564,22 @@ MacroExpander::match_matcher (Parser<MacroInvocLexer> &parser,
 
   switch (delimiter->get_id ())
     {
-      case LEFT_PAREN: {
+    case LEFT_PAREN:
+      {
        if (!parser.skip_token (RIGHT_PAREN))
          return false;
       }
       break;
 
-      case LEFT_SQUARE: {
+    case LEFT_SQUARE:
+      {
        if (!parser.skip_token (RIGHT_SQUARE))
          return false;
       }
       break;
 
-      case LEFT_CURLY: {
+    case LEFT_CURLY:
+      {
        if (!parser.skip_token (RIGHT_CURLY))
          return false;
       }
@@ -617,7 +628,8 @@ MacroExpander::match_n_matches (Parser<MacroInvocLexer> &parser,
          size_t offs_begin = source.get_offs ();
          switch (match->get_macro_match_type ())
            {
-             case AST::MacroMatch::MacroMatchType::Fragment: {
+           case AST::MacroMatch::MacroMatchType::Fragment:
+             {
                AST::MacroMatchFragment *fragment
                  = static_cast<AST::MacroMatchFragment *> (match.get ());
                valid_current_match = match_fragment (parser, *fragment);
@@ -632,20 +644,23 @@ MacroExpander::match_n_matches (Parser<MacroInvocLexer> &parser,
              }
              break;
 
-             case AST::MacroMatch::MacroMatchType::Tok: {
+           case AST::MacroMatch::MacroMatchType::Tok:
+             {
                AST::Token *tok = static_cast<AST::Token *> (match.get ());
                valid_current_match = match_token (parser, *tok);
              }
              break;
 
-             case AST::MacroMatch::MacroMatchType::Repetition: {
+           case AST::MacroMatch::MacroMatchType::Repetition:
+             {
                AST::MacroMatchRepetition *rep
                  = static_cast<AST::MacroMatchRepetition *> (match.get ());
                valid_current_match = match_repetition (parser, *rep);
              }
              break;
 
-             case AST::MacroMatch::MacroMatchType::Matcher: {
+           case AST::MacroMatch::MacroMatchType::Matcher:
+             {
                AST::MacroMatcher *m
                  = static_cast<AST::MacroMatcher *> (match.get ());
                valid_current_match = match_matcher (parser, *m, true);
index 02e4e3b1c5aedff139ec9b0239046a9a73d03994..ac36ed8b0451b7844b535850673fa58af3600c16 100644 (file)
@@ -273,7 +273,8 @@ SubstituteCtx::substitute_token (size_t token_idx)
       // don't substitute, dollar sign is alone/metavar is unknown
       return {std::vector<std::unique_ptr<AST::Token>> (), 0};
 
-      case LEFT_PAREN: {
+    case LEFT_PAREN:
+      {
        // We need to parse up until the closing delimiter and expand this
        // fragment->n times.
        rust_debug ("expanding repetition");
index 6ffaaf6c099f7447484bbb5a6acc0f6d2b2870ab..058c93aa434b51ded7a9c511abcac9363bd435f1 100644 (file)
@@ -82,11 +82,9 @@ public:
  *
  * @param The path to the shared object file to load.
  */
-const std::vector<ProcMacro::Procmacro>
-load_macros (std::string path);
+const std::vector<ProcMacro::Procmacro> load_macros (std::string path);
 
-std::string
-generate_proc_macro_decls_symbol (std::uint32_t stable_crate_id);
+std::string generate_proc_macro_decls_symbol (std::uint32_t stable_crate_id);
 
 } // namespace Rust
 
index 2d9a4450c901e2e05cf2c2250afa4855667f8b74..b7d3224f2c22bdfabe4ce544df5d9d219a5d0529 100644 (file)
@@ -648,12 +648,14 @@ ASTLoweringBase::lower_generic_args (AST::GenericArgs &args)
     {
       switch (arg.get_kind ())
        {
-         case AST::GenericArg::Kind::Type: {
+       case AST::GenericArg::Kind::Type:
+         {
            auto type = ASTLoweringType::translate (arg.get_type ());
            type_args.emplace_back (std::unique_ptr<HIR::Type> (type));
            break;
          }
-         case AST::GenericArg::Kind::Const: {
+       case AST::GenericArg::Kind::Const:
+         {
            auto expr = ASTLoweringExpr::translate (arg.get_expression ());
            const_args.emplace_back (
              HIR::ConstGenericArg (std::unique_ptr<HIR::Expr> (expr),
@@ -887,7 +889,8 @@ ASTLoweringBase::lower_range_pattern_bound (AST::RangePatternBound &bound)
   std::unique_ptr<HIR::RangePatternBound> hir_bound = nullptr;
   switch (bound.get_bound_type ())
     {
-      case AST::RangePatternBound::RangePatternBoundType::LITERAL: {
+    case AST::RangePatternBound::RangePatternBoundType::LITERAL:
+      {
        AST::RangePatternBoundLiteral &ref
          = static_cast<AST::RangePatternBoundLiteral &> (bound);
 
@@ -898,7 +901,8 @@ ASTLoweringBase::lower_range_pattern_bound (AST::RangePatternBound &bound)
                                             ref.get_has_minus ()));
       }
       break;
-      case AST::RangePatternBound::RangePatternBoundType::PATH: {
+    case AST::RangePatternBound::RangePatternBoundType::PATH:
+      {
        auto &ref = static_cast<AST::RangePatternBoundPath &> (bound);
 
        HIR::PathInExpression *path
@@ -908,7 +912,8 @@ ASTLoweringBase::lower_range_pattern_bound (AST::RangePatternBound &bound)
          new HIR::RangePatternBoundPath (*path));
       }
       break;
-      case AST::RangePatternBound::RangePatternBoundType::QUALPATH: {
+    case AST::RangePatternBound::RangePatternBoundType::QUALPATH:
+      {
        auto &ref = static_cast<AST::RangePatternBoundQualPath &> (bound);
 
        HIR::QualifiedPathInExpression *qualpath
index 66ccafa4f52286a761cfd53a32681adcd89d8a52..acec008c8923e352bd5aa9e711283abef1defb94 100644 (file)
@@ -495,7 +495,8 @@ ASTLoweringItem::visit (AST::InherentImpl &impl_block)
        {
          switch (generic_param->get_kind ())
            {
-             case HIR::GenericParam::GenericKind::TYPE: {
+           case HIR::GenericParam::GenericKind::TYPE:
+             {
                const HIR::TypeParam &t
                  = static_cast<const HIR::TypeParam &> (*generic_param);
 
@@ -652,7 +653,8 @@ ASTLoweringItem::visit (AST::TraitImpl &impl_block)
        {
          switch (generic_param->get_kind ())
            {
-             case HIR::GenericParam::GenericKind::TYPE: {
+           case HIR::GenericParam::GenericKind::TYPE:
+             {
                const HIR::TypeParam &t
                  = static_cast<const HIR::TypeParam &> (*generic_param);
 
index b7a4c564782b1f32285d2f105bde4fe490461c11..9be36c8f2a09702c80a402b46caaa9167c22e9e5 100644 (file)
@@ -74,13 +74,15 @@ ASTLoweringPattern::visit (AST::TupleStructPattern &pattern)
   auto &items = pattern.get_items ();
   switch (items.get_item_type ())
     {
-      case AST::TupleStructItems::RANGE: {
+    case AST::TupleStructItems::RANGE:
+      {
        // TODO
        rust_unreachable ();
       }
       break;
 
-      case AST::TupleStructItems::NO_RANGE: {
+    case AST::TupleStructItems::NO_RANGE:
+      {
        AST::TupleStructItemsNoRange &items_no_range
          = static_cast<AST::TupleStructItemsNoRange &> (items);
 
@@ -120,7 +122,8 @@ ASTLoweringPattern::visit (AST::StructPattern &pattern)
       HIR::StructPatternField *f = nullptr;
       switch (field->get_item_type ())
        {
-         case AST::StructPatternField::ItemType::TUPLE_PAT: {
+       case AST::StructPatternField::ItemType::TUPLE_PAT:
+         {
            auto &tuple
              = static_cast<AST::StructPatternFieldTuplePat &> (*field);
 
@@ -140,7 +143,8 @@ ASTLoweringPattern::visit (AST::StructPattern &pattern)
          }
          break;
 
-         case AST::StructPatternField::ItemType::IDENT_PAT: {
+       case AST::StructPatternField::ItemType::IDENT_PAT:
+         {
            AST::StructPatternFieldIdentPat &ident
              = static_cast<AST::StructPatternFieldIdentPat &> (*field);
 
@@ -160,7 +164,8 @@ ASTLoweringPattern::visit (AST::StructPattern &pattern)
          }
          break;
 
-         case AST::StructPatternField::ItemType::IDENT: {
+       case AST::StructPatternField::ItemType::IDENT:
+         {
            AST::StructPatternFieldIdent &ident
              = static_cast<AST::StructPatternFieldIdent &> (*field.get ());
 
@@ -213,7 +218,8 @@ ASTLoweringPattern::visit (AST::TuplePattern &pattern)
   std::unique_ptr<HIR::TuplePatternItems> items;
   switch (pattern.get_items ().get_pattern_type ())
     {
-      case AST::TuplePatternItems::TuplePatternItemType::MULTIPLE: {
+    case AST::TuplePatternItems::TuplePatternItemType::MULTIPLE:
+      {
        AST::TuplePatternItemsMultiple &ref
          = static_cast<AST::TuplePatternItemsMultiple &> (
            pattern.get_items ());
@@ -221,7 +227,8 @@ ASTLoweringPattern::visit (AST::TuplePattern &pattern)
       }
       break;
 
-      case AST::TuplePatternItems::TuplePatternItemType::RANGED: {
+    case AST::TuplePatternItems::TuplePatternItemType::RANGED:
+      {
        AST::TuplePatternItemsRanged &ref
          = static_cast<AST::TuplePatternItemsRanged &> (pattern.get_items ());
        items = lower_tuple_pattern_ranged (ref);
index cc7408277a317e321052730a4bd8d93f9b237bec..0787ddfd0a327ec0d2405a0bb189ccb87bd03b44 100644 (file)
@@ -28,16 +28,14 @@ namespace HIR {
 
 /* Checks whether the name of a field already exists.  Returns true
    and produces an error if so.  */
-bool
-struct_field_name_exists (std::vector<HIR::StructField> &fields,
-                         HIR::StructField &new_field);
+bool struct_field_name_exists (std::vector<HIR::StructField> &fields,
+                              HIR::StructField &new_field);
 
 /**
  * Lowers a Visibility from the AST into an HIR Visibility, desugaring it in
  * the process
  */
-Visibility
-translate_visibility (const AST::Visibility &vis);
+Visibility translate_visibility (const AST::Visibility &vis);
 
 /**
  * Main base class used for lowering AST to HIR.
index cb32f68ab965d457383fbd4c665f27ececd0a85b..96cd65640572dda2acf3d7ca5977e7382ed031a0 100644 (file)
@@ -1602,7 +1602,8 @@ Dump::visit (UseTreeGlob &e)
     case UseTreeGlob::PathType::GLOBAL:
       glob = "::*";
       break;
-      case UseTreeGlob::PathType::PATH_PREFIXED: {
+    case UseTreeGlob::PathType::PATH_PREFIXED:
+      {
        path = e.get_path ().as_string ();
        glob = "::*";
        break;
@@ -1630,7 +1631,8 @@ Dump::visit (UseTreeList &e)
     case UseTreeList::PathType::GLOBAL:
       path_type = "::*";
       break;
-      case UseTreeList::PathType::PATH_PREFIXED: {
+    case UseTreeList::PathType::PATH_PREFIXED:
+      {
        path = e.get_path ().as_string ();
        path_type = "::*";
        break;
index 45b17080e696e1c9315c5cc927e6e2ec2d28fbc1..a1b89ca5874176bbc3fa2f254f94121b53598e6e 100644 (file)
@@ -252,7 +252,6 @@ private:
 } // namespace Rust
 
 // In the global namespace to make it easier to call from debugger
-void
-debug (Rust::HIR::FullVisitable &v);
+void debug (Rust::HIR::FullVisitable &v);
 
 #endif // !RUST_HIR_DUMP_H
index 093d8d50146eca78d01c41a7b9b716ab65f341b2..9c8293bd60366007835403d851725481a8aa5bd7 100644 (file)
@@ -577,7 +577,8 @@ UseTreeGlob::as_string () const
       return "*";
     case GLOBAL:
       return "::*";
-      case PATH_PREFIXED: {
+    case PATH_PREFIXED:
+      {
        std::string path_str = path.as_string ();
        return path_str + "::*";
       }
@@ -600,7 +601,8 @@ UseTreeList::as_string () const
     case GLOBAL:
       path_str = "::{";
       break;
-      case PATH_PREFIXED: {
+    case PATH_PREFIXED:
+      {
        path_str = path.as_string () + "::{";
        break;
       }
index b143e70c9464515f9d803cca9e3e42f652698606..8a5668f385894e396c69f4ddb0d5c3f5612dfbf0 100644 (file)
@@ -1317,7 +1317,8 @@ Lexer::parse_escape (char opening_char)
 
   switch (current_char.value)
     {
-      case 'x': {
+    case 'x':
+      {
        auto hex_escape_pair = parse_partial_hex_escape ();
        long hexLong = hex_escape_pair.first;
        additional_length_offset += hex_escape_pair.second;
@@ -1400,7 +1401,8 @@ Lexer::parse_utf8_escape ()
 
   switch (current_char.value)
     {
-      case 'x': {
+    case 'x':
+      {
        auto hex_escape_pair = parse_partial_hex_escape ();
        long hexLong = hex_escape_pair.first;
        additional_length_offset += hex_escape_pair.second;
@@ -1438,7 +1440,8 @@ Lexer::parse_utf8_escape ()
     case '"':
       output_char = '"';
       break;
-      case 'u': {
+    case 'u':
+      {
        auto unicode_escape_pair = parse_partial_unicode_escape ();
        output_char = unicode_escape_pair.first;
        additional_length_offset += unicode_escape_pair.second;
index 10293e0a81228b08e6e64ecc4e73dced47890493..383ffac225586a8ff5131e186f35849f8cd8ea84 100644 (file)
@@ -263,8 +263,7 @@ private:
 #if CHECKING_P
 
 namespace selftest {
-void
-rust_input_source_test ();
+void rust_input_source_test ();
 
 } // namespace selftest
 
index 8493889db9f15c02cfd43e4341c467af395d654f..783638b4171758f14cbe7e270228e878c003c9a1 100644 (file)
@@ -88,7 +88,8 @@ token_id_keyword_string (TokenId id)
   switch (id)
     {
 #define RS_TOKEN_KEYWORD_2015(id, str_ptr)                                     \
-    case id: {                                                                 \
+  case id:                                                                     \
+    {                                                                          \
       static const std::string str (str_ptr);                                  \
       return str;                                                              \
     }                                                                          \
index c683ecd446eee169d1502cd1f6ae70c2a5e9d09b..2abdf27f6c3bea05d7332d232559ab5fff17cd64 100644 (file)
@@ -221,25 +221,20 @@ typedef std::shared_ptr<Token> TokenPtr;
 typedef std::shared_ptr<const Token> const_TokenPtr;
 
 // Hackily defined way to get token description for enum value using x-macros
-const char *
-get_token_description (TokenId id);
+const char *get_token_description (TokenId id);
 /* Hackily defined way to get token description as a string for enum value using
  * x-macros */
-const char *
-token_id_to_str (TokenId id);
+const char *token_id_to_str (TokenId id);
 /* checks if a token is a keyword */
-bool
-token_id_is_keyword (TokenId id);
+bool token_id_is_keyword (TokenId id);
 /* gets the string associated with a keyword */
-const std::string &
-token_id_keyword_string (TokenId id);
+const std::string &token_id_keyword_string (TokenId id);
 // Get type hint description as a string.
-const char *
-get_type_hint_string (PrimitiveCoreType type);
+const char *get_type_hint_string (PrimitiveCoreType type);
 
 /* Normalize string if a token is a identifier */
-std::string
-nfc_normalize_token_string (location_t loc, TokenId id, const std::string &str);
+std::string nfc_normalize_token_string (location_t loc, TokenId id,
+                                       const std::string &str);
 
 // Represents a single token. Create using factory static methods.
 class Token
index 771bec6e63785f09bee5922d339066c3b9c3bb0f..1829a85d2e477f441386e1baee646a541bab6924 100644 (file)
@@ -263,8 +263,7 @@ PublicInterface::write_to_path (const std::string &path) const
   FILE *nfd = fopen (path.c_str (), "wb");
   if (nfd == NULL)
     {
-      rust_error_at (UNDEF_LOCATION,
-                    "failed to open file %qs for writing: %s",
+      rust_error_at (UNDEF_LOCATION, "failed to open file %qs for writing: %s",
                     path.c_str (), xstrerror (errno));
       return;
     }
index cf24607f099c6815f4b54e1953a25b3b0fc1fb05..f64de4e061cec6898cf40438046f4521d037c024 100644 (file)
@@ -683,7 +683,7 @@ public:
 
   const Header &operator* () const { return this->header_; }
 
-  const Header *operator-> () const { return &this->header_; }
+  const Header *operator->() const { return &this->header_; }
 
   Archive_iterator &operator++ ()
   {
index a497c67451743effabed0b075d0510c60f7492ac..65a2af11c0da08de1274e876149e9ae1b0aca932 100644 (file)
@@ -11,8 +11,7 @@
 
 namespace Rust {
 
-extern void
-add_search_path (const std::string &path);
+extern void add_search_path (const std::string &path);
 
 class Import
 {
index 0d64016f86dca820ed3145cf35a8637b0a2a8446..61db240a3672ea75338d4f21111eb175c216b078 100644 (file)
@@ -36,15 +36,14 @@ namespace Rust {
  *
  * @return false if the given input was invalid, true otherwise
  */
-bool
-parse_cfg_option (std::string &input, std::string &key, std::string &value);
+bool parse_cfg_option (std::string &input, std::string &key,
+                      std::string &value);
 } // namespace Rust
 
 #if CHECKING_P
 
 namespace selftest {
-extern void
-rust_cfg_parser_test (void);
+extern void rust_cfg_parser_test (void);
 } // namespace selftest
 
 #endif // CHECKING_P
index 3a2fcd214744f9f888b8dfdfb0f8ba359f74f28a..b661040a7159b05a95869c4c492859495ab2c214 100644 (file)
@@ -227,19 +227,22 @@ Parser<ManagedTokenSource>::skip_generics_right_angle ()
       // this is good - skip token
       lexer.skip_token ();
       return true;
-      case RIGHT_SHIFT: {
+    case RIGHT_SHIFT:
+      {
        // new implementation that should be better
        lexer.split_current_token (RIGHT_ANGLE, RIGHT_ANGLE);
        lexer.skip_token ();
        return true;
       }
-      case GREATER_OR_EQUAL: {
+    case GREATER_OR_EQUAL:
+      {
        // new implementation that should be better
        lexer.split_current_token (RIGHT_ANGLE, EQUAL);
        lexer.skip_token ();
        return true;
       }
-      case RIGHT_SHIFT_EQ: {
+    case RIGHT_SHIFT_EQ:
+      {
        // new implementation that should be better
        lexer.split_current_token (RIGHT_ANGLE, GREATER_OR_EQUAL);
        lexer.skip_token ();
@@ -790,7 +793,8 @@ Parser<ManagedTokenSource>::parse_attr_input ()
     {
     case LEFT_PAREN:
     case LEFT_SQUARE:
-      case LEFT_CURLY: {
+    case LEFT_CURLY:
+      {
        // must be a delimited token tree, so parse that
        std::unique_ptr<AST::AttrInput> input_tree (
          new AST::DelimTokenTree (parse_delim_token_tree ()));
@@ -799,7 +803,8 @@ Parser<ManagedTokenSource>::parse_attr_input ()
 
        return input_tree;
       }
-      case EQUAL: {
+    case EQUAL:
+      {
        // = LiteralExpr
        lexer.skip_token ();
 
@@ -2120,7 +2125,8 @@ Parser<ManagedTokenSource>::parse_macro_match ()
     {
     case LEFT_PAREN:
     case LEFT_SQUARE:
-      case LEFT_CURLY: {
+    case LEFT_CURLY:
+      {
        // must be macro matcher as delimited
        AST::MacroMatcher matcher = parse_macro_matcher ();
        if (matcher.is_error ())
@@ -2134,7 +2140,8 @@ Parser<ManagedTokenSource>::parse_macro_match ()
        return std::unique_ptr<AST::MacroMatcher> (
          new AST::MacroMatcher (std::move (matcher)));
       }
-      case DOLLAR_SIGN: {
+    case DOLLAR_SIGN:
+      {
        // have to do more lookahead to determine if fragment or repetition
        const_TokenPtr t2 = lexer.peek_token (1);
        switch (t2->get_id ())
@@ -2405,7 +2412,8 @@ Parser<ManagedTokenSource>::parse_visibility ()
       skip_token (RIGHT_PAREN);
 
       return AST::Visibility::create_super (path_loc, vis_loc);
-      case IN: {
+    case IN:
+      {
        lexer.skip_token ();
 
        // parse the "in" path as well
@@ -2469,7 +2477,8 @@ Parser<ManagedTokenSource>::parse_module (AST::Visibility vis,
        new AST::Module (std::move (name), std::move (vis),
                         std::move (outer_attrs), locus, safety,
                         lexer.get_filename (), inline_module_stack));
-      case LEFT_CURLY: {
+    case LEFT_CURLY:
+      {
        lexer.skip_token ();
 
        // parse inner attributes
@@ -2733,7 +2742,8 @@ Parser<ManagedTokenSource>::parse_use_tree ()
            return std::unique_ptr<AST::UseTreeGlob> (
              new AST::UseTreeGlob (AST::UseTreeGlob::NO_PATH,
                                    AST::SimplePath::create_empty (), locus));
-         case LEFT_CURLY: {
+       case LEFT_CURLY:
+         {
            // nested tree UseTree type
            lexer.skip_token ();
 
@@ -2811,7 +2821,8 @@ Parser<ManagedTokenSource>::parse_use_tree ()
          return std::unique_ptr<AST::UseTreeGlob> (
            new AST::UseTreeGlob (AST::UseTreeGlob::PATH_PREFIXED,
                                  std::move (path), locus));
-         case LEFT_CURLY: {
+       case LEFT_CURLY:
+         {
            // nested tree UseTree type
            lexer.skip_token ();
 
@@ -2848,7 +2859,8 @@ Parser<ManagedTokenSource>::parse_use_tree ()
                                    std::move (path), std::move (use_trees),
                                    locus));
          }
-         case AS: {
+       case AS:
+         {
            // rebind UseTree type
            lexer.skip_token ();
 
@@ -3103,7 +3115,8 @@ Parser<ManagedTokenSource>::parse_generic_param (EndTokenPred is_end_token)
 
   switch (token->get_id ())
     {
-      case LIFETIME: {
+    case LIFETIME:
+      {
        auto lifetime = parse_lifetime (false);
        if (!lifetime)
          {
@@ -3129,7 +3142,8 @@ Parser<ManagedTokenSource>::parse_generic_param (EndTokenPred is_end_token)
          std::move (outer_attrs), token->get_locus ()));
        break;
       }
-      case IDENTIFIER: {
+    case IDENTIFIER:
+      {
        auto type_ident = token->get_str ();
        lexer.skip_token ();
 
@@ -3164,7 +3178,8 @@ Parser<ManagedTokenSource>::parse_generic_param (EndTokenPred is_end_token)
                              std::move (outer_attrs)));
        break;
       }
-      case CONST: {
+    case CONST:
+      {
        lexer.skip_token ();
 
        auto name_token = expect_token (IDENTIFIER);
@@ -4359,7 +4374,8 @@ Parser<ManagedTokenSource>::parse_struct (AST::Visibility vis,
   const_TokenPtr t = lexer.peek_token ();
   switch (t->get_id ())
     {
-      case LEFT_CURLY: {
+    case LEFT_CURLY:
+      {
        // struct with body
 
        // skip curly bracket
@@ -4762,7 +4778,8 @@ Parser<ManagedTokenSource>::parse_enum_item ()
   const_TokenPtr t = lexer.peek_token ();
   switch (t->get_id ())
     {
-      case LEFT_PAREN: {
+    case LEFT_PAREN:
+      {
        // tuple enum item
        lexer.skip_token ();
 
@@ -4783,7 +4800,8 @@ Parser<ManagedTokenSource>::parse_enum_item ()
          std::move (item_name), std::move (vis), std::move (tuple_fields),
          std::move (outer_attrs), item_name_tok->get_locus ()));
       }
-      case LEFT_CURLY: {
+    case LEFT_CURLY:
+      {
        // struct enum item
        lexer.skip_token ();
 
@@ -4800,7 +4818,8 @@ Parser<ManagedTokenSource>::parse_enum_item ()
          std::move (item_name), std::move (vis), std::move (struct_fields),
          std::move (outer_attrs), item_name_tok->get_locus ()));
       }
-      case EQUAL: {
+    case EQUAL:
+      {
        // discriminant enum item
        lexer.skip_token ();
 
@@ -5453,7 +5472,8 @@ Parser<ManagedTokenSource>::parse_inherent_impl_item ()
     case SUPER:
     case SELF:
     case CRATE:
-      case PUB: {
+    case PUB:
+      {
        // visibility, so not a macro invocation semi - must be constant,
        // function, or method
        AST::Visibility vis = parse_visibility ();
@@ -5967,7 +5987,8 @@ Parser<ManagedTokenSource>::parse_external_item ()
     {
     case IDENTIFIER:
       return parse_macro_invocation_semi (outer_attrs);
-      case STATIC_KW: {
+    case STATIC_KW:
+      {
        // parse extern static item
        lexer.skip_token ();
 
@@ -6264,7 +6285,8 @@ Parser<ManagedTokenSource>::parse_generic_arg ()
 
   switch (tok->get_id ())
     {
-      case IDENTIFIER: {
+    case IDENTIFIER:
+      {
        // This is a bit of a weird situation: With an identifier token, we
        // could either have a valid type or a macro (FIXME: anything else?). So
        // we need one bit of lookahead to differentiate if this is really
@@ -6312,9 +6334,10 @@ Parser<ManagedTokenSource>::parse_generic_arg ()
     case FALSE_LITERAL:
       expr = parse_literal_expr ();
       break;
-      // FIXME: Because of this, error reporting is garbage for const generic
-      // parameter's default values
-      default: {
+    // FIXME: Because of this, error reporting is garbage for const generic
+    // parameter's default values
+    default:
+      {
        auto type = parse_type ();
        // FIXME: Find a better way to do this?
        if (type)
@@ -6513,7 +6536,8 @@ Parser<ManagedTokenSource>::parse_type_path_segment ()
   switch (t->get_id ())
     {
     case LEFT_SHIFT:
-      case LEFT_ANGLE: {
+    case LEFT_ANGLE:
+      {
        // parse generic args
        AST::GenericArgs generic_args = parse_path_generic_args ();
 
@@ -6522,7 +6546,8 @@ Parser<ManagedTokenSource>::parse_type_path_segment ()
                                           has_separating_scope_resolution,
                                           std::move (generic_args), locus));
       }
-      case LEFT_PAREN: {
+    case LEFT_PAREN:
+      {
        // parse type path function
        AST::TypePathFunction type_path_function
          = parse_type_path_function (locus);
@@ -7071,7 +7096,8 @@ Parser<ManagedTokenSource>::parse_expr_stmt (AST::AttrVec outer_attrs,
     case SELF:
     case SELF_ALIAS:
     case DOLLAR_SIGN:
-      case SCOPE_RESOLUTION: {
+    case SCOPE_RESOLUTION:
+      {
        AST::PathInExpression path = parse_path_in_expression ();
        std::unique_ptr<AST::Expr> null_denotation;
 
@@ -7678,7 +7704,8 @@ Parser<ManagedTokenSource>::parse_if_expr (AST::AttrVec outer_attrs,
       const_TokenPtr t = lexer.peek_token ();
       switch (t->get_id ())
        {
-         case LEFT_CURLY: {
+       case LEFT_CURLY:
+         {
            // double selection - else
            // parse else block expr (required)
            std::unique_ptr<AST::BlockExpr> else_body = parse_block_expr ();
@@ -7699,7 +7726,8 @@ Parser<ManagedTokenSource>::parse_if_expr (AST::AttrVec outer_attrs,
                                         std::move (else_body),
                                         std::move (outer_attrs), locus));
          }
-         case IF: {
+       case IF:
+         {
            // multiple selection - else if or else if let
            // branch on whether next token is 'let' or not
            if (lexer.peek_token (1)->get_id () == LET)
@@ -7860,7 +7888,8 @@ Parser<ManagedTokenSource>::parse_if_let_expr (AST::AttrVec outer_attrs,
       const_TokenPtr t = lexer.peek_token ();
       switch (t->get_id ())
        {
-         case LEFT_CURLY: {
+       case LEFT_CURLY:
+         {
            // double selection - else
            // parse else block expr (required)
            std::unique_ptr<AST::BlockExpr> else_body = parse_block_expr ();
@@ -7882,7 +7911,8 @@ Parser<ManagedTokenSource>::parse_if_let_expr (AST::AttrVec outer_attrs,
                                            std::move (else_body),
                                            std::move (outer_attrs), locus));
          }
-         case IF: {
+       case IF:
+         {
            // multiple selection - else if or else if let
            // branch on whether next token is 'let' or not
            if (lexer.peek_token (1)->get_id () == LET)
@@ -8934,7 +8964,8 @@ Parser<ManagedTokenSource>::parse_type (bool save_errors)
       // slice type or array type - requires further disambiguation
       return parse_slice_or_array_type ();
     case LEFT_SHIFT:
-      case LEFT_ANGLE: {
+    case LEFT_ANGLE:
+      {
        // qualified path in type
        AST::QualifiedPathInType path = parse_qualified_path_in_type ();
        if (path.is_error ())
@@ -8963,7 +8994,8 @@ Parser<ManagedTokenSource>::parse_type (bool save_errors)
     case LOGICAL_AND:
       // reference type
       return parse_reference_type ();
-      case LIFETIME: {
+    case LIFETIME:
+      {
        /* probably a lifetime bound, so probably type param bounds in
         * TraitObjectType */
        std::vector<std::unique_ptr<AST::TypeParamBound>> bounds
@@ -8979,7 +9011,8 @@ Parser<ManagedTokenSource>::parse_type (bool save_errors)
     case SELF_ALIAS:
     case CRATE:
     case DOLLAR_SIGN:
-      case SCOPE_RESOLUTION: {
+    case SCOPE_RESOLUTION:
+      {
        // macro invocation or type path - requires further disambiguation.
        /* for parsing path component of each rule, perhaps parse it as a
         * typepath and attempt conversion to simplepath if a trailing '!' is
@@ -9009,7 +9042,8 @@ Parser<ManagedTokenSource>::parse_type (bool save_errors)
        t = lexer.peek_token ();
        switch (t->get_id ())
          {
-           case EXCLAM: {
+         case EXCLAM:
+           {
              // macro invocation
              // convert to simple path
              AST::SimplePath macro_path = path.as_simple_path ();
@@ -9035,7 +9069,8 @@ Parser<ManagedTokenSource>::parse_type (bool save_errors)
                                     std::move (tok_tree)),
                {}, locus);
            }
-           case PLUS: {
+         case PLUS:
+           {
              // type param bounds
              std::vector<std::unique_ptr<AST::TypeParamBound>> bounds;
 
@@ -9149,7 +9184,8 @@ Parser<ManagedTokenSource>::parse_type (bool save_errors)
            new AST::ImplTraitType (std::move (bounds), locus));
        }
     case DYN:
-      case QUESTION_MARK: {
+    case QUESTION_MARK:
+      {
        // either TraitObjectType or TraitObjectTypeOneBound
        bool has_dyn = false;
        if (t->get_id () == DYN)
@@ -9402,7 +9438,8 @@ Parser<ManagedTokenSource>::parse_for_prefixed_type ()
     case SELF:
     case SELF_ALIAS:
     case CRATE:
-      case DOLLAR_SIGN: {
+    case DOLLAR_SIGN:
+      {
        // path, so trait type
 
        // parse type path to finish parsing trait bound
@@ -9748,7 +9785,8 @@ Parser<ManagedTokenSource>::parse_slice_or_array_type ()
 
       return std::unique_ptr<AST::SliceType> (
        new AST::SliceType (std::move (inner_type), locus));
-      case SEMICOLON: {
+    case SEMICOLON:
+      {
        // array type
        lexer.skip_token ();
 
@@ -9799,7 +9837,8 @@ Parser<ManagedTokenSource>::parse_type_no_bounds ()
       // slice type or array type - requires further disambiguation
       return parse_slice_or_array_type ();
     case LEFT_SHIFT:
-      case LEFT_ANGLE: {
+    case LEFT_ANGLE:
+      {
        // qualified path in type
        AST::QualifiedPathInType path = parse_qualified_path_in_type ();
        if (path.is_error ())
@@ -9840,7 +9879,8 @@ Parser<ManagedTokenSource>::parse_type_no_bounds ()
     case SELF_ALIAS:
     case CRATE:
     case DOLLAR_SIGN:
-      case SCOPE_RESOLUTION: {
+    case SCOPE_RESOLUTION:
+      {
        // macro invocation or type path - requires further disambiguation.
        /* for parsing path component of each rule, perhaps parse it as a
         * typepath and attempt conversion to simplepath if a trailing '!' is
@@ -9868,7 +9908,8 @@ Parser<ManagedTokenSource>::parse_type_no_bounds ()
        t = lexer.peek_token ();
        switch (t->get_id ())
          {
-           case EXCLAM: {
+         case EXCLAM:
+           {
              // macro invocation
              // convert to simple path
              AST::SimplePath macro_path = path.as_simple_path ();
@@ -9956,7 +9997,8 @@ Parser<ManagedTokenSource>::parse_type_no_bounds ()
            new AST::ImplTraitTypeOneBound (std::move (initial_bound), locus));
        }
     case DYN:
-      case QUESTION_MARK: {
+    case QUESTION_MARK:
+      {
        // either TraitObjectTypeOneBound
        bool has_dyn = false;
        if (t->get_id () == DYN)
@@ -10297,7 +10339,8 @@ Parser<ManagedTokenSource>::parse_range_pattern_bound ()
     case SELF_ALIAS:
     case CRATE:
     case SCOPE_RESOLUTION:
-      case DOLLAR_SIGN: {
+    case DOLLAR_SIGN:
+      {
        // path in expression
        AST::PathInExpression path = parse_path_in_expression ();
        if (path.is_error ())
@@ -10313,7 +10356,8 @@ Parser<ManagedTokenSource>::parse_range_pattern_bound ()
          new AST::RangePatternBoundPath (std::move (path)));
       }
     case LEFT_SHIFT:
-      case LEFT_ANGLE: {
+    case LEFT_ANGLE:
+      {
        // qualified path in expression
        AST::QualifiedPathInExpression path
          = parse_qualified_path_in_expression ();
@@ -10458,7 +10502,8 @@ Parser<ManagedTokenSource>::parse_pattern_no_alt ()
       // slice pattern
       return parse_slice_pattern ();
     case LEFT_SHIFT:
-      case LEFT_ANGLE: {
+    case LEFT_ANGLE:
+      {
        // qualified path in expression or qualified range pattern bound
        AST::QualifiedPathInExpression path
          = parse_qualified_path_in_expression ();
@@ -10494,7 +10539,8 @@ Parser<ManagedTokenSource>::parse_pattern_no_alt ()
     case SELF_ALIAS:
     case CRATE:
     case SCOPE_RESOLUTION:
-      case DOLLAR_SIGN: {
+    case DOLLAR_SIGN:
+      {
        // path in expression or range pattern bound
        AST::PathInExpression path = parse_path_in_expression ();
 
@@ -10503,7 +10549,8 @@ Parser<ManagedTokenSource>::parse_pattern_no_alt ()
          {
          case DOT_DOT_EQ:
          case DOT_DOT:
-           case ELLIPSIS: {
+         case ELLIPSIS:
+           {
              // qualified range pattern bound, so parse rest of range pattern
              AST::RangeKind kind = AST::tokenid_to_rangekind (next->get_id ());
              lexer.skip_token ();
@@ -10521,7 +10568,8 @@ Parser<ManagedTokenSource>::parse_pattern_no_alt ()
          case EXCLAM:
            return parse_macro_invocation_partial (std::move (path),
                                                   AST::AttrVec ());
-           case LEFT_PAREN: {
+         case LEFT_PAREN:
+           {
              // tuple struct
              lexer.skip_token ();
 
@@ -10546,7 +10594,8 @@ Parser<ManagedTokenSource>::parse_pattern_no_alt ()
                new AST::TupleStructPattern (std::move (path),
                                             std::move (items)));
            }
-           case LEFT_CURLY: {
+         case LEFT_CURLY:
+           {
              // struct
              lexer.skip_token ();
 
@@ -10716,7 +10765,8 @@ Parser<ManagedTokenSource>::parse_grouped_or_tuple_pattern ()
 
       return std::unique_ptr<AST::GroupedPattern> (
        new AST::GroupedPattern (std::move (initial_pattern), paren_locus));
-      case COMMA: {
+    case COMMA:
+      {
        // tuple pattern
        lexer.skip_token ();
 
@@ -10973,7 +11023,8 @@ Parser<ManagedTokenSource>::parse_ident_leading_pattern ()
     {
     case EXCLAM:
       return parse_macro_invocation_partial (std::move (path), AST::AttrVec ());
-      case LEFT_PAREN: {
+    case LEFT_PAREN:
+      {
        // tuple struct
        lexer.skip_token ();
 
@@ -11006,7 +11057,8 @@ Parser<ManagedTokenSource>::parse_ident_leading_pattern ()
        return std::unique_ptr<AST::TupleStructPattern> (
          new AST::TupleStructPattern (std::move (path), std::move (items)));
       }
-      case LEFT_CURLY: {
+    case LEFT_CURLY:
+      {
        // struct
        lexer.skip_token ();
 
@@ -11027,7 +11079,8 @@ Parser<ManagedTokenSource>::parse_ident_leading_pattern ()
       }
     case DOT_DOT_EQ:
     case DOT_DOT:
-      case ELLIPSIS: {
+    case ELLIPSIS:
+      {
        // range
        AST::RangeKind kind
          = AST::tokenid_to_rangekind (lexer.peek_token ()->get_id ());
@@ -11044,7 +11097,8 @@ Parser<ManagedTokenSource>::parse_ident_leading_pattern ()
                                 std::move (upper_bound), kind,
                                 t->get_locus ()));
       }
-      case PATTERN_BIND: {
+    case PATTERN_BIND:
+      {
        // only allow on single-segment paths
        if (path.is_single_segment ())
          {
@@ -11182,7 +11236,8 @@ Parser<ManagedTokenSource>::parse_tuple_struct_items ()
     case RIGHT_PAREN:
       return std::unique_ptr<AST::TupleStructItemsNoRange> (
        new AST::TupleStructItemsNoRange (std::move (lower_patterns)));
-      case DOT_DOT: {
+    case DOT_DOT:
+      {
        // has an upper range that must be parsed separately
        lexer.skip_token ();
 
@@ -11302,7 +11357,8 @@ Parser<ManagedTokenSource>::parse_struct_pattern_field_partial (
   const_TokenPtr t = lexer.peek_token ();
   switch (t->get_id ())
     {
-      case INT_LITERAL: {
+    case INT_LITERAL:
+      {
        // tuple index
        std::string index_str = t->get_str ();
        int index = atoi (index_str.c_str ());
@@ -11336,7 +11392,8 @@ Parser<ManagedTokenSource>::parse_struct_pattern_field_partial (
       // branch on next token
       switch (lexer.peek_token (1)->get_id ())
        {
-         case COLON: {
+       case COLON:
+         {
            // identifier-pattern
            Identifier ident{t};
            lexer.skip_token ();
@@ -11361,7 +11418,8 @@ Parser<ManagedTokenSource>::parse_struct_pattern_field_partial (
                                                   t->get_locus ()));
          }
        case COMMA:
-         case RIGHT_CURLY: {
+       case RIGHT_CURLY:
+         {
            // identifier only
            Identifier ident = {t};
            lexer.skip_token ();
@@ -11380,7 +11438,8 @@ Parser<ManagedTokenSource>::parse_struct_pattern_field_partial (
          return nullptr;
        }
     case REF:
-      case MUT: {
+    case MUT:
+      {
        // only identifier
        bool has_ref = false;
        if (t->get_id () == REF)
@@ -11452,7 +11511,8 @@ Parser<ManagedTokenSource>::parse_stmt_or_expr ()
   t = lexer.peek_token ();
   switch (t->get_id ())
     {
-      case LET: {
+    case LET:
+      {
        // let statement
        std::unique_ptr<AST::LetStmt> stmt (
          parse_let_stmt (std::move (outer_attrs)));
@@ -11470,42 +11530,48 @@ Parser<ManagedTokenSource>::parse_stmt_or_expr ()
     case STATIC_KW:
     case AUTO:
     case TRAIT:
-      case IMPL: {
+    case IMPL:
+      {
        std::unique_ptr<AST::VisItem> item (
          parse_vis_item (std::move (outer_attrs)));
        return ExprOrStmt (std::move (item));
       }
-      /* TODO: implement union keyword but not really because of
-       * context-dependence crappy hack way to parse a union written below to
-       * separate it from the good code. */
-      // case UNION:
-      case UNSAFE: { // maybe - unsafe traits are a thing
+    /* TODO: implement union keyword but not really because of
+     * context-dependence crappy hack way to parse a union written below to
+     * separate it from the good code. */
+    // case UNION:
+    case UNSAFE:
+      { // maybe - unsafe traits are a thing
        /* if any of these (should be all possible VisItem prefixes), parse a
         * VisItem - can't parse item because would require reparsing outer
         * attributes */
        const_TokenPtr t2 = lexer.peek_token (1);
        switch (t2->get_id ())
          {
-           case LEFT_CURLY: {
+         case LEFT_CURLY:
+           {
              // unsafe block: parse as expression
              expr = parse_expr (std::move (outer_attrs), restrictions);
              break;
            }
          case AUTO:
-           case TRAIT: {
+         case TRAIT:
+           {
              // unsafe trait
              std::unique_ptr<AST::VisItem> item (
                parse_vis_item (std::move (outer_attrs)));
              return ExprOrStmt (std::move (item));
            }
          case EXTERN_KW:
-           case FN_KW: {
+         case FN_KW:
+           {
              // unsafe function
              std::unique_ptr<AST::VisItem> item (
                parse_vis_item (std::move (outer_attrs)));
              return ExprOrStmt (std::move (item));
            }
-           case IMPL: {
+         case IMPL:
+           {
              // unsafe trait impl
              std::unique_ptr<AST::VisItem> item (
                parse_vis_item (std::move (outer_attrs)));
@@ -11550,7 +11616,8 @@ Parser<ManagedTokenSource>::parse_stmt_or_expr ()
     case SELF_ALIAS:
     case CRATE:
     case SCOPE_RESOLUTION:
-      case DOLLAR_SIGN: {
+    case DOLLAR_SIGN:
+      {
        AST::PathInExpression path = parse_path_in_expression ();
        std::unique_ptr<AST::Expr> null_denotation;
 
@@ -11674,7 +11741,8 @@ Parser<ManagedTokenSource>::parse_struct_expr_field ()
                                                std::move (outer_attrs),
                                                t->get_locus ()));
        }
-      case INT_LITERAL: {
+    case INT_LITERAL:
+      {
        // parse tuple index field
        int index = atoi (t->get_str ().c_str ());
        lexer.skip_token ();
@@ -12044,7 +12112,8 @@ Parser<ManagedTokenSource>::null_denotation (const_TokenPtr tok,
     case SELF_ALIAS:
     case DOLLAR_SIGN:
     case CRATE:
-      case SUPER: {
+    case SUPER:
+      {
        // DEBUG
        rust_debug ("beginning null denotation identifier handling");
 
@@ -12055,7 +12124,8 @@ Parser<ManagedTokenSource>::null_denotation (const_TokenPtr tok,
        return null_denotation_path (std::move (path), std::move (outer_attrs),
                                     restrictions);
       }
-      case SCOPE_RESOLUTION: {
+    case SCOPE_RESOLUTION:
+      {
        // TODO: fix: this is for global paths, i.e. std::string::whatever
        Error error (tok->get_locus (),
                     "found null denotation scope resolution operator, and "
@@ -12097,7 +12167,8 @@ Parser<ManagedTokenSource>::null_denotation_path (
       // macro
       return parse_macro_invocation_partial (std::move (path),
                                             std::move (outer_attrs));
-      case LEFT_CURLY: {
+    case LEFT_CURLY:
+      {
        bool not_a_block = lexer.peek_token (1)->get_id () == IDENTIFIER
                           && (lexer.peek_token (2)->get_id () == COMMA
                               || (lexer.peek_token (2)->get_id () == COLON
@@ -12173,7 +12244,8 @@ Parser<ManagedTokenSource>::null_denotation_not_path (
     {
     // FIXME: Handle in null_denotation_path?
     case LEFT_SHIFT:
-      case LEFT_ANGLE: {
+    case LEFT_ANGLE:
+      {
        // qualified path
        // HACK: add outer attrs to path
        AST::QualifiedPathInExpression path
@@ -12231,23 +12303,24 @@ Parser<ManagedTokenSource>::null_denotation_not_path (
       return parse_grouped_or_tuple_expr (std::move (outer_attrs),
                                          tok->get_locus ());
 
-      /*case PLUS: { // unary plus operator
-         // invoke parse_expr recursively with appropriate priority, etc. for
-      below AST::Expr* expr = parse_expr(LBP_UNARY_PLUS);
+    /*case PLUS: { // unary plus operator
+       // invoke parse_expr recursively with appropriate priority, etc. for
+    below AST::Expr* expr = parse_expr(LBP_UNARY_PLUS);
 
-         if (expr == nullptr)
-             return nullptr;
-         // can only apply to integer and float expressions
-         if (expr->get_type() != integer_type_node || expr->get_type() !=
-      float_type_node) { rust_error_at(tok->get_locus(), "operand of unary
-      plus must be int or float but it is %s", print_type(expr->get_type()));
-      return nullptr;
-         }
+       if (expr == nullptr)
+           return nullptr;
+       // can only apply to integer and float expressions
+       if (expr->get_type() != integer_type_node || expr->get_type() !=
+    float_type_node) { rust_error_at(tok->get_locus(), "operand of unary
+    plus must be int or float but it is %s", print_type(expr->get_type()));
+    return nullptr;
+       }
 
-         return Tree(expr, tok->get_locus());
-      }*/
-      // Rust has no unary plus operator
-      case MINUS: { // unary minus
+       return Tree(expr, tok->get_locus());
+    }*/
+    // Rust has no unary plus operator
+    case MINUS:
+      { // unary minus
        ParseRestrictions entered_from_unary;
        entered_from_unary.entered_from_unary = true;
        if (!restrictions.can_be_struct_expr)
@@ -12274,7 +12347,8 @@ Parser<ManagedTokenSource>::null_denotation_not_path (
          new AST::NegationExpr (std::move (expr), NegationOperator::NEGATE,
                                 std::move (outer_attrs), tok->get_locus ()));
       }
-      case EXCLAM: { // logical or bitwise not
+    case EXCLAM:
+      { // logical or bitwise not
        ParseRestrictions entered_from_unary;
        entered_from_unary.entered_from_unary = true;
        if (!restrictions.can_be_struct_expr)
@@ -12299,7 +12373,8 @@ Parser<ManagedTokenSource>::null_denotation_not_path (
          new AST::NegationExpr (std::move (expr), NegationOperator::NOT,
                                 std::move (outer_attrs), tok->get_locus ()));
       }
-      case ASTERISK: {
+    case ASTERISK:
+      {
        /* pointer dereference only - HACK: as struct expressions should
         * always be value expressions, cannot be dereferenced */
        ParseRestrictions entered_from_unary;
@@ -12312,7 +12387,8 @@ Parser<ManagedTokenSource>::null_denotation_not_path (
          new AST::DereferenceExpr (std::move (expr), std::move (outer_attrs),
                                    tok->get_locus ()));
       }
-      case AMP: {
+    case AMP:
+      {
        // (single) "borrow" expression - shared (mutable) or immutable
        std::unique_ptr<AST::Expr> expr = nullptr;
        Mutability mutability = Mutability::Imm;
@@ -12369,7 +12445,8 @@ Parser<ManagedTokenSource>::null_denotation_not_path (
          new AST::BorrowExpr (std::move (expr), mutability, raw_borrow, false,
                               std::move (outer_attrs), tok->get_locus ()));
       }
-      case LOGICAL_AND: {
+    case LOGICAL_AND:
+      {
        // (double) "borrow" expression - shared (mutable) or immutable
        std::unique_ptr<AST::Expr> expr = nullptr;
        Mutability mutability = Mutability::Imm;
@@ -12485,8 +12562,9 @@ Parser<ManagedTokenSource>::left_denotation (const_TokenPtr tok,
   // Token passed in has already been skipped, so peek gives "next" token
   switch (tok->get_id ())
     {
-      // FIXME: allow for outer attributes to be applied
-      case QUESTION_MARK: {
+    // FIXME: allow for outer attributes to be applied
+    case QUESTION_MARK:
+      {
        location_t left_locus = left->get_locus ();
        // error propagation expression - unary postfix
        return std::unique_ptr<AST::ErrorPropagationExpr> (
@@ -12740,7 +12818,8 @@ Parser<ManagedTokenSource>::left_denotation (const_TokenPtr tok,
               "function - this should probably be handled elsewhere"));
 
       return nullptr;
-      case DOT: {
+    case DOT:
+      {
        /* field expression or method call - relies on parentheses after next
         * identifier or await if token after is "await" (unary postfix) or
         * tuple index if token after is a decimal int literal */
@@ -14056,7 +14135,8 @@ Parser<ManagedTokenSource>::parse_struct_expr_struct_partial (
        * algorithm should work too. As such, AST type not happening. */
     case IDENTIFIER:
     case HASH:
-      case INT_LITERAL: {
+    case INT_LITERAL:
+      {
        // struct with struct expr fields
 
        // parse struct expr fields
@@ -14353,7 +14433,8 @@ Parser<ManagedTokenSource>::parse_closure_expr_pratt (const_TokenPtr tok,
     case OR:
       // no parameters, don't skip token
       break;
-      case PIPE: {
+    case PIPE:
+      {
        // actually may have parameters
        // don't skip token
        const_TokenPtr t = lexer.peek_token ();
index 43d15aa2bb9e1a4e47a0674f1e80d3a21c698d80..4895c6afdaa05b9a2e899f8ea0929d82531144ae 100644 (file)
@@ -144,10 +144,9 @@ peculiar_fragment_match_compatible_fragment (
     = contains (fragment_follow_set[last_spec.get_kind ()], spec.get_kind ());
 
   if (!is_valid)
-    rust_error_at (
-      match_locus,
-      "fragment specifier %qs is not allowed after %qs fragments",
-      spec.as_string ().c_str (), last_spec.as_string ().c_str ());
+    rust_error_at (match_locus,
+                  "fragment specifier %qs is not allowed after %qs fragments",
+                  spec.as_string ().c_str (), last_spec.as_string ().c_str ());
 
   return is_valid;
 }
@@ -244,7 +243,8 @@ peculiar_fragment_match_compatible (const AST::MacroMatchFragment &last_match,
   // the error.
   switch (match.get_macro_match_type ())
     {
-      case AST::MacroMatch::Tok: {
+    case AST::MacroMatch::Tok:
+      {
        auto tok = static_cast<const AST::Token *> (&match);
        if (contains (allowed_toks, tok->get_id ()))
          return true;
@@ -254,7 +254,8 @@ peculiar_fragment_match_compatible (const AST::MacroMatchFragment &last_match,
        break;
       }
       break;
-      case AST::MacroMatch::Repetition: {
+    case AST::MacroMatch::Repetition:
+      {
        auto repetition
          = static_cast<const AST::MacroMatchRepetition *> (&match);
        auto &matches = repetition->get_matches ();
@@ -263,7 +264,8 @@ peculiar_fragment_match_compatible (const AST::MacroMatchFragment &last_match,
          return peculiar_fragment_match_compatible (last_match, *first_frag);
        break;
       }
-      case AST::MacroMatch::Matcher: {
+    case AST::MacroMatch::Matcher:
+      {
        auto matcher = static_cast<const AST::MacroMatcher *> (&match);
        auto first_token = matcher->get_delim_type ();
        TokenId delim_id;
@@ -289,7 +291,8 @@ peculiar_fragment_match_compatible (const AST::MacroMatchFragment &last_match,
        error_locus = matcher->get_match_locus ();
        break;
       }
-      case AST::MacroMatch::Fragment: {
+    case AST::MacroMatch::Fragment:
+      {
        auto last_spec = last_match.get_frag_spec ();
        auto fragment = static_cast<const AST::MacroMatchFragment *> (&match);
        if (last_spec.has_follow_set_fragment_restrictions ())
@@ -328,10 +331,11 @@ is_match_compatible (const AST::MacroMatch &last_match,
 
   switch (last_match.get_macro_match_type ())
     {
-      // This is our main stop condition: When we are finally looking at the
-      // last match (or its actual last component), and it is a fragment, it
-      // may contain some follow up restrictions.
-      case AST::MacroMatch::Fragment: {
+    // This is our main stop condition: When we are finally looking at the
+    // last match (or its actual last component), and it is a fragment, it
+    // may contain some follow up restrictions.
+    case AST::MacroMatch::Fragment:
+      {
        auto fragment
          = static_cast<const AST::MacroMatchFragment *> (&last_match);
        if (fragment->get_frag_spec ().has_follow_set_restrictions ())
@@ -339,7 +343,8 @@ is_match_compatible (const AST::MacroMatch &last_match,
        else
          return true;
       }
-      case AST::MacroMatch::Repetition: {
+    case AST::MacroMatch::Repetition:
+      {
        // A repetition on the left hand side means we want to make sure the
        // last match of the repetition is compatible with the new match
        auto repetition
index 827d91d6cbb1f49290602f105fc9e03229e30e08..c8ee5f109b0c392b3c327947775df721330a1c52 100644 (file)
@@ -764,9 +764,9 @@ private:
   };
 };
 
-std::string
-extract_module_path (const AST::AttrVec &inner_attrs,
-                    const AST::AttrVec &outer_attrs, const std::string &name);
+std::string extract_module_path (const AST::AttrVec &inner_attrs,
+                                const AST::AttrVec &outer_attrs,
+                                const std::string &name);
 
 /**
  * Check if a MacroMatch is allowed to follow the last parsed MacroMatch.
@@ -776,9 +776,8 @@ extract_module_path (const AST::AttrVec &inner_attrs,
  *
  * @return true if the follow-up is valid, false otherwise
  */
-bool
-is_match_compatible (const AST::MacroMatch &last_match,
-                    const AST::MacroMatch &current_match);
+bool is_match_compatible (const AST::MacroMatch &last_match,
+                         const AST::MacroMatch &current_match);
 } // namespace Rust
 
 // as now template, include implementations of all methods
index 5524e18ab5f7fbea6fdf059e9514461a09edd34d..28c76399945448b80cc740981cddc93c17a940f8 100644 (file)
@@ -324,38 +324,45 @@ translate_operand (AST::InlineAsm &expr, const CanonicalPath &prefix,
     {
       switch (operand.get_register_type ())
        {
-         case RegisterType::In: {
+       case RegisterType::In:
+         {
            auto in = operand.get_in ();
            ResolveExpr::go (*in.expr, prefix, canonical_prefix);
            break;
          }
-         case RegisterType::Out: {
+       case RegisterType::Out:
+         {
            auto out = operand.get_out ();
            ResolveExpr::go (*out.expr, prefix, canonical_prefix);
            break;
          }
-         case RegisterType::InOut: {
+       case RegisterType::InOut:
+         {
            auto in_out = operand.get_in_out ();
            ResolveExpr::go (*in_out.expr, prefix, canonical_prefix);
            break;
          }
-         case RegisterType::SplitInOut: {
+       case RegisterType::SplitInOut:
+         {
            auto split_in_out = operand.get_split_in_out ();
            ResolveExpr::go (*split_in_out.in_expr, prefix, canonical_prefix);
            ResolveExpr::go (*split_in_out.out_expr, prefix, canonical_prefix);
            break;
          }
-         case RegisterType::Const: {
+       case RegisterType::Const:
+         {
            auto anon_const = operand.get_const ().anon_const;
            ResolveExpr::go (*anon_const.expr, prefix, canonical_prefix);
            break;
          }
-         case RegisterType::Sym: {
+       case RegisterType::Sym:
+         {
            auto sym = operand.get_sym ();
            ResolveExpr::go (*sym.expr, prefix, canonical_prefix);
            break;
          }
-         case RegisterType::Label: {
+       case RegisterType::Label:
+         {
            auto label = operand.get_label ();
            ResolveExpr::go (*label.expr, prefix, canonical_prefix);
            break;
index 9f95f517187e18623bef7e273407721c907bb698..0937d6577c8b16ba4a78e55c7da312613bb89c57 100644 (file)
@@ -829,29 +829,32 @@ ResolveItem::resolve_extern_item (AST::ExternalItem &item)
   ResolveExternItem::go (item, prefix, canonical_prefix);
 }
 
-static void
-flatten_glob (const AST::UseTreeGlob &glob, std::vector<Import> &imports);
-static void
-flatten_rebind (const AST::UseTreeRebind &glob, std::vector<Import> &imports);
-static void
-flatten_list (const AST::UseTreeList &glob, std::vector<Import> &imports);
+static void flatten_glob (const AST::UseTreeGlob &glob,
+                         std::vector<Import> &imports);
+static void flatten_rebind (const AST::UseTreeRebind &glob,
+                           std::vector<Import> &imports);
+static void flatten_list (const AST::UseTreeList &glob,
+                         std::vector<Import> &imports);
 
 static void
 flatten (const AST::UseTree *tree, std::vector<Import> &imports)
 {
   switch (tree->get_kind ())
     {
-      case AST::UseTree::Glob: {
+    case AST::UseTree::Glob:
+      {
        auto glob = static_cast<const AST::UseTreeGlob *> (tree);
        flatten_glob (*glob, imports);
        break;
       }
-      case AST::UseTree::Rebind: {
+    case AST::UseTree::Rebind:
+      {
        auto rebind = static_cast<const AST::UseTreeRebind *> (tree);
        flatten_rebind (*rebind, imports);
        break;
       }
-      case AST::UseTree::List: {
+    case AST::UseTree::List:
+      {
        auto list = static_cast<const AST::UseTreeList *> (tree);
        flatten_list (*list, imports);
        break;
index 776dd5338a511c1e1a9e46ffdae64ed83970371c..d31f910c4b1851d7ffcf8660648c061c33282809 100644 (file)
@@ -153,8 +153,7 @@ private:
 #if CHECKING_P
 
 namespace selftest {
-extern void
-rust_simple_path_resolve_test (void);
+extern void rust_simple_path_resolve_test (void);
 } // namespace selftest
 
 #endif // CHECKING_P
index ee84be8942bc51476554fd617acad60ac14a1187..2b5e2bf97eb978fbaa576b7ecbfae7c45eedfa8d 100644 (file)
@@ -94,13 +94,15 @@ PatternDeclaration::visit (AST::TupleStructPattern &pattern)
   AST::TupleStructItems &items = pattern.get_items ();
   switch (items.get_item_type ())
     {
-      case AST::TupleStructItems::RANGE: {
+    case AST::TupleStructItems::RANGE:
+      {
        // TODO
        rust_unreachable ();
       }
       break;
 
-      case AST::TupleStructItems::NO_RANGE: {
+    case AST::TupleStructItems::NO_RANGE:
+      {
        auto &items_no_range
          = static_cast<AST::TupleStructItemsNoRange &> (items);
 
@@ -123,7 +125,8 @@ PatternDeclaration::visit (AST::StructPattern &pattern)
     {
       switch (field->get_item_type ())
        {
-         case AST::StructPatternField::ItemType::TUPLE_PAT: {
+       case AST::StructPatternField::ItemType::TUPLE_PAT:
+         {
            AST::StructPatternFieldTuplePat &tuple
              = static_cast<AST::StructPatternFieldTuplePat &> (*field);
 
@@ -131,7 +134,8 @@ PatternDeclaration::visit (AST::StructPattern &pattern)
          }
          break;
 
-         case AST::StructPatternField::ItemType::IDENT_PAT: {
+       case AST::StructPatternField::ItemType::IDENT_PAT:
+         {
            AST::StructPatternFieldIdentPat &ident
              = static_cast<AST::StructPatternFieldIdentPat &> (*field);
 
@@ -139,7 +143,8 @@ PatternDeclaration::visit (AST::StructPattern &pattern)
          }
          break;
 
-         case AST::StructPatternField::ItemType::IDENT: {
+       case AST::StructPatternField::ItemType::IDENT:
+         {
            auto &ident = static_cast<AST::StructPatternFieldIdent &> (*field);
 
            Mutability mut
@@ -160,7 +165,8 @@ PatternDeclaration::visit (AST::TuplePattern &pattern)
   auto &items = pattern.get_items ();
   switch (items.get_pattern_type ())
     {
-      case AST::TuplePatternItems::TuplePatternItemType::MULTIPLE: {
+    case AST::TuplePatternItems::TuplePatternItemType::MULTIPLE:
+      {
        auto &ref = static_cast<AST::TuplePatternItemsMultiple &> (
          pattern.get_items ());
 
@@ -169,7 +175,8 @@ PatternDeclaration::visit (AST::TuplePattern &pattern)
       }
       break;
 
-      case AST::TuplePatternItems::TuplePatternItemType::RANGED: {
+    case AST::TuplePatternItems::TuplePatternItemType::RANGED:
+      {
        auto &ref
          = static_cast<AST::TuplePatternItemsRanged &> (pattern.get_items ());
 
@@ -348,14 +355,16 @@ resolve_range_pattern_bound (AST::RangePatternBound &bound)
       // Nothing to resolve for a literal.
       break;
 
-      case AST::RangePatternBound::RangePatternBoundType::PATH: {
+    case AST::RangePatternBound::RangePatternBoundType::PATH:
+      {
        auto &ref = static_cast<AST::RangePatternBoundPath &> (bound);
 
        ResolvePath::go (ref.get_path ());
       }
       break;
 
-      case AST::RangePatternBound::RangePatternBoundType::QUALPATH: {
+    case AST::RangePatternBound::RangePatternBoundType::QUALPATH:
+      {
        auto &ref = static_cast<AST::RangePatternBoundQualPath &> (bound);
 
        ResolvePath::go (ref.get_qualified_path ());
index 891fcf5d9f1db868c75d15236bea4cb78efc198f..a0402289afc401a09bfc70d90ecd9650addcc897 100644 (file)
@@ -210,7 +210,8 @@ ResolveRelativeTypePath::go (AST::TypePath &path, NodeId &resolved_node_id)
 
       switch (segment->get_type ())
        {
-         case AST::TypePathSegment::SegmentType::GENERIC: {
+       case AST::TypePathSegment::SegmentType::GENERIC:
+         {
            AST::TypePathSegmentGeneric *s
              = static_cast<AST::TypePathSegmentGeneric *> (segment.get ());
            if (s->has_generic_args ())
@@ -509,7 +510,8 @@ ResolveTypeToCanonicalPath::visit (AST::TypePath &path)
       auto &final_seg = path.get_segments ().back ();
       switch (final_seg->get_type ())
        {
-         case AST::TypePathSegment::SegmentType::GENERIC: {
+       case AST::TypePathSegment::SegmentType::GENERIC:
+         {
            AST::TypePathSegmentGeneric *s
              = static_cast<AST::TypePathSegmentGeneric *> (final_seg.get ());
 
@@ -651,7 +653,8 @@ ResolveTypeToCanonicalPath::visit (AST::TraitObjectType &type)
 
       switch (additional_bound->get_bound_type ())
        {
-         case AST::TypeParamBound::TRAIT: {
+       case AST::TypeParamBound::TRAIT:
+         {
            auto bound_path = CanonicalPath::create_empty ();
 
            auto &bound_type_path
index 3e3c992e76acfe0008646086f01db8293a619b1e..2208f7046a7e870f12e67c2a5b6a50d85ca9e080 100644 (file)
@@ -24,8 +24,7 @@
 #include "rust-ast-resolve-expr.h"
 #include "rust-ast-resolve-struct-expr-field.h"
 
-extern bool
-saw_errors (void);
+extern bool saw_errors (void);
 
 namespace Rust {
 namespace Resolver {
index 3390f09e2916140e2a904b089a85270d9c56e7a2..9d2b77a0e3abfe1cd483ae66aa5f3d5da2d63799 100644 (file)
@@ -419,7 +419,8 @@ Early::finalize_rebind_import (const Early::ImportPair &mapping)
       declared_name = rebind.get_identifier ().as_string ();
       locus = rebind.get_identifier ().get_locus ();
       break;
-      case AST::UseTreeRebind::NewBindType::NONE: {
+    case AST::UseTreeRebind::NewBindType::NONE:
+      {
        const auto &segments = path.get_segments ();
        // We don't want to insert `self` with `use module::self`
        if (path.get_final_segment ().is_lower_self_seg ())
index 328d5af0b1cc31f51ee19bf9c8b9f7702321351d..401d26634c5b38e18cbecffad134b18f8d203b79 100644 (file)
@@ -377,7 +377,8 @@ Late::visit (AST::IdentifierExpr &expr)
     }
   else if (funny_error)
     {
-      diagnostics::text_finalizer (global_dc) = Resolver::funny_ice_text_finalizer;
+      diagnostics::text_finalizer (global_dc)
+       = Resolver::funny_ice_text_finalizer;
       emit_diagnostic (diagnostics::kind::ice_nobt, expr.get_locus (), -1,
                       "are you trying to break %s? how dare you?",
                       expr.as_string ().c_str ());
index 122436bb22fecb8d62da985f3fb23444711b5dc8..4d88ad1eb37063b905d2128340eacf7d9cc0bd3c 100644 (file)
@@ -415,21 +415,18 @@ TopLevel::visit (AST::TypeAlias &type_item)
   DefaultResolver::visit (type_item);
 }
 
-static void
-flatten_rebind (
+static void flatten_rebind (
   const AST::UseTreeRebind &glob,
   std::vector<std::pair<AST::SimplePath, AST::UseTreeRebind>> &rebind_paths);
 
-static void
-flatten_list (
+static void flatten_list (
   const AST::UseTreeList &glob, std::vector<AST::SimplePath> &paths,
   std::vector<AST::SimplePath> &glob_paths,
   std::vector<std::pair<AST::SimplePath, AST::UseTreeRebind>> &rebind_paths,
   NameResolutionContext &ctx);
-static void
-flatten_glob (const AST::UseTreeGlob &glob,
-             std::vector<AST::SimplePath> &glob_paths,
-             NameResolutionContext &ctx);
+static void flatten_glob (const AST::UseTreeGlob &glob,
+                         std::vector<AST::SimplePath> &glob_paths,
+                         NameResolutionContext &ctx);
 
 static void
 flatten (
@@ -440,17 +437,20 @@ flatten (
 {
   switch (tree->get_kind ())
     {
-      case AST::UseTree::Rebind: {
+    case AST::UseTree::Rebind:
+      {
        auto rebind = static_cast<const AST::UseTreeRebind *> (tree);
        flatten_rebind (*rebind, rebind_paths);
        break;
       }
-      case AST::UseTree::List: {
+    case AST::UseTree::List:
+      {
        auto list = static_cast<const AST::UseTreeList *> (tree);
        flatten_list (*list, paths, glob_paths, rebind_paths, ctx);
        break;
       }
-      case AST::UseTree::Glob: {
+    case AST::UseTree::Glob:
+      {
        auto glob = static_cast<const AST::UseTreeGlob *> (tree);
        flatten_glob (*glob, glob_paths, ctx);
        break;
index 414799edefee8f018a2e6967e9adbe87e54a54e3..a0df217988083ffb88fb97c19d90abd39cc3b836 100644 (file)
@@ -42,8 +42,7 @@ class Bvariable;
 
 namespace Backend {
 
-void
-init ();
+void init ();
 
 // Name/type/location.  Used for function parameters, struct fields,
 // interface methods.
@@ -64,47 +63,37 @@ struct typed_identifier
 
 // debug
 void debug (tree);
-void
-debug (Bvariable *);
+void debug (Bvariable *);
 
-tree
-get_identifier_node (const std::string &str);
+tree get_identifier_node (const std::string &str);
 
 // Types.
 
 // Get the wchar type
-tree
-wchar_type ();
+tree wchar_type ();
 
 // Get the Host pointer size in bits
-int
-get_pointer_size ();
+int get_pointer_size ();
 
 // Get the raw str type const char*
-tree
-raw_str_type ();
+tree raw_str_type ();
 
 // Get an unnamed integer type with the given signedness and number
 // of bits.
-tree
-integer_type (bool is_unsigned, int bits);
+tree integer_type (bool is_unsigned, int bits);
 
 // Get an unnamed floating point type with the given number of bits
 // (32 or 64).
-tree
-float_type (int bits);
+tree float_type (int bits);
 
 // Get a pointer type.
-tree
-pointer_type (tree to_type);
+tree pointer_type (tree to_type);
 
 // Get a reference type.
-tree
-reference_type (tree to_type);
+tree reference_type (tree to_type);
 
 // make type immutable
-tree
-immutable_type (tree base);
+tree immutable_type (tree base);
 
 // Get a function type.  The receiver, parameter, and results are
 // generated from the types in the Function_type.  The Function_type
@@ -115,41 +104,36 @@ immutable_type (tree base);
 // one result, RESULT_STRUCT is a struct type to hold the results,
 // and RESULTS may be ignored; if there are zero or one results,
 // RESULT_STRUCT is NULL.
-tree
-function_type (const typed_identifier &receiver,
-              const std::vector<typed_identifier> &parameters,
-              const std::vector<typed_identifier> &results, tree result_struct,
-              location_t location);
-
-tree
-function_type_variadic (const typed_identifier &receiver,
-                       const std::vector<typed_identifier> &parameters,
-                       const std::vector<typed_identifier> &results,
-                       tree result_struct, location_t location);
-
-tree
-function_ptr_type (tree result, const std::vector<tree> &praameters,
-                  location_t location);
+tree function_type (const typed_identifier &receiver,
+                   const std::vector<typed_identifier> &parameters,
+                   const std::vector<typed_identifier> &results,
+                   tree result_struct, location_t location);
+
+tree function_type_variadic (const typed_identifier &receiver,
+                            const std::vector<typed_identifier> &parameters,
+                            const std::vector<typed_identifier> &results,
+                            tree result_struct, location_t location);
+
+tree function_ptr_type (tree result, const std::vector<tree> &praameters,
+                       location_t location);
 
 // Get a struct type.
-tree
-struct_type (const std::vector<typed_identifier> &fields, bool layout = true);
+tree struct_type (const std::vector<typed_identifier> &fields,
+                 bool layout = true);
 
 // Get a union type.
-tree
-union_type (const std::vector<typed_identifier> &fields, bool layout = true);
+tree union_type (const std::vector<typed_identifier> &fields,
+                bool layout = true);
 
 // Get an array type.
-tree
-array_type (tree element_type, tree length);
+tree array_type (tree element_type, tree length);
 
 // Return a named version of a type.  The location is the location
 // of the type definition.  This will not be called for a type
 // created via placeholder_pointer_type, placeholder_struct_type, or
 // placeholder_array_type..  (It may be called for a pointer,
 // struct, or array type in a case like "type P *byte; type Q P".)
-tree
-named_type (const std::string &name, tree, location_t);
+tree named_type (const std::string &name, tree, location_t);
 
 // Return the size of a type.
 int64_t type_size (tree);
@@ -164,8 +148,7 @@ int64_t type_field_alignment (tree);
 // Return the offset of field INDEX in a struct type.  INDEX is the
 // entry in the FIELDS std::vector parameter of struct_type or
 // set_placeholder_struct_type.
-int64_t
-type_field_offset (tree, size_t index);
+int64_t type_field_offset (tree, size_t index);
 
 // Expressions.
 
@@ -175,155 +158,128 @@ type_field_offset (tree, size_t index);
 tree zero_expression (tree);
 
 // Create a reference to a variable.
-tree
-var_expression (Bvariable *var, location_t);
+tree var_expression (Bvariable *var, location_t);
 
 // Return an expression for the floating point value VAL in BTYPE.
-tree
-float_constant_expression (tree btype, mpfr_t val);
+tree float_constant_expression (tree btype, mpfr_t val);
 
 // Return an expression for the string value VAL.
-tree
-string_constant_expression (const std::string &val);
+tree string_constant_expression (const std::string &val);
 
 // Get a char literal
-tree
-char_constant_expression (char c);
+tree char_constant_expression (char c);
 
 // Get a char literal
-tree
-wchar_constant_expression (wchar_t c);
+tree wchar_constant_expression (wchar_t c);
 
 // Return an expression for the boolean value VAL.
-tree
-boolean_constant_expression (bool val);
+tree boolean_constant_expression (bool val);
 
 // Return an expression that converts EXPR to TYPE.
-tree
-convert_expression (tree type, tree expr, location_t);
+tree convert_expression (tree type, tree expr, location_t);
 
 // Return an expression for the field at INDEX in BSTRUCT.
-tree
-struct_field_expression (tree bstruct, size_t index, location_t);
+tree struct_field_expression (tree bstruct, size_t index, location_t);
 
 // Create an expression that executes BSTAT before BEXPR.
-tree
-compound_expression (tree bstat, tree bexpr, location_t);
+tree compound_expression (tree bstat, tree bexpr, location_t);
 
 // Return an expression that executes THEN_EXPR if CONDITION is true, or
 // ELSE_EXPR otherwise and returns the result as type BTYPE, within the
 // specified function FUNCTION.  ELSE_EXPR may be NULL.  BTYPE may be NULL.
-tree
-conditional_expression (tree function, tree btype, tree condition,
-                       tree then_expr, tree else_expr, location_t);
+tree conditional_expression (tree function, tree btype, tree condition,
+                            tree then_expr, tree else_expr, location_t);
 
 // Return an expression for the negation operation OP EXPR.
 // Supported values of OP are enumerated in NegationOperator.
-tree
-negation_expression (NegationOperator op, tree expr, location_t);
+tree negation_expression (NegationOperator op, tree expr, location_t);
 
 // Return an expression for the operation LEFT OP RIGHT.
 // Supported values of OP are enumerated in ArithmeticOrLogicalOperator.
-tree
-arithmetic_or_logical_expression (ArithmeticOrLogicalOperator op, tree left,
-                                 tree right, location_t loc);
+tree arithmetic_or_logical_expression (ArithmeticOrLogicalOperator op,
+                                      tree left, tree right, location_t loc);
 
 // Return an expression for the operation LEFT OP RIGHT.
 // Supported values of OP are enumerated in ArithmeticOrLogicalOperator.
 // This function adds overflow checking and returns a list of statements to
 // add to the current function context. The `receiver` variable refers to the
 // variable which will contain the result of that operation.
-tree
-arithmetic_or_logical_expression_checked (ArithmeticOrLogicalOperator op,
-                                         tree left, tree right, location_t loc,
-                                         Bvariable *receiver);
+tree arithmetic_or_logical_expression_checked (ArithmeticOrLogicalOperator op,
+                                              tree left, tree right,
+                                              location_t loc,
+                                              Bvariable *receiver);
 
 // Return an expression for the operation LEFT OP RIGHT.
 // Supported values of OP are enumerated in ComparisonOperator.
-tree
-comparison_expression (ComparisonOperator op, tree left, tree right,
-                      location_t loc);
+tree comparison_expression (ComparisonOperator op, tree left, tree right,
+                           location_t loc);
 
 // Return an expression for the operation LEFT OP RIGHT.
 // Supported values of OP are enumerated in LazyBooleanOperator.
-tree
-lazy_boolean_expression (LazyBooleanOperator op, tree left, tree right,
-                        location_t);
+tree lazy_boolean_expression (LazyBooleanOperator op, tree left, tree right,
+                             location_t);
 
 // Return an expression that constructs BTYPE with VALS.  BTYPE must be the
 // backend representation a of struct.  VALS must be in the same order as the
 // corresponding fields in BTYPE.
-tree
-constructor_expression (tree btype, bool is_variant,
-                       const std::vector<tree> &vals, int, location_t);
+tree constructor_expression (tree btype, bool is_variant,
+                            const std::vector<tree> &vals, int, location_t);
 
 // Return an expression that constructs an array of BTYPE with INDEXES and
 // VALS.  INDEXES and VALS must have the same amount of elements. Each index
 // in INDEXES must be in the same order as the corresponding value in VALS.
-tree
-array_constructor_expression (tree btype,
-                             const std::vector<unsigned long> &indexes,
-                             const std::vector<tree> &vals, location_t);
+tree array_constructor_expression (tree btype,
+                                  const std::vector<unsigned long> &indexes,
+                                  const std::vector<tree> &vals, location_t);
 
-tree
-array_initializer (tree, tree, tree, tree, tree, tree *, location_t);
+tree array_initializer (tree, tree, tree, tree, tree, tree *, location_t);
 
 // Return an expression for ARRAY[INDEX] as an l-value.  ARRAY is a valid
 // fixed-length array, not a slice.
-tree
-array_index_expression (tree array, tree index, location_t);
+tree array_index_expression (tree array, tree index, location_t);
 
 // Create an expression for a call to FN with ARGS, taking place within
 // caller CALLER.
-tree
-call_expression (tree fn, const std::vector<tree> &args, tree static_chain,
-                location_t);
+tree call_expression (tree fn, const std::vector<tree> &args, tree static_chain,
+                     location_t);
 
 // Statements.
 
 // Create a variable initialization statement in the specified
 // function.  This initializes a local variable at the point in the
 // program flow where it is declared.
-tree
-init_statement (tree, Bvariable *var, tree init);
+tree init_statement (tree, Bvariable *var, tree init);
 
 // Create an assignment statement within the specified function.
-tree
-assignment_statement (tree lhs, tree rhs, location_t);
+tree assignment_statement (tree lhs, tree rhs, location_t);
 
 // Create return statement for an decl for a value (can be NULL_TREE) at a
 // location
-tree
-return_statement (tree fndecl, tree val, location_t);
+tree return_statement (tree fndecl, tree val, location_t);
 
 // Create an if statement within a function.  ELSE_BLOCK may be NULL.
-tree
-if_statement (tree, tree condition, tree then_block, tree else_block,
-             location_t);
+tree if_statement (tree, tree condition, tree then_block, tree else_block,
+                  location_t);
 
 // infinite loop expressions
-tree
-loop_expression (tree body, location_t);
+tree loop_expression (tree body, location_t);
 
 // exit expressions
-tree
-exit_expression (tree condition, location_t);
+tree exit_expression (tree condition, location_t);
 
 // Create a single statement from two statements.
 tree compound_statement (tree, tree);
 
 // Create a single statement from a list of statements.
-tree
-statement_list (const std::vector<tree> &);
+tree statement_list (const std::vector<tree> &);
 
 // Create a statement that attempts to execute BSTAT and calls EXCEPT_STMT if
 // an exception occurs. EXCEPT_STMT may be NULL.  FINALLY_STMT may be NULL and
 // if not NULL, it will always be executed.  This is used for handling defers
 // in Go functions.  In C++, the resulting code is of this form:
 //   try { BSTAT; } catch { EXCEPT_STMT; } finally { FINALLY_STMT; }
-tree
-exception_handler_statement (tree bstat, tree except_stmt, tree finally_stmt,
-                            location_t);
+tree exception_handler_statement (tree bstat, tree except_stmt,
+                                 tree finally_stmt, location_t);
 
 // Blocks.
 
@@ -337,16 +293,14 @@ exception_handler_statement (tree bstat, tree except_stmt, tree finally_stmt,
 // the initial curly brace.  END_LOCATION is the location of the end
 // of the block, more or less the location of the final curly brace.
 // The statements will be added after the block is created.
-tree
-block (tree function, tree enclosing, const std::vector<Bvariable *> &vars,
-       location_t start_location, location_t end_location);
+tree block (tree function, tree enclosing, const std::vector<Bvariable *> &vars,
+           location_t start_location, location_t end_location);
 
 // Add the statements to a block.  The block is created first.  Then
 // the statements are created.  Then the statements are added to the
 // block.  This will called exactly once per block.  The vector may
 // be empty if there are no statements.
-void
-block_add_statements (tree, const std::vector<tree> &);
+void block_add_statements (tree, const std::vector<tree> &);
 
 // Variables.
 
@@ -360,10 +314,10 @@ block_add_statements (tree, const std::vector<tree> &);
 // be put into a unique section if possible; this is intended to
 // permit the linker to garbage collect the variable if it is not
 // referenced.  LOCATION is where the variable was defined.
-Bvariable *
-global_variable (const std::string &name, const std::string &asm_name,
-                tree btype, bool is_external, bool is_hidden,
-                bool in_unique_section, location_t location);
+Bvariable *global_variable (const std::string &name,
+                           const std::string &asm_name, tree btype,
+                           bool is_external, bool is_hidden,
+                           bool in_unique_section, location_t location);
 
 // A global variable will 1) be initialized to zero, or 2) be
 // initialized to a constant value, or 3) be initialized in the init
@@ -371,8 +325,7 @@ global_variable (const std::string &name, const std::string &asm_name,
 // global_variable_set_init to set the initial value.  If this is
 // not called, the backend should initialize a global variable to 0.
 // The init function may then assign a value to it.
-void
-global_variable_set_init (Bvariable *, tree);
+void global_variable_set_init (Bvariable *, tree);
 
 // Create a local variable.  The frontend will create the local
 // variables first, and then create the block which contains them.
@@ -386,21 +339,18 @@ global_variable_set_init (Bvariable *, tree);
 // the function, as otherwise the variable would be on the heap).
 // LOCATION is where the variable is defined.  For each local variable
 // the frontend will call init_statement to set the initial value.
-Bvariable *
-local_variable (tree function, const std::string &name, tree type,
-               Bvariable *decl_var, location_t location);
+Bvariable *local_variable (tree function, const std::string &name, tree type,
+                          Bvariable *decl_var, location_t location);
 
 // Create a function parameter.  This is an incoming parameter, not
 // a result parameter (result parameters are treated as local
 // variables).  The arguments are as for local_variable.
-Bvariable *
-parameter_variable (tree function, const std::string &name, tree type,
-                   location_t location);
+Bvariable *parameter_variable (tree function, const std::string &name,
+                              tree type, location_t location);
 
 // Create a static chain parameter.  This is the closure parameter.
-Bvariable *
-static_chain_variable (tree function, const std::string &name, tree type,
-                      location_t location);
+Bvariable *static_chain_variable (tree function, const std::string &name,
+                                 tree type, location_t location);
 
 // Create a temporary variable.  A temporary variable has no name,
 // just a type.  We pass in FUNCTION and BLOCK in case they are
@@ -413,18 +363,16 @@ static_chain_variable (tree function, const std::string &name, tree type,
 // variable, and may not be very useful.  This function should
 // return a variable which can be referenced later and should set
 // *PSTATEMENT to a statement which initializes the variable.
-Bvariable *
-temporary_variable (tree fndecl, tree bind_tree, tree type, tree init,
-                   bool address_is_taken, location_t location,
-                   tree *pstatement);
+Bvariable *temporary_variable (tree fndecl, tree bind_tree, tree type,
+                              tree init, bool address_is_taken,
+                              location_t location, tree *pstatement);
 
 // Labels.
 
 // Create a new label.  NAME will be empty if this is a label
 // created by the frontend for a loop construct.  The location is
 // where the label is defined.
-tree
-label (tree, const std::string &name, location_t);
+tree label (tree, const std::string &name, location_t);
 
 // Create a statement which defines a label.  This statement will be
 // put into the codestream at the point where the label should be
@@ -464,39 +412,34 @@ static const unsigned int function_in_unique_section = 1 << 3;
 // string, is the name that should be used in the symbol table; this
 // will be non-empty if a magic extern comment is used.  FLAGS is
 // bit flags described above.
-tree
-function (tree fntype, const std::string &name, const std::string &asm_name,
-         unsigned int flags, location_t);
+tree function (tree fntype, const std::string &name,
+              const std::string &asm_name, unsigned int flags, location_t);
 
 // Create a statement that runs all deferred calls for FUNCTION.  This should
 // be a statement that looks like this in C++:
 //   finish:
 //     try { DEFER_RETURN; } catch { CHECK_DEFER; goto finish; }
-tree
-function_defer_statement (tree function, tree undefer, tree check_defer,
-                         location_t);
+tree function_defer_statement (tree function, tree undefer, tree check_defer,
+                              location_t);
 
 // Record PARAM_VARS as the variables to use for the parameters of FUNCTION.
 // This will only be called for a function definition.  Returns true on
 // success, false on failure.
-bool
-function_set_parameters (tree function,
-                        const std::vector<Bvariable *> &param_vars);
+bool function_set_parameters (tree function,
+                             const std::vector<Bvariable *> &param_vars);
 
 // Utility.
 
 // Write the definitions for all TYPE_DECLS, CONSTANT_DECLS,
 // FUNCTION_DECLS, and VARIABLE_DECLS declared globally.
-void
-write_global_definitions (const std::vector<tree> &type_decls,
-                         const std::vector<tree> &constant_decls,
-                         const std::vector<tree> &function_decls,
-                         const std::vector<Bvariable *> &variable_decls);
+void write_global_definitions (const std::vector<tree> &type_decls,
+                              const std::vector<tree> &constant_decls,
+                              const std::vector<tree> &function_decls,
+                              const std::vector<Bvariable *> &variable_decls);
 
 // TODO: make static
 
-tree
-fill_in_fields (tree, const std::vector<typed_identifier> &, bool);
+tree fill_in_fields (tree, const std::vector<typed_identifier> &, bool);
 
 tree fill_in_array (tree, tree, tree);
 
index 702da718df94602d2f60bfcc44a3a29e92771c16..5965bb4588cdb866f93c67e3be24b7a2549eb0fe 100644 (file)
@@ -48,27 +48,33 @@ expand_format (const char *fmt)
       c++;
       switch (*c)
        {
-         case '\0': {
+       case '\0':
+         {
            // malformed format string
            rust_unreachable ();
          }
-         case '%': {
+       case '%':
+         {
            ss << "%";
            break;
          }
-         case 'm': {
+       case 'm':
+         {
            ss << mformat_value ();
            break;
          }
-         case '<': {
+       case '<':
+         {
            ss << rust_open_quote ();
            break;
          }
-         case '>': {
+       case '>':
+         {
            ss << rust_close_quote ();
            break;
          }
-         case 'q': {
+       case 'q':
+         {
            ss << rust_open_quote ();
            c++;
            if (*c == 'm')
@@ -82,7 +88,8 @@ expand_format (const char *fmt)
            ss << rust_close_quote ();
            break;
          }
-         default: {
+       default:
+         {
            ss << "%" << *c;
          }
        }
@@ -104,8 +111,8 @@ expand_format (const char *fmt)
 // calling function must need to have attribute gnu_printf as well, even
 // though there is already an attribute declaration for it.
 
-static std::string
-expand_message (const char *fmt, va_list ap) RUST_ATTRIBUTE_GCC_DIAG (1, 0);
+static std::string expand_message (const char *fmt, va_list ap)
+  RUST_ATTRIBUTE_GCC_DIAG (1, 0);
 
 #pragma GCC diagnostic push
 #pragma GCC diagnostic ignored "-Wsuggest-attribute=format"
@@ -420,24 +427,24 @@ namespace Rust {
  */
 
 // simple location
-static Error
-va_constructor (Error::Kind kind, location_t locus, const char *fmt,
-               va_list args) RUST_ATTRIBUTE_GCC_DIAG (3, 0);
+static Error va_constructor (Error::Kind kind, location_t locus,
+                            const char *fmt, va_list args)
+  RUST_ATTRIBUTE_GCC_DIAG (3, 0);
 
 // simple location + error code
-static Error
-va_constructor (Error::Kind kind, location_t locus, const ErrorCode code,
-               const char *fmt, va_list args) RUST_ATTRIBUTE_GCC_DIAG (4, 0);
+static Error va_constructor (Error::Kind kind, location_t locus,
+                            const ErrorCode code, const char *fmt,
+                            va_list args) RUST_ATTRIBUTE_GCC_DIAG (4, 0);
 
 // rich location
-static Error
-va_constructor (Error::Kind kind, rich_location *r_locus, const char *fmt,
-               va_list args) RUST_ATTRIBUTE_GCC_DIAG (3, 0);
+static Error va_constructor (Error::Kind kind, rich_location *r_locus,
+                            const char *fmt, va_list args)
+  RUST_ATTRIBUTE_GCC_DIAG (3, 0);
 
 // rich location + error code
-static Error
-va_constructor (Error::Kind kind, rich_location *r_locus, const ErrorCode code,
-               const char *fmt, va_list args) RUST_ATTRIBUTE_GCC_DIAG (4, 0);
+static Error va_constructor (Error::Kind kind, rich_location *r_locus,
+                            const ErrorCode code, const char *fmt,
+                            va_list args) RUST_ATTRIBUTE_GCC_DIAG (4, 0);
 
 // simple location
 static Error
index a13dc6a2eaf8695d7ec97ff10a817c86bf1abf8a..0b83e8ca2d8149c388a7276f576425768b70cd5f 100644 (file)
@@ -31,7 +31,7 @@
 #if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 1)
 #define RUST_ATTRIBUTE_GCC_DIAG(m, n)                                          \
   __attribute__ ((__format__ (__gcc_tdiag__, m, n)))                           \
-    __attribute__ ((__nonnull__ (m)))
+  __attribute__ ((__nonnull__ (m)))
 #else
 #define RUST_ATTRIBUTE_GCC_DIAG(m, n)
 #endif
@@ -119,10 +119,8 @@ rust_error_at(rich_location *richloc, const ErrorCode, const char *fmt, ...)
 // These interfaces provide a way for the front end to ask for
 // the open/close quote characters it should use when formatting
 // diagnostics (warnings, errors).
-extern const char *
-rust_open_quote ();
-extern const char *
-rust_close_quote ();
+extern const char *rust_open_quote ();
+extern const char *rust_close_quote ();
 
 // These interfaces are used by utilities above to pass warnings and
 // errors (once format specifiers have been expanded) to the back end,
@@ -306,8 +304,7 @@ struct Error
 
 #define rust_sorry_at(location, ...) sorry_at (location, __VA_ARGS__)
 
-void
-rust_debug_loc (const location_t location, const char *fmt,
-               ...) ATTRIBUTE_PRINTF_2;
+void rust_debug_loc (const location_t location, const char *fmt,
+                    ...) ATTRIBUTE_PRINTF_2;
 
 #endif // !defined(RUST_DIAGNOSTICS_H)
index e5319d320800743360a9186f7a1842a37c40d541..f440f79801b3bbd9a9170eccfe7d025b07a43ec5 100644 (file)
@@ -1876,7 +1876,8 @@ non_zero_size_type (tree type)
        }
       return rust_non_zero_struct;
 
-      case ARRAY_TYPE: {
+    case ARRAY_TYPE:
+      {
        tree element_type = non_zero_size_type (TREE_TYPE (type));
        return build_array_type_nelts (element_type, 1);
       }
index fe055c3ec05799030110bad5853391aff10ea3af..784fef31f391c1d53b14465085cb39c800451114 100644 (file)
 
 #include "rust-system.h"
 
-extern unsigned int
-rust_field_alignment (tree t);
-
-extern const char *
-rust_read_export_data (int fd, off_t offset, char **pbuf, size_t *plen,
-                      int *perr);
-extern void
-rust_write_export_data (const char *bytes, unsigned int size);
+extern unsigned int rust_field_alignment (tree t);
+
+extern const char *rust_read_export_data (int fd, off_t offset, char **pbuf,
+                                         size_t *plen, int *perr);
+extern void rust_write_export_data (const char *bytes, unsigned int size);
 
 #endif // RUST_OBJECT_EXPORT_H
index 09f7e2ee4efbbede6e347458dcb4224fa02eef90..d42ae6a3fda59d15be50d01dbc2534d2473a4573 100644 (file)
 #include "tm.h"
 #include "rust-target.h"
 
-extern bool
-saw_errors (void);
+extern bool saw_errors (void);
 
-extern Linemap *
-rust_get_linemap ();
+extern Linemap *rust_get_linemap ();
 
 namespace Rust {
 
@@ -151,9 +149,9 @@ validate_crate_name (const std::string &crate_name, Error &error)
     {
       if (!(is_alphabetic (c.value) || is_numeric (c.value) || c.value == '_'))
        {
-         error = Error (UNDEF_LOCATION,
-                        "invalid character %qs in crate name: %qs",
-                        c.as_string ().c_str (), crate_name.c_str ());
+         error
+           = Error (UNDEF_LOCATION, "invalid character %qs in crate name: %qs",
+                    c.as_string ().c_str (), crate_name.c_str ());
          return false;
        }
     }
@@ -204,14 +202,16 @@ Session::handle_option (
   switch (code)
     {
     case OPT_I:
-      case OPT_L: {
+    case OPT_L:
+      {
        // TODO: add search path
        const std::string p = std::string (arg);
        add_search_path (p);
       }
       break;
 
-      case OPT_frust_extern_: {
+    case OPT_frust_extern_:
+      {
        std::string input (arg);
        ret = handle_extern_option (input);
       }
@@ -252,7 +252,8 @@ Session::handle_option (
       Compile::Mangler::set_mangling (flag_rust_mangling);
       break;
 
-      case OPT_frust_cfg_: {
+    case OPT_frust_cfg_:
+      {
        auto string_arg = std::string (arg);
        ret = handle_cfg_option (string_arg);
        break;
@@ -1110,8 +1111,7 @@ Session::load_extern_crate (const std::string &crate_name, location_t locus)
   if (stream == NULL          // No stream and
       && proc_macros.empty ()) // no proc macros
     {
-      rust_error_at (locus, "failed to locate crate %qs",
-                    import_name.c_str ());
+      rust_error_at (locus, "failed to locate crate %qs", import_name.c_str ());
       return UNKNOWN_NODEID;
     }
 
index 83ba121e411627304691f91430826ac2623bc64b..9af103cbd7325e8ef224bf023c7f489eafe19551 100644 (file)
@@ -441,8 +441,7 @@ private:
 
 #if CHECKING_P
 namespace selftest {
-extern void
-rust_crate_name_validation_test (void);
+extern void rust_crate_name_validation_test (void);
 }
 #endif // CHECKING_P
 
index 986428b08195429a5e0a3118243f9e66fdd2a07d..a4551239f3ab5f118db13c29e8f159cb6ae13030 100644 (file)
@@ -88,10 +88,8 @@ constexpr static const char *file_separator = "/";
  */
 #define rust_unreachable() (fancy_abort (__FILE__, __LINE__, __FUNCTION__))
 
-extern void
-rust_preserve_from_gc (tree t);
+extern void rust_preserve_from_gc (tree t);
 
-extern const char *
-rust_localize_identifier (const char *ident);
+extern const char *rust_localize_identifier (const char *ident);
 
 #endif // !defined(RUST_SYSTEM_H)
index dbc2baff29bd4205b338c1b6cbdabcfea1f94d42..e61ea5112c150a17e54d0d7a84c7131f3723c825 100644 (file)
@@ -26,8 +26,7 @@
 #include "rust-target.def"
 
 /* Used by target to add target-related info.  */
-extern void
-rust_add_target_info (const char *, const char *);
+extern void rust_add_target_info (const char *, const char *);
 
 /* Each target can provide their own.  */
 extern struct gcc_targetrustm targetrustm;
index 6aa20a8c941415c1635f8e04b14a21e943159bc7..825607431f07df8d4c5f8100f6e4d890e057d51f 100644 (file)
@@ -26,8 +26,7 @@
 namespace Rust {
 namespace Resolver {
 
-static bool
-resolve_operator_overload_fn (
+static bool resolve_operator_overload_fn (
   LangItem::Kind lang_item_type, TyTy::BaseType *ty, TyTy::FnType **resolved_fn,
   Adjustment::AdjustmentType *requires_ref_adjustment);
 
index 90bdef1fd3c14b9c606ecc7f8b4ee2c4b762858b..d0a9f5dca015c42f3ed48eff7c7f3220aa80e375 100644 (file)
@@ -73,7 +73,8 @@ TypeCastRules::cast_rules ()
              to.get_ty ()->debug_str ().c_str ());
   switch (from_type->get_kind ())
     {
-      case TyTy::TypeKind::INFER: {
+    case TyTy::TypeKind::INFER:
+      {
        TyTy::InferType *from_infer
          = static_cast<TyTy::InferType *> (from_type);
        switch (from_infer->get_infer_kind ())
@@ -85,7 +86,8 @@ TypeCastRules::cast_rules ()
          case TyTy::InferType::InferTypeKind::INTEGRAL:
            switch (to.get_ty ()->get_kind ())
              {
-               case TyTy::TypeKind::CHAR: {
+             case TyTy::TypeKind::CHAR:
+               {
                  // only u8 and char
                  bool was_uint
                    = from.get_ty ()->get_kind () == TyTy::TypeKind::UINT;
@@ -108,7 +110,8 @@ TypeCastRules::cast_rules ()
                return TypeCoercionRules::CoercionResult{
                  {}, to.get_ty ()->clone ()};
 
-               case TyTy::TypeKind::INFER: {
+             case TyTy::TypeKind::INFER:
+               {
                  TyTy::InferType *to_infer
                    = static_cast<TyTy::InferType *> (to.get_ty ());
 
@@ -140,7 +143,8 @@ TypeCastRules::cast_rules ()
                return TypeCoercionRules::CoercionResult{
                  {}, to.get_ty ()->clone ()};
 
-               case TyTy::TypeKind::INFER: {
+             case TyTy::TypeKind::INFER:
+               {
                  TyTy::InferType *to_infer
                    = static_cast<TyTy::InferType *> (to.get_ty ());
 
@@ -187,7 +191,8 @@ TypeCastRules::cast_rules ()
     case TyTy::TypeKind::INT:
       switch (to.get_ty ()->get_kind ())
        {
-         case TyTy::TypeKind::CHAR: {
+       case TyTy::TypeKind::CHAR:
+         {
            // only u8 and char
            bool was_uint = from.get_ty ()->get_kind () == TyTy::TypeKind::UINT;
            bool was_u8 = was_uint
@@ -200,7 +205,8 @@ TypeCastRules::cast_rules ()
          }
          break;
 
-         case TyTy::TypeKind::FLOAT: {
+       case TyTy::TypeKind::FLOAT:
+         {
            // can only do this for number types not char
            bool from_char
              = from.get_ty ()->get_kind () == TyTy::TypeKind::CHAR;
@@ -210,7 +216,8 @@ TypeCastRules::cast_rules ()
          }
          break;
 
-         case TyTy::TypeKind::POINTER: {
+       case TyTy::TypeKind::POINTER:
+         {
            // char can't be casted as a ptr
            bool from_char
              = from.get_ty ()->get_kind () == TyTy::TypeKind::CHAR;
@@ -244,7 +251,8 @@ TypeCastRules::cast_rules ()
        case TyTy::TypeKind::FLOAT:
          return TypeCoercionRules::CoercionResult{{}, to.get_ty ()->clone ()};
 
-         case TyTy::TypeKind::INFER: {
+       case TyTy::TypeKind::INFER:
+         {
            TyTy::InferType *to_infer
              = static_cast<TyTy::InferType *> (to.get_ty ());
 
@@ -273,7 +281,8 @@ TypeCastRules::cast_rules ()
        case TyTy::TypeKind::USIZE:
        case TyTy::TypeKind::ISIZE:
        case TyTy::TypeKind::UINT:
-         case TyTy::TypeKind::INT: {
+       case TyTy::TypeKind::INT:
+         {
            // refs should not cast to numeric type
            bool from_ptr
              = from.get_ty ()->get_kind () == TyTy::TypeKind::POINTER;
index 5905992426c234517c1c2118dadf9c238f2e60ef..3a92a2f2f6ee48f0c3e792cedc006a751e60299b 100644 (file)
@@ -125,13 +125,15 @@ TypeCoercionRules::do_coercion (TyTy::BaseType *receiver)
   // pointers
   switch (expected->get_kind ())
     {
-      case TyTy::TypeKind::POINTER: {
+    case TyTy::TypeKind::POINTER:
+      {
        TyTy::PointerType *ptr = static_cast<TyTy::PointerType *> (expected);
        try_result = coerce_unsafe_ptr (receiver, ptr, ptr->mutability ());
        return !try_result.is_error ();
       }
 
-      case TyTy::TypeKind::REF: {
+    case TyTy::TypeKind::REF:
+      {
        TyTy::ReferenceType *ptr
          = static_cast<TyTy::ReferenceType *> (expected);
        try_result
@@ -147,7 +149,8 @@ TypeCoercionRules::do_coercion (TyTy::BaseType *receiver)
   // https://github.com/rust-lang/rust/blob/7eac88abb2e57e752f3302f02be5f3ce3d7adfb4/compiler/rustc_typeck/src/check/coercion.rs#L210
   switch (receiver->get_kind ())
     {
-      default: {
+    default:
+      {
        rust_debug (
          "do_coercion default unify and infer expected: %s receiver %s",
          receiver->debug_str ().c_str (), expected->debug_str ().c_str ());
@@ -182,7 +185,8 @@ TypeCoercionRules::coerce_unsafe_ptr (TyTy::BaseType *receiver,
   TyTy::BaseType *element = nullptr;
   switch (receiver->get_kind ())
     {
-      case TyTy::TypeKind::REF: {
+    case TyTy::TypeKind::REF:
+      {
        TyTy::ReferenceType *ref
          = static_cast<TyTy::ReferenceType *> (receiver);
        from_mutbl = ref->mutability ();
@@ -190,14 +194,16 @@ TypeCoercionRules::coerce_unsafe_ptr (TyTy::BaseType *receiver,
       }
       break;
 
-      case TyTy::TypeKind::POINTER: {
+    case TyTy::TypeKind::POINTER:
+      {
        TyTy::PointerType *ref = static_cast<TyTy::PointerType *> (receiver);
        from_mutbl = ref->mutability ();
        element = ref->get_base ();
       }
       break;
 
-      default: {
+    default:
+      {
        // FIXME this can probably turn into a unify_and
        if (receiver->can_eq (expected, false))
          return CoercionResult{{}, expected->clone ()};
@@ -264,14 +270,16 @@ TypeCoercionRules::coerce_borrowed_pointer (TyTy::BaseType *receiver,
   Mutability from_mutbl = Mutability::Imm;
   switch (receiver->get_kind ())
     {
-      case TyTy::TypeKind::REF: {
+    case TyTy::TypeKind::REF:
+      {
        TyTy::ReferenceType *from
          = static_cast<TyTy::ReferenceType *> (receiver);
        from_mutbl = from->mutability ();
       }
       break;
 
-      default: {
+    default:
+      {
        // FIXME
        // we might be able to replace this with a can_eq because we default
        // back to a final unity anyway
index 032bb5841272f019ba25a0acc2a3f6ef30fe5467..35c9b0a6a2d32876d894f3b4b6d5ee8907e556dc 100644 (file)
@@ -224,7 +224,8 @@ TraitResolver::resolve_trait (HIR::Trait *trait_reference)
          // handling.
          break;
 
-         case HIR::GenericParam::GenericKind::TYPE: {
+       case HIR::GenericParam::GenericKind::TYPE:
+         {
            auto &typaram = static_cast<HIR::TypeParam &> (*generic_param);
            bool is_self
              = typaram.get_type_representation ().as_string ().compare ("Self")
@@ -543,7 +544,8 @@ AssociatedImplTrait::setup_associated_types (
          // handling.
          break;
 
-         case HIR::GenericParam::GenericKind::TYPE: {
+       case HIR::GenericParam::GenericKind::TYPE:
+         {
            TyTy::BaseType *l = nullptr;
            bool ok = context->lookup_type (
              generic_param->get_mappings ().get_hirid (), &l);
@@ -753,7 +755,8 @@ TraitItemReference::is_object_safe () const
   // https://doc.rust-lang.org/reference/items/traits.html#object-safety
   switch (get_trait_item_type ())
     {
-      case TraitItemReference::TraitItemType::FN: {
+    case TraitItemReference::TraitItemType::FN:
+      {
        // lets be boring and just check that this is indeed a method will do
        // for now
        const HIR::TraitItem *item = get_hir_trait_item ();
index 14b8ab8635e1f417baf5ccb2aa3ae1d201f49116..6d5806f967f8bddc09570498f89e661894002363 100644 (file)
@@ -124,7 +124,8 @@ TypeCheckBase::resolve_literal (const Analysis::NodeMapping &expr_mappings,
   TyTy::BaseType *infered = nullptr;
   switch (literal.get_lit_type ())
     {
-      case HIR::Literal::LitType::INT: {
+    case HIR::Literal::LitType::INT:
+      {
        bool ok = false;
 
        switch (literal.get_type_hint ())
@@ -191,7 +192,8 @@ TypeCheckBase::resolve_literal (const Analysis::NodeMapping &expr_mappings,
       }
       break;
 
-      case HIR::Literal::LitType::FLOAT: {
+    case HIR::Literal::LitType::FLOAT:
+      {
        bool ok = false;
 
        switch (literal.get_type_hint ())
@@ -216,25 +218,29 @@ TypeCheckBase::resolve_literal (const Analysis::NodeMapping &expr_mappings,
       }
       break;
 
-      case HIR::Literal::LitType::BOOL: {
+    case HIR::Literal::LitType::BOOL:
+      {
        auto ok = context->lookup_builtin ("bool", &infered);
        rust_assert (ok);
       }
       break;
 
-      case HIR::Literal::LitType::CHAR: {
+    case HIR::Literal::LitType::CHAR:
+      {
        auto ok = context->lookup_builtin ("char", &infered);
        rust_assert (ok);
       }
       break;
 
-      case HIR::Literal::LitType::BYTE: {
+    case HIR::Literal::LitType::BYTE:
+      {
        auto ok = context->lookup_builtin ("u8", &infered);
        rust_assert (ok);
       }
       break;
 
-      case HIR::Literal::LitType::STRING: {
+    case HIR::Literal::LitType::STRING:
+      {
        TyTy::BaseType *base = nullptr;
        auto ok = context->lookup_builtin ("str", &base);
        rust_assert (ok);
@@ -246,7 +252,8 @@ TypeCheckBase::resolve_literal (const Analysis::NodeMapping &expr_mappings,
       }
       break;
 
-      case HIR::Literal::LitType::BYTE_STRING: {
+    case HIR::Literal::LitType::BYTE_STRING:
+      {
        /* This is an arraytype of u8 reference (&[u8;size]). It isn't in
           UTF-8, but really just a byte array. Code to construct the array
           reference copied from ArrayElemsValues and ArrayType. */
@@ -440,7 +447,8 @@ TypeCheckBase::resolve_generic_params (
     {
       switch (generic_param->get_kind ())
        {
-         case HIR::GenericParam::GenericKind::LIFETIME: {
+       case HIR::GenericParam::GenericKind::LIFETIME:
+         {
            auto lifetime_param
              = static_cast<HIR::LifetimeParam &> (*generic_param);
            auto lifetime = lifetime_param.get_lifetime ();
@@ -449,7 +457,8 @@ TypeCheckBase::resolve_generic_params (
          }
          break;
 
-         case HIR::GenericParam::GenericKind::CONST: {
+       case HIR::GenericParam::GenericKind::CONST:
+         {
            if (is_foreign && abi != Rust::ABI::INTRINSIC)
              {
                rust_error_at (generic_param->get_locus (), ErrorCode::E0044,
@@ -478,7 +487,8 @@ TypeCheckBase::resolve_generic_params (
          }
          break;
 
-         case HIR::GenericParam::GenericKind::TYPE: {
+       case HIR::GenericParam::GenericKind::TYPE:
+         {
            if (is_foreign && abi != Rust::ABI::INTRINSIC)
              {
                rust_error_at (generic_param->get_locus (), ErrorCode::E0044,
index 7283d01d5a3c50b13000987e6c0fa5f03f0ca1eb..905d669b3545b9104c3ac370d66c7bae93d52913 100644 (file)
@@ -373,7 +373,8 @@ TypeCheckExpr::visit (HIR::ArithmeticOrLogicalExpr &expr)
   switch (expr.get_expr_type ())
     {
     case ArithmeticOrLogicalOperator::LEFT_SHIFT:
-      case ArithmeticOrLogicalOperator::RIGHT_SHIFT: {
+    case ArithmeticOrLogicalOperator::RIGHT_SHIFT:
+      {
        TyTy::TyWithLocation from (rhs, expr.get_rhs ().get_locus ());
        TyTy::TyWithLocation to (lhs, expr.get_lhs ().get_locus ());
        infered = cast_site (expr.get_mappings ().get_hirid (), from, to,
@@ -381,7 +382,8 @@ TypeCheckExpr::visit (HIR::ArithmeticOrLogicalExpr &expr)
       }
       break;
 
-      default: {
+    default:
+      {
        infered = unify_site (
          expr.get_mappings ().get_hirid (),
          TyTy::TyWithLocation (lhs, expr.get_lhs ().get_locus ()),
@@ -470,7 +472,8 @@ TypeCheckExpr::visit (HIR::NegationExpr &expr)
   // https://doc.rust-lang.org/reference/expressions/operator-expr.html#negation-operators
   switch (expr.get_expr_type ())
     {
-      case NegationOperator::NEGATE: {
+    case NegationOperator::NEGATE:
+      {
        bool valid
          = (negated_expr_ty->get_kind () == TyTy::TypeKind::INT)
            || (negated_expr_ty->get_kind () == TyTy::TypeKind::UINT)
@@ -492,7 +495,8 @@ TypeCheckExpr::visit (HIR::NegationExpr &expr)
       }
       break;
 
-      case NegationOperator::NOT: {
+    case NegationOperator::NOT:
+      {
        bool valid
          = (negated_expr_ty->get_kind () == TyTy::TypeKind::BOOL)
            || (negated_expr_ty->get_kind () == TyTy::TypeKind::INT)
@@ -790,38 +794,45 @@ typecheck_inline_asm_operand (HIR::InlineAsm &expr)
     {
       switch (operand.get_register_type ())
        {
-         case RegisterType::In: {
+       case RegisterType::In:
+         {
            auto in = operand.get_in ();
            TypeCheckExpr::Resolve (*in.expr);
            break;
          }
-         case RegisterType::Out: {
+       case RegisterType::Out:
+         {
            auto out = operand.get_out ();
            TypeCheckExpr::Resolve (*out.expr);
            break;
          }
-         case RegisterType::InOut: {
+       case RegisterType::InOut:
+         {
            auto in_out = operand.get_in_out ();
            TypeCheckExpr::Resolve (*in_out.expr);
            break;
          }
-         case RegisterType::SplitInOut: {
+       case RegisterType::SplitInOut:
+         {
            auto split_in_out = operand.get_split_in_out ();
            TypeCheckExpr::Resolve (*split_in_out.in_expr);
            TypeCheckExpr::Resolve (*split_in_out.out_expr);
            break;
          }
-         case RegisterType::Const: {
+       case RegisterType::Const:
+         {
            auto anon_const = operand.get_const ().anon_const;
            TypeCheckExpr::Resolve (*anon_const.expr);
            break;
          }
-         case RegisterType::Sym: {
+       case RegisterType::Sym:
+         {
            auto sym = operand.get_sym ();
            TypeCheckExpr::Resolve (*sym.expr);
            break;
          }
-         case RegisterType::Label: {
+       case RegisterType::Label:
+         {
            auto label = operand.get_label ();
            TypeCheckExpr::Resolve (*label.expr);
            break;
@@ -996,8 +1007,7 @@ TypeCheckExpr::visit (HIR::ArrayIndexExpr &expr)
   rich_location r (line_table, expr.get_locus ());
   r.add_range (expr.get_array_expr ().get_locus ());
   r.add_range (expr.get_index_expr ().get_locus ());
-  rust_error_at (r, ErrorCode::E0277,
-                "the type %qs cannot be indexed by %qs",
+  rust_error_at (r, ErrorCode::E0277, "the type %qs cannot be indexed by %qs",
                 array_expr_ty->get_name ().c_str (),
                 index_expr_ty->get_name ().c_str ());
 }
@@ -1011,7 +1021,8 @@ TypeCheckExpr::visit (HIR::ArrayExpr &expr)
   TyTy::BaseType *element_type = nullptr;
   switch (elements.get_array_expr_type ())
     {
-      case HIR::ArrayElems::ArrayExprType::COPIED: {
+    case HIR::ArrayElems::ArrayExprType::COPIED:
+      {
        HIR::ArrayElemsCopied &elems
          = static_cast<HIR::ArrayElemsCopied &> (elements);
        element_type = TypeCheckExpr::Resolve (elems.get_elem_to_copy ());
@@ -1035,7 +1046,8 @@ TypeCheckExpr::visit (HIR::ArrayExpr &expr)
       }
       break;
 
-      case HIR::ArrayElems::ArrayExprType::VALUES: {
+    case HIR::ArrayElems::ArrayExprType::VALUES:
+      {
        HIR::ArrayElemsValues &elems
          = static_cast<HIR::ArrayElemsValues &> (elements);
 
index bc7f6dc58c4822b65ddde79304e89354efdb6dda..168a934fa540329b6aa095d1cb1b00191f0c1d26 100644 (file)
@@ -266,7 +266,8 @@ TypeCheckImplItem::visit (HIR::Function &function)
              self_type = self->clone ();
              break;
 
-             case HIR::SelfParam::IMM_REF: {
+           case HIR::SelfParam::IMM_REF:
+             {
                tl::optional<TyTy::Region> region;
                if (self_param.has_lifetime ())
                  {
@@ -290,7 +291,8 @@ TypeCheckImplItem::visit (HIR::Function &function)
              }
              break;
 
-             case HIR::SelfParam::MUT_REF: {
+           case HIR::SelfParam::MUT_REF:
+             {
                tl::optional<TyTy::Region> region;
                if (self_param.has_lifetime ())
                  {
@@ -494,10 +496,9 @@ TypeCheckImplItemWithTrait::visit (HIR::ConstantItem &constant)
       rich_location r (line_table, constant.get_locus ());
       r.add_range (resolved_trait_item.get_locus ());
 
-      rust_error_at (
-       r, "constant %qs has an incompatible type for trait %qs",
-       constant.get_identifier ().as_string ().c_str (),
-       trait_reference.get_name ().c_str ());
+      rust_error_at (r, "constant %qs has an incompatible type for trait %qs",
+                    constant.get_identifier ().as_string ().c_str (),
+                    trait_reference.get_name ().c_str ());
     }
 }
 
@@ -545,10 +546,9 @@ TypeCheckImplItemWithTrait::visit (HIR::TypeAlias &type)
       rich_location r (line_table, type.get_locus ());
       r.add_range (resolved_trait_item.get_locus ());
 
-      rust_error_at (
-       r, "type alias %qs has an incompatible type for trait %qs",
-       type.get_new_type_name ().as_string ().c_str (),
-       trait_reference.get_name ().c_str ());
+      rust_error_at (r, "type alias %qs has an incompatible type for trait %qs",
+                    type.get_new_type_name ().as_string ().c_str (),
+                    trait_reference.get_name ().c_str ());
     }
 
   // its actually a projection, since we need a way to actually bind the
index bd13f7a561856614690a99cc5e80c09144ee4874..102083bd84c33e93f1d530413ac032c33d1b36fe 100644 (file)
@@ -213,13 +213,15 @@ TypeCheckPattern::visit (HIR::TupleStructPattern &pattern)
   auto &items = pattern.get_items ();
   switch (items.get_item_type ())
     {
-      case HIR::TupleStructItems::RANGED: {
+    case HIR::TupleStructItems::RANGED:
+      {
        // TODO
        rust_unreachable ();
       }
       break;
 
-      case HIR::TupleStructItems::MULTIPLE: {
+    case HIR::TupleStructItems::MULTIPLE:
+      {
        HIR::TupleStructItemsNoRange &items_no_range
          = static_cast<HIR::TupleStructItemsNoRange &> (items);
 
@@ -333,13 +335,15 @@ TypeCheckPattern::visit (HIR::StructPattern &pattern)
     {
       switch (field->get_item_type ())
        {
-         case HIR::StructPatternField::ItemType::TUPLE_PAT: {
+       case HIR::StructPatternField::ItemType::TUPLE_PAT:
+         {
            // TODO
            rust_unreachable ();
          }
          break;
 
-         case HIR::StructPatternField::ItemType::IDENT_PAT: {
+       case HIR::StructPatternField::ItemType::IDENT_PAT:
+         {
            HIR::StructPatternFieldIdentPat &ident
              = static_cast<HIR::StructPatternFieldIdentPat &> (*field);
 
@@ -358,7 +362,8 @@ TypeCheckPattern::visit (HIR::StructPattern &pattern)
          }
          break;
 
-         case HIR::StructPatternField::ItemType::IDENT: {
+       case HIR::StructPatternField::ItemType::IDENT:
+         {
            HIR::StructPatternFieldIdent &ident
              = static_cast<HIR::StructPatternFieldIdent &> (*field);
 
@@ -397,7 +402,8 @@ TypeCheckPattern::visit (HIR::StructPattern &pattern)
            case HIR::StructPatternField::ItemType::IDENT:
            case HIR::StructPatternField::ItemType::IDENT_PAT:
              break;
-             default: {
+           default:
+             {
                auto first_elem
                  = struct_pattern_elems.get_struct_pattern_fields ()
                      .at (0)
@@ -459,7 +465,8 @@ TypeCheckPattern::visit (HIR::TuplePattern &pattern)
   std::unique_ptr<HIR::TuplePatternItems> items;
   switch (pattern.get_items ().get_item_type ())
     {
-      case HIR::TuplePatternItems::ItemType::MULTIPLE: {
+    case HIR::TuplePatternItems::ItemType::MULTIPLE:
+      {
        auto &ref = static_cast<HIR::TuplePatternItemsMultiple &> (
          pattern.get_items ());
 
@@ -498,7 +505,8 @@ TypeCheckPattern::visit (HIR::TuplePattern &pattern)
       }
       break;
 
-      case HIR::TuplePatternItems::ItemType::RANGED: {
+    case HIR::TuplePatternItems::ItemType::RANGED:
+      {
        // HIR::TuplePatternItemsRanged &ref
        //   = *static_cast<HIR::TuplePatternItemsRanged *> (
        //     pattern.get_items ().get ());
@@ -608,7 +616,8 @@ TypeCheckPattern::typecheck_range_pattern_bound (
   TyTy::BaseType *resolved_bound = nullptr;
   switch (bound.get_bound_type ())
     {
-      case HIR::RangePatternBound::RangePatternBoundType::LITERAL: {
+    case HIR::RangePatternBound::RangePatternBoundType::LITERAL:
+      {
        auto &ref = static_cast<HIR::RangePatternBoundLiteral &> (bound);
 
        HIR::Literal lit = ref.get_literal ();
@@ -617,14 +626,16 @@ TypeCheckPattern::typecheck_range_pattern_bound (
       }
       break;
 
-      case HIR::RangePatternBound::RangePatternBoundType::PATH: {
+    case HIR::RangePatternBound::RangePatternBoundType::PATH:
+      {
        auto &ref = static_cast<HIR::RangePatternBoundPath &> (bound);
 
        resolved_bound = TypeCheckExpr::Resolve (ref.get_path ());
       }
       break;
 
-      case HIR::RangePatternBound::RangePatternBoundType::QUALPATH: {
+    case HIR::RangePatternBound::RangePatternBoundType::QUALPATH:
+      {
        auto &ref = static_cast<HIR::RangePatternBoundQualPath &> (bound);
 
        resolved_bound = TypeCheckExpr::Resolve (ref.get_qualified_path ());
index df1636a584a5942a49b0d338c88ff47ffc505c2f..e3a08e6f044d16471e572a1962e4a2ab7334ff2d 100644 (file)
@@ -329,8 +329,7 @@ TypeCheckStructExpr::visit (HIR::StructExprFieldIndexValue &field)
       repeat_location.add_range (prev_field_locus);
 
       rust_error_at (repeat_location, ErrorCode::E0062,
-                    "field %qs specified more than once",
-                    field_name.c_str ());
+                    "field %qs specified more than once", field_name.c_str ());
       return false;
     }
 
index 6919093b0f5f36aac810ccaa19e4e2e1e4c4a005..18e04581ab838e98bcb6fe6c83db388e45415ffa 100644 (file)
@@ -908,7 +908,8 @@ TypeResolveGenericParam::apply_trait_bounds (HIR::TypeParam &param,
        {
          switch (bound->get_bound_type ())
            {
-             case HIR::TypeParamBound::BoundType::TRAITBOUND: {
+           case HIR::TypeParamBound::BoundType::TRAITBOUND:
+             {
                HIR::TraitBound &b = static_cast<HIR::TraitBound &> (*bound);
 
                TyTy::TypeBoundPredicate predicate = get_predicate_from_bound (
@@ -920,7 +921,8 @@ TypeResolveGenericParam::apply_trait_bounds (HIR::TypeParam &param,
                  {
                    switch (predicate.get_polarity ())
                      {
-                       case BoundPolarity::AntiBound: {
+                     case BoundPolarity::AntiBound:
+                       {
                          bool found = predicates.find (predicate.get_id ())
                                       != predicates.end ();
                          if (found)
@@ -937,7 +939,8 @@ TypeResolveGenericParam::apply_trait_bounds (HIR::TypeParam &param,
                        }
                        break;
 
-                       default: {
+                     default:
+                       {
                          if (predicates.find (predicate.get_id ())
                              == predicates.end ())
                            {
@@ -1033,7 +1036,8 @@ ResolveWhereClauseItem::visit (HIR::TypeBoundWhereClauseItem &item)
     {
       switch (bound->get_bound_type ())
        {
-         case HIR::TypeParamBound::BoundType::TRAITBOUND: {
+       case HIR::TypeParamBound::BoundType::TRAITBOUND:
+         {
            auto *b = static_cast<HIR::TraitBound *> (bound.get ());
 
            TyTy::TypeBoundPredicate predicate
@@ -1042,7 +1046,8 @@ ResolveWhereClauseItem::visit (HIR::TypeBoundWhereClauseItem &item)
              specified_bounds.push_back (std::move (predicate));
          }
          break;
-         case HIR::TypeParamBound::BoundType::LIFETIME: {
+       case HIR::TypeParamBound::BoundType::LIFETIME:
+         {
            if (auto param = binding->try_as<TyTy::ParamType> ())
              {
                auto *b = static_cast<HIR::Lifetime *> (bound.get ());
index fbaf3230d73700c4ca59cc6dfda5cb4c89a1f041..d386fda036bb2e39c8959e36875ab9184e9810a0 100644 (file)
@@ -29,8 +29,7 @@
 // for flag_name_resolution_2_0
 #include "options.h"
 
-extern bool
-saw_errors (void);
+extern bool saw_errors (void);
 
 namespace Rust {
 namespace Resolver {
@@ -231,7 +230,8 @@ TraitItemReference::get_type_from_fn (/*const*/ HIR::TraitItemFunc &fn) const
              break;
 
            case HIR::SelfParam::IMM_REF:
-             case HIR::SelfParam::MUT_REF: {
+           case HIR::SelfParam::MUT_REF:
+             {
                auto mutability
                  = self_param.get_self_kind () == HIR::SelfParam::IMM_REF
                      ? Mutability::Imm
index 03874a48bd8e42c199c667000d058cc96053687a..dd97f1e989ac9666a0d0866c2b4bf63d4e0858c3 100644 (file)
 namespace Rust {
 namespace Resolver {
 
-bool
-query_type (HirId reference, TyTy::BaseType **result);
+bool query_type (HirId reference, TyTy::BaseType **result);
 
-bool
-types_compatable (TyTy::TyWithLocation lhs, TyTy::TyWithLocation rhs,
-                 location_t unify_locus, bool emit_errors);
+bool types_compatable (TyTy::TyWithLocation lhs, TyTy::TyWithLocation rhs,
+                      location_t unify_locus, bool emit_errors);
 
-TyTy::BaseType *
-unify_site (HirId id, TyTy::TyWithLocation lhs, TyTy::TyWithLocation rhs,
-           location_t unify_locus);
+TyTy::BaseType *unify_site (HirId id, TyTy::TyWithLocation lhs,
+                           TyTy::TyWithLocation rhs, location_t unify_locus);
 
-TyTy::BaseType *
-unify_site_and (HirId id, TyTy::TyWithLocation lhs, TyTy::TyWithLocation rhs,
-               location_t unify_locus, bool emit_errors, bool commit_if_ok,
-               bool implicit_infer_vars, bool cleanup);
+TyTy::BaseType *unify_site_and (HirId id, TyTy::TyWithLocation lhs,
+                               TyTy::TyWithLocation rhs,
+                               location_t unify_locus, bool emit_errors,
+                               bool commit_if_ok, bool implicit_infer_vars,
+                               bool cleanup);
 
-TyTy::BaseType *
-coercion_site (HirId id, TyTy::TyWithLocation lhs, TyTy::TyWithLocation rhs,
-              location_t coercion_locus);
+TyTy::BaseType *coercion_site (HirId id, TyTy::TyWithLocation lhs,
+                              TyTy::TyWithLocation rhs,
+                              location_t coercion_locus);
 
-TyTy::BaseType *
-try_coercion (HirId id, TyTy::TyWithLocation lhs, TyTy::TyWithLocation rhs,
-             location_t coercion_locus);
+TyTy::BaseType *try_coercion (HirId id, TyTy::TyWithLocation lhs,
+                             TyTy::TyWithLocation rhs,
+                             location_t coercion_locus);
 
-TyTy::BaseType *
-cast_site (HirId id, TyTy::TyWithLocation from, TyTy::TyWithLocation to,
-          location_t cast_locus);
+TyTy::BaseType *cast_site (HirId id, TyTy::TyWithLocation from,
+                          TyTy::TyWithLocation to, location_t cast_locus);
 
 AssociatedImplTrait *
 lookup_associated_impl_block (const TyTy::TypeBoundPredicate &bound,
index e028a0af80bbc939f77fbf0e1e2fb19628aa325a..5d42f80221ee65f206a157a3548b7668c809af4d 100644 (file)
@@ -226,7 +226,8 @@ TypeCheckBase::get_predicate_from_bound (
   auto &final_seg = type_path.get_final_segment ();
   switch (final_seg.get_type ())
     {
-      case HIR::TypePathSegment::SegmentType::GENERIC: {
+    case HIR::TypePathSegment::SegmentType::GENERIC:
+      {
        auto &final_generic_seg
          = static_cast<HIR::TypePathSegmentGeneric &> (final_seg);
        if (final_generic_seg.has_generic_args ())
@@ -251,7 +252,8 @@ TypeCheckBase::get_predicate_from_bound (
       }
       break;
 
-      case HIR::TypePathSegment::SegmentType::FUNCTION: {
+    case HIR::TypePathSegment::SegmentType::FUNCTION:
+      {
        auto &final_function_seg
          = static_cast<HIR::TypePathSegmentFunction &> (final_seg);
        auto &fn = final_function_seg.get_function_path ();
index 2e0830e4adad959a58f20325eece83844f206b10..5ce31243d9bc5681315b7cb8e070d50e26f633f6 100644 (file)
@@ -171,7 +171,8 @@ TypeCheckCallExpr::visit (FnType &type)
            {
            case TyTy::TypeKind::ERROR:
              return;
-             case TyTy::TypeKind::INT: {
+           case TyTy::TypeKind::INT:
+             {
                auto &int_ty
                  = static_cast<TyTy::IntType &> (*argument_expr_tyty);
                if ((int_ty.get_int_kind () == TyTy::IntType::IntKind::I8)
@@ -186,7 +187,8 @@ TypeCheckCallExpr::visit (FnType &type)
                  }
                break;
              }
-             case TyTy::TypeKind::UINT: {
+           case TyTy::TypeKind::UINT:
+             {
                auto &uint_ty
                  = static_cast<TyTy::UintType &> (*argument_expr_tyty);
                if ((uint_ty.get_uint_kind () == TyTy::UintType::UintKind::U8)
@@ -202,7 +204,8 @@ TypeCheckCallExpr::visit (FnType &type)
                  }
                break;
              }
-             case TyTy::TypeKind::FLOAT: {
+           case TyTy::TypeKind::FLOAT:
+             {
                if (static_cast<TyTy::FloatType &> (*argument_expr_tyty)
                      .get_float_kind ()
                    == TyTy::FloatType::FloatKind::F32)
@@ -216,14 +219,16 @@ TypeCheckCallExpr::visit (FnType &type)
                  }
                break;
              }
-             case TyTy::TypeKind::BOOL: {
+           case TyTy::TypeKind::BOOL:
+             {
                rich_location richloc (line_table, arg_locus);
                richloc.add_fixit_replace ("cast the value to c_int: as c_int");
                rust_error_at (arg_locus, ErrorCode::E0617,
                               "expected %<c_int%> variadic argument");
                return;
              }
-             case TyTy::TypeKind::FNDEF: {
+           case TyTy::TypeKind::FNDEF:
+             {
                rust_error_at (
                  arg_locus, ErrorCode::E0617,
                  "unexpected function definition type as variadic "
index c897c1321bde0b37f5d411a0f9b45e9261b7933e..aeefaa9323b13eb72e9d7235f197c6992b0e28d1 100644 (file)
@@ -621,7 +621,8 @@ public:
        ok = true;
        return;
 
-       case InferType::InferTypeKind::INTEGRAL: {
+      case InferType::InferTypeKind::INTEGRAL:
+       {
          if (type.get_infer_kind () == InferType::InferTypeKind::INTEGRAL)
            {
              ok = true;
@@ -635,7 +636,8 @@ public:
        }
        break;
 
-       case InferType::InferTypeKind::FLOAT: {
+      case InferType::InferTypeKind::FLOAT:
+       {
          if (type.get_infer_kind () == InferType::InferTypeKind::FLOAT)
            {
              ok = true;
index 9059a2f225d38f9cc764d0276def6ff4660959fe..282c6f305b49bfe85e66dbba84249f6cc5001515 100644 (file)
@@ -41,9 +41,10 @@ private:
   std::unique_ptr<GenericTyPerCrateCtx> private_ctx;
 };
 
-std::vector<size_t>
-query_field_regions (const ADTType *parent, size_t variant_index,
-                    size_t field_index, const FreeRegions &parent_regions);
+std::vector<size_t> query_field_regions (const ADTType *parent,
+                                        size_t variant_index,
+                                        size_t field_index,
+                                        const FreeRegions &parent_regions);
 
 /** Variance semilattice */
 class Variance
index f0f4a07e966075c0acd952dfca8cc0f0626d3ce9..25310d3c34b226fa24dfcd34a7835826250169bd 100644 (file)
@@ -230,11 +230,13 @@ BaseType::is_unit () const
     case NEVER:
       return true;
 
-      case TUPLE: {
+    case TUPLE:
+      {
        return x->as<const TupleType> ()->num_fields () == 0;
       }
 
-      case ADT: {
+    case ADT:
+      {
        auto adt = x->as<const ADTType> ();
        if (adt->is_enum ())
          return false;
@@ -894,28 +896,32 @@ BaseType::has_substitutions_defined () const
     case OPAQUE:
       return false;
 
-      case PROJECTION: {
+    case PROJECTION:
+      {
        const ProjectionType &p = *static_cast<const ProjectionType *> (x);
        const SubstitutionRef &ref = static_cast<const SubstitutionRef &> (p);
        return ref.has_substitutions ();
       }
       break;
 
-      case FNDEF: {
+    case FNDEF:
+      {
        const FnType &fn = *static_cast<const FnType *> (x);
        const SubstitutionRef &ref = static_cast<const SubstitutionRef &> (fn);
        return ref.has_substitutions ();
       }
       break;
 
-      case ADT: {
+    case ADT:
+      {
        const ADTType &adt = *static_cast<const ADTType *> (x);
        const SubstitutionRef &ref = static_cast<const SubstitutionRef &> (adt);
        return ref.has_substitutions ();
       }
       break;
 
-      case CLOSURE: {
+    case CLOSURE:
+      {
        const ClosureType &closure = *static_cast<const ClosureType *> (x);
        const SubstitutionRef &ref
          = static_cast<const SubstitutionRef &> (closure);
@@ -956,28 +962,32 @@ BaseType::needs_generic_substitutions () const
     case OPAQUE:
       return false;
 
-      case PROJECTION: {
+    case PROJECTION:
+      {
        const ProjectionType &p = *static_cast<const ProjectionType *> (x);
        const SubstitutionRef &ref = static_cast<const SubstitutionRef &> (p);
        return ref.needs_substitution ();
       }
       break;
 
-      case FNDEF: {
+    case FNDEF:
+      {
        const FnType &fn = *static_cast<const FnType *> (x);
        const SubstitutionRef &ref = static_cast<const SubstitutionRef &> (fn);
        return ref.needs_substitution ();
       }
       break;
 
-      case ADT: {
+    case ADT:
+      {
        const ADTType &adt = *static_cast<const ADTType *> (x);
        const SubstitutionRef &ref = static_cast<const SubstitutionRef &> (adt);
        return ref.needs_substitution ();
       }
       break;
 
-      case CLOSURE: {
+    case CLOSURE:
+      {
        const ClosureType &closure = *static_cast<const ClosureType *> (x);
        const SubstitutionRef &ref
          = static_cast<const SubstitutionRef &> (closure);
@@ -996,28 +1006,32 @@ BaseType::get_subst_argument_mappings () const
   const TyTy::BaseType *x = destructure ();
   switch (x->get_kind ())
     {
-      case PROJECTION: {
+    case PROJECTION:
+      {
        const auto &p = *static_cast<const ProjectionType *> (x);
        const auto &ref = static_cast<const SubstitutionRef &> (p);
        return ref.get_substitution_arguments ();
       }
       break;
 
-      case FNDEF: {
+    case FNDEF:
+      {
        const auto &fn = *static_cast<const FnType *> (x);
        const auto &ref = static_cast<const SubstitutionRef &> (fn);
        return ref.get_substitution_arguments ();
       }
       break;
 
-      case ADT: {
+    case ADT:
+      {
        const auto &adt = *static_cast<const ADTType *> (x);
        const auto &ref = static_cast<const SubstitutionRef &> (adt);
        return ref.get_substitution_arguments ();
       }
       break;
 
-      case CLOSURE: {
+    case CLOSURE:
+      {
        const auto &closure = *static_cast<const ClosureType *> (x);
        const auto &ref = static_cast<const SubstitutionRef &> (closure);
        return ref.get_substitution_arguments ();
@@ -1140,13 +1154,15 @@ InferType::default_type (BaseType **type) const
        case GENERAL:
          return false;
 
-         case INTEGRAL: {
+       case INTEGRAL:
+         {
            ok = context->lookup_builtin ("i32", type);
            rust_assert (ok);
            return ok;
          }
 
-         case FLOAT: {
+       case FLOAT:
+         {
            ok = context->lookup_builtin ("f64", type);
            rust_assert (ok);
            return ok;
@@ -1269,7 +1285,8 @@ InferType::apply_primitive_type_hint (const BaseType &hint)
       default_hint.kind = hint.get_kind ();
       break;
 
-      case INT: {
+    case INT:
+      {
        infer_kind = INTEGRAL;
        default_hint.kind = hint.get_kind ();
        default_hint.shint = TypeHint::SignedHint::SIGNED;
@@ -1294,7 +1311,8 @@ InferType::apply_primitive_type_hint (const BaseType &hint)
       }
       break;
 
-      case UINT: {
+    case UINT:
+      {
        infer_kind = INTEGRAL;
        default_hint.kind = hint.get_kind ();
        default_hint.shint = TypeHint::SignedHint::UNSIGNED;
@@ -1319,7 +1337,8 @@ InferType::apply_primitive_type_hint (const BaseType &hint)
       }
       break;
 
-      case TypeKind::FLOAT: {
+    case TypeKind::FLOAT:
+      {
        infer_kind = FLOAT;
        default_hint.shint = TypeHint::SignedHint::SIGNED;
        default_hint.kind = hint.get_kind ();
index 1cada9a4030b55ec80342fb7ed9fbfd105343657..81e15c896410d8f50a3df42e90862d550f507eec 100644 (file)
@@ -78,8 +78,7 @@ enum TypeKind
   ERROR
 };
 
-extern bool
-is_primitive_type_kind (TypeKind kind);
+extern bool is_primitive_type_kind (TypeKind kind);
 
 class TypeKindFormat
 {
@@ -268,8 +267,8 @@ public:
   {}
 
   WARN_UNUSED_RESULT virtual size_t get_num_params () const = 0;
-  WARN_UNUSED_RESULT virtual BaseType *
-  get_param_type_at (size_t index) const = 0;
+  WARN_UNUSED_RESULT virtual BaseType *get_param_type_at (size_t index) const
+    = 0;
   WARN_UNUSED_RESULT virtual BaseType *get_return_type () const = 0;
 };
 
index 294b677ba41762e135510e8d25e86edba9a13dd4..0ffab667433c40a27b253f372df1d4b4b7e22884 100644 (file)
@@ -328,14 +328,16 @@ UnifyRules::expect_inference_variable (TyTy::InferType *ltype,
 {
   switch (rtype->get_kind ())
     {
-      case TyTy::INFER: {
+    case TyTy::INFER:
+      {
        TyTy::InferType *r = static_cast<TyTy::InferType *> (rtype);
        switch (ltype->get_infer_kind ())
          {
          case TyTy::InferType::InferTypeKind::GENERAL:
            return rtype->clone ();
 
-           case TyTy::InferType::InferTypeKind::INTEGRAL: {
+         case TyTy::InferType::InferTypeKind::INTEGRAL:
+           {
              bool is_valid = r->get_infer_kind ()
                                == TyTy::InferType::InferTypeKind::INTEGRAL
                              || r->get_infer_kind ()
@@ -345,7 +347,8 @@ UnifyRules::expect_inference_variable (TyTy::InferType *ltype,
            }
            break;
 
-           case TyTy::InferType::InferTypeKind::FLOAT: {
+         case TyTy::InferType::InferTypeKind::FLOAT:
+           {
              bool is_valid
                = r->get_infer_kind () == TyTy::InferType::InferTypeKind::FLOAT
                  || r->get_infer_kind ()
@@ -361,7 +364,8 @@ UnifyRules::expect_inference_variable (TyTy::InferType *ltype,
     case TyTy::INT:
     case TyTy::UINT:
     case TyTy::USIZE:
-      case TyTy::ISIZE: {
+    case TyTy::ISIZE:
+      {
        bool is_valid = (ltype->get_infer_kind ()
                         == TyTy::InferType::InferTypeKind::GENERAL)
                        || (ltype->get_infer_kind ()
@@ -374,7 +378,8 @@ UnifyRules::expect_inference_variable (TyTy::InferType *ltype,
       }
       break;
 
-      case TyTy::FLOAT: {
+    case TyTy::FLOAT:
+      {
        bool is_valid = (ltype->get_infer_kind ()
                         == TyTy::InferType::InferTypeKind::GENERAL)
                        || (ltype->get_infer_kind ()
@@ -404,7 +409,8 @@ UnifyRules::expect_inference_variable (TyTy::InferType *ltype,
     case TyTy::PROJECTION:
     case TyTy::DYNAMIC:
     case TyTy::CLOSURE:
-      case TyTy::OPAQUE: {
+    case TyTy::OPAQUE:
+      {
        bool is_valid = (ltype->get_infer_kind ()
                         == TyTy::InferType::InferTypeKind::GENERAL);
        if (is_valid)
@@ -424,7 +430,8 @@ UnifyRules::expect_adt (TyTy::ADTType *ltype, TyTy::BaseType *rtype)
 {
   switch (rtype->get_kind ())
     {
-      case TyTy::INFER: {
+    case TyTy::INFER:
+      {
        TyTy::InferType *r = static_cast<TyTy::InferType *> (rtype);
        bool is_valid
          = r->get_infer_kind () == TyTy::InferType::InferTypeKind::GENERAL;
@@ -433,7 +440,8 @@ UnifyRules::expect_adt (TyTy::ADTType *ltype, TyTy::BaseType *rtype)
       }
       break;
 
-      case TyTy::ADT: {
+    case TyTy::ADT:
+      {
        TyTy::ADTType &type = *static_cast<TyTy::ADTType *> (rtype);
        if (ltype->get_adt_kind () != type.get_adt_kind ())
          {
@@ -544,7 +552,8 @@ UnifyRules::expect_str (TyTy::StrType *ltype, TyTy::BaseType *rtype)
 {
   switch (rtype->get_kind ())
     {
-      case TyTy::INFER: {
+    case TyTy::INFER:
+      {
        TyTy::InferType *r = static_cast<TyTy::InferType *> (rtype);
        bool is_valid
          = r->get_infer_kind () == TyTy::InferType::InferTypeKind::GENERAL;
@@ -589,7 +598,8 @@ UnifyRules::expect_reference (TyTy::ReferenceType *ltype, TyTy::BaseType *rtype)
 {
   switch (rtype->get_kind ())
     {
-      case TyTy::INFER: {
+    case TyTy::INFER:
+      {
        TyTy::InferType *r = static_cast<TyTy::InferType *> (rtype);
        bool is_valid
          = r->get_infer_kind () == TyTy::InferType::InferTypeKind::GENERAL;
@@ -598,7 +608,8 @@ UnifyRules::expect_reference (TyTy::ReferenceType *ltype, TyTy::BaseType *rtype)
       }
       break;
 
-      case TyTy::REF: {
+    case TyTy::REF:
+      {
        TyTy::ReferenceType &type = *static_cast<TyTy::ReferenceType *> (rtype);
        auto base_type = ltype->get_base ();
        auto other_base_type = type.get_base ();
@@ -660,7 +671,8 @@ UnifyRules::expect_pointer (TyTy::PointerType *ltype, TyTy::BaseType *rtype)
 {
   switch (rtype->get_kind ())
     {
-      case TyTy::INFER: {
+    case TyTy::INFER:
+      {
        TyTy::InferType *r = static_cast<TyTy::InferType *> (rtype);
        bool is_valid
          = r->get_infer_kind () == TyTy::InferType::InferTypeKind::GENERAL;
@@ -669,7 +681,8 @@ UnifyRules::expect_pointer (TyTy::PointerType *ltype, TyTy::BaseType *rtype)
       }
       break;
 
-      case TyTy::POINTER: {
+    case TyTy::POINTER:
+      {
        TyTy::PointerType &type = *static_cast<TyTy::PointerType *> (rtype);
        auto base_type = ltype->get_base ();
        auto other_base_type = type.get_base ();
@@ -731,7 +744,8 @@ UnifyRules::expect_param (TyTy::ParamType *ltype, TyTy::BaseType *rtype)
 {
   switch (rtype->get_kind ())
     {
-      case TyTy::INFER: {
+    case TyTy::INFER:
+      {
        TyTy::InferType *r = static_cast<TyTy::InferType *> (rtype);
        bool is_valid
          = r->get_infer_kind () == TyTy::InferType::InferTypeKind::GENERAL;
@@ -740,7 +754,8 @@ UnifyRules::expect_param (TyTy::ParamType *ltype, TyTy::BaseType *rtype)
       }
       break;
 
-      case TyTy::PARAM: {
+    case TyTy::PARAM:
+      {
        TyTy::ParamType &type = *static_cast<TyTy::ParamType *> (rtype);
        // bool symbol_matches
        //   = ltype->get_symbol ().compare (type.get_symbol ()) == 0;
@@ -793,7 +808,8 @@ UnifyRules::expect_array (TyTy::ArrayType *ltype, TyTy::BaseType *rtype)
 {
   switch (rtype->get_kind ())
     {
-      case TyTy::INFER: {
+    case TyTy::INFER:
+      {
        TyTy::InferType *r = static_cast<TyTy::InferType *> (rtype);
        bool is_valid
          = r->get_infer_kind () == TyTy::InferType::InferTypeKind::GENERAL;
@@ -802,7 +818,8 @@ UnifyRules::expect_array (TyTy::ArrayType *ltype, TyTy::BaseType *rtype)
       }
       break;
 
-      case TyTy::ARRAY: {
+    case TyTy::ARRAY:
+      {
        TyTy::ArrayType &type = *static_cast<TyTy::ArrayType *> (rtype);
        TyTy::BaseType *element_unify = UnifyRules::Resolve (
          TyTy::TyWithLocation (ltype->get_element_type ()),
@@ -853,7 +870,8 @@ UnifyRules::expect_slice (TyTy::SliceType *ltype, TyTy::BaseType *rtype)
 {
   switch (rtype->get_kind ())
     {
-      case TyTy::INFER: {
+    case TyTy::INFER:
+      {
        TyTy::InferType *r = static_cast<TyTy::InferType *> (rtype);
        bool is_valid
          = r->get_infer_kind () == TyTy::InferType::InferTypeKind::GENERAL;
@@ -862,7 +880,8 @@ UnifyRules::expect_slice (TyTy::SliceType *ltype, TyTy::BaseType *rtype)
       }
       break;
 
-      case TyTy::SLICE: {
+    case TyTy::SLICE:
+      {
        TyTy::SliceType &type = *static_cast<TyTy::SliceType *> (rtype);
        TyTy::BaseType *element_unify = UnifyRules::Resolve (
          TyTy::TyWithLocation (ltype->get_element_type ()),
@@ -912,7 +931,8 @@ UnifyRules::expect_fndef (TyTy::FnType *ltype, TyTy::BaseType *rtype)
 {
   switch (rtype->get_kind ())
     {
-      case TyTy::INFER: {
+    case TyTy::INFER:
+      {
        TyTy::InferType *r = static_cast<TyTy::InferType *> (rtype);
        bool is_valid
          = r->get_infer_kind () == TyTy::InferType::InferTypeKind::GENERAL;
@@ -921,7 +941,8 @@ UnifyRules::expect_fndef (TyTy::FnType *ltype, TyTy::BaseType *rtype)
       }
       break;
 
-      case TyTy::FNDEF: {
+    case TyTy::FNDEF:
+      {
        TyTy::FnType &type = *static_cast<TyTy::FnType *> (rtype);
        if (ltype->num_params () != type.num_params ())
          {
@@ -1003,7 +1024,8 @@ UnifyRules::expect_fnptr (TyTy::FnPtr *ltype, TyTy::BaseType *rtype)
 {
   switch (rtype->get_kind ())
     {
-      case TyTy::INFER: {
+    case TyTy::INFER:
+      {
        TyTy::InferType *r = static_cast<TyTy::InferType *> (rtype);
        bool is_valid
          = r->get_infer_kind () == TyTy::InferType::InferTypeKind::GENERAL;
@@ -1012,7 +1034,8 @@ UnifyRules::expect_fnptr (TyTy::FnPtr *ltype, TyTy::BaseType *rtype)
       }
       break;
 
-      case TyTy::FNPTR: {
+    case TyTy::FNPTR:
+      {
        TyTy::FnPtr &type = *static_cast<TyTy::FnPtr *> (rtype);
        if (ltype->num_params () != type.num_params ())
          {
@@ -1048,7 +1071,8 @@ UnifyRules::expect_fnptr (TyTy::FnPtr *ltype, TyTy::BaseType *rtype)
       }
       break;
 
-      case TyTy::FNDEF: {
+    case TyTy::FNDEF:
+      {
        TyTy::FnType &type = *static_cast<TyTy::FnType *> (rtype);
        auto this_ret_type = ltype->get_return_type ();
        auto other_ret_type = type.get_return_type ();
@@ -1120,7 +1144,8 @@ UnifyRules::expect_tuple (TyTy::TupleType *ltype, TyTy::BaseType *rtype)
 {
   switch (rtype->get_kind ())
     {
-      case TyTy::INFER: {
+    case TyTy::INFER:
+      {
        TyTy::InferType *r = static_cast<TyTy::InferType *> (rtype);
        bool is_valid
          = r->get_infer_kind () == TyTy::InferType::InferTypeKind::GENERAL;
@@ -1129,7 +1154,8 @@ UnifyRules::expect_tuple (TyTy::TupleType *ltype, TyTy::BaseType *rtype)
       }
       break;
 
-      case TyTy::TUPLE: {
+    case TyTy::TUPLE:
+      {
        TyTy::TupleType &type = *static_cast<TyTy::TupleType *> (rtype);
        if (ltype->num_fields () != type.num_fields ())
          {
@@ -1191,7 +1217,8 @@ UnifyRules::expect_bool (TyTy::BoolType *ltype, TyTy::BaseType *rtype)
 {
   switch (rtype->get_kind ())
     {
-      case TyTy::INFER: {
+    case TyTy::INFER:
+      {
        TyTy::InferType *r = static_cast<TyTy::InferType *> (rtype);
        bool is_valid
          = r->get_infer_kind () == TyTy::InferType::InferTypeKind::GENERAL;
@@ -1239,7 +1266,8 @@ UnifyRules::expect_char (TyTy::CharType *ltype, TyTy::BaseType *rtype)
 {
   switch (rtype->get_kind ())
     {
-      case TyTy::INFER: {
+    case TyTy::INFER:
+      {
        TyTy::InferType *r = static_cast<TyTy::InferType *> (rtype);
        bool is_valid
          = r->get_infer_kind () == TyTy::InferType::InferTypeKind::GENERAL;
@@ -1287,7 +1315,8 @@ UnifyRules::expect_int (TyTy::IntType *ltype, TyTy::BaseType *rtype)
 {
   switch (rtype->get_kind ())
     {
-      case TyTy::INFER: {
+    case TyTy::INFER:
+      {
        TyTy::InferType *r = static_cast<TyTy::InferType *> (rtype);
        bool is_valid
          = r->get_infer_kind () == TyTy::InferType::InferTypeKind::GENERAL
@@ -1300,7 +1329,8 @@ UnifyRules::expect_int (TyTy::IntType *ltype, TyTy::BaseType *rtype)
       }
       break;
 
-      case TyTy::INT: {
+    case TyTy::INT:
+      {
        TyTy::IntType &type = *static_cast<TyTy::IntType *> (rtype);
        bool is_valid = ltype->get_int_kind () == type.get_int_kind ();
        if (is_valid)
@@ -1342,7 +1372,8 @@ UnifyRules::expect_uint (TyTy::UintType *ltype, TyTy::BaseType *rtype)
 {
   switch (rtype->get_kind ())
     {
-      case TyTy::INFER: {
+    case TyTy::INFER:
+      {
        TyTy::InferType *r = static_cast<TyTy::InferType *> (rtype);
        bool is_valid
          = r->get_infer_kind () == TyTy::InferType::InferTypeKind::GENERAL
@@ -1355,7 +1386,8 @@ UnifyRules::expect_uint (TyTy::UintType *ltype, TyTy::BaseType *rtype)
       }
       break;
 
-      case TyTy::UINT: {
+    case TyTy::UINT:
+      {
        TyTy::UintType &type = *static_cast<TyTy::UintType *> (rtype);
        bool is_valid = ltype->get_uint_kind () == type.get_uint_kind ();
        if (is_valid)
@@ -1397,7 +1429,8 @@ UnifyRules::expect_float (TyTy::FloatType *ltype, TyTy::BaseType *rtype)
 {
   switch (rtype->get_kind ())
     {
-      case TyTy::INFER: {
+    case TyTy::INFER:
+      {
        TyTy::InferType *r = static_cast<TyTy::InferType *> (rtype);
        bool is_valid
          = r->get_infer_kind () == TyTy::InferType::InferTypeKind::GENERAL
@@ -1410,7 +1443,8 @@ UnifyRules::expect_float (TyTy::FloatType *ltype, TyTy::BaseType *rtype)
       }
       break;
 
-      case TyTy::FLOAT: {
+    case TyTy::FLOAT:
+      {
        TyTy::FloatType &type = *static_cast<TyTy::FloatType *> (rtype);
        bool is_valid = ltype->get_float_kind () == type.get_float_kind ();
        if (is_valid)
@@ -1452,7 +1486,8 @@ UnifyRules::expect_isize (TyTy::ISizeType *ltype, TyTy::BaseType *rtype)
 {
   switch (rtype->get_kind ())
     {
-      case TyTy::INFER: {
+    case TyTy::INFER:
+      {
        TyTy::InferType *r = static_cast<TyTy::InferType *> (rtype);
        bool is_valid
          = r->get_infer_kind () != TyTy::InferType::InferTypeKind::FLOAT;
@@ -1500,7 +1535,8 @@ UnifyRules::expect_usize (TyTy::USizeType *ltype, TyTy::BaseType *rtype)
 {
   switch (rtype->get_kind ())
     {
-      case TyTy::INFER: {
+    case TyTy::INFER:
+      {
        TyTy::InferType *r = static_cast<TyTy::InferType *> (rtype);
        bool is_valid
          = r->get_infer_kind () != TyTy::InferType::InferTypeKind::FLOAT;
@@ -1548,7 +1584,8 @@ UnifyRules::expect_never (TyTy::NeverType *ltype, TyTy::BaseType *rtype)
 {
   switch (rtype->get_kind ())
     {
-      case TyTy::INFER: {
+    case TyTy::INFER:
+      {
        TyTy::InferType *r = static_cast<TyTy::InferType *> (rtype);
        bool is_valid
          = r->get_infer_kind () == TyTy::InferType::InferTypeKind::GENERAL;
@@ -1569,7 +1606,8 @@ UnifyRules::expect_placeholder (TyTy::PlaceholderType *ltype,
 {
   switch (rtype->get_kind ())
     {
-      case TyTy::INFER: {
+    case TyTy::INFER:
+      {
        TyTy::InferType *r = static_cast<TyTy::InferType *> (rtype);
        bool is_valid
          = r->get_infer_kind () == TyTy::InferType::InferTypeKind::GENERAL;
@@ -1619,7 +1657,8 @@ UnifyRules::expect_projection (TyTy::ProjectionType *ltype,
 {
   switch (rtype->get_kind ())
     {
-      case TyTy::INFER: {
+    case TyTy::INFER:
+      {
        TyTy::InferType *r = static_cast<TyTy::InferType *> (rtype);
        bool is_valid
          = r->get_infer_kind () == TyTy::InferType::InferTypeKind::GENERAL;
@@ -1666,7 +1705,8 @@ UnifyRules::expect_dyn (TyTy::DynamicObjectType *ltype, TyTy::BaseType *rtype)
 {
   switch (rtype->get_kind ())
     {
-      case TyTy::INFER: {
+    case TyTy::INFER:
+      {
        TyTy::InferType *r = static_cast<TyTy::InferType *> (rtype);
        bool is_valid
          = r->get_infer_kind () == TyTy::InferType::InferTypeKind::GENERAL;
@@ -1675,7 +1715,8 @@ UnifyRules::expect_dyn (TyTy::DynamicObjectType *ltype, TyTy::BaseType *rtype)
       }
       break;
 
-      case TyTy::DYNAMIC: {
+    case TyTy::DYNAMIC:
+      {
        TyTy::DynamicObjectType &type
          = *static_cast<TyTy::DynamicObjectType *> (rtype);
        if (ltype->num_specified_bounds () != type.num_specified_bounds ())
@@ -1725,7 +1766,8 @@ UnifyRules::expect_closure (TyTy::ClosureType *ltype, TyTy::BaseType *rtype)
 {
   switch (rtype->get_kind ())
     {
-      case TyTy::INFER: {
+    case TyTy::INFER:
+      {
        TyTy::InferType *r = static_cast<TyTy::InferType *> (rtype);
        bool is_valid
          = r->get_infer_kind () == TyTy::InferType::InferTypeKind::GENERAL;
@@ -1734,7 +1776,8 @@ UnifyRules::expect_closure (TyTy::ClosureType *ltype, TyTy::BaseType *rtype)
       }
       break;
 
-      case TyTy::CLOSURE: {
+    case TyTy::CLOSURE:
+      {
        TyTy::ClosureType &type = *static_cast<TyTy::ClosureType *> (rtype);
        if (ltype->get_def_id () != type.get_def_id ())
          {
@@ -1796,7 +1839,8 @@ UnifyRules::expect_opaque (TyTy::OpaqueType *ltype, TyTy::BaseType *rtype)
 {
   switch (rtype->get_kind ())
     {
-      case TyTy::INFER: {
+    case TyTy::INFER:
+      {
        TyTy::InferType *r = static_cast<TyTy::InferType *> (rtype);
        bool is_valid
          = r->get_infer_kind () == TyTy::InferType::InferTypeKind::GENERAL;
@@ -1805,7 +1849,8 @@ UnifyRules::expect_opaque (TyTy::OpaqueType *ltype, TyTy::BaseType *rtype)
       }
       break;
 
-      case TyTy::OPAQUE: {
+    case TyTy::OPAQUE:
+      {
        auto &type = *static_cast<TyTy::OpaqueType *> (rtype);
        if (ltype->num_specified_bounds () != type.num_specified_bounds ())
          {
index a0180ed4d951b5a9d7134028911e52b9eb468ab5..357a5db95ffcc041f3704e5842c99c839fe31fd9 100644 (file)
@@ -34,11 +34,9 @@ enum ABI
   SYSV64
 };
 
-extern Rust::ABI
-get_abi_from_string (const std::string &abi);
+extern Rust::ABI get_abi_from_string (const std::string &abi);
 
-extern std::string
-get_string_from_abi (Rust::ABI abi);
+extern std::string get_string_from_abi (Rust::ABI abi);
 
 } // namespace Rust
 
index c77e99c1ca5ad2149ea7fbe88d8045c648bee262..9bf4f7773c68b81b83324f1f10101e39a4f2e399 100644 (file)
@@ -221,7 +221,8 @@ check_doc_attribute (const AST::Attribute &attribute)
       break;
       // FIXME: Handle them as well
 
-      case AST::AttrInput::TOKEN_TREE: {
+    case AST::AttrInput::TOKEN_TREE:
+      {
        // FIXME: This doesn't check for #[doc(alias(...))]
        const auto &option = static_cast<const AST::DelimTokenTree &> (
          attribute.get_attr_input ());
index e751c95f18f5b3e3e501c89609ac2821c08d4191..5fd7a37292e5ee3c1d2a4fb6a4a568742ec1feed 100644 (file)
@@ -26,8 +26,7 @@ namespace Rust {
 /**
  * Get the Base62 representation of an integer
  */
-std::string
-base62_integer (uint64_t value);
+std::string base62_integer (uint64_t value);
 
 } // namespace Rust
 
index dcb45d84278cb3f578656a1fa57cfe50259e9454..fb72bb1551cb54356649deb00d51faa64972f35b 100644 (file)
@@ -26,8 +26,7 @@
 namespace Rust {
 
 // extracts the owned subdirectory name from a file name
-bool
-get_file_subdir (const std::string &filename, std::string &subdir);
+bool get_file_subdir (const std::string &filename, std::string &subdir);
 
 } // namespace Rust
 
index d034ea03a6f1c4f6abcee54fbb68a0c6bcc07e29..532fedb98799755f3c372663b99bb8aff8defa54 100644 (file)
@@ -33,8 +33,7 @@ enum class Edition
   E2021
 };
 
-Edition
-get_rust_edition ();
+Edition get_rust_edition ();
 
 } // namespace Rust
 
index a939f05e886d7f5fdcfef4715c48541569cca56d..75260ce0468a7cf11b3332be7805a9ada3b792c1 100644 (file)
@@ -27,8 +27,7 @@ namespace Rust {
 /* Encode a string as punycode. Returns a string if encoding is successful.
  * Returns nullopt otherwise. Note that a returned string contains only ASCII
  * characters and does not start with `xn--`. */
-tl::optional<std::string>
-encode_punycode (const Utf8String &src);
+tl::optional<std::string> encode_punycode (const Utf8String &src);
 
 } // namespace Rust
 
@@ -36,8 +35,7 @@ encode_punycode (const Utf8String &src);
 
 namespace selftest {
 
-void
-rust_punycode_encode_test ();
+void rust_punycode_encode_test ();
 
 } // namespace selftest
 
index fc34adb9b1955c73a1f9b36efa0b7d0559536971..52172f40cfa6f4e45c989d7cbb7ec4d9410030e7 100644 (file)
@@ -202,7 +202,8 @@ convert (const std::vector<const_TokenPtr> &tokens)
        case PERCENT_EQ:
        case SCOPE_RESOLUTION:
        case NOT_EQUAL:
-         case EQUAL_EQUAL: {
+       case EQUAL_EQUAL:
+         {
            auto str = token->as_string ();
            auto it = str.cbegin ();
            for (; it != str.cend () - 1; it++)
@@ -260,9 +261,8 @@ convert (const std::vector<const_TokenPtr> &tokens)
   return trees.back ();
 }
 
-static void
-from_tokenstream (const ProcMacro::TokenStream &ts,
-                 std::vector<const_TokenPtr> &result);
+static void from_tokenstream (const ProcMacro::TokenStream &ts,
+                             std::vector<const_TokenPtr> &result);
 
 /**
  * Append the token corresponding to a given Ident to a vector.
index 5405d6e59d6ef04dc3729c781407ee9aea2ae2cb..6e4af50439ef066ec49eeff1d73b6a31aa4db9d0 100644 (file)
 
 namespace Rust {
 
-ProcMacro::TokenStream
-convert (const std::vector<const_TokenPtr> &tokens);
+ProcMacro::TokenStream convert (const std::vector<const_TokenPtr> &tokens);
 
-std::vector<const_TokenPtr>
-convert (const ProcMacro::TokenStream &ts);
+std::vector<const_TokenPtr> convert (const ProcMacro::TokenStream &ts);
 
-ProcMacro::Literal
-convert_literal (const_TokenPtr lit);
+ProcMacro::Literal convert_literal (const_TokenPtr lit);
 
 } // namespace Rust
 
index 6a6526db30909d6c68ea4ecce054b466658406fa..6579b806976e5232e5e274aa5f2f3977262c9a99 100644 (file)
@@ -59,20 +59,15 @@ public:
   Utf8String nfc_normalize () const;
 };
 
-bool
-is_alphabetic (uint32_t codepoint);
+bool is_alphabetic (uint32_t codepoint);
 
-bool
-is_ascii_only (const std::string &str);
+bool is_ascii_only (const std::string &str);
 
-bool
-is_numeric (uint32_t codepoint);
+bool is_numeric (uint32_t codepoint);
 
-bool
-is_nfc_qc_no (uint32_t codepoint);
+bool is_nfc_qc_no (uint32_t codepoint);
 
-bool
-is_nfc_qc_maybe (uint32_t codepoint);
+bool is_nfc_qc_maybe (uint32_t codepoint);
 
 enum class QuickCheckResult
 {
@@ -81,8 +76,7 @@ enum class QuickCheckResult
   MAYBE
 };
 
-QuickCheckResult
-nfc_quick_check (const std::vector<Codepoint> &s);
+QuickCheckResult nfc_quick_check (const std::vector<Codepoint> &s);
 
 } // namespace Rust
 
@@ -90,14 +84,11 @@ nfc_quick_check (const std::vector<Codepoint> &s);
 
 namespace selftest {
 
-void
-rust_nfc_qc_test ();
+void rust_nfc_qc_test ();
 
-void
-rust_utf8_normalize_test ();
+void rust_utf8_normalize_test ();
 
-void
-rust_utf8_property_test ();
+void rust_utf8_property_test ();
 
 } // namespace selftest
 
index bebdc3aadd4df86bb98a97eedbeb6a5c6b214869..af3a237ea28e85499eed534e3b4ea037d056c885 100644 (file)
@@ -83,14 +83,11 @@ public:
 /*
  * Used to get the node id of a path segment object
  */
-NodeId
-unwrap_segment_node_id (const AST::TypePathSegment &seg);
+NodeId unwrap_segment_node_id (const AST::TypePathSegment &seg);
 
-NodeId
-unwrap_segment_node_id (const AST::SimplePathSegment &seg);
+NodeId unwrap_segment_node_id (const AST::SimplePathSegment &seg);
 
-NodeId
-unwrap_segment_node_id (const AST::PathExprSegment &seg);
+NodeId unwrap_segment_node_id (const AST::PathExprSegment &seg);
 
 template <class T>
 NodeId
index e176bc29985018e70b5c148f82f157b0facb8c1e..b133b35bcb0f7938e356daf5165831215bc65b65 100644 (file)
@@ -43,11 +43,9 @@ public:
 };
 
 extern "C" {
-FFIString
-FFIString__new (const unsigned char *data, std::uint64_t len);
+FFIString FFIString__new (const unsigned char *data, std::uint64_t len);
 
-void
-FFIString__drop (FFIString *str);
+void FFIString__drop (FFIString *str);
 }
 
 } // namespace ProcMacro
index cdc9b0d5d95d098b9c803b8177662da8845aee1d..839471675a7824330c915652368e0ca0d33488d0 100644 (file)
@@ -47,17 +47,13 @@ public:
 
 extern "C" {
 
-Ident
-Ident__new (FFIString str, Span span);
+Ident Ident__new (FFIString str, Span span);
 
-Ident
-Ident__new_raw (FFIString str, Span span);
+Ident Ident__new_raw (FFIString str, Span span);
 
-void
-Ident__drop (Ident *ident);
+void Ident__drop (Ident *ident);
 
-Ident
-Ident__clone (const Ident *ident);
+Ident Ident__clone (const Ident *ident);
 }
 
 } // namespace ProcMacro
index c8579471b9df2495a164a68286351f1807e9a24b..b30c69a2925d1f05eeaa1b6df7342cdd6d5657f7 100644 (file)
@@ -105,8 +105,7 @@ public:
 };
 
 extern "C" {
-bool
-Literal__from_string (FFIString str, Literal *lit);
+bool Literal__from_string (FFIString str, Literal *lit);
 }
 } // namespace ProcMacro
 
index ce9adb24734d7202c8e6cdd6b1ec9e00fc493f66..d5f2e20d8d69a51bd9a54ef0ed15eadeb4324b82 100644 (file)
@@ -96,8 +96,7 @@ struct ProcmacroArray
   Procmacro *macros;
 };
 
-extern "C" bool
-bridge_is_available ();
+extern "C" bool bridge_is_available ();
 
 } // namespace ProcMacro
 
index 4e13ce7690d9e0880418a7f27d132793e9013d9f..f24d4ab6892528ead09993a93b51997007dfb44b 100644 (file)
@@ -51,23 +51,17 @@ public:
   static void drop (TokenStream *stream);
 };
 
-extern "C" TokenStream
-TokenStream__new ();
+extern "C" TokenStream TokenStream__new ();
 
-extern "C" TokenStream
-TokenStream__with_capacity (std::uint64_t capacity);
+extern "C" TokenStream TokenStream__with_capacity (std::uint64_t capacity);
 
-extern "C" void
-TokenSream__push (TokenStream *stream, TokenTree tree);
+extern "C" void TokenSream__push (TokenStream *stream, TokenTree tree);
 
-extern "C" bool
-TokenStream__from_string (FFIString str, TokenStream *ts);
+extern "C" bool TokenStream__from_string (FFIString str, TokenStream *ts);
 
-extern "C" TokenStream
-TokenStream__clone (const TokenStream *ts);
+extern "C" TokenStream TokenStream__clone (const TokenStream *ts);
 
-extern "C" void
-TokenStream__drop (TokenStream *stream);
+extern "C" void TokenStream__drop (TokenStream *stream);
 
 } // namespace ProcMacro