image-rs / imageproc

Image processing operations
MIT License
758 stars 149 forks source link

"cannot find trait `FontRef` in this scope" #607

Closed szabgab closed 6 months ago

szabgab commented 6 months ago

While trying to publish a crate using imageproc I get this error:

error[E0405]: cannot find trait `FontRef` in this scope
  --> /home/gabor/.cargo/registry/src/index.crates.io-6f17d22bba15001f/imageproc-0.24.0/src/drawing/text.rs:43:64
   |
43 | pub fn text_size(scale: impl Into<PxScale> + Copy, font: &impl FontRef, text: &str) -> (u32, u32) {
   |                                                                ^^^^^^^ not found in this scope

Reproduce

Create a new crate:

Cargo.toml

[package]
name = "try-imageproc"
version = "0.1.0"
edition = "2021"

[dependencies]
imageproc = "0.24.0"

Run

cargo publish --dry-run

Environment

$ rustc -vV
rustc 1.78.0 (9b00956e5 2024-04-29)
binary: rustc
commit-hash: 9b00956e56009bab2aa15d7bff10916599e3d6d6
commit-date: 2024-04-29
host: x86_64-unknown-linux-gnu
release: 1.78.0
LLVM version: 18.1.2

less -N /home/gabor/.cargo/registry/src/index.crates.io-6f17d22bba15001f/imageproc-0.24.0/src/drawing/text.rs

     40 /// Get the width and height of the given text, rendered with the given font and scale.
     41 ///
     42 /// Note that this function *does not* support newlines, you must do this manually.
     43 pub fn text_size(scale: impl Into<PxScale> + Copy, font: &impl FontRef, text: &str) -> (u32, u32) {
     44     layout_glyphs(scale, font, text, |_, _| {})
     45 }
ripytide commented 6 months ago

I can't reproduce:

> rustc -vV
rustc 1.78.0 (9b00956e5 2024-04-29)
binary: rustc
commit-hash: 9b00956e56009bab2aa15d7bff10916599e3d6d6
commit-date: 2024-04-29
host: x86_64-unknown-linux-gnu
release: 1.78.0
LLVM version: 18.1.2

cat Cargo.toml

[package]
name = "try-imageproc"
version = "0.1.0"
edition = "2021"

[dependencies]
imageproc = "0.24.0"

cargo publish --dry-run

    Updating crates.io index
warning: manifest has no description, license, license-file, documentation, homepage or repository.
See https://doc.rust-lang.org/cargo/reference/manifest.html#package-metadata for more info.
   Packaging try-imageproc v0.1.0 (/tmp/temp)
   Verifying try-imageproc v0.1.0 (/tmp/temp)
    Updating crates.io index
   Compiling autocfg v1.3.0
   Compiling libm v0.2.8
   Compiling proc-macro2 v1.0.82
   Compiling cfg-if v1.0.0
   Compiling unicode-ident v1.0.12
   Compiling crossbeam-utils v0.8.19
   Compiling libc v0.2.154
   Compiling rayon-core v1.12.1
   Compiling simd-adler32 v0.3.7
   Compiling num-traits v0.2.19
   Compiling bytemuck v1.16.0
   Compiling paste v1.0.15
   Compiling lock_api v0.4.12
   Compiling quote v1.0.36
   Compiling crossbeam-epoch v0.9.18
   Compiling syn v2.0.64
   Compiling thiserror v1.0.60
   Compiling adler v1.0.2
   Compiling crc32fast v1.4.0
   Compiling crossbeam-deque v0.8.5
   Compiling anyhow v1.0.83
   Compiling either v1.11.0
   Compiling miniz_oxide v0.7.2
   Compiling num-integer v0.1.46
   Compiling scopeguard v1.2.0
   Compiling memchr v2.7.2
   Compiling num-bigint v0.4.5
   Compiling arrayvec v0.7.4
   Compiling aligned-vec v0.5.0
   Compiling built v0.7.2
   Compiling minimal-lexical v0.2.1
   Compiling v_frame v0.3.8
   Compiling nom v7.1.3
   Compiling rayon v1.10.0
   Compiling rav1e v0.7.1
   Compiling num-rational v0.4.2
   Compiling getrandom v0.2.15
   Compiling log v0.4.21
   Compiling rand_core v0.6.4
   Compiling flate2 v1.0.30
   Compiling spin v0.9.8
   Compiling num-complex v0.4.6
   Compiling itertools v0.12.1
   Compiling simd_helpers v0.1.0
   Compiling av1-grain v0.2.3
   Compiling safe_arch v0.7.1
   Compiling matrixmultiply v0.3.8
   Compiling maybe-rayon v0.1.1
   Compiling once_cell v1.19.0
   Compiling imgref v1.10.1
   Compiling new_debug_unreachable v1.0.6
   Compiling weezl v0.1.8
   Compiling noop_proc_macro v0.3.0
   Compiling bitstream-io v2.3.0
   Compiling ppv-lite86 v0.2.17
   Compiling typenum v1.17.0
   Compiling loop9 v0.1.5
   Compiling rand_chacha v0.3.1
   Compiling wide v0.7.19
   Compiling flume v0.11.0
   Compiling avif-serialize v0.8.1
   Compiling approx v0.5.1
   Compiling rgb v0.8.37
   Compiling fdeflate v0.3.4
   Compiling zune-inflate v0.2.54
   Compiling half v2.4.1
   Compiling ttf-parser v0.21.1
   Compiling thiserror-impl v1.0.60
   Compiling profiling-procmacros v1.0.15
   Compiling arg_enum_proc_macro v0.3.4
   Compiling num-derive v0.4.2
   Compiling profiling v1.0.15
   Compiling lebe v0.5.2
   Compiling quick-error v2.0.1
   Compiling zune-core v0.4.12
   Compiling jpeg-decoder v0.3.1
   Compiling rawpointer v0.2.1
   Compiling byteorder-lite v0.1.0
   Compiling smallvec v1.13.2
   Compiling bitflags v1.3.2
   Compiling bit_field v0.10.2
   Compiling color_quant v1.1.0
   Compiling exr v1.72.0
   Compiling tiff v0.9.1
   Compiling gif v0.13.1
   Compiling owned_ttf_parser v0.21.0
   Compiling image-webp v0.1.2
   Compiling png v0.17.13
   Compiling zune-jpeg v0.4.11
   Compiling simba v0.8.1
   Compiling rand v0.8.5
   Compiling num-iter v0.1.45
   Compiling qoi v0.4.1
   Compiling byteorder v1.5.0
   Compiling custom_derive v0.1.7
   Compiling ab_glyph_rasterizer v0.1.8
   Compiling conv v0.3.3
   Compiling ab_glyph v0.2.26
   Compiling rand_distr v0.4.3
   Compiling num v0.4.3
   Compiling ravif v0.11.5
   Compiling image v0.25.1
   Compiling nalgebra v0.32.5
   Compiling imageproc v0.24.0
   Compiling try-imageproc v0.1.0 (/tmp/temp/target/package/try-imageproc-0.1.0)
    Finished `dev` profile [unoptimized + debuginfo] target(s) in 25.63s
    Packaged 5 files, 1003.0B (831.0B compressed)
   Uploading try-imageproc v0.1.0 (/tmp/temp)
warning: aborting upload due to dry run
szabgab commented 6 months ago

Very strange. After removing /home/gabor/.cargo/registry/src/index.crates.io-6f17d22bba15001f/imageproc-0.24.0/ and running cargo publish --dry-run again, the process passed.

Maybe I edited that source-file by mistake?

Thanks for checking.