Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

long line breaks span note formatting #40157

Closed
durka opened this issue Feb 28, 2017 · 3 comments
Closed

long line breaks span note formatting #40157

durka opened this issue Feb 28, 2017 · 3 comments
Labels
A-diagnostics Area: Messages for errors, warnings, and lints T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@durka
Copy link
Contributor

durka commented Feb 28, 2017

The note after line 5 is supposed to say `foo` dropped here while still borrowed.

$ cargo script -e 'println!("{:?}", match { let foo = vec![1, 2]; foo.get(1) } { x => x });'
   Compiling expr v0.1.0 (file:///Users/alex/.cargo/.cargo/script-cache/expr-fbc7431f17311f94)
error: `foo` does not live long enough
 --> /Users/alex/.cargo/.cargo/script-cache/expr-fbc7431f17311f94/expr.rs:5:60
  |
5 | {println!("{:?}", match { let foo = vec![1, 2]; foo.get(1) } { x => x });}
  |  ----------------------------------------------------------^-------------d here while still borrowed
  |  |                                              |
  |  |                                              |
  |  |                                              borrow occurs here
  |  borrowed value needs to live until here
  |
  = note: this error originates in a macro outside of the current crate

cc @jonathandturner

@durka durka changed the title long source line runs into error span marker long source breaks span note formatting Feb 28, 2017
@durka durka changed the title long source breaks span note formatting long line breaks span note formatting Feb 28, 2017
@sophiajt
Copy link
Contributor

I have a sneaking suspicion that this will require detecting the case where we're about to overwrite the message.

@sophiajt
Copy link
Contributor

I'm not sure if we can detect the width of the terminal in a cross platform way. If we can, maybe we can use that to factor in how we draw the message

@steveklabnik steveklabnik added the A-diagnostics Area: Messages for errors, warnings, and lints label Mar 1, 2017
@estebank
Copy link
Contributor

estebank commented Mar 6, 2017

I don't think this is a problem with terminal width, but rather a bug in the positioning of the labels.

frewsxcv added a commit to frewsxcv/rust that referenced this issue Mar 9, 2017
@steveklabnik steveklabnik added the T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. label Mar 9, 2017
alexcrichton added a commit to alexcrichton/rust that referenced this issue Mar 10, 2017
alexcrichton added a commit to alexcrichton/rust that referenced this issue Mar 10, 2017
arielb1 pushed a commit to arielb1/rust that referenced this issue Mar 10, 2017
arielb1 pushed a commit to arielb1/rust that referenced this issue Mar 10, 2017
arielb1 pushed a commit to arielb1/rust that referenced this issue Mar 10, 2017
alexcrichton added a commit to alexcrichton/rust that referenced this issue Mar 11, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-diagnostics Area: Messages for errors, warnings, and lints T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

No branches or pull requests

4 participants