Skip to content

Commit 67309f1

Browse files
committed
fix todo remnants
1 parent f5807eb commit 67309f1

File tree

2 files changed

+5
-26
lines changed

2 files changed

+5
-26
lines changed

compiler/rustc_hir_analysis/src/astconv/mod.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -733,8 +733,7 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
733733
args,
734734
trait_segment.infer_args,
735735
Some(self_ty),
736-
// TODO remove this
737-
ty::BoundConstness::NotConst,
736+
constness,
738737
);
739738

740739
let tcx = self.tcx();

compiler/rustc_hir_analysis/src/collect.rs

+4-24
Original file line numberDiff line numberDiff line change
@@ -1338,33 +1338,13 @@ fn impl_trait_ref(
13381338
.map(|ast_trait_ref| {
13391339
let selfty = tcx.type_of(def_id).instantiate_identity();
13401340

1341-
if let Some(ErrorGuaranteed { .. }) = check_impl_constness(
1341+
check_impl_constness(
13421342
tcx,
13431343
tcx.is_const_trait_impl_raw(def_id.to_def_id()),
13441344
ast_trait_ref,
1345-
) {
1346-
// TODO this is wrong
1347-
// we have a const impl, but for a trait without `#[const_trait]`, so
1348-
// without the host param. If we continue with the HIR trait ref, we get
1349-
// ICEs for generic arg count mismatch. We do a little HIR editing to
1350-
// make astconv happy.
1351-
let mut path_segments = ast_trait_ref.path.segments.to_vec();
1352-
let last_segment = path_segments.len() - 1;
1353-
let mut args = *path_segments[last_segment].args();
1354-
let last_arg = args.args.len() - 1;
1355-
assert!(matches!(args.args[last_arg], hir::GenericArg::Const(anon_const) if anon_const.is_desugared_from_effects));
1356-
args.args = &args.args[..args.args.len() - 1];
1357-
path_segments[last_segment].args = Some(tcx.hir_arena.alloc(args));
1358-
let path = hir::Path {
1359-
span: ast_trait_ref.path.span,
1360-
res: ast_trait_ref.path.res,
1361-
segments: tcx.hir_arena.alloc_slice(&path_segments),
1362-
};
1363-
let trait_ref = tcx.hir_arena.alloc(hir::TraitRef { path: tcx.hir_arena.alloc(path), hir_ref_id: ast_trait_ref.hir_ref_id });
1364-
icx.astconv().instantiate_mono_trait_ref(trait_ref, selfty)
1365-
} else {
1366-
icx.astconv().instantiate_mono_trait_ref(ast_trait_ref, selfty)
1367-
}
1345+
);
1346+
1347+
icx.astconv().instantiate_mono_trait_ref(ast_trait_ref, selfty)
13681348
})
13691349
.map(ty::EarlyBinder::bind)
13701350
}

0 commit comments

Comments
 (0)