jiebi/CodeConvo huggingface dataset:
Change:
The final summary at the end says we ran 28 tests when we ran thousands.
Interesting, is the code for buildbot in src/test?
This code is part of the build system. is the place to start looking. The code for recording the number of tests is probably in .
Thanks brson, You were right, the code is in extra::test. Do I execute the tests through:
I'll pick this up, unless it's still in-progress or has been fixed already.
Go for it, I'd love to see what you come up with!

Discussion:
summaries = [] def summarise(fname): summary = {} <del> fd = open(fname) for line in fd: status, test = line.strip().split(' ', 1) if not summary.has_key(status): summary[status] = [] summary[status].append(test) summaries.append((fname, summary)) </del> <ins> with open(fname) as fd: for line in fd: splitline = line.strip().split(' ') if len(splitline) == 1: continue status = splitline[0] test = splitline[-1] # track bench runs if splitline[1] == 'ns/iter': status = 'bench' if not summary.has_key(status): summary[status] = [] summary[status].append(test) summaries.append((fname, summary)) </ins> def count(t): return sum(map(lambda (f, s): len(s.get(t, [])), summaries)) logfiles = sys.argv[1:]

ok = count('ok') failed = count('failed') ignored = count('ignored') <del> print "summary of %d test runs: %d passed; %d failed; %d ignored" %  (len(logfiles), ok, failed, ignored) </del> <ins> measured = count('bench') print "summary of %d test runs: %d passed; %d failed; %d ignored; %d measured" %  (len(logfiles), ok, failed, ignored, measured) </ins> print "" if failed > 0: print "failed tests:"

match self.log_out { None => (), Some(ref mut o) => { <del> let s = format!("{} {}", match *result { </del> <ins> let s = format!("{} {}n", match *result { </ins> TrOk => ~"ok", TrFailed => ~"failed", TrIgnored => ~"ignored",
Change:
<!-- Thank you for filing a bug report! Please provide a short summary of the bug, along with any information you feel relevant to replicating the bug. --I have the following code, split into two files: This code, as expected, produces , shown below. However, the help message at the bottom of the error appears to be referencing line 2 in , while displaying the filename , thus suggesting we add the annotation to a comment in . It should instead point to the in . <!-- 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. --: <!-- TRIAGEBOTSTART --<!-- TRIAGEBOTASSIGNSTART --<!-- TRIAGEBOTASSIGNDATASTARTTRIAGEBOTASSIGNDATAEND --<!-- TRIAGEBOTASSIGNEND --<!-- TRIAGEBOTEND --
claim
The issue is that in , the span we use to look up the file/line mapper is the primary span of the message, i.e. the error in

Discussion:
// We special case `#[derive(_)]n` and other attribute suggestions, because those // are the ones where context is most useful. let file_lines = sm <del> .span_to_lines(span.primary_span().unwrap().shrink_to_hi()) </del> <ins> .span_to_lines(parts[0].span.shrink_to_hi()) </ins> .expect("span_to_lines failed when emitting suggestion"); let line_num = sm.lookup_char_pos(parts[0].span.lo()).line; if let Some(line) = file_lines.file.get_line(line_num - 1) {

--> $DIR/auxiliary/dummy_lib.rs:2:1 | 2   + #[derive(Debug)] <del> 3   | #[path = "auxiliary/dummy_lib.rs"] </del> <ins> 3   | pub struct Dummy; </ins> | error: aborting due to previous error
Change:
Sometimes when rustc dumps an ICE backtrace to disk, the file only contains I have yet to find what actual file/ice causes this, its a bit tricky since there is no mapping from ice file to the actual .rs that was used to cause the ICE. cc
Is this from a test case in the suite that's ICEing? I would like to try and reproduce this.
It looks like this is related to panics that happen during panics: With that file and the listed flags, you will get 3 stacktraces in stderr, but only one in the file:
The original finding was from one of the files in :sweat_smile:
That actually makes sense to me, I'll have to dig into it, but it sounds like it might be straightforward to fix. Edit: wait, re your last comment, did this new machinery regressed a previously fixed ICE, or is it an expected ICE that the new machinery didn't handle gracefully?
nono, not that I know, the directory is just full of files where plain does not crash anymore, but icemaker can use spicy -Z flags or different executables like rustdoc, rustfmt, clippy, miri, kani, cranelift that cause ices even in the directory :)
This happens exclusively for because they have their own machinery to print their own (more useful) backtrace. Looking into it.
Hm, I also just noticed, when for example clippy panics (you can force that with a delayspanbug attr), we also generate an empty file :/ ` repro
I believe that fixes the situation for all cases detected, both delayed span bugs and panic during panic.

Discussion:
let backtrace = std::env::var_os("RUST_BACKTRACE").map_or(true, |x| &x != "0"); for bug in bugs { if let Some(file) = self.ice_file.as_ref() <del> && let Ok(mut out) = std::fs::File::options().append(true).open(file) </del> <ins> && let Ok(mut out) = std::fs::File::options().create(true).append(true).open(file) </ins> { let _ = write!( &mut out, <del> "nndelayed span bug: {}n{}", </del> <ins> "delayed span bug: {}n{}n", </ins> bug.inner.styled_message().iter().filter_map(|(msg, _)| msg.as_str()).collect::<String>(), &bug.note );

}; if let Some(path) = path <del> && let Ok(mut out) = crate::fs::File::options().create(true).write(true).open(&path) </del> <ins> && let Ok(mut out) = crate::fs::File::options().create(true).append(true).open(&path) </ins> { write(&mut out, BacktraceStyle::full()); }
Change:
Create an empty crate, add to dependencies, and . [ ] Previous Stable [ ] Current Stable [X] Current Beta [X] Current Nightly Discovered on since 1.72.0-nightly ( 2023-07-03). The previous version 2023-07-02 is good. The breaking day is the same as . I suspect this is also related to . But fix to that does NOT fix this ICE though. cc The error message is similar to , but that occurs on an earlier version 2023-06-28. I guess it's unrelated.
label regression-from-stable-to-beta
WG-prioritization assigning priority (). label -I-prioritize +P-medium

Discussion:
args: GenericArgsRef<'tcx>, ) -> FfiResult<'tcx> { let field_ty = field.ty(self.cx.tcx, args); <del> if field_ty.has_opaque_types() { self.check_type_for_ffi(cache, field_ty) } else { let field_ty = self.cx.tcx.normalize_erasing_regions(self.cx.param_env, field_ty); self.check_type_for_ffi(cache, field_ty) } </del> <ins> let field_ty = self .cx .tcx .try_normalize_erasing_regions(self.cx.param_env, field_ty) .unwrap_or(field_ty); self.check_type_for_ffi(cache, field_ty) </ins> } /// Checks if the given `VariantDef`'s field types are "ffi-safe".

if let Some(ty) = self .cx .tcx <del> .normalize_erasing_regions(self.cx.param_env, ty) </del> <ins> .try_normalize_erasing_regions(self.cx.param_env, ty) .unwrap_or(ty) </ins> .visit_with(&mut ProhibitOpaqueTypes) .break_value() {

is_static: bool, is_return_type: bool, ) { <del> // We have to check for opaque types before `normalize_erasing_regions`, // which will replace opaque types with their underlying concrete type. </del> if self.check_for_opaque_ty(sp, ty) { // We've already emitted an error due to an opaque type. return; } <del> // it is only OK to use this function because extern fns cannot have // any generic types right now: let ty = self.cx.tcx.normalize_erasing_regions(self.cx.param_env, ty); </del> <ins> let ty = self.cx.tcx.try_normalize_erasing_regions(self.cx.param_env, ty).unwrap_or(ty); </ins> // C doesn't really support passing arrays by value - the only way to pass an array by value // is through a struct. So, first test that the top level isn't an array, and then

<ins> // check-pass // Extending `improper_ctypes` to check external-ABI fn-ptrs means that it can encounter // projections which cannot be normalized - unsurprisingly, this shouldn't crash the compiler. trait Bar { type Assoc; } type Foo<T> = extern "C" fn() -> <T as Bar>::Assoc; fn main() {} </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. --<!-- 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. --: <!-- Include a backtrace in the code block by setting in your environment. E.g. . --<details<summary<strongBacktrace</strong</summary<p</p</details
Regression in nightly-2023-07-11 Regression in cc ^^
This is possibly fixed by , or alternatively . I'll have to look into it, but I'll look into it regardless by tomorrow.

Discussion:
); ocx.resolve_regions_and_report_errors(impl_m_def_id, &outlives_env)?; <del> let mut collected_tys = FxHashMap::default(); </del> <ins> let mut remapped_types = FxHashMap::default(); </ins> for (def_id, (ty, args)) in collected_types { match infcx.fully_resolve((ty, args)) { Ok((ty, args)) => {

Ok(ty) => ty, Err(guar) => Ty::new_error(tcx, guar), }; <del> collected_tys.insert(def_id, ty::EarlyBinder::bind(ty)); </del> <ins> remapped_types.insert(def_id, ty::EarlyBinder::bind(ty)); </ins> } Err(err) => { let reported = tcx.sess.delay_span_bug( return_span, format!("could not fully resolve: {ty} => {err:?}"), ); <del> collected_tys.insert(def_id, ty::EarlyBinder::bind(Ty::new_error(tcx, reported))); </del> <ins> remapped_types.insert(def_id, ty::EarlyBinder::bind(Ty::new_error(tcx, reported))); </ins> } } } <del> Ok(&*tcx.arena.alloc(collected_tys)) </del> <ins> // We may not collect all RPITITs that we see in the HIR for a trait signature // because an RPITIT was located within a missing item. Like if we have a sig // returning `-> Missing<impl Sized>`, that gets converted to `-> [type error]`, // and when walking through the signature we end up never collecting the def id // of the `impl Sized`. Insert that here, so we don't ICE later. for assoc_item in tcx.associated_types_for_impl_traits_in_associated_fn(trait_m.def_id) { if !remapped_types.contains_key(assoc_item) { remapped_types.insert( *assoc_item, ty::EarlyBinder::bind(Ty::new_error_with_message( tcx, return_span, "missing synthetic item for RPITIT", )), ); } } Ok(&*tcx.arena.alloc(remapped_types)) </ins> } struct ImplTraitInTraitCollector<'a, 'tcx> {

<ins> // issue: 113903 #![feature(return_position_impl_trait_in_trait)] use std::ops::Deref; pub trait Tr { fn w() -> impl Deref<Target = Missing<impl Sized>>; //~^ ERROR cannot find type `Missing` in this scope } impl Tr for () { fn w() -> &'static () { &() } } fn main() {} </ins>

<ins> error[E0412]: cannot find type `Missing` in this scope --> $DIR/rpitit-shadowed-by-missing-adt.rs:8:35 | LL |     fn w() -> impl Deref<Target = Missing<impl Sized>>; |                                   ^^^^^^^ not found in this scope error: aborting due to previous error For more information about this error, try `rustc --explain E0412`. </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. --need <!-- 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. --: <!-- Include a backtrace in the code block by setting in your environment. E.g. . --<details<summary<strongBacktrace</strong</summary<p</p</details
Crashes on but not on
Regression in nightly-2023-07-01 Regression in Regression in cc
reduced:
WG-prioritization assigning priority (). label -I-prioritize +P-medium

Discussion:
initial_binding.res() }); let res = binding.res(); <ins> if res == Res::Err || !this.ambiguity_errors.is_empty() { this.tcx .sess .delay_span_bug(import.span, "some error happened for an import"); return; } </ins> if let Ok(initial_res) = initial_res { <del> if res != initial_res && this.ambiguity_errors.is_empty() { </del> <ins> if res != initial_res { </ins> span_bug!(import.span, "inconsistent resolution for an import"); } <del> } else if res != Res::Err && this.ambiguity_errors.is_empty() && this.privacy_errors.is_empty() { </del> <ins> } else if this.privacy_errors.is_empty() { </ins> this.tcx .sess .create_err(CannotDetermineImportResolution { span: import.span })

<ins> // edition: 2021 use u8 as imported_u8; use unresolved as u8; //~^ ERROR unresolved import `unresolved` fn main() {} </ins>

<ins> error[E0432]: unresolved import `unresolved` --> $DIR/issue-113953.rs:3:5 | LL | use unresolved as u8; |     ^^^^^^^^^^^^^^^^ no external crate `unresolved` error: aborting due to previous error For more information about this error, try `rustc --explain E0432`. </ins>
Change:
This line in my project currently causes an unimplemented expression error, told me to submit an issue

Discussion:
None => { return true; } <ins> Some(mc::AliasableStaticMut) => { return true; } </ins> Some(cause) => { this.bccx.report_aliasability_violation( expr.span,

} } } <ins> ExprVstore(_, ExprVstoreMutSlice) | </ins> ExprVstore(_, ExprVstoreSlice) | ExprVec(_, MutImmutable) | ExprAddrOf(MutImmutable, _) |

ast::ExprVstore(_, ast::ExprVstoreSlice) => { visit::walk_expr(self, e, is_const); } <ins> ast::ExprVstore(_, ast::ExprVstoreMutSlice) => { self.tcx.sess.span_err(e.span, "static items are not allowed to have mutable slices"); }, </ins> ast::ExprUnary(ast::UnBox, _) => { self.tcx.sess.span_err(e.span, "static items are not allowed to have managed pointers");

use back::abi; <del> use lib::llvm::{llvm, ConstFCmp, ConstICmp, SetLinkage, PrivateLinkage, ValueRef, Bool, True}; </del> <ins> use lib::llvm::{llvm, ConstFCmp, ConstICmp, SetLinkage, PrivateLinkage, ValueRef, Bool, True, False}; </ins> use lib::llvm::{IntEQ, IntNE, IntUGT, IntUGE, IntULT, IntULE, IntSGT, IntSGE, IntSLT, IntSLE, RealOEQ, RealOGT, RealOGE, RealOLT, RealOLE, RealONE};

is_local); (v, inlineable) } <del> ast::ExprVstore(sub, ast::ExprVstoreSlice) => { </del> <ins> ast::ExprVstore(sub, store @ ast::ExprVstoreSlice) | ast::ExprVstore(sub, store @ ast::ExprVstoreMutSlice) => { </ins> match sub.node { ast::ExprLit(ref lit) => { match lit.node {

llvm::LLVMAddGlobal(cx.llmod, llty.to_ref(), name) }); llvm::LLVMSetInitializer(gv, cv); <del> llvm::LLVMSetGlobalConstant(gv, True); </del> <ins> llvm::LLVMSetGlobalConstant(gv, if store == ast::ExprVstoreMutSlice { False } else { True }); </ins> SetLinkage(gv, PrivateLinkage); let p = const_ptrcast(cx, gv, llunitty); (C_struct([p, C_uint(cx, es.len())], false), false)

<ins> // Copyright 2014 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your // option. This file may not be copied, modified, or distributed // except according to those terms. // Checks that immutable static items can't have mutable slices static TEST: &'static mut [int] = &mut []; //~^ ERROR static items are not allowed to have mutable slices pub fn main() { } </ins>

<ins> // Copyright 2014 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your // option. This file may not be copied, modified, or distributed // except according to those terms. // Checks that mutable static items can have mutable slices static mut TEST: &'static mut [int] = &mut [1]; pub fn main() { unsafe { TEST[0] += 1; assert_eq!(TEST[0], 2); } } </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. --<!-- 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. --: <!-- Include a backtrace in the code block by setting in your environment. E.g. . --<details<summary<strongBacktrace</strong</summary<p</p</details<!-- TRIAGEBOTSTART --<!-- TRIAGEBOTASSIGNSTART --<!-- TRIAGEBOTASSIGNDATASTARTTRIAGEBOTASSIGNDATAEND --<!-- TRIAGEBOTASSIGNEND --<!-- TRIAGEBOTEND --
claim
label A-sanitizers

Discussion:
use rustc_data_structures::fx::FxHashMap; use rustc_middle::bug; <del> use rustc_middle::ty::{self, Instance, Ty, TyCtxt, TypeFoldable}; </del> <ins> use rustc_middle::ty::{self, Instance, Ty, TyCtxt, TypeFoldable, TypeVisitableExt}; </ins> use rustc_target::abi::call::{Conv, FnAbi, PassMode}; use tracing::instrument;

instance: Instance<'tcx>, options: TypeIdOptions, ) -> String { <ins> assert!(!instance.has_non_region_param(), "{instance:#?} must be fully monomorphic"); </ins> let transform_ty_options = TransformTyOptions::from_bits(options.bits()) .unwrap_or_else(|| bug!("typeid_for_instance: invalid option(s) `{:?}`", options.bits())); let instance = transform_instance(tcx, instance, transform_ty_options); let fn_abi = tcx <del> .fn_abi_of_instance(tcx.param_env(instance.def_id()).and((instance, ty::List::empty()))) </del> <ins> .fn_abi_of_instance(ty::ParamEnv::reveal_all().and((instance, ty::List::empty()))) </ins> .unwrap_or_else(|error| { bug!("typeid_for_instance: couldn't get fn_abi of instance {instance:?}: {error:?}") });

<ins> //@ needs-sanitizer-cfi //@ compile-flags: -Ccodegen-units=1 -Clto -Ctarget-feature=-crt-static -Zsanitizer=cfi //@ no-prefer-dynamic //@ only-x86_64-unknown-linux-gnu //@ build-pass // See comment below for why this test exists. trait Tr<U> { type Projection; } impl<F, U> Tr<U> for F where F: Fn() -> U { type Projection = U; } fn test<B: Tr<U>, U>(b: B) -> B::Projection { todo!() } fn main() { fn rpit_fn() -> impl Sized {} // When CFI runs, it tries to compute the signature of the call. This // ends up giving us a signature of: //     `fn test::<rpit_fn, ()>() -> <rpit_fn as Tr<()>>::Projection`, // where `rpit_fn` is the ZST FnDef for the function. However, we were // previously using a Reveal::UserFacing param-env. This means that the // `<rpit_fn as Tr<()>>::Projection` return type is impossible to normalize, // since it would require proving `rpit_fn: Fn() -> ()`, but we cannot // prove that the `impl Sized` opaque is `()` with a user-facing param-env. // This leads to a normalization error, and then an ICE. // // Side-note: // So why is the second generic of `test` "`()`", and not the // `impl Sized` since we inferred it from the return type of `rpit_fn` // during typeck? Well, that's because we're using the generics from the // terminator of the MIR, which has had the RevealAll pass performed on it. let _ = test(rpit_fn); } </ins>
Change:
Sorry in advance, this is going to be a pretty poor bug report as I don't have much time to look into this at the moment, but I did want to create an issue for it. asyncfnintrait asynciterator constmutrefs constoption constweaknew docautocfg doccfghide extractif impltraitinassoctype iosliceadvance issorted maybeuninitarrayassumeinit maybeuninituninitarray maybeuninitwriteslice nevertype newuninit noopwaker ptrmetadata stmtexprattributes wakergetters I found that I can reproduce it in public code as well: Running fails, specifically this example: : <!-- Include a backtrace in the code block by setting in your environment. E.g. . --<details<summary<strongBacktrace</strong</summary<p</p</details
Minimzed to: This now errors with "unexpected unsized tail: usize", but i think that should be alright (?). If someone really needs the original error, I might have it lying around somewhere.
Triage: The above minimal code now compiles successfully on 1.77.0-nightly (2023-12-24 ), so this issue may have been fixed or may need a new MCVE.
Can confirm that this has been resolved. Do we want to keep this open to add a regression test? Otherwise I'm fine with closing.
If the issue is fixed in and your private code, then let's use the MCVE above to add a regression test. label -E-needs-mcve +E-needs-test

Discussion:
<ins> // This is a non-regression test for issue #114325: an "unexpected unsized tail" ICE happened during // codegen, and was fixed by MIR drop tracking #107421. // edition: 2021 // build-pass: ICEd during codegen. #![feature(impl_trait_in_assoc_type)] use std::future::Future; fn main() { RuntimeRef::spawn_local(actor_fn(http_actor)); } async fn http_actor() { async fn respond(body: impl Body) { body.write_message().await; } respond(&()).await; } trait Body { type WriteFuture: Future; fn write_message(self) -> Self::WriteFuture; } impl Body for &'static () { type WriteFuture = impl Future<Output = ()>; fn write_message(self) -> Self::WriteFuture { async {} } } trait NewActor { type RuntimeAccess; } fn actor_fn<T, A>(_d: T) -> (T, A) { loop {} } impl<F: FnMut() -> A, A> NewActor for (F, A) { type RuntimeAccess = RuntimeRef; } struct RuntimeRef(Vec<()>); impl RuntimeRef { fn spawn_local<NA: NewActor<RuntimeAccess = RuntimeRef>>(_f: NA) { struct ActorFuture<NA: NewActor>(NA::RuntimeAccess); (ActorFuture::<NA>(RuntimeRef(vec![])), _f); } } </ins>
Change:
The following code should be optimized to a no-op afaict, but instead gives: (this is true on stable, beta and nightly). I think a blocking point here is that rustc/LLVM do not manage to infer the invariant: Note that the version with asserts for this invariant removes the useless conditional call to but instead gets useless calls to assert failure code.
I think there are two issues here: the invariant isn't encoded anywhere inside the push and pop methods llvm's constraint elimination pass (in llvm 16) isn't smart enough to figure these things out (even with the s) The first issue can be fixed by adding s to push and pop. The second one is somewhat tricky, however we are fortunate that this has been improved somewhat already in upstream llvm: (c++ reproducer, so it's not directly visible that the constraint elimination pass got improved) (llvm-ir)
Thanks for investigating! Unfortunately your code is equivalent to this Rust code which gets correctly optimized (): I'm not proficient in C++ but I'll try to find an example closer to Rust.
This gets correctly optimized, I'll try a PR to add the assume to and see how it does on benchmarks.
Just ran into which seems similar
Also

Discussion:
} else { unsafe { self.len -= 1; <ins> core::intrinsics::assume(self.len < self.capacity()); </ins> Some(ptr::read(self.as_ptr().add(self.len()))) } }

<ins> // compile-flags: -O #![crate_type = "lib"] #[no_mangle] // CHECK-LABEL: @noop( pub fn noop(v: &mut Vec<u8>) { // CHECK-NOT: reserve_for_push // CHECK-NOT: call // CHECK: tail call void @llvm.assume // CHECK-NOT: reserve_for_push // CHECK-NOT: call // CHECK: ret if let Some(x) = v.pop() { v.push(x) } } #[no_mangle] // CHECK-LABEL: @push_byte( pub fn push_byte(v: &mut Vec<u8>) { // CHECK: call {{.*}}reserve_for_push v.push(3); } </ins>