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

diagnostics: shorten paths of unique symbols #73996

Merged
merged 6 commits into from
Sep 4, 2020

Commits on Sep 2, 2020

  1. Fix some unwanted uses of Debug formatting on user-facing messages

    While formatting for user diagnostics used `Display` for all most cases,
    some small amount of cases used `Debug` instead.  Until now, `Display`
    and `Debug` yielded the same output for many types. However, with path
    trimming, we want to show a shorter path for the user, these cases need
    fixing.
    da-x committed Sep 2, 2020
    Configuration menu
    Copy the full SHA
    75a042e View commit details
    Browse the repository at this point in the history
  2. rustc_{errors,session}: add delay_good_path_bug

    The first use case of this detection of regression for trimmed paths
    computation, that is in the case of rustc, which should be computed only
    in case of errors or warnings.
    
    Our current user of this method is deeply nested, being a side effect
    from `Display` formatting on lots of rustc types. So taking only the
    caller to the error message is not enough - we should collect the
    traceback instead.
    da-x committed Sep 2, 2020
    Configuration menu
    Copy the full SHA
    7b2deb5 View commit details
    Browse the repository at this point in the history
  3. pretty: trim paths of unique symbols

    If a symbol name can only be imported from one place for a type, and
    as long as it was not glob-imported anywhere in the current crate, we
    can trim its printed path and print only the name.
    
    This has wide implications on error messages with types, for example,
    shortening `std::vec::Vec` to just `Vec`, as long as there is no other
    `Vec` importable anywhere.
    
    This adds a new '-Z trim-diagnostic-paths=false' option to control this
    feature.
    
    On the good path, with no diagnosis printed, we should try to avoid
    issuing this query, so we need to prevent trimmed_def_paths query on
    several cases.
    
    This change also relies on a previous commit that differentiates
    between `Debug` and `Display` on various rustc types, where the latter
    is trimmed and presented to the user and the former is not.
    da-x committed Sep 2, 2020
    Configuration menu
    Copy the full SHA
    07e7823 View commit details
    Browse the repository at this point in the history

Commits on Sep 3, 2020

  1. rustc_driver: have TrimmedDefPaths::GoodPath only for rustc

    `run_compiler` is used by clippy and other tools, which should not have
    the trimmed paths feature enabled by default, until we see it works well
    for them.
    
    Would also be nice to rename `TimePassesCallbacks` however it's a
    submodule change.
    da-x committed Sep 3, 2020
    Configuration menu
    Copy the full SHA
    c5a6131 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    51742be View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    e7d7615 View commit details
    Browse the repository at this point in the history