mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-27 01:04:03 +00:00
Rollup merge of #112223 - compiler-errors:new-solver-auto-proj, r=BoxyUwU
Don't ICE in new solver when auto traits have associated types People can write malformed auto traits, and that shouldn't cause the new solver to ICE
This commit is contained in:
commit
18763cb464
@ -226,10 +226,14 @@ impl<'tcx> assembly::GoalKind<'tcx> for ProjectionPredicate<'tcx> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn consider_auto_trait_candidate(
|
fn consider_auto_trait_candidate(
|
||||||
_ecx: &mut EvalCtxt<'_, 'tcx>,
|
ecx: &mut EvalCtxt<'_, 'tcx>,
|
||||||
goal: Goal<'tcx, Self>,
|
goal: Goal<'tcx, Self>,
|
||||||
) -> QueryResult<'tcx> {
|
) -> QueryResult<'tcx> {
|
||||||
bug!("auto traits do not have associated types: {:?}", goal);
|
ecx.tcx().sess.delay_span_bug(
|
||||||
|
ecx.tcx().def_span(goal.predicate.def_id()),
|
||||||
|
"associated types not allowed on auto traits",
|
||||||
|
);
|
||||||
|
Err(NoSolution)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn consider_trait_alias_candidate(
|
fn consider_trait_alias_candidate(
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
error[E0380]: auto traits cannot have associated items
|
error[E0380]: auto traits cannot have associated items
|
||||||
--> $DIR/issue-23080-2.rs:5:10
|
--> $DIR/issue-23080-2.rs:8:10
|
||||||
|
|
|
|
||||||
LL | unsafe auto trait Trait {
|
LL | unsafe auto trait Trait {
|
||||||
| ----- auto traits cannot have associated items
|
| ----- auto traits cannot have associated items
|
11
tests/ui/auto-traits/issue-23080-2.next.stderr
Normal file
11
tests/ui/auto-traits/issue-23080-2.next.stderr
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
error[E0380]: auto traits cannot have associated items
|
||||||
|
--> $DIR/issue-23080-2.rs:8:10
|
||||||
|
|
|
||||||
|
LL | unsafe auto trait Trait {
|
||||||
|
| ----- auto traits cannot have associated items
|
||||||
|
LL | type Output;
|
||||||
|
| -----^^^^^^- help: remove these associated items
|
||||||
|
|
||||||
|
error: aborting due to previous error
|
||||||
|
|
||||||
|
For more information about this error, try `rustc --explain E0380`.
|
@ -1,3 +1,6 @@
|
|||||||
|
// revisions: current next
|
||||||
|
//[next] compile-flags: -Ztrait-solver=next
|
||||||
|
|
||||||
#![feature(auto_traits)]
|
#![feature(auto_traits)]
|
||||||
#![feature(negative_impls)]
|
#![feature(negative_impls)]
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user