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

Rustup #3889

Closed
wants to merge 9 commits into from
Closed

Rustup #3889

wants to merge 9 commits into from

Conversation

flip1995
Copy link
Member

This is a WIP of the rustup to rust-lang/rust#58140. I'll try to continue working on this tomorrow. In the mean time everyone can pick this up if someone wants to :)

@flip1995 flip1995 added E-help-wanted Call for participation: Help is requested to fix this issue. S-waiting-on-author Status: This is awaiting some action from the author. (Use `@rustbot ready` to update this status) labels Mar 15, 2019
Copy link
Contributor

@mati865 mati865 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was about to open another WIP Rustup RP and noticed this one.

clippy_lints/src/transmute.rs Outdated Show resolved Hide resolved
clippy_lints/src/attrs.rs Show resolved Hide resolved
clippy_lints/src/eta_reduction.rs Outdated Show resolved Hide resolved
clippy_lints/src/utils/mod.rs Outdated Show resolved Hide resolved
@mati865
Copy link
Contributor

mati865 commented Mar 16, 2019

cc @eddyb

@flip1995
Copy link
Member Author

Ok thanks for the review everyone! Now I just have to fix the tests.

@flip1995 flip1995 marked this pull request as ready for review March 16, 2019 14:39
@flip1995 flip1995 added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties and removed S-waiting-on-author Status: This is awaiting some action from the author. (Use `@rustbot ready` to update this status) E-help-wanted Call for participation: Help is requested to fix this issue. labels Mar 16, 2019
@mati865
Copy link
Contributor

mati865 commented Mar 17, 2019

Yet another breakage rust-lang/rust#58899

Very very WIP: mati865@d3447a2
I don't have time to work on this today.

EDIT2: Further WIP https://github.com/mati865/rust-clippy/tree/rustup

fn match_borrow_depth(lhs: &ty::TyKind<'_>, rhs: &ty::TyKind<'_>) -> bool {
match (lhs, rhs) {
(ty::Ref(_, t1, _), ty::Ref(_, t2, _)) => match_borrow_depth(&t1.sty, &t2.sty),
fn match_borrow_depth(lhs: ty::Ty<'_>, rhs: ty::Ty<'_>) -> bool {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You should import Ty and always refer to it unqualified - that's at least the rustc convention.

ABSOLUTE
use rustc::ty::print::Printer;

#[allow(clippy::diverging_sub_expression)]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This sounds like a false positive - is an issue filled?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not really a FP:
Since type Error = ! and we call let mut path = print_prefix(self)?;, the ? is a diverging sub-expression. IMO allowing this here is ok.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I disagree, ? with a diverging error path should not be warned against, the behavior is more like that of let Ok(mut path) = print_prefix(self);.

cc @Manishearth @oli-obk

pub const PARTIAL_ORD: [&str; 3] = ["core", "cmp", "PartialOrd"];
pub const PATH: [&str; 3] = ["std", "path", "Path"];
pub const PATH_BUF: [&str; 3] = ["std", "path", "PathBuf"];
pub const PATH_TO_PATH_BUF: [&str; 4] = ["std", "path", "Path", "to_path_buf"];
pub const PATH_TO_PATH_BUF: [&str; 2] = ["<std::path::Path>", "to_path_buf"];
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These don't look good... That means path_qualified isn't quite right.

You want at least this, at the start of path_qualified:

        if trait_ref.is_none() {
            if let ty::Adt(def, substs) = self_ty.sty {
                return self.print_def_path(def.did, substs);
            }
        }

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah that would be better. Should I also open a rustc PR to also change it there?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Where? rustdoc? Maybe, I don't know what that's used for (cc @QuietMisdreavus)

(ty::Bool, ty::Bool)
| (ty::Char, ty::Char)
| (ty::Int(_), ty::Int(_))
| (ty::Uint(_), ty::Uint(_))
| (ty::Str, ty::Str) => true,
(ty::Ref(_, t1, _), ty::Ref(_, t2, _))
| (ty::Array(t1, _), ty::Array(t2, _))
| (ty::Slice(t1), ty::Slice(t2)) => match_types(&t1.sty, &t2.sty),
| (ty::Slice(t1), ty::Slice(t2)) => match_types(&t1, &t2),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

&x.field, when x: &T, is &(*x).field, so when you want the whole thing instead of the field, you can write just x (&x happens to work, but it's because deref coercions stripping the &).

fn match_types(lhs: &ty::TyKind<'_>, rhs: &ty::TyKind<'_>) -> bool {
match (lhs, rhs) {
fn match_types(lhs: ty::Ty<'_>, rhs: ty::Ty<'_>) -> bool {
match (&lhs.sty, &rhs.sty) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, random note, cc @Manishearth @oli-obk: this looks like it could use the ty::relate infrastructure.

@flip1995
Copy link
Member Author

Thanks for the review! I won't be able to get to this until this evening. @mati865 if you want to open a new rustup PR based on this, feel free to do so!

@mati865 mati865 mentioned this pull request Mar 18, 2019
@mati865
Copy link
Contributor

mati865 commented Mar 18, 2019

New PR: #3893

bors added a commit that referenced this pull request Mar 18, 2019
Rustup

Supersedes #3889

Addresses some review comments from previous PR and rustups to rust-lang/rust#58899
bors added a commit that referenced this pull request Mar 18, 2019
Rustup

Supersedes #3889

Addresses some review comments from previous PR and rustups to rust-lang/rust#58899
bors added a commit that referenced this pull request Mar 18, 2019
Rustup

Supersedes #3889

Addresses some review comments from previous PR and rustups to rust-lang/rust#58899
@flip1995 flip1995 closed this Mar 18, 2019
@flip1995 flip1995 deleted the rustup branch March 18, 2019 13:34
bors added a commit that referenced this pull request Mar 18, 2019
Rustup

Supersedes #3889

Addresses some review comments from previous PR and rustups to rust-lang/rust#58899
bors added a commit that referenced this pull request Mar 18, 2019
Rustup

Supersedes #3889

Addresses some review comments from previous PR and rustups to rust-lang/rust#58899
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-review Status: Awaiting review from the assignee but also interested parties
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants