Skip to content

Commit

Permalink
clean up leftover FIXME
Browse files Browse the repository at this point in the history
  • Loading branch information
fee1-dead committed Dec 10, 2023
1 parent d464dd0 commit de8f4ac
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 30 deletions.
6 changes: 4 additions & 2 deletions compiler/rustc_middle/src/ty/generics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -326,6 +326,8 @@ impl<'tcx> Generics {
own_params.start = 1;
}

let verbose = tcx.sess.verbose();

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

Expand Down
29 changes: 1 addition & 28 deletions compiler/rustc_middle/src/ty/print/pretty.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ use rustc_hir::LangItem;
use rustc_session::config::TrimmedDefPaths;
use rustc_session::cstore::{ExternCrate, ExternCrateSource};
use rustc_session::Limit;
use rustc_span::sym;
use rustc_span::symbol::{kw, Ident, Symbol};
use rustc_span::FileNameDisplayPreference;
use rustc_target::abi::Size;
Expand Down Expand Up @@ -2034,37 +2033,11 @@ impl<'tcx> Printer<'tcx> for FmtPrinter<'_, 'tcx> {
) -> Result<(), PrintError> {
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 self.in_value {
write!(self, "::")?;
}
self.generic_delimiters(|cx| cx.comma_sep(args.into_iter()))
self.generic_delimiters(|cx| cx.comma_sep(args.iter().copied()))
} else {
Ok(())
}
Expand Down

0 comments on commit de8f4ac

Please sign in to comment.