jiebi/CodeConvo huggingface dataset:
Change:
<!-- [31mICE[0m: Rustc '-Zprint-mono-items=eager -Zpolymorphize=on --crate-type=lib -ooutputfile -Zdump-mir-dir=dir' 'thread 'rustc' panicked at 'assertion failed: coroutine constructed with incorrect number of substitutions'', 'thread 'rustc' panicked at 'assertion failed: coroutine constructed with incorrect number of substitutions'' File: --auto-reduced (treereduce-rust): original: Version information Command: &lt;!-- Include a backtrace in the code block by setting in your environment. E.g. . --&lt;details&lt;summary&lt;strongProgram output&lt;/strong&lt;/summary&lt;p&lt;/p&lt;/details&lt;!-- query stack: [collectandpartitionmonoitems] collectandpartitionmonoitems [exported_symbols] collecting exported symbols for crate --
without debug assertions: &lt;!-- [31mICE[0m: Rustc '-Zprint-mono-items=eager -Zpolymorphize=on --crate-type=lib -ooutputfile -Zdump-mir-dir=dir' 'thread 'rustc' panicked at ', 'thread 'rustc' panicked at ' File: --auto-reduced (treereduce-rust): original: Version information Command: <!-- Include a backtrace in the code block by setting in your environment. E.g. . --<details<summary<strongProgram output</strong</summary<p</p</details<!-- query stack: [collectandpartitionmonoitems] collectandpartitionmonoitems [exported_symbols] collecting exported symbols for crate --
Regression in nightly-2024-02-07 cc

Discussion:
kind: hir::ExprKind::Closure(hir::Closure { kind, .. }), .. }) = node { <ins> // See `ClosureArgsParts`, `CoroutineArgsParts`, and `CoroutineClosureArgsParts` // for info on the usage of each of these fields. </ins> let dummy_args = match kind { ClosureKind::Closure => &["<closure_kind>", "<closure_signature>", "<upvars>"][..], <del> ClosureKind::Coroutine(_) => { &["<resume_ty>", "<yield_ty>", "<return_ty>", "<witness>", "<upvars>"][..] } </del> <ins> ClosureKind::Coroutine(_) => &[ "<coroutine_kind>", "<resume_ty>", "<yield_ty>", "<return_ty>", "<witness>", "<upvars>", ][..], </ins> ClosureKind::CoroutineClosure(_) => &[ "<closure_kind>", "<closure_signature_parts>",

let def_id = instance.def_id(); let upvars_ty = match tcx.type_of(def_id).skip_binder().kind() { ty::Closure(..) => Some(args.as_closure().tupled_upvars_ty()), <del> ty::Coroutine(..) => Some(args.as_coroutine().tupled_upvars_ty()), </del> <ins> ty::Coroutine(..) => { assert_eq!( args.as_coroutine().kind_ty(), tcx.types.unit, "polymorphization does not support coroutines from async closures" ); Some(args.as_coroutine().tupled_upvars_ty()) } </ins> _ => None, }; let has_upvars = upvars_ty.is_some_and(|ty| !ty.tuple_fields().is_empty());

<ins> // compile-flags: -Zpolymorphize=on // build-pass #![feature(coroutines, coroutine_trait)] use std::ops::Coroutine; use std::pin::Pin; use std::thread; fn main() { let mut foo = || yield; thread::spawn(move || match Pin::new(&mut foo).resume(()) { s => panic!("bad state: {:?}", s), }) .join() .unwrap(); } </ins>
Change:
<!-- [31mICE[0m: Rustc '' 'thread 'rustc' panicked at 'assertion failed: ().haserrors().issome()'', 'thread 'rustc' panicked at 'assertion failed: ().haserrors().issome()'' File: --auto-reduced (treereduce-rust): original: Version information ` Command: <!-- Include a backtrace in the code block by setting in your environment. E.g. . --<details<summary<strongProgram output</strong</summary<p</p</details<!-- query stack: [checkwellformed] checking that is well-formed [checkmodtype_wf] checking that types are well-formed in top-level module [analysis] running analysis passes on this crate --
cc
in 'ish ICEs, I am seeing ice now, im wondering if that also relates to somehow :thinking:
Quite likely, I'll take a look.
I can reproduce this. It's Saturday morning here, I might get to it today, if not I'll look on Monday morning.
Fixing this is really easy, I just need to adjust the assertion a tiny bit. The hard part is deciding where to put the test. is the obvious place, but then I get complaining that there are too many files in that directory. Suggestions?
just bump the limit by one like everybody else? :upsidedownface: :seenoevil:
I ended up putting the test in , because it happens during type checking.

Discussion:
let ty = tcx.type_of(def_id).instantiate_identity(); if ty.references_error() { // If there is already another error, do not emit an error for not using a type parameter. <del> assert!(tcx.dcx().has_errors().is_some()); </del> <ins> // Without the `stashed_err_count` part this can fail (#120856). assert!(tcx.dcx().has_errors().is_some() || tcx.dcx().stashed_err_count() > 0); </ins> return; }

<ins> pub type Archived<T> = <m::Alias as n::Trait>::Archived; //~^ ERROR failed to resolve: use of undeclared crate or module `m` //~| ERROR failed to resolve: use of undeclared crate or module `n` fn main() {} </ins>

<ins> error[E0433]: failed to resolve: use of undeclared crate or module `n` --> $DIR/issue-120856.rs:1:37 | LL | pub type Archived<T> = <m::Alias as n::Trait>::Archived; |                                     ^ |                                     | |                                     use of undeclared crate or module `n` |                                     help: a trait with a similar name exists: `Fn` error[E0433]: failed to resolve: use of undeclared crate or module `m` --> $DIR/issue-120856.rs:1:25 | LL | pub type Archived<T> = <m::Alias as n::Trait>::Archived; |                         ^ |                         | |                         use of undeclared crate or module `m` |                         help: a type parameter with a similar name exists: `T` error: aborting due to 2 previous errors For more information about this error, try `rustc --explain E0433`. </ins>
Change:
<!-- [31mICE[0m: Rustc '' 'thread 'rustc' panicked at 'assertion failed: errors.isempty()'', 'thread 'rustc' panicked at 'assertion failed: errors.isempty()'' File: --auto-reduced (treereduce-rust): original: Version information ` Command: <!-- Include a backtrace in the code block by setting in your environment. E.g. . --<details<summary<strongProgram output</strong</summary<p</p</details<!-- query stack: [typeck] type-checking [analysis] running analysis passes on this crate --
cc

Discussion:
}); // We're done if we found errors, but we already emitted them. <del> if let Some(reported) = reported { assert!(errors.is_empty()); </del> <ins> if let Some(reported) = reported && errors.is_empty() { </ins> return reported; } assert!(!errors.is_empty());

<ins> fn thing() { let f = |_, _| (); f(f); //~ ERROR: closure/coroutine type that references itself //~^ ERROR: this function takes 2 arguments but 1 argument was supplied } fn main() {} </ins>

<ins> error[E0644]: closure/coroutine type that references itself --> $DIR/cyclic_type_ice.rs:3:7 | LL |     f(f); |       ^ cyclic type of infinite size | = note: closures cannot capture themselves or take themselves as argument; this error may be the result of a recent compiler bug-fix, see issue #46062 <https://github.com/rust-lang/rust/issues/46062> for more information error[E0057]: this function takes 2 arguments but 1 argument was supplied --> $DIR/cyclic_type_ice.rs:3:5 | LL |     f(f); |     ^--- an argument is missing | note: closure defined here --> $DIR/cyclic_type_ice.rs:2:13 | LL |     let f = |_, _| (); |             ^^^^^^ help: provide the argument | LL |     f(/*  */, /*  */); |      ~~~~~~~~~~~~~~~~ error: aborting due to 2 previous errors Some errors have detailed explanations: E0057, E0644. For more information about an error, try `rustc --explain E0057`. </ins>
Change:
<!-- [31mICE[0m: Rustc '-Znext-solver=coherence -ooutputfile -Zdump-mir-dir=dir' 'thread 'rustc' panicked at 'internal error: entered unreachable code: Weak and Inherent aliases should have been normalized away already'', 'thread 'rustc' panicked at 'internal error: entered unreachable code: Weak and Inherent aliases should have been normalized away already'' File: --auto-reduced (treereduce-rust): original: Version information ` Command: <!-- Include a backtrace in the code block by setting in your environment. E.g. . --<details<summary<strongProgram output</strong</summary<p</p</details<!-- query stack: [specializationgraphof] building specialization graph of trait [coherent_trait] coherence checking all impls of trait [analysis] running analysis passes on this crate --
cc

Discussion:
use rustc_middle::ty::{self, Ty, TyCtxt}; use rustc_middle::ty::{fast_reject, TypeFoldable}; use rustc_middle::ty::{ToPredicate, TypeVisitableExt}; <del> use rustc_span::ErrorGuaranteed; </del> <ins> use rustc_span::{ErrorGuaranteed, DUMMY_SP}; </ins> use std::fmt::Debug; pub(super) mod structural_traits;

ty::Alias(kind @ (ty::Projection | ty::Opaque), alias_ty) => (kind, alias_ty), ty::Alias(ty::Inherent | ty::Weak, _) => { <del> unreachable!("Weak and Inherent aliases should have been normalized away already") </del> <ins> self.tcx().sess.dcx().span_delayed_bug( DUMMY_SP, format!("could not normalize {self_ty}, it is not WF"), ); return; </ins> } };

<ins> // compile-flags: -Znext-solver #![feature(lazy_type_alias)] //~^ WARN the feature `lazy_type_alias` is incomplete trait Foo {} type A<T: Foo> = T; struct W<T>(T); // For `W<A<usize>>` to be WF, `A<usize>: Sized` must hold. However, when assembling // alias bounds for `A<usize>`, we try to normalize it, but it doesn't hold because // `usize: Foo` doesn't hold. Therefore we ICE, because we don't expect to still // encounter weak types in `assemble_alias_bound_candidates_recur`. fn hello(_: W<A<usize>>) {} //~^ ERROR the type `W<A<usize>>` is not well-formed fn main() {} </ins>

<ins> warning: the feature `lazy_type_alias` is incomplete and may not be safe to use and/or cause compiler crashes --> $DIR/alias-bounds-when-not-wf.rs:3:12 | LL | #![feature(lazy_type_alias)] |            ^^^^^^^^^^^^^^^ | = note: see issue #112792 <https://github.com/rust-lang/rust/issues/112792> for more information = note: `#[warn(incomplete_features)]` on by default error: the type `W<A<usize>>` is not well-formed --> $DIR/alias-bounds-when-not-wf.rs:16:13 | LL | fn hello(_: W<A<usize>>) {} |             ^^^^^^^^^^^ error: aborting due to 1 previous error; 1 warning emitted </ins>
Change:
I tried this code: I expected to see this happen: It compiles quickly. Instead, this happened: It takes 10s to complete. Bisected to cc
Why did you title this "is broken"? It just takes longer to compile, or is it broken some other way? I'll look into the upcoming week.
Sorry, it just takes longer to compile.
WG-prioritization assigning priority (). label -I-prioritize +P-medium -regression-untriaged
On my machine (Apple M2 Pro), this test currently takes about 30 seconds. But if I enable , the compiler appears to consume 100% CPU forever. I'm not sure whether it's actually stuck, or just taking an incredibly long time, but I've never seen it finish with debug assertions enabled.
If I apply , the test finishes in about 45 seconds with debug assertions enabled, and about 3 seconds with them disabled.

Discussion:
on_ambiguity: impl FnOnce(), ) -> ControlFlow<T, ()> { let mut idx = 0; <ins> let mut in_parent_alias_type = false; </ins> loop { let (kind, alias_ty) = match *self_ty.kind() { ty::Alias(kind @ (ty::Projection | ty::Opaque), alias_ty) => (kind, alias_ty),

for bound in self.tcx().item_bounds(alias_ty.def_id).instantiate(self.tcx(), alias_ty.args) { <ins> // HACK: On subsequent recursions, we only care about bounds that don't // share the same type as `self_ty`. This is because for truly rigid // projections, we will never be able to equate, e.g. `<T as Tr>::A` // with `<<T as Tr>::A as Tr>::A`. if in_parent_alias_type { match bound.kind().skip_binder() { ty::ClauseKind::Trait(tr) if tr.self_ty() == self_ty => continue, ty::ClauseKind::Projection(p) if p.self_ty() == self_ty => continue, _ => {} } } </ins> for_each(self, bound, idx)?; idx += 1; }

} else { return ControlFlow::Continue(()); } <ins> in_parent_alias_type = true; </ins> } }
Change:
<!-- [31mICE[0m: Rustc '-Zmir-opt-level=5 -ooutputfile -Zdump-mir-dir=dir' 'thread 'rustc' panicked at 'assertion failed: ()'', 'thread 'rustc' panicked at 'assertion failed: ()'' File: --auto-reduced (treereduce-rust): original: Version information ` Command: <!-- Include a backtrace in the code block by setting in your environment. E.g. . --<details<summary<strongProgram output</strong</summary<p</p</details<!-- query stack: [optimizedmir] optimizing MIR for [collectandpartitionmonoitems] collectandpartitionmono_items --
cc

Discussion:
.ok()?; dest.into() } <del> CastKind::FnPtrToPtr | CastKind::PtrToPtr | CastKind::PointerCoercion( </del> <ins> CastKind::FnPtrToPtr | CastKind::PtrToPtr => { let src = self.evaluated[value].as_ref()?; let src = self.ecx.read_immediate(src).ok()?; let to = self.ecx.layout_of(to).ok()?; let ret = self.ecx.ptr_to_ptr(&src, to).ok()?; ret.into() } CastKind::PointerCoercion( </ins> ty::adjustment::PointerCoercion::MutToConstPointer | ty::adjustment::PointerCoercion::ArrayToPointer | ty::adjustment::PointerCoercion::UnsafeFnPointer,

let src = self.evaluated[value].as_ref()?; let src = self.ecx.read_immediate(src).ok()?; let to = self.ecx.layout_of(to).ok()?; <del> let ret = self.ecx.ptr_to_ptr(&src, to).ok()?; ret.into() </del> <ins> ImmTy::from_immediate(*src, to).into() </ins> } _ => return None, },

<ins> // Verify that we do not ICE when attempting to interpret casts between fn types. // skip-filecheck static FOO: fn() = || assert_ne!(42, 43); static BAR: fn(i32, i32) = |a, b| assert_ne!(a, b); fn main() { FOO(); let bar: unsafe fn(i32, i32) = BAR; let f: fn() = || {}; f(); f(); f(); let g: fn(i32) = |i| assert_eq!(i, 2); g(2); g(2); g(2); } </ins>
Change:
<!-- [31mICE[0m: Rustc '-Zmir-opt-level=0 -Zpolymorphize=on -Zinline-mir=yes -ooutputfile -Zdump-mir-dir=dir' 'thread 'rustc' panicked at 'index out of bounds: the len is 6 but the index is 6'', 'thread 'rustc' panicked at 'index out of bounds: the len is 6 but the index is 6'' File: --auto-reduced (treereduce-rust): original: Version information ` Command: <!-- Include a backtrace in the code block by setting in your environment. E.g. . --<details<summary<strongProgram output</strong</summary<p</p</details<!-- query stack: [optimizedmir] optimizing MIR for [unusedgenericparams] determining which generic parameters are unused by [analysis] running analysis passes on this crate --
cc

Discussion:
use crate::deref_separator::deref_finder; use rustc_attr::InlineAttr; use rustc_const_eval::transform::validate::validate_types; <ins> use rustc_hir::def::DefKind; </ins> use rustc_hir::def_id::DefId; use rustc_index::bit_set::BitSet; use rustc_index::Idx;

} let fn_sig = self.tcx.fn_sig(def_id).instantiate(self.tcx, args); <ins> // Additionally, check that the body that we're inlining actually agrees // with the ABI of the trait that the item comes from. if let InstanceDef::Item(instance_def_id) = callee.def && self.tcx.def_kind(instance_def_id) == DefKind::AssocFn && let instance_fn_sig = self.tcx.fn_sig(instance_def_id).skip_binder() && instance_fn_sig.abi() != fn_sig.abi() { return None; } </ins> let source_info = SourceInfo { span: fn_span, ..terminator.source_info }; return Some(CallSite { callee, fn_sig, block: bb, source_info });

<ins> // compile-flags: -Zpolymorphize=on -Zinline-mir=yes -Zmir-opt-level=0 #![feature(fn_traits, unboxed_closures)] struct Foo<T>(T); impl<T: Copy> Fn<()> for Foo<T> { extern "C" fn call(&self, _: ()) -> T { //~^ ERROR method `call` has an incompatible type for trait match *self { Foo(t) => t, } } } impl<T: Copy> FnMut<()> for Foo<T> { extern "rust-call" fn call_mut(&mut self, _: ()) -> T { self.call(()) } } impl<T: Copy> FnOnce<()> for Foo<T> { type Output = T; extern "rust-call" fn call_once(self, _: ()) -> T { self.call(()) } } fn main() { let t: u8 = 1; println!("{}", Foo(t)()); } </ins>

<ins> error[E0053]: method `call` has an incompatible type for trait --> $DIR/inline-wrong-abi.rs:7:5 | LL |     extern "C" fn call(&self, _: ()) -> T { |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected "rust-call" fn, found "C" fn | = note: expected signature `extern "rust-call" fn(&Foo<_>, ()) -> _` found signature `extern "C" fn(&Foo<_>, ()) -> _` error: aborting due to 1 previous error For more information about this error, try `rustc --explain E0053`. </ins>
Change:
<!-- Thank you for finding an Internal Compiler Error! If possible, try to provide a minimal verifiable example. You can read "Rust Bug Minimization Patterns" for how to create smaller examples. --Original code Auto reduced but does no longer compile: <!-- If you're using the stable version of the compiler, you should also check if the bug also exists in the beta or nightly versions. --: `rustdoc -Znormalize-docs <!-- Include a backtrace in the code block by setting in your environment. E.g. . --<details<summary<strongBacktrace</strong</summary<p</p</details
can you share the stack trace? the part that says is actually what's needed to debug this lol
nvm, found it

Discussion:
} } <del> Some(cx.enter_alias(args, def_id.to_def_id(), |cx| clean_ty(&ty, cx))) </del> <ins> Some(cx.enter_alias(args, def_id.to_def_id(), |cx| { cx.with_param_env(def_id.to_def_id(), |cx| clean_ty(&ty, cx)) })) </ins> } pub(crate) fn clean_ty<'tcx>(ty: &hir::Ty<'tcx>, cx: &mut DocContext<'tcx>) -> Type {

<ins> // check-pass // compile-flags: -Znormalize-docs trait Woo<T> { type Assoc; } impl<T> Woo<T> for () { type Assoc = (); } type Alias<P> = <() as Woo<P>>::Assoc; pub fn hello<S>() -> Alias<S> {} </ins>
Change:
<!-- Thank you for filing a regression report! A regression is something that changed between versions of Rust but was not supposed to. Please provide a short summary of the regression, along with any information you feel is relevant to replicate it. --I tried this code: I expected to see this happen: it compiles with being reachable through . Instead, this happened: <!-- Provide the most recent version this worked on, for example: It most recently worked on: Rust 1.47 --It most recently worked on: : modify labels: +regression-from-stable-to-nightly +A-const-eval +T-compiler -regression-untriaged
Like , this issue is not contrived since I also use this technique in in code generation for benchmarks of generic functions, specifically for caching via . The simple example I gave is just a minimal reproduction of the issue. This appears to happen with any internally-mutable types such as .
Yea, this is a duplicate of
this seems similar but the error messages suggest to me that it's not a duplicate. This is about referencing mutable data while the other is a cycle caused by self-referencing.
Let's keep it open an check
Yeah it's the same root cause; adds a test.

Discussion:
<ins> // check-pass #![allow(non_camel_case_types, non_upper_case_globals, static_mut_ref)] pub struct wl_interface { pub version: i32 } pub struct Interface { pub other_interfaces: &'static [&'static Interface], pub c_ptr: Option<&'static wl_interface>, } pub static mut wl_callback_interface: wl_interface = wl_interface { version: 0, }; pub static WL_CALLBACK_INTERFACE: Interface = Interface { other_interfaces: &[], c_ptr: Some(unsafe { &wl_callback_interface }), }; // This static contains a promoted that points to a static that points to a mutable static. pub static WL_SURFACE_INTERFACE: Interface = Interface { other_interfaces: &[&WL_CALLBACK_INTERFACE], c_ptr: None, }; // And another variant of the same thing, this time with interior mutability. use std::sync::OnceLock; static LAZY_INIT: OnceLock<u32> = OnceLock::new(); static LAZY_INIT_REF: &[&OnceLock<u32>] = &[&LAZY_INIT]; fn main() {} </ins>
Change:
<!-- [31mICE[0m: Rustc '' 'thread 'rustc' panicked at 'index out of bounds: the len is 1 but the index is 1'', 'thread 'rustc' panicked at 'index out of bounds: the len is 1 but the index is 1'' File: --auto-reduced (treereduce-rust): original: Version information ` Command: <!-- Include a backtrace in the code block by setting in your environment. E.g. . --<details<summary<strongProgram output</strong</summary<p</p</details<!-- query stack: [mirborrowck] borrow-checking [analysis] running analysis passes on this crate --
cc
label +D-diagnostic-infra -needs-triage

Discussion:
), .. }) => { <del> let hir::Ty { span, .. } = inputs[local.index() - 1]; </del> <ins> let hir::Ty { span, .. } = *inputs.get(local.index() - 1)?; </ins> Some(span) } _ => None,

<ins> trait Hello { fn example(val: ()); } struct Test1(i32); impl Hello for Test1 { fn example(&self, input: &i32) { //~^ ERROR `&self` declaration in the impl, but not in the trait *input = self.0; //~^ ERROR cannot assign to `*input`, which is behind a `&` reference } } fn main() {} </ins>

<ins> error[E0185]: method `example` has a `&self` declaration in the impl, but not in the trait --> $DIR/argument_number_mismatch_ice.rs:8:5 | LL |     fn example(val: ()); |     -------------------- trait method declared without `&self` ... LL |     fn example(&self, input: &i32) { |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `&self` used in impl error[E0594]: cannot assign to `*input`, which is behind a `&` reference --> $DIR/argument_number_mismatch_ice.rs:10:9 | LL |         *input = self.0; |         ^^^^^^^^^^^^^^^ `input` is a `&` reference, so the data it refers to cannot be written error: aborting due to 2 previous errors Some errors have detailed explanations: E0185, E0594. For more information about an error, try `rustc --explain E0185`. </ins>
Change:
I believe this code is well defined. It runs successfully in Miri with . However, since (nightly-2024-02-14), the following deny-by-default lint is triggered in : Rustc thinks the is 0 bytes, whereas for the purpose of the memory model as I understand it, it has a runtime size that is bigger than 0 bytes.
The here is the size reported at compile time, which obviously doesn't make sense with DST, the lint implementation should be gated on the types being sized. (to be honest, I completely forgot about this). There should probably be an somewhere after this
My code is also regressing in this: Gives the error on nightly This doesn't involve DST though. But the pattern is the same as we just go through a which shouldn't count as a dereference.
Your sample code is as far as I can tell UB and with the lint. <subIf you want to continue this conversation, let's create a new issue as to not diverge this specific issue.</sub
WG-prioritization assigning priority (). label -I-prioritize +P-high

Discussion:
} let from_layout = cx.layout_of(*inner_start_ty).ok()?; <ins> // if the type isn't sized, we bail out, instead of potentially giving // the user a meaningless warning. if from_layout.is_unsized() { return None; } </ins> let alloc_layout = cx.layout_of(alloc_ty).ok()?; let to_layout = cx.layout_of(*inner_end_ty).ok()?;

//~^ ERROR casting references to a bigger memory layout } <ins> { let x: Box<dyn Send> = Box::new(0i32); let _z = unsafe { &*(&*x as *const dyn Send as *const i32) }; } </ins> unsafe fn from_ref(this: &i32) -> &i64 { &*(this as *const i32 as *const i64) }