base: Remove Rust

136.0.7103.44
klzgrad 2025-01-14 19:29:28 +08:00
parent e44c0742c0
commit a6902e19ed
3 changed files with 7 additions and 66 deletions

View File

@ -1040,12 +1040,6 @@ component("base") {
if (!is_nacl) { if (!is_nacl) {
# Used by metrics/crc32, except on NaCl builds. # Used by metrics/crc32, except on NaCl builds.
deps += [ "//third_party/zlib" ] deps += [ "//third_party/zlib" ]
# NaCl does not support Rust.
deps += [
":rust_logger",
"//third_party/rust/serde_json_lenient/v0_2/wrapper",
]
} }
# `raw_ptr` cannot be made a component due to CRT symbol issues. # `raw_ptr` cannot be made a component due to CRT symbol issues.
@ -1085,17 +1079,6 @@ component("base") {
# accidentally (transitively) depend on it anymore. # accidentally (transitively) depend on it anymore.
public_deps += [ "//build:chromeos_buildflags" ] public_deps += [ "//build:chromeos_buildflags" ]
if (!is_nacl) {
sources += [
"containers/span_rust.h",
"strings/string_view_rust.h",
]
# Base provides conversions between CXX types and base types (e.g.
# std::string_view).
public_deps += [ "//build/rust:cxx_cppdeps" ]
}
# Needed for <atomic> if using newer C++ library than sysroot, except if # Needed for <atomic> if using newer C++ library than sysroot, except if
# building inside the cros_sdk environment - use host_toolchain as a # building inside the cros_sdk environment - use host_toolchain as a
# more robust check for this. # more robust check for this.
@ -1563,8 +1546,6 @@ component("base") {
"files/scoped_temp_file.h", "files/scoped_temp_file.h",
"json/json_file_value_serializer.cc", "json/json_file_value_serializer.cc",
"json/json_file_value_serializer.h", "json/json_file_value_serializer.h",
"logging/rust_log_integration.cc",
"logging/rust_log_integration.h",
"memory/discardable_memory.cc", "memory/discardable_memory.cc",
"memory/discardable_memory.h", "memory/discardable_memory.h",
"memory/discardable_memory_allocator.cc", "memory/discardable_memory_allocator.cc",
@ -2497,46 +2478,6 @@ component("base") {
} }
} }
rust_bindgen("logging_log_severity_bindgen") {
# TODO(danakj): Maybe combine all base bindgen targets, or all base/logging
# ones even) into a single GN target? But the GN rule needs to handle multiple
# headers then.
header = "logging/log_severity.h"
cpp = true
visibility = [ ":*" ]
# Transitive generated header dependency.
deps = [ ":debugging_buildflags" ]
}
rust_static_library("rust_logger") {
allow_unsafe = true # Unsafe needed for FFI.
deps = [
":debugging_buildflags",
":logging_log_severity_bindgen",
":tracing_buildflags",
"//build:chromeos_buildflags",
"//third_party/rust/log/v0_4:lib",
# Needed because of circular dependency: base depends on this target and by
# extension the cxx-generated C++ code, but the cxx-generated code includes
# base headers and calls base code. This seems to generally not cause
# issues, except for partition_alloc which applies configs when depended on.
#
# This allows the generated C++ code to transitively include partition alloc
# headers without issue.
#
# TODO(collinbaker): determine how to handle these cxx bindings-induced
# circular dependencies more robustly.
"//base/allocator/partition_allocator:raw_ptr",
]
visibility = [ ":base" ]
sources = [ "logging/rust_logger.rs" ]
crate_root = "logging/rust_logger.rs"
cxx_bindings = [ "logging/rust_logger.rs" ]
}
if (is_linux || is_chromeos) { if (is_linux || is_chromeos) {
# Split out as a separate target for two reasons: # Split out as a separate target for two reasons:
# - the line number reader is 2x slower in debug builds if not optimized, # - the line number reader is 2x slower in debug builds if not optimized,

View File

@ -13,7 +13,7 @@
#include "base/metrics/histogram_macros.h" #include "base/metrics/histogram_macros.h"
#include "build/build_config.h" #include "build/build_config.h"
#if !BUILDFLAG(IS_NACL) #if 0 // Disables Rust
#include "base/strings/string_view_rust.h" #include "base/strings/string_view_rust.h"
#include "third_party/rust/serde_json_lenient/v0_2/wrapper/functions.h" #include "third_party/rust/serde_json_lenient/v0_2/wrapper/functions.h"
#include "third_party/rust/serde_json_lenient/v0_2/wrapper/lib.rs.h" #include "third_party/rust/serde_json_lenient/v0_2/wrapper/lib.rs.h"
@ -21,7 +21,7 @@
// TODO(crbug.com/40811643): Move the C++ parser into components/nacl to just // TODO(crbug.com/40811643): Move the C++ parser into components/nacl to just
// run in-process there. Don't compile base::JSONReader on NaCL at all. // run in-process there. Don't compile base::JSONReader on NaCL at all.
#if !BUILDFLAG(IS_NACL) #if 0 // Disables Rust
namespace { namespace {
const char kSecurityJsonParsingTime[] = "Security.JSONParser.ParsingTime"; const char kSecurityJsonParsingTime[] = "Security.JSONParser.ParsingTime";
@ -138,7 +138,7 @@ namespace base {
std::optional<Value> JSONReader::Read(std::string_view json, std::optional<Value> JSONReader::Read(std::string_view json,
int options, int options,
size_t max_depth) { size_t max_depth) {
#if BUILDFLAG(IS_NACL) #if 1 // Disables Rust
internal::JSONParser parser(options, max_depth); internal::JSONParser parser(options, max_depth);
return parser.Parse(json); return parser.Parse(json);
#else // BUILDFLAG(IS_NACL) #else // BUILDFLAG(IS_NACL)
@ -183,7 +183,7 @@ std::optional<Value::List> JSONReader::ReadList(std::string_view json,
JSONReader::Result JSONReader::ReadAndReturnValueWithError( JSONReader::Result JSONReader::ReadAndReturnValueWithError(
std::string_view json, std::string_view json,
int options) { int options) {
#if BUILDFLAG(IS_NACL) #if 1 // Disables Rust
internal::JSONParser parser(options); internal::JSONParser parser(options);
auto value = parser.Parse(json); auto value = parser.Parse(json);
if (!value) { if (!value) {
@ -224,7 +224,7 @@ bool JSONReader::UsingRust() {
if (!base::FeatureList::GetInstance()) { if (!base::FeatureList::GetInstance()) {
return false; return false;
} }
#if BUILDFLAG(IS_NACL) #if 1 // Disables Rust
return false; return false;
#else #else
return base::FeatureList::IsEnabled(base::features::kUseRustJsonParser); return base::FeatureList::IsEnabled(base::features::kUseRustJsonParser);

View File

@ -118,7 +118,7 @@ typedef FILE* FileHandle;
#include "base/fuchsia/scoped_fx_logger.h" #include "base/fuchsia/scoped_fx_logger.h"
#endif #endif
#if !BUILDFLAG(IS_NACL) #if 0 // Disables Rust
#include "base/logging/rust_logger.rs.h" #include "base/logging/rust_logger.rs.h"
#endif #endif
@ -530,7 +530,7 @@ bool BaseInitLoggingImpl(const LoggingSettings& settings) {
} }
#endif #endif
#if !BUILDFLAG(IS_NACL) #if 0 // Disables Rust
// Connects Rust logging with the //base logging functionality. // Connects Rust logging with the //base logging functionality.
internal::init_rust_log_crate(); internal::init_rust_log_crate();
#endif #endif