Skip to content

Commit

Permalink
Bug 1335203 - Synchronize rust debug-assertions with C++ DEBUG, r=fro…
Browse files Browse the repository at this point in the history
…ydnj

MozReview-Commit-ID: JPD9eNFg89S
  • Loading branch information
mystor committed Feb 1, 2017
1 parent b62bca9 commit 0dadca0
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
8 changes: 7 additions & 1 deletion config/rules.mk
Original file line number Diff line number Diff line change
Expand Up @@ -940,7 +940,13 @@ endif
# optimization level here, if necessary. (The Cargo.toml files already
# specify debug-assertions appropriately for --{disable,enable}-debug.)
ifndef MOZ_OPTIMIZE
rustflags_override = RUSTFLAGS='-C opt-level=0'
rustflags = -C opt-level=0
# Unfortunately, -C opt-level=0 implies -C debug-assertions, so we need
# to explicitly disable them when MOZ_DEBUG is not set.
ifndef MOZ_DEBUG
rustflags += -C debug-assertions=no
endif
rustflags_override = RUSTFLAGS='$(rustflags)'
endif

CARGO_BUILD = env $(rustflags_override) \
Expand Down
6 changes: 4 additions & 2 deletions xpcom/string/nsSubstring.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -355,12 +355,14 @@ static_assert(sizeof(nsStringContainer_base) == sizeof(nsSubstring),
// Provide rust bindings to the nsA[C]String types
extern "C" {

// This is a no-op on release, when bug 1335203 is fixed we should ifdef this
// to ensure using it in release results in a linker error.
// This is a no-op on release, so we ifdef it out such that using it in release
// results in a linker error.
#ifdef DEBUG
void Gecko_IncrementStringAdoptCount(void* aData)
{
MOZ_LOG_CTOR(aData, "StringAdopt", 1);
}
#endif

void Gecko_FinalizeCString(nsACString* aThis)
{
Expand Down

0 comments on commit 0dadca0

Please sign in to comment.