Quoting Santiago Vila (2026-06-23 02:33:36) > Explanation from my asistant: > > ------------------------------------------------------------------------------- > The Logger trait at crates/compiler/src/logger.rs:5-12 exposes > codemap::SpanLoc > (a type from a third-party crate) in its public API. This means anyone > who wants to implement Logger must link against the exact same crate > instance of codemap that grass_compiler used, otherwise Rust's type > system sees them as different types even at the same version. > > In normal cargo this works because Cargo unifies all dependencies into > a single instance. In Debian's separate-package build system (where > each crate is an independent package), the codemap that grass_compiler > linked against and the codemap that the test binary links against can > end up as different compilation instances, hence the E0053. > > The simple fix without refactoring the Logger trait: Avoid > implementing Logger in the tests at all. Only two test files (warn.rs > and debug.rs) actually use TestLogger. Instead of a custom logger > implementation that runs into the type identity issue: > > 1. Move TestLogger and impl Logger for TestLogger out of macros.rs > into its own module. > > 2. In the two tests that need it, replace the custom logger with > StdLogger and capture stderr to verify the output. > > Or even simpler: just test that @warn and @debug compile without > error, and skip verifying the exact message content, or use > options.quiet(true) / NullLogger to test the silent path. The Sass > parsing/output tests are already covered by the 80+ other test files; > the logging tests are a nice-to-have. > > The deeper lesson for the author is: avoid third-party crate types in > trait method signatures, prefer &str, usize, and other primitives, or > define a local type. This keeps the trait implementable without > cargo-dependency version gymnastics. > ------------------------------------------------------------------------------- > > I asked it to implement the "simple fix" and the result is attached. > > Of course, this should be taken with a grain of salt, but the fact is > that now I can rebuild the package, while previously I could not. > > So, we can reverse the famous quote from Donald Knuth: > > Beware with the attached patch, I have only verified that it solves > the build error, not that the fix is correct...
That was very helpful, and I think I now found an even better patch. Can I ask you to test the attached patch? (I am aware that you have offered me access, but it is much slower for me to figure that out than pass a patch to you, so I hope that is ok) > I would still be delighted to see a better fix if there is any. I sure hope that my alternative and more compact patch addresses the issue, since that also means it is likely that I actually understood what is really going on here. - Jonas -- * Jonas Smedegaard - idealist & Internet-arkitekt * Tlf.: +45 40843136 Website: http://dr.jones.dk/ * Sponsorship: https://ko-fi.com/drjones [x] quote me freely [ ] ask before reusing [ ] keep private
Description: use codemap without re-export to avoid duplicate crate instance In some situations, likely caused by parallel builds and seen happen on powerful amd64 and s390x hosts using Debian dh-rust tooling, The codemap::SpanLoc object linked with lib/tests/macros.rs differ from grass_compiler::codemap::SpanLoc object. . This patch changes to use same-version non-re-exported codemap in tests which should avoid duplicate crate instance in test execution. Author: Jonas Smedegaard <[email protected]> Bug: https://bugs.debian.org/1135277 Forwarded: not-needed Last-Update: 2026-06-23 --- This patch header follows DEP-3: http://dep.debian.net/deps/dep3/ --- a/Cargo.toml +++ b/Cargo.toml @@ -5,6 +5,9 @@ "crates/lib", ] +[workspace.dependencies] +codemap = "0.1.3" + [profile.release] debug = 1 panic = "abort" --- a/crates/compiler/Cargo.toml +++ b/crates/compiler/Cargo.toml @@ -30,7 +30,7 @@ # todo: update to use asref<path> # todo: update to expose more info (for eww) # todo: update to use text_size::TextRange -codemap = "0.1.3" +codemap.workspace = true wasm-bindgen = { version = "0.2.68", optional = true } # todo: benchmark using phf for global functions phf = { version = "0.11", features = ["macros"] } --- a/crates/lib/Cargo.toml +++ b/crates/lib/Cargo.toml @@ -44,6 +44,7 @@ grass_compiler = { path = "../compiler", version = "=0.13.4", default-features = false } include_sass = { path = "../include_sass", version = "0.13.4", optional = true } clap = { version = "4.3.10", optional = true } +codemap.workspace = true [features] # todo: no commandline by default --- a/crates/lib/tests/macros.rs +++ b/crates/lib/tests/macros.rs @@ -5,8 +5,8 @@ path::{Path, PathBuf}, }; +use codemap::SpanLoc; use grass::{Fs, Logger}; -use grass_compiler::codemap::SpanLoc; #[macro_export] macro_rules! test {
signature.asc
Description: signature

