Comment indentation creates failing doctests

Đang mở
#3,530 2 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

Chưa có ai nhận issue này.

Đánh giá

Độ khó
4/5
Thời gian dự kiến
3-5 ngày
Mức phù hợp với người mới
55/100
Loại issue
Lỗi
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
rust
Lĩnh vực
tooling

Hướng nghiên cứu

Start by reproducing the failure with the Rust doc attribute shown in the issue and the documented .clang_arg options. Read the bindgen code that handles C comments and generates Rust documentation to find where indentation becomes a failing doctest. Done means the generated documentation no longer creates a failing doctest for the example; the issue leaves the implementation approach open.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

cargo test fails if the code for which bindings are generated inadvertently contains indented markdown code blocks.

For instance, if this is generated in a library:

#[doc = "This fails\n\n      to compile"]

a doctest is created that fails to compile.

Could this be avoided somehow? For instance, could I disable interpreting C comments as markdown when using

.clang_arg("-fretain-comments-from-system-headers")
.clang_arg("-fparse-all-comments")

E.g. using raw string

#[doc = r#"This does not fail\n\n      to compile"#]

does not seem to create a doctest.

Ngôn ngữ chính
Rust
Star
5.3k
Fork
846
Merge trung bình
2 ngày 6 giờ
Pull request đã merge (30 ngày)
11

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của rust-lang/rust-bindgen

Tất cả issue của rust-lang/rust-bindgen

Issue tương tự

Thêm issue về Rust

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.