Skip to content

Commit 429fb59

Browse files
committed
Auto merge of rust-lang#3363 - RalfJung:rustup, r=RalfJung
Rustup This should finally work again :)
2 parents 1e346ec + 84f6e90 commit 429fb59

18 files changed

+49
-43
lines changed

clippy_lints/src/approx_const.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,9 +75,12 @@ impl ApproxConstant {
7575
fn check_lit(&self, cx: &LateContext<'_>, lit: &LitKind, e: &Expr<'_>) {
7676
match *lit {
7777
LitKind::Float(s, LitFloatType::Suffixed(fty)) => match fty {
78+
FloatTy::F16 => self.check_known_consts(cx, e, s, "f16"),
7879
FloatTy::F32 => self.check_known_consts(cx, e, s, "f32"),
7980
FloatTy::F64 => self.check_known_consts(cx, e, s, "f64"),
81+
FloatTy::F128 => self.check_known_consts(cx, e, s, "f128"),
8082
},
83+
// FIXME(f16_f128): add `f16` and `f128` when these types become stable.
8184
LitKind::Float(s, LitFloatType::Unsuffixed) => self.check_known_consts(cx, e, s, "f{32, 64}"),
8285
_ => (),
8386
}

clippy_lints/src/disallowed_script_idents.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ impl EarlyLintPass for DisallowedScriptIdents {
7272
return;
7373
}
7474

75-
let symbols = cx.sess().parse_sess.symbol_gallery.symbols.lock();
75+
let symbols = cx.sess().psess.symbol_gallery.symbols.lock();
7676
// Sort by `Span` so that error messages make sense with respect to the
7777
// order of identifier locations in the code.
7878
let mut symbols: Vec<_> = symbols.iter().collect();

clippy_lints/src/doc/needless_doctest_main.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,9 +48,9 @@ pub fn check(
4848
let dcx = DiagCtxt::new(Box::new(emitter)).disable_warnings();
4949
#[expect(clippy::arc_with_non_send_sync)] // `Lrc` is expected by with_dcx
5050
let sm = Lrc::new(SourceMap::new(FilePathMapping::empty()));
51-
let sess = ParseSess::with_dcx(dcx, sm);
51+
let psess = ParseSess::with_dcx(dcx, sm);
5252

53-
let mut parser = match maybe_new_parser_from_source_str(&sess, filename, code) {
53+
let mut parser = match maybe_new_parser_from_source_str(&psess, filename, code) {
5454
Ok(p) => p,
5555
Err(errs) => {
5656
errs.into_iter().for_each(Diag::cancel);

clippy_lints/src/float_literal.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,11 +76,14 @@ impl<'tcx> LateLintPass<'tcx> for FloatLiteral {
7676
let digits = count_digits(sym_str);
7777
let max = max_digits(fty);
7878
let type_suffix = match lit_float_ty {
79+
LitFloatType::Suffixed(ast::FloatTy::F16) => Some("f16"),
7980
LitFloatType::Suffixed(ast::FloatTy::F32) => Some("f32"),
8081
LitFloatType::Suffixed(ast::FloatTy::F64) => Some("f64"),
82+
LitFloatType::Suffixed(ast::FloatTy::F128) => Some("f128"),
8183
LitFloatType::Unsuffixed => None,
8284
};
8385
let (is_whole, is_inf, mut float_str) = match fty {
86+
FloatTy::F16 => unimplemented!("f16_f128"),
8487
FloatTy::F32 => {
8588
let value = sym_str.parse::<f32>().unwrap();
8689

@@ -91,6 +94,7 @@ impl<'tcx> LateLintPass<'tcx> for FloatLiteral {
9194

9295
(value.fract() == 0.0, value.is_infinite(), formatter.format(value))
9396
},
97+
FloatTy::F128 => unimplemented!("f16_f128"),
9498
};
9599

96100
if is_inf {
@@ -135,8 +139,10 @@ impl<'tcx> LateLintPass<'tcx> for FloatLiteral {
135139
#[must_use]
136140
fn max_digits(fty: FloatTy) -> u32 {
137141
match fty {
142+
FloatTy::F16 => unimplemented!("f16_f128"),
138143
FloatTy::F32 => f32::DIGITS,
139144
FloatTy::F64 => f64::DIGITS,
145+
FloatTy::F128 => unimplemented!("f16_f128"),
140146
}
141147
}
142148

clippy_lints/src/inline_fn_without_body.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
//! checks for `#[inline]` on trait methods without bodies
22
33
use clippy_utils::diagnostics::span_lint_and_then;
4-
use clippy_utils::sugg::DiagnosticExt;
4+
use clippy_utils::sugg::DiagExt;
55
use rustc_ast::ast::Attribute;
66
use rustc_errors::Applicability;
77
use rustc_hir::{TraitFn, TraitItem, TraitItemKind};

clippy_lints/src/methods/useless_asref.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,9 @@ fn get_enum_ty(enum_ty: Ty<'_>) -> Option<Ty<'_>> {
2222
}
2323

2424
impl<'tcx> TypeVisitor<TyCtxt<'tcx>> for ContainsTyVisitor {
25-
type BreakTy = Ty<'tcx>;
25+
type Result = ControlFlow<Ty<'tcx>>;
2626

27-
fn visit_ty(&mut self, t: Ty<'tcx>) -> ControlFlow<Self::BreakTy> {
27+
fn visit_ty(&mut self, t: Ty<'tcx>) -> Self::Result {
2828
self.level += 1;
2929
if self.level == 1 {
3030
t.super_visit_with(self)

clippy_lints/src/new_without_default.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
use clippy_utils::diagnostics::span_lint_hir_and_then;
22
use clippy_utils::return_ty;
33
use clippy_utils::source::snippet;
4-
use clippy_utils::sugg::DiagnosticExt;
4+
use clippy_utils::sugg::DiagExt;
55
use rustc_errors::Applicability;
66
use rustc_hir as hir;
77
use rustc_hir::HirIdSet;

clippy_utils/src/consts.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -277,12 +277,16 @@ pub fn lit_to_mir_constant<'tcx>(lit: &LitKind, ty: Option<Ty<'tcx>>) -> Constan
277277
LitKind::Char(c) => Constant::Char(c),
278278
LitKind::Int(n, _) => Constant::Int(n.get()),
279279
LitKind::Float(ref is, LitFloatType::Suffixed(fty)) => match fty {
280+
ast::FloatTy::F16 => unimplemented!("f16_f128"),
280281
ast::FloatTy::F32 => Constant::F32(is.as_str().parse().unwrap()),
281282
ast::FloatTy::F64 => Constant::F64(is.as_str().parse().unwrap()),
283+
ast::FloatTy::F128 => unimplemented!("f16_f128"),
282284
},
283285
LitKind::Float(ref is, LitFloatType::Unsuffixed) => match ty.expect("type of float is known").kind() {
286+
ty::Float(FloatTy::F16) => unimplemented!("f16_f128"),
284287
ty::Float(FloatTy::F32) => Constant::F32(is.as_str().parse().unwrap()),
285288
ty::Float(FloatTy::F64) => Constant::F64(is.as_str().parse().unwrap()),
289+
ty::Float(FloatTy::F128) => unimplemented!("f16_f128"),
286290
_ => bug!(),
287291
},
288292
LitKind::Bool(b) => Constant::Bool(b),
@@ -778,8 +782,10 @@ pub fn mir_to_const<'tcx>(lcx: &LateContext<'tcx>, result: mir::Const<'tcx>) ->
778782
let range = alloc_range(offset + size * idx, size);
779783
let val = alloc.read_scalar(&lcx.tcx, range, /* read_provenance */ false).ok()?;
780784
res.push(match flt {
785+
FloatTy::F16 => unimplemented!("f16_f128"),
781786
FloatTy::F32 => Constant::F32(f32::from_bits(val.to_u32().ok()?)),
782787
FloatTy::F64 => Constant::F64(f64::from_bits(val.to_u64().ok()?)),
788+
FloatTy::F128 => unimplemented!("f16_f128"),
783789
});
784790
}
785791
Some(Constant::Vec(res))

clippy_utils/src/mir/possible_borrower.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -141,9 +141,9 @@ impl<'a, 'b, 'tcx> mir::visit::Visitor<'tcx> for PossibleBorrowerVisitor<'a, 'b,
141141
struct ContainsRegion;
142142

143143
impl TypeVisitor<TyCtxt<'_>> for ContainsRegion {
144-
type BreakTy = ();
144+
type Result = ControlFlow<()>;
145145

146-
fn visit_region(&mut self, _: ty::Region<'_>) -> ControlFlow<Self::BreakTy> {
146+
fn visit_region(&mut self, _: ty::Region<'_>) -> Self::Result {
147147
ControlFlow::Break(())
148148
}
149149
}

clippy_utils/src/qualify_min_const_fn.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -334,7 +334,7 @@ fn check_terminator<'tcx>(
334334
// within const fns. `transmute` is allowed in all other const contexts.
335335
// This won't really scale to more intrinsics or functions. Let's allow const
336336
// transmutes in const fn before we add more hacks to this.
337-
if matches!(tcx.intrinsic(fn_def_id), Some(sym::transmute)) {
337+
if tcx.is_intrinsic(fn_def_id, sym::transmute) {
338338
return Err((
339339
span,
340340
"can only call `transmute` from const items, not `const fn`".into(),

0 commit comments

Comments
 (0)