Skip to content

Commit d4d39a9

Browse files
committed
Auto merge of #123108 - matthiaskrgr:rollup-zossklv, r=matthiaskrgr
Rollup of 9 pull requests Successful merges: - #108675 (Document `adt_const_params` feature in Unstable Book) - #122120 (Suggest associated type bounds on problematic associated equality bounds) - #122589 (Fix diagnostics for async block cloning) - #122835 (Require `DerefMut` and `DerefPure` on `deref!()` patterns when appropriate) - #123049 (In `ConstructCoroutineInClosureShim`, pass receiver by mut ref, not mut pointer) - #123055 (enable cargo miri test doctests) - #123057 (unix fs: Make hurd using explicit new rather than From) - #123087 (Change `f16` and `f128` clippy stubs to be nonpanicking) - #123103 (Rename `Inherited` -> `TypeckRootCtxt`) r? `@ghost` `@rustbot` modify labels: rollup
2 parents 888e86b + 421d3a5 commit d4d39a9

File tree

3 files changed

+17
-10
lines changed

3 files changed

+17
-10
lines changed

clippy_lints/src/float_literal.rs

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,10 @@ impl<'tcx> LateLintPass<'tcx> for FloatLiteral {
8383
LitFloatType::Unsuffixed => None,
8484
};
8585
let (is_whole, is_inf, mut float_str) = match fty {
86-
FloatTy::F16 => unimplemented!("f16_f128"),
86+
FloatTy::F16 => {
87+
// FIXME(f16_f128): do a check like the others when parsing is available
88+
return;
89+
},
8790
FloatTy::F32 => {
8891
let value = sym_str.parse::<f32>().unwrap();
8992

@@ -94,7 +97,10 @@ impl<'tcx> LateLintPass<'tcx> for FloatLiteral {
9497

9598
(value.fract() == 0.0, value.is_infinite(), formatter.format(value))
9699
},
97-
FloatTy::F128 => unimplemented!("f16_f128"),
100+
FloatTy::F128 => {
101+
// FIXME(f16_f128): do a check like the others when parsing is available
102+
return;
103+
},
98104
};
99105

100106
if is_inf {
@@ -139,10 +145,11 @@ impl<'tcx> LateLintPass<'tcx> for FloatLiteral {
139145
#[must_use]
140146
fn max_digits(fty: FloatTy) -> u32 {
141147
match fty {
142-
FloatTy::F16 => unimplemented!("f16_f128"),
148+
// FIXME(f16_f128): replace the magic numbers once `{f16,f128}::DIGITS` are available
149+
FloatTy::F16 => 3,
143150
FloatTy::F32 => f32::DIGITS,
144151
FloatTy::F64 => f64::DIGITS,
145-
FloatTy::F128 => unimplemented!("f16_f128"),
152+
FloatTy::F128 => 33,
146153
}
147154
}
148155

clippy_lints/src/methods/unnecessary_to_owned.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ use rustc_errors::Applicability;
1212
use rustc_hir::def::{DefKind, Res};
1313
use rustc_hir::def_id::DefId;
1414
use rustc_hir::{BorrowKind, Expr, ExprKind, ItemKind, LangItem, Node};
15-
use rustc_hir_typeck::{FnCtxt, Inherited};
15+
use rustc_hir_typeck::{FnCtxt, TypeckRootCtxt};
1616
use rustc_infer::infer::TyCtxtInferExt;
1717
use rustc_lint::LateContext;
1818
use rustc_middle::mir::Mutability;
@@ -438,8 +438,8 @@ fn can_change_type<'a>(cx: &LateContext<'a>, mut expr: &'a Expr<'a>, mut ty: Ty<
438438
Node::Item(item) => {
439439
if let ItemKind::Fn(_, _, body_id) = &item.kind
440440
&& let output_ty = return_ty(cx, item.owner_id)
441-
&& let inherited = Inherited::new(cx.tcx, item.owner_id.def_id)
442-
&& let fn_ctxt = FnCtxt::new(&inherited, cx.param_env, item.owner_id.def_id)
441+
&& let root_ctxt = TypeckRootCtxt::new(cx.tcx, item.owner_id.def_id)
442+
&& let fn_ctxt = FnCtxt::new(&root_ctxt, cx.param_env, item.owner_id.def_id)
443443
&& fn_ctxt.can_coerce(ty, output_ty)
444444
{
445445
if has_lifetime(output_ty) && has_lifetime(ty) {

clippy_lints/src/transmute/utils.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
use rustc_hir as hir;
22
use rustc_hir::Expr;
3-
use rustc_hir_typeck::{cast, FnCtxt, Inherited};
3+
use rustc_hir_typeck::{cast, FnCtxt, TypeckRootCtxt};
44
use rustc_lint::LateContext;
55
use rustc_middle::ty::cast::CastKind;
66
use rustc_middle::ty::Ty;
@@ -34,8 +34,8 @@ pub(super) fn check_cast<'tcx>(
3434
let hir_id = e.hir_id;
3535
let local_def_id = hir_id.owner.def_id;
3636

37-
let inherited = Inherited::new(cx.tcx, local_def_id);
38-
let fn_ctxt = FnCtxt::new(&inherited, cx.param_env, local_def_id);
37+
let root_ctxt = TypeckRootCtxt::new(cx.tcx, local_def_id);
38+
let fn_ctxt = FnCtxt::new(&root_ctxt, cx.param_env, local_def_id);
3939

4040
if let Ok(check) = cast::CastCheck::new(
4141
&fn_ctxt,

0 commit comments

Comments
 (0)