Skip to content

Commit 609fb5a

Browse files
committed
Correctly handle const paths with a qself
1 parent 190a5f0 commit 609fb5a

File tree

3 files changed

+7
-5
lines changed
  • compiler

3 files changed

+7
-5
lines changed

compiler/rustc_ast_lowering/src/lib.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2131,13 +2131,13 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
21312131
} else {
21322132
&anon.value
21332133
};
2134-
if let ExprKind::Path(qself, path) = &expr.kind
2135-
// FIXME(min_generic_const_args): we only allow one-segment const paths for now
2134+
// FIXME(min_generic_const_args): we only allow one-segment const paths for now
2135+
if let ExprKind::Path(None, path) = &expr.kind
21362136
&& path.is_potential_trivial_const_arg()
21372137
{
21382138
let qpath = self.lower_qpath(
21392139
expr.id,
2140-
qself,
2140+
&None,
21412141
path,
21422142
ParamMode::Optional,
21432143
AllowReturnTypeNotation::No,

compiler/rustc_hir_analysis/src/hir_ty_lowering/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2104,7 +2104,7 @@ impl<'tcx> dyn HirTyLowerer<'tcx> + '_ {
21042104
_ => ty::Const::new_error_with_message(
21052105
tcx,
21062106
qpath.span(),
2107-
"Const::lower_const_arg_path: invalid qpath",
2107+
format!("Const::lower_const_arg_path: invalid qpath {qpath:?}"),
21082108
),
21092109
}
21102110
}

compiler/rustc_middle/src/ty/consts.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
use std::borrow::Cow;
2+
13
use either::Either;
24
use rustc_data_structures::intern::Interned;
35
use rustc_error_messages::MultiSpan;
@@ -142,7 +144,7 @@ impl<'tcx> Const<'tcx> {
142144
pub fn new_error_with_message<S: Into<MultiSpan>>(
143145
tcx: TyCtxt<'tcx>,
144146
span: S,
145-
msg: &'static str,
147+
msg: impl Into<Cow<'static, str>>,
146148
) -> Const<'tcx> {
147149
let reported = tcx.dcx().span_delayed_bug(span, msg);
148150
Const::new_error(tcx, reported)

0 commit comments

Comments
 (0)