mirror of
https://github.com/rust-lang/rust.git
synced 2025-02-15 16:33:49 +00:00
Auto merge of #5342 - flip1995:rollup-77s2pmt, r=flip1995
Rollup of 4 pull requests Successful merges: - #5326 (rustup https://github.com/rust-lang/rust/pull/69838) - #5333 (rustup https://github.com/rust-lang/rust/pull/69189) - #5336 (rustup https://github.com/rust-lang/rust/pull/69920/) - #5341 (Rustup to rust-lang/rust#66131) Failed merges: r? @ghost changelog: none
This commit is contained in:
commit
d8e6e4cfcd
3
.github/workflows/clippy_bors.yml
vendored
3
.github/workflows/clippy_bors.yml
vendored
@ -208,8 +208,9 @@ jobs:
|
||||
- name: Extract Binaries
|
||||
run: |
|
||||
DIR=$CARGO_TARGET_DIR/debug
|
||||
rm $DIR/deps/integration-*.d
|
||||
mv $DIR/deps/integration-* $DIR/integration
|
||||
find $DIR ! -executable -o -type d ! -path $DIR | xargs rm -rf
|
||||
mv $DIR/integration-* $DIR/integration
|
||||
rm -rf $CARGO_TARGET_DIR/release
|
||||
|
||||
- name: Upload Binaries
|
||||
|
@ -486,7 +486,7 @@ fn is_mutable_pat(cx: &LateContext<'_, '_>, pat: &hir::Pat<'_>, tys: &mut FxHash
|
||||
if let hir::PatKind::Wild = pat.kind {
|
||||
return false; // ignore `_` patterns
|
||||
}
|
||||
let def_id = pat.hir_id.owner_def_id();
|
||||
let def_id = pat.hir_id.owner.to_def_id();
|
||||
if cx.tcx.has_typeck_tables(def_id) {
|
||||
is_mutable_ty(cx, &cx.tcx.typeck_tables_of(def_id).pat_ty(pat), pat.span, tys)
|
||||
} else {
|
||||
@ -601,7 +601,7 @@ impl<'a, 'tcx> intravisit::Visitor<'tcx> for StaticMutVisitor<'a, 'tcx> {
|
||||
Call(_, args) | MethodCall(_, _, args) => {
|
||||
let mut tys = FxHashSet::default();
|
||||
for arg in args {
|
||||
let def_id = arg.hir_id.owner_def_id();
|
||||
let def_id = arg.hir_id.owner.to_def_id();
|
||||
if self.cx.tcx.has_typeck_tables(def_id)
|
||||
&& is_mutable_ty(
|
||||
self.cx,
|
||||
|
@ -59,7 +59,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for MultipleInherentImpl {
|
||||
// but filter out implementations that have generic params (type or lifetime)
|
||||
// or are derived from a macro
|
||||
if !in_macro(item.span) && generics.params.is_empty() {
|
||||
self.impls.insert(item.hir_id.owner_def_id(), item.span);
|
||||
self.impls.insert(item.hir_id.owner.to_def_id(), item.span);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -69,7 +69,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for MultipleInherentImpl {
|
||||
// Retrieve all inherent implementations from the crate, grouped by type
|
||||
for impls in cx
|
||||
.tcx
|
||||
.crate_inherent_impls(item.hir_id.owner_def_id().krate)
|
||||
.crate_inherent_impls(item.hir_id.owner.to_def_id().krate)
|
||||
.inherent_impls
|
||||
.values()
|
||||
{
|
||||
|
@ -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.
|
||||
///
|
||||
|
@ -1679,7 +1679,7 @@ fn check_for_mutation(
|
||||
span_low: None,
|
||||
span_high: None,
|
||||
};
|
||||
let def_id = def_id::DefId::local(body.hir_id.owner);
|
||||
let def_id = body.hir_id.owner.to_def_id();
|
||||
cx.tcx.infer_ctxt().enter(|infcx| {
|
||||
ExprUseVisitor::new(&mut delegate, &infcx, def_id, cx.param_env, cx.tables).walk_expr(body);
|
||||
});
|
||||
|
@ -135,7 +135,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for MissingDoc {
|
||||
hir::ItemKind::Fn(..) => {
|
||||
// ignore main()
|
||||
if it.ident.name == sym!(main) {
|
||||
let def_id = cx.tcx.hir().local_def_id(it.hir_id);
|
||||
let def_id = it.hir_id.owner;
|
||||
let def_key = cx.tcx.hir().def_key(def_id);
|
||||
if def_key.parent == Some(hir::def_id::CRATE_DEF_INDEX) {
|
||||
return;
|
||||
|
@ -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,
|
||||
|
@ -149,9 +149,9 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for NewWithoutDefault {
|
||||
if_chain! {
|
||||
if let Some(ref impling_types) = self.impling_types;
|
||||
if let Some(self_def) = cx.tcx.type_of(self_did).ty_adt_def();
|
||||
if self_def.did.is_local();
|
||||
if let Some(self_def_id) = self_def.did.as_local();
|
||||
then {
|
||||
let self_id = cx.tcx.hir().local_def_id_to_hir_id(self_def.did.to_local());
|
||||
let self_id = cx.tcx.hir().local_def_id_to_hir_id(self_def_id);
|
||||
if impling_types.contains(&self_id) {
|
||||
return;
|
||||
}
|
||||
|
@ -99,7 +99,7 @@ fn check_manual_swap(cx: &LateContext<'_, '_>, block: &Block<'_>) {
|
||||
then {
|
||||
if let ExprKind::Field(ref lhs1, _) = lhs1.kind {
|
||||
if let ExprKind::Field(ref lhs2, _) = lhs2.kind {
|
||||
if lhs1.hir_id.owner_def_id() == lhs2.hir_id.owner_def_id() {
|
||||
if lhs1.hir_id.owner == lhs2.hir_id.owner {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
@ -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;
|
||||
|
@ -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.
|
||||
|
@ -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! {
|
||||
|
@ -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! {
|
||||
|
@ -297,8 +297,8 @@ pub fn qpath_res(cx: &LateContext<'_, '_>, qpath: &hir::QPath<'_>, id: hir::HirI
|
||||
match qpath {
|
||||
hir::QPath::Resolved(_, path) => path.res,
|
||||
hir::QPath::TypeRelative(..) => {
|
||||
if cx.tcx.has_typeck_tables(id.owner_def_id()) {
|
||||
cx.tcx.typeck_tables_of(id.owner_def_id()).qpath_res(qpath, id)
|
||||
if cx.tcx.has_typeck_tables(id.owner.to_def_id()) {
|
||||
cx.tcx.typeck_tables_of(id.owner.to_def_id()).qpath_res(qpath, id)
|
||||
} else {
|
||||
Res::Err
|
||||
}
|
||||
|
@ -5,7 +5,7 @@ use rustc_ast::ast;
|
||||
use rustc_data_structures::fx::FxHashSet;
|
||||
use rustc_hir::def::Res;
|
||||
use rustc_hir::intravisit::{walk_expr, NestedVisitorMap, Visitor};
|
||||
use rustc_hir::{def_id, Expr, HirId, Path};
|
||||
use rustc_hir::{Expr, HirId, Path};
|
||||
use rustc_infer::infer::TyCtxtInferExt;
|
||||
use rustc_lint::LateContext;
|
||||
use rustc_span::symbol::Ident;
|
||||
@ -17,7 +17,7 @@ pub fn mutated_variables<'a, 'tcx>(expr: &'tcx Expr<'_>, cx: &'a LateContext<'a,
|
||||
used_mutably: FxHashSet::default(),
|
||||
skip: false,
|
||||
};
|
||||
let def_id = def_id::DefId::local(expr.hir_id.owner);
|
||||
let def_id = expr.hir_id.owner.to_def_id();
|
||||
cx.tcx.infer_ctxt().enter(|infcx| {
|
||||
ExprUseVisitor::new(&mut delegate, &infcx, def_id, cx.param_env, cx.tables).walk_expr(expr);
|
||||
});
|
||||
|
@ -85,7 +85,7 @@ impl LateLintPass<'_, '_> for WildcardImports {
|
||||
if let ItemKind::Use(use_path, UseKind::Glob) = &item.kind;
|
||||
// don't lint prelude glob imports
|
||||
if !use_path.segments.iter().last().map_or(false, |ps| ps.ident.as_str() == "prelude");
|
||||
let used_imports = cx.tcx.names_imported_by_glob_use(item.hir_id.owner_def_id());
|
||||
let used_imports = cx.tcx.names_imported_by_glob_use(item.hir_id.owner.to_def_id());
|
||||
if !used_imports.is_empty(); // Already handled by `unused_imports`
|
||||
then {
|
||||
let mut applicability = Applicability::MachineApplicable;
|
||||
|
@ -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()) {
|
||||
|
@ -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
|
||||
|
||||
|
@ -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);
|
||||
|
@ -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<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
|
||||
|
||||
|
@ -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) };
|
||||
|
Loading…
Reference in New Issue
Block a user