File tree Expand file tree Collapse file tree 2 files changed +5
-30
lines changed
compiler/rustc_middle/src/ty Expand file tree Collapse file tree 2 files changed +5
-30
lines changed Original file line number Diff line number Diff line change @@ -326,6 +326,8 @@ impl<'tcx> Generics {
326
326
own_params.start = 1;
327
327
}
328
328
329
+ let verbose = tcx.sess.verbose();
330
+
329
331
// Filter the default arguments.
330
332
//
331
333
// This currently uses structural equality instead
@@ -340,8 +342,8 @@ impl<'tcx> Generics {
340
342
param.default_value(tcx).is_some_and(|default| {
341
343
default.instantiate(tcx, args) == args[param.index as usize]
342
344
})
343
- // filter out trailing effect params
344
- || matches!(param.kind, GenericParamDefKind::Const { is_host_effect: true, .. })
345
+ // filter out trailing effect params, if we're not in `-Zverbose`.
346
+ || (!verbose && matches!(param.kind, GenericParamDefKind::Const { is_host_effect: true, .. }) )
345
347
})
346
348
.count();
347
349
Original file line number Diff line number Diff line change @@ -19,7 +19,6 @@ use rustc_hir::LangItem;
19
19
use rustc_session::config::TrimmedDefPaths;
20
20
use rustc_session::cstore::{ExternCrate, ExternCrateSource};
21
21
use rustc_session::Limit;
22
- use rustc_span::sym;
23
22
use rustc_span::symbol::{kw, Ident, Symbol};
24
23
use rustc_span::FileNameDisplayPreference;
25
24
use rustc_target::abi::Size;
@@ -2034,37 +2033,11 @@ impl<'tcx> Printer<'tcx> for FmtPrinter<'_, 'tcx> {
2034
2033
) -> Result<(), PrintError> {
2035
2034
print_prefix(self)?;
2036
2035
2037
- let tcx = self.tcx;
2038
-
2039
- let args = args.iter().copied();
2040
-
2041
- let args: Vec<_> = if !tcx.sess.verbose() {
2042
- // skip host param as those are printed as `~const`
2043
- args.filter(|arg| match arg.unpack() {
2044
- // FIXME(effects) there should be a better way than just matching the name
2045
- GenericArgKind::Const(c)
2046
- if tcx.features().effects
2047
- && matches!(
2048
- c.kind(),
2049
- ty::ConstKind::Param(ty::ParamConst { name: sym::host, .. })
2050
- ) =>
2051
- {
2052
- false
2053
- }
2054
- _ => true,
2055
- })
2056
- .collect()
2057
- } else {
2058
- // If -Zverbose is passed, we should print the host parameter instead
2059
- // of eating it.
2060
- args.collect()
2061
- };
2062
-
2063
2036
if !args.is_empty() {
2064
2037
if self.in_value {
2065
2038
write!(self, "::")?;
2066
2039
}
2067
- self.generic_delimiters(|cx| cx.comma_sep(args.into_iter ()))
2040
+ self.generic_delimiters(|cx| cx.comma_sep(args.iter().copied ()))
2068
2041
} else {
2069
2042
Ok(())
2070
2043
}
You can’t perform that action at this time.
0 commit comments