Skip to content

Commit 93f0a9a

Browse files
committed
Auto merge of #12431 - flip1995:rustup, r=flip1995
Rustup r? `@ghost` changelog: none
2 parents ba80e06 + 1d65642 commit 93f0a9a

File tree

64 files changed

+285
-268
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

64 files changed

+285
-268
lines changed

clippy_config/src/lib.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,7 @@
55
clippy::must_use_candidate,
66
clippy::missing_panics_doc,
77
rustc::diagnostic_outside_of_impl,
8-
rustc::untranslatable_diagnostic,
9-
rustc::untranslatable_diagnostic_trivial
8+
rustc::untranslatable_diagnostic
109
)]
1110

1211
extern crate rustc_ast;

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/casts/cast_possible_truncation.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ use clippy_utils::expr_or_init;
44
use clippy_utils::source::snippet;
55
use clippy_utils::sugg::Sugg;
66
use clippy_utils::ty::{get_discriminant_value, is_isize_or_usize};
7-
use rustc_errors::{Applicability, DiagnosticBuilder, SuggestionStyle};
7+
use rustc_errors::{Applicability, Diag, SuggestionStyle};
88
use rustc_hir::def::{DefKind, Res};
99
use rustc_hir::{BinOpKind, Expr, ExprKind};
1010
use rustc_lint::LateContext;
@@ -176,7 +176,7 @@ fn offer_suggestion(
176176
expr: &Expr<'_>,
177177
cast_expr: &Expr<'_>,
178178
cast_to_span: Span,
179-
diag: &mut DiagnosticBuilder<'_, ()>,
179+
diag: &mut Diag<'_, ()>,
180180
) {
181181
let cast_to_snip = snippet(cx, cast_to_span, "..");
182182
let suggestion = if cast_to_snip == "_" {

clippy_lints/src/disallowed_macros.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ use clippy_utils::diagnostics::{span_lint_and_then, span_lint_hir_and_then};
33
use clippy_utils::macros::macro_backtrace;
44
use rustc_ast::Attribute;
55
use rustc_data_structures::fx::FxHashSet;
6-
use rustc_errors::DiagnosticBuilder;
6+
use rustc_errors::Diag;
77
use rustc_hir::def_id::DefIdMap;
88
use rustc_hir::{
99
Expr, ExprKind, ForeignItem, HirId, ImplItem, Item, ItemKind, OwnerId, Pat, Path, Stmt, TraitItem, Ty,
@@ -89,7 +89,7 @@ impl DisallowedMacros {
8989
if let Some(&index) = self.disallowed.get(&mac.def_id) {
9090
let conf = &self.conf_disallowed[index];
9191
let msg = format!("use of a disallowed macro `{}`", conf.path());
92-
let add_note = |diag: &mut DiagnosticBuilder<'_, _>| {
92+
let add_note = |diag: &mut Diag<'_, _>| {
9393
if let Some(reason) = conf.reason() {
9494
diag.note(reason);
9595
}

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: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ use clippy_utils::diagnostics::span_lint;
66
use rustc_ast::{CoroutineKind, Fn, FnRetTy, Item, ItemKind};
77
use rustc_data_structures::sync::Lrc;
88
use rustc_errors::emitter::HumanEmitter;
9-
use rustc_errors::{DiagCtxt, DiagnosticBuilder};
9+
use rustc_errors::{Diag, DiagCtxt};
1010
use rustc_lint::LateContext;
1111
use rustc_parse::maybe_new_parser_from_source_str;
1212
use rustc_parse::parser::ForceCollect;
@@ -45,15 +45,15 @@ pub fn check(
4545
let fallback_bundle =
4646
rustc_errors::fallback_fluent_bundle(rustc_driver::DEFAULT_LOCALE_RESOURCES.to_vec(), false);
4747
let emitter = HumanEmitter::new(Box::new(io::sink()), fallback_bundle);
48-
let dcx = DiagCtxt::with_emitter(Box::new(emitter)).disable_warnings();
48+
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) => {
56-
errs.into_iter().for_each(DiagnosticBuilder::cancel);
56+
errs.into_iter().for_each(Diag::cancel);
5757
return (false, test_attr_spans);
5858
},
5959
};

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/functions/result.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
use rustc_errors::DiagnosticBuilder;
1+
use rustc_errors::Diag;
22
use rustc_hir as hir;
33
use rustc_lint::{LateContext, LintContext};
44
use rustc_middle::lint::in_external_macro;
@@ -135,7 +135,7 @@ fn check_result_large_err<'tcx>(cx: &LateContext<'tcx>, err_ty: Ty<'tcx>, hir_ty
135135
RESULT_LARGE_ERR,
136136
hir_ty_span,
137137
"the `Err`-variant returned from this function is very large",
138-
|diag: &mut DiagnosticBuilder<'_, ()>| {
138+
|diag: &mut Diag<'_, ()>| {
139139
diag.span_label(hir_ty_span, format!("the `Err`-variant is at least {ty_size} bytes"));
140140
diag.help(format!("try reducing the size of `{err_ty}`, for example by boxing large elements or replacing it with `Box<{err_ty}>`"));
141141
},

clippy_lints/src/if_let_mutex.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
use clippy_utils::diagnostics::span_lint_and_then;
22
use clippy_utils::ty::is_type_diagnostic_item;
33
use clippy_utils::{higher, SpanlessEq};
4-
use rustc_errors::DiagnosticBuilder;
4+
use rustc_errors::Diag;
55
use rustc_hir::intravisit::{self as visit, Visitor};
66
use rustc_hir::{Expr, ExprKind};
77
use rustc_lint::{LateContext, LateLintPass};
@@ -59,7 +59,7 @@ impl<'tcx> LateLintPass<'tcx> for IfLetMutex {
5959
arm_visit.visit_expr(if_else);
6060

6161
if let Some(arm_mutex) = arm_visit.found_mutex_if_same_as(op_mutex) {
62-
let diag = |diag: &mut DiagnosticBuilder<'_, ()>| {
62+
let diag = |diag: &mut Diag<'_, ()>| {
6363
diag.span_label(
6464
op_mutex.span,
6565
"this Mutex will remain locked for the entire `if let`-block...",

clippy_lints/src/implicit_hasher.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
use std::borrow::Cow;
22
use std::collections::BTreeMap;
33

4-
use rustc_errors::DiagnosticBuilder;
4+
use rustc_errors::Diag;
55
use rustc_hir as hir;
66
use rustc_hir::intravisit::{walk_body, walk_expr, walk_inf, walk_ty, Visitor};
77
use rustc_hir::{Body, Expr, ExprKind, GenericArg, Item, ItemKind, QPath, TyKind};
@@ -65,7 +65,7 @@ impl<'tcx> LateLintPass<'tcx> for ImplicitHasher {
6565

6666
fn suggestion(
6767
cx: &LateContext<'_>,
68-
diag: &mut DiagnosticBuilder<'_, ()>,
68+
diag: &mut Diag<'_, ()>,
6969
generics_span: Span,
7070
generics_suggestion_span: Span,
7171
target: &ImplicitHasherType<'_>,

0 commit comments

Comments
 (0)