Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 8424197

Browse files
committed
rename needs_subst to has_param
1 parent f04b8fe commit 8424197

File tree

18 files changed

+28
-28
lines changed

18 files changed

+28
-28
lines changed

‎compiler/rustc_codegen_llvm/src/debuginfo/mod.rs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -515,7 +515,7 @@ impl<'ll, 'tcx> DebugInfoMethods<'tcx> for CodegenCx<'ll, 'tcx> {
515515
ty::Adt(def, ..) if !def.is_box() => {
516516
// Again, only create type information if full debuginfo is enabled
517517
if cx.sess().opts.debuginfo == DebugInfo::Full
518-
&& !impl_self_ty.needs_subst()
518+
&& !impl_self_ty.has_param()
519519
{
520520
Some(type_di_node(cx, impl_self_ty))
521521
} else {

‎compiler/rustc_const_eval/src/interpret/util.rs‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ where
1414
T: TypeVisitable<TyCtxt<'tcx>>,
1515
{
1616
debug!("ensure_monomorphic_enough: ty={:?}", ty);
17-
if !ty.needs_subst() {
17+
if !ty.has_param() {
1818
return Ok(());
1919
}
2020

@@ -27,7 +27,7 @@ where
2727
type BreakTy = FoundParam;
2828

2929
fn visit_ty(&mut self, ty: Ty<'tcx>) -> ControlFlow<Self::BreakTy> {
30-
if !ty.needs_subst() {
30+
if !ty.has_param() {
3131
return ControlFlow::Continue(());
3232
}
3333

@@ -46,7 +46,7 @@ where
4646
// are used and require substitution.
4747
// Just in case there are closures or generators within this subst,
4848
// recurse.
49-
if unused_params.is_used(index) && subst.needs_subst() {
49+
if unused_params.is_used(index) && subst.has_param() {
5050
return subst.visit_with(self);
5151
}
5252
}

‎compiler/rustc_hir_analysis/src/astconv/mod.rs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3039,7 +3039,7 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
30393039
// the anon const, which is empty. This is why the
30403040
// `AlwaysApplicable` impl needs a `T: ?Sized` bound for
30413041
// this to compile if we were to normalize here.
3042-
if forbid_generic && ty.needs_subst() {
3042+
if forbid_generic && ty.has_param() {
30433043
let mut err = tcx.sess.struct_span_err(
30443044
path.span,
30453045
"generic `Self` types are currently not permitted in anonymous constants",

‎compiler/rustc_hir_analysis/src/check/wfcheck.rs‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1292,7 +1292,7 @@ fn check_where_clauses<'tcx>(wfcx: &WfCheckingCtxt<'_, 'tcx>, span: Span, def_id
12921292
// Ignore dependent defaults -- that is, where the default of one type
12931293
// parameter includes another (e.g., `<T, U = T>`). In those cases, we can't
12941294
// be sure if it will error or not as user might always specify the other.
1295-
if !ty.needs_subst() {
1295+
if !ty.has_param() {
12961296
wfcx.register_wf_obligation(
12971297
tcx.def_span(param.def_id),
12981298
Some(WellFormedLoc::Ty(param.def_id.expect_local())),
@@ -1308,7 +1308,7 @@ fn check_where_clauses<'tcx>(wfcx: &WfCheckingCtxt<'_, 'tcx>, span: Span, def_id
13081308
// for `struct Foo<const N: usize, const M: usize = { 1 - 2 }>`
13091309
// we should eagerly error.
13101310
let default_ct = tcx.const_param_default(param.def_id).subst_identity();
1311-
if !default_ct.needs_subst() {
1311+
if !default_ct.has_param() {
13121312
wfcx.register_wf_obligation(
13131313
tcx.def_span(param.def_id),
13141314
None,
@@ -1342,7 +1342,7 @@ fn check_where_clauses<'tcx>(wfcx: &WfCheckingCtxt<'_, 'tcx>, span: Span, def_id
13421342
if is_our_default(param) {
13431343
let default_ty = tcx.type_of(param.def_id).subst_identity();
13441344
// ... and it's not a dependent default, ...
1345-
if !default_ty.needs_subst() {
1345+
if !default_ty.has_param() {
13461346
// ... then substitute it with the default.
13471347
return default_ty.into();
13481348
}
@@ -1355,7 +1355,7 @@ fn check_where_clauses<'tcx>(wfcx: &WfCheckingCtxt<'_, 'tcx>, span: Span, def_id
13551355
if is_our_default(param) {
13561356
let default_ct = tcx.const_param_default(param.def_id).subst_identity();
13571357
// ... and it's not a dependent default, ...
1358-
if !default_ct.needs_subst() {
1358+
if !default_ct.has_param() {
13591359
// ... then substitute it with the default.
13601360
return default_ct.into();
13611361
}

‎compiler/rustc_hir_analysis/src/coherence/orphan.rs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -457,7 +457,7 @@ fn emit_newtype_suggestion_for_raw_ptr(
457457
ptr_ty: &ty::TypeAndMut<'_>,
458458
diag: &mut Diagnostic,
459459
) {
460-
if !self_ty.needs_subst() {
460+
if !self_ty.has_param() {
461461
let mut_key = ptr_ty.mutbl.prefix_str();
462462
let msg_sugg = "consider introducing a new wrapper type".to_owned();
463463
let sugg = vec![

‎compiler/rustc_hir_typeck/src/fn_ctxt/suggestions.rs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1384,7 +1384,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
13841384
}
13851385
let item_ty = self.tcx.type_of(item.def_id).subst_identity();
13861386
// FIXME(compiler-errors): This check is *so* rudimentary
1387-
if item_ty.needs_subst() {
1387+
if item_ty.has_param() {
13881388
return false;
13891389
}
13901390
if self.can_coerce(item_ty, expected_ty) {

‎compiler/rustc_lint/src/enum_intrinsics_non_enums.rs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ declare_lint_pass!(EnumIntrinsicsNonEnums => [ENUM_INTRINSICS_NON_ENUMS]);
4242
/// Returns `true` if we know for sure that the given type is not an enum. Note that for cases where
4343
/// the type is generic, we can't be certain if it will be an enum so we have to assume that it is.
4444
fn is_non_enum(t: Ty<'_>) -> bool {
45-
!t.is_enum() && !t.needs_subst()
45+
!t.is_enum() && !t.has_param()
4646
}
4747

4848
fn enforce_mem_discriminant(

‎compiler/rustc_middle/src/ty/subst.rs‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -761,7 +761,7 @@ impl<'tcx, T: TypeFoldable<TyCtxt<'tcx>>> ty::EarlyBinder<T> {
761761

762762
/// Returns the inner value, but only if it contains no bound vars.
763763
pub fn no_bound_vars(self) -> Option<T> {
764-
if !self.0.needs_subst() { Some(self.0) } else { None }
764+
if !self.0.has_param() { Some(self.0) } else { None }
765765
}
766766
}
767767

@@ -840,7 +840,7 @@ impl<'a, 'tcx> TypeFolder<TyCtxt<'tcx>> for SubstFolder<'a, 'tcx> {
840840
}
841841

842842
fn fold_ty(&mut self, t: Ty<'tcx>) -> Ty<'tcx> {
843-
if !t.needs_subst() {
843+
if !t.has_param() {
844844
return t;
845845
}
846846

‎compiler/rustc_middle/src/ty/visit.rs‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ pub trait TypeVisitableExt<'tcx>: TypeVisitable<TyCtxt<'tcx>> {
7070
}
7171
}
7272
fn has_non_region_param(&self) -> bool {
73-
self.has_type_flags(TypeFlags::NEEDS_SUBST - TypeFlags::HAS_RE_PARAM)
73+
self.has_type_flags(TypeFlags::HAS_PARAM - TypeFlags::HAS_RE_PARAM)
7474
}
7575
fn has_infer_regions(&self) -> bool {
7676
self.has_type_flags(TypeFlags::HAS_RE_INFER)
@@ -94,8 +94,8 @@ pub trait TypeVisitableExt<'tcx>: TypeVisitable<TyCtxt<'tcx>> {
9494
fn has_non_region_placeholders(&self) -> bool {
9595
self.has_type_flags(TypeFlags::HAS_TY_PLACEHOLDER | TypeFlags::HAS_CT_PLACEHOLDER)
9696
}
97-
fn needs_subst(&self) -> bool {
98-
self.has_type_flags(TypeFlags::NEEDS_SUBST)
97+
fn has_param(&self) -> bool {
98+
self.has_type_flags(TypeFlags::HAS_PARAM)
9999
}
100100
/// "Free" regions in this context means that it has any region
101101
/// that is not (a) erased or (b) late-bound.

‎compiler/rustc_mir_transform/src/const_prop.rs‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -428,7 +428,7 @@ impl<'mir, 'tcx> ConstPropagator<'mir, 'tcx> {
428428
/// Returns the value, if any, of evaluating `c`.
429429
fn eval_constant(&mut self, c: &Constant<'tcx>) -> Option<OpTy<'tcx>> {
430430
// FIXME we need to revisit this for #67176
431-
if c.needs_subst() {
431+
if c.has_param() {
432432
return None;
433433
}
434434

@@ -527,7 +527,7 @@ impl<'mir, 'tcx> ConstPropagator<'mir, 'tcx> {
527527
}
528528

529529
// FIXME we need to revisit this for #67176
530-
if rvalue.needs_subst() {
530+
if rvalue.has_param() {
531531
return None;
532532
}
533533
if !rvalue

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /