Skip to content

Underlining with ~ for missing parameters in long functions overflows the terminal width #101242

Open
@poliorcetics

Description

@poliorcetics

Given the following code: playground

use std::collections::{BTreeSet, HashMap, VecDeque};
use std::sync::{Arc, Mutex};

fn main() {
    my_very_long_function_name_with_lots_of_args();
}

fn my_very_long_function_name_with_lots_of_args(
    _first_long_param: bool,
    _second_long_param: HashMap<Arc<String>, Vec<BTreeSet<usize>>>,
    _third_long_param: usize,
    _fourth_long_param: String,
    _fifth_long_param: Mutex<Option<VecDeque<Arc<String>>>>,
) {
}

The current output is:

error[E0061]: this function takes 5 arguments but 0 arguments were supplied
  --> src/main.rs:5:5
   |
5  |     my_very_long_function_name_with_lots_of_args();
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-- multiple arguments are missing
   |
note: function defined here
  --> src/main.rs:8:4
   |
8  | fn my_very_long_function_name_with_lots_of_args(
   |    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
9  |     _first_long_param: bool,
   |     -----------------------
10 |     _second_long_param: HashMap<Arc<String>, Vec<BTreeSet<usize>>>,
   |     --------------------------------------------------------------
11 |     _third_long_param: usize,
   |     ------------------------
12 |     _fourth_long_param: String,
   |     --------------------------
13 |     _fifth_long_param: Mutex<Option<VecDeque<Arc<String>>>>,
   |     -------------------------------------------------------
help: provide the arguments
   |
5  |     my_very_long_function_name_with_lots_of_args(/* bool */, /* std::collections::HashMap<std::sync::Arc<std::string::String>, std::vec::Vec<std::collections::BTreeSet<usize>>> */, /* usize */, /* std::string::String */, /* std::sync::Mutex<std::option::Option<std::collections::VecDeque<std::sync::Arc<std::string::String>>>> */);
   |     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

For more information about this error, try `rustc --explain E0061`.
error: could not compile `pg2` due to previous error

Screenshot:

Underlining with a tilde '~' takes up two lines because the terminal width is not large enough

Ideally this could be like the first part, with one parameter on each line ? This would also improve readability of the types I think

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-diagnosticsArea: Messages for errors, warnings, and lintsA-suggestion-diagnosticsArea: Suggestions generated by the compiler applied by `cargo fix`D-papercutDiagnostics: An error or lint that needs small tweaks.D-verboseDiagnostics: Too much output caused by a single piece of incorrect code.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions