jiebi/CodeConvo huggingface dataset:
} let base_dir = Path::new("/rustc/FAKE_PREFIX"); <del> // Paths into the libstd/libcore </del> <ins> // Fake paths into the libstd/libcore </ins> normalize_path(&base_dir.join("library"), "$SRC_DIR"); // `ui-fulldeps` tests can show paths to the compiler source when testing macros from // `rustc_macros` // eg. /home/user/rust/compiler normalize_path(&base_dir.join("compiler"), "$COMPILER_DIR"); <ins> // Real paths into the libstd/libcore let rust_src_dir = &self.config.sysroot_base.join("lib/rustlib/src/rust"); rust_src_dir.try_exists().expect(&*format!("{} should exists", rust_src_dir.display())); let rust_src_dir = rust_src_dir.read_link().unwrap_or(rust_src_dir.to_path_buf()); normalize_path(&rust_src_dir.join("library"), "$SRC_DIR_REAL"); </ins> // Paths into the build directory let test_build_dir = &self.config.build_base; let parent_build_dir = test_build_dir.parent().unwrap().parent().unwrap().parent().unwrap();
<ins> //@ revisions: with-remap without-remap //@ compile-flags: -g -Ztranslate-remapped-path-to-local-path=yes //@ [with-remap]compile-flags: --remap-path-prefix={{rust-src-base}}=remapped //@ [with-remap]compile-flags: --remap-path-prefix={{src-base}}=remapped-tests-ui //@ [without-remap]compile-flags: //@ error-pattern: E0507 // The $SRC_DIR*.rs:LL:COL normalisation doesn't kick in automatically // as the remapped revision will not begin with $SRC_DIR_REAL, // so we have to do it ourselves. //@ normalize-stderr-test: ".rs:d+:d+" -> ".rs:LL:COL" use std::thread; struct Worker { thread: thread::JoinHandle<()>, } impl Drop for Worker { fn drop(&mut self) { self.thread.join().unwrap(); } } pub fn main(){} </ins>
<ins> error[E0507]: cannot move out of `self.thread` which is behind a mutable reference --> remapped-tests-ui/errors/remap-path-prefix-sysroot.rs:LL:COL | LL |         self.thread.join().unwrap(); |         ^^^^^^^^^^^ ------ `self.thread` moved due to this method call |         | |         move occurs because `self.thread` has type `JoinHandle<()>`, which does not implement the `Copy` trait | note: `JoinHandle::<T>::join` takes ownership of the receiver `self`, which moves `self.thread` --> remapped/library/std/src/thread/mod.rs:LL:COL | LL |     pub fn join(self) -> Result<T> { |                 ^^^^ error: aborting due to 1 previous error For more information about this error, try `rustc --explain E0507`. </ins>
<ins> error[E0507]: cannot move out of `self.thread` which is behind a mutable reference --> $DIR/remap-path-prefix-sysroot.rs:LL:COL | LL |         self.thread.join().unwrap(); |         ^^^^^^^^^^^ ------ `self.thread` moved due to this method call |         | |         move occurs because `self.thread` has type `JoinHandle<()>`, which does not implement the `Copy` trait | note: `JoinHandle::<T>::join` takes ownership of the receiver `self`, which moves `self.thread` --> $SRC_DIR_REAL/std/src/thread/mod.rs:LL:COL | LL |     pub fn join(self) -> Result<T> { |                 ^^^^ error: aborting due to 1 previous error For more information about this error, try `rustc --explain E0507`. </ins>
|| self.suggest_boxing_when_appropriate(err, expr, expected, expr_ty) || self.suggest_block_to_brackets_peeling_refs(err, expr, expr_ty, expected) || self.suggest_copied_or_cloned(err, expr, expr_ty, expected) <ins> || self.suggest_clone_for_ref(err, expr, expr_ty, expected) </ins> || self.suggest_into(err, expr, expr_ty, expected) || self.suggest_floating_point_literal(err, expr, expected); if !suggested {
} } <ins> pub(crate) fn suggest_clone_for_ref( &self, diag: &mut Diagnostic, expr: &hir::Expr<'_>, expr_ty: Ty<'tcx>, expected_ty: Ty<'tcx>, ) -> bool { if let ty::Ref(_, inner_ty, hir::Mutability::Not) = expr_ty.kind() && let Some(clone_trait_def) = self.tcx.lang_items().clone_trait() && expected_ty == *inner_ty && self .infcx .type_implements_trait( clone_trait_def, [self.tcx.erase_regions(expected_ty)], self.param_env ) .must_apply_modulo_regions() { diag.span_suggestion_verbose( expr.span.shrink_to_hi(), "consider using clone here", ".clone()", Applicability::MachineApplicable, ); return true; } false } </ins> pub(crate) fn suggest_copied_or_cloned( &self, diag: &mut Diagnostic,
use crate::traits::{NormalizeExt, ObligationCtxt}; use hir::def::CtorOf; <del> use hir::HirId; </del> <ins> use hir::{Expr, HirId}; </ins> use rustc_data_structures::fx::FxHashSet; use rustc_data_structures::stack::ensure_sufficient_stack; use rustc_errors::{
trait_pred: ty::PolyTraitPredicate<'tcx>, ); <ins> fn suggest_add_clone_to_arg( &self, obligation: &PredicateObligation<'tcx>, err: &mut Diagnostic, trait_pred: ty::PolyTraitPredicate<'tcx>, ) -> bool; </ins> fn suggest_add_reference_to_arg( &self, obligation: &PredicateObligation<'tcx>,
} } <ins> fn suggest_add_clone_to_arg( &self, obligation: &PredicateObligation<'tcx>, err: &mut Diagnostic, trait_pred: ty::PolyTraitPredicate<'tcx>, ) -> bool { let self_ty = self.resolve_vars_if_possible(trait_pred.self_ty()); let ty = self.tcx.erase_late_bound_regions(self_ty); let owner = self.tcx.hir().get_parent_item(obligation.cause.body_id); let Some(generics) = self.tcx.hir().get_generics(owner.def_id) else { return false }; let ty::Ref(_, inner_ty, hir::Mutability::Not) = ty.kind() else { return false }; let ty::Param(param) = inner_ty.kind() else { return false }; let ObligationCauseCode::FunctionArgumentObligation { arg_hir_id, .. } = obligation.cause.code() else { return false }; let arg_node = self.tcx.hir().get(*arg_hir_id); let Node::Expr(Expr { kind: hir::ExprKind::Path(_), ..}) = arg_node else { return false }; let clone_trait = self.tcx.require_lang_item(LangItem::Clone, None); let has_clone = |ty| { self.type_implements_trait(clone_trait, [ty], obligation.param_env) .must_apply_modulo_regions() }; let new_obligation = self.mk_trait_obligation_with_new_self_ty( obligation.param_env, trait_pred.map_bound(|trait_pred| (trait_pred, *inner_ty)), ); if self.predicate_may_hold(&new_obligation) && has_clone(ty) { if !has_clone(param.to_ty(self.tcx)) { suggest_constraining_type_param( self.tcx, generics, err, param.name.as_str(), "Clone", Some(clone_trait), ); } err.span_suggestion_verbose( obligation.cause.span.shrink_to_hi(), "consider using clone here", ".clone()".to_string(), Applicability::MaybeIncorrect, ); return true; } false } </ins> fn suggest_add_reference_to_arg( &self, obligation: &PredicateObligation<'tcx>,
<ins> error[E0308]: mismatched types --> $DIR/issue-106443-sugg-clone-for-arg.rs:11:9 | LL |     foo(s); |     --- ^ expected struct `S`, found `&S` |     | |     arguments to this function are incorrect | note: function defined here --> $DIR/issue-106443-sugg-clone-for-arg.rs:7:4 | LL | fn foo(_: S) {} |    ^^^ ---- help: consider using clone here | LL |     foo(s.clone()); |          ++++++++ error[E0308]: mismatched types --> $DIR/issue-106443-sugg-clone-for-arg.rs:17:9 | LL |     bar(t); |     --- ^ expected struct `T`, found `&T` |     | |     arguments to this function are incorrect | note: function defined here --> $DIR/issue-106443-sugg-clone-for-arg.rs:14:4 | LL | fn bar(_: T) {} |    ^^^ ---- error: aborting due to 2 previous errors For more information about this error, try `rustc --explain E0308`. </ins>
<ins> #[derive(Clone)] struct S; trait X {} impl X for S {} fn foo<T: X>(_: T) {} fn bar<T: X>(s: &T) { foo(s); //~ ERROR the trait bound `&T: X` is not satisfied } fn bar_with_clone<T: X + Clone>(s: &T) { foo(s); //~ ERROR the trait bound `&T: X` is not satisfied } fn main() { let s = &S; bar(s); } </ins>
<ins> error[E0277]: the trait bound `&T: X` is not satisfied --> $DIR/issue-106443-sugg-clone-for-bound.rs:10:9 | LL |     foo(s); |         ^ the trait `X` is not implemented for `&T` | help: consider further restricting this bound | LL | fn bar<T: X + Clone>(s: &T) { |             +++++++ help: consider using clone here | LL |     foo(s.clone()); |          ++++++++ error[E0277]: the trait bound `&T: X` is not satisfied --> $DIR/issue-106443-sugg-clone-for-bound.rs:14:9 | LL |     foo(s); |         ^ the trait `X` is not implemented for `&T` | help: consider using clone here | LL |     foo(s.clone()); |          ++++++++ error: aborting due to 2 previous errors For more information about this error, try `rustc --explain E0277`. </ins>
cx: &mut DocContext<'_>, item_def_id: DefId, ) -> impl Iterator<Item = Item> { <del> // FIXME: To be removed once `parallel_compiler` bugs are fixed! // More information in <https://github.com/rust-lang/rust/pull/106930>. if cfg!(parallel_compiler) { return vec![].into_iter().chain(vec![].into_iter()); } </del> let auto_impls = cx .sess() .prof
assert_eq!(_green_node_index, DepNodeIndex::SINGLETON_DEPENDENCYLESS_ANON_NODE); // Instantiate a dependy-less red node only once for anonymous queries. <del> let (_red_node_index, _prev_and_index) = current.intern_node( </del> <ins> let (red_node_index, red_node_prev_index_and_color) = current.intern_node( </ins> profiler, &prev_graph, DepNode { kind: DepKind::RED, hash: Fingerprint::ZERO.into() },
None, false, ); <del> assert_eq!(_red_node_index, DepNodeIndex::FOREVER_RED_NODE); assert!(matches!(_prev_and_index, None | Some((_, DepNodeColor::Red)))); </del> <ins> assert_eq!(red_node_index, DepNodeIndex::FOREVER_RED_NODE); match red_node_prev_index_and_color { None => { // This is expected when we have no previous compilation session. assert!(prev_graph_node_count == 0); } Some((prev_red_node_index, DepNodeColor::Red)) => { assert_eq!(prev_red_node_index.as_usize(), red_node_index.as_usize()); colors.insert(prev_red_node_index, DepNodeColor::Red); } Some((_, DepNodeColor::Green(_))) => { // There must be a logic error somewhere if we hit this branch. panic!("DepNodeIndex::FOREVER_RED_NODE evaluated to DepNodeColor::Green") } } </ins> DepGraph { data: Some(Lrc::new(DepGraphData {
})) }; <del> let task_deps_ref = match &task_deps { Some(deps) => TaskDepsRef::Allow(deps), None => TaskDepsRef::Ignore, }; </del> <ins> let task_deps_ref = task_deps.as_ref().map(TaskDepsRef::Allow).unwrap_or(TaskDepsRef::EvalAlways); </ins> let result = K::with_deps(task_deps_ref, || task(cx, arg)); let edges = task_deps.map_or_else(|| smallvec![], |lock| lock.into_inner().reads);
K::read_deps(|task_deps| { let mut task_deps = match task_deps { TaskDepsRef::Allow(deps) => deps.lock(), <ins> TaskDepsRef::EvalAlways => { // We don't need to record dependencies of eval_always // queries. They are re-evaluated unconditionally anyway. return; } </ins> TaskDepsRef::Ignore => return, TaskDepsRef::Forbid => { panic!("Illegal read of: {dep_node_index:?}")
let mut edges = SmallVec::new(); K::read_deps(|task_deps| match task_deps { TaskDepsRef::Allow(deps) => edges.extend(deps.lock().reads.iter().copied()), <del> TaskDepsRef::Ignore => {} // During HIR lowering, we have no dependencies. </del> <ins> TaskDepsRef::EvalAlways => { edges.push(DepNodeIndex::FOREVER_RED_NODE); } TaskDepsRef::Ignore => {} </ins> TaskDepsRef::Forbid => { panic!("Cannot summarize when dependencies are not recorded.") }
/// `TaskDeps`. This is used when executing a 'normal' query /// (no `eval_always` modifier) Allow(&'a Lock<TaskDeps<K>>), <del> /// New dependencies are ignored. This is used when /// executing an `eval_always` query, since there's no </del> <ins> /// This is used when executing an `eval_always` query. We don't </ins> /// need to track dependencies for a query that's always <del> /// re-executed. This is also used for `dep_graph.with_ignore` </del> <ins> /// re-executed -- but we need to know that this is an `eval_always` /// query in order to emit dependencies to `DepNodeIndex::FOREVER_RED_NODE` /// when directly feeding other queries. EvalAlways, /// New dependencies are ignored. This is also used for `dep_graph.with_ignore`. </ins> Ignore, /// Any attempt to add new dependencies will cause a panic. /// This is used when decoding a query result from disk,
<ins> // revisions: cpass1 cpass2 #![crate_type = "rlib"] use std::fmt::Debug; // MCVE kindly provided by Nilstrieb at // https://github.com/rust-lang/rust/issues/108481#issuecomment-1493080185 #[derive(Debug)] pub struct ConstGeneric<const CHUNK_SIZE: usize> { _p: [(); CHUNK_SIZE], } #[cfg(cpass1)] impl<const CHUNK_SIZE: usize> ConstGeneric<CHUNK_SIZE> {} </ins>
}); buf.push_str(&part.snippet); let cur_hi = sm.lookup_char_pos(part.span.hi()); <del> if prev_hi.line == cur_lo.line && cur_hi.line == cur_lo.line { </del> <ins> if cur_hi.line == cur_lo.line { </ins> // Account for the difference between the width of the current code and the // snippet being suggested, so that the *later* suggestions are correctly // aligned on the screen.
<ins> // compile-flags: --error-format=human --color=always // ignore-windows fn short(foo_bar: &Vec<&i32>) -> &i32 { //~ ERROR missing lifetime specifier &12 } fn long( //~ ERROR missing lifetime specifier foo_bar: &Vec<&i32>, something_very_long_so_that_the_line_will_wrap_around__________: i32, ) -> &i32 { &12 } fn long2( //~ ERROR missing lifetime specifier foo_bar: &Vec<&i32>) -> &i32 { &12 } fn main() {} </ins>
BareFunctionDecl { unsafety: bare_fn.unsafety, abi: bare_fn.abi, decl, generic_params } } <del> /// This visitor is used to go through only the "top level" of a item and not enter any sub /// item while looking for a given `Ident` which is stored into `item` if found. struct OneLevelVisitor<'hir> { </del> <ins> /// Get DefId of of an item's user-visible parent. /// /// "User-visible" should account for re-exporting and inlining, which is why this function isn't /// just `tcx.parent(def_id)`. If the provided `path` has more than one path element, the `DefId` /// of the second-to-last will be given. /// /// ```text /// use crate::foo::Bar; ///            ^^^ DefId of this item will be returned /// ``` /// /// If the provided path has only one item, `tcx.parent(def_id)` will be returned instead. fn get_path_parent_def_id( tcx: TyCtxt<'_>, def_id: DefId, path: &hir::UsePath<'_>, ) -> Option<DefId> { if let [.., parent_segment, _] = &path.segments { match parent_segment.res { hir::def::Res::Def(_, parent_def_id) => Some(parent_def_id), _ if parent_segment.ident.name == kw::Crate => { // In case the "parent" is the crate, it'll give `Res::Err` so we need to // circumvent it this way. Some(tcx.parent(def_id)) } _ => None, } } else { // If the path doesn't have a parent, then the parent is the current module. Some(tcx.parent(def_id)) } } /// This visitor is used to find an HIR Item based on its `use` path. This doesn't use the ordinary /// name resolver because it does not walk all the way through a chain of re-exports. pub(crate) struct OneLevelVisitor<'hir> { </ins> map: rustc_middle::hir::map::Map<'hir>, <del> item: Option<&'hir hir::Item<'hir>>, </del> <ins> pub(crate) item: Option<&'hir hir::Item<'hir>>, </ins> looking_for: Ident, target_def_id: LocalDefId, } impl<'hir> OneLevelVisitor<'hir> { <del> fn new(map: rustc_middle::hir::map::Map<'hir>, target_def_id: LocalDefId) -> Self { </del> <ins> pub(crate) fn new(map: rustc_middle::hir::map::Map<'hir>, target_def_id: LocalDefId) -> Self { </ins> Self { map, item: None, looking_for: Ident::empty(), target_def_id } } <del> fn reset(&mut self, looking_for: Ident) { self.looking_for = looking_for; </del> <ins> pub(crate) fn find_target( &mut self, tcx: TyCtxt<'_>, def_id: DefId, path: &hir::UsePath<'_>, ) -> Option<&'hir hir::Item<'hir>> { let parent_def_id = get_path_parent_def_id(tcx, def_id, path)?; let parent = self.map.get_if_local(parent_def_id)?; // We get the `Ident` we will be looking for into `item`. self.looking_for = path.segments[path.segments.len() - 1].ident; // We reset the `item`. </ins> self.item = None; <ins> match parent { hir::Node::Item(parent_item) => { hir::intravisit::walk_item(self, parent_item); } hir::Node::Crate(m) => { hir::intravisit::walk_mod( self, m, tcx.local_def_id_to_hir_id(parent_def_id.as_local().unwrap()), ); } _ => return None, } self.item </ins> } }
add_without_unwanted_attributes(attributes, hir_map.attrs(item.hir_id()), is_inline); } <del> let def_id = if let [.., parent_segment, _] = &path.segments { match parent_segment.res { hir::def::Res::Def(_, def_id) => def_id, _ if parent_segment.ident.name == kw::Crate => { // In case the "parent" is the crate, it'll give `Res::Err` so we need to // circumvent it this way. tcx.parent(item.owner_id.def_id.to_def_id()) } _ => break, } } else { // If the path doesn't have a parent, then the parent is the current module. tcx.parent(item.owner_id.def_id.to_def_id()) }; let Some(parent) = hir_map.get_if_local(def_id) else { break }; // We get the `Ident` we will be looking for into `item`. let looking_for = path.segments[path.segments.len() - 1].ident; visitor.reset(looking_for); match parent { hir::Node::Item(parent_item) => { hir::intravisit::walk_item(&mut visitor, parent_item); } hir::Node::Crate(m) => { hir::intravisit::walk_mod( &mut visitor, m, tcx.local_def_id_to_hir_id(def_id.as_local().unwrap()), ); } _ => break, } if let Some(i) = visitor.item { </del> <ins> if let Some(i) = visitor.find_target(tcx, item.owner_id.def_id.to_def_id(), path) { </ins> item = i; } else { break;
return false; } <ins> if !please_inline && let mut visitor = OneLevelVisitor::new(self.cx.tcx.hir(), res_did) && let Some(item) = visitor.find_target(self.cx.tcx, def_id.to_def_id(), path) && let item_def_id = item.owner_id.def_id && item_def_id != def_id && self .cx .cache .effective_visibilities .is_directly_public(self.cx.tcx, item_def_id.to_def_id()) && !inherits_doc_hidden(self.cx.tcx, item_def_id) { // The imported item is public and not `doc(hidden)` so no need to inline it. return false; } </ins> let ret = match tcx.hir().get_by_def_id(res_did) { Node::Item(&hir::Item { kind: hir::ItemKind::Mod(ref m), .. }) if glob => { let prev = mem::replace(&mut self.inlining, true);
<ins> // This test ensures that the `struct.B.html` only exists in `a`: // since `a::B` is public (and inlined too), `self::a::B` doesn't // need to be inlined as well. #![crate_name = "foo"] pub mod a { // @has 'foo/a/index.html' // Should only contain "Structs". // @count - '//*[@id="main-content"]//*[@class="item-table"]' 1 // @has - '//*[@id="structs"]' 'Structs' // @has - '//*[@id="main-content"]//a[@href="struct.A.html"]' 'A' // @has - '//*[@id="main-content"]//a[@href="struct.B.html"]' 'B' mod b { pub struct B; } pub use self::b::B; pub struct A; } // @has 'foo/index.html' // @!has - '//*[@id="structs"]' 'Structs' // @has - '//*[@id="reexports"]' 'Re-exports' // @has - '//*[@id="modules"]' 'Modules' // @has - '//*[@id="main-content"]//*[@id="reexport.A"]' 'pub use self::a::A;' // @has - '//*[@id="main-content"]//*[@id="reexport.B"]' 'pub use self::a::B;' // Should only contain "Modules" and "Re-exports". // @count - '//*[@id="main-content"]//*[@class="item-table"]' 2 pub use self::a::{A, B}; </ins>
None } <ins> fn suggest_missing_writer( &self, rcvr_ty: Ty<'tcx>, args: (&'tcx hir::Expr<'tcx>, &'tcx [hir::Expr<'tcx>]), ) -> DiagnosticBuilder<'_, ErrorGuaranteed> { let (ty_str, _ty_file) = self.tcx.short_ty_string(rcvr_ty); let mut err = struct_span_err!(self.tcx.sess, args.0.span, E0599, "cannot write into `{}`", ty_str); err.span_note( args.0.span, "must implement `io::Write`, `fmt::Write`, or have a `write_fmt` method", ); if let ExprKind::Lit(_) = args.0.kind { err.span_help( args.0.span.shrink_to_lo(), "a writer is needed before this format string", ); }; err } </ins> pub fn report_no_match_method_error( &self, mut span: Span,
} } <del> let mut err = struct_span_err!( tcx.sess, span, E0599, "no {} named `{}` found for {} `{}` in the current scope", item_kind, item_name, rcvr_ty.prefix_string(self.tcx), ty_str_reported, ); </del> <ins> let is_write = sugg_span.ctxt().outer_expn_data().macro_def_id.map_or(false, |def_id| { tcx.is_diagnostic_item(sym::write_macro, def_id) || tcx.is_diagnostic_item(sym::writeln_macro, def_id) }) && item_name.name == Symbol::intern("write_fmt"); let mut err = if is_write && let Some(args) = args { self.suggest_missing_writer(rcvr_ty, args) } else { struct_span_err!( tcx.sess, span, E0599, "no {} named `{}` found for {} `{}` in the current scope", item_kind, item_name, rcvr_ty.prefix_string(self.tcx), ty_str_reported, ) }; </ins> if tcx.sess.source_map().is_multiline(sugg_span) { err.span_label(sugg_span.with_hi(span.lo()), ""); }
<ins> // Check error for missing writer in writeln! and write! macro fn main() { let x = 1; let y = 2; write!("{}_{}", x, y); //~^ ERROR format argument must be a string literal //~| HELP you might be missing a string literal to format with //~| ERROR cannot write into `&'static str` //~| NOTE must implement `io::Write`, `fmt::Write`, or have a `write_fmt` method //~| HELP a writer is needed before this format string writeln!("{}_{}", x, y); //~^ ERROR format argument must be a string literal //~| HELP you might be missing a string literal to format with //~| ERROR cannot write into `&'static str` //~| NOTE must implement `io::Write`, `fmt::Write`, or have a `write_fmt` method //~| HELP a writer is needed before this format string } </ins>
<ins> error: format argument must be a string literal --> $DIR/missing-writer.rs:5:21 | LL |     write!("{}_{}", x, y); |                     ^ | help: you might be missing a string literal to format with | LL |     write!("{}_{}", "{} {}", x, y); |                     ++++++++ error: format argument must be a string literal --> $DIR/missing-writer.rs:11:23 | LL |     writeln!("{}_{}", x, y); |                       ^ | help: you might be missing a string literal to format with | LL |     writeln!("{}_{}", "{} {}", x, y); |                       ++++++++ error[E0599]: cannot write into `&'static str` --> $DIR/missing-writer.rs:5:12 | LL |     write!("{}_{}", x, y); |     -------^^^^^^^------- method not found in `&str` | note: must implement `io::Write`, `fmt::Write`, or have a `write_fmt` method --> $DIR/missing-writer.rs:5:12 | LL |     write!("{}_{}", x, y); |            ^^^^^^^ help: a writer is needed before this format string --> $DIR/missing-writer.rs:5:12 | LL |     write!("{}_{}", x, y); |            ^ error[E0599]: cannot write into `&'static str` --> $DIR/missing-writer.rs:11:14 | LL |     writeln!("{}_{}", x, y); |     ---------^^^^^^^------- method not found in `&str` | note: must implement `io::Write`, `fmt::Write`, or have a `write_fmt` method --> $DIR/missing-writer.rs:11:14 | LL |     writeln!("{}_{}", x, y); |              ^^^^^^^ help: a writer is needed before this format string --> $DIR/missing-writer.rs:11:14 | LL |     writeln!("{}_{}", x, y); |              ^ error: aborting due to 4 previous errors For more information about this error, try `rustc --explain E0599`. </ins>
--> $SRC_DIR/std/src/io/buffered/bufwriter.rs:LL:COL error[E0599]: the method `write_fmt` exists for struct `BufWriter<&dyn Write>`, but its trait bounds were not satisfied <del> --> $DIR/mut-borrow-needed-by-trait.rs:21:5 </del> <ins> --> $DIR/mut-borrow-needed-by-trait.rs:21:14 </ins> | LL |     writeln!(fp, "hello world").unwrap(); <del> |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^ method cannot be called on `BufWriter<&dyn Write>` due to unsatisfied trait bounds </del> <ins> |     ---------^^---------------- method cannot be called on `BufWriter<&dyn Write>` due to unsatisfied trait bounds </ins> --> $SRC_DIR/std/src/io/buffered/bufwriter.rs:LL:COL | = note: doesn't satisfy `BufWriter<&dyn std::io::Write>: std::io::Write` | <ins> note: must implement `io::Write`, `fmt::Write`, or have a `write_fmt` method --> $DIR/mut-borrow-needed-by-trait.rs:21:14 | LL |     writeln!(fp, "hello world").unwrap(); |              ^^ </ins> = note: the following trait bounds were not satisfied: `&dyn std::io::Write: std::io::Write` which is required by `BufWriter<&dyn std::io::Write>: std::io::Write` <del> = note: this error originates in the macro `writeln` (in Nightly builds, run with -Z macro-backtrace for more info) </del> error: aborting due to 3 previous errors