1
Fork 0

clean up leftover FIXME

This commit is contained in:
Deadbeef 2023-12-10 10:53:57 +00:00
parent d464dd07ed
commit de8f4acbf7
2 changed files with 5 additions and 30 deletions

View file

@ -326,6 +326,8 @@ impl<'tcx> Generics {
own_params.start = 1; own_params.start = 1;
} }
let verbose = tcx.sess.verbose();
// Filter the default arguments. // Filter the default arguments.
// //
// This currently uses structural equality instead // This currently uses structural equality instead
@ -340,8 +342,8 @@ impl<'tcx> Generics {
param.default_value(tcx).is_some_and(|default| { param.default_value(tcx).is_some_and(|default| {
default.instantiate(tcx, args) == args[param.index as usize] default.instantiate(tcx, args) == args[param.index as usize]
}) })
// filter out trailing effect params // filter out trailing effect params, if we're not in `-Zverbose`.
|| matches!(param.kind, GenericParamDefKind::Const { is_host_effect: true, .. }) || (!verbose && matches!(param.kind, GenericParamDefKind::Const { is_host_effect: true, .. }))
}) })
.count(); .count();

View file

@ -19,7 +19,6 @@ use rustc_hir::LangItem;
use rustc_session::config::TrimmedDefPaths; use rustc_session::config::TrimmedDefPaths;
use rustc_session::cstore::{ExternCrate, ExternCrateSource}; use rustc_session::cstore::{ExternCrate, ExternCrateSource};
use rustc_session::Limit; use rustc_session::Limit;
use rustc_span::sym;
use rustc_span::symbol::{kw, Ident, Symbol}; use rustc_span::symbol::{kw, Ident, Symbol};
use rustc_span::FileNameDisplayPreference; use rustc_span::FileNameDisplayPreference;
use rustc_target::abi::Size; use rustc_target::abi::Size;
@ -2034,37 +2033,11 @@ impl<'tcx> Printer<'tcx> for FmtPrinter<'_, 'tcx> {
) -> Result<(), PrintError> { ) -> Result<(), PrintError> {
print_prefix(self)?; print_prefix(self)?;
let tcx = self.tcx;
let args = args.iter().copied();
let args: Vec<_> = if !tcx.sess.verbose() {
// skip host param as those are printed as `~const`
args.filter(|arg| match arg.unpack() {
// FIXME(effects) there should be a better way than just matching the name
GenericArgKind::Const(c)
if tcx.features().effects
&& matches!(
c.kind(),
ty::ConstKind::Param(ty::ParamConst { name: sym::host, .. })
) =>
{
false
}
_ => true,
})
.collect()
} else {
// If -Zverbose is passed, we should print the host parameter instead
// of eating it.
args.collect()
};
if !args.is_empty() { if !args.is_empty() {
if self.in_value { if self.in_value {
write!(self, "::")?; write!(self, "::")?;
} }
self.generic_delimiters(|cx| cx.comma_sep(args.into_iter())) self.generic_delimiters(|cx| cx.comma_sep(args.iter().copied()))
} else { } else {
Ok(()) Ok(())
} }