Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support syn::File case for module level document #3

Merged
merged 8 commits into from
Oct 29, 2022

Conversation

termoshtt
Copy link
Owner

Resolve #1

@termoshtt
Copy link
Owner Author

There are two problems:

error[E0658]: inner macro attributes are unstable
 --> katexit-example/src/lib.rs:1:4                                                 
  |
1 | #![katexit::katexit]                                                            
  |    ^^^^^^^^^^^^^^^^
  |                                                                                 
  = note: see issue #54726 <https://github.com/rust-lang/rust/issues/54726> for more information
  = help: add `#![feature(custom_inner_attributes)]` to the crate attributes to enable
  • cargo +nightly --doc does not works:
error[E0658]: `#[prelude_import]` is for use by rustc only
  --> katexit-example/src/lib.rs:1:1
   |
1  | / #![feature(custom_inner_attributes)]
2  | | #![katexit::katexit]
3  | | //! Module level document example
4  | |
...  |
13 | | /// $$
14 | | pub fn my_func() {}
   | |___________________^
   |
   = help: add `#![feature(prelude_import)]` to the crate attributes to enable

error: Compilation failed, aborting rustdoc

@Andlon
Copy link

Andlon commented Oct 28, 2022

Seems like it could perhaps work now? This seems to actually work on nightly with your branch:

#![feature(custom_inner_attributes)]
#![feature(prelude_import)]
#![cfg_attr(doc, katexit::katexit)]
//! Test $x = 2$.
//!
//! <div>$$
//! \iiint_{\Omega} f(x) \, \mathrm{d}x
//! $$</div>
fn main() {}

image

Which is exciting, to say the least :-) I'm not sure about the implications of this - how "stable" is this? I'm not sure if we can deploy a solution like this to docs.rs since there is no way to pin the nightly version on there. Promising, nonetheless!

@termoshtt
Copy link
Owner Author

I confirm this works with cargo 1.66.0-nightly (3ff044334 2022-10-17). Thanks :)

@termoshtt termoshtt merged commit d2e1084 into main Oct 29, 2022
@termoshtt termoshtt deleted the support-file-level branch October 29, 2022 12:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support for module-level docs
2 participants