jiebi/CodeConvo huggingface dataset:
Change:
No response The lint is marked able but applying the suggestion fails: ` No response No response <!-- TRIAGEBOTSTART --<!-- TRIAGEBOTASSIGNSTART --<!-- TRIAGEBOTASSIGNDATASTARTTRIAGEBOTASSIGNDATAEND --<!-- TRIAGEBOTASSIGNEND --<!-- TRIAGEBOTEND --
Same problem with
claim
I think this is a known issue with with applying all suggestions even if they are multually exclusive. I'm pretty sure there's nothing to do in the lint, it correctly suggests the two (valid) suggestions, only one of them should be applied.
Well we can either remove one of the suggestions or make the lint MaybeIncorrect or something?
I think this is We can't remove one of the suggestions, they are both necessary. We can however make them for the time being.
That is indeed unfortunate.

Discussion:
#[multipart_suggestion( lint_addr_metadata_suggestion, style = "verbose", <del> applicability = "machine-applicable" </del> <ins> // FIXME(#53934): make machine-applicable again applicability = "maybe-incorrect" </ins> )] pub struct AmbiguousWidePointerComparisonsAddrMetadataSuggestion<'a> { pub ne: &'a str,

#[multipart_suggestion( lint_addr_suggestion, style = "verbose", <del> applicability = "machine-applicable" </del> <ins> // FIXME(#53934): make machine-applicable again applicability = "maybe-incorrect" </ins> )] AddrEq { ne: &'a str,

#[multipart_suggestion( lint_addr_suggestion, style = "verbose", <del> applicability = "machine-applicable" </del> <ins> // FIXME(#53934): make machine-applicable again applicability = "maybe-incorrect" </ins> )] Cast { deref_left: &'a str,

self.props.compare_output_lines_by_subset, ); } else if !expected_fixed.is_empty() { <del> panic!( "the `// run-rustfix` directive wasn't found but a `*.fixed`  file was found" ); </del> <ins> if self.config.suite == "ui" { panic!( "the `//@ run-rustfix` directive wasn't found but a `*.fixed` file was found" ); } else { panic!( "the `// run-rustfix` directive wasn't found but a `*.fixed` file was found" ); } </ins> } if errors > 0 {

<ins> //@ run-rustfix //@ rustfix-only-machine-applicable //@ check-pass // See <https://github.com/rust-lang/rust/issues/121330>. fn cmp<T: ?Sized>(a: *mut T, b: *mut T) -> bool { let _ = a == b; //~^ WARN ambiguous wide pointer comparison panic!(); } fn main() {} </ins>

<ins> warning: ambiguous wide pointer comparison, the comparison includes metadata which may not be expected --> $DIR/ambiguous_wide_pointer_comparisons_suggestions.rs:8:13 | LL |     let _ = a == b; |             ^^^^^^ | = note: `#[warn(ambiguous_wide_pointer_comparisons)]` on by default help: use `std::ptr::addr_eq` or untyped pointers to only compare their addresses | LL |     let _ = std::ptr::addr_eq(a, b); |             ++++++++++++++++++ ~  + help: use explicit `std::ptr::eq` method to compare metadata and addresses | LL |     let _ = std::ptr::eq(a, b); |             +++++++++++++ ~  + warning: 1 warning emitted </ins>
Change:
<!-- [31mICE[0m: Rustc '' 'error: internal compiler error: expected ADT to be an item', 'error: internal compiler error: expected ADT to be an item' File: --snippet: 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: [adtdef] computing ADT definition for [adtdef] computing ADT definition for [typeof] computing type of [inferredoutlivescrate] computing the inferred outlives predicates for items in this crate [inferredoutlivesof] computing inferred outlives predicates of [predicatesdefinedon] computing predicates of [predicatesof] computing predicates of [collectmoditemtypes] collecting item types in top-level module [analysis] running analysis passes on this crate --<!-- TRIAGEBOTSTART --<!-- TRIAGEBOTASSIGNSTART --<!-- TRIAGEBOTASSIGNDATASTARTTRIAGEBOTASSIGNDATAEND --<!-- TRIAGEBOTASSIGNEND --<!-- TRIAGEBOT_END --
cc
Oh, seems that more checks are needed to prevent unnamed fields from occurring in enums.
claim

Discussion:
matches!(self.kind, ItemKind::Enum(..) | ItemKind::Struct(..) | ItemKind::Union(..)) } <ins> /// Check if this is an [`ItemKind::Struct`] or [`ItemKind::Union`]. pub fn is_struct_or_union(&self) -> bool { matches!(self.kind, ItemKind::Struct(..) | ItemKind::Union(..)) } </ins> expect_methods_self_kind! { expect_extern_crate, Option<Symbol>, ItemKind::ExternCrate(s), *s;

let is_anonymous = item.ident.name == kw::Empty; let repr = if is_anonymous { <del> tcx.adt_def(tcx.local_parent(def_id)).repr() </del> <ins> let parent = tcx.local_parent(def_id); if let Node::Item(item) = tcx.hir_node_by_def_id(parent) && item.is_struct_or_union() { tcx.adt_def(parent).repr() } else { tcx.dcx().span_delayed_bug(item.span, "anonymous field inside non struct/union"); ty::ReprOptions::default() } </ins> } else { tcx.repr_options_of_def(def_id.to_def_id()) };

<ins> #![crate_type = "lib"] #![feature(unnamed_fields)] #![allow(unused, incomplete_features)] enum K { M { _ : struct { field: u8 }, //~^ error: unnamed fields are not allowed outside of structs or unions //~| error: anonymous structs are not allowed outside of unnamed struct or union fields } } </ins>

<ins> error: unnamed fields are not allowed outside of structs or unions --> $DIR/anon-struct-in-enum-issue-121446.rs:7:9 | LL |         _ : struct { field: u8 }, |         -^^^^^^^^^^^^^^^^^^^^^^^ |         | |         unnamed field declared here error: anonymous structs are not allowed outside of unnamed struct or union fields --> $DIR/anon-struct-in-enum-issue-121446.rs:7:13 | LL |         _ : struct { field: u8 }, |             ^^^^^^^^^^^^^^^^^^^^ anonymous struct declared here error: aborting due to 2 previous errors </ins>
Change:
I'm pretty sure it is possible to set custom paths for , & in but not for clippy.
label +T-bootstrap

Discussion:
# use this rustfmt binary instead as the stage0 snapshot rustfmt. #rustfmt = "/path/to/rustfmt" <ins> # Instead of downloading the src/stage0 version of cargo-clippy specified, # use this cargo-clippy binary instead as the stage0 snapshot cargo-clippy. # # Note that this option should be used with the same toolchain as the `rustc` option above. # Otherwise, clippy is likely to fail due to a toolchain conflict. #cargo-clippy = "/path/to/cargo-clippy" </ins> # Whether to build documentation by default. If false, rustdoc and # friends will still be compiled but they will not be used to generate any # documentation.

pub fn cargo_clippy_cmd(&self, run_compiler: Compiler) -> BootstrapCommand { if run_compiler.stage == 0 { <del> // `ensure(Clippy { stage: 0 })` *builds* clippy with stage0, it doesn't use the beta clippy. let cargo_clippy = self.build.config.download_clippy(); </del> <ins> let cargo_clippy = self .config .initial_cargo_clippy .clone() .unwrap_or_else(|| self.build.config.download_clippy()); </ins> let mut cmd = command(cargo_clippy); cmd.env("CARGO", &self.initial_cargo); return cmd;

// These are either the stage0 downloaded binaries or the locally installed ones. pub initial_cargo: PathBuf, pub initial_rustc: PathBuf, <ins> pub initial_cargo_clippy: Option<PathBuf>, </ins> #[cfg(not(test))] initial_rustfmt: RefCell<RustfmtState>,

cargo: Option<PathBuf> = "cargo", rustc: Option<PathBuf> = "rustc", rustfmt: Option<PathBuf> = "rustfmt", <ins> cargo_clippy: Option<PathBuf> = "cargo-clippy", </ins> docs: Option<bool> = "docs", compiler_docs: Option<bool> = "compiler-docs", library_docs_private_items: Option<bool> = "library-docs-private-items",

cargo, rustc, rustfmt, <ins> cargo_clippy, </ins> docs, compiler_docs, library_docs_private_items,

config.out = absolute(&config.out).expect("can't make empty path absolute"); } <ins> if cargo_clippy.is_some() && rustc.is_none() { println!( "WARNING: Using `build.cargo-clippy` without `build.rustc` usually fails due to toolchain conflict." ); } config.initial_cargo_clippy = cargo_clippy; </ins> config.initial_rustc = if let Some(rustc) = rustc { if !flags.skip_stage0_validation { config.check_stage0_version(&rustc, "rustc");

severity: ChangeSeverity::Info, summary: "The `build.profiler` option now tries to use source code from `download-ci-llvm` if possible, instead of checking out the `src/llvm-project` submodule.", }, <ins> ChangeInfo { change_id: 129152, severity: ChangeSeverity::Info, summary: "New option `build.cargo-clippy` added for supporting the use of custom/external clippy.", }, </ins> ];
Change:
<!-- [31mICE[0m: Rustc '--crate-type=lib -ooutputfile -Zdump-mir-dir=dir' 'thread 'rustc' panicked at 'called on a value'', 'thread 'rustc' panicked at 'called on a value'' 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: [lintmod] linting top-level module [analysis] running analysis passes on this crate --<!-- TRIAGEBOTSTART --<!-- TRIAGEBOTASSIGNSTART --<!-- TRIAGEBOTASSIGNDATASTARTTRIAGEBOTASSIGNDATAEND --<!-- TRIAGEBOTASSIGNEND --<!-- TRIAGEBOT_END --
cc
claim
The ICE occurs due to the on this line: The underlying reason is that typeck result is tainted due to the bad arg type in the user's code and therefore returns .

Discussion:
// Check if the method call actually calls the libcore // `IntoIterator::into_iter`. <del> let def_id = cx.typeck_results().type_dependent_def_id(expr.hir_id).unwrap(); match cx.tcx.trait_of_item(def_id) { Some(trait_id) if cx.tcx.is_diagnostic_item(sym::IntoIterator, trait_id) => {} _ => return, }; </del> <ins> let trait_id = cx .typeck_results() .type_dependent_def_id(expr.hir_id) .and_then(|did| cx.tcx.trait_of_item(did)); if trait_id.is_none() || !cx.tcx.is_diagnostic_item(sym::IntoIterator, trait_id.unwrap()) { return; } </ins> // As this is a method call expression, we have at least one argument. let receiver_ty = cx.typeck_results().expr_ty(receiver_arg);

<ins> // Regression test for #121532 // Checks the we don't ICE in ArrayIntoIter // lint when typeck has failed // Typeck fails for the arg type as // `Self` makes no sense here fn func(a: Self::ItemsIterator) { //~ ERROR failed to resolve: `Self` is only available in impls, traits, and type definitions a.into_iter(); } fn main() {} </ins>

<ins> error[E0433]: failed to resolve: `Self` is only available in impls, traits, and type definitions --> $DIR/ice-array-into-iter-lint-issue-121532.rs:7:12 | LL | fn func(a: Self::ItemsIterator) { |            ^^^^ `Self` is only available in impls, traits, and type definitions error: aborting due to 1 previous error For more information about this error, try `rustc --explain E0433`. </ins>
Change:
<!-- [31mICE[0m: Rustc '' 'error: internal compiler error: invalid asymmetric binary op Sub: (i32), 2 (u32)', 'error: internal compiler error: invalid asymmetric binary op Sub: (i32), 2 (u32)' 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: [mirdropselaboratedandconstchecked] elaborating drops for [analysis] running analysis passes on this crate --<!-- TRIAGEBOTSTART --<!-- TRIAGEBOTASSIGNSTART --<!-- TRIAGEBOTASSIGNDATASTARTTRIAGEBOTASSIGNDATAEND --<!-- TRIAGEBOTASSIGNEND --<!-- TRIAGEBOTEND --
cc
Const prop We need to make it not do union field accesses
Reduced a bit further:
claim

Discussion:
val.into() } <del> Aggregate(ref kind, ref fields) => Value::Aggregate { fields: fields .iter() .map(|field| self.eval_operand(field).map_or(Value::Uninit, Value::Immediate)) .collect(), variant: match **kind { AggregateKind::Adt(_, variant, _, _, _) => variant, AggregateKind::Array(_) | AggregateKind::Tuple | AggregateKind::Closure(_, _) | AggregateKind::Coroutine(_, _) | AggregateKind::CoroutineClosure(_, _) => VariantIdx::new(0), }, }, </del> <ins> Aggregate(ref kind, ref fields) => { // Do not const pop union fields as they can be // made to produce values that don't match their // underlying layout's type (see ICE #121534). // If the last element of the `Adt` tuple // is `Some` it indicates the ADT is a union if let AggregateKind::Adt(_, _, _, _, Some(_)) = **kind { return None; }; Value::Aggregate { fields: fields .iter() .map(|field| { self.eval_operand(field).map_or(Value::Uninit, Value::Immediate) }) .collect(), variant: match **kind { AggregateKind::Adt(_, variant, _, _, _) => variant, AggregateKind::Array(_) | AggregateKind::Tuple | AggregateKind::Closure(_, _) | AggregateKind::Coroutine(_, _) | AggregateKind::CoroutineClosure(_, _) => VariantIdx::new(0), }, } } </ins> Repeat(ref op, n) => { trace!(?op, ?n);

<ins> // Regression test for #121534 // Tests that no ICE occurs in KnownPanicsLint when it // evaluates an operation whose operands have different // layout types even though they have the same type. // This situation can be contrived through the use of // unions as in this test //@ build-pass union Union { u32_field: u32, i32_field: i32, } pub fn main() { let u32_variant = Union { u32_field: 2 }; let i32_variant = Union { i32_field: 3 }; let a = unsafe { u32_variant.u32_field }; let b = unsafe { i32_variant.u32_field }; let _diff = a - b; } </ins>
Change:
<!-- [31mICE[0m: Rustc '' 'thread 'rustc' panicked at 'called on a value'', 'thread 'rustc' panicked at 'called on a value'' File: --snippet: 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: [hircrate] getting the crate HIR [hirattrs] getting HIR owner attributes in `` [entry_fn] looking up the entry function of a crate [analysis] running analysis passes on this crate --
Crashes since cc
For the record: helped expose a latent bug in AST validation, which will fix.
Also (probably the same cause):
This code now causes unbound memory growth after when trying to print the query stack. after

Discussion:
generics, body.as_deref(), ); <ins> walk_list!(self, visit_attribute, &item.attrs); </ins> self.visit_fn(kind, item.span, item.id); } AssocItemKind::Type(_) => {

<ins> trait MyTrait { #[doc = MyTrait] //~^ ERROR attribute value must be a literal fn myfun(); } fn main() {} </ins>

<ins> error: attribute value must be a literal --> $DIR/validation-on-associated-items-issue-121537.rs:2:13 | LL |     #[doc = MyTrait] |             ^^^^^^^ error: aborting due to 1 previous error </ins>
Change:
Running this test: with many different seeds in Miri eventually shows: This indicates that the allocation made here does not get freed properly: Specifically when running this with Miri , seed 139 causes the issue. I don't think there is any way for this to be a false positive. Cc
I think this is not recent, it's just hard to trigger. I'll try reproducing on some older versions of rustc+Miri: (Jan 24th): seed 1870 (Nov 22nd, 2023): seed 1020 We can't go back much further since it seems we're not keeping the artifacts long enough for that? So probably this existed ever since landed.
Reproduced this with crossbeam-channel 0.5.11 and miri `.

Discussion:
} let mut head = self.head.index.load(Ordering::Acquire); <del> let mut block = self.head.block.load(Ordering::Acquire); </del> <ins> let mut block = self.head.block.swap(ptr::null_mut(), Ordering::AcqRel); </ins> // If we're going to be dropping messages we need to synchronize with initialization if head >> SHIFT != tail >> SHIFT {

drop(Box::from_raw(block)); } } head &= !MARK_BIT; <del> self.head.block.store(ptr::null_mut(), Ordering::Release); </del> self.head.index.store(head, Ordering::Release); }
Change:
I would expect this to run to completion: On stable, it does: But not on current nightly: Interestingly, it works ok without cargo: The cargo project isn't special though: OS: macOS 13.6.3
cc I guess?
The internal function uses const promotion for the vtable in two places, once at initial construction and another when cloning. Maybe that results in two differently-addressed vtables.
I gave this a shot in . But without a language feature for statics with type parameters, we are not seeing a reliable way to restore 's functionality. Let's consider reverting . Having be a handful of CPU instructions faster but way more often wrong is not useful.

Discussion:
#[inline(always)] fn raw_waker<W: Wake + Send + Sync + 'static>(waker: Arc<W>) -> RawWaker { // Increment the reference count of the arc to clone it. <ins> // // The #[inline(always)] is to ensure that raw_waker and clone_waker are // always generated in the same code generation unit as one another, and // therefore that the structurally identical const-promoted RawWakerVTable // within both functions is deduplicated at LLVM IR code generation time. // This allows optimizing Waker::will_wake to a single pointer comparison of // the vtable pointers, rather than comparing all four function pointers // within the vtables. #[inline(always)] </ins> unsafe fn clone_waker<W: Wake + Send + Sync + 'static>(waker: *const ()) -> RawWaker { unsafe { Arc::increment_strong_count(waker as *const W) }; RawWaker::new(

#[inline(always)] fn local_raw_waker<W: LocalWake + 'static>(waker: Rc<W>) -> RawWaker { // Increment the reference count of the Rc to clone it. <ins> // // Refer to the comment on raw_waker's clone_waker regarding why this is // always inline. #[inline(always)] </ins> unsafe fn clone_waker<W: LocalWake + 'static>(waker: *const ()) -> RawWaker { unsafe { Rc::increment_strong_count(waker as *const W) }; RawWaker::new(

#![feature(thin_box)] #![feature(strict_provenance)] #![feature(drain_keep_rest)] <ins> #![feature(local_waker)] </ins> #![allow(internal_features)] #![deny(fuzzy_provenance_casts)] #![deny(unsafe_op_in_unsafe_fn)]

mod slice; mod str; mod string; <ins> mod task; </ins> mod thin_box; mod vec; mod vec_deque;

<ins> use alloc::rc::Rc; use alloc::sync::Arc; use alloc::task::{LocalWake, Wake}; use core::task::{LocalWaker, Waker}; #[test] fn test_waker_will_wake_clone() { struct NoopWaker; impl Wake for NoopWaker { fn wake(self: Arc<Self>) {} } let waker = Waker::from(Arc::new(NoopWaker)); let clone = waker.clone(); assert!(waker.will_wake(&clone)); assert!(clone.will_wake(&waker)); } #[test] fn test_local_waker_will_wake_clone() { struct NoopWaker; impl LocalWake for NoopWaker { fn wake(self: Rc<Self>) {} } let waker = LocalWaker::from(Rc::new(NoopWaker)); let clone = waker.clone(); assert!(waker.will_wake(&clone)); assert!(clone.will_wake(&waker)); } </ins>
Change:
<!-- [31mICE[0m: Rustc '-Znext-solver=coherence -ooutputfile -Zdump-mir-dir=dir' 'thread 'rustc' panicked at 'assertion failed: obligations.isempty()'', 'thread 'rustc' panicked at 'assertion failed: obligations.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: [specializationgraphof] building specialization graph of trait [coherent_trait] coherence checking all impls of trait [analysis] running analysis passes on this crate --
cc
Probably due to the fact that doesn't preserve the flag.
should be fixed by
With the output is ...
should add the following as a test
Hello, I'm a beginner and I would like to contribute to Rust. Since this issue has been marked as "Easy," what is the desired behavior of this program and how can I approach it? Any help would be appreciated.
This is marked E-needs-test, so the only change here would be to add this test to the test suite, since the issue has been fixed.

Discussion:
<ins> // regression test for issue #121649. trait ToUnit<'a> { type Unit; } trait Overlap<T> {} type Assoc<'a, T> = <T as ToUnit<'a>>::Unit; impl<T> Overlap<T> for T {} impl<T> Overlap<for<'a> fn(&'a (), Assoc<'a, T>)> for T {} //~^ ERROR 13:17: 13:49: the trait bound `for<'a> T: ToUnit<'a>` is not satisfied [E0277] //~| ERROR 13:36: 13:48: the trait bound `for<'a> T: ToUnit<'a>` is not satisfied [E0277] fn main() {} </ins>

<ins> WARN rustc_infer::infer::relate::generalize may incompletely handle alias type: AliasTy { args: [?1t, '^0.Named(DefId(0:15 ~ structually_relate_aliases[de75]::{impl#1}::'a), "'a")], def_id: DefId(0:5 ~ structually_relate_aliases[de75]::ToUnit::Unit) } WARN rustc_infer::infer::relate::generalize may incompletely handle alias type: AliasTy { args: [?1t, !2_0.Named(DefId(0:15 ~ structually_relate_aliases[de75]::{impl#1}::'a), "'a")], def_id: DefId(0:5 ~ structually_relate_aliases[de75]::ToUnit::Unit) } error[E0277]: the trait bound `for<'a> T: ToUnit<'a>` is not satisfied --> $DIR/structually-relate-aliases.rs:13:36 | LL | impl<T> Overlap<for<'a> fn(&'a (), Assoc<'a, T>)> for T {} |                                    ^^^^^^^^^^^^ the trait `for<'a> ToUnit<'a>` is not implemented for `T` | help: consider restricting type parameter `T` | LL | impl<T: for<'a> ToUnit<'a>> Overlap<for<'a> fn(&'a (), Assoc<'a, T>)> for T {} |       ++++++++++++++++++++ error[E0277]: the trait bound `for<'a> T: ToUnit<'a>` is not satisfied --> $DIR/structually-relate-aliases.rs:13:17 | LL | impl<T> Overlap<for<'a> fn(&'a (), Assoc<'a, T>)> for T {} |                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `for<'a> ToUnit<'a>` is not implemented for `T` | help: consider restricting type parameter `T` | LL | impl<T: for<'a> ToUnit<'a>> Overlap<for<'a> fn(&'a (), Assoc<'a, T>)> for T {} |       ++++++++++++++++++++ error: aborting due to 2 previous errors For more information about this error, try `rustc --explain E0277`. </ins>