Fix data and compile_data for rust_doc (#1741)

Fixes #1572 

Main issue is that data_paths do not inherit from original crate when building rust_doc (and probably rust_test).
The main idea is to rely on crate_info which inherit correctly from original crate.

Issue with this draft is that compile_data is filed with File instead of Target when building 3rd party crate.

```
ERROR: <redacted>__base64-0.13.1/BUILD.bazel:34:13: in rust_library rule @<redacted>__base64-0.13.1//:base64:
Traceback (most recent call last):
	File "external/rules_rust/rust/private/rust.bzl", line 197, column 32, in _rust_library_impl
		return _rust_library_common(ctx, "rlib")
	File "external/rules_rust/rust/private/rust.bzl", line 292, column 32, in _rust_library_common
		return rustc_compile_action(
	File "external/rules_rust/rust/private/rustc.bzl", line 1093, column 46, in rustc_compile_action
		args, env_from_args = construct_arguments(
	File "external/rules_rust/rust/private/rustc.bzl", line 915, column 38, in construct_arguments
		expand_list_element_locations(
	File "external/rules_rust/rust/private/utils.bzl", line 311, column 53, in expand_list_element_locations
		return [_expand_location_for_build_script_runner(ctx, arg, data) for arg in args]
	File "external/rules_rust/rust/private/utils.bzl", line 255, column 30, in _expand_location_for_build_script_runner
		dedup_expand_location(ctx, env, data),
	File "external/rules_rust/rust/private/utils.bzl", line 230, column 31, in dedup_expand_location
		return ctx.expand_location(input, _deduplicate(targets))
Error in expand_location: at index 0 of targets, got element of type File, want Target
```
13 files changed
tree: 3f62e91bb05839b244ca8fbfbf4632840dbf7d47
  1. .bazelci/
  2. .github/
  3. bindgen/
  4. cargo/
  5. crate_universe/
  6. docs/
  7. examples/
  8. proto/
  9. rust/
  10. test/
  11. tools/
  12. util/
  13. wasm_bindgen/
  14. .bazelignore
  15. .bazelrc
  16. .clang-format
  17. .gitattributes
  18. .gitignore
  19. ARCHITECTURE.md
  20. AUTHORS
  21. BUILD.bazel
  22. CODEOWNERS
  23. COMPATIBILITY.md
  24. CONTRIBUTING.md
  25. CONTRIBUTORS
  26. LICENSE.txt
  27. README.md
  28. version.bzl
  29. WORKSPACE.bazel
README.md

Rust Rules

  • Postsubmit Build status

Overview

This repository provides rules for building Rust projects with Bazel.

Community

General discussions and announcements take place in the GitHub Discussions, but there are additional places where community members gather to discuss rules_rust.

Documentation

Please refer to the full documentation.