fix tooling

This commit is contained in:
lcnr 2025-11-25 11:34:27 +01:00
parent feb13036ef
commit 8e08af1769
11 changed files with 5 additions and 50 deletions

View file

@ -1841,7 +1841,6 @@ pub(crate) fn clean_ty<'tcx>(ty: &hir::Ty<'tcx>, cx: &mut DocContext<'tcx>) -> T
// Rustdoc handles `TyKind::Err`s by turning them into `Type::Infer`s.
TyKind::Infer(())
| TyKind::Err(_)
| TyKind::Typeof(..)
| TyKind::InferDelegation(..)
| TyKind::TraitAscription(_) => Infer,
}

View file

@ -830,7 +830,6 @@ impl TyCoercionStability {
TyKind::OpaqueDef(..)
| TyKind::TraitAscription(..)
| TyKind::Infer(())
| TyKind::Typeof(..)
| TyKind::TraitObject(..)
| TyKind::InferDelegation(..)
| TyKind::Err(_) => Self::Reborrow,
@ -911,7 +910,7 @@ fn ty_contains_infer(ty: &hir::Ty<'_>) -> bool {
}
fn visit_ty(&mut self, ty: &hir::Ty<'_, AmbigArg>) {
if self.0 || matches!(ty.kind, TyKind::OpaqueDef(..) | TyKind::Typeof(_) | TyKind::Err(_)) {
if self.0 || matches!(ty.kind, TyKind::OpaqueDef(..) | TyKind::Err(_)) {
self.0 = true;
} else {
walk_ty(self, ty);

View file

@ -875,7 +875,6 @@ pub fn eq_ty(l: &Ty, r: &Ty) -> bool {
(Path(lq, lp), Path(rq, rp)) => both(lq.as_deref(), rq.as_deref(), eq_qself) && eq_path(lp, rp),
(TraitObject(lg, ls), TraitObject(rg, rs)) => ls == rs && over(lg, rg, eq_generic_bound),
(ImplTrait(_, lg), ImplTrait(_, rg)) => over(lg, rg, eq_generic_bound),
(Typeof(l), Typeof(r)) => eq_expr(&l.value, &r.value),
(MacCall(l), MacCall(r)) => eq_mac_call(l, r),
_ => false,
}

View file

@ -524,11 +524,10 @@ fn ast_ty_search_pat(ty: &ast::Ty) -> (Pat, Pat) {
TyKind::ImplicitSelf
// experimental
|TyKind::Pat(..)
| TyKind::Pat(..)
// unused
| TyKind::CVarArgs
| TyKind::Typeof(_)
// placeholder
| TyKind::Dummy

View file

@ -1309,9 +1309,6 @@ impl<'a, 'tcx> SpanlessHash<'a, 'tcx> {
TyKind::TraitObject(_, lifetime) => {
self.hash_lifetime(lifetime);
},
TyKind::Typeof(anon_const) => {
self.hash_body(anon_const.body);
},
TyKind::UnsafeBinder(binder) => {
self.hash_ty(binder.inner_ty);
},

View file

@ -8,8 +8,7 @@ use crate::comment::{combine_strs_with_missing_comments, contains_comment};
use crate::config::lists::*;
use crate::config::{IndentStyle, StyleEdition, TypeDensity};
use crate::expr::{
ExprType, RhsAssignKind, format_expr, rewrite_assign_rhs, rewrite_call, rewrite_tuple,
rewrite_unary_prefix,
ExprType, RhsAssignKind, format_expr, rewrite_assign_rhs, rewrite_tuple, rewrite_unary_prefix,
};
use crate::lists::{
ListFormatting, ListItem, Separator, definitive_tactic, itemize_list, write_list,
@ -1031,13 +1030,6 @@ impl Rewrite for ast::Ty {
}
ast::TyKind::CVarArgs => Ok("...".to_owned()),
ast::TyKind::Dummy | ast::TyKind::Err(_) => Ok(context.snippet(self.span).to_owned()),
ast::TyKind::Typeof(ref anon_const) => rewrite_call(
context,
"typeof",
&[anon_const.value.clone()],
self.span,
shape,
),
ast::TyKind::Pat(ref ty, ref pat) => {
let ty = ty.rewrite_result(context, shape)?;
let pat = pat.rewrite_result(context, shape)?;

View file

@ -158,9 +158,3 @@ impl<T: [ const] Trait> Foo<T> {
Self(t)
}
}
// #4357
type T = typeof(
1);
impl T for .. {
}

View file

@ -167,7 +167,3 @@ impl<T: [const] Trait> Foo<T> {
Self(t)
}
}
// #4357
type T = typeof(1);
impl T for .. {}

View file

@ -1,5 +0,0 @@
// https://github.com/rust-lang/rust/issues/102986
struct Struct {
y: (typeof("hey"),),
//~^ ERROR `typeof` is a reserved keyword but unimplemented
}

View file

@ -1,15 +0,0 @@
error[E0516]: `typeof` is a reserved keyword but unimplemented
--> $DIR/ice-typeof-102986.rs:3:9
|
LL | y: (typeof("hey"),),
| ^^^^^^^^^^^^^ reserved keyword
|
help: consider replacing `typeof(...)` with an actual type
|
LL - y: (typeof("hey"),),
LL + y: (&str,),
|
error: aborting due to 1 previous error
For more information about this error, try `rustc --explain E0516`.

View file

@ -1,8 +1,8 @@
error[E0516]: `typeof` is a reserved keyword but unimplemented
--> $DIR/E0516.rs:2:19
--> $DIR/E0516.rs:2:12
|
LL | let x: typeof(92) = 92;
| ^^
| ^^^^^^^^^^
|
= note: consider replacing `typeof(...)` with an actual type