Skip to content
Closed
Show file tree
Hide file tree
Changes from 2 commits
Commits
Show all changes
17 commits
Select commit Hold shift + click to select a range
456007a
Emit error instead of ICE when optimized MIR is missing
Enselic Aug 29, 2023
7a6b52b
RPITITs are considered object-safe, they're always on Self:Sized methods
compiler-errors Sep 2, 2023
07fc644
Do not require associated types with Self: Sized to uphold bounds whe…
compiler-errors Sep 2, 2023
f686bd8
Take `&mut Results` in `ResultsVisitor`
Jarcho Sep 2, 2023
789451b
Allow `large_assignments` for Box/Arc/Rc initialization
Enselic Sep 3, 2023
8c667fe
Don't ICE on associated type projection without feature gate
compiler-errors Sep 3, 2023
eba5b44
Add OnceHelp lint level (same as OnceNote, except for help)
Urgau Jul 25, 2023
efbe445
Add help to allow lint for the implied by suggestion
Urgau Jul 25, 2023
9190e96
Adjust clippy tests with new rustc help suggestion for lints
Urgau Aug 1, 2023
56d10a8
provide more useful info for DefId Debug
ouz-a Sep 4, 2023
acefeb7
Rollup merge of #114089 - Urgau:allow-with-implied-by, r=petrochenkov
matthiaskrgr Sep 4, 2023
773b785
Rollup merge of #115353 - Enselic:no-optimized-mir, r=oli-obk
matthiaskrgr Sep 4, 2023
257e5ec
Rollup merge of #115467 - compiler-errors:assoc-ty-object-safety, r=o…
matthiaskrgr Sep 4, 2023
5adacdf
Rollup merge of #115488 - Jarcho:mut_result_visitor, r=oli-obk
matthiaskrgr Sep 4, 2023
f04dcd5
Rollup merge of #115492 - Enselic:large-box-move, r=oli-obk
matthiaskrgr Sep 4, 2023
7f93014
Rollup merge of #115519 - compiler-errors:next-solver-assoc-ice, r=lcnr
matthiaskrgr Sep 4, 2023
9e26c90
Rollup merge of #115534 - ouz-a:smir_def, r=oli-obk
matthiaskrgr Sep 4, 2023
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
16 changes: 15 additions & 1 deletion compiler/rustc_trait_selection/src/solve/project_goals.rs
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,21 @@ impl<'tcx> assembly::GoalKind<'tcx> for ProjectionPredicate<'tcx> {
// Finally we construct the actual value of the associated type.
let term = match assoc_def.item.kind {
ty::AssocKind::Type => tcx.type_of(assoc_def.item.def_id).map_bound(|ty| ty.into()),
ty::AssocKind::Const => bug!("associated const projection is not supported yet"),
ty::AssocKind::Const => {
if tcx.features().associated_const_equality {
bug!("associated const projection is not supported yet")
} else {
ty::EarlyBinder::bind(
ty::Const::new_error_with_message(
tcx,
tcx.type_of(assoc_def.item.def_id).instantiate_identity(),
DUMMY_SP,
"associated const projection is not supported yet",
)
.into(),
)
}
}
ty::AssocKind::Fn => unreachable!("we should never project to a fn"),
};

Expand Down
19 changes: 19 additions & 0 deletions tests/ui/traits/new-solver/dont-ice-on-assoc-projection.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
// compile-flags: -Ztrait-solver=next-coherence

// Makes sure we don't ICE on associated const projection when the feature gate
// is not enabled, since we should avoid encountering ICEs on stable if possible.

trait Bar {
const ASSOC: usize;
}
impl Bar for () {
const ASSOC: usize = 1;
}

trait Foo {}
impl Foo for () {}
impl<T> Foo for T where T: Bar<ASSOC = 0> {}
//~^ ERROR associated const equality is incomplete
//~| ERROR conflicting implementations of trait `Foo` for type `()`

fn main() {}
21 changes: 21 additions & 0 deletions tests/ui/traits/new-solver/dont-ice-on-assoc-projection.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
error[E0658]: associated const equality is incomplete
--> $DIR/dont-ice-on-assoc-projection.rs:15:32
|
LL | impl<T> Foo for T where T: Bar<ASSOC = 0> {}
| ^^^^^^^^^
|
= note: see issue #92827 <https://github.com/rust-lang/rust/issues/92827> for more information
= help: add `#![feature(associated_const_equality)]` to the crate attributes to enable

error[E0119]: conflicting implementations of trait `Foo` for type `()`
--> $DIR/dont-ice-on-assoc-projection.rs:15:1
|
LL | impl Foo for () {}
| --------------- first implementation here
LL | impl<T> Foo for T where T: Bar<ASSOC = 0> {}
| ^^^^^^^^^^^^^^^^^ conflicting implementation for `()`

error: aborting due to 2 previous errors

Some errors have detailed explanations: E0119, E0658.
For more information about an error, try `rustc --explain E0119`.