Skip to content

Decide on semantics of #[namespace = "..."] #416

@dtolnay

Description

@dtolnay

Which of the following does this mean?

#[cxx::bridge(namespace = "n")]
mod ffi {
    extern "C++" {
        fn f();
    }
}
  • A: "f() as if resolved inside of ::n"
  • B: "precisely ::n::f()"

I realized when upgrading a nonpublic codebase from cxx 0.5.2 to 0.5.3 that we had unintentionally broken some code with #370 by changing from A to B, but we'd never deliberately decided on which is the intended behavior.

  namespace n {
  extern "C" {
  void n$cxxbridge05$f() noexcept {
-   void (*f$)() = f;       // 0.5.2 (A)
+   void (*f$)() = ::n::f;  // 0.5.3 (B)
    f$();
  }
  } // extern "C"
  } // namespace n

@adetaylor

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions