Consider changing/reverting dev profile `debug=line-tables-only`
I'm not really picky on what the solution is, whether it's making debug the default profile and dev opt-in, reverting the debug-line-tables-only on dev, or something else.
Reasoning copied from: https://github.com/rust-lang/cargo/issues/17518#issuecomment-7084718716_
Hi, I know it's a bit late to comment on this. I'm not 100% sure the procedure here, but imho I think this is a bad default that should be reverted. We've already received a bug report about it and it took me a bisect to end up here.
tl;dr, I do not think this concern was given appropriate weight:
This may confuse people switching between toolchain version and has different default
And the existence of a workaround solution isn't good enough. It's a change to fundamental default behavior and there doesn't seem to be any user-facing indication that something has changed/how the user can get full debug info. This is doubly true w.r.t. debuggers, since they will happily let you try to debug them, but provide ~no useful information at all. In my experience, people are not familiar enough with debuggers to see that debugger output as anything other than a debugger and/or compiler bug.
For the past X years (X being at least 4 or 5, basing purely off my own experience), cargo build has meant "my program is debuggable". Tons of tutorials and beginner resources are written with this in mind. If you want a non-debuggable program, you need to opt-in via --release or config options. Invalidating beginner resources (e.g. "tutorial told me to cargo build and debug, but I can't see my variables! I don't know enough to understand why not") seems like it would be a very common occurrence, and would absolutely sour people's early impressions of the language's tooling.
One of the delights I had that made me stick to Rust after bouncing off of c++ was a combination of
- sane defaults. i.e. when something did require configuration, it's very clear that the alternatives are less important or less common than the default (e.g.
--releasedefaulting to-O3rather than, say, always requiring the user to specify an exact optimization level, or optimizing for size by default) - everything I tried/found on tutorials Just Worked™. Especially important because people who are using those tutorials don't have the requisite knowledge to understand why things aren't working and/or how to fix them.
Breaking either of those seems serious enough to be a last resort, let alone both of them. I don't think "minimizing the size of my non-release builds" is something so important that it is "more default" than "my non-release build is debuggable". Even if size is really important, the unfortunate truth is that Rust itself has been saying the latter is the default long enough that it will have certainly shifted a not-insignificant portion of the user-base's perception of what is "default" to include debuggability.
The debugging experience is already generally known to be bad. How likely is it that someone has heard that offhand, has little-to-no experience with debugging Rust, and just assumes that the debugging experience with line-tables-only is the only debugging experience available, and that that's what people meant when they said "debugging rust sucks"?
Users with experience have already been on the rollercoaster of the debugger (i.e. visualizer scripts, which most people don't even know exist) sometimes not working at all, sometimes working decently. To those users, will the debugger not working come across as a rust configuration issue that they can fix? Very likely not. Is there any plan on how to notify people of this change beyond hoping they'll read the release notes?
cc @weihanglo
Thanks for filing this separately!
And the existence of a workaround solution isn't good enough. It's a change to fundamental default behavior and there doesn't seem to be any user-facing indication that something has changed/how the user can get full debug info.
This is true, and you're right that we give little signal today except a changelog item. If not reverting, can we find a way to improve the discoverability? For example, some ideas we could do:
- make the
"Finished"Cargo status line more accurate to reflect the new default - work with some major IDEs so their debug actions default to the new
debugprofile - also make
build.profilemore prominent in the blogpost for changing to old default - change rust-lldb/rust-gbd to hint non-full debuginfo is used
However, to myself, I would still prefer we keeping the new default, per all the discussions linked in https://github.com/rust-lang/cargo/issues/15931 and all the past survey peopole have done. Some examples, build dependencies debuginfo has been turned off since https://github.com/rust-lang/cargo/pull/11252, because the build time benefits (mostly), and also because build deps are usuallly not the thing people debugging for. Another like disk usage has been one of the top most reasons scaring people away (especially with LLM and git worktree workflows), and this has a huge direct benefit to it (that said, we are also looking at ways to dedup more build artifacts, and trim-paths may also affect debugging experience, see https://github.com/rust-lang/cargo/issues/17586).
Tons of tutorials and beginner resources are written with this in mind. If you want a non-debuggable program, you need to opt-in via --release or config options.
This is also true. I am not sure how to help update those tutorial, if we decide shipping this as-is. However, in contrast, there are also tons of tutorial teaching people setting line-table-only or even turning off debug at all for a faster iteration loop. That is also an indicator we might want to re-evaluate the default.
I understand the frustrations, especially for people that have put a lot effort in debugging experience and a incoming new default kills most of the the effort. I'd love to collaborate and brainstorm good ways to prepare the migration.
BTW, I could share all the past data/survey and help summarize it, if needed.
If not reverting, can we find a way to improve the discoverability? For example, some ideas we could do:
We could also draft a official blog post for this, for a higher visibility, and clarify the intent, and have a clear migration path for people.
What it boils down to imo is this:
Anyone who cares about binary size is necessarily invested enough to 1. Know enough to fiddle with config settings, and 2. Not be bothered too much by doing so. They'd have to be building a program large enough for the build time and size to matter.
This is in stark contrast to "people who want to step through their code" which includes people of all experience levels, writing projects of all sizes (including, speaking from experience, people writing their first programs who have no idea what debug info even is). I think the default should be "what do people expect" + "what is most commonly useful in the average situation", and i dont see how binary size at the expense of all debugability fits that.
Regardless, Rust has been saying "debuginfo is opt out" for long enough that i think the ship has sailed on which is the better default. Imo there needs to be an incredibly compelling reason to change such a fundamental config default in a way that is, at best, a tradeoff.
Maybe it would be an appropriate change for an Edition change? If a change to people's longstanding workflow is dropped in a random patch, the minimum i (as a hypothetical user, unaware of this discussion) would consider acceptable would be an explicit, deliberately intrusive "which build default would you prefer" upon installing a toolchain. As a dev, that's sortof a gross solution, but changing things out from under people without telling them creates lasting bad impressions.
make the "Finished" Cargo status line more accurate to reflect the new default
If you have to add a giant "this build doesnt contain debug info" banner on build output, it seems like that's a sign that including debug info is what people expect as the default. If that's the case, it doesnt seem to make much sense to change it.
work with some major IDEs so their debug actions default to the new debug profile
This wouldnt help with workflows that dont have automatic build steps and/or that rely on user-defined build steps (e.g. vscode + lldb-dap).
also make build.profile more prominent in the blogpost for changing to old default
i would be very surprised to find such a chage in a non-edition rust version bump. I dont always read patch notes before bumping my toolchain version because rust is fairly stable and gates user-facing, breaking config changes like this behind editions (e.g. resolver)
change rust-lldb/rust-gbd to hint non-full debuginfo is used
those launcher scripts are more or less unused on windows because they dont end up in $PATH unless you put them there yourself. If we put the check in the visualizers, we need to be able to detect when non-full debuginfo is there via what's available in the debugger API. As the guy largely in charge of those scripts, i can say that's a non-trivial problem (and almost certainly impossible for natvis).
all the past survey peopole have done
Poor debugging experience gets just about as many complaints as binary size in surveys. We just recently did a debugging survey as well to get more specifics there, so we have very recent data. Given that, i dont think it makes sense to consider either one more important than the other.
disk usage has been one of the top most reasons scaring people away (especially with LLM and git worktree workflows)
I'm incredibly skeptical of the idea of sacrificing human UX to cater to LLMs.
build dependencies debuginfo has been turned off
This was an excellent change because 99% of the time, you (correctly) assume the bug is in your own code, not in dependency code.
So the question for this is: when the average person builds a non-release application, do you think that it's more likely that
- They will debug that application
- Minimum size is the highest priority, and they will not debug that build
And as a followup, if the latter is more likely, is it significantly more likely? If not, is this new default worth annoying e.g. 45% of rust developers to cater to the 55%?
I am not sure how to help update those tutorial
My point is that there isnt really a way. There are years and years worth of videos, books, blog posts, stackoverflow comments, etc. That assume things work one way. Some cant change, lots are very likely to not change.
There'll be a disconnect between some subset of tutorials and how cargo actually works. That will make the onboarding experience less smooth, which (again, speaking from experience with this exact problem in C++) has the potential to filter people.
Are the benefits of this change worth that in comparison to just making debug the default build and dev the opt-in?
sane defaults. i.e. when something did require configuration, it's very clear that the alternatives are less important or less common than the default
I can understand your frustration with this point.
This is a really hard thing for the Cargo team to navigate: there isn't just one sane default. We saw this with the MSRV aware resolver where in adding it, many people came to us with their workflows and why they thought their workflow should be the default. They had a lot of good reasons and we had to work through that to determine which to favor and how to still best support all of the others even if some compromise was needed.
As for this change, it doesn't just impact disk space but also compile time. I didn't include numbers in the PR description because I didn't collect fresh ones but you can find them in the PR thread and the Issue thread. According to the 2025 survey, those were the top two challenges (with debugger experience coming next!). This has been a case where people "in the know" knew the magic incantation to address the problem, leaving out many other users. As for disk space specifically, from the discussions I've observed, it does not seem to be limited to people "in the know". Since our decision, we've also seen this be one of the top changes made in third-party experimental cargo implementations or forks. For many people, this change is to a "sane default".
While we shouldn't over-index on feedback, I've seen many people in different forums grateful that we are making this change, sometimes even with a tinge of frustration that we hadn't done this sooner.
So the question for this is: when the average person builds a non-release application, do you think that it's more likely that
A slightly different framing that I've been considering: per edit, how many times does someone run their application or tests outside of a debugger vs in a debugger?
This presupposes that we've handled the transition well and help people understand they need to use --profile debug for debugging.
Our operating assumption is people don't debug as often as the other operations. For the assumed outliers who do, they can set build.profile = "debug".
Maybe it would be an appropriate change for an Edition change?
Profiles exist at the workspace level and there isn't a workspace edition field. For workspace.resolver, we default it from the package's edition if a package is present in the manifest but many people encourage virtual manifests for workspaces and this tends to cause people to be on an old resolver version. I recently migrated all of my workspaces to 2024 edition and I expect I forgot to update workspace.resolver in half of them. For anyone with a virtual manifest, they would need to know about this and recreate the configuration we have done. This doesn't scale well and runs into the "in the know" problem.
As an FYI, we've been talking about eventually changing the default for the upcoming trim-paths profile setting so it is on. This helps with reproducibility, debugging on a machine different than where it was built (edit the remap file), and better cache hits for reducing disk space and speeding up builds. This will require the use of a remap file though.
Before going any further, I just want to tl;dr my concerns to make sure they're not getting lost in the explanations, since I can be pretty longwinded.
- this change disproportionately negatively affects those who are beginners to rust and/or programming (i.e. those most likely to be filtered by such an annoyance). It disproportionately benefits people who would be fine fiddling with config options anyway. A language catering their defaults to the most experienced is how you get beginner-hostile messes like C++'s tooling, and I do not think we should be striving to lower our tooling to C++'s level.
2a. it changes a longstanding user-facing default in a way that is a tradeoff, rather than an unambiguous win. Such a change should be considered an alternative to the established norm, thus opt-in, not opt-out.
2b. 5-30%(?) build size/time seems like sortof small potatoes to change such a visible default when there's bigger fish to fry (e.g. something like cargo-sweep or cargo-clean-all should be behavior built in to cargo. current cargo clean UX is annoying, so it makes the binary size issue seem extra egregious once users need to clean out their projects folder).
- per the rust debugging survey, 47% of respondents currently use debuggers. 74% of respondents currently, or have in the past, used debuggers. I do not think debugging is uncommon enough (relative to the number of people to which
line-tables-onlyis a dealbreaker) to consider it worth throwing under the bus for the sake ofline-tables-only line-tables-onlyis a bad default in general. Either full debuginfo or none at all would be better. For people expecting the old default (full debuginfo),line-tables-onlylooks like a debugger or compiler bug. I've done nothing but work on debuggers for the past 2 years and it looked like a compiler bug to me. 1 in 8 respondents don't even know which debugger they are using. It is exceedingly unlikely that, upon encounteringline-tables-onlybehavior in the debugger, the average person would identify it as a configuration issue.
In short, the solution that would be most ideal to me is making debug the new default build config, and dev can be the one that people opt-in to via build.profile.
This has been a case where people "in the know" knew the magic incantation to address the problem, leaving out many other users.
That's always going to be the case for opt-in options. My concern is this: should you have to be "in the know" to be able to debug your application?
Are the types of people who are more likely to debug their applications frequently also more likely to be "in the know" compared to those who are more likely to care about binary size/build time (to the point that 5-30% matters)?
This presupposes that we've handled the transition well and help people understand they need to use --profile debug for debugging.
One thing that's also worth point out is that this change runs counter to other language's default build configuration lists. When I open a new C++ or C# project in Visual Studio, I have 2 configs: Debug and Release, and Debug is selected by default:
This is also true of Jetbrains Rider
The default configuration when opening a new project in CLion includes debug info.
CMake lists the following "typical" build profiles: Debug, Release, RelWithDebInfo and MinSizeRel. I don't think Debug being first in that list is a coincidence (nor is Debug and Release being the first 2 a coincidence).
Python requires the -O flag to opt-out of asserts and __debug__-gated statements
So you're swimming upstream against both Rust users' beliefs about the default, and other languages' default as well.
per edit, how many times does someone run their application or tests outside of a debugger vs in a debugger
The assumption being you run the application to see if it works, and if it doesn't, you then debug it, no? With the new default, that would mean you'd need another rebuild once you realize the application doesn't work. I assume the dev and debug output isn't shared, so wouldn't that result in larger target directories since now you have effectively 2 copies of everything? Also, the debug recompile isn't instantaneous. If the build time save of dev is, say, 15%, you'd need to compile dev 7 times for every 1 debug compile for it to actually save time.
As an FYI, we've been talking about eventually changing the default for the upcoming trim-paths profile setting so it is on.
To be clear, my problem isn't with changing defaults as a whole, my problem is changing a longstanding user-facing default in a way that silently breaks existing workflows and disproportionately negatively impacts less experienced users. AFAIK the trim-paths change doesn't really come at the expense of anything else, nor does it negatively impact anyone's existing workflows.
(The first program I ever wrote was ~4 years ago. My guess is that's significantly more recent than most people who participated in the discussions around this change. I bring up the new-users perspective, and consider it so important, is because it's still very fresh in my mind, and it tends to get overlooked by those who are experienced. Config defaults like this are literally why I gave up on C++ during my first few months programming. I don't consider them minor annoyances; the less experience you have, the less ability you have to solve those annoyances It's very easy for them to turn into a multi-hour or multi-day fiasco. What drew me to Rust was the ability to spend my time programming instead of sitting in configuration hell. Idk how much y'all value that, but I think it's the best, and most important, feature that Rust offers in the systems programming space. I think changes that come at the expense of that ideal should have to clear a higher bar than other changes)
I see big benefits on both sides (having the current, and more predictable default with debuginfo, which allows debugging out of the box vs having faster compilation and smaller target dir size). I sometimes use line-tables-only on projects where compilation time is a pain, which helps a lot, but then I create a breakpoint in my IDE and start debugging, and suddenly realize that nothing works, and I have to change the profile options, and wait for the whole thing to be recompiled. That is a pretty crappy experience. If at least rustc could backfill the debuginfo without recompiling everything from scratch, that would be wonderful :/
I wonder if using debuginfo only for local crates, but not for all dependencies, was considered? While I use the debugger a lot, I personally almost never have to debug third-party crates, I only debug my own code. This default would more or less correspond to what normally happens with C/C++, where you compile with -g, but typically your dependencies won't have debuginfo available, unless you compile them out of band.
I wonder if using debuginfo only for local crates, but not for all dependencies, was considered?
Relevant discussion #t-cargo > A way to evolve builtin profile settings @ 💬. From @joshtriplett:
I think that'd be the worst of both worlds. You're still building some debuginfo at the cost of performance, while also not having full backtrace / single-step support if someone wants to debug.
Also, it is not uncommon anymore that projects have lots of local crate members, and local crates could produce more copies of artifacts/debuginfo than dependencies during a tight iteration loop.
line-tables-only is a bad default in general. Either full debuginfo or none at all would be better.
Agreed that having no debuginfo at all is a bit clearer than having a half-broken debugging experience, but backtrace's fine:line info will be gone still as well as some profiler attributes. It takes away everything from both debugger and non-debugger users. And probably if IDE is not smarter enough to know debuginfo is gone. The breakpoint would show gray and beginner moment changes from "my variable is missing" to "my breakpoint got ignored". That is still not good 😞.
Hi! I'm an engineering lead for the Rust ecosystem at JetBrains (opinions are my own), and I previously worked on the RustRover debugger integration and our LLDB fork with custom Rust support. We’ve already run into test failures in our debugger integration because of this change.
I believe that the debugging experience is one of the most important underdeveloped areas of the Rust ecosystem. A good debugger gives both newcomers and experienced developers a deep understanding of how their code works.
As someone invested in this, it makes me sad to see Rust move in this direction, while other systems languages make major improvements to the debug info instead:
- Zig: https://codeberg.org/ziglang/zig/pulls/37739
- Odin: https://github.com/odin-lang/Odin/pull/7823
Rather than repeating the good points raised above, I'll just emphasize that defaults matter, the new default:
- degrades the UX and/or increases disk usage for people using debuggers;
- discourages new users from adopting a debugger by adding yet another obstacle;
- discourages developers from looking under the hood to understand how their software actually works;
- disincentivizes debugger developers from investing in Rust debugging experience.
Please reconsider this change. I'm open to having a more in-depth discussion on this of course.