-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
WIP: rustup #1373
Conversation
@oli-obk did you find the responsible PR from rustc? That usually really helps. |
rust-lang/rust#37676 that was one of the changes, but there are multiple things going on at once I think |
@jseyfried : Why is the qpath.def for |
hashes of paths are wrong... for not sure how to fix |
As long as equality works and |
ok... we're down to equal for loops not comparing equal |
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); |
There was a problem hiding this comment.
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)) => { |
There was a problem hiding this comment.
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, _)) => { |
There was a problem hiding this comment.
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); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ditto.
There was a problem hiding this comment.
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
This reverts commit cf1fa94.
use std::hash::{Hash, Hasher}; | ||
use std::collections::hash_map::DefaultHasher; | ||
use syntax::ast::Name; | ||
use syntax::ast::{Name, NodeId}; |
There was a problem hiding this comment.
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 NodeId
s or Span
s in that file, you're doing something wrong 😛
This works locally on |
// 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) { |
There was a problem hiding this comment.
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, | ||
}) |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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! |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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...
The new update for |
we need to patch rustc first. rust-lang/rust#37918 broke all lints that forward to an inner |
I have a rustc pr ready but didn't get clippy ported all the way. Will finish tomorrow |
got it to work with rust-lang/rust#38191 |
rust PR has been merged, now we wait for a new nightly to survive the buildbots: http://rusty-dash.com/nightlies |
rust-lang/rust#38097 broke this a little more. Edit: Fixed in https://github.com/Arnavion/rust-clippy/commit/3de6f9db202c612aad15397fb5b3320497dc2f25 |
…-existent fields.
Thanks @Arnavion! |
There is a nightly release now ... |
Travis doesn't have it yet |
🎉 Published 🎉 |
fixes #1371
going to bed. Didn't get this fixed all the way. I think the
vec!
macro changed, sohigher::vec_macro
is borked (but not in the part that I changed I think)