Skip to content

Commit 8716eae

Browse files
committed
add tests and comment
1 parent 4a0473c commit 8716eae

File tree

4 files changed

+19
-0
lines changed

4 files changed

+19
-0
lines changed

compiler/rustc_traits/src/evaluate_obligation.rs

+2
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ fn evaluate_obligation<'tcx>(
1616
canonical_goal: CanonicalPredicateGoal<'tcx>,
1717
) -> Result<EvaluationResult, OverflowError> {
1818
debug!("evaluate_obligation(canonical_goal={:#?})", canonical_goal);
19+
// HACK This bubble is required for this tests to pass:
20+
// impl-trait/issue99642.rs
1921
tcx.infer_ctxt().with_opaque_type_inference(DefiningAnchor::Bubble).enter_with_canonical(
2022
DUMMY_SP,
2123
&canonical_goal,

compiler/rustc_traits/src/type_op.rs

+2
Original file line numberDiff line numberDiff line change
@@ -258,6 +258,8 @@ fn type_op_prove_predicate<'tcx>(
258258
tcx: TyCtxt<'tcx>,
259259
canonicalized: Canonical<'tcx, ParamEnvAnd<'tcx, ProvePredicate<'tcx>>>,
260260
) -> Result<&'tcx Canonical<'tcx, QueryResponse<'tcx, ()>>, NoSolution> {
261+
// HACK This bubble is required for this test to pass:
262+
// impl-trait/issue-99642.rs
261263
tcx.infer_ctxt().with_opaque_type_inference(DefiningAnchor::Bubble).enter_canonical_trait_query(
262264
&canonicalized,
263265
|infcx, fulfill_cx, key| {
+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
// check-pass
2+
3+
#![feature(type_alias_impl_trait)]
4+
type Opq = impl Sized;
5+
fn test() -> impl Iterator<Item = Opq> {
6+
Box::new(0..) as Box<dyn Iterator<Item = _>>
7+
}
8+
fn main(){}

src/test/ui/impl-trait/issue-99642.rs

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
// check-pass
2+
3+
fn test() -> impl Iterator<Item = impl Sized> {
4+
Box::new(0..) as Box<dyn Iterator<Item = _>>
5+
}
6+
7+
fn main() {}

0 commit comments

Comments
 (0)