Skip to content

Commit 93f0a9a

Browse files
committed
Auto merge of rust-lang#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

+1-2
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

+3
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

+2-2
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

+2-2
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

+1-1
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

+5-5
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

+6
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

+2-2
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

+2-2
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

+2-2
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<'_>,

clippy_lints/src/inline_fn_without_body.rs

+1-1
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/manual_clamp.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ use clippy_utils::{
99
peel_blocks_with_stmt, MaybePath,
1010
};
1111
use itertools::Itertools;
12-
use rustc_errors::{Applicability, DiagnosticBuilder};
12+
use rustc_errors::{Applicability, Diag};
1313
use rustc_hir::def::Res;
1414
use rustc_hir::{Arm, BinOpKind, Block, Expr, ExprKind, HirId, PatKind, PathSegment, PrimTy, QPath, StmtKind};
1515
use rustc_lint::{LateContext, LateLintPass};
@@ -163,7 +163,7 @@ fn emit_suggestion<'tcx>(cx: &LateContext<'tcx>, suggestion: &ClampSuggestion<'t
163163
};
164164
let suggestion = format!("{assignment}{input}.clamp({min}, {max}){semicolon}");
165165
let msg = "clamp-like pattern without using clamp function";
166-
let lint_builder = |d: &mut DiagnosticBuilder<'_, ()>| {
166+
let lint_builder = |d: &mut Diag<'_, ()>| {
167167
d.span_suggestion(*span, "replace with clamp", suggestion, Applicability::MaybeIncorrect);
168168
if *is_float {
169169
d.note("clamp will panic if max < min, min.is_nan(), or max.is_nan()")

clippy_lints/src/matches/significant_drop_in_scrutinee.rs

+2-7
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ use crate::FxHashSet;
22
use clippy_utils::diagnostics::span_lint_and_then;
33
use clippy_utils::source::{indent_of, snippet};
44
use clippy_utils::{get_attr, is_lint_allowed};
5-
use rustc_errors::{Applicability, DiagnosticBuilder};
5+
use rustc_errors::{Applicability, Diag};
66
use rustc_hir::intravisit::{walk_expr, Visitor};
77
use rustc_hir::{Arm, Expr, ExprKind, MatchSource};
88
use rustc_lint::{LateContext, LintContext};
@@ -37,12 +37,7 @@ pub(super) fn check<'tcx>(
3737
}
3838
}
3939

40-
fn set_diagnostic<'tcx>(
41-
diag: &mut DiagnosticBuilder<'_, ()>,
42-
cx: &LateContext<'tcx>,
43-
expr: &'tcx Expr<'tcx>,
44-
found: FoundSigDrop,
45-
) {
40+
fn set_diagnostic<'tcx>(diag: &mut Diag<'_, ()>, cx: &LateContext<'tcx>, expr: &'tcx Expr<'tcx>, found: FoundSigDrop) {
4641
if found.lint_suggestion == LintSuggestion::MoveAndClone {
4742
// If our suggestion is to move and clone, then we want to leave it to the user to
4843
// decide how to address this lint, since it may be that cloning is inappropriate.

clippy_lints/src/methods/suspicious_command_arg_space.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
use clippy_utils::diagnostics::span_lint_and_then;
22
use clippy_utils::ty::is_type_diagnostic_item;
3-
use rustc_errors::{Applicability, DiagnosticBuilder};
3+
use rustc_errors::{Applicability, Diag};
44
use rustc_lint::LateContext;
55
use rustc_span::{sym, Span};
66
use {rustc_ast as ast, rustc_hir as hir};
@@ -22,7 +22,7 @@ pub(super) fn check<'tcx>(cx: &LateContext<'tcx>, recv: &'tcx hir::Expr<'_>, arg
2222
SUSPICIOUS_COMMAND_ARG_SPACE,
2323
arg.span,
2424
"single argument that looks like it should be multiple arguments",
25-
|diag: &mut DiagnosticBuilder<'_, ()>| {
25+
|diag: &mut Diag<'_, ()>| {
2626
diag.multipart_suggestion_verbose(
2727
"consider splitting the argument",
2828
vec![(span, "args".to_string()), (arg.span, format!("[{arg1:?}, {arg2:?}]"))],

clippy_lints/src/methods/useless_asref.rs

+2-2
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/missing_asserts_for_indexing.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ use clippy_utils::{eq_expr_value, hash_expr, higher};
99
use rustc_ast::{LitKind, RangeLimits};
1010
use rustc_data_structures::packed::Pu128;
1111
use rustc_data_structures::unhash::UnhashMap;
12-
use rustc_errors::{Applicability, DiagnosticBuilder};
12+
use rustc_errors::{Applicability, Diag};
1313
use rustc_hir::{BinOp, Block, Body, Expr, ExprKind, UnOp};
1414
use rustc_lint::{LateContext, LateLintPass};
1515
use rustc_session::declare_lint_pass;
@@ -67,7 +67,7 @@ declare_lint_pass!(MissingAssertsForIndexing => [MISSING_ASSERTS_FOR_INDEXING]);
6767

6868
fn report_lint<F>(cx: &LateContext<'_>, full_span: Span, msg: &str, indexes: &[Span], f: F)
6969
where
70-
F: FnOnce(&mut DiagnosticBuilder<'_, ()>),
70+
F: FnOnce(&mut Diag<'_, ()>),
7171
{
7272
span_lint_and_then(cx, MISSING_ASSERTS_FOR_INDEXING, full_span, msg, |diag| {
7373
f(diag);

clippy_lints/src/needless_pass_by_value.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ use clippy_utils::ty::{
66
implements_trait, implements_trait_with_env_from_iter, is_copy, is_type_diagnostic_item, is_type_lang_item,
77
};
88
use rustc_ast::ast::Attribute;
9-
use rustc_errors::{Applicability, DiagnosticBuilder};
9+
use rustc_errors::{Applicability, Diag};
1010
use rustc_hir::intravisit::FnKind;
1111
use rustc_hir::{
1212
BindingAnnotation, Body, FnDecl, GenericArg, HirId, HirIdSet, Impl, ItemKind, LangItem, Mutability, Node, PatKind,
@@ -196,7 +196,7 @@ impl<'tcx> LateLintPass<'tcx> for NeedlessPassByValue {
196196
&& !moved_vars.contains(&canonical_id)
197197
{
198198
// Dereference suggestion
199-
let sugg = |diag: &mut DiagnosticBuilder<'_, ()>| {
199+
let sugg = |diag: &mut Diag<'_, ()>| {
200200
if let ty::Adt(def, ..) = ty.kind() {
201201
if let Some(span) = cx.tcx.hir().span_if_local(def.did()) {
202202
if type_allowed_to_implement_copy(

clippy_lints/src/new_without_default.rs

+1-1
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_lints/src/types/vec_box.rs

+3-4
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
11
use clippy_utils::diagnostics::span_lint_and_sugg;
2-
use clippy_utils::paths::ALLOCATOR_GLOBAL;
2+
use clippy_utils::last_path_segment;
33
use clippy_utils::source::snippet;
4-
use clippy_utils::{last_path_segment, match_def_path};
54
use rustc_errors::Applicability;
65
use rustc_hir::def_id::DefId;
7-
use rustc_hir::{self as hir, GenericArg, QPath, TyKind};
6+
use rustc_hir::{self as hir, GenericArg, LangItem, QPath, TyKind};
87
use rustc_hir_analysis::hir_ty_to_ty;
98
use rustc_lint::LateContext;
109
use rustc_middle::ty::layout::LayoutOf;
@@ -50,7 +49,7 @@ pub(super) fn check<'tcx>(
5049
(None, Some(GenericArg::Type(inner))) | (Some(GenericArg::Type(inner)), None) => {
5150
if let TyKind::Path(path) = inner.kind
5251
&& let Some(did) = cx.qpath_res(&path, inner.hir_id).opt_def_id() {
53-
match_def_path(cx, did, &ALLOCATOR_GLOBAL)
52+
cx.tcx.lang_items().get(LangItem::GlobalAlloc) == Some(did)
5453
} else {
5554
false
5655
}

clippy_lints/src/utils/internal_lints/metadata_collector.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ const LINT_EMISSION_FUNCTIONS: [&[&str]; 7] = [
7474
&["clippy_utils", "diagnostics", "span_lint_and_then"],
7575
&["clippy_utils", "diagnostics", "span_lint_hir_and_then"],
7676
];
77-
const SUGGESTION_DIAGNOSTIC_BUILDER_METHODS: [(&str, bool); 9] = [
77+
const SUGGESTION_DIAG_METHODS: [(&str, bool); 9] = [
7878
("span_suggestion", false),
7979
("span_suggestion_short", false),
8080
("span_suggestion_verbose", false),
@@ -1067,9 +1067,9 @@ impl<'a, 'hir> intravisit::Visitor<'hir> for IsMultiSpanScanner<'a, 'hir> {
10671067
},
10681068
ExprKind::MethodCall(path, recv, _, _arg_span) => {
10691069
let (self_ty, _) = walk_ptrs_ty_depth(self.cx.typeck_results().expr_ty(recv));
1070-
if match_type(self.cx, self_ty, &paths::DIAGNOSTIC_BUILDER) {
1070+
if match_type(self.cx, self_ty, &paths::DIAG) {
10711071
let called_method = path.ident.name.as_str().to_string();
1072-
for (method_name, is_multi_part) in &SUGGESTION_DIAGNOSTIC_BUILDER_METHODS {
1072+
for (method_name, is_multi_part) in &SUGGESTION_DIAG_METHODS {
10731073
if *method_name == called_method {
10741074
if *is_multi_part {
10751075
self.add_multi_part_suggestion();

clippy_utils/src/ast_utils.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,8 @@ pub fn eq_expr(l: &Expr, r: &Expr) -> bool {
143143
match (&l.kind, &r.kind) {
144144
(Paren(l), _) => eq_expr(l, r),
145145
(_, Paren(r)) => eq_expr(l, r),
146-
(Err, Err) => true,
146+
(Err(_), Err(_)) => true,
147+
(Dummy, _) | (_, Dummy) => unreachable!("comparing `ExprKind::Dummy`"),
147148
(Try(l), Try(r)) | (Await(l, _), Await(r, _)) => eq_expr(l, r),
148149
(Array(l), Array(r)) => over(l, r, |l, r| eq_expr(l, r)),
149150
(Tup(l), Tup(r)) => over(l, r, |l, r| eq_expr(l, r)),

clippy_utils/src/consts.rs

+6
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))

0 commit comments

Comments
 (0)