Skip to content

Creating a service named Service produces weird errors with tonic-build #676

@Dentosal

Description

@Dentosal

Bug Report

Version

tonic v0.4.3
tonic-build v0.4.2

Platform

Windows 10 (64bit) running WSL1 4.4.0-19041-Microsoft #488-Microsoft x86_64 GNU/Linux

Description

Creating a service named Service like this:

syntax = "proto3";
package example;

service Service {
    rpc Anything (Anything) returns (Anything);
}

produces errors like:

error[E0437]: type `Response` is not a member of trait `Service`
   --> /path/to/project/target/debug/build/t_common-fb7feb9559309b84/out/example.rs:123:3
    |
107 |         type Response = http::Response<tonic::body::BoxBody>;
    |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ not a member of trait `Service`

error[E0437]: type `Error` is not a member of trait `Service`
   --> /path/to/project/target/debug/build/t_common-fb7feb9559309b84/out/example.rs:123:4
    |
108 |         type Error = Never;
    |         ^^^^^^^^^^^^^^^^^^^ not a member of trait `Service`

I would expect the code to work, or at least produce a proper error message.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-buildC-bugCategory: Something isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions