Skip to content

rustup #5377

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

Merged
merged 4 commits into from
Mar 27, 2020
Merged

rustup #5377

merged 4 commits into from
Mar 27, 2020

Conversation

matthiaskrgr
Copy link
Member

changelog: none

@matthiaskrgr
Copy link
Member Author

There's still this left

    Checking clippy_lints v0.0.212 (/home/matthias/vcs/github/rust-clippy/clippy_lints)
error[E0599]: no method named `is_local` found for enum `std::option::Option<rustc_span::def_id::DefId>` in the current scope
  --> clippy_lints/src/derive.rs:97:39
   |
97 |         if !&trait_ref.trait_def_id().is_local();
   |                                       ^^^^^^^^ method not found in `std::option::Option<rustc_span::def_id::DefId>`

error[E0277]: `rustc_hir::Path<'_>` doesn't implement `std::fmt::Display`
  --> clippy_lints/src/trait_bounds.rs:55:68
   |
55 | ...                   hint_string.push_str(&format!(" {} +", path));
   |                                                              ^^^^ `rustc_hir::Path<'_>` cannot be formatted with the default formatter
   |
   = help: the trait `std::fmt::Display` is not implemented for `rustc_hir::Path<'_>`
   = note: in format strings you may be able to use `{:?}` (or {:#?} for pretty-print) instead
   = note: required because of the requirements on the impl of `std::fmt::Display` for `&rustc_hir::Path<'_>`
   = note: required because of the requirements on the impl of `std::fmt::Display` for `&&rustc_hir::Path<'_>`
   = note: required by `std::fmt::Display::fmt`
   = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)

error[E0277]: `rustc_hir::Path<'_>` doesn't implement `std::fmt::Display`
  --> clippy_lints/src/trait_bounds.rs:61:68
   |
61 | ...                   hint_string.push_str(&format!(" {} +", path));
   |                                                              ^^^^ `rustc_hir::Path<'_>` cannot be formatted with the default formatter
   |
   = help: the trait `std::fmt::Display` is not implemented for `rustc_hir::Path<'_>`
   = note: in format strings you may be able to use `{:?}` (or {:#?} for pretty-print) instead
   = note: required because of the requirements on the impl of `std::fmt::Display` for `&rustc_hir::Path<'_>`
   = note: required because of the requirements on the impl of `std::fmt::Display` for `&&rustc_hir::Path<'_>`
   = note: required by `std::fmt::Display::fmt`
   = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)

I need to figure out which commit causes this (could be the rustc_hir_pretty one)

@flip1995
Copy link
Member

flip1995 commented Mar 27, 2020

@matthiaskrgr Seems like paths have to be printed from their source snippets now: https://github.com/rust-lang/rust/pull/70344/files#diff-f7c5ab0a133d5d59a6ce76d8c88ff203R1316-R1320

first error should be resolved by this:

-if !&trait_ref.trait_def_id().is_local();
+if !&trait_ref.trait_def_id().map_or(false, |def_id| def_id.is_local());

@matthiaskrgr
Copy link
Member Author

Yeah, it should work now :)

@matthiaskrgr matthiaskrgr changed the title [ WIP ] Rustup rustup Mar 27, 2020
@matthiaskrgr
Copy link
Member Author

Tests are failing :/

@flip1995
Copy link
Member

Yeah, Debug is now derived for hir::Path, so I guess the span and res will be printed alongside the path itself?

You can resolve it like it was done in rustc: https://github.com/Centril/rust/blob/b2f7a9502bafebfa9ce0b61ff24a19c26e66c93b/src/librustc_privacy/lib.rs#L1316-L1321

and use snippet(path.span) to print the path

@flip1995
Copy link
Member

@bors r+

@bors
Copy link
Contributor

bors commented Mar 27, 2020

📌 Commit 0982097 has been approved by flip1995

@bors
Copy link
Contributor

bors commented Mar 27, 2020

⌛ Testing commit 0982097 with merge 64befe5...

@bors
Copy link
Contributor

bors commented Mar 27, 2020

☀️ Test successful - checks-action_dev_test, checks-action_remark_test, checks-action_test
Approved by: flip1995
Pushing 64befe5 to master...

@bors bors merged commit 64befe5 into rust-lang:master Mar 27, 2020
@Centril
Copy link
Contributor

Centril commented Mar 29, 2020

I would recommend trying to avoid any further dependence on HIR pretty printing and trying to remove that which you already have. It's something we might want to remove and its not really a good fit for diagnostics in either case.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants