rust-lang / rust

Empowering everyone to build reliable and efficient software.
https://www.rust-lang.org
Other
96.81k stars 12.5k forks source link

[rustdoc] re-add --disable-minification #129908

Open lolbinarycat opened 1 week ago

lolbinarycat commented 1 week ago

the line to change would be in write_shared.rs:154: cx.shared.fs.write(filename, f.minified())

this should use f.bytes instead of f.minified() if the --no-minify flag is specified.

this flag would mostly be useful for debugging rustdoc itself, allowing js and css errors to accurately report line numbers.

lolbinarycat commented 1 week ago

apparently this existed before in the form of --disable-minification, but was removed without discussion in https://github.com/rust-lang/rust/pull/101702, however, the corrosponding config.toml option build.docs-minification was not removed, instead being silently ignored.

lolbinarycat commented 1 week ago

silently ignoring removed options is not a good solution, especially when not all of the documentation has been updated to reflect the removal.

lolbinarycat commented 1 week ago

the rationale for removal is that is that it would allow the contents of the file to change without the filename hash changing, but this is easily addressed by just adding nominify after the hash if minification is disabled.

GuillaumeGomez commented 1 week ago

I don't mind putting back the option but you'll need to have a good use-case for it (implementing the option so it doesn't go against why it was removed originally shouldn't be too complicated).

lolbinarycat commented 1 week ago

usecase is i don't want to do hacky and fallible symlink stuff just to get accurate line number reporting.

alternative is making a robust symlink override as part of bootstrap, but that seem like a lot more work than just reinstituting the option