Skip to content

The code generated using std::string in the namespace does not introduce ToCppString #1488

@smagical

Description

@smagical

Describe the bug
When a namespaced function uses std::string, the generated rs cannot correctly reference ToCppString

To Reproduce

#include <string>
namespace test{
    std::string test(std::string value){
        return value;
    };
}
use autocxx::prelude::*;

include_cpp! {
     #include "test.h"
    safety!(unsafe_ffi)
    generate!("test::test")
}

Expected behavior
The generated code is as follows

  pub mod test {
        #[allow(unused_imports)]
        use super::{bindgen, cxxbridge, output};
        pub fn test(value: impl ToCppString) -> cxx::UniquePtr<cxx::CxxString> {
            cxxbridge::test_autocxx_wrapper_0xf5230f3da42bdc87(value.into_cpp())
        }
    }

use super::{bindgen, cxxbridge, output};
ToCppString is not introduced
Additional context
Add any other context about the problem here.

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