Skip to content

Rustup #11563

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 38 commits into from
Sep 25, 2023
Merged

Rustup #11563

Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
1c27ba9
Stabilize the Saturating type (saturating_int_impl, gh-87920)
kellerkindt Jul 26, 2023
0f74faf
Use `Freeze` for `SourceFile.lines`
Zoxc Aug 31, 2023
e88a556
Reuse rustdoc's doc comment handling in Clippy
Alexendoo Sep 8, 2023
54f3ddb
Call `LateLintPass::check_attribute` from `with_lint_attrs`
Alexendoo Sep 10, 2023
ab08a3d
Update tools and fulldeps tests
matthewjasper Sep 8, 2023
b643f20
Auto merge of #115689 - Alexendoo:clippy-doc-comments, r=notriddle,Ma…
bors Sep 12, 2023
471469d
Merge commit '98363cbf6a7c3f8b571a7d92a3c645bb4376e4a6' into clippyup
flip1995 Sep 12, 2023
5cd391c
make the set of methods between our two Const types more consistent
RalfJung Sep 12, 2023
0698591
Auto merge of #115790 - flip1995:clippyup, r=Manishearth
bors Sep 13, 2023
2aaaeb4
use AllocId instead of Allocation in ConstValue::ByRef
RalfJung Sep 11, 2023
b2d5d68
cleanup op_to_const a bit; rename ConstValue::ByRef → Indirect
RalfJung Sep 12, 2023
272df70
treat host effect params as erased generics in codegen
fee1-dead Sep 13, 2023
477a9b8
fix clippy (and MIR printing) handling of ConstValue::Indirect slices
RalfJung Sep 12, 2023
eb545d7
Auto merge of #115817 - fee1-dead-contrib:fix-codegen, r=oli-obk
bors Sep 14, 2023
da4244e
Ignore `#[doc(hidden)]` functions in clippy doc lints
Alexendoo Sep 14, 2023
9756a13
Auto merge of #115677 - matthewjasper:let-expr-recovery, r=b-naber
bors Sep 14, 2023
1d49cb6
move required_consts check to general post-mono-check function
RalfJung Sep 11, 2023
3226e4b
don't point at const usage site for resolution-time errors
RalfJung Sep 11, 2023
2121629
Auto merge of #115851 - Alexendoo:clippy-doc-hidden-headers, r=flip1995
bors Sep 15, 2023
66aa7f7
Rollup merge of #115477 - kellerkindt:stabilized_int_impl, r=dtolnay
Dylan-DPC Sep 17, 2023
e9dc753
Auto merge of #115748 - RalfJung:post-mono, r=oli-obk
bors Sep 18, 2023
b30cefc
move ConstValue into mir
RalfJung Sep 16, 2023
2ea6ac5
rename mir::Constant -> mir::ConstOperand, mir::ConstKind -> mir::Const
RalfJung Sep 20, 2023
238dc28
Prevent promotion of const fn calls in inline consts
oli-obk Sep 18, 2023
12815e9
Rollup merge of #115972 - RalfJung:const-consistency, r=oli-obk
GuillaumeGomez Sep 21, 2023
823bcb4
Record asyncness span in HIR
compiler-errors Sep 14, 2023
1fac304
adjust how closure/generator types and rvalues are printed
RalfJung Sep 9, 2023
74573fb
fix clippy errors (ignore effects in certainty)
fee1-dead Sep 22, 2023
84917c8
Auto merge of #114776 - fee1-dead-contrib:enable-effects-in-libcore, …
bors Sep 22, 2023
5ee167e
Add a way to decouple the implementation and the declaration of a TyC…
oli-obk Sep 22, 2023
835d7d9
Auto merge of #115696 - RalfJung:closure-ty-print, r=oli-obk
bors Sep 22, 2023
3da69c7
Auto merge of #116052 - oli-obk:ceci_nest_pas_une_query, r=WaffleLapkin
bors Sep 23, 2023
0a2d39d
Enable drop_tracking_mir by default.
cjgillot Jan 28, 2023
19e160f
Bless clippy.
cjgillot Jan 28, 2023
e2669b2
Remove GeneratorWitness and rename GeneratorWitnessMIR.
cjgillot Aug 3, 2023
81fe8dc
Merge remote-tracking branch 'upstream/master' into rustup
flip1995 Sep 25, 2023
5eb7604
Bump nightly version -> 2023-09-25
flip1995 Sep 25, 2023
903add0
Fix dogfood fallout
flip1995 Sep 25, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion clippy_lints/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ clippy_utils = { path = "../clippy_utils" }
declare_clippy_lint = { path = "../declare_clippy_lint" }
if_chain = "1.0"
itertools = "0.10.1"
pulldown-cmark = { version = "0.9", default-features = false }
quine-mc_cluskey = "0.2"
regex-syntax = "0.7"
serde = { version = "1.0", features = ["derive"] }
Expand Down
43 changes: 25 additions & 18 deletions clippy_lints/src/await_holding_invalid.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ use clippy_utils::diagnostics::span_lint_and_then;
use clippy_utils::{match_def_path, paths};
use rustc_data_structures::fx::FxHashMap;
use rustc_hir::def_id::DefId;
use rustc_hir::{AsyncGeneratorKind, Body, BodyId, GeneratorKind};
use rustc_hir::{AsyncGeneratorKind, Body, GeneratorKind};
use rustc_lint::{LateContext, LateLintPass};
use rustc_middle::ty::GeneratorInteriorTypeCause;
use rustc_middle::mir::GeneratorLayout;
use rustc_session::{declare_tool_lint, impl_lint_pass};
use rustc_span::{sym, Span};

Expand Down Expand Up @@ -197,36 +197,43 @@ impl LateLintPass<'_> for AwaitHolding {
fn check_body(&mut self, cx: &LateContext<'_>, body: &'_ Body<'_>) {
use AsyncGeneratorKind::{Block, Closure, Fn};
if let Some(GeneratorKind::Async(Block | Closure | Fn)) = body.generator_kind {
let body_id = BodyId {
hir_id: body.value.hir_id,
};
let typeck_results = cx.tcx.typeck_body(body_id);
self.check_interior_types(
cx,
typeck_results.generator_interior_types.as_ref().skip_binder(),
body.value.span,
);
let def_id = cx.tcx.hir().body_owner_def_id(body.id());
if let Some(generator_layout) = cx.tcx.mir_generator_witnesses(def_id) {
self.check_interior_types(cx, generator_layout);
}
}
}
}

impl AwaitHolding {
fn check_interior_types(&self, cx: &LateContext<'_>, ty_causes: &[GeneratorInteriorTypeCause<'_>], span: Span) {
for ty_cause in ty_causes {
fn check_interior_types(&self, cx: &LateContext<'_>, generator: &GeneratorLayout<'_>) {
for (ty_index, ty_cause) in generator.field_tys.iter_enumerated() {
if let rustc_middle::ty::Adt(adt, _) = ty_cause.ty.kind() {
let await_points = || {
generator
.variant_source_info
.iter_enumerated()
.filter_map(|(variant, source_info)| {
generator.variant_fields[variant]
.raw
.contains(&ty_index)
.then_some(source_info.span)
})
.collect::<Vec<_>>()
};
if is_mutex_guard(cx, adt.did()) {
span_lint_and_then(
cx,
AWAIT_HOLDING_LOCK,
ty_cause.span,
ty_cause.source_info.span,
"this `MutexGuard` is held across an `await` point",
|diag| {
diag.help(
"consider using an async-aware `Mutex` type or ensuring the \
`MutexGuard` is dropped before calling await",
);
diag.span_note(
ty_cause.scope_span.unwrap_or(span),
await_points(),
"these are all the `await` points this lock is held through",
);
},
Expand All @@ -235,18 +242,18 @@ impl AwaitHolding {
span_lint_and_then(
cx,
AWAIT_HOLDING_REFCELL_REF,
ty_cause.span,
ty_cause.source_info.span,
"this `RefCell` reference is held across an `await` point",
|diag| {
diag.help("ensure the reference is dropped before calling `await`");
diag.span_note(
ty_cause.scope_span.unwrap_or(span),
await_points(),
"these are all the `await` points this reference is held through",
);
},
);
} else if let Some(disallowed) = self.def_ids.get(&adt.did()) {
emit_invalid_type(cx, ty_cause.span, disallowed);
emit_invalid_type(cx, ty_cause.source_info.span, disallowed);
}
}
}
Expand Down
1 change: 0 additions & 1 deletion clippy_lints/src/dereference.rs
Original file line number Diff line number Diff line change
Expand Up @@ -844,7 +844,6 @@ impl TyCoercionStability {
| ty::FnDef(..)
| ty::Generator(..)
| ty::GeneratorWitness(..)
| ty::GeneratorWitnessMIR(..)
| ty::Closure(..)
| ty::Never
| ty::Tuple(_)
Expand Down
2 changes: 1 addition & 1 deletion clippy_lints/src/derive.rs
Original file line number Diff line number Diff line change
Expand Up @@ -343,7 +343,7 @@ fn check_copy_clone<'tcx>(cx: &LateContext<'tcx>, item: &Item<'_>, trait_ref: &h
// If the current self type doesn't implement Copy (due to generic constraints), search to see if
// there's a Copy impl for any instance of the adt.
if !is_copy(cx, ty) {
if ty_subs.non_erasable_generics().next().is_some() {
if ty_subs.non_erasable_generics(cx.tcx, ty_adt.did()).next().is_some() {
let has_copy_impl = cx.tcx.all_local_trait_impls(()).get(&copy_id).map_or(false, |impls| {
impls.iter().any(|&id| {
matches!(cx.tcx.type_of(id).instantiate_identity().kind(), ty::Adt(adt, _)
Expand Down
Loading