Skip to content
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

Rollup of 8 pull requests #129591

Closed
wants to merge 34 commits into from
Closed
Show file tree
Hide file tree
Changes from 2 commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
a97b41f
Use subtyping for UnsafeFnPointer coercion, too
compiler-errors Aug 20, 2024
147bb17
Rework how we emit errors for unresolved object lifetimes
compiler-errors Aug 24, 2024
e7f11b6
Removes dead code from the compiler
mu001999 Aug 8, 2024
c29e328
gitignore: ignore ICE reports regardless of directory
GrigorenkoPV Aug 24, 2024
51cd76b
warn on suspicious elision resolutions
GrigorenkoPV Aug 15, 2024
40d8379
elided_named_lifetimes: Lint stub
GrigorenkoPV Aug 15, 2024
19d11db
elided_named_lifetimes: LintDiagnostic
GrigorenkoPV Aug 16, 2024
f735c7a
elided_named_lifetimes: fix (hack) the ICE for non-static case
GrigorenkoPV Aug 16, 2024
4328e8b
elided_named_lifetimes: try to work around the issues with `NodeId`s …
GrigorenkoPV Aug 17, 2024
7a73ed4
elided_named_lifetimes: allow elided `'static` in const/static type a…
GrigorenkoPV Aug 17, 2024
3dac6f9
elided_named_lifetimes: bump to `Warn` & fix libs
GrigorenkoPV Aug 17, 2024
b977633
elided_named_lifetimes: improve the message a bit
GrigorenkoPV Aug 18, 2024
a57ebc3
Rename `allow_elided_static` to `warn_elided_static` for clarity
GrigorenkoPV Aug 18, 2024
bec8f58
elided_named_lifetimes: allow elided `'static` in assoc consts' types
GrigorenkoPV Aug 18, 2024
2822aff
bless tests
GrigorenkoPV Aug 21, 2024
0b37f75
Fix ICE & bless the remaining tests
GrigorenkoPV Aug 21, 2024
3175fac
Bless clippy tests
GrigorenkoPV Aug 22, 2024
7e74a5e
elided_named_lifetimes: add tests
GrigorenkoPV Aug 23, 2024
610f1a5
elided_named_lifetimes: add docs
GrigorenkoPV Aug 23, 2024
bacbf46
`TyCtxt::item_name` exists
GrigorenkoPV Aug 24, 2024
f0c9cec
Move the override flag for `elided_named_lifetimes`
GrigorenkoPV Aug 24, 2024
3a7d0ab
elided_named_lifetimes: get rid of `crate_node_id`
GrigorenkoPV Aug 24, 2024
ba24121
tweak rustc_allow_const_fn_unstable hint, and add back test for stabl…
RalfJung Aug 25, 2024
8750e24
Fixing span manipulation and indentation of the suggestion introduced…
surechen Aug 22, 2024
48f43fa
Avoid taking reference of &TyKind
compiler-errors Aug 25, 2024
ecd2d11
Remove redundant flags that can be inferred from the HIR
compiler-errors Aug 24, 2024
4e1a70f
Rollup merge of #129207 - GrigorenkoPV:elided-is-named, r=cjgillot
matthiaskrgr Aug 25, 2024
e7aca53
Rollup merge of #129288 - compiler-errors:unsafe-fn-coercion, r=lcnr
matthiaskrgr Aug 25, 2024
614ea5a
Rollup merge of #129405 - surechen:fix_span_x, r=cjgillot
matthiaskrgr Aug 25, 2024
1fe4b67
Rollup merge of #129518 - GrigorenkoPV:gitignore-library-ice, r=tgross35
matthiaskrgr Aug 25, 2024
8a1fff1
Rollup merge of #129519 - compiler-errors:lowering-flags, r=fmease
matthiaskrgr Aug 25, 2024
65baca7
Rollup merge of #129544 - mu001999-contrib:dead-code/clean, r=compile…
matthiaskrgr Aug 25, 2024
b8e8a10
Rollup merge of #129553 - RalfJung:const-stability, r=compiler-errors
matthiaskrgr Aug 25, 2024
1bac9b2
Rollup merge of #129590 - compiler-errors:ref-tykind, r=fmease
matthiaskrgr Aug 25, 2024
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
2 changes: 1 addition & 1 deletion compiler/rustc_borrowck/src/borrowck_errors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -290,7 +290,7 @@ impl<'infcx, 'tcx> crate::MirBorrowckCtxt<'_, '_, 'infcx, 'tcx> {
ty: Ty<'_>,
is_index: Option<bool>,
) -> Diag<'infcx> {
let type_name = match (&ty.kind(), is_index) {
let type_name = match (ty.kind(), is_index) {
(&ty::Array(_, _), Some(true)) | (&ty::Array(_, _), None) => "array",
(&ty::Slice(_), _) => "slice",
_ => span_bug!(move_from_span, "this path should not cause illegal move"),
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_borrowck/src/places_conflict.rs
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ fn place_components_conflict<'tcx>(

let base_ty = base.ty(body, tcx).ty;

match (elem, &base_ty.kind(), access) {
match (elem, base_ty.kind(), access) {
(_, _, Shallow(Some(ArtificialField::ArrayLength)))
| (_, _, Shallow(Some(ArtificialField::FakeBorrow))) => {
// The array length is like additional fields on the
Expand Down
6 changes: 3 additions & 3 deletions compiler/rustc_const_eval/src/interpret/cast.rs
Original file line number Diff line number Diff line change
Expand Up @@ -388,7 +388,7 @@ impl<'tcx, M: Machine<'tcx>> InterpCx<'tcx, M> {
let (src_pointee_ty, dest_pointee_ty) =
self.tcx.struct_lockstep_tails_for_codegen(source_ty, cast_ty, self.param_env);

match (&src_pointee_ty.kind(), &dest_pointee_ty.kind()) {
match (src_pointee_ty.kind(), dest_pointee_ty.kind()) {
(&ty::Array(_, length), &ty::Slice(_)) => {
let ptr = self.read_pointer(src)?;
let val = Immediate::new_slice(
Expand Down Expand Up @@ -478,9 +478,9 @@ impl<'tcx, M: Machine<'tcx>> InterpCx<'tcx, M> {
dest: &PlaceTy<'tcx, M::Provenance>,
) -> InterpResult<'tcx> {
trace!("Unsizing {:?} of type {} into {}", *src, src.layout.ty, cast_ty.ty);
match (&src.layout.ty.kind(), &cast_ty.ty.kind()) {
match (src.layout.ty.kind(), cast_ty.ty.kind()) {
(&ty::Ref(_, s, _), &ty::Ref(_, c, _) | &ty::RawPtr(c, _))
| (&ty::RawPtr(s, _), &ty::RawPtr(c, _)) => self.unsize_into_ptr(src, dest, *s, *c),
| (&ty::RawPtr(s, _), &ty::RawPtr(c, _)) => self.unsize_into_ptr(src, dest, s, c),
(&ty::Adt(def_a, _), &ty::Adt(def_b, _)) => {
assert_eq!(def_a, def_b); // implies same number of fields

Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_hir_analysis/src/hir_ty_lowering/errors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -608,7 +608,7 @@ impl<'tcx> dyn HirTyLowerer<'tcx> + '_ {

let mut bound_span_label = |self_ty: Ty<'_>, obligation: &str, quiet: &str| {
let msg = format!("`{}`", if obligation.len() > 50 { quiet } else { obligation });
match &self_ty.kind() {
match self_ty.kind() {
// Point at the type that couldn't satisfy the bound.
ty::Adt(def, _) => {
bound_spans.get_mut_or_insert_default(tcx.def_span(def.did())).push(msg)
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_hir_analysis/src/hir_ty_lowering/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1056,7 +1056,7 @@ impl<'tcx> dyn HirTyLowerer<'tcx> + '_ {

// Find the type of the associated item, and the trait where the associated
// item is declared.
let bound = match (&qself_ty.kind(), qself_res) {
let bound = match (qself_ty.kind(), qself_res) {
(_, Res::SelfTyAlias { alias_to: impl_def_id, is_trait_impl: true, .. }) => {
// `Self` in an impl of a trait -- we have a concrete self type and a
// trait reference.
Expand Down
4 changes: 2 additions & 2 deletions compiler/rustc_hir_typeck/src/fn_ctxt/suggestions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2975,7 +2975,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
let mut suffix_suggestion = sugg.clone();
suffix_suggestion.push((
if matches!(
(&expected_ty.kind(), &checked_ty.kind()),
(expected_ty.kind(), checked_ty.kind()),
(ty::Int(_) | ty::Uint(_), ty::Float(_))
) {
// Remove fractional part from literal, for example `42.0f32` into `42`
Expand Down Expand Up @@ -3077,7 +3077,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
err.multipart_suggestion_verbose(msg, suggestion, Applicability::MachineApplicable);
};

match (&expected_ty.kind(), &checked_ty.kind()) {
match (expected_ty.kind(), checked_ty.kind()) {
(ty::Int(exp), ty::Int(found)) => {
let (f2e_is_fallible, e2f_is_fallible) = match (exp.bit_width(), found.bit_width())
{
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_hir_typeck/src/method/suggest.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1012,7 +1012,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
};
let mut bound_span_label = |self_ty: Ty<'_>, obligation: &str, quiet: &str| {
let msg = format!("`{}`", if obligation.len() > 50 { quiet } else { obligation });
match &self_ty.kind() {
match self_ty.kind() {
// Point at the type that couldn't satisfy the bound.
ty::Adt(def, _) => {
bound_spans.get_mut_or_insert_default(tcx.def_span(def.did())).push(msg)
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_hir_typeck/src/pat.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1336,7 +1336,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
// More generally, the expected type wants a tuple variant with one field of an
// N-arity-tuple, e.g., `V_i((p_0, .., p_N))`. Meanwhile, the user supplied a pattern
// with the subpatterns directly in the tuple variant pattern, e.g., `V_i(p_0, .., p_N)`.
let missing_parentheses = match (&expected.kind(), fields, had_err) {
let missing_parentheses = match (expected.kind(), fields, had_err) {
// #67037: only do this if we could successfully type-check the expected type against
// the tuple struct pattern. Otherwise the args could get out of range on e.g.,
// `let P() = U;` where `P != U` with `struct P<T>(T);`.
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_middle/src/ty/layout.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1104,7 +1104,7 @@ where
}

fn is_never(this: TyAndLayout<'tcx>) -> bool {
this.ty.kind() == &ty::Never
matches!(this.ty.kind(), ty::Never)
}

fn is_tuple(this: TyAndLayout<'tcx>) -> bool {
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_middle/src/ty/util.rs
Original file line number Diff line number Diff line change
Expand Up @@ -296,7 +296,7 @@ impl<'tcx> TyCtxt<'tcx> {
) -> (Ty<'tcx>, Ty<'tcx>) {
let (mut a, mut b) = (source, target);
loop {
match (&a.kind(), &b.kind()) {
match (a.kind(), b.kind()) {
(&ty::Adt(a_def, a_args), &ty::Adt(b_def, b_args))
if a_def == b_def && a_def.is_struct() =>
{
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_mir_build/src/build/expr/as_constant.rs
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ fn lit_to_mir_constant<'tcx>(
Ok(ConstValue::Scalar(Scalar::from_uint(result, width)))
};

let value = match (lit, &ty.kind()) {
let value = match (lit, ty.kind()) {
(ast::LitKind::Str(s, _), ty::Ref(_, inner_ty, _)) if inner_ty.is_str() => {
let s = s.as_str();
let allocation = Allocation::from_bytes_byte_aligned_immutable(s.as_bytes());
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_mir_build/src/thir/constant.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ pub(crate) fn lit_to_const<'tcx>(
.unwrap_or_else(|| bug!("expected to create ScalarInt from uint {:?}", result)))
};

let valtree = match (lit, &ty.kind()) {
let valtree = match (lit, ty.kind()) {
(ast::LitKind::Str(s, _), ty::Ref(_, inner_ty, _)) if inner_ty.is_str() => {
let str_bytes = s.as_str().as_bytes();
ty::ValTree::from_raw_bytes(tcx, str_bytes)
Expand Down
4 changes: 2 additions & 2 deletions compiler/rustc_monomorphize/src/collector.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1035,9 +1035,9 @@ fn find_vtable_types_for_unsizing<'tcx>(
}
};

match (&source_ty.kind(), &target_ty.kind()) {
match (source_ty.kind(), target_ty.kind()) {
(&ty::Ref(_, a, _), &ty::Ref(_, b, _) | &ty::RawPtr(b, _))
| (&ty::RawPtr(a, _), &ty::RawPtr(b, _)) => ptr_vtable(*a, *b),
| (&ty::RawPtr(a, _), &ty::RawPtr(b, _)) => ptr_vtable(a, b),
(&ty::Adt(def_a, _), &ty::Adt(def_b, _)) if def_a.is_box() && def_b.is_box() => {
ptr_vtable(source_ty.boxed_ty(), target_ty.boxed_ty())
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -382,7 +382,7 @@ impl<'tcx> TypeErrCtxt<'_, 'tcx> {
if !expected_inner.is_fn() || !found_inner.is_fn() {
return;
}
match (&expected_inner.kind(), &found_inner.kind()) {
match (expected_inner.kind(), found_inner.kind()) {
(ty::FnPtr(sig_tys, hdr), ty::FnDef(did, args)) => {
let sig = sig_tys.with(*hdr);
let expected_sig = &(self.normalize_fn_sig)(sig);
Expand Down
Loading