Skip to content

Commit

Permalink
Fix documentation on no-std targets
Browse files Browse the repository at this point in the history
    error[E0463]: can't find crate for `std`
      |
      = note: the `thumbv7m-none-eabi` target may not support the standard library
      = note: `std` is required by `dyn_clone` because it does not declare `#![no_std]`
      = help: consider building the standard library from source with `cargo build -Zbuild-std`

    error: cannot find macro `assert_eq` in this scope
       --> src/lib.rs:144:9
        |
    144 |         assert_eq!(*data_ptr as *const (), t as *const T as *const ());
        |         ^^^^^^^^^
        |
    help: consider importing this macro
        |
    116 + use core::assert_eq;
        |

    error[E0405]: cannot find trait `Clone` in this scope
       --> src/lib.rs:110:13
        |
    110 |     impl<T: Clone> Sealed for T {}
        |             ^^^^^ not found in this scope
        |
    help: consider importing one of these items
        |
    109 +     use core::clone::Clone;
        |
    109 +     use crate::__private::Clone;
        |

    error[E0405]: cannot find trait `Clone` in this scope
       --> src/lib.rs:112:13
        |
    112 |     impl<T: Clone> Sealed for [T] {}
        |             ^^^^^ not found in this scope
        |
    help: consider importing one of these items
        |
    109 +     use core::clone::Clone;
        |
    109 +     use crate::__private::Clone;
        |

    error[E0405]: cannot find trait `Sized` in this scope
       --> src/lib.rs:139:9
        |
    139 |     T: ?Sized + DynClone,
        |         ^^^^^ not found in this scope
        |
    help: consider importing this trait
        |
    116 + use core::marker::Sized;
        |

    error[E0405]: cannot find trait `Sized` in this scope
       --> src/lib.rs:153:9
        |
    153 |     T: ?Sized + DynClone,
        |         ^^^^^ not found in this scope
        |
    help: consider importing this trait
        |
    116 + use core::marker::Sized;
        |

    error[E0405]: cannot find trait `Sized` in this scope
       --> src/lib.rs:179:9
        |
    179 |     T: ?Sized + DynClone,
        |         ^^^^^ not found in this scope
        |
    help: consider importing this trait
        |
    116 + use core::marker::Sized;
        |

    error[E0405]: cannot find trait `Clone` in this scope
       --> src/lib.rs:192:8
        |
    192 |     T: Clone,
        |        ^^^^^ not found in this scope
        |
    help: consider importing one of these items
        |
    116 + use core::clone::Clone;
        |
    116 + use crate::__private::Clone;
        |

    error[E0405]: cannot find trait `Clone` in this scope
       --> src/lib.rs:207:8
        |
    207 |     T: Clone,
        |        ^^^^^ not found in this scope
        |
    help: consider importing one of these items
        |
    116 + use core::clone::Clone;
        |
    116 + use crate::__private::Clone;
        |

    warning: relaxing a default bound only does something for `?Sized`; all other traits are not bound by default
       --> src/lib.rs:139:8
        |
    139 |     T: ?Sized + DynClone,
        |        ^^^^^^

    warning: relaxing a default bound only does something for `?Sized`; all other traits are not bound by default
       --> src/lib.rs:153:8
        |
    153 |     T: ?Sized + DynClone,
        |        ^^^^^^

    warning: relaxing a default bound only does something for `?Sized`; all other traits are not bound by default
       --> src/lib.rs:179:8
        |
    179 |     T: ?Sized + DynClone,
        |        ^^^^^^

    Some errors have detailed explanations: E0405, E0463.
    For more information about an error, try `rustc --explain E0405`.
    warning: `dyn-clone` (lib doc) generated 3 warnings
    error: could not document `dyn-clone`
  • Loading branch information
dtolnay committed Nov 3, 2023
1 parent 4bcfc07 commit 453e078
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@
//! ```

#![doc(html_root_url = "https://docs.rs/dyn_clone/1.0.14")]
#![cfg_attr(not(doc), no_std)]
#![no_std]
#![allow(
clippy::missing_panics_doc,
clippy::needless_doctest_main,
Expand All @@ -90,6 +90,9 @@

extern crate alloc;

#[cfg(doc)]
extern crate core as std;

#[macro_use]
mod macros;

Expand Down

0 comments on commit 453e078

Please sign in to comment.