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

WIP: rustup #1373

Merged
merged 15 commits into from
Dec 17, 2016
Merged

WIP: rustup #1373

merged 15 commits into from
Dec 17, 2016

Conversation

oli-obk
Copy link
Contributor

@oli-obk oli-obk commented Dec 1, 2016

fixes #1371

going to bed. Didn't get this fixed all the way. I think the vec! macro changed, so higher::vec_macro is borked (but not in the part that I changed I think)

@mcarton
Copy link
Member

mcarton commented Dec 1, 2016

@oli-obk did you find the responsible PR from rustc? That usually really helps.

@oli-obk
Copy link
Contributor Author

oli-obk commented Dec 1, 2016

rust-lang/rust#37676 that was one of the changes, but there are multiple things going on at once I think

@oli-obk
Copy link
Contributor Author

oli-obk commented Dec 2, 2016

@jseyfried : Why is the qpath.def for use std::cmp::Ordering::*; (extracted through ItemUse(ref qpath, UseKind::Glob)) a Mod and not an Enum? (asking here again, since I'm going offline in irc now)

@oli-obk
Copy link
Contributor Author

oli-obk commented Dec 2, 2016

hashes of paths are wrong... for copies.rs

not sure how to fix enum_glob_use

@mcarton
Copy link
Member

mcarton commented Dec 2, 2016

hashes of paths are wrong... for copies.rs

As long as equality works and a == b ⇒ hash(a) == hash(b) it's fine. You don't need perfect hashes.

@oli-obk
Copy link
Contributor Author

oli-obk commented Dec 2, 2016

ok... we're down to equal for loops not comparing equal

@oli-obk
Copy link
Contributor Author

oli-obk commented Dec 2, 2016

If someone could pick this up, that would be great. I'm not gonna be near a pc until sunday.

All that is left is to dump the failing test (copy just the failing expression to a new file and dump the ast) and figure out what part of a desugared for loop fails to compare

It is slow but it can be useful and can be set/unset explicitly before
running tests if needed. There is no backtrace by default anyway.
}
fn eq_qpath(&self, left: &QPath, lid: NodeId, right: &QPath, rid: NodeId) -> bool {
let l = self.cx.tcx.tables().qpath_def(left, lid);
let r = self.cx.tcx.tables().qpath_def(right, rid);
Copy link
Member

Choose a reason for hiding this comment

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

Now foo::<u8> and foo::<u32> compare equal, this is wrong.

@@ -100,11 +101,11 @@ impl<'a, 'tcx: 'a> SpanlessEq<'a, 'tcx> {
self.eq_expr(lc, rc) && self.eq_block(lt, rt) && both(le, re, |l, r| self.eq_expr(l, r))
}
(&ExprLit(ref l), &ExprLit(ref r)) => l.node == r.node,
(&ExprLoop(ref lb, ref ll, ref lls), &ExprLoop(ref rb, ref rl, ref rls)) => {
Copy link
Member

Choose a reason for hiding this comment

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

Why did you remove the loop source ({l,r}ls)? It's just a variant-less Copy enum.

}
(&ExprMatch(ref le, ref la, ref ls), &ExprMatch(ref re, ref ra, ref rs)) => {
ls == rs && self.eq_expr(le, re) &&
(&ExprMatch(ref le, ref la, _), &ExprMatch(ref re, ref ra, _)) => {
Copy link
Member

Choose a reason for hiding this comment

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

Ditto.

let c: fn(_, _, _) -> _ = ExprLoop;
c.hash(&mut self.s);
self.hash_block(b);
if let Some(i) = *i {
self.hash_name(&i.node);
}
j.hash(&mut self.s);
Copy link
Member

Choose a reason for hiding this comment

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

Ditto.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Because they don't really add any value... If a desugaring is the same as a manual write then it is the same

use std::hash::{Hash, Hasher};
use std::collections::hash_map::DefaultHasher;
use syntax::ast::Name;
use syntax::ast::{Name, NodeId};
Copy link
Member

Choose a reason for hiding this comment

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

If you're ever going to use NodeIds or Spans in that file, you're doing something wrong 😛

@mcarton
Copy link
Member

mcarton commented Dec 2, 2016

This works locally on rustc 1.15.0-nightly (1c448574b 2016-11-28) now but it looks like it need more updates for rustc 1.15.0-nightly (908dba0c9 2016-12-01) 😓

// FIXME: ask jseyfried why the qpath.def for `use std::cmp::Ordering::*;`
// extracted through `ItemUse(ref qpath, UseKind::Glob)` is a `Mod` and not an `Enum`
//if let Def::Enum(_) = path.def {
if path.segments.last().and_then(|seg| seg.name.as_str().chars().next()).map_or(false, char::is_uppercase) {
Copy link
Member

@mcarton mcarton Dec 2, 2016

Choose a reason for hiding this comment

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

Did you had an answer for that?

}
},
None => false,
})
Copy link
Member

Choose a reason for hiding this comment

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

Why did you have to change this? IMO we don't have enough in_macro tests.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Because without this, we can't do anything useful with ranges in hir, since they all have that expansion span

@@ -10,5 +10,5 @@ pub fn test(_: LinkedList<u8>) { //~ ERROR I see you're using a LinkedList!
}

fn main(){
test(LinkedList::new());
test(LinkedList::new()); //~ ERROR I see you're using a LinkedList!
Copy link
Member

Choose a reason for hiding this comment

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

I thought this wasn't here on purpose: if test takes a LinkedList, the user has no choice but to build one to call the function. Hence the function should be warned about, not its call.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Makes sense, I'm surprised it ever worked...

@mcarton
Copy link
Member

mcarton commented Dec 2, 2016

The new update for rustc 1.15.0-nightly (908dba0c9 2016-12-01) is quite big too, I will finish that tomorrow.

@jseyfried
Copy link

@oli-obk

Why is the qpath.def for use std::cmp::Ordering::*; a Mod and not an Enum?

Because this code is incorrect -- it should record module.def().unwrap(), not Def::Mod(module.def_id().unwrap()).
This is a very minor change -- I'll fix in my next PR (probably tomorrow).

@oli-obk
Copy link
Contributor Author

oli-obk commented Dec 4, 2016

The new update for rustc 1.15.0-nightly (908dba0 2016-12-01) is quite big too, I will finish that tomorrow.

we need to patch rustc first. rust-lang/rust#37918 broke all lints that forward to an inner Visitor, since LateContext's methods do not have lifetime annotations binding the given ast/hir node's lifetime to the TyCtxt's. A hacky workaround in clippy would be to do an intermediate call to tcx.map.expect_* which again yields a tcx lifetime, but I think we'd save us many headaches by simply fixing rustc.

@oli-obk oli-obk changed the title DO NOT MERGE: compiles and doesn't crash (much) but tests are failing WIP: rustup Dec 4, 2016
@oli-obk
Copy link
Contributor Author

oli-obk commented Dec 5, 2016

I have a rustc pr ready but didn't get clippy ported all the way. Will finish tomorrow

@oli-obk
Copy link
Contributor Author

oli-obk commented Dec 6, 2016

got it to work with rust-lang/rust#38191

@oli-obk
Copy link
Contributor Author

oli-obk commented Dec 9, 2016

rust PR has been merged, now we wait for a new nightly to survive the buildbots: http://rusty-dash.com/nightlies

@Arnavion
Copy link
Contributor

Arnavion commented Dec 11, 2016

rust-lang/rust#38097 broke this a little more. rustc::ty::FnSig no longer has fields called inputs and output

Edit: Fixed in https://github.com/Arnavion/rust-clippy/commit/3de6f9db202c612aad15397fb5b3320497dc2f25

@mcarton
Copy link
Member

mcarton commented Dec 11, 2016

Thanks @Arnavion!
Now we just have to wait for a new nightly to be published, but it's been a few days since there hasn't been any.

@Wabuo
Copy link

Wabuo commented Dec 16, 2016

There is a nightly release now ...

@oli-obk
Copy link
Contributor Author

oli-obk commented Dec 16, 2016

Travis doesn't have it yet

@mcarton mcarton merged commit ea0227f into master Dec 17, 2016
@mcarton
Copy link
Member

mcarton commented Dec 17, 2016

🎉 Published 🎉

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.

does not compile with rustc 1.15.0-nightly (1c448574b 2016-11-28)
5 participants