Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
d10b113
Set CMAKE_SYSTEM_NAME for Linux targets
eggyal Mar 15, 2023
5e0fc04
rustdoc: Correctly merge import's and its target's docs in one more case
petrochenkov Mar 17, 2023
d808bc2
Add tests for configure.py
jyn514 Mar 17, 2023
c7eccda
Use python3.11 in CI to make sure toml is validated
jyn514 Mar 17, 2023
0d53565
Make `slice::is_sorted_by` impl nicer
WaffleLapkin Mar 17, 2023
c2ccdfa
Switch impls of `is_sorted_by` between slices and slice iters
WaffleLapkin Mar 17, 2023
9139ed0
Fix impl_trait_ty_to_ty substs
spastorino Mar 17, 2023
640c202
Fix generics_of for impl's RPITIT synthesized associated type
spastorino Mar 17, 2023
be8b323
Ignore `Inlined` spans when computing caller location.
cjgillot Mar 18, 2023
18ea16c
Update mdbook
ehuss Mar 19, 2023
252fa78
Only expect a GAT const arg
compiler-errors Mar 19, 2023
dbedf40
Reformat type_of
compiler-errors Mar 19, 2023
96d5dd6
Rollup merge of #109170 - eggyal:xc-linux-cmake, r=Mark-Simulacrum
matthiaskrgr Mar 20, 2023
0e8085a
Rollup merge of #109266 - petrochenkov:docice4, r=petrochenkov
matthiaskrgr Mar 20, 2023
023079f
Rollup merge of #109267 - jyn514:test-configure, r=Mark-Simulacrum
matthiaskrgr Mar 20, 2023
88caa29
Rollup merge of #109273 - WaffleLapkin:slice_is_sorted_by_array_windo…
matthiaskrgr Mar 20, 2023
d86fd83
Rollup merge of #109277 - spastorino:new-rpitit-14, r=compiler-errors
matthiaskrgr Mar 20, 2023
3efecba
Rollup merge of #109307 - cjgillot:inline-location, r=compiler-errors
matthiaskrgr Mar 20, 2023
f21c435
Rollup merge of #109364 - compiler-errors:gat-const-arg, r=BoxyUwU
matthiaskrgr Mar 20, 2023
58ffabb
Rollup merge of #109365 - ehuss:update-mdbook, r=Mark-Simulacrum
matthiaskrgr Mar 20, 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
Prev Previous commit
Next Next commit
Only expect a GAT const arg
  • Loading branch information
compiler-errors committed Mar 19, 2023
commit 252fa782836785d947ec67ef915553b30b32ce68
15 changes: 10 additions & 5 deletions compiler/rustc_hir_analysis/src/collect/type_of.rs
Original file line number Diff line number Diff line change
Expand Up @@ -475,7 +475,9 @@ pub(super) fn type_of(tcx: TyCtxt<'_>, def_id: DefId) -> ty::EarlyBinder<Ty<'_>>
def_id.to_def_id(),
);
if let Some(assoc_item) = assoc_item {
tcx.type_of(assoc_item.def_id).subst_identity()
tcx.type_of(assoc_item.def_id)
.no_bound_vars()
.expect("const parameter types cannot be generic")
} else {
// FIXME(associated_const_equality): add a useful error message here.
tcx.ty_error_with_message(
Expand Down Expand Up @@ -517,15 +519,18 @@ pub(super) fn type_of(tcx: TyCtxt<'_>, def_id: DefId) -> ty::EarlyBinder<Ty<'_>>
},
def_id.to_def_id(),
);
if let Some(param)
= assoc_item.map(|item| &tcx.generics_of(item.def_id).params[idx]).filter(|param| param.kind.is_ty_or_const())
if let Some(assoc_item) = assoc_item
&& let param = &tcx.generics_of(assoc_item.def_id).params[idx]
&& matches!(param.kind, ty::GenericParamDefKind::Const { .. })
{
tcx.type_of(param.def_id).subst_identity()
tcx.type_of(param.def_id)
.no_bound_vars()
.expect("const parameter types cannot be generic")
} else {
// FIXME(associated_const_equality): add a useful error message here.
tcx.ty_error_with_message(
DUMMY_SP,
"Could not find associated const on trait",
"Could not find const param on associated item",
)
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#![feature(generic_const_exprs)]
//~^ WARN the feature `generic_const_exprs` is incomplete

trait B {
type U<T>;
}

fn f<T: B<U<1i32> = ()>>() {}
//~^ ERROR constant provided when a type was expected

fn main() {}
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
warning: the feature `generic_const_exprs` is incomplete and may not be safe to use and/or cause compiler crashes
--> $DIR/mismatched-gat-subst-kind.rs:1:12
|
LL | #![feature(generic_const_exprs)]
| ^^^^^^^^^^^^^^^^^^^
|
= note: see issue #76560 <https://github.com/rust-lang/rust/issues/76560> for more information
= note: `#[warn(incomplete_features)]` on by default

error[E0747]: constant provided when a type was expected
--> $DIR/mismatched-gat-subst-kind.rs:8:13
|
LL | fn f<T: B<U<1i32> = ()>>() {}
| ^^^^

error: aborting due to previous error; 1 warning emitted

For more information about this error, try `rustc --explain E0747`.