From b8effecee18256c88bf4189446cdacdff439210b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matthias=20Kr=C3=BCger?= Date: Tue, 17 Mar 2020 10:18:22 +0100 Subject: [PATCH 1/5] rustup https://github.com/rust-lang/rust/pull/69838 --- clippy_lints/src/write.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/clippy_lints/src/write.rs b/clippy_lints/src/write.rs index a63c6771bb53..5ad43ad55a36 100644 --- a/clippy_lints/src/write.rs +++ b/clippy_lints/src/write.rs @@ -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 = None; if is_write { expr = match parser.parse_expr().map_err(|mut err| err.cancel()) { From b875c53d2c23329a6148d9d6bb90522abd11df7d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matthias=20Kr=C3=BCger?= Date: Wed, 18 Mar 2020 03:27:05 +0100 Subject: [PATCH 2/5] rustup https://github.com/rust-lang/rust/pull/69189 rustups https://github.com/rust-lang/rust/pull/69189 which is part of https://github.com/rust-lang/rust/pull/70085 (at least I think this is the only pr that changes clippy test stdout) --- tests/ui/inefficient_to_string.stderr | 8 ++++---- tests/ui/transmute.stderr | 2 +- tests/ui/transmute_ptr_to_ptr.stderr | 28 ++++++++++++++++++++++++++- tests/ui/transmute_ptr_to_ref.stderr | 4 ++-- 4 files changed, 34 insertions(+), 8 deletions(-) diff --git a/tests/ui/inefficient_to_string.stderr b/tests/ui/inefficient_to_string.stderr index 1c0490ffa44c..4be46161e8b7 100644 --- a/tests/ui/inefficient_to_string.stderr +++ b/tests/ui/inefficient_to_string.stderr @@ -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` --> $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` implements `ToString` through a slower blanket impl, but `std::borrow::Cow` has a fast specialization of `ToString` -error: calling `to_string` on `&&&std::borrow::Cow<'_, str>` +error: calling `to_string` on `&&&std::borrow::Cow` --> $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` implements `ToString` through a slower blanket impl, but `std::borrow::Cow` has a fast specialization of `ToString` error: aborting due to 6 previous errors diff --git a/tests/ui/transmute.stderr b/tests/ui/transmute.stderr index 37162ecf4756..8582080498f3 100644 --- a/tests/ui/transmute.stderr +++ b/tests/ui/transmute.stderr @@ -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); diff --git a/tests/ui/transmute_ptr_to_ptr.stderr b/tests/ui/transmute_ptr_to_ptr.stderr index 4d1b8fcc199e..61fbea1c164e 100644 --- a/tests/ui/transmute_ptr_to_ptr.stderr +++ b/tests/ui/transmute_ptr_to_ptr.stderr @@ -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 | @@ -36,5 +50,17 @@ error: transmute from a reference to a reference LL | let _: &GenericParam = std::mem::transmute(&GenericParam { t: 1u32 }); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `&*(&GenericParam { t: 1u32 } as *const GenericParam as *const GenericParam)` -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 diff --git a/tests/ui/transmute_ptr_to_ref.stderr b/tests/ui/transmute_ptr_to_ref.stderr index 2d52e421816e..df0598a58cd3 100644 --- a/tests/ui/transmute_ptr_to_ref.stderr +++ b/tests/ui/transmute_ptr_to_ref.stderr @@ -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`) --> $DIR/transmute_ptr_to_ref.rs:32:32 | LL | let _: &Foo = 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) }; From b9d6bf3bfb6e0a0be793a9352d5568f1cd0d8470 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matthias=20Kr=C3=BCger?= Date: Wed, 18 Mar 2020 23:45:02 +0100 Subject: [PATCH 3/5] rustup https://github.com/rust-lang/rust/pull/69920/ --- clippy_lints/src/lib.rs | 2 +- clippy_lints/src/missing_inline.rs | 2 +- clippy_lints/src/trivially_copy_pass_by_ref.rs | 2 +- clippy_lints/src/utils/attrs.rs | 2 +- clippy_lints/src/utils/author.rs | 2 +- clippy_lints/src/utils/inspector.rs | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/clippy_lints/src/lib.rs b/clippy_lints/src/lib.rs index fb79ad271e0a..1c81d78a2b95 100644 --- a/clippy_lints/src/lib.rs +++ b/clippy_lints/src/lib.rs @@ -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. /// diff --git a/clippy_lints/src/missing_inline.rs b/clippy_lints/src/missing_inline.rs index 0f871d29c2f3..22b56c28b6bc 100644 --- a/clippy_lints/src/missing_inline.rs +++ b/clippy_lints/src/missing_inline.rs @@ -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, diff --git a/clippy_lints/src/trivially_copy_pass_by_ref.rs b/clippy_lints/src/trivially_copy_pass_by_ref.rs index 7e9a94f14fef..194e11ac9bdf 100644 --- a/clippy_lints/src/trivially_copy_pass_by_ref.rs +++ b/clippy_lints/src/trivially_copy_pass_by_ref.rs @@ -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; diff --git a/clippy_lints/src/utils/attrs.rs b/clippy_lints/src/utils/attrs.rs index 3721350959b9..e27e1b7f2e6c 100644 --- a/clippy_lints/src/utils/attrs.rs +++ b/clippy_lints/src/utils/attrs.rs @@ -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. diff --git a/clippy_lints/src/utils/author.rs b/clippy_lints/src/utils/author.rs index e95c45852ac2..4fcaf4264d77 100644 --- a/clippy_lints/src/utils/author.rs +++ b/clippy_lints/src/utils/author.rs @@ -3,7 +3,6 @@ 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; @@ -11,6 +10,7 @@ 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! { diff --git a/clippy_lints/src/utils/inspector.rs b/clippy_lints/src/utils/inspector.rs index d79f6d525fcf..c6a47f05e248 100644 --- a/clippy_lints/src/utils/inspector.rs +++ b/clippy_lints/src/utils/inspector.rs @@ -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! { From 6943363c202ec8090a345faa2d41ab6e8526c238 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matthias=20Kr=C3=BCger?= Date: Thu, 19 Mar 2020 11:42:36 +0100 Subject: [PATCH 4/5] ci: create "integration" dir before moving files there, see if this ifxes ci --- .github/workflows/clippy_bors.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/clippy_bors.yml b/.github/workflows/clippy_bors.yml index a4f7b64cb6a7..c2ceffbfbcf1 100644 --- a/.github/workflows/clippy_bors.yml +++ b/.github/workflows/clippy_bors.yml @@ -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 From 8cb59cc2435f5ff3f4574c007b0a72f1acbc6bb3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matthias=20Kr=C3=BCger?= Date: Thu, 19 Mar 2020 12:42:24 +0100 Subject: [PATCH 5/5] add debug --- .github/workflows/clippy_bors.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/clippy_bors.yml b/.github/workflows/clippy_bors.yml index c2ceffbfbcf1..5222c4353038 100644 --- a/.github/workflows/clippy_bors.yml +++ b/.github/workflows/clippy_bors.yml @@ -204,6 +204,9 @@ jobs: - name: Build Integration Test run: cargo test --test integration --features integration --no-run + - name: Debug + run: ls target/debug -l + # Upload - name: Extract Binaries run: |