Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
b80d074
Fix typo in README.md
filenine Nov 30, 2023
605381a
Capitalize ToC in README.md
filenine Nov 30, 2023
4e99db9
Tweak unclosed generics errors
estebank Nov 15, 2023
5e470db
Remove the `precise_pointer_size_matching` feature gate
Nadrieril Dec 4, 2023
e6a14c0
Use default params until effects in desugaring
fee1-dead Dec 4, 2023
8fb7117
Update books
rustbot Dec 4, 2023
0e3e16c
rustc_driver_impl: Address all `rustc::potential_query_instability` l…
Enselic Dec 5, 2023
ae2427d
rustc_interface: Address all `rustc::potential_query_instability` lints
Enselic Dec 5, 2023
d7d867d
rustc_symbol_mangling: Address all `rustc::potential_query_instabilit…
Enselic Dec 5, 2023
1b50304
Remove mention of rust to make the error message generic.
hdost Dec 4, 2023
15a8e9d
Fix x not to quit when x prints settings.json
long-long-float Dec 4, 2023
2d01eee
Rollup merge of #117922 - estebank:unclosed-generics, r=b-naber
matthiaskrgr Dec 5, 2023
30b4cef
Rollup merge of #118471 - filenine:fix-typos, r=workingjubilee
matthiaskrgr Dec 5, 2023
fddda14
Rollup merge of #118594 - hdost:patch-1, r=fmease
matthiaskrgr Dec 5, 2023
81b6263
Rollup merge of #118598 - Nadrieril:remove_precise_pointer_size_match…
matthiaskrgr Dec 5, 2023
a260acc
Rollup merge of #118606 - long-long-float:x-do-not-quit-when-x-prints…
matthiaskrgr Dec 5, 2023
c6c0c65
Rollup merge of #118608 - fee1-dead-contrib:backdoor-in-askconv, r=co…
matthiaskrgr Dec 5, 2023
4b40b1b
Rollup merge of #118614 - rustbot:docs-update, r=ehuss
matthiaskrgr Dec 5, 2023
d367db2
Rollup merge of #118637 - Enselic:query-instability-2, r=cjgillot
matthiaskrgr Dec 5, 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
Use default params until effects in desugaring
  • Loading branch information
fee1-dead committed Dec 4, 2023
commit e6a14c033640dff9a8cb39bdc39b5e62ec46fc3f
25 changes: 25 additions & 0 deletions compiler/rustc_hir_analysis/src/astconv/generics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -243,6 +243,31 @@ pub fn create_args_for_parent_generic_args<'tcx, 'a>(
match (args_iter.peek(), params.peek()) {
(Some(&arg), Some(&param)) => {
match (arg, &param.kind, arg_count.explicit_late_bound) {
(
GenericArg::Const(hir::ConstArg {
is_desugared_from_effects: true,
..
}),
GenericParamDefKind::Const { is_host_effect: false, .. }
| GenericParamDefKind::Type { .. }
| GenericParamDefKind::Lifetime,
_,
) => {
// SPECIAL CASE FOR DESUGARED EFFECT PARAMS
// This comes from the following example:
//
// ```
// #[const_trait]
// pub trait PartialEq<Rhs: ?Sized = Self> {}
// impl const PartialEq for () {}
// ```
//
// Since this is a const impl, we need to insert `<false>` at the end of
// `PartialEq`'s generics, but this errors since `Rhs` isn't specified.
// To work around this, we infer all arguments until we reach the host param.
args.push(ctx.inferred_kind(Some(&args), param, infer_args));
params.next();
}
(GenericArg::Lifetime(_), GenericParamDefKind::Lifetime, _)
| (
GenericArg::Type(_) | GenericArg::Infer(_),
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
// Ensure that we don't get a mismatch error when inserting the host param
// at the end of generic args when the generics have defaulted params.
//
// check-pass

#![feature(const_trait_impl, effects)]

#[const_trait]
pub trait Foo<Rhs: ?Sized = Self> {
/* stuff */
}

impl const Foo for () {}

fn main() {}
6 changes: 2 additions & 4 deletions tests/ui/rfcs/rfc-2632-const-trait-impl/effects/minicore.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,7 @@ trait Add<Rhs = Self> {
fn add(self, rhs: Rhs) -> Self::Output;
}

// FIXME(effects) we shouldn't need to have to specify `Rhs`.
impl const Add<i32> for i32 {
impl const Add for i32 {
type Output = i32;
fn add(self, rhs: i32) -> i32 {
loop {}
Expand Down Expand Up @@ -353,8 +352,7 @@ where
}
}

// FIXME(effects): again, this should not error without Rhs specified
impl PartialEq<str> for str {
impl PartialEq for str {
fn eq(&self, other: &str) -> bool {
loop {}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
error[E0493]: destructor of `Self` cannot be evaluated at compile-time
--> $DIR/minicore.rs:503:9
--> $DIR/minicore.rs:501:9
|
LL | *self = source.clone()
| ^^^^^
Expand All @@ -8,7 +8,7 @@ LL | *self = source.clone()
| value is dropped here

error[E0493]: destructor of `T` cannot be evaluated at compile-time
--> $DIR/minicore.rs:513:35
--> $DIR/minicore.rs:511:35
|
LL | const fn drop<T: ~const Destruct>(_: T) {}
| ^ - value is dropped here
Expand Down