Skip to content

Commit

Permalink
Implement 'bytes' accessors for UPB :)
Browse files Browse the repository at this point in the history
Move the 'accessors_test.rs' to shared/ as both kernels now support the same accessor types.

PiperOrigin-RevId: 526591987
  • Loading branch information
buchgr authored and copybara-github committed Apr 24, 2023
1 parent 37c8f81 commit 0ecb729
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 82 deletions.
12 changes: 0 additions & 12 deletions rust/test/cpp/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,3 @@
# To do that use:
# * `rust_cc_proto_library` instead of `rust_proto_library`.
# * `//rust:protobuf_cpp` instead of `//rust:protobuf``.

load("@rules_rust//rust:defs.bzl", "rust_test")

rust_test(
name = "accessors_test",
srcs = ["accessors_test.rs"],
tags = [
# TODO(b/270274576): Enable testing on arm once we have a Rust Arm toolchain.
"not_build:arm",
],
deps = ["//rust/test:unittest_cc_rust_proto"],
)
20 changes: 20 additions & 0 deletions rust/test/shared/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -121,3 +121,23 @@ rust_test(
],
deps = ["//rust/test:unittest_upb_rust_proto"],
)

rust_test(
name = "accessors_cpp_test",
srcs = ["accessors_test.rs"],
tags = [
# TODO(b/270274576): Enable testing on arm once we have a Rust Arm toolchain.
"not_build:arm",
],
deps = ["//rust/test:unittest_cc_rust_proto"],
)

rust_test(
name = "accessors_upb_test",
srcs = ["accessors_test.rs"],
tags = [
# TODO(b/270274576): Enable testing on arm once we have a Rust Arm toolchain.
"not_build:arm",
],
deps = ["//rust/test:unittest_upb_rust_proto"],
)
File renamed without changes.
12 changes: 0 additions & 12 deletions rust/test/upb/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,3 @@
# To do that use:
# * `rust_upb_proto_library` instead of `rust_proto_library`.
# * `//rust:protobuf_upb` instead of `//rust:protobuf``.

load("@rules_rust//rust:defs.bzl", "rust_test")

rust_test(
name = "accessors_test",
srcs = ["accessors_test.rs"],
tags = [
# TODO(b/270274576): Enable testing on arm once we have a Rust Arm toolchain.
"not_build:arm",
],
deps = ["//rust/test:unittest_upb_rust_proto"],
)
57 changes: 0 additions & 57 deletions rust/test/upb/accessors_test.rs

This file was deleted.

2 changes: 1 addition & 1 deletion src/google/protobuf/compiler/rust/accessors/accessors.cc
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ std::unique_ptr<AccessorGenerator> AccessorGenerator::For(
if (field.desc().is_repeated()) return nullptr;
return ForSingularScalar(field);
case FieldDescriptor::TYPE_BYTES:
if (field.desc().is_repeated() || field.is_upb()) return nullptr;
if (field.desc().is_repeated()) return nullptr;
return ForSingularBytes(field);

default:
Expand Down

0 comments on commit 0ecb729

Please sign in to comment.