Skip to content

error[E0599]: no method named compute_size found for reference &Config in the current scope #2113

@YeahhhhLi

Description

@YeahhhhLi

rule_rust 0.26.0

https://github.com/bazelbuild/rules_rust/blob/0.26.0/examples/proto/basic/lib.rs

diff --git a/examples/proto/basic/lib.rs b/examples/proto/basic/lib.rs
index 2146b3c4..fa18d3ea 100644
--- a/examples/proto/basic/lib.rs
+++ b/examples/proto/basic/lib.rs
@@ -1,5 +1,6 @@
 extern crate common_proto_rust;
 
 pub fn do_something(_x: &common_proto_rust::Config) -> bool {
+    println!("compute_size[{}]", _x.compute_size());
     true
 }

when I run:

bazel run //proto/basic:common_bin 

The following error occurred:

Compiling Rust rlib common_lib (1 files) failed: (Exit 1): process_wrapper failed: error executing command (from target //proto/basic:common_lib) bazel-out/k8-opt-exec-2B5CBBC6/bin/external/rules_rust/util/process_wrapper/process_wrapper --arg-file ... (remaining 30 arguments skipped)

Use --sandbox_debug to see verbose messages from the sandbox and retain the sandbox build root for debugging
error[E0599]: no method named `compute_size` found for reference `&Config` in the current scope
 --> proto/basic/lib.rs:4:37
  |
4 |     println!("compute_size[{}]", _x.compute_size());
  |                                     ^^^^^^^^^^^^ method not found in `&Config`
  |
  = help: items from traits can only be used if the trait is in scope

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions