Skip to content

Rollup of 10 pull requests #106573

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 42 commits into from
Jan 8, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
42 commits
Select commit Hold shift + click to select a range
72a9029
PhantomData layout guarantees
joshlf Nov 7, 2022
ac583f1
Add O(1) `Vec -> VecDeque` conversion guarantee
Sp00ph Dec 1, 2022
9553a4d
Fix process-panic-after-fork.rs to pass on newer versions of Android.
pcc Dec 10, 2022
5cccb36
higher-ranked lifetime message
compiler-errors Dec 18, 2022
82cf6f2
UPDATE - migrate base.rs to new diagnostics infrastructure
JhonnyBillM Nov 17, 2022
78796ba
ADD - fixme in type_names.rs until we are able to translate InterpError
JhonnyBillM Nov 6, 2022
d41112a
UPDATE - migrate constant.rs to new diagnostics infrastructure
JhonnyBillM Nov 6, 2022
e26366a
[WIP] UPDATE - migrate intrinsic.rs to new diagnostic infrastructure
JhonnyBillM Nov 13, 2022
d1030fa
UPDATE - migrate fn simd_simple_float_intrinsic error messages
JhonnyBillM Nov 17, 2022
2774446
ADD - create and emit Bug support for Diagnostics
JhonnyBillM Nov 23, 2022
29d8c87
DELETE - fn span_invalid_monomorphization_error and localize intrinsi…
JhonnyBillM Nov 27, 2022
4d63d7d
UPDATE - migrate outstanding diagnostic in link.rs
JhonnyBillM Nov 27, 2022
8360a40
Migrate named_anon_conflict.rs
IntQuant Sep 8, 2022
2118ff4
Migrate placeholder_error.rs
IntQuant Sep 10, 2022
3935a81
Migrate trait_impl_difference.rs
IntQuant Sep 13, 2022
0634b01
Partial work on static_impl_trait.rs
IntQuant Sep 16, 2022
57fdd19
Rebase and fix
IntQuant Sep 22, 2022
6c19c08
More descriptive names for ActualImplExplNotes variants
IntQuant Sep 25, 2022
71d24da
Split into several messages
IntQuant Sep 29, 2022
eb7ce17
Use eager translation
IntQuant Oct 14, 2022
40b2218
Rename subdiagnostic fields that do not need to be unique now
IntQuant Oct 15, 2022
19b8579
Address changes of pr 103345
IntQuant Oct 24, 2022
7ecd064
Split infer_explicit_lifetime_required into several diags
IntQuant Nov 3, 2022
62f9962
Made ty_or_sig and trait_path use their actual types instead of String
IntQuant Nov 3, 2022
a861737
Fix nits
IntQuant Nov 3, 2022
dda3eba
Fix broken rebase
IntQuant Nov 7, 2022
2a8b17d
Fix formatting
IntQuant Nov 29, 2022
0c50e1f
eager is the default now
IntQuant Dec 28, 2022
ce6b717
Detect closures assigned to binding in block
estebank Jan 5, 2023
43bec83
docs: make `HashSet::retain` doctest more clear
Ezrashaw Jan 7, 2023
a7ac923
rustdoc: remove no-op mobile CSS `.content { margin-left: 0 }`
notriddle Jan 7, 2023
a139fd0
Change to immutable borrow when cloning element of RepeatN
Folyd Jan 7, 2023
405e48f
Rollup merge of #101936 - IntQuant:issue-100717-infer-4, r=compiler-e…
matthiaskrgr Jan 7, 2023
08653c8
Rollup merge of #104081 - joshlf:patch-6, r=dtolnay
matthiaskrgr Jan 7, 2023
771cfa5
Rollup merge of #104543 - JhonnyBillM:migrate-codegen-ssa-to-diagnost…
matthiaskrgr Jan 7, 2023
d7519c3
Rollup merge of #105128 - Sp00ph:vec_vec_deque_conversion, r=dtolnay
matthiaskrgr Jan 7, 2023
3d18c4d
Rollup merge of #105517 - pcc:process-panic-after-fork, r=davidtwco
matthiaskrgr Jan 7, 2023
0c8d11b
Rollup merge of #105859 - compiler-errors:hr-lifetime-add, r=davidtwco
matthiaskrgr Jan 7, 2023
1e6710d
Rollup merge of #106509 - estebank:closure-in-block, r=davidtwco
matthiaskrgr Jan 7, 2023
ee1992c
Rollup merge of #106553 - Ezrashaw:fix-hashset-doctest, r=JohnTitor
matthiaskrgr Jan 7, 2023
98ad442
Rollup merge of #106556 - notriddle:notriddle/margin-left-content-mob…
matthiaskrgr Jan 7, 2023
3076f26
Rollup merge of #106564 - Folyd:feat-repeatn, r=scottmcm
matthiaskrgr Jan 7, 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
Prev Previous commit
Next Next commit
UPDATE - migrate fn simd_simple_float_intrinsic error messages
  • Loading branch information
JhonnyBillM committed Dec 28, 2022
commit d1030fab229d25d3ca14b1aaa2fc8e5a6ec932a8
2 changes: 2 additions & 0 deletions Cargo.lock
Original file line number Diff line number Diff line change
Expand Up @@ -3636,6 +3636,7 @@ dependencies = [
"rustc_span",
"rustc_symbol_mangling",
"rustc_target",
"rustc_type_ir",
"serde_json",
"smallvec",
"snap",
Expand Down Expand Up @@ -3770,6 +3771,7 @@ dependencies = [
"rustc_serialize",
"rustc_span",
"rustc_target",
"rustc_type_ir",
"serde",
"serde_json",
"termcolor",
Expand Down
41 changes: 13 additions & 28 deletions compiler/rustc_codegen_llvm/src/intrinsic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1165,42 +1165,24 @@ fn generic_simd_intrinsic<'ll, 'tcx>(
span: Span,
args: &[OperandRef<'tcx, &'ll Value>],
) -> Result<&'ll Value, ()> {
#[allow(unused_macro_rules)]
macro_rules! emit_error {
($msg: tt) => {
emit_error!($msg, )
};
($msg: tt, $($fmt: tt)*) => {
span_invalid_monomorphization_error(
bx.sess(), span,
&format!(concat!("invalid monomorphization of `{}` intrinsic: ", $msg),
name, $($fmt)*));
}
}
macro_rules! return_error {
($($fmt: tt)*) => {
{
emit_error!($($fmt)*);
return Err(());
}
}
}

let (elem_ty_str, elem_ty) = if let ty::Float(f) = in_elem.kind() {
let elem_ty = bx.cx.type_float_from_ty(*f);
match f.bit_width() {
32 => ("f32", elem_ty),
64 => ("f64", elem_ty),
_ => {
return_error!(
"unsupported element type `{}` of floating-point vector `{}`",
f.name_str(),
in_ty
);
bx.sess().emit_err(InvalidMonomorphization::FloatingPointVector {
span,
name,
f_ty: *f,
in_ty,
});
return Err(());
}
}
} else {
return_error!("`{}` is not a floating-point type", in_ty);
bx.sess().emit_err(InvalidMonomorphization::FloatingPointType { span, name, in_ty });
return Err(());
};

let vec_ty = bx.type_vector(elem_ty, in_len);
Expand All @@ -1222,7 +1204,10 @@ fn generic_simd_intrinsic<'ll, 'tcx>(
sym::simd_fsqrt => ("sqrt", bx.type_func(&[vec_ty], vec_ty)),
sym::simd_round => ("round", bx.type_func(&[vec_ty], vec_ty)),
sym::simd_trunc => ("trunc", bx.type_func(&[vec_ty], vec_ty)),
_ => return_error!("unrecognized intrinsic `{}`", name),
_ => {
bx.sess().emit_err(InvalidMonomorphization::UnrecognizedIntrinsic { span, name });
return Err(());
}
};
let llvm_name = &format!("llvm.{0}.v{1}{2}", intr_name, in_len, elem_ty_str);
let f = bx.declare_cfn(llvm_name, llvm::UnnamedAddr::No, fn_ty);
Expand Down
1 change: 1 addition & 0 deletions compiler/rustc_codegen_ssa/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ rustc_arena = { path = "../rustc_arena" }
rustc_ast = { path = "../rustc_ast" }
rustc_span = { path = "../rustc_span" }
rustc_middle = { path = "../rustc_middle" }
rustc_type_ir = { path = "../rustc_type_ir" }
rustc_attr = { path = "../rustc_attr" }
rustc_symbol_mangling = { path = "../rustc_symbol_mangling" }
rustc_data_structures = { path = "../rustc_data_structures" }
Expand Down
25 changes: 25 additions & 0 deletions compiler/rustc_codegen_ssa/src/errors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ use rustc_errors::{
use rustc_macros::Diagnostic;
use rustc_middle::ty::Ty;
use rustc_span::{Span, Symbol};
use rustc_type_ir::FloatTy;
use std::borrow::Cow;
use std::io::Error;
use std::path::{Path, PathBuf};
Expand Down Expand Up @@ -631,4 +632,28 @@ pub enum InvalidMonomorphization<'tcx> {
span: Span,
ty: Ty<'tcx>,
},

#[diag(codegen_ssa_invalid_monomorphization_floating_point_vector, code = "E0511")]
FloatingPointVector {
#[primary_span]
span: Span,
name: Symbol,
f_ty: FloatTy,
in_ty: Ty<'tcx>,
},

#[diag(codegen_ssa_invalid_monomorphization_floating_point_type, code = "E0511")]
FloatingPointType {
#[primary_span]
span: Span,
name: Symbol,
in_ty: Ty<'tcx>,
},

#[diag(codegen_ssa_invalid_monomorphization_unrecognized_intrinsic, code = "E0511")]
UnrecognizedIntrinsic {
#[primary_span]
span: Span,
name: Symbol,
},
}
6 changes: 6 additions & 0 deletions compiler/rustc_error_messages/locales/en-US/codegen_ssa.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -219,3 +219,9 @@ codegen_ssa_invalid_monomorphization_basic_integer_type = invalid monomorphizati
codegen_ssa_invalid_monomorphization_basic_float_type = invalid monomorphization of `{$name}` intrinsic: expected basic float type, found `{$ty}`

codegen_ssa_invalid_monomorphization_float_to_int_unchecked = invalid monomorphization of `float_to_int_unchecked` intrinsic: expected basic float type, found `{$ty}`

codegen_ssa_invalid_monomorphization_floating_point_vector = invalid monomorphization of `{$name}` intrinsic: unsupported element type `{$f_ty}` of floating-point vector `{$in_ty}`

codegen_ssa_invalid_monomorphization_floating_point_type = invalid monomorphization of `{$name}` intrinsic: `{$in_ty}` is not a floating-point type

codegen_ssa_invalid_monomorphization_unrecognized_intrinsic = invalid monomorphization of `{$name}` intrinsic: unrecognized intrinsic `{$name}`
1 change: 1 addition & 0 deletions compiler/rustc_errors/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ rustc_data_structures = { path = "../rustc_data_structures" }
rustc_target = { path = "../rustc_target" }
rustc_hir = { path = "../rustc_hir" }
rustc_lint_defs = { path = "../rustc_lint_defs" }
rustc_type_ir = { path = "../rustc_type_ir" }
unicode-width = "0.1.4"
termcolor = "1.0"
annotate-snippets = "0.9"
Expand Down
7 changes: 7 additions & 0 deletions compiler/rustc_errors/src/diagnostic_impls.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ use rustc_span::edition::Edition;
use rustc_span::symbol::{Ident, MacroRulesNormalizedIdent, Symbol};
use rustc_target::abi::TargetDataLayoutErrors;
use rustc_target::spec::{PanicStrategy, SplitDebuginfo, StackProtector, TargetTriple};
use rustc_type_ir as type_ir;
use std::borrow::Cow;
use std::fmt;
use std::num::ParseIntError;
Expand Down Expand Up @@ -170,6 +171,12 @@ impl IntoDiagnosticArg for ast::token::TokenKind {
}
}

impl IntoDiagnosticArg for type_ir::FloatTy {
fn into_diagnostic_arg(self) -> DiagnosticArgValue<'static> {
DiagnosticArgValue::Str(Cow::Borrowed(self.name_str()))
}
}

impl IntoDiagnosticArg for Level {
fn into_diagnostic_arg(self) -> DiagnosticArgValue<'static> {
DiagnosticArgValue::Str(Cow::Borrowed(match self {
Expand Down