Repository navigation
Change column!() macro guarantees - #164645
clarfonthey wants to merge 1 commit into
Conversation
|
This says to consult "the compiler documentation", but I don't think we have such documentation that talks about what |
1099de9 to
a50c595
Compare
|
Correct. There is no such documentation, but the idea is that if we made it more complicated, such docs could be made. |
|
I believe that instead of "just" changing the documentation to encode rustc's current column rendering nuances, to instead change |
Note that this is particularly contradicted by the fact that Note that we could add a @rfcbot merge libs |
This comment was marked as outdated.
This comment was marked as outdated.
|
Adding compiler nomination so that the compiler team can be aware of libs' general mentality here that this is a compiler issue, not a libs issue. Compiler diagnostic positions are not stable, and libs' opinion is the stability of this macro should be tied to the compiler diagnostics instead. |
|
Actually, why not add lang here too? Everyone can join the party. I'm not sure if we consider this macro to be a lang issue. |
1ee9aaf to
2669136
Compare
This comment was marked as resolved.
This comment was marked as resolved.
|
Race condition, Max, but you did comment that after I made a change actually updating those docs to this PR. |
It seems more beneficial for this to match compiler error output and editor notions of columns than it to be a stable value between versions. That said, I don't feel that strongly about it. |
|
I will insist that the appropriate thing to do here is to "just" change rust/compiler/rustc_middle/src/mir/consts.rs Line 547 in df74b1f to be Did a bit of digging and we've been using |
2669136 to
f39f6aa
Compare
|
Note that changing the And, well, the compiler does not use byte indices for this purpose. So, you'd need to change that too. |
f39f6aa to
6bf4c2d
Compare
6bf4c2d to
74e9a10
Compare
|
@rfcbot cancel |
|
@rfcbot merge lang,libs |
|
@nia-e proposal cancelled. |
This comment was marked as outdated.
This comment was marked as outdated.
| /// The exact counting scheme for columns is only guaranteed to be the same across a single | ||
| /// compiler version and configuration. For example, the handling of the "width" of characters |
There was a problem hiding this comment.
| /// The exact counting scheme for columns is only guaranteed to be the same across a single | |
| /// compiler version and configuration. For example, the handling of the "width" of characters | |
| /// For example, the handling of the "width" of characters |
I think our intent is that we shouldn't make the guarantee on how we count. The compiler needs to provide a sound implementation (and so e.g. cross-crate expansion of the "same" constant may need to be the same for a sound type system), but otherwise it's up to the compiler.
|
@nia-e proposal cancelled. |
|
@rfcbot merge lang,libs EDIT: We can follow up on Zulip: #t-infra > rfcbot broken on restarted FCP @ 💬 |
|
@clarfonthey has proposed to merge this. The next step is review by the rest of the tagged team members:
Concerns:
Once a majority of reviewers approve (and at most 2 approvals are outstanding), this will enter its final comment period. If you spot a major issue that hasn't been raised at any point in this process, please speak up! cc @rust-lang/lang-advisors: FCP proposed for lang, please feel free to register concerns. |
74e9a10 to
01a1fec
Compare
|
Hid the old FCPs and moved over checkboxes so that people don't get confused. |
@clarfonthey you 👎 'd this and the new docs seem to contradict it. As a lang advisor, I'd like to register an FCP concern (but the bot won't listen to me) |
So, to clarify here, I did look into the bug a bit more and it turns out that not only did I misunderstand what the proposed code was doing, but also, the proposed code does not fix the issue. The issue is in the way we store this information in the compiler. Effectively, the ingredients are:
So, the reality here is that the problem cannot be solved except in one of the following cases:
Note that the second option effectively amounts to ensuring that, for any given crate, we explicitly save the conversion between byte positions and (line, column) for every panic location so that we can later do this lookup in a consistent manner. And I particularly like this change because it is effectively what we are already doing, just not completely: we save the beginning of line <-> byte offset mappings, but not the byte offset <-> (line, col) mappings for relevant positions. So, tl;dr:
|
|
Thanks, that makes sense!
Note that
Now I am confused, did you not suggest an implementation strategy a few paragraphs above? |
|
Note the double negative, I don't think it's not possible, meaning it's possible. |
View all comments
cc #164574
This effectively delegates the meaning of this macro to the compiler team, and only guarantees consistency between individual compiler runs.
It also updates the following locations to specifically reference these guarantees:
std::panic::Location::{line, column}proc_macro::Span::{line, column}r? libs