aboutsummaryrefslogtreecommitdiff
path: root/gcc/rust/rust-session-manager.cc
diff options
context:
space:
mode:
authorArthur Cohen <arthur.cohen@embecosm.com>2023-06-26 14:47:06 +0200
committerCohenArthur <arthur.cohen@embecosm.com>2023-07-10 15:54:56 +0000
commit3016c44e535fe134d88c03ec3d61e3066e43180c (patch)
treeede922bdb7f1124def97b0d8788fafa02c85d98d /gcc/rust/rust-session-manager.cc
parent1fe255e4928dd3a6d1ab574f92d472b1eea894c2 (diff)
downloadgcc-3016c44e535fe134d88c03ec3d61e3066e43180c.zip
gcc-3016c44e535fe134d88c03ec3d61e3066e43180c.tar.gz
gcc-3016c44e535fe134d88c03ec3d61e3066e43180c.tar.bz2
gccrs: Remove Rust::Optional in favor of tl::optional
gcc/rust/ChangeLog: * Make-lang.in: Remove rust-optional-test.cc's object file * ast/rust-macro.h: Remove use of Rust::Optional * backend/rust-compile-base.cc (HIRCompileBase::resolve_method_address): Likewise. * checks/errors/privacy/rust-privacy-reporter.cc (PrivacyReporter::check_for_privacy_violation): Likewise. (PrivacyReporter::visit): Likewise. * checks/errors/privacy/rust-privacy-reporter.h: Likewise. * checks/errors/rust-feature-gate.cc (FeatureGate::check): Likewise. * checks/errors/rust-feature.cc (Feature::create): Likewise. (Feature::as_name): Likewise. * checks/errors/rust-feature.h: Likewise. * expand/rust-macro-builtins.cc: Likewise. * lex/rust-lex.cc (Lexer::Lexer): Likewise. (Lexer::skip_token): Likewise. (Lexer::dump_and_skip): Likewise. * lex/rust-lex.h: Likewise. * resolve/rust-ast-resolve-path.cc (ResolvePath::resolve_path): Likewise. * resolve/rust-ast-resolve-type.cc (ResolveRelativeTypePath::go): Likewise. * rust-lang.cc (run_rust_tests): Likewise. * rust-session-manager.cc (Session::compile_crate): Likewise. (TargetOptions::dump_target_options): Likewise. * rust-session-manager.h (struct TargetOptions): Likewise. * util/rust-hir-map.cc (Mappings::lookup_module_children): Likewise. (Mappings::lookup_module_chidren_items): Likewise. (Mappings::lookup_module_child): Likewise. (Mappings::lookup_parent_module): Likewise. * util/rust-hir-map.h (RUST_HIR_MAP_H): Likewise. * util/rust-optional-test.cc: Removed. * util/rust-optional.h: Removed.
Diffstat (limited to 'gcc/rust/rust-session-manager.cc')
-rw-r--r--gcc/rust/rust-session-manager.cc16
1 files changed, 7 insertions, 9 deletions
diff --git a/gcc/rust/rust-session-manager.cc b/gcc/rust/rust-session-manager.cc
index c27b456..8344bca 100644
--- a/gcc/rust/rust-session-manager.cc
+++ b/gcc/rust/rust-session-manager.cc
@@ -481,18 +481,16 @@ Session::compile_crate (const char *filename)
// parse file here
/* create lexer and parser - these are file-specific and so aren't instance
* variables */
- Optional<std::ofstream &> dump_lex_opt = Optional<std::ofstream &>::none ();
+ tl::optional<std::ofstream &> dump_lex_opt = tl::nullopt;
std::ofstream dump_lex_stream;
if (options.dump_option_enabled (CompileOptions::LEXER_DUMP))
{
dump_lex_stream.open (kLexDumpFile);
if (dump_lex_stream.fail ())
- {
- rust_error_at (UNKNOWN_LOCATION, "cannot open %s:%m; ignored",
- kLexDumpFile);
- }
- auto stream = Optional<std::ofstream &>::some (dump_lex_stream);
- dump_lex_opt = std::move (stream);
+ rust_error_at (UNKNOWN_LOCATION, "cannot open %s:%m; ignored",
+ kLexDumpFile);
+
+ dump_lex_opt = dump_lex_stream;
}
Lexer lex (filename, std::move (file_wrap), linemap, dump_lex_opt);
@@ -1051,8 +1049,8 @@ TargetOptions::dump_target_options () const
{
for (const auto &value : pairs.second)
{
- if (value.is_some ())
- out << pairs.first + ": \"" + value.get () + "\"\n";
+ if (value.has_value ())
+ out << pairs.first + ": \"" + value.value () + "\"\n";
else
out << pairs.first + "\n";
}