jiebi/CodeConvo huggingface dataset:
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: I expected to see this happen: all the avx512f functions get inlined into Instead, this happened: did not get inlined into codegen: here's a repro that mostly doesn't depend on std codegen: there seem to be quite a few moving parts here. if i remove the feature (or replace it with a feature that is implied by avx512f), or if i remove the inout parameter in the asm in , or if i remove the call to , or if i take the code outside the closure, the function gets inlined as expected, so i'm not sure which is the culprit here <!-- 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. --:
the closure doesn't have any target features enabled, which isn't supposed to happen according to llvm ir before any llvm passes: link to original zulip discussion: https://rust-
This works correctly if you add . It looks like it was done .

Discussion:
<ins> // only-x86_64 // assembly-output: emit-asm // make sure the feature is not enabled at compile-time // compile-flags: -C opt-level=3 -C target-feature=-sse4.1 -C llvm-args=-x86-asm-syntax=intel #![feature(target_feature_11)] #![crate_type = "rlib"] use std::arch::x86_64::{__m128, _mm_blend_ps}; #[no_mangle] pub unsafe fn sse41_blend_nofeature(x: __m128, y: __m128) -> __m128 { let f = { // check that _mm_blend_ps is not being inlined into the closure // CHECK-LABEL: {{sse41_blend_nofeature.*closure.*:}} // CHECK-NOT: blendps // CHECK: {{call .*_mm_blend_ps.*}} // CHECK-NOT: blendps // CHECK: ret #[inline(never)] |x, y| _mm_blend_ps(x, y, 0b0101) }; f(x, y) } #[target_feature(enable = "sse4.1")] pub fn sse41_blend_noinline(x: __m128, y: __m128) -> __m128 { let f = { // check that _mm_blend_ps is being inlined into the closure // CHECK-LABEL: {{sse41_blend_noinline.*closure.*:}} // CHECK-NOT: _mm_blend_ps // CHECK: blendps // CHECK-NOT: _mm_blend_ps // CHECK: ret #[inline(never)] |x, y| unsafe { _mm_blend_ps(x, y, 0b0101) } }; f(x, y) } #[no_mangle] #[target_feature(enable = "sse4.1")] pub fn sse41_blend_doinline(x: __m128, y: __m128) -> __m128 { // check that the closure and _mm_blend_ps are being inlined into the function // CHECK-LABEL: sse41_blend_doinline: // CHECK-NOT: {{sse41_blend_doinline.*closure.*}} // CHECK-NOT: _mm_blend_ps // CHECK: blendps // CHECK-NOT: {{sse41_blend_doinline.*closure.*}} // CHECK-NOT: _mm_blend_ps // CHECK: ret let f = { #[inline] |x, y| unsafe { _mm_blend_ps(x, y, 0b0101) } }; f(x, y) } </ins>
Change:
Found while reducing , but the error is different (probably same root cause however) : <!-- Include a backtrace in the code block by setting in your environment. E.g. . --<details<summary<strongBacktrace</strong</summary<p</p</details label +T-rustdoc searched nightlies: from nightly-2023-01-01 to nightly-2023-02-23 regressed nightly: nightly-2023-02-12 searched commit range: regressed commit: <details<summarybisected with <a href=''cargo-bisect-rustc</av0.6.5</summary</detailscc
being looked up: table:
cc
Duplicate of , fixed in

Discussion:
use std::mem; use thin_vec::ThinVec; <ins> use crate::clean::inline::merge_attrs; </ins> use crate::core::{self, DocContext, ImplTraitParam}; use crate::formats::item_type::ItemType; use crate::visit_ast::Module as DocModule;

_ => unreachable!("not yet converted"), }; <del> let mut extra_attrs = Vec::new(); </del> <ins> let mut import_attrs = Vec::new(); let mut target_attrs = Vec::new(); </ins> if let Some(import_id) = import_id && let Some(hir::Node::Item(use_node)) = cx.tcx.hir().find_by_def_id(import_id) { let is_inline = inline::load_attrs(cx, import_id.to_def_id()).lists(sym::doc).get_word_attr(sym::inline).is_some(); // Then we get all the various imports' attributes. <del> get_all_import_attributes(use_node, cx.tcx, item.owner_id.def_id, &mut extra_attrs, is_inline); add_without_unwanted_attributes(&mut extra_attrs, inline::load_attrs(cx, def_id), is_inline); </del> <ins> get_all_import_attributes(use_node, cx.tcx, item.owner_id.def_id, &mut import_attrs, is_inline); add_without_unwanted_attributes(&mut target_attrs, inline::load_attrs(cx, def_id), is_inline); </ins> } else { // We only keep the item's attributes. <del> extra_attrs.extend_from_slice(inline::load_attrs(cx, def_id)); </del> <ins> target_attrs.extend_from_slice(inline::load_attrs(cx, def_id)); </ins> } <del> let attrs = Attributes::from_ast(&extra_attrs); let cfg = extra_attrs.cfg(cx.tcx, &cx.cache.hidden_cfg); </del> <ins> let import_parent = import_id.map(|import_id| cx.tcx.local_parent(import_id).to_def_id()); let (attrs, cfg) =  merge_attrs(cx, import_parent, &target_attrs, Some(&import_attrs)); </ins> let mut item = Item::from_def_id_and_attrs_and_parts(def_id, Some(name), kind, Box::new(attrs), cfg);

<ins> // Import for `A` is inlined and doc comments on the import and `A` itself are merged. // After the merge they still have correct parent scopes to resolve both `[A]` and `[B]`. // check-pass #![allow(rustdoc::private_intra_doc_links)] mod m { /// [B] pub struct A {} pub struct B {} } /// [A] pub use m::A; </ins>
Change:
The following UB compiles: The impl is invalid because the lifetime parameter appears unconstrained in the impl header. It should be rejected for the same reason that projection types doesn't constraint impl generics: label C-bug T-types I-unsound requires-nightly F-typealiasimpl_trait

Discussion:
impl<'tcx> TypeVisitor<TyCtxt<'tcx>> for ParameterCollector { fn visit_ty(&mut self, t: Ty<'tcx>) -> ControlFlow<Self::BreakTy> { match *t.kind() { <del> ty::Alias(ty::Projection | ty::Inherent, ..) if !self.include_nonconstraining => { </del> <ins> ty::Alias(..) if !self.include_nonconstraining => { </ins> // projections are not injective return ControlFlow::Continue(()); }

foreign_crate::ForeignType(val) } <del> impl<T> foreign_crate::ForeignTrait for AliasOfForeignType<T> {} </del> <ins> impl foreign_crate::ForeignTrait for AliasOfForeignType<()> {} </ins> //~^ ERROR only traits defined in the current crate can be implemented for arbitrary types fn main() {}

error[E0117]: only traits defined in the current crate can be implemented for arbitrary types --> $DIR/coherence.rs:14:1 | <del> LL | impl<T> foreign_crate::ForeignTrait for AliasOfForeignType<T> {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^--------------------- | |                                       | | |                                       `AliasOfForeignType<T>` is not defined in the current crate </del> <ins> LL | impl foreign_crate::ForeignTrait for AliasOfForeignType<()> {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^---------------------- | |                                    | | |                                    `AliasOfForeignType<()>` is not defined in the current crate </ins> | impl doesn't use only types from inside the current crate | = note: define and implement a trait or new type instead

// FIXME(type_alias_impl_trait): What does this test? This needs a comment // explaining what we're worried about here. #![feature(type_alias_impl_trait)] trait Trait {} type Opaque<T> = impl Sized;

() } <del> impl<T, V> Trait for (T, V, V, u32) {} impl<U, V> Trait for (Opaque<U>, V, i32, V) {} </del> <ins> impl<T, U, V> Trait for (T, U, V, V, u32) {} impl<U, V> Trait for (Opaque<U>, U, V, i32, V) {} </ins> fn main() {}

<ins> #![feature(type_alias_impl_trait)] use std::fmt::Display; type Opaque<X> = impl Sized + 'static; fn define<X>() -> Opaque<X> {} trait Trait { type Assoc: Display; } impl<'a> Trait for Opaque<&'a str> { //~^ ERROR the lifetime parameter `'a` is not constrained by the impl trait, self type, or predicates type Assoc = &'a str; } // ======= Exploit ======= fn extend<T: Trait + 'static>(s: T::Assoc) -> Box<dyn Display> { Box::new(s) } fn main() { let val = extend::<Opaque<&'_ str>>(&String::from("blah blah blah")); println!("{}", val); } </ins>

<ins> error[E0207]: the lifetime parameter `'a` is not constrained by the impl trait, self type, or predicates --> $DIR/unconstrained-impl-param.rs:11:6 | LL | impl<'a> Trait for Opaque<&'a str> { |      ^^ unconstrained lifetime parameter error: aborting due to previous error For more information about this error, try `rustc --explain E0207`. </ins>
Change:
The reason why it should be changed is because the new error message makes it clearer you should replace with . I was following the book, and I encountered this error. I didn't understand how to solve it and asked on the community discord, then a user in the community server then helped me and I managed to fix the error. No response No response <!-- TRIAGEBOTSTART --<!-- TRIAGEBOTASSIGNSTART --<!-- TRIAGEBOTASSIGNDATASTARTTRIAGEBOTASSIGNDATAEND --<!-- TRIAGEBOTASSIGNEND --<!-- TRIAGEBOTEND --
claim

Discussion:
[one] statement *[other] statements } with a body <del> .suggestion_use_comma_not_semicolon = use a comma to end a `match` arm expression </del> <ins> .suggestion_use_comma_not_semicolon = replace `;` with `,` to end a `match` arm expression </ins> parse_inclusive_range_extra_equals = unexpected `=` after inclusive range .suggestion_remove_eq = use `..=` instead

--> $DIR/match-arm-without-braces.rs:26:27 | LL |         Some(Val::Foo) => 3; <del> |                        -- ^- help: use a comma to end a `match` arm expression: `,` |                        |  | |                        |  this statement is not surrounded by a body </del> <ins> |                        -- ^ this statement is not surrounded by a body |                        | </ins> |                        while parsing the `match` arm starting here <ins> | help: replace `;` with `,` to end a `match` arm expression | LL |         Some(Val::Foo) => 3, |                            ~ </ins> error: `match` arm body without braces --> $DIR/match-arm-without-braces.rs:31:11
Change:
I tried this code: I expected to see this happen: generates a toml file with the contents Instead, this happened: HEAD is branched from . <!-- TRIAGEBOTSTART --<!-- TRIAGEBOTASSIGNSTART --<!-- TRIAGEBOTASSIGNDATASTARTTRIAGEBOTASSIGNDATAEND --<!-- TRIAGEBOTASSIGNEND --<!-- TRIAGEBOTEND --
Relevant code:
claim
Error: Parsing assign command in failed: ...' claim' ' :)'... Please file an issue on GitHub at if there's a problem with this bot, or reach out on on Zulip.
I have a PR ready but I need to wait for to get merged since that PR was and creating a new branch now doesn't help
You can run (replace with the name of the rust-lang remote), then run . In the future, take the habit of always having your branch fast-forward able, it will avoid you hassles with the GitHub UI.
That worked for me, Thank you so much!

Discussion:
return value else: return "'" + value + "'" <ins> elif isinstance(value, dict): return "{" + ", ".join(map(lambda a: "{} = {}".format(to_toml(a[0]), to_toml(a[1])), value.items())) + "}" </ins> else: raise RuntimeError('no toml')
Change:
The preceding code used to compile successfully. Since the stabilization of in the compilation fails with:
Hm, I think related to and
Based on , I'm guessing it would be fine to allow with on closures, at least from a language perspective, even if it still trips up LLVM?
Technically, is "just a hint" and thus one solution is and always was to accept the inline annotation and then simply ignore the request.
But yes, I believe this code actually should be fully acceptable. Note that in that if is enabled, the attributes do get applied to the closure and inlining is done normally by LLVM due to a full match. No hint required.
Assigning P-low because the regression has been contained to nightly versions due to an immediate revert, so this only blocks forward feature development.
label: -regression-from-stable-to-nightly +requires-nightly

Discussion:
}); // #73631: closures inherit `#[target_feature]` annotations <del> if tcx.features().target_feature_11 && tcx.is_closure(did.to_def_id()) { </del> <ins> // // If this closure is marked `#[inline(always)]`, simply skip adding `#[target_feature]`. // // At this point, `unsafe` has already been checked and `#[target_feature]` only affects codegen. // Emitting both `#[inline(always)]` and `#[target_feature]` can potentially result in an // ICE, because LLVM errors when the function fails to be inlined due to a target feature // mismatch. // // Using `#[inline(always)]` implies that this closure will most likely be inlined into // its parent function, which effectively inherits the features anyway. Boxing this closure // would result in this closure being compiled without the inherited target features, but this // is probably a poor usage of `#[inline(always)]` and easily avoided by not using the attribute. if tcx.features().target_feature_11 && tcx.is_closure(did.to_def_id()) && codegen_fn_attrs.inline != InlineAttr::Always { </ins> let owner_id = tcx.parent(did.to_def_id()); if tcx.def_kind(owner_id).has_codegen_attrs() { codegen_fn_attrs

<ins> // only-x86_64 // compile-flags: -Copt-level=3 #![crate_type = "lib"] #![feature(target_feature_11)] #[cfg(target_arch = "x86_64")] use std::arch::x86_64::*; // CHECK-LABEL: @with_avx #[no_mangle] #[cfg(target_arch = "x86_64")] #[target_feature(enable = "avx")] fn with_avx(x: __m256) -> __m256 { // CHECK: fadd let add = { #[inline(always)] |x, y| unsafe { _mm256_add_ps(x, y) } }; add(x, x) } // CHECK-LABEL: @without_avx #[no_mangle] #[cfg(target_arch = "x86_64")] unsafe fn without_avx(x: __m256) -> __m256 { // CHECK-NOT: fadd let add = { #[inline(always)] |x, y| unsafe { _mm256_add_ps(x, y) } }; add(x, x) } </ins>

<ins> // Tests #108655: closures in `#[target_feature]` functions can still be marked #[inline(always)] // check-pass // revisions: mir thir // [thir]compile-flags: -Z thir-unsafeck // only-x86_64 #![feature(target_feature_11)] #[target_feature(enable = "avx")] pub unsafe fn test() { ({ #[inline(always)] move || {} })(); } 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<!-- TRIAGEBOTSTART --<!-- TRIAGEBOTASSIGNSTART --<!-- TRIAGEBOTASSIGNDATASTARTTRIAGEBOTASSIGNDATAEND --<!-- TRIAGEBOTASSIGNEND --<!-- TRIAGEBOTEND --
mcve Crashes on nightly and , stable 167:
claim
searched nightlies: from nightly-2023-01-01 to nightly-2023-03-02 regressed nightly: nightly-2023-01-07 searched commit range: regressed commit: <details<summarybisected with <a href=''cargo-bisect-rustc</av0.6.4</summaryHost triple: x86_64-unknown-linux-gnu Reproduce with: </details cc

Discussion:
probe::ProbeScope::TraitsInScope, None, ) { <del> Ok(pick) => pick.self_ty, </del> <ins> Ok(pick) => eraser.fold_ty(pick.self_ty), </ins> Err(_) => rcvr_ty, }; // Remove one layer of references to account for `&mut self` and

<ins> // The error message here still is pretty confusing. fn main() { let primes = Vec::new(); primes.contains(3); //~^ ERROR mismatched types } </ins>

<ins> error[E0308]: mismatched types --> $DIR/bad-type-in-vec-contains.rs:5:21 | LL |     primes.contains(3); |            -------- ^ |            |        | |            |        expected `&_`, found integer |            |        help: consider borrowing here: `&3` |            arguments to this method are incorrect |            here the type of `primes` is inferred to be `[_]` | = note: expected reference `&_` found type `{integer}` note: method defined here --> $SRC_DIR/core/src/slice/mod.rs:LL:COL error: aborting due to previous error For more information about this error, try `rustc --explain E0308`. </ins>
Change:
While trying to upgrade rustc to the latest nightly, I stumbled across a Rust compiler panic. Here's a repo that contains a minimum-reproducible test case (well, reasonably compact): From my brief investigation, it appears that adding the combinator causes recent rustc nightly's to panic. I've bisected the recent nightly versions; is the first that starts panicking. Running with builds successfully. To reproduce the bug, just run . Running doesn't panic, though, since it seems to be codegen related. : <!-- Include a backtrace in the code block by setting in your environment. E.g. . --<details<summary<strongBacktrace</strong</summary<p</p</details
searched nightlies: from nightly-2023-02-01 to nightly-2023-03-04 regressed nightly: nightly-2023-02-09 searched commit range: regressed commit: <details<summarybisected with <a href=''cargo-bisect-rustc</av0.6.5</summaryHost triple: x86_64-unknown-linux-gnu Reproduce with: </detailsRegressed in , cc
I have (a couple of) fixes for this PR, but I really need this minimized :/
WG-prioritization assigning priority (). label -I-prioritize +P-critical +E-needs-mcve
I'll work on minimizing it in the meantime
I've started some work I but it's extremely miserable because of hypers internal highly entangled generic mess
I tried some more and I'm convinced that this ICE here cannot be minimized in a reasonable amount of time. The ICE is very brittle and disappears with seemingly random changes and the codebase is huge and highly generic with many bounds. I'll leave the label here, but I don't recommend anyone working on this (unless you hate fun and want to waste your time).
We don't have a test, but given that we won't get a test from this report, keeping it open doesn't seem useful.

Discussion:
predicate: pred.to_predicate(infcx.tcx), }; <del> let result = infcx.predicate_must_hold_modulo_regions(&obligation); </del> <ins> let result = infcx.evaluate_obligation_no_overflow(&obligation); </ins> debug!(?result); <del> if result && has_non_region_infer { </del> <ins> if result.must_apply_modulo_regions() && !has_non_region_infer { true } else if result.may_apply() { </ins> // Because of inference "guessing", selection can sometimes claim // to succeed while the success requires a guess. To ensure // this function's result remains infallible, we must confirm

} } } else { <del> result </del> <ins> false </ins> } }
Change:
The following compiles fine, but uncommenting any of the currently-commented functions makes the compiler ICE. For the ICE message is and the others are similar.
I'm inclined to say that the correct behavior is to deny all patterns other than (give a parser error perhaps).
Nominating.
I agree
Accepted for 1.0, P-backcompat-lang.
Good newbie bug.
Being a good newbie, I'll have a crack at this one. :)
Might have aimed a little too high by trying this issue.. but from what i understand, the type checking is working as people would like, but the message is incorrect and should be a actual syntax error and not an ICE... so the below is some thing like how it should work? Sorry if I've completely misunderstood, still pretty nubbins with Rust. :
my reading of is that all of your examples should fail; ideally only an identfier should pass.
They should all fail, the only thing that should pass is , nothing involving destructuring or pattern matching. One way to implement this would be to make it an actual syntax error. You can find a starting place for this change by grepping for in . (I personally would recommend implementing this by threading a argument through , to where you chose between the existing call and calling directly based on that boolean.)
Ahhh okay, that makes more sense. Thanks for that. I'll see what I can make happen.

Discussion:
ast_generics: &ast::Generics, abis: AbiSet) -> ty::ty_param_bounds_and_ty { <ins> for i in decl.inputs.iter() { match (*i).pat.node { ast::PatIdent(_, _, _) => (), ast::PatWild => (), _ => ccx.tcx.sess.span_err((*i).pat.span, "patterns aren't allowed in foreign function declarations") } } </ins> let ty_generics = ty_generics(ccx, ast_generics, 0); let rb = BindingRscope::new(def_id.node); let input_tys = decl.inputs .iter() .map(|a| ty_of_arg(ccx, &rb, a, None)) .collect(); let output_ty = ast_ty_to_ty(ccx, &rb, decl.output); let t_fn = ty::mk_bare_fn(

<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. struct Foo { x: int } extern { fn foo(1: ()); //~^ ERROR: patterns aren't allowed in foreign function declarations fn bar((): int); //~^ ERROR: patterns aren't allowed in foreign function declarations fn baz(Foo { x }: int); //~^ ERROR: patterns aren't allowed in foreign function declarations fn qux((x,y): ()); //~^ ERROR: patterns aren't allowed in foreign function declarations fn this_is_actually_ok(a: uint); fn and_so_is_this(_: uint); } fn main() {} </ins>  No newline at end of file
Change:
I tried this code: I expected to see this happen: build failed, because this future doesn't implement Send, so this function shouldn't implement Instead, this happened: build pass <!-- 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<summaryBacktrace</summary<p</p</detailscargo-bisect-rustc show the Regression in this bug is introduced by this PR <!-- TRIAGEBOTSTART --<!-- TRIAGEBOTASSIGNSTART --<!-- TRIAGEBOTASSIGNDATASTARTTRIAGEBOTASSIGNDATAEND --<!-- TRIAGEBOTASSIGNEND --<!-- TRIAGEBOTEND --
label: +T-types
I think it's a very serious bug, should we revert this change?
claim
minimized ah, figured out the issue how did you catch this bug?
I try to find the minimized example of there is a ICE with a unsend future in this issue
WG-prioritization assigning priority (). label -I-prioritize +P-critical
Isn't this a stable-to-beta regression since nightly just branched?
Just to clarify since we're in the confusing week where stable & beta are discontinuous version numbers:

Discussion:
let mut nested_result = EvaluationResult::EvaluatedToOk; for obligation in nested_obligations { nested_result = cmp::max( <del> this.evaluate_predicate_recursively(stack.list(), obligation)?, </del> <ins> this.evaluate_predicate_recursively(previous_stack, obligation)?, </ins> nested_result, ); }

let obligation = obligation.with(this.tcx(), predicate); result = cmp::max( nested_result, <del> this.evaluate_trait_predicate_recursively(stack.list(), obligation)?, </del> <ins> this.evaluate_trait_predicate_recursively(previous_stack, obligation)?, </ins> ); } }

<ins> // edition:2021 // issue 108897 trait Handler {} impl<F, Fut> Handler for F where Fut: Send, F: FnOnce() -> Fut, {} fn require_handler<H: Handler>(h: H) {} async fn handler() { let a = &1 as *const i32; async {}.await; } fn main() { require_handler(handler) //~^ ERROR future cannot be sent between threads safely } </ins>

<ins> error: future cannot be sent between threads safely --> $DIR/unsend-future.rs:19:21 | LL |     require_handler(handler) |                     ^^^^^^^ future returned by `handler` is not `Send` | = help: within `impl Future<Output = ()>`, the trait `Send` is not implemented for `*const i32` note: future is not `Send` as this value is used across an await --> $DIR/unsend-future.rs:15:13 | LL |     let a = &1 as *const i32; |         - has type `*const i32` which is not `Send` LL |     async {}.await; |             ^^^^^^ await occurs here, with `a` maybe used later LL | } | - `a` is later dropped here note: required by a bound in `require_handler` --> $DIR/unsend-future.rs:11:23 | LL | fn require_handler<H: Handler>(h: H) {} |                       ^^^^^^^ required by this bound in `require_handler` error: aborting due to previous error </ins>