Skip to content

Commit

Permalink
Auto merge of #5339 - matthiaskrgr:rollup, r=<try>
Browse files Browse the repository at this point in the history
Rollup up 3 pull requests

changelog: none

We need all of these merging at the same time.
  • Loading branch information
bors committed Mar 19, 2020
2 parents c036c4f + 6943363 commit 30cc503
Show file tree
Hide file tree
Showing 12 changed files with 42 additions and 15 deletions.
1 change: 1 addition & 0 deletions .github/workflows/clippy_bors.yml
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,7 @@ jobs:
run: |
DIR=$CARGO_TARGET_DIR/debug
find $DIR ! -executable -o -type d ! -path $DIR | xargs rm -rf
mkdir -p $DIR/integration
mv $DIR/integration-* $DIR/integration
rm -rf $CARGO_TARGET_DIR/release
Expand Down
2 changes: 1 addition & 1 deletion clippy_lints/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,9 @@ extern crate rustc_trait_selection;
#[allow(unused_extern_crates)]
extern crate rustc_typeck;

use rustc::session::Session;
use rustc_data_structures::fx::FxHashSet;
use rustc_lint::LintId;
use rustc_session::Session;

/// Macro used to declare a Clippy lint.
///
Expand Down
2 changes: 1 addition & 1 deletion clippy_lints/src/missing_inline.rs
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ fn check_missing_inline_attrs(cx: &LateContext<'_, '_>, attrs: &[ast::Attribute]
}

fn is_executable(cx: &LateContext<'_, '_>) -> bool {
use rustc::session::config::CrateType;
use rustc_session::config::CrateType;

cx.tcx.sess.crate_types.get().iter().any(|t: &CrateType| match t {
CrateType::Executable => true,
Expand Down
2 changes: 1 addition & 1 deletion clippy_lints/src/trivially_copy_pass_by_ref.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@ use std::cmp;
use crate::utils::{is_copy, is_self_ty, snippet, span_lint_and_sugg};
use if_chain::if_chain;
use matches::matches;
use rustc::session::config::Config as SessionConfig;
use rustc::ty;
use rustc_errors::Applicability;
use rustc_hir as hir;
use rustc_hir::intravisit::FnKind;
use rustc_hir::{Body, FnDecl, HirId, ItemKind, MutTy, Mutability, Node};
use rustc_lint::{LateContext, LateLintPass};
use rustc_session::config::Config as SessionConfig;
use rustc_session::{declare_tool_lint, impl_lint_pass};
use rustc_span::Span;
use rustc_target::abi::LayoutOf;
Expand Down
2 changes: 1 addition & 1 deletion clippy_lints/src/utils/attrs.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use rustc::session::Session;
use rustc_ast::ast;
use rustc_errors::Applicability;
use rustc_session::Session;
use std::str::FromStr;

/// Deprecation status of attributes known by Clippy.
Expand Down
2 changes: 1 addition & 1 deletion clippy_lints/src/utils/author.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@
use crate::utils::{get_attr, higher};
use rustc::hir::map::Map;
use rustc::session::Session;
use rustc_ast::ast::{Attribute, LitFloatType, LitKind};
use rustc_ast::walk_list;
use rustc_data_structures::fx::FxHashMap;
use rustc_hir as hir;
use rustc_hir::intravisit::{NestedVisitorMap, Visitor};
use rustc_hir::{BindingAnnotation, Block, Expr, ExprKind, Pat, PatKind, QPath, Stmt, StmtKind, TyKind};
use rustc_lint::{LateContext, LateLintPass, LintContext};
use rustc_session::Session;
use rustc_session::{declare_lint_pass, declare_tool_lint};

declare_clippy_lint! {
Expand Down
2 changes: 1 addition & 1 deletion clippy_lints/src/utils/inspector.rs
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
//! checks for attributes
use crate::utils::get_attr;
use rustc::session::Session;
use rustc_ast::ast::Attribute;
use rustc_hir as hir;
use rustc_hir::print;
use rustc_lint::{LateContext, LateLintPass, LintContext};
use rustc_session::Session;
use rustc_session::{declare_lint_pass, declare_tool_lint};

declare_clippy_lint! {
Expand Down
2 changes: 1 addition & 1 deletion clippy_lints/src/write.rs
Original file line number Diff line number Diff line change
Expand Up @@ -357,7 +357,7 @@ impl Write {
};
let tts = tts.clone();

let mut parser = parser::Parser::new(&cx.sess.parse_sess, tts, None, false, false, None);
let mut parser = parser::Parser::new(&cx.sess.parse_sess, tts, false, None);
let mut expr: Option<Expr> = None;
if is_write {
expr = match parser.parse_expr().map_err(|mut err| err.cancel()) {
Expand Down
8 changes: 4 additions & 4 deletions tests/ui/inefficient_to_string.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -35,21 +35,21 @@ LL | let _: String = rrrstring.to_string();
|
= help: `&&std::string::String` implements `ToString` through a slower blanket impl, but `std::string::String` has a fast specialization of `ToString`

error: calling `to_string` on `&&std::borrow::Cow<'_, str>`
error: calling `to_string` on `&&std::borrow::Cow<str>`
--> $DIR/inefficient_to_string.rs:29:21
|
LL | let _: String = rrcow.to_string();
| ^^^^^^^^^^^^^^^^^ help: try dereferencing the receiver: `(*rrcow).to_string()`
|
= help: `&std::borrow::Cow<'_, str>` implements `ToString` through a slower blanket impl, but `std::borrow::Cow<'_, str>` has a fast specialization of `ToString`
= help: `&std::borrow::Cow<str>` implements `ToString` through a slower blanket impl, but `std::borrow::Cow<str>` has a fast specialization of `ToString`

error: calling `to_string` on `&&&std::borrow::Cow<'_, str>`
error: calling `to_string` on `&&&std::borrow::Cow<str>`
--> $DIR/inefficient_to_string.rs:30:21
|
LL | let _: String = rrrcow.to_string();
| ^^^^^^^^^^^^^^^^^^ help: try dereferencing the receiver: `(**rrrcow).to_string()`
|
= help: `&&std::borrow::Cow<'_, str>` implements `ToString` through a slower blanket impl, but `std::borrow::Cow<'_, str>` has a fast specialization of `ToString`
= help: `&&std::borrow::Cow<str>` implements `ToString` through a slower blanket impl, but `std::borrow::Cow<str>` has a fast specialization of `ToString`

error: aborting due to 6 previous errors

2 changes: 1 addition & 1 deletion tests/ui/transmute.stderr
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
error: transmute from a type (`&'a T`) to itself
error: transmute from a type (`&T`) to itself
--> $DIR/transmute.rs:19:20
|
LL | let _: &'a T = core::intrinsics::transmute(t);
Expand Down
28 changes: 27 additions & 1 deletion tests/ui/transmute_ptr_to_ptr.stderr
Original file line number Diff line number Diff line change
@@ -1,3 +1,17 @@
error: transmute from a type (`&T`) to itself
--> $DIR/transmute_ptr_to_ptr.rs:8:5
|
LL | std::mem::transmute::<&'a T, &'static T>(t)
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: `-D clippy::useless-transmute` implied by `-D warnings`

error: transmute from a type (`&T`) to itself
--> $DIR/transmute_ptr_to_ptr.rs:13:5
|
LL | std::mem::transmute::<&'a T, &'b T>(t)
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

error: transmute from a pointer to a pointer
--> $DIR/transmute_ptr_to_ptr.rs:29:29
|
Expand Down Expand Up @@ -36,5 +50,17 @@ error: transmute from a reference to a reference
LL | let _: &GenericParam<f32> = std::mem::transmute(&GenericParam { t: 1u32 });
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `&*(&GenericParam { t: 1u32 } as *const GenericParam<u32> as *const GenericParam<f32>)`

error: aborting due to 6 previous errors
error: transmute from a type (`&LifetimeParam`) to itself
--> $DIR/transmute_ptr_to_ptr.rs:50:47
|
LL | let _: &LifetimeParam<'static> = unsafe { std::mem::transmute(&lp) };
| ^^^^^^^^^^^^^^^^^^^^^^^^

error: transmute from a type (`&GenericParam<&LifetimeParam>`) to itself
--> $DIR/transmute_ptr_to_ptr.rs:51:62
|
LL | let _: &GenericParam<&LifetimeParam<'static>> = unsafe { std::mem::transmute(&GenericParam { t: &lp }) };
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

error: aborting due to 10 previous errors

4 changes: 2 additions & 2 deletions tests/ui/transmute_ptr_to_ref.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -42,13 +42,13 @@ error: transmute from a pointer type (`*mut U`) to a reference type (`&T`)
LL | let _: &T = std::mem::transmute(om);
| ^^^^^^^^^^^^^^^^^^^^^^^ help: try: `&*(om as *const T)`

error: transmute from a pointer type (`*const i32`) to a reference type (`&issue1231::Foo<'_, u8>`)
error: transmute from a pointer type (`*const i32`) to a reference type (`&issue1231::Foo<u8>`)
--> $DIR/transmute_ptr_to_ref.rs:32:32
|
LL | let _: &Foo<u8> = unsafe { std::mem::transmute::<_, &Foo<_>>(raw) };
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `&*(raw as *const Foo<_>)`

error: transmute from a pointer type (`*const i32`) to a reference type (`&issue1231::Foo<'_, &u8>`)
error: transmute from a pointer type (`*const i32`) to a reference type (`&issue1231::Foo<&u8>`)
--> $DIR/transmute_ptr_to_ref.rs:34:33
|
LL | let _: &Foo<&u8> = unsafe { std::mem::transmute::<_, &Foo<&_>>(raw) };
Expand Down

0 comments on commit 30cc503

Please sign in to comment.