Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Closed
Show file tree
Hide file tree
Changes from 2 commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
deb3fdd
Use new check-cfg syntax in rustc_llvm build script
Urgau Nov 16, 2023
347e382
Update unexpected_cfgs lint definition with new syntax and diagnostics
Urgau Nov 16, 2023
623e99e
Remove deprecated --check-cfg names() and values() syntax
Urgau Nov 16, 2023
b80d074
Fix typo in README.md
filenine Nov 30, 2023
605381a
Capitalize ToC in README.md
filenine Nov 30, 2023
8870768
Change prefetch to avoid deadlock
andjo403 Nov 30, 2023
4e99db9
Tweak unclosed generics errors
estebank Nov 15, 2023
e6a14c0
Use default params until effects in desugaring
fee1-dead Dec 4, 2023
8fb7117
Update books
rustbot Dec 4, 2023
65212a0
Remove `#[rustc_host]`, use internal desugaring
fee1-dead 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
2e97bce
Rollup merge of #117922 - estebank:unclosed-generics, r=b-naber
fee1-dead Dec 5, 2023
dfa6ff7
Rollup merge of #117981 - Urgau:check-cfg-remove-deprecated-syntax, r…
fee1-dead Dec 5, 2023
790dd75
Rollup merge of #118471 - filenine:fix-typos, r=workingjubilee
fee1-dead Dec 5, 2023
519669a
Rollup merge of #118488 - andjo403:remove_deadlock, r=SparrowLii
fee1-dead Dec 5, 2023
c7fbebd
Rollup merge of #118605 - fee1-dead-contrib:rm-rustc_host, r=compiler…
fee1-dead Dec 5, 2023
c778187
Rollup merge of #118608 - fee1-dead-contrib:backdoor-in-askconv, r=co…
fee1-dead Dec 5, 2023
834a8e8
Rollup merge of #118614 - rustbot:docs-update, r=ehuss
fee1-dead Dec 5, 2023
0a896b4
Rollup merge of #118637 - Enselic:query-instability-2, r=cjgillot
fee1-dead 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
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