jiebi/CodeConvo huggingface dataset:
<ins> error: unknown start of token: u{2796} --> $DIR/suggest-remove-compount-assign-let-ice.rs:13:11 | LL |     let x ➖= 1; |           ^^ | help: Unicode character '➖' (Heavy Minus Sign) looks like '-' (Minus/Hyphen), but it is not | LL |     let x -= 1; |           ~ error: can't reassign to an uninitialized variable --> $DIR/suggest-remove-compount-assign-let-ice.rs:13:11 | LL |     let x ➖= 1; |           ^^^ | = help: if you meant to overwrite, remove the `let` binding help: initialize the variable | LL -     let x ➖= 1; LL +     let x = 1; | error: aborting due to 2 previous errors </ins>
// gdb-command:run // gdb-command:print some <del> // gdb-check:$1 = core::option::Option<&u32>::Some(0x12345678) </del> <ins> // gdb-check:$1 = core::option::Option<&u32>::Some(0x[...]) </ins> // gdb-command:print none // gdb-check:$2 = core::option::Option<&u32>::None // gdb-command:print full <del> // gdb-check:$3 = option_like_enum::MoreFields::Full(454545, 0x87654321, 9988) </del> <ins> // gdb-check:$3 = option_like_enum::MoreFields::Full(454545, 0x[...], 9988) </ins> <del> // gdb-command:print empty_gdb.discr // gdb-check:$4 = (*mut isize) 0x1 </del> <ins> // gdb-command:print empty // gdb-check:$4 = option_like_enum::MoreFields::Empty </ins> // gdb-command:print droid <del> // gdb-check:$5 = option_like_enum::NamedFields::Droid{id: 675675, range: 10000001, internals: 0x43218765} </del> <ins> // gdb-check:$5 = option_like_enum::NamedFields::Droid{id: 675675, range: 10000001, internals: 0x[...]} </ins> <del> // gdb-command:print void_droid_gdb.internals // gdb-check:$6 = (*mut isize) 0x1 </del> <ins> // gdb-command:print void_droid // gdb-check:$6 = option_like_enum::NamedFields::Void </ins> // gdb-command:print nested_non_zero_yep // gdb-check:$7 = option_like_enum::NestedNonZero::Yep(10.5, option_like_enum::NestedNonZeroField {a: 10, b: 20, c: 0x[...]})
// lldb-command:run // lldb-command:v some <del> // lldb-check:[...] Some(&0x12345678) </del> <ins> // lldb-check:[...] Some(&0x[...]) </ins> // lldb-command:v none // lldb-check:[...] None // lldb-command:v full <del> // lldb-check:[...] Full(454545, &0x87654321, 9988) </del> <ins> // lldb-check:[...] Full(454545, &0x[...], 9988) </ins> // lldb-command:v empty // lldb-check:[...] Empty // lldb-command:v droid <del> // lldb-check:[...] Droid { id: 675675, range: 10000001, internals: &0x43218765 } </del> <ins> // lldb-check:[...] Droid { id: 675675, range: 10000001, internals: &0x[...] } </ins> // lldb-command:v void_droid // lldb-check:[...] Void
// contains a non-nullable pointer, then this value is used as the discriminator. // The test cases in this file make sure that something readable is generated for // this kind of types. <del> // If the non-empty variant contains a single non-nullable pointer than the whole // item is represented as just a pointer and not wrapped in a struct. // Unfortunately (for these test cases) the content of the non-discriminant fields // in the null-case is not defined. So we just read the discriminator field in // this case (by casting the value to a memory-equivalent struct). </del> enum MoreFields<'a> { Full(u32, &'a isize, i16),
let some_str: Option<&'static str> = Some("abc"); let none_str: Option<&'static str> = None; <del> let some: Option<&u32> = Some(unsafe { std::mem::transmute(0x12345678_usize) }); </del> <ins> let some: Option<&u32> = Some(&1234); </ins> let none: Option<&u32> = None; <del> let full = MoreFields::Full(454545, unsafe { std::mem::transmute(0x87654321_usize) }, 9988); </del> <ins> let full = MoreFields::Full(454545, &1234, 9988); </ins> let empty = MoreFields::Empty; <del> let empty_gdb: &MoreFieldsRepr = unsafe { std::mem::transmute(&MoreFields::Empty) }; </del> let droid = NamedFields::Droid { id: 675675, range: 10000001, <del> internals: unsafe { std::mem::transmute(0x43218765_usize) } </del> <ins> internals: &1234, </ins> }; let void_droid = NamedFields::Void; <del> let void_droid_gdb: &NamedFieldsRepr = unsafe { std::mem::transmute(&NamedFields::Void) }; let x = 'x'; </del> let nested_non_zero_yep = NestedNonZero::Yep( 10.5, NestedNonZeroField { a: 10, b: 20, <del> c: &x </del> <ins> c: &'x', </ins> }); let nested_non_zero_nope = NestedNonZero::Nope; zzz(); // #break
.find_ancestor_inside(value.span) .map(|span| (value.span.with_hi(span.lo()), value.span.with_lo(span.hi()))), ast::ExprKind::Paren(ref expr) => { <del> expr.span.find_ancestor_inside(value.span).map(|expr_span| { </del> <ins> // For the expr with attributes, like `let _ = (#[inline] || println!("Hello!"));`, // the span should contains the attributes, or the suggestion will remove them. let expr_span_with_attrs = if let Some(attr_lo) = expr.attrs.iter().map(|attr| attr.span.lo()).min() { expr.span.with_lo(attr_lo) } else { expr.span }; expr_span_with_attrs.find_ancestor_inside(value.span).map(|expr_span| { </ins> (value.span.with_hi(expr_span.lo()), value.span.with_lo(expr_span.hi())) }) }
<ins> //@ run-rustfix // Check the `unused_parens` suggestion for paren_expr with attributes. // The suggestion should retain attributes in the front. #![feature(stmt_expr_attributes)] #![deny(unused_parens)] pub fn foo() -> impl Fn() { let _ = #[inline] #[allow(dead_code)] || println!("Hello!"); //~ERROR unnecessary parentheses #[inline] #[allow(dead_code)] || println!("Hello!") //~ERROR unnecessary parentheses } fn main() { let _ = foo(); } </ins>
<ins> //@ run-rustfix // Check the `unused_parens` suggestion for paren_expr with attributes. // The suggestion should retain attributes in the front. #![feature(stmt_expr_attributes)] #![deny(unused_parens)] pub fn foo() -> impl Fn() { let _ = (#[inline] #[allow(dead_code)] || println!("Hello!")); //~ERROR unnecessary parentheses (#[inline] #[allow(dead_code)] || println!("Hello!")) //~ERROR unnecessary parentheses } fn main() { let _ = foo(); } </ins>
<ins> error: unnecessary parentheses around assigned value --> $DIR/unused-parens-for-stmt-expr-attributes-issue-129833.rs:9:13 | LL |     let _ = (#[inline] #[allow(dead_code)] || println!("Hello!")); |             ^                                                   ^ | note: the lint level is defined here --> $DIR/unused-parens-for-stmt-expr-attributes-issue-129833.rs:6:9 | LL | #![deny(unused_parens)] |         ^^^^^^^^^^^^^ help: remove these parentheses | LL -     let _ = (#[inline] #[allow(dead_code)] || println!("Hello!")); LL +     let _ = #[inline] #[allow(dead_code)] || println!("Hello!"); | error: unnecessary parentheses around block return value --> $DIR/unused-parens-for-stmt-expr-attributes-issue-129833.rs:10:5 | LL |     (#[inline] #[allow(dead_code)] || println!("Hello!")) |     ^                                                   ^ | help: remove these parentheses | LL -     (#[inline] #[allow(dead_code)] || println!("Hello!")) LL +     #[inline] #[allow(dead_code)] || println!("Hello!") | error: aborting due to 2 previous errors </ins>
run_path_with_cstr(original, &|original| { run_path_with_cstr(link, &|link| { cfg_if::cfg_if! { <del> if #[cfg(any(target_os = "vxworks", target_os = "redox", target_os = "android", target_os = "espidf", target_os = "horizon", target_os = "vita", target_os = "nto"))] { </del> <ins> if #[cfg(any(target_os = "vxworks", target_os = "redox", target_os = "android", target_os = "espidf", target_os = "horizon", target_os = "vita", target_env = "nto70"))] { </ins> // VxWorks, Redox and ESP-IDF lack `linkat`, so use `link` instead. POSIX leaves // it implementation-defined whether `link` follows symlinks, so rely on the // `symlink_hard_link` test in library/std/src/fs/tests.rs to check the behavior.
cx: X, input: X::Input, <del> result: X::Result, </del> <ins> origin_result: X::Result, </ins> dep_node: X::DepNodeIndex, additional_depth: usize, encountered_overflow: bool, nested_goals: NestedGoals<X>, ) { <del> let result = cx.mk_tracked(result, dep_node); </del> <ins> let result = cx.mk_tracked(origin_result, dep_node); </ins> let entry = self.map.entry(input).or_default(); if encountered_overflow { let with_overflow = WithOverflow { nested_goals, result }; let prev = entry.with_overflow.insert(additional_depth, with_overflow); <del> assert!(prev.is_none()); </del> <ins> if let Some(prev) = &prev { assert!(cx.evaluation_is_concurrent()); assert_eq!(cx.get_tracked(&prev.result), origin_result); } </ins> } else { let prev = entry.success.replace(Success { additional_depth, nested_goals, result }); <del> assert!(prev.is_none()); </del> <ins> if let Some(prev) = &prev { assert!(cx.evaluation_is_concurrent()); assert_eq!(cx.get_tracked(&prev.result), origin_result); } </ins> } }
<ins> //@ compile-flags: -Zthreads=16 // original issue: https://github.com/rust-lang/rust/issues/129112 // Previously, the "next" solver asserted that each successful solution is only obtained once. // This test exhibits a repro that, with next-solver + -Zthreads, triggered that old assert. // In the presence of multithreaded solving, it's possible to concurrently evaluate things twice, // which leads to replacing already-solved solutions in the global solution cache! // We assume this is fine if we check to make sure they are solved the same way each time. // This test only nondeterministically fails but that's okay, as it will be rerun by CI many times, // so it should almost always fail before anything is merged. As other thread tests already exist, // we already face this difficulty, probably. If we need to fix this by reducing the error margin, // we should improve compiletest. #[derive(Clone, Eq)] //~ ERROR [E0277] pub struct Struct<T>(T); impl<T: Clone, U> PartialEq<U> for Struct<T> where U: Into<Struct<T>> + Clone { fn eq(&self, _other: &U) -> bool { todo!() } } fn main() {} </ins>
<ins> error[E0277]: the trait bound `T: Clone` is not satisfied --> $DIR/global-cache-and-parallel-frontend.rs:15:17 | LL | #[derive(Clone, Eq)] |                 ^^ the trait `Clone` is not implemented for `T`, which is required by `Struct<T>: PartialEq` | note: required for `Struct<T>` to implement `PartialEq` --> $DIR/global-cache-and-parallel-frontend.rs:18:19 | LL | impl<T: Clone, U> PartialEq<U> for Struct<T> |         -----     ^^^^^^^^^^^^     ^^^^^^^^^ |         | |         unsatisfied trait bound introduced here note: required by a bound in `Eq` --> $SRC_DIR/core/src/cmp.rs:LL:COL = note: this error originates in the derive macro `Eq` (in Nightly builds, run with -Z macro-backtrace for more info) help: consider restricting type parameter `T` | LL | pub struct Struct<T: std::clone::Clone>(T); |                    +++++++++++++++++++ error: aborting due to 1 previous error For more information about this error, try `rustc --explain E0277`. </ins>
} } <del> pub fn is_async(self) -> bool { matches!(self, CoroutineKind::Async { .. }) } pub fn is_gen(self) -> bool { matches!(self, CoroutineKind::Gen { .. }) </del> <ins> pub fn as_str(self) -> &'static str { match self { CoroutineKind::Async { .. } => "async", CoroutineKind::Gen { .. } => "gen", CoroutineKind::AsyncGen { .. } => "async gen", } </ins> } pub fn closure_id(self) -> NodeId {
ast_passes_bound_in_context = bounds on `type`s in {$ctx} have no effect <del> ast_passes_const_and_async = functions cannot be both `const` and `async` .const = `const` because of this .async = `async` because of this .label = {""} </del> ast_passes_const_and_c_variadic = functions cannot be both `const` and C-variadic .const = `const` because of this .variadic = C-variadic because of this <ins> ast_passes_const_and_coroutine = functions cannot be both `const` and `{$coroutine_kind}` .const = `const` because of this .coroutine = `{$coroutine_kind}` because of this .label = {""} </ins> ast_passes_const_bound_trait_object = const trait bounds are not allowed in trait object types ast_passes_const_without_body =
// Functions cannot both be `const async` or `const gen` if let Some(&FnHeader { <del> constness: Const::Yes(cspan), </del> <ins> constness: Const::Yes(const_span), </ins> coroutine_kind: Some(coroutine_kind), .. }) = fk.header() { <del> let aspan = match coroutine_kind { CoroutineKind::Async { span: aspan, .. } | CoroutineKind::Gen { span: aspan, .. } | CoroutineKind::AsyncGen { span: aspan, .. } => aspan, }; // FIXME(gen_blocks): Report a different error for `const gen` self.dcx().emit_err(errors::ConstAndAsync { spans: vec![cspan, aspan], cspan, aspan, </del> <ins> self.dcx().emit_err(errors::ConstAndCoroutine { spans: vec![coroutine_kind.span(), const_span], const_span, coroutine_span: coroutine_kind.span(), coroutine_kind: coroutine_kind.as_str(), </ins> span, }); }
} #[derive(Diagnostic)] <del> #[diag(ast_passes_const_and_async)] pub(crate) struct ConstAndAsync { </del> <ins> #[diag(ast_passes_const_and_coroutine)] pub(crate) struct ConstAndCoroutine { </ins> #[primary_span] pub spans: Vec<Span>, #[label(ast_passes_const)] <del> pub cspan: Span, #[label(ast_passes_async)] pub aspan: Span, </del> <ins> pub const_span: Span, #[label(ast_passes_coroutine)] pub coroutine_span: Span, </ins> #[label] pub span: Span, <ins> pub coroutine_kind: &'static str, </ins> } #[derive(Diagnostic)]
) => { eq_closure_binder(lb, rb) && lc == rc <del> && la.map_or(false, CoroutineKind::is_async) == ra.map_or(false, CoroutineKind::is_async) </del> <ins> && eq_coroutine_kind(*la, *ra) </ins> && lm == rm && eq_fn_decl(lf, rf) && eq_expr(le, re)
} } <ins> fn eq_coroutine_kind(a: Option<CoroutineKind>, b: Option<CoroutineKind>) -> bool { match (a, b) { (Some(CoroutineKind::Async { .. }), Some(CoroutineKind::Async { .. })) | (Some(CoroutineKind::Gen { .. }), Some(CoroutineKind::Gen { .. })) | (Some(CoroutineKind::AsyncGen { .. }), Some(CoroutineKind::AsyncGen { .. })) | (None, None) => true, _ => false, } } </ins> pub fn eq_field(l: &ExprField, r: &ExprField) -> bool { l.is_placeholder == r.is_placeholder && eq_id(l.ident, r.ident)
<ins> error: functions cannot be both `const` and `gen` --> $DIR/const_gen_fn.rs:6:1 | LL | const gen fn a() {} | ^^^^^-^^^---------- | |     | | |     `gen` because of this | `const` because of this error: functions cannot be both `const` and `async gen` --> $DIR/const_gen_fn.rs:9:1 | LL | const async gen fn b() {} | ^^^^^-^^^^^^^^^---------- | |     | | |     `async gen` because of this | `const` because of this error: aborting due to 2 previous errors </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. trait Foo { fn bar(&mut self, other: &mut Foo); } struct Baz; impl Foo for Baz { fn bar(&mut self, other: &Foo) {} //~^ ERROR method `bar` has an incompatible type for trait: values differ in mutability [E0053] } 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. #![feature(overloaded_calls)] use std::{fmt, ops}; struct Shower<T> { x: T } impl<T: fmt::Show> ops::Fn<(), ()> for Shower<T> { fn call(&self, _args: ()) { //~^ ERROR `call` has an incompatible type for trait: expected "rust-call" fn but found "Rust" fn println!("{}", self.x); } } fn make_shower<T>(x: T) -> Shower<T> { Shower { x: x } } pub fn main() { let show3 = make_shower(3i); show3(); } </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. enum Foo { A = 1i64, //~^ ERROR mismatched types: expected `int` but found `i64` B = 2u8 //~^ ERROR mismatched types: expected `int` but found `u8` } 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. fn main() { if true { return } match () { () => { static MAGIC: uint = 0; } } } </ins>
buf.len() as DWORD, ptr::null()); if res == 0 { <del> fail!("[{}] FormatMessage failure", errno()); </del> <ins> // Sometimes FormatMessageW can fail e.g. system doesn't like langId, let fm_err = errno(); return format!("OS Error {} (FormatMessageW() returned error {})", err, fm_err); </ins> } <del> str::from_utf16(str::truncate_utf16_at_nul(buf)) .expect("FormatMessageW returned invalid UTF-16") </del> <ins> let msg = str::from_utf16(str::truncate_utf16_at_nul(buf)); match msg { Some(msg) => format!("OS Error {}: {}", err, msg), None => format!("OS Error {} (FormatMessageW() returned invalid UTF-16)", err), } </ins> } }
} else { cmd = Command::new(&output_file); if doctest.is_multiple_tests { <del> cmd.arg("*doctest-bin-path"); cmd.arg(&output_file); </del> <ins> cmd.env("RUSTDOC_DOCTEST_BIN_PATH", &output_file); </ins> } } if let Some(run_directory) = &rustdoc_options.test_run_directory {
use std::path::PathBuf; pub static BINARY_PATH: OnceLock<PathBuf> = OnceLock::new(); <del> pub const RUN_OPTION: &str = "*doctest-inner-test"; pub const BIN_OPTION: &str = "*doctest-bin-path"; </del> <ins> pub const RUN_OPTION: &str = "RUSTDOC_DOCTEST_RUN_NB_TEST"; </ins> #[allow(unused)] pub fn doctest_path() -> Option<&'static PathBuf> {{
#[allow(unused)] pub fn doctest_runner(bin: &std::path::Path, test_nb: usize) -> Result<(), String> {{ let out = std::process::Command::new(bin) <del> .arg(self::RUN_OPTION) .arg(test_nb.to_string()) </del> <ins> .env(self::RUN_OPTION, test_nb.to_string()) .args(std::env::args().skip(1).collect::<Vec<_>>()) </ins> .output() .expect("failed to run command"); if !out.status.success() {{
#[rustc_main] fn main() -> std::process::ExitCode {{ const TESTS: [test::TestDescAndFn; {nb_tests}] = [{ids}]; <del> let bin_marker = std::ffi::OsStr::new(__doctest_mod::BIN_OPTION); </del> let test_marker = std::ffi::OsStr::new(__doctest_mod::RUN_OPTION); let test_args = &[{test_args}]; <ins> const ENV_BIN: &'static str = "RUSTDOC_DOCTEST_BIN_PATH"; </ins> <del> let mut args = std::env::args_os().skip(1); while let Some(arg) = args.next() {{ if arg == bin_marker {{ let Some(binary) = args.next() else {{ panic!("missing argument after `{{}}`", __doctest_mod::BIN_OPTION); }}; if crate::__doctest_mod::BINARY_PATH.set(binary.into()).is_err() {{ panic!("`{{}}` option was used more than once", bin_marker.to_string_lossy()); }} return std::process::Termination::report(test::test_main(test_args, Vec::from(TESTS), None)); }} else if arg == test_marker {{ let Some(nb_test) = args.next() else {{ panic!("missing argument after `{{}}`", __doctest_mod::RUN_OPTION); }}; if let Some(nb_test) = nb_test.to_str().and_then(|nb| nb.parse::<usize>().ok()) {{ if let Some(test) = TESTS.get(nb_test) {{ if let test::StaticTestFn(f) = test.testfn {{ return std::process::Termination::report(f()); }} </del> <ins> if let Ok(binary) = std::env::var(ENV_BIN) {{ let _ = crate::__doctest_mod::BINARY_PATH.set(binary.into()); unsafe {{ std::env::remove_var(ENV_BIN); }} return std::process::Termination::report(test::test_main(test_args, Vec::from(TESTS), None)); }} else if let Ok(nb_test) = std::env::var(__doctest_mod::RUN_OPTION) {{ if let Ok(nb_test) = nb_test.parse::<usize>() {{ if let Some(test) = TESTS.get(nb_test) {{ if let test::StaticTestFn(f) = test.testfn {{ return std::process::Termination::report(f()); </ins> }} }} <del> panic!("Unexpected value after `{{}}`", __doctest_mod::RUN_OPTION); </del> }} <ins> panic!("Unexpected value for `{{}}`", __doctest_mod::RUN_OPTION); </ins> }} <del> eprintln!("WARNING: No argument provided so doctests will be run in the same process"); </del> <ins> eprintln!("WARNING: No rustdoc doctest environment variable provided so doctests will be run in  the same process"); </ins> std::process::Termination::report(test::test_main(test_args, Vec::from(TESTS), None)) }}", nb_tests = self.nb_tests,
cmd.args(lint_flags.split_whitespace()); } <ins> // Conditionally pass `-Zon-broken-pipe=kill` to underlying rustc. Not all binaries want // `-Zon-broken-pipe=kill`, which includes cargo itself. if env::var_os("FORCE_ON_BROKEN_PIPE_KILL").is_some() { cmd.arg("-Z").arg("on-broken-pipe=kill"); } </ins> if target.is_some() { // The stage0 compiler has a special sysroot distinct from what we // actually downloaded, so we just always pass the `--sysroot` option,
cargo.rustdocflag("-Zcrate-attr=warn(rust_2018_idioms)"); <del> // If the rustc output is piped to e.g. `head -n1` we want the process to be // killed, rather than having an error bubble up and cause a panic. </del> <ins> // If the rustc output is piped to e.g. `head -n1` we want the process to be killed, rather than // having an error bubble up and cause a panic. // // FIXME(jieyouxu): this flag is load-bearing for rustc to not ICE on broken pipes, because // rustc internally sometimes uses std `println!` -- but std `println!` by default will panic on // broken pipes, and uncaught panics will manifest as an ICE. The compiler *should* handle this // properly, but this flag is set in the meantime to paper over the I/O errors. // // See <https://github.com/rust-lang/rust/issues/131059> for details. // // Also see the discussion for properly handling I/O errors related to broken pipes, i.e. safe // variants of `println!` in // <https://rust-lang.zulipchat.com/#narrow/stream/131828-t-compiler/topic/Internal.20lint.20for.20raw.20.60print!.60.20and.20.60println!.60.3F>. </ins> cargo.rustflag("-Zon-broken-pipe=kill"); if builder.config.llvm_enzyme {