Skip to content

Conversation

flip1995
Copy link
Member

@flip1995 flip1995 commented Nov 25, 2019

Rustups:

changelog: none

@flip1995 flip1995 added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties label Nov 25, 2019
Comment on lines -75 to -79
error: use of `ok_or` followed by a function call
--> $DIR/or_fun_call.rs:74:17
|
LL | let _ = opt.ok_or(format!("{} world.", hello));
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `ok_or_else(|| format!("{} world.", hello))`
Copy link
Member Author

Choose a reason for hiding this comment

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

format! now expands to a block. While format is explicitly handled in expect_fun_call, it is not in or_fun_call.

@Centril
Copy link
Contributor

Centril commented Nov 25, 2019

rust-lang/rust#66671 (Ast address-of)

cc @matthewjasper -- simply doing _ on the BorrowKind might give wrong linting behaviors depending on the lint. You might want to be more conservative and match on ::Ref initially.

@flip1995
Copy link
Member Author

Ah thanks, good point!

Copy link
Contributor

@matthewjasper matthewjasper left a comment

Choose a reason for hiding this comment

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

I've commented in the places that should not be using BorrowKind::Ref

@@ -328,7 +328,7 @@ impl<'a, 'tcx> Visitor<'tcx> for ReadVisitor<'a, 'tcx> {
// ```
//
// TODO: fix this
ExprKind::AddrOf(_, _) => {
ExprKind::AddrOf(_, _, _) => {
Copy link
Contributor

Choose a reason for hiding this comment

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

This can stay

@@ -656,7 +656,7 @@ impl<'a, 'tcx> intravisit::Visitor<'tcx> for StaticMutVisitor<'a, 'tcx> {
tys.clear();
}
},
Assign(ref target, _) | AssignOp(_, ref target, _) | AddrOf(hir::Mutability::Mutable, ref target) => {
Assign(ref target, _) | AssignOp(_, ref target, _) | AddrOf(_, hir::Mutability::Mutable, ref target) => {
Copy link
Contributor

Choose a reason for hiding this comment

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

This can stay

@@ -77,14 +77,14 @@ fn extract_call<'a, 'tcx>(cx: &'a LateContext<'a, 'tcx>, e: &'tcx Expr) -> Optio
if let ExprKind::Tup(ref conditions) = headerexpr.kind;
if conditions.len() == 2;
then {
if let ExprKind::AddrOf(_, ref lhs) = conditions[0].kind {
if let ExprKind::AddrOf(_, _, ref lhs) = conditions[0].kind {
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe the ones in this file?

Copy link
Member

Choose a reason for hiding this comment

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

eh, i think this is edge casey enough to leave it focused on Ref.

@@ -58,7 +58,7 @@ fn has_no_effect(cx: &LateContext<'_, '_>, expr: &Expr) -> bool {
| ExprKind::Type(ref inner, _)
| ExprKind::Unary(_, ref inner)
| ExprKind::Field(ref inner, _)
| ExprKind::AddrOf(_, ref inner)
| ExprKind::AddrOf(_, _, ref inner)
Copy link
Contributor

Choose a reason for hiding this comment

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

The ones in this file

@@ -37,7 +37,7 @@ impl EarlyLintPass for DerefAddrOf {
fn check_expr(&mut self, cx: &EarlyContext<'_>, e: &Expr) {
if_chain! {
if let ExprKind::Unary(UnOp::Deref, ref deref_target) = e.kind;
if let ExprKind::AddrOf(_, ref addrof_target) = without_parens(deref_target).kind;
if let ExprKind::AddrOf(_, _, ref addrof_target) = without_parens(deref_target).kind;
Copy link
Contributor

Choose a reason for hiding this comment

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

The ones in this file

},
ExprKind::Unary(_, ref e)
| ExprKind::Field(ref e, _)
| ExprKind::AddrOf(_, _, ref e)
Copy link
Contributor

Choose a reason for hiding this comment

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

The ones in this file

@@ -78,7 +78,7 @@ impl<'a, 'tcx> SpanlessEq<'a, 'tcx> {
}

match (&left.kind, &right.kind) {
(&ExprKind::AddrOf(l_mut, ref le), &ExprKind::AddrOf(r_mut, ref re)) => {
(&ExprKind::AddrOf(_, l_mut, ref le), &ExprKind::AddrOf(_, r_mut, ref re)) => {
Copy link
Contributor

Choose a reason for hiding this comment

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

This should compare the BorrowKinds

@@ -398,7 +398,7 @@ impl<'a, 'tcx> SpanlessHash<'a, 'tcx> {
std::mem::discriminant(&e.kind).hash(&mut self.s);

match e.kind {
ExprKind::AddrOf(m, ref e) => {
ExprKind::AddrOf(_, m, ref e) => {
Copy link
Contributor

Choose a reason for hiding this comment

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

This should hash the BorrowKind

@@ -264,7 +264,7 @@ fn print_expr(cx: &LateContext<'_, '_>, expr: &hir::Expr, indent: usize) {
println!("{}Relative Path, {:?}", ind, ty);
println!("{}seg: {:?}", ind, seg);
},
hir::ExprKind::AddrOf(ref muta, ref e) => {
hir::ExprKind::AddrOf(_, ref muta, ref e) => {
Copy link
Contributor

Choose a reason for hiding this comment

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

This should print out the BorrowKind

@Manishearth
Copy link
Member

Updated, added some more fixes

@bors r+

@bors
Copy link
Contributor

bors commented Nov 27, 2019

📌 Commit ef05061 has been approved by Manishearth

@bors
Copy link
Contributor

bors commented Nov 27, 2019

⌛ Testing commit ef05061 with merge ff930d3...

bors added a commit that referenced this pull request Nov 27, 2019
Rustup

Rustups:

- rust-lang/rust#66671 (Ast address-of)
- rust-lang/rust#64856 (Scope format! temporaries)

changelog: none
@bors
Copy link
Contributor

bors commented Nov 27, 2019

💔 Test failed - status-appveyor

@Manishearth Manishearth changed the title Rustup Rustup to rustc 1.41.0-nightly (e87a205c2 2019-11-27) Nov 27, 2019
@Manishearth
Copy link
Member

@bors r+

@bors
Copy link
Contributor

bors commented Nov 27, 2019

📌 Commit 9aa58ed has been approved by Manishearth

@bors
Copy link
Contributor

bors commented Nov 27, 2019

⌛ Testing commit 9aa58ed with merge a3da0fb...

bors added a commit that referenced this pull request Nov 27, 2019
Rustup to rustc 1.41.0-nightly (e87a205 2019-11-27)

Rustups:

- rust-lang/rust#66671 (Ast address-of)
- rust-lang/rust#64856 (Scope format! temporaries)
 - http://github.com/rust-lang/rust/pull/66719

changelog: none
@bors
Copy link
Contributor

bors commented Nov 27, 2019

💔 Test failed - status-appveyor

@Manishearth
Copy link
Member

@bors r+

@bors
Copy link
Contributor

bors commented Nov 27, 2019

📌 Commit 40c91ec has been approved by Manishearth

@bors
Copy link
Contributor

bors commented Nov 27, 2019

⌛ Testing commit 40c91ec with merge 7b8e829...

bors added a commit that referenced this pull request Nov 27, 2019
Rustup to rustc 1.41.0-nightly (e87a205 2019-11-27)

Rustups:

- rust-lang/rust#66671 (Ast address-of)
- rust-lang/rust#64856 (Scope format! temporaries)
 - http://github.com/rust-lang/rust/pull/66719

changelog: none
@bors
Copy link
Contributor

bors commented Nov 27, 2019

☀️ Test successful - checks-travis, status-appveyor
Approved by: Manishearth
Pushing 7b8e829 to master...

@bors bors merged commit 40c91ec into rust-lang:master Nov 27, 2019
@flip1995 flip1995 deleted the rustup branch November 28, 2019 14:26
@flip1995
Copy link
Member Author

Thanks! Hadn't had access to my dev machine the last 2 days!

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.

5 participants