Skip to content

Commit 7052175

Browse files
No spans
1 parent 800a212 commit 7052175

File tree

6 files changed

+13
-23
lines changed

6 files changed

+13
-23
lines changed

compiler/rustc_middle/src/ty/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -238,7 +238,7 @@ pub struct ImplHeader<'tcx> {
238238
pub impl_def_id: DefId,
239239
pub self_ty: Ty<'tcx>,
240240
pub trait_ref: Option<TraitRef<'tcx>>,
241-
pub predicates: Vec<(Predicate<'tcx>, Span)>,
241+
pub predicates: Vec<Predicate<'tcx>>,
242242
}
243243

244244
#[derive(Copy, Clone, PartialEq, Eq, Debug, TypeFoldable, TypeVisitable)]

compiler/rustc_trait_selection/src/traits/coherence.rs

+6-8
Original file line numberDiff line numberDiff line change
@@ -151,16 +151,14 @@ fn with_fresh_ty_vars<'cx, 'tcx>(
151151
.predicates_of(impl_def_id)
152152
.instantiate(tcx, impl_args)
153153
.iter()
154-
.map(|(c, s)| (c.as_predicate(), s))
154+
.map(|(c, _)| c.as_predicate())
155155
.collect(),
156156
};
157157

158-
let InferOk { value: mut header, obligations } = selcx
159-
.infcx
160-
.at(&ObligationCause::dummy_with_span(tcx.def_span(impl_def_id)), param_env)
161-
.normalize(header);
158+
let InferOk { value: mut header, obligations } =
159+
selcx.infcx.at(&ObligationCause::dummy(), param_env).normalize(header);
162160

163-
header.predicates.extend(obligations.into_iter().map(|o| (o.predicate, o.cause.span)));
161+
header.predicates.extend(obligations.into_iter().map(|o| o.predicate));
164162
header
165163
}
166164

@@ -295,8 +293,8 @@ fn impl_intersection_has_impossible_obligation<'cx, 'tcx>(
295293
[&impl1_header.predicates, &impl2_header.predicates]
296294
.into_iter()
297295
.flatten()
298-
.map(|&(predicate, span)| {
299-
Obligation::new(infcx.tcx, ObligationCause::dummy_with_span(span), param_env, predicate)
296+
.map(|&predicate| {
297+
Obligation::new(infcx.tcx, ObligationCause::dummy(), param_env, predicate)
300298
})
301299
.chain(obligations.into_iter().cloned())
302300
.find(|obligation: &PredicateObligation<'tcx>| {

tests/ui/traits/issue-105231.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1+
//~ ERROR overflow evaluating the requirement `A<A<A<A<A<A<A<...>>>>>>>: Send`
12
struct A<T>(B<T>);
23
//~^ ERROR recursive types `A` and `B` have infinite size
34
struct B<T>(A<A<T>>);
45
trait Foo {}
56
impl<T> Foo for T where T: Send {}
6-
//~^ ERROR overflow evaluating the requirement `A<A<A<A<A<A<A<...>>>>>>>: Send`
77
impl Foo for B<u8> {}
88

99
fn main() {}

tests/ui/traits/issue-105231.stderr

+2-6
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
error[E0072]: recursive types `A` and `B` have infinite size
2-
--> $DIR/issue-105231.rs:1:1
2+
--> $DIR/issue-105231.rs:2:1
33
|
44
LL | struct A<T>(B<T>);
55
| ^^^^^^^^^^^ ---- recursive without indirection
@@ -15,14 +15,10 @@ LL ~ struct B<T>(Box<A<A<T>>>);
1515
|
1616

1717
error[E0275]: overflow evaluating the requirement `A<A<A<A<A<A<A<...>>>>>>>: Send`
18-
--> $DIR/issue-105231.rs:5:28
19-
|
20-
LL | impl<T> Foo for T where T: Send {}
21-
| ^^^^
2218
|
2319
= help: consider increasing the recursion limit by adding a `#![recursion_limit = "256"]` attribute to your crate (`issue_105231`)
2420
note: required because it appears within the type `B<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<u8>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>`
25-
--> $DIR/issue-105231.rs:3:8
21+
--> $DIR/issue-105231.rs:4:8
2622
|
2723
LL | struct B<T>(A<A<T>>);
2824
| ^

tests/ui/traits/solver-cycles/cycle-via-builtin-auto-trait-impl.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
//~ ERROR overflow
12
// A regression test for #111729 checking that we correctly
23
// track recursion depth for obligations returned by confirmation.
34
use std::panic::RefUnwindSafe;
@@ -14,7 +15,6 @@ struct RootDatabase {
1415
}
1516

1617
impl<T: RefUnwindSafe> Database for T {
17-
//~^ ERROR overflow
1818
type Storage = SalsaStorage;
1919
}
2020
impl Database for RootDatabase {

tests/ui/traits/solver-cycles/cycle-via-builtin-auto-trait-impl.stderr

+2-6
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,13 @@
11
error[E0275]: overflow evaluating the requirement `Runtime<RootDatabase>: RefUnwindSafe`
2-
--> $DIR/cycle-via-builtin-auto-trait-impl.rs:16:9
3-
|
4-
LL | impl<T: RefUnwindSafe> Database for T {
5-
| ^^^^^^^^^^^^^
62
|
73
= help: consider increasing the recursion limit by adding a `#![recursion_limit = "256"]` attribute to your crate (`cycle_via_builtin_auto_trait_impl`)
84
note: required because it appears within the type `RootDatabase`
9-
--> $DIR/cycle-via-builtin-auto-trait-impl.rs:12:8
5+
--> $DIR/cycle-via-builtin-auto-trait-impl.rs:13:8
106
|
117
LL | struct RootDatabase {
128
| ^^^^^^^^^^^^
139
note: required for `RootDatabase` to implement `Database`
14-
--> $DIR/cycle-via-builtin-auto-trait-impl.rs:16:24
10+
--> $DIR/cycle-via-builtin-auto-trait-impl.rs:17:24
1511
|
1612
LL | impl<T: RefUnwindSafe> Database for T {
1713
| ------------- ^^^^^^^^ ^

0 commit comments

Comments
 (0)