Skip to content

Commit a23a444

Browse files
committed
fix rebase
1 parent ae7828a commit a23a444

File tree

6 files changed

+26
-9
lines changed

6 files changed

+26
-9
lines changed

src/librustc_mir/interpret/eval_context.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -454,7 +454,7 @@ impl<'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> {
454454
def_id: DefId,
455455
substs: SubstsRef<'tcx>,
456456
) -> InterpResult<'tcx, ty::Instance<'tcx>> {
457-
self.resolve_const_arg(self.tcx.with_opt_param(def_id), substs)
457+
self.resolve_const_arg(ty::WithOptParam::dummy(def_id), substs)
458458
}
459459

460460
pub(super) fn resolve_const_arg(

src/librustc_mir/interpret/operand.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -532,7 +532,7 @@ impl<'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> {
532532
ty::ConstKind::Param(_) => throw_inval!(TooGeneric),
533533
ty::ConstKind::Error(_) => throw_inval!(TypeckError(ErrorReported)),
534534
ty::ConstKind::Unevaluated(def, substs, promoted) => {
535-
let instance = self.resolve(def, substs)?;
535+
let instance = self.resolve_const_arg(def, substs)?;
536536
// We use `const_eval` here and `const_eval_raw` elsewhere in mir interpretation.
537537
// The reason we use `const_eval_raw` everywhere else is to prevent cycles during
538538
// validation, because validation automatically reads through any references, thus

src/librustc_mir/transform/instrument_coverage.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ pub struct InstrumentCoverage;
2525
/// constructing the arguments for `llvm.instrprof.increment`.
2626
pub(crate) fn provide(providers: &mut Providers<'_>) {
2727
providers.coverage_data = |tcx, def_id| {
28-
let mir_body = tcx.optimized_mir(def_id);
28+
let mir_body = tcx.optimized_mir(ty::WithOptParam::dummy(def_id));
2929
// FIXME(richkadel): The current implementation assumes the MIR for the given DefId
3030
// represents a single function. Validate and/or correct if inlining and/or monomorphization
3131
// invalidates these assumptions.

src/librustc_typeck/check/mod.rs

+4-3
Original file line numberDiff line numberDiff line change
@@ -1751,7 +1751,7 @@ fn opaque_type_cycle_error(tcx: TyCtxt<'tcx>, def_id: LocalDefId, span: Span) {
17511751

17521752
let mut label = false;
17531753
if let Some((hir_id, visitor)) = get_owner_return_paths(tcx, def_id) {
1754-
let tables = tcx.typeck_tables_of(tcx.hir().local_def_id(hir_id));
1754+
let tables = tcx.typeck_tables_of(ty::WithOptParam::dummy(tcx.hir().local_def_id(hir_id)));
17551755
if visitor
17561756
.returns
17571757
.iter()
@@ -1854,8 +1854,9 @@ fn binding_opaque_type_cycle_error(
18541854
..
18551855
}) => {
18561856
let hir_id = tcx.hir().as_local_hir_id(def_id);
1857-
let tables =
1858-
tcx.typeck_tables_of(tcx.hir().local_def_id(tcx.hir().get_parent_item(hir_id)));
1857+
let tables = tcx.typeck_tables_of(ty::WithOptParam::dummy(
1858+
tcx.hir().local_def_id(tcx.hir().get_parent_item(hir_id)),
1859+
));
18591860
if let Some(ty) = tables.node_type_opt(expr.hir_id) {
18601861
err.span_label(
18611862
expr.span,

src/test/ui/const-generics/type-dependent/issue-71382.rs

+2-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
1-
// run-pass
21
#![feature(const_generics)]
3-
#![allow(incomplete_features)]
4-
#![feature(const_compare_raw_pointers)]
2+
//~^ WARN the feature `const_generics` is incomplete
53

64
struct Test;
75

@@ -15,6 +13,7 @@ impl Test {
1513
}
1614

1715
fn test<const FN: fn() -> u8>(&self) -> u8 {
16+
//~^ ERROR using function pointers as const generic parameters is forbidden
1817
FN()
1918
}
2019
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
warning: the feature `const_generics` is incomplete and may not be safe to use and/or cause compiler crashes
2+
--> $DIR/issue-71382.rs:1:12
3+
|
4+
LL | #![feature(const_generics)]
5+
| ^^^^^^^^^^^^^^
6+
|
7+
= note: `#[warn(incomplete_features)]` on by default
8+
= note: see issue #44580 <https://github.com/rust-lang/rust/issues/44580> for more information
9+
10+
error: using function pointers as const generic parameters is forbidden
11+
--> $DIR/issue-71382.rs:15:23
12+
|
13+
LL | fn test<const FN: fn() -> u8>(&self) -> u8 {
14+
| ^^^^^^^^^^
15+
16+
error: aborting due to previous error; 1 warning emitted
17+

0 commit comments

Comments
 (0)