Skip to content

Commit

Permalink
Merge pull request #1140 from dtolnay/eastconst
Browse files Browse the repository at this point in the history
Adopt east const in generated code to avoid ambiguities
  • Loading branch information
dtolnay authored Dec 3, 2022
2 parents a894a69 + 5e404f0 commit 3b423fe
Show file tree
Hide file tree
Showing 2 changed files with 78 additions and 76 deletions.
8 changes: 4 additions & 4 deletions gen/src/builtin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -264,8 +264,8 @@ pub(super) fn write(out: &mut OutFile) {
out,
" Fail(::rust::repr::PtrLen &throw$) noexcept : throw$(throw$) {{}}",
);
writeln!(out, " void operator()(const char *) noexcept;");
writeln!(out, " void operator()(const std::string &) noexcept;");
writeln!(out, " void operator()(char const *) noexcept;");
writeln!(out, " void operator()(std::string const &) noexcept;");
writeln!(out, "}};");
}

Expand Down Expand Up @@ -352,7 +352,7 @@ pub(super) fn write(out: &mut OutFile) {
writeln!(out, "public:");
writeln!(out, " static Error error(repr::PtrLen repr) noexcept {{");
writeln!(out, " Error error;");
writeln!(out, " error.msg = static_cast<const char *>(repr.ptr);");
writeln!(out, " error.msg = static_cast<char const *>(repr.ptr);");
writeln!(out, " error.len = repr.len;");
writeln!(out, " return error;");
writeln!(out, " }}");
Expand Down Expand Up @@ -412,7 +412,7 @@ pub(super) fn write(out: &mut OutFile) {
writeln!(out, " missing>::value>::type");
writeln!(out, "trycatch(Try &&func, Fail &&fail) noexcept try {{");
writeln!(out, " func();");
writeln!(out, "}} catch (const ::std::exception &e) {{");
writeln!(out, "}} catch (::std::exception const &e) {{");
writeln!(out, " fail(e.what());");
writeln!(out, "}}");
out.end_block(Block::Namespace("behavior"));
Expand Down
Loading

0 comments on commit 3b423fe

Please sign in to comment.