Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions compiler/rustc_trait_selection/src/solve/project_goals.rs
Original file line number Diff line number Diff line change
Expand Up @@ -193,10 +193,14 @@ impl<'tcx> assembly::GoalKind<'tcx> for ProjectionPredicate<'tcx> {
}

fn consider_auto_trait_candidate(
_ecx: &mut EvalCtxt<'_, 'tcx>,
ecx: &mut EvalCtxt<'_, 'tcx>,
goal: Goal<'tcx, Self>,
) -> 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(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
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 {
| ----- auto traits cannot have associated items
Expand Down
11 changes: 11 additions & 0 deletions tests/ui/auto-traits/issue-23080-2.next.stderr
Original file line number Diff line number Diff line change
@@ -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`.
3 changes: 3 additions & 0 deletions tests/ui/auto-traits/issue-23080-2.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// revisions: current next
//[next] compile-flags: -Ztrait-solver=next

#![feature(auto_traits)]
#![feature(negative_impls)]

Expand Down