Remove non-API usage of R_NamespaceRegistry#488
Merged
DavisVaughan merged 5 commits intomainfrom Apr 3, 2026
Merged
Conversation
We got it through `cpp11/protect.hpp`, but we should not rely on that
…mat()` In fmt, there is a `FMT_CONSTEVAL` macro that resolves to `consteval` on "new enough" C++ (otherwise it doesn't do anything). For R 4.6+, the default C++ used is finally "new enough" (`__cplusplus > 201703L`). This causes all `fmt::format()` calls to require a constant expression for `const char*` and `std::string&` input, which we are not currently doing via `fmt_arg`. We have a runtime provided string, which must now be wrapped in `fmt::runtime()`, which is what we should have been doing all along.
Throwing an informative (and tested!) error when we can't find the package namespace
`#include <cpp11/R.hpp>` sets everything up the right way, and otherwise we get a warning from Rcpp which doesn't seem to end up being relevant for this use case
To avoid triggering a NOTE about usage of `Rf_findVarInFrame3()` on R 4.5, where technically we had the tools to avoid that
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #487
Replaced with the new
R_getRegisteredNamespace()on r-devel, and our own polyfill for that.Plus two other minor things:
CPP11_USE_FMTwhere the input was not being correctly wrapped infmt::runtime()(related to the default C++ compiler for R 4.6 being C++20)RCPP_NO_R_HEADERS_CHECKbefore all#include <Rcpp.h>usage