-
Notifications
You must be signed in to change notification settings - Fork 13.4k
Stabilize the panic_col feature #46762
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Conversation
r? @TimNN (rust_highfive has picked a reviewer for you, use r? to override) |
cc @rust-lang/libs: There seems nothing more to do here, does this require any kind of FCP? |
@rfcbot fcp merge Yeah for stabilizations we do indeed like to go through FCP! |
Team member @alexcrichton has proposed to merge this. The next step is review by the rest of the tagged teams: Concerns:
Once these reviewers reach consensus, 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! See this document for info about what commands tagged team members can give me. |
Is it intentional that line numbers in a panic start at 1 but column numbers start at 0? I see that this is what fn main() {
panic!("line 2 column 0");
} @rfcbot concern 0 |
vim seems to start at 1 for lines and columns. |
Compiler errors in both Rust and gcc start at 1 for columns as well. If you have code like: fn main() {
panic!("line 2 column 0");
} Rust will say the column is 1 and if you do kate src/main.rs:linenum:1 then it jumps to the space, not the panic. I'd say this is a off-by-one error and a bug in the actual code that emits the panic column info. I'd also say that it's a bug with the |
Note that this code gives you the correct column number: fn main() {
let v = [1,2,3];
v[7];
} This is because this panic is directly emitted by the compiler and thus uses a separate way to obtain the column. I guess I'll just add one to the column value for the panic macro case. |
Not sure how to add a regression test for this. Any ideas? |
You should be able to make an rpass test that sets a panic handle that looks at the column. |
@sfackler good idea, will do |
@rfcbot resolved 0 |
We discussed this with the libs team and we would be interested in fixing the |
I've marked this as WIP until the column issue is resolved. |
0855471
to
131a9d8
Compare
LGTM |
🔔 This is now entering its final comment period, as per the review above. 🔔 |
@bors: r+ |
📌 Commit 131a9d8 has been approved by |
src/libstd/panicking.rs
Outdated
@@ -329,7 +328,7 @@ impl<'a> Location<'a> { | |||
/// | |||
/// panic!("Normal panic"); | |||
/// ``` | |||
#[unstable(feature = "panic_col", reason = "recently added", issue = "42939")] | |||
#[stable(feature = "panic_col", since = "1.24")] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't this be since = "1.25" now?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Indeed.
I've added the panic_col feature in PR rust-lang#42938. Now it's time to stabilize it! Closes rust-lang#42939.
re-r? @alexcrichton |
@bors: r+ |
📌 Commit 2491814 has been approved by |
@bors rollup |
Stabilize the panic_col feature I've added the panic_col feature in PR rust-lang#42938. Now it's time to stabilize it! Closes rust-lang#42939.
☔ The latest upstream changes (presumably #47308) made this pull request unmergeable. Please resolve the merge conflicts. |
I've added the panic_col feature in PR #42938.
Now it's time to stabilize it!
Closes #42939.