Repository: tauri-apps/wry (language: rust)

Issue:
API docs for wry v0.35.0 is unavailable on docs.rs
**Describe the bug**

Building API docs on docs.rs failed.[ API docs for v0.35.0](https://docs.rs/crate/wry/latest) is not available.

Build log: https://docs.rs/crate/wry/0.35.0/builds/988909

**Steps To Reproduce**

N/A

**Expected behavior**

Documentation for v0.35.0 can be referred on docs.rs

**Screenshots**

![image](https://github.com/tauri-apps/wry/assets/823277/d2ea6083-af9e-4682-a976-1e25e8820abd)

**Platform and Versions (please complete the following information):**
OS: N/A
Rustc: N/A

**Would you want to assign yourself to resolve this bug?**
- [ ] Yes
- [x] No

**Additional context**

Errors reported in the build log:

```
[INFO] [stderr] error[E0433]: failed to resolve: use of undeclared crate or module `gdkx11`
[INFO] [stderr]     --> src/lib.rs:1151:9
[INFO] [stderr]      |
[INFO] [stderr] 1151 |     use gdkx11::glib::Cast;
[INFO] [stderr]      |         ^^^^^^ use of undeclared crate or module `gdkx11`
[INFO] [stderr] 
[INFO] [stderr] error[E0433]: failed to resolve: use of undeclared crate or module `gtk`
[INFO] [stderr]     --> src/lib.rs:1136:8
[INFO] [stderr]      |
[INFO] [stderr] 1136 |     W: gtk::prelude::IsA<gtk::Container>;
[INFO] [stderr]      |        ^^^ use of undeclared crate or module `gtk`
[INFO] [stderr] 
[INFO] [stderr] error[E0433]: failed to resolve: use of undeclared crate or module `gtk`
[INFO] [stderr]     --> src/lib.rs:1149:8
[INFO] [stderr]      |
[INFO] [stderr] 1149 |     W: gtk::prelude::IsA<gtk::Container>,
[INFO] [stderr]      |        ^^^ use of undeclared crate or module `gtk`
[INFO] [stderr] 
[INFO] [stderr] error[E0412]: cannot find type `InnerWebView` in this scope
[INFO] [stderr]     --> src/lib.rs:1171:12
[INFO] [stderr]      |
[INFO] [stderr] 1171 |   webview: InnerWebView,
[INFO] [stderr]      |            ^^^^^^^^^^^^ not found in this scope
[INFO] [stderr] 
[INFO] [stderr] error[E0433]: failed to resolve: use of undeclared crate or module `gtk`
[INFO] [stderr]     --> src/lib.rs:1136:26
[INFO] [stderr]      |
[INFO] [stderr] 1136 |     W: gtk::prelude::IsA<gtk::Container>;
[INFO] [stderr]      |                          ^^^ use of undeclared crate or module `gtk`
[INFO] [stderr] 
[INFO] [stderr] error[E0433]: failed to resolve: use of undeclared crate or module `gtk`
[INFO] [stderr]     --> src/lib.rs:1149:26
[INFO] [stderr]      |
[INFO] [stderr] 1149 |     W: gtk::prelude::IsA<gtk::Container>,
[INFO] [stderr]      |                          ^^^ use of undeclared crate or module `gtk`
[INFO] [stderr] 
[INFO] [stderr] Some errors have detailed explanations: E0412, E0433.
[INFO] [stderr] For more information about an error, try `rustc --explain E0412`.
[INFO] [stderr] error: could not document `wry`
[INFO] [stderr] 
[INFO] [stderr] Caused by:
[INFO] [stderr]   process didn't exit successfully: `/opt/rustwide/rustup-home/toolchains/nightly-x86_64-unknown-linux-gnu/bin/rustdoc --edition=2021 --crate-type lib --crate-name wry src/lib.rs --target x86_64-unknown-linux-gnu -o /opt/rustwide/target/x86_64-unknown-linux-gnu/doc --cfg 'feature="file-drop"' --cfg 'feature="protocol"' --error-format=json --json=diagnostic-rendered-ansi,artifacts,future-incompat -C metadata=5cec3cd8eb83027a -L dependency=/opt/rustwide/target/x86_64-unknown-linux-gnu/debug/deps -L dependency=/opt/rustwide/target/debug/deps --extern http=/opt/rustwide/target/x86_64-unknown-linux-gnu/debug/deps/libhttp-05c14da7421f4629.rmeta --extern libc=/opt/rustwide/target/x86_64-unknown-linux-gnu/debug/deps/liblibc-38c0088155dba44d.rmeta --extern log=/opt/rustwide/target/x86_64-unknown-linux-gnu/debug/deps/liblog-7429a03555bcf241.rmeta --extern once_cell=/opt/rustwide/target/x86_64-unknown-linux-gnu/debug/deps/libonce_cell-3810e71ba6b5ea8b.rmeta --extern raw_window_handle=/opt/rustwide/target/x86_64-unknown-linux-gnu/debug/deps/libraw_window_handle-0e8010c39360f59d.rmeta --extern serde=/opt/rustwide/target/x86_64-unknown-linux-gnu/debug/deps/libserde-c4eea3c00534bc11.rmeta --extern serde_json=/opt/rustwide/target/x86_64-unknown-linux-gnu/debug/deps/libserde_json-37085cd1fdf87490.rmeta --extern thiserror=/opt/rustwide/target/x86_64-unknown-linux-gnu/debug/deps/libthiserror-6b9da5ff673c6c25.rmeta --extern url=/opt/rustwide/target/x86_64-unknown-linux-gnu/debug/deps/liburl-216f9f0917650058.rmeta --extern-html-root-url 'http=https://docs.rs/http/0.2.11/x86_64-unknown-linux-gnu' --extern-html-root-url 'libc=https://docs.rs/libc/0.2.150/x86_64-unknown-linux-gnu' --extern-html-root-url 'log=https://docs.rs/log/0.4.20/x86_64-unknown-linux-gnu' --extern-html-root-url 'once_cell=https://docs.rs/once_cell/1.18.0/x86_64-unknown-linux-gnu' --extern-html-root-url 'raw_window_handle=https://docs.rs/raw-window-handle/0.5.2/x86_64-unknown-linux-gnu' --extern-html-root-url 'serde=https://docs.rs/serde/1.0.193/x86_64-unknown-linux-gnu' --extern-html-root-url 'serde_json=https://docs.rs/serde_json/1.0.108/x86_64-unknown-linux-gnu' --extern-html-root-url 'thiserror=https://docs.rs/thiserror/1.0.50/x86_64-unknown-linux-gnu' --extern-html-root-url 'url=https://docs.rs/url/2.4.1/x86_64-unknown-linux-gnu' -Zunstable-options --cfg docsrs -Z unstable-options --emit=invocation-specific --resource-suffix -20231120-1.76.0-nightly-3a85a5cfe --static-root-path /-/rustdoc.static/ --cap-lints warn --extern-html-root-takes-precedence --crate-version 0.35.0 --cfg linux` (exit status: 1)
```


Discussion / hints:
I haven't confirmed, but `os-webview` feature seems missing in [`[package.metadata.docs.rs]`](https://github.com/tauri-apps/wry/blob/180548ea83f3bf689d81cec6637a1dce58278b5d/Cargo.toml#L15C1-L15C27) which was added at #1077.
I guess I forgot to add it there. While we can add a PR to fix it pretty soon, can anyone confirm it can be built in the doc.rs container by this?
Sorry I don't have same environment to build documents as docs.rs. How to try it is desribed in the following document:

https://github.com/rust-lang/docs.rs/blob/master/README.md#getting-started

From the comment in #1032, @FabianLars may have the pipeline environment.
i do, i'll check in a minute :)
There's a duplicate `#![cfg_attr(docsrs, feature(doc_cfg))]` line in lib.rs - once one of them is removed it builds again after adding the os-webview feature flag.

Fix patch:
diff --git a/.changes/fix-doc-build.md b/.changes/fix-doc-build.md
new file mode 100644
index 000000000..373b53881
--- /dev/null
+++ b/.changes/fix-doc-build.md
@@ -0,0 +1,5 @@
+---
+"wry": patch
+---
+
+Fix the API documentation cannot be built on docs.rs.
diff --git a/Cargo.toml b/Cargo.toml
index c90f053d2..620cbbbdf 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -14,7 +14,7 @@ categories = [ "gui" ]
 
 [package.metadata.docs.rs]
 no-default-features = true
-features = [ "file-drop", "protocol" ]
+features = [ "file-drop", "protocol", "os-webview" ]
 targets = [
   "x86_64-unknown-linux-gnu",
   "x86_64-pc-windows-msvc",
diff --git a/src/lib.rs b/src/lib.rs
index f03443fb9..aa4297d93 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -2,8 +2,6 @@
 // SPDX-License-Identifier: Apache-2.0
 // SPDX-License-Identifier: MIT
 
-#![cfg_attr(docsrs, feature(doc_cfg))]
-
 //! Wry is a Cross-platform WebView rendering library.
 //!
 //! The webview requires a running event loop and a window type that implements [`HasRawWindowHandle`],


Test patch: