Skip to content

Commit 0aff00d

Browse files
committed
Auto merge of #5342 - flip1995:rollup-77s2pmt, r=<try>
Rollup of 4 pull requests Successful merges: - #5326 (rustup rust-lang/rust#69838) - #5333 (rustup rust-lang/rust#69189) - #5336 (rustup rust-lang/rust#69920) - #5341 (Rustup to rust-lang/rust#66131) Failed merges: r? @ghost
2 parents c036c4f + 266b988 commit 0aff00d

21 files changed

+56
-30
lines changed

.github/workflows/clippy_bors.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,7 @@ jobs:
209209
run: |
210210
DIR=$CARGO_TARGET_DIR/debug
211211
find $DIR ! -executable -o -type d ! -path $DIR | xargs rm -rf
212-
mv $DIR/integration-* $DIR/integration
212+
mv $DIR/deps/integration-* $DIR/integration
213213
rm -rf $CARGO_TARGET_DIR/release
214214
215215
- name: Upload Binaries

clippy_lints/src/functions.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -486,7 +486,7 @@ fn is_mutable_pat(cx: &LateContext<'_, '_>, pat: &hir::Pat<'_>, tys: &mut FxHash
486486
if let hir::PatKind::Wild = pat.kind {
487487
return false; // ignore `_` patterns
488488
}
489-
let def_id = pat.hir_id.owner_def_id();
489+
let def_id = pat.hir_id.owner.to_def_id();
490490
if cx.tcx.has_typeck_tables(def_id) {
491491
is_mutable_ty(cx, &cx.tcx.typeck_tables_of(def_id).pat_ty(pat), pat.span, tys)
492492
} else {
@@ -601,7 +601,7 @@ impl<'a, 'tcx> intravisit::Visitor<'tcx> for StaticMutVisitor<'a, 'tcx> {
601601
Call(_, args) | MethodCall(_, _, args) => {
602602
let mut tys = FxHashSet::default();
603603
for arg in args {
604-
let def_id = arg.hir_id.owner_def_id();
604+
let def_id = arg.hir_id.owner.to_def_id();
605605
if self.cx.tcx.has_typeck_tables(def_id)
606606
&& is_mutable_ty(
607607
self.cx,

clippy_lints/src/inherent_impl.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for MultipleInherentImpl {
5959
// but filter out implementations that have generic params (type or lifetime)
6060
// or are derived from a macro
6161
if !in_macro(item.span) && generics.params.is_empty() {
62-
self.impls.insert(item.hir_id.owner_def_id(), item.span);
62+
self.impls.insert(item.hir_id.owner.to_def_id(), item.span);
6363
}
6464
}
6565
}
@@ -69,7 +69,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for MultipleInherentImpl {
6969
// Retrieve all inherent implementations from the crate, grouped by type
7070
for impls in cx
7171
.tcx
72-
.crate_inherent_impls(item.hir_id.owner_def_id().krate)
72+
.crate_inherent_impls(item.hir_id.owner.to_def_id().krate)
7373
.inherent_impls
7474
.values()
7575
{

clippy_lints/src/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -56,9 +56,9 @@ extern crate rustc_trait_selection;
5656
#[allow(unused_extern_crates)]
5757
extern crate rustc_typeck;
5858

59-
use rustc::session::Session;
6059
use rustc_data_structures::fx::FxHashSet;
6160
use rustc_lint::LintId;
61+
use rustc_session::Session;
6262

6363
/// Macro used to declare a Clippy lint.
6464
///

clippy_lints/src/loops.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1679,7 +1679,7 @@ fn check_for_mutation(
16791679
span_low: None,
16801680
span_high: None,
16811681
};
1682-
let def_id = def_id::DefId::local(body.hir_id.owner);
1682+
let def_id = body.hir_id.owner.to_def_id();
16831683
cx.tcx.infer_ctxt().enter(|infcx| {
16841684
ExprUseVisitor::new(&mut delegate, &infcx, def_id, cx.param_env, cx.tables).walk_expr(body);
16851685
});

clippy_lints/src/missing_doc.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for MissingDoc {
135135
hir::ItemKind::Fn(..) => {
136136
// ignore main()
137137
if it.ident.name == sym!(main) {
138-
let def_id = cx.tcx.hir().local_def_id(it.hir_id);
138+
let def_id = it.hir_id.owner;
139139
let def_key = cx.tcx.hir().def_key(def_id);
140140
if def_key.parent == Some(hir::def_id::CRATE_DEF_INDEX) {
141141
return;

clippy_lints/src/missing_inline.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ fn check_missing_inline_attrs(cx: &LateContext<'_, '_>, attrs: &[ast::Attribute]
6969
}
7070

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

7474
cx.tcx.sess.crate_types.get().iter().any(|t: &CrateType| match t {
7575
CrateType::Executable => true,

clippy_lints/src/new_without_default.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -149,9 +149,9 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for NewWithoutDefault {
149149
if_chain! {
150150
if let Some(ref impling_types) = self.impling_types;
151151
if let Some(self_def) = cx.tcx.type_of(self_did).ty_adt_def();
152-
if self_def.did.is_local();
152+
if let Some(self_def_id) = self_def.did.as_local();
153153
then {
154-
let self_id = cx.tcx.hir().local_def_id_to_hir_id(self_def.did.to_local());
154+
let self_id = cx.tcx.hir().local_def_id_to_hir_id(self_def_id);
155155
if impling_types.contains(&self_id) {
156156
return;
157157
}

clippy_lints/src/swap.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ fn check_manual_swap(cx: &LateContext<'_, '_>, block: &Block<'_>) {
9999
then {
100100
if let ExprKind::Field(ref lhs1, _) = lhs1.kind {
101101
if let ExprKind::Field(ref lhs2, _) = lhs2.kind {
102-
if lhs1.hir_id.owner_def_id() == lhs2.hir_id.owner_def_id() {
102+
if lhs1.hir_id.owner == lhs2.hir_id.owner {
103103
return;
104104
}
105105
}

clippy_lints/src/trivially_copy_pass_by_ref.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,13 @@ use std::cmp;
33
use crate::utils::{is_copy, is_self_ty, snippet, span_lint_and_sugg};
44
use if_chain::if_chain;
55
use matches::matches;
6-
use rustc::session::config::Config as SessionConfig;
76
use rustc::ty;
87
use rustc_errors::Applicability;
98
use rustc_hir as hir;
109
use rustc_hir::intravisit::FnKind;
1110
use rustc_hir::{Body, FnDecl, HirId, ItemKind, MutTy, Mutability, Node};
1211
use rustc_lint::{LateContext, LateLintPass};
12+
use rustc_session::config::Config as SessionConfig;
1313
use rustc_session::{declare_tool_lint, impl_lint_pass};
1414
use rustc_span::Span;
1515
use rustc_target::abi::LayoutOf;

clippy_lints/src/utils/attrs.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
use rustc::session::Session;
21
use rustc_ast::ast;
32
use rustc_errors::Applicability;
3+
use rustc_session::Session;
44
use std::str::FromStr;
55

66
/// Deprecation status of attributes known by Clippy.

clippy_lints/src/utils/author.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,14 @@
33
44
use crate::utils::{get_attr, higher};
55
use rustc::hir::map::Map;
6-
use rustc::session::Session;
76
use rustc_ast::ast::{Attribute, LitFloatType, LitKind};
87
use rustc_ast::walk_list;
98
use rustc_data_structures::fx::FxHashMap;
109
use rustc_hir as hir;
1110
use rustc_hir::intravisit::{NestedVisitorMap, Visitor};
1211
use rustc_hir::{BindingAnnotation, Block, Expr, ExprKind, Pat, PatKind, QPath, Stmt, StmtKind, TyKind};
1312
use rustc_lint::{LateContext, LateLintPass, LintContext};
13+
use rustc_session::Session;
1414
use rustc_session::{declare_lint_pass, declare_tool_lint};
1515

1616
declare_clippy_lint! {

clippy_lints/src/utils/inspector.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
//! checks for attributes
22
33
use crate::utils::get_attr;
4-
use rustc::session::Session;
54
use rustc_ast::ast::Attribute;
65
use rustc_hir as hir;
76
use rustc_hir::print;
87
use rustc_lint::{LateContext, LateLintPass, LintContext};
8+
use rustc_session::Session;
99
use rustc_session::{declare_lint_pass, declare_tool_lint};
1010

1111
declare_clippy_lint! {

clippy_lints/src/utils/mod.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -297,8 +297,8 @@ pub fn qpath_res(cx: &LateContext<'_, '_>, qpath: &hir::QPath<'_>, id: hir::HirI
297297
match qpath {
298298
hir::QPath::Resolved(_, path) => path.res,
299299
hir::QPath::TypeRelative(..) => {
300-
if cx.tcx.has_typeck_tables(id.owner_def_id()) {
301-
cx.tcx.typeck_tables_of(id.owner_def_id()).qpath_res(qpath, id)
300+
if cx.tcx.has_typeck_tables(id.owner.to_def_id()) {
301+
cx.tcx.typeck_tables_of(id.owner.to_def_id()).qpath_res(qpath, id)
302302
} else {
303303
Res::Err
304304
}

clippy_lints/src/utils/usage.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ use rustc_ast::ast;
55
use rustc_data_structures::fx::FxHashSet;
66
use rustc_hir::def::Res;
77
use rustc_hir::intravisit::{walk_expr, NestedVisitorMap, Visitor};
8-
use rustc_hir::{def_id, Expr, HirId, Path};
8+
use rustc_hir::{Expr, HirId, Path};
99
use rustc_infer::infer::TyCtxtInferExt;
1010
use rustc_lint::LateContext;
1111
use rustc_span::symbol::Ident;
@@ -17,7 +17,7 @@ pub fn mutated_variables<'a, 'tcx>(expr: &'tcx Expr<'_>, cx: &'a LateContext<'a,
1717
used_mutably: FxHashSet::default(),
1818
skip: false,
1919
};
20-
let def_id = def_id::DefId::local(expr.hir_id.owner);
20+
let def_id = expr.hir_id.owner.to_def_id();
2121
cx.tcx.infer_ctxt().enter(|infcx| {
2222
ExprUseVisitor::new(&mut delegate, &infcx, def_id, cx.param_env, cx.tables).walk_expr(expr);
2323
});

clippy_lints/src/wildcard_imports.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ impl LateLintPass<'_, '_> for WildcardImports {
8585
if let ItemKind::Use(use_path, UseKind::Glob) = &item.kind;
8686
// don't lint prelude glob imports
8787
if !use_path.segments.iter().last().map_or(false, |ps| ps.ident.as_str() == "prelude");
88-
let used_imports = cx.tcx.names_imported_by_glob_use(item.hir_id.owner_def_id());
88+
let used_imports = cx.tcx.names_imported_by_glob_use(item.hir_id.owner.to_def_id());
8989
if !used_imports.is_empty(); // Already handled by `unused_imports`
9090
then {
9191
let mut applicability = Applicability::MachineApplicable;

clippy_lints/src/write.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -357,7 +357,7 @@ impl Write {
357357
};
358358
let tts = tts.clone();
359359

360-
let mut parser = parser::Parser::new(&cx.sess.parse_sess, tts, None, false, false, None);
360+
let mut parser = parser::Parser::new(&cx.sess.parse_sess, tts, false, None);
361361
let mut expr: Option<Expr> = None;
362362
if is_write {
363363
expr = match parser.parse_expr().map_err(|mut err| err.cancel()) {

tests/ui/inefficient_to_string.stderr

+4-4
Original file line numberDiff line numberDiff line change
@@ -35,21 +35,21 @@ LL | let _: String = rrrstring.to_string();
3535
|
3636
= help: `&&std::string::String` implements `ToString` through a slower blanket impl, but `std::string::String` has a fast specialization of `ToString`
3737

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

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

5454
error: aborting due to 6 previous errors
5555

tests/ui/transmute.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
error: transmute from a type (`&'a T`) to itself
1+
error: transmute from a type (`&T`) to itself
22
--> $DIR/transmute.rs:19:20
33
|
44
LL | let _: &'a T = core::intrinsics::transmute(t);

tests/ui/transmute_ptr_to_ptr.stderr

+27-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,17 @@
1+
error: transmute from a type (`&T`) to itself
2+
--> $DIR/transmute_ptr_to_ptr.rs:8:5
3+
|
4+
LL | std::mem::transmute::<&'a T, &'static T>(t)
5+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
6+
|
7+
= note: `-D clippy::useless-transmute` implied by `-D warnings`
8+
9+
error: transmute from a type (`&T`) to itself
10+
--> $DIR/transmute_ptr_to_ptr.rs:13:5
11+
|
12+
LL | std::mem::transmute::<&'a T, &'b T>(t)
13+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
14+
115
error: transmute from a pointer to a pointer
216
--> $DIR/transmute_ptr_to_ptr.rs:29:29
317
|
@@ -36,5 +50,17 @@ error: transmute from a reference to a reference
3650
LL | let _: &GenericParam<f32> = std::mem::transmute(&GenericParam { t: 1u32 });
3751
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `&*(&GenericParam { t: 1u32 } as *const GenericParam<u32> as *const GenericParam<f32>)`
3852

39-
error: aborting due to 6 previous errors
53+
error: transmute from a type (`&LifetimeParam`) to itself
54+
--> $DIR/transmute_ptr_to_ptr.rs:50:47
55+
|
56+
LL | let _: &LifetimeParam<'static> = unsafe { std::mem::transmute(&lp) };
57+
| ^^^^^^^^^^^^^^^^^^^^^^^^
58+
59+
error: transmute from a type (`&GenericParam<&LifetimeParam>`) to itself
60+
--> $DIR/transmute_ptr_to_ptr.rs:51:62
61+
|
62+
LL | let _: &GenericParam<&LifetimeParam<'static>> = unsafe { std::mem::transmute(&GenericParam { t: &lp }) };
63+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
64+
65+
error: aborting due to 10 previous errors
4066

tests/ui/transmute_ptr_to_ref.stderr

+2-2
Original file line numberDiff line numberDiff line change
@@ -42,13 +42,13 @@ error: transmute from a pointer type (`*mut U`) to a reference type (`&T`)
4242
LL | let _: &T = std::mem::transmute(om);
4343
| ^^^^^^^^^^^^^^^^^^^^^^^ help: try: `&*(om as *const T)`
4444

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

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

0 commit comments

Comments
 (0)