jiebi/CodeConvo huggingface dataset:
Change:
Originally reported as , but the actual bug affects every libraries and platforms. generates the linker command . Without it correctly doesn't link whole archive. It is expected to link whole archive only if passing modifier.
or whoever wants to look at linkage troubles today
Looks like it is a back compat hack:
Not sure to understand why tests are special, but it's intentional from indeed. Feels like a bad workaround for missing +whole-archive modifiers in some projects?
My reading from the code comment is that you can't aren't allowed to use for tests of rlib crates at all, not that some projects are missing it.
Why is that not allowed? That would be the root issue then?
It seems like and are not compatible with each other for rlibs. Someone else may know better why this is the case. It's been a while since I last looked at this code.
The combination was recently stabilized in so it may be possible to remove this hack now. We'll just need to run crater, send fixes to affected crates, and all that stuff.
Fixed in

Discussion:
NativeLibKind::Static { bundle, whole_archive } => { if link_static { let bundle = bundle.unwrap_or(true); <del> let whole_archive = whole_archive == Some(true) // Backward compatibility case: this can be a rlib (so `+whole-archive` // cannot be added explicitly if necessary, see the error in `fn link_rlib`) // compiled as an executable due to `--test`. Use whole-archive implicitly, // like before the introduction of native lib modifiers. || (whole_archive == None && bundle && cnum == LOCAL_CRATE && sess.is_test_crate()); </del> <ins> let whole_archive = whole_archive == Some(true); </ins> if bundle && cnum != LOCAL_CRATE { if let Some(filename) = lib.filename { // If rlib contains native libs as archives, they are unpacked to tmpdir.

to `/WHOLEARCHIVE` for `link.exe`, and to `-force_load` for `ld64`. The modifier does nothing for linkers that don't support it. <del> The default for this modifier is `-whole-archive`.  NOTE: The default may currently be different in some cases for backward compatibility, but it is not guaranteed. If you need whole archive semantics use `+whole-archive` explicitly. </del> <ins> The default for this modifier is `-whole-archive`. </ins> ### Linking modifiers: `bundle`
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. -- <p<details</p</details<!-- 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</detailsBuild with
can reproduce
can you include a and (for example as a link to a project (+commit), or right here), to be able to reproduce this in the future?
Sorry, forgot to add those, I've attached them
does needs MCVE mean an example not relying on tokio?
yes
Ran a bisect. searched nightlies: from to regressed nightly: searched commit range: ... regressed commit: <details<summarybisected with <a href=''cargo-bisect-rustc</av0.6.7</summaryHost triple: x86_64-unknown-linux-gnu Reproduce with: </details
Spent some unforgettable time chopping down 80k lines of tokio code piece by piece, but it was worth it, I hope. Here's an MCVE: : :
Since this seems to be somehow caused by mir drop tracking, cc
WG-prioritization assigning priority (). label -I-prioritize +P-high

Discussion:
//! Otherwise it drops all the values in scope at the last suspension point. use crate::abort_unwinding_calls; <del> use crate::add_call_guards; </del> use crate::deref_separator::deref_finder; use crate::errors; use crate::pass_manager as pm;

simplify::remove_dead_blocks(&mut body); // Update the body's def to become the drop glue. <del> // This needs to be updated before the AbortUnwindingCalls pass. </del> let coroutine_instance = body.source.instance; let drop_in_place = tcx.require_lang_item(LangItem::DropInPlace, None); let drop_instance = InstanceDef::DropGlue(drop_in_place, Some(coroutine_ty)); <del> body.source.instance = drop_instance; pm::run_passes_no_validate( tcx, &mut body, &[&abort_unwinding_calls::AbortUnwindingCalls, &add_call_guards::CriticalCallEdges], None, ); </del> // Temporary change MirSource to coroutine's instance so that dump_mir produces more sensible // filename.

let mut body = EarlyBinder::bind(body.clone()).instantiate(tcx, args); debug!("make_shim({:?}) = {:?}", instance, body); <del> // Run empty passes to mark phase change and perform validation. </del> pm::run_passes( tcx, &mut body, <del> &[], </del> <ins> &[ &abort_unwinding_calls::AbortUnwindingCalls, &add_call_guards::CriticalCallEdges, ], </ins> Some(MirPhase::Runtime(RuntimePhase::Optimized)), );

<ins> // compile-flags: -Cpanic=unwind  --crate-type=lib // no-prefer-dynamic // edition:2021 #![feature(coroutines)] pub fn run<T>(a: T) { let _ = move || { drop(a); yield; }; } </ins>

<ins> // Ensure that coroutine drop glue is valid when mixing different panic // strategies. Regression test for #116953. // // no-prefer-dynamic // build-pass // aux-build:unwind-aux.rs // compile-flags: -Cpanic=abort // needs-unwind extern crate unwind_aux; pub fn main() { unwind_aux::run(String::new()); } </ins>
Change:
I tried these commands: I expected to see this happen: Compiles Instead, this happened: Rustc SIGSEGV's. It most recently worked on: nightly-2023-10-09 <!-- Provide the version you are using that has the regression. --: <!-- Did the compiler crash? If so, please provide a backtrace. --<!-- Include a backtrace in the code block by setting in your environment. E.g. . --<details<summaryBacktrace</summary<p</p</details<!-- If you know when this regression occurred, please add a line like below, replacing with one of stable, beta, or nightly. modify labels: +regression-from-stable-to-{channel} -regression-untriaged --<!-- TRIAGEBOTSTART --<!-- TRIAGEBOTASSIGNSTART --<!-- TRIAGEBOTASSIGNDATASTARTTRIAGEBOTASSIGNDATAEND --<!-- TRIAGEBOTASSIGNEND --<!-- TRIAGEBOTEND --
This requires disabling incremental compilation as well as using a custom built sysroot. I'm not passing any weird arguments when building the sysroot and because of the everything is compiled using the regular LLVM backend.
This is causing cgclif's CI to fail as it checks that it's test suite passes with LLVM:
A workaround is: A small reproduction is:
It may be an alias related issue. I am not really sure. But I started trying to address it. claim
WG-prioritization assigning priority (). label -I-prioritize +P-high T-compiler
Possible upstream issue:
Upstream issue: I'm pretty sure I got it right this time.
It is indeed fixed now:

Discussion:
<del> Subproject commit febc39711a7c91560eb0f0980916ae23c343b99d </del> <ins> Subproject commit fef3d7b14ede45d051dc688aae0bb8c8b02a0566 </ins>
Change:
File: auto-reduced (treereduce-rust): &lt;details&lt;summary&lt;strongoriginal code&lt;/strong&lt;/summary&lt;poriginal: 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
additional ices with &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;!-- 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
slightly more reduced

Discussion:
// use nth(1) to skip one layer of desugaring from `IntoIter::into_iter` if let Some((_, hir::Node::Expr(await_expr))) = hir.parent_iter(*hir_id).nth(1) <del> && let Some(expr_span) = expr.span.find_ancestor_inside(await_expr.span) </del> <ins> && let Some(expr_span) = expr.span.find_ancestor_inside_same_ctxt(await_expr.span) </ins> { let removal_span = self .tcx

f!(()); } <ins> // Regression test for issue #117014. async fn desugaring_span_ctxt() { for x in [] {}.await //~ ERROR `()` is not a future } </ins> fn main() {}

= note: required for `()` to implement `IntoFuture` = note: this error originates in the macro `f` (in Nightly builds, run with -Z macro-backtrace for more info) <del> error: aborting due to 3 previous errors </del> <ins> error[E0277]: `()` is not a future --> $DIR/unnecessary-await.rs:36:20 | LL |     for x in [] {}.await |                   -^^^^^ |                   || |                   |`()` is not a future |                   help: remove the `.await` | = help: the trait `Future` is not implemented for `()` = note: () must be a future or must implement `IntoFuture` to be awaited = note: required for `()` to implement `IntoFuture` error: aborting due to 4 previous errors </ins> For more information about this error, try `rustc --explain E0277`.
Change:
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
What is intriguing is that the transmute doesn't fail, as it is a transmute from a 1ZST to a Never-like type, which has no representations. This code is definitely unsound, but I guess this is already a known thing.
Regression in cc
:facepalm: Oops, fix here: Good catch!

Discussion:
cx: &MatchCheckCtxt<'p, 'tcx>, column: &[&DeconstructedPat<'p, 'tcx>], ) -> Vec<WitnessPat<'tcx>> { <ins> if column.is_empty() { return Vec::new(); } </ins> let ty = column[0].ty(); let pcx = &PatCtxt { cx, ty, span: DUMMY_SP, is_top_level: false };

pub fn takes_non_exhaustive(_: NonExhaustiveEnum) { let _closure = |_: NonExhaustiveEnum| {}; } <ins> // ICE #117033 enum Void {} #[deny(non_exhaustive_omitted_patterns)] pub fn void(v: Void) -> ! { match v {} } </ins>
Change:
rustc generally detects when a static type is larger than bytes, giving an error that + 10x80000000isize::MAX + 1`): (The is to ensure that an object of size is actually created on the stack.) This is clearly unsound, since it breaks the size invariant of , and since third-party crates may depend on types being no larger than for soundness. However, it's nontrivial to observe unexpected behavior from this using only safe APIs in the standard library, since placing the overlarge type within any other type, even a wrapper, will result in a compile error as expected, and the standard APIs tend to refer to when creating a slice from a reference.
Wow, good catch! Looks like we're doing the check before rounding up to the next multiple of alignment? That's bad.

Discussion:
// Align the maximum variant size to the largest alignment. size = size.align_to(align.abi); <ins> // FIXME(oli-obk): deduplicate and harden these checks </ins> if size.bytes() >= dl.obj_size_bound() { return None; }

inverse_memory_index.into_iter().map(|it| it.index() as u32).collect() }; let size = min_size.align_to(align.abi); <ins> // FIXME(oli-obk): deduplicate and harden these checks if size.bytes() >= dl.obj_size_bound() { return None; } </ins> let mut layout_of_single_non_zst_field = None; let mut abi = Abi::Aggregate { sized }; // Try to make this a Scalar/ScalarPair.

if layout.size.bytes() % layout.align.abi.bytes() != 0 { bug!("size is not a multiple of align, in the following layout:n{layout:#?}"); } <ins> if layout.size.bytes() >= cx.tcx.data_layout.obj_size_bound() { bug!("size is too large, in the following layout:n{layout:#?}"); } </ins> if !cfg!(debug_assertions) { // Stop here, the rest is kind of expensive.

<ins> // build-fail // compile-flags: --target i686-unknown-linux-gnu --crate-type lib // needs-llvm-components: x86 #![feature(no_core, lang_items)] #![allow(internal_features)] #![no_std] #![no_core] // 0x7fffffff is fine, but after rounding up it becomes too big #[repr(C, align(2))] pub struct Example([u8; 0x7fffffff]); pub fn lib(_x: Example) {} //~ERROR: too big for the current architecture #[lang = "sized"] pub trait Sized {} #[lang = "copy"] pub trait Copy: Sized {} </ins>

<ins> error: values of the type `Example` are too big for the current architecture --> $DIR/too-big-with-padding.rs:13:1 | LL | pub fn lib(_x: Example) {} | ^^^^^^^^^^^^^^^^^^^^^^^ error: aborting due to previous error </ins>
Change:
changed the , and methods of vectors to return an Option instead of failing on empty vectors. These methods should probably get the same change, to be consistent - - -
I'll try to fix this!

Discussion:
// Check if a landing pad block exists; if not, create one. { let mut scopes = self.scopes.borrow_mut(); <del> let last_scope = scopes.get().mut_last(); </del> <ins> let last_scope = scopes.get().mut_last().unwrap(); </ins> match last_scope.cached_landing_pad { Some(llbb) => { return llbb; } None => {

fn mut_iter(self) -> MutItems<'a, T>; /// Returns a mutable pointer to the last item in the vector. <del> fn mut_last(self) -> &'a mut T; </del> <ins> fn mut_last(self) -> Option<&'a mut T>; </ins> /// Returns a reversed iterator that allows modifying each value fn mut_rev_iter(self) -> RevMutItems<'a, T>;

} #[inline] <del> fn mut_last(self) -> &'a mut T { </del> <ins> fn mut_last(self) -> Option<&'a mut T> { </ins> let len = self.len(); <del> if len == 0 { fail!("mut_last: empty vector") } &mut self[len - 1] </del> <ins> if len == 0 { return None; } Some(&mut self[len - 1]) </ins> } #[inline]

let mut y: &mut [int] = []; assert!(y.mut_pop_ref().is_none()); } <ins> #[test] fn test_mut_last() { let mut x = [1, 2, 3, 4, 5]; let h = x.mut_last(); assert_eq!(*h.unwrap(), 5); let mut y: &mut [int] = []; assert!(y.mut_last().is_none()); } </ins> } #[cfg(test)]

} } <del> pub fn mut_last<'a>(&'a mut self) -> &'a mut T { </del> <ins> pub fn mut_last<'a>(&'a mut self) -> Option<&'a mut T> { </ins> match *self { Vec(ref mut v) => v.mut_last(), <del> Empty => fail!("mut_last on empty opt_vec") </del> <ins> Empty => None </ins> } }
Change:
This triggers a stack overflow of rustc (even without the TAIT feature gate, i.e. on stable too) (): <details<summaryBacktrace</summary<p</p</details
(side-note: doesn't overflow in the new trait solver )
I'm gonna look into this

Discussion:
Reveal::All => { let args = data.args.try_fold_with(self)?; let recursion_limit = self.interner().recursion_limit(); if !recursion_limit.value_within_limit(self.anon_depth) { <del> // A closure or coroutine may have itself as in its upvars. // This should be checked handled by the recursion check for opaque // types, but we may end up here before that check can happen. // In that case, we delay a bug to mark the trip, and continue without // revealing the opaque. self.infcx </del> <ins> let guar = self .infcx </ins> .err_ctxt() .build_overflow_error(&ty, self.cause.span, true) .delay_as_bug(); <del> return ty.try_super_fold_with(self); </del> <ins> return Ok(Ty::new_error(self.interner(), guar)); </ins> } let generic_ty = self.interner().type_of(data.def_id);

<ins> #![feature(type_alias_impl_trait)] type T = impl Copy; //~^ ERROR cannot resolve opaque type static STATIC: T = None::<&'static T>; fn main() {} </ins>

<ins> error[E0720]: cannot resolve opaque type --> $DIR/infinite-cycle-involving-weak.rs:3:10 | LL | type T = impl Copy; |          ^^^^^^^^^ cannot resolve opaque type error: aborting due to previous error For more information about this error, try `rustc --explain E0720`. </ins>
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 tried this code (): Somehow in the second case we think that is unconstrained even though it doesn't seem to contain more or less type information than the first case. Note also that this does not error if I use RPIT instead.
I think in the second example mir building doesn't generate code for the trailing expression because it's statically known as dead code. But I thought we were keeping around the typeck types nowadays, and typeck should be the same for both functions
I don't think that's it, same error if I put the match in a branch ():
In fact this doesn't need an empty type at all:
I think we're generating bogus MIR or THIR because of that empty match -- Are you sure the bug doesn't exist on the THIR/MIR building side, (hacked to dump the instead of )
Oh I'm sure of nothing I just assumed an unreachable in a branch would not affect anything else
So: If there's a match error, we end up constructing a failure MIR body. This will prevent us from inferring the opaque later on. edit: that last sentence was a lie Let me see if I can cook up a quick fix.

Discussion:
}; // Use borrowck to get the type with unerased regions. <del> let concrete_opaque_types = &self.tcx.mir_borrowck(item_def_id).concrete_opaque_types; debug!(?concrete_opaque_types); if let Some(&concrete_type) = concrete_opaque_types.get(&self.def_id) { </del> <ins> let borrowck_results = &self.tcx.mir_borrowck(item_def_id); // If the body was tainted, then assume the opaque may have been constrained and just set it to error. if let Some(guar) = borrowck_results.tainted_by_errors { self.found = Some(ty::OpaqueHiddenType { span: DUMMY_SP, ty: Ty::new_error(self.tcx, guar) }); return; } debug!(?borrowck_results.concrete_opaque_types); if let Some(&concrete_type) = borrowck_results.concrete_opaque_types.get(&self.def_id) { </ins> debug!(?concrete_type, "found constraint"); if let Some(prev) = &mut self.found { if concrete_type.ty != prev.ty && !(concrete_type, prev.ty).references_error() {

<ins> #![feature(type_alias_impl_trait)] type Tait = impl Copy; // Make sure that this TAIT isn't considered unconstrained... fn empty_opaque() -> Tait { if false { match empty_opaque() {} //~^ ERROR non-empty } 0u8 } fn main() {} </ins>

<ins> error[E0004]: non-exhaustive patterns: type `Tait` is non-empty --> $DIR/unconstrained-due-to-bad-pattern.rs:8:15 | LL |         match empty_opaque() {} |               ^^^^^^^^^^^^^^ | = note: the matched value is of type `Tait` help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern as shown | LL ~         match empty_opaque() { LL +             _ => todo!(), LL +         } | error: aborting due to previous error For more information about this error, try `rustc --explain E0004`. </ins>
Change:
Check out ICU4X (tested on commit ), and build : However this started happening in our nightly CI since (one nightly before this one). The PR must have landed in the recent past. <!-- Include a backtrace in the code block by setting in your environment. E.g. . --<details<summary<strongBacktrace</strong</summary<p</p</details
Working on bisection, so far I have this
regressed commit: <detailsbash cargo bisect-rustc --start 2023-10-28 --end 2023-10-30 </details
Regression is , cc

Discussion:
<del> use rustc_middle::ty::{self, Ty, TyCtxt, TypeSuperVisitable, TypeVisitable, TypeVisitor}; </del> <ins> use rustc_middle::ty::{ self, Ty, TyCtxt, TypeSuperVisitable, TypeVisitable, TypeVisitableExt, TypeVisitor, }; </ins> use std::ops::ControlFlow;

return ControlFlow::Continue(()); } <ins> // FIXME: Don't consider alias bounds on types that have escaping bound // vars. See #117455. if ty.has_escaping_bound_vars() { return ty.super_visit_with(self); } </ins> match ty.kind() { // We can prove that an alias is live two ways: // 1. All the components are live.

<ins> trait Trait { type Gat<'a: 'b, 'b: 'c, 'c>: 'c; } fn get_func<'a, T: Trait>(_: &'a str) -> fn(T::Gat<'a, '_, 'static>) { loop {} } fn test<T: Trait>() { let func = get_func::<T>(&String::new()); //~ ERROR temporary value dropped drop(func); } fn main() {} </ins>

<ins> error[E0716]: temporary value dropped while borrowed --> $DIR/escaping-bounds-2.rs:10:31 | LL |     let func = get_func::<T>(&String::new()); |                               ^^^^^^^^^^^^^ - temporary value is freed at the end of this statement |                               | |                               creates a temporary value which is freed while still in use LL |     drop(func); |          ---- borrow later used here | help: consider using a `let` binding to create a longer lived value | LL ~     let binding = String::new(); LL ~     let func = get_func::<T>(&binding); | error: aborting due to previous error For more information about this error, try `rustc --explain E0716`. </ins>

<ins> // check-pass // Ensure that we don't ICE when an alias that has escaping bound vars is // required to be live. This is because the code that allows us to deduce an // appropriate outlives bound for a given alias type (in this test, a // projection) does not handle aliases with escaping bound vars. // See <https://github.com/rust-lang/rust/issues/117455>. trait Foo { type Assoc<'a, 'b>: 'static; } struct MentionsLifetimeAndType<'a, T>(&'a (), T); fn foo<'a, 'b, T: Foo>(_: <T as Foo>::Assoc<'a, 'b>) {} fn test<'b, T: Foo>() { let y: MentionsLifetimeAndType<'_, for<'a> fn(<T as Foo>::Assoc<'a, 'b>)> = MentionsLifetimeAndType(&(), foo); } fn main() {} </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: The above code compiles fine on beta and stable, but fails on the latest nightly. It used to pass on nightly too (last I tested it). The errors is this: The error is claiming that we are using in the pattern when we are not. Interestingly if we change the value of to be something other then a pointer, this passes (though that should not make a difference). Also if we don't use a constant but instead match on directly, it passes as well. We only see this issue in the nightly compiler when we both using a constant and the variant in the constant is a pointer. Unless I am misunderstanding something here, this should not be an error. <!-- Provide the most recent version this worked on, for example: It most recently worked on: Rust 1.47 --It most recently worked on: <!-- version --<!-- Provide the version you are using that has the regression. --: <!-- Did the compiler crash? If so, please provide a backtrace. --
I believe there has been a regression as per the pull request , and I plan to investigate it further at a later time.
bisection seems to confirm PR thanks for looking into that! WG-prioritization assigning priority (). label -I-prioritize +P-high -needs-triage
That does indeed bisect to

Discussion:
<ins> // check-pass #[derive(PartialEq)] struct NonMatchable; impl Eq for NonMatchable {} #[derive(PartialEq, Eq)] enum Foo { A(NonMatchable), B(*const u8), } const CONST: Foo = Foo::B(std::ptr::null()); fn main() { match CONST { CONST => 0, _ => 1, }; } </ins>