jiebi/CodeConvo huggingface dataset:
Change:
When compiling the test E0501, I get the following result: The message "cannot borrow it as because previous closure requires unique access" looks wrong - I think the arguments to got mixed up a bit.
I am working on this.

Discussion:
Origin::Mir, ), <del> (_, _, _, BorrowKind::Unique, _, _) => self.tcx </del> <ins> (BorrowKind::Shared, lft, _, BorrowKind::Unique, _, _) => self.tcx </ins> .cannot_reborrow_already_uniquely_borrowed( span, &desc_place, <del> "it", </del> "", <ins> lft, issued_span, "", end_issued_loan_span, Origin::Mir, ), (BorrowKind::Mut, _, lft, BorrowKind::Unique, _, _) => self.tcx .cannot_reborrow_already_uniquely_borrowed( span, &desc_place, "", lft, </ins> issued_span, "", end_issued_loan_span,

// option. This file may not be copied, modified, or distributed // except according to those terms. <ins> // ignore-tidy-linelength // revisions: ast mir //[mir]compile-flags: -Z borrowck=mir </ins> fn inside_closure(x: &mut i32) { } <del> fn outside_closure(x: &mut i32) { </del> <ins> fn outside_closure_1(x: &mut i32) { } fn outside_closure_2(x: &i32) { </ins> } fn foo(a: &mut i32) { let bar = || { inside_closure(a) }; <del> outside_closure(a); //~ ERROR E0501 </del> <ins> outside_closure_1(a); //[ast]~ ERROR cannot borrow `*a` as mutable because previous closure requires unique access //[mir]~^ ERROR cannot borrow `*a` as mutable because previous closure requires unique access outside_closure_2(a); //[ast]~ ERROR cannot borrow `*a` as immutable because previous closure requires unique access //[mir]~^ ERROR cannot borrow `*a` as immutable because previous closure requires unique access </ins> } fn main() {
Change:
I think that in , is not slice. It is just a reference for primitive type (arrary) for example: that the second on is not a right statements. against the definition of is slice type. And I think it's better to add a note. and these y are same.

Discussion:
#[doc(alias = "[")] #[doc(alias = "]")] #[doc(alias = "[]")] <del> // </del> /// A dynamically-sized view into a contiguous sequence, `[T]`. /// /// *[See also the `std::slice` module](slice/index.html).*

/// points to: /// /// ``` <del> /// let x = &mut [1, 2, 3]; </del> <ins> /// let mut x = [1, 2, 3]; /// let x = &mut x[..]; // Take a full slice of `x`. </ins> /// x[1] = 7; /// assert_eq!(x, &[1, 7, 3]); /// ``` <del> /// </del> #[stable(feature = "rust1", since = "1.0.0")] mod prim_slice { }
Change:
Here is the verbose output:
cc All the needs to have .
If is busy I can try it.
(Note: affects msp430 as well)
I saw no open PR to fix this so I opened . (I hope no one minds)

Discussion:
} } <ins> #[cfg(target_has_atomic = "ptr")] </ins> #[stable(feature = "atomic_from", since = "1.23.0")] impl<T> From<*mut T> for AtomicPtr<T> { #[inline]
Change:
turned up some usages of inline assembly which have no outputs. LLVM will just remove such inline assembly as they can never be used. We should make this an error.
Alternatively, do what GCC does and add volatile automatically if there are no outputs.
It's worth considering an error though; inline asm is uncommon and extraordinarily unsafe, conditions which generally favor explicitness over implicitness.

Discussion:
} } <ins> // If there are no outputs, the inline assembly is executed just for its side effects, // so ensure that it is volatile if outputs.is_empty() { volatile = true; } </ins> MacEager::expr(P(ast::Expr { id: ast::DUMMY_NODE_ID, node: ast::ExprKind::InlineAsm(P(ast::InlineAsm {

<ins> // Copyright 2017 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. // compile-flags: -O // ignore-asmjs #![feature(asm)] #![crate_type = "lib"] // Check that inline assembly expressions without any outputs // are marked as having side effects / being volatile // CHECK-LABEL: @assembly #[no_mangle] pub fn assembly() { unsafe { asm!("") } // CHECK: tail call void asm sideeffect "", {{.*}} } </ins>
Change:
This is an issue for moving Rust By Example, which is currently at , to . I will be working on the first step shortly. [x] Convert RBE to a submodule under [x] Add RBE to the bookshelf (thanks [x] Update book release process on forge After it is converted and RBE reaches stable: [ ] Update the main English website link a 301
Step one done! Now waiting for this to reach stable.
The forge documentation can be updated now.
This has all been done!

Discussion:
[submodule "src/binaryen"] path = src/binaryen url = https://github.com/alexcrichton/binaryen.git <ins> [submodule "src/doc/rust-by-example"] path = src/doc/rust-by-example url = https://github.com/rust-lang/rust-by-example </ins>

Kind::Bench => describe!(check::Crate, check::CrateLibrustc), Kind::Doc => describe!(doc::UnstableBook, doc::UnstableBookGen, doc::TheBook, doc::Standalone, doc::Std, doc::Test, doc::Rustc, doc::ErrorIndex, doc::Nomicon, <del> doc::Reference, doc::Rustdoc, doc::CargoBook), </del> <ins> doc::Reference, doc::Rustdoc, doc::RustByExample, doc::CargoBook), </ins> Kind::Dist => describe!(dist::Docs, dist::Mingw, dist::Rustc, dist::DebuggerScripts, dist::Std, dist::Analysis, dist::Src, dist::PlainSourceTarball, dist::Cargo, dist::Rls, dist::Rustfmt, dist::Extended, dist::HashSign,

//! //! This module implements generation for all bits and pieces of documentation //! for the Rust project. This notably includes suites like the rust book, the <del> //! nomicon, standalone documentation, etc. </del> <ins> //! nomicon, rust by example, standalone documentation, etc. </ins> //! //! Everything here is basically just a shim around calling either `rustbook` or //! `rustdoc`.

Nomicon, "src/doc/nomicon", "nomicon"; Reference, "src/doc/reference", "reference"; Rustdoc, "src/doc/rustdoc", "rustdoc"; <ins> RustByExample, "src/doc/rust-by-example", "rust-by-example"; </ins> ); #[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]

<ins> Subproject commit 4ebb8169dfe569b3dcbeab560607800bb717978a </ins>
Change:
This method is public, but its documentation doesn’t say anything about the meaning of the return value. The bit indices to interpret it are given by the numerical value of variants of the enum. But that enum is private, and all of that information is exposed in other public methods (, , , ) so it looks like the details of that encoding are intended to be private. It looks like there is no way of using that method without making assumptions about private implementation details that we might want to change. Should we document it as such and deprecate it? CC
Yeah I think we'll want to deprecate it.

Discussion:
/// Flags for formatting #[stable(feature = "rust1", since = "1.0.0")] <ins> #[rustc_deprecated(since = "1.24.0", reason = "use the `sign_plus`, `sign_minus`, `alternate`,  or `sign_aware_zero_pad` methods instead")] </ins> pub fn flags(&self) -> u32 { self.flags } /// Character used as 'fill' whenever there is alignment
Change:
When all eight segments are present in an IPv6 address specification, allows anywhere, except at the very end. Here is a test program: The output is:
The grammar in (URI syntax) says that all these cases should be rejected; i.e., is not allowed to expand to nothing.
I think all of them should be rejected because according to §2.2, At least both Python3's function and Go's function doesn't recognize .

Discussion:
// two double colons let none: Option<Ipv6Addr> = "1:2::6::8".parse().ok(); assert_eq!(None, none); <ins> // `::` indicating zero groups of zeros let none: Option<Ipv6Addr> = "1:2:3:4::5:6:7:8".parse().ok(); assert_eq!(None, none); </ins> } #[test]

} let mut tail = [0; 8]; <del> let (tail_size, _) = read_groups(self, &mut tail, 8 - head_size); </del> <ins> // `::` indicates one or more groups of 16 bits of zeros let limit = 8 - (head_size + 1); let (tail_size, _) = read_groups(self, &mut tail, limit); </ins> Some(ipv6_addr_from_head_tail(&head[..head_size], &tail[..tail_size])) }
Change:
On the latest nightly ( 2017-11-25) there's an ICE when generating the docs for the crate. Presumably somewhere along the line internal bookkeeping got confused and an invalid was generated (or a valid one was deleted), resulting in a panic during the phase 3 analysis passes. It looks like this is a regression in the latest nightly because it was works just fine on the build. Minimal Example: This was on an up-to-date Arch Linux machine.
For reference: ...
Simplified repro, no dependency needed:
Hold on, something's wrong. Edit: I've inverted the failure condition when bisecting The actual regressing commit is
The issue here is likely due to the everybody-loops pass moved to a different place. Previously it was called immediately after phase 1, now it is called in the middle of phase 2. I'm now trying to see if putting it at the end of phase 2 would help. If not we'd put it back to the beginning of phase 2. Edit: neither is working.
Also happens to
Can we prioritize fixing this? It looks like a relatively widespread problem...
Sure. Will take a look in the next days.
Minimized: I believe I see what's going on, will try to make a fix.
I've posted a fix for this issue at

Discussion:
tcx.hir.krate().visit_all_item_likes(&mut visitor); for &(def_id, span) in tcx.maybe_unused_extern_crates(LOCAL_CRATE).iter() { <ins> // The `def_id` here actually was calculated during resolution (at least // at the time of this writing) and is being shipped to us via a side // channel of the tcx. There may have been extra expansion phases, // however, which ended up removing the `def_id` *after* expansion such // as the `ReplaceBodyWithLoop` pass (which is a bit of a hack, but hey) // // As a result we need to verify that `def_id` is indeed still valid for // our AST and actually present in the HIR map. If it's not there then // there's safely nothing to warn about, and otherwise we carry on with // our execution. // // Note that if we carry through to the `extern_mod_stmt_cnum` query // below it'll cause a panic because `def_id` is actually bogus at this // point in time otherwise. if let Some(id) = tcx.hir.as_local_node_id(def_id) { if tcx.hir.find(id).is_none() { continue } } </ins> let cnum = tcx.extern_mod_stmt_cnum(def_id).unwrap(); if tcx.is_compiler_builtins(cnum) { continue

<ins> // Copyright 2017 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. // hopefully this doesn't cause an ICE pub fn foo() { extern crate std; } </ins>
Change:
Happened for these PRs so far:
Thanks for the report. This is a Travis CI issue, currently tracked in travis-ci/travis-ci. A temporary workaround that disables all Xcode 7.3 () is currently testing.

Discussion:
- env: IMAGE=dist-x86_64-linux DEPLOY_ALT=1 if: branch = try OR branch = auto <del> # FIXME: The macOS dist images are temporarily disabled until Travis bug is fixed # https://github.com/travis-ci/travis-ci/issues/8821 </del> - env: > RUST_CHECK_TARGET=dist RUST_CONFIGURE_ARGS="--enable-extended --enable-profiler"

NO_DEBUG_ASSERTIONS=1 os: osx osx_image: xcode7.3 <del> if: branch = disabled </del> <ins> if: branch = auto </ins> # macOS builders. These are placed near the beginning because they are very # slow to run.

NO_DEBUG_ASSERTIONS=1 os: osx osx_image: xcode7.3 <del> if: branch = disabled </del> <ins> if: branch = auto </ins> - env: > RUST_CHECK_TARGET=dist

NO_DEBUG_ASSERTIONS=1 os: osx osx_image: xcode7.3 <del> if: branch = disabled </del> <ins> if: branch = auto </ins> # Linux builders, remaining docker images - env: IMAGE=arm-android
Change:
When invoking a locally-built or compiled with debug assertions, debug messages can be enabled by setting the environment variable . When invoking with , log message will be displayed from all internal crates (e.g. , ) as expected. However, when invoking with RUST_LOG=, only messages from are displayed, despite many other internal crates being used by .
I suspect the blame lies somewhere within rustc_driver, but I don't know for sure.

Discussion:
dependencies = [ "build_helper 0.1.0", "cc 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)", <del> "env_logger 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)", </del> "html-diff 0.0.5 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", "pulldown-cmark 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",

doctest = false [dependencies] <del> env_logger = { version = "0.4", default-features = false } </del> log = "0.3" pulldown-cmark = { version = "0.1.0", default-features = false } html-diff = "0.0.5"
Change:
The following simpl file causes rustc to panic when compiling:
Oh, removing the lifetime parameter in the type passed to size_of does not panic:
Reproduces with the NLL borrow checker (crashes in ). cc
Triage: This is no longer ICE with the latest nightly ( forbid the case):

Discussion:
<ins> // check-fail struct Foo<'a> //~ ERROR parameter `'a` is never used [E0392] { _a: [u8; std::mem::size_of::<&'a mut u8>()] //~ ERROR  a non-static lifetime is not allowed in a `const` } pub fn main() {} </ins>

<ins> error[E0658]: a non-static lifetime is not allowed in a `const` --> $DIR/issue-46511.rs:5:35 | LL |     _a: [u8; std::mem::size_of::<&'a mut u8>()] |                                   ^^ | = note: see issue #76560 <https://github.com/rust-lang/rust/issues/76560> for more information = help: add `#![feature(generic_const_exprs)]` to the crate attributes to enable error[E0392]: parameter `'a` is never used --> $DIR/issue-46511.rs:3:12 | LL | struct Foo<'a> |            ^^ unused parameter | = help: consider removing `'a`, referring to it in a field, or using a marker such as `PhantomData` error: aborting due to 2 previous errors Some errors have detailed explanations: E0392, E0658. For more information about an error, try `rustc --explain E0392`. </ins>
Change:
I have an issue with rust (now version 1.22.1) on Solaris sparc (64bit). On intel I don't see it. I originally see it as part of Firefox build () I now believe it's rustc issue (though it could be still issue with clang-sys). Any help would be greatly appreciated. Run output looks like: Stack: With tracing: Note that clanggetTranslationUnitCursor isn't called with 'tu' set to 0. I have find out that the issue seems to be with the size of CXCursor structure which is returned: CXCursor is 32 bytes long. But if I tell clang-sys it's 16 bytes everything is perfect (when it's 17 bytes or more it causes the trouble): Following is disassembly when CXCursor is pretended to be just 16 bytes: And now with 17 bytes:
I wrote more minimalistic version of test case which rules out use of clang-sys. On intel it works as expected: But on sparc it looks weird: But with this "hack" it looks better:
Ok. I'm new to both Rust and LLVM. I tried to create for above example llvm-ir data on intel and used llc to build it on sparc. The same result could be seen. Does it mean that that issue is rather in LLVM?! On intel I did: On Sparc I did: The output is bad. See comment above (). [1]
and are wrong; structs up to 32 bytes in size, i.e. 256 bits, are returned in registers. I was also suspicious of this code in general when it was first merged as it doesn't seem very long, and handling mixed float and int structs is a little fiddly. EDIT: Well, actually, should vary based on whether it's an argument (which can be up to 16 bytes) or return value (up to 32 bytes).
Can you please suggest how to implement this? I can confirm that when modifying to contain 256 my above test examples passes as expected (though Firefox still wouldn't build).
As mentioned above. With partial fix Firefox build dies later when it calls . Which takes three arguments and the problematic first one is again 32 bytes long structure ().
Maybe you can suggest a preliminary patch to at least improve the code generation?
Are you sure? That doesn't entirely control whether a is passed by value or indirectly, but specifically it handles s which the ABI treats like arrays of primitives (incl. SIMD vectors).

Discussion:
} let size = ret.layout.size; let bits = size.bits(); <del> if bits <= 128 { </del> <ins> if bits <= 256 { </ins> let unit = if bits <= 8 { Reg::i8() } else if bits <= 16 {

} let total = arg.layout.size; <ins> if total.bits() > 128 { arg.make_indirect(); return; } </ins> arg.cast_to(Uniform { unit: Reg::i64(), total
Change:
It took me a while to figure out the compilation error in this example (): Here you get: Naturally I tried changing the pattern . That gives you: What the heck? What's going on here is that the filter is giving us an . When we skip the first , we get into "ref by default" mode, but when we explicitly acknowledge the second one, we do not get back into "by value" mode. That's kind of annoying.
To check my understanding, the turns into ?
effectively yes

Discussion:
err.emit(); } } <ins> } else if let PatKind::Ref(..) = pat.node { // When you encounter a `&pat` pattern, reset to "by // value". This is so that `x` and `y` here are by value, // as they appear to be: // // ``` // match &(&22, &44) { //   (&x, &y) => ... // } // ``` // // cc #46688 def_bm = ty::BindByValue(hir::MutImmutable); </ins> } // Lose mutability now that we know binding mode and discriminant type.

<ins> // Copyright 2017 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(match_default_bindings)] // Test that we "reset" the mode as we pass through a `&` pattern. // // cc #46688 fn surprise(x: i32) { assert_eq!(x, 2); } fn main() { let x = &(1, &2); let (_, &b) = x; surprise(b); } </ins>
Change:
Spawned off of put its simply:
My thinking here is that we should add an ensuring the (believed current invariant) holds. (We could perhaps go further and try to make the two-phase borrow system force an immediate activation when it sees an assignment to a non-temporary, if we discover that the supposed invariant does not hold.)
cc
Hmm it seems according to that the proposed invariant does not hold. Good thing we attempted to check it! Compiler error (once I a relatively narrow assertion to the MIR borrowck):

Discussion:
} } <del> mir::StatementKind::Assign(_, ref rhs) => { </del> <ins> mir::StatementKind::Assign(ref lhs, ref rhs) => { </ins> // NOTE: if/when the Assign case is revised to inspect // the assigned_place here, make sure to also // re-consider the current implementations of the

panic!("could not find BorrowIndexs for region {:?}", region); }).contains(&index)); sets.gen(&ReserveOrActivateIndex::reserved(*index)); <ins> if is_activations { // Issue #46746: Two-phase borrows handles // stmts of form `Tmp = &mut Borrow` ... match lhs { Place::Local(..) => {} // okay Place::Static(..) => unreachable!(), // (filtered by is_unsafe_place) Place::Projection(..) => { // ... can assign into projections, // e.g. `box (&mut _)`. Current // conservative solution: force // immediate activation here. sets.gen(&ReserveOrActivateIndex::active(*index)); } } } </ins> } }
Change:
<details<summaryBacktrace</summary</detailsWindows 10 (64-bit)
Which code had caused this assertion? Caused by this assertion: Which was introduced in , which is beta-nominated. cc
I'm glad I that assertion! What it likely means is that isn't a multiple of . I'd be quite surprised if and/or weren't involved.
In my case this error is caused by the crate. Simply including it in your and compiling crashes rustc. <details<summaryBacktrace</summary</detailsI'm on Arch running the latest nightly rustc.
Looks like triggers the assertion, and it has alignment but size (which is illegal), IIRC, includes some types that are ( this is indeed which has a packed ) and has caused issues in the past as well. EDIT: minimal repro:

Discussion:
}).collect::<Result<Vec<_>, _>>()?; let offset = st[i].fields.offset(field_index) + offset; <del> let LayoutDetails { size, mut align, .. } = st[i]; </del> <ins> let LayoutDetails { mut size, mut align, .. } = st[i]; </ins> let mut niche_align = niche.value.align(dl); let abi = if offset.bytes() == 0 && niche.value.size(dl) == size {

Abi::Aggregate { sized: true } }; align = align.max(niche_align); <ins> size = size.abi_align(align); </ins> return Ok(tcx.intern_layout(LayoutDetails { variants: Variants::NicheFilling {

fn clone(&self) -> Self { *self } } <del> fn main() { let one = (Some(Packed((&(), 0))), true); </del> <ins> fn sanity_check_size<T: Copy>(one: T) { </ins> let two = [one, one]; let stride = (&two[1] as *const _ as usize) - (&two[0] as *const _ as usize); <ins> assert_eq!(stride, std::mem::size_of_val(&one)); } fn main() { </ins> // This can fail if rustc and LLVM disagree on the size of a type. // In this case, `Option<Packed<(&(), u32)>>` was erronously not // marked as packed despite needing alignment `1` and containing // its `&()` discriminant, which has alignment larger than `1`. <del> assert_eq!(stride, std::mem::size_of_val(&one)); </del> <ins> sanity_check_size((Some(Packed((&(), 0))), true)); // In #46769, `Option<(Packed<&()>, bool)>` was found to have // pointer alignment, without actually being aligned in size. // E.g. on 64-bit platforms, it had alignment `8` but size `9`. sanity_check_size(Some((Packed(&()), true))); </ins> }
Change:
, and a few others have summaries as given in the source code, but , and a few others somehow don't. This is perplexing when we recall the method impls are generated by macros
cc I'll try to take a look in the next days.

Discussion:
match module.inner { ModuleItem(ref module) => { for it in &module.items { <del> if it.is_extern_crate() && it.attrs.has_doc_flag("masked") { </del> <ins> // `compiler_builtins` should be masked too, but we can't apply // `#[doc(masked)]` to the injected `extern crate` because it's unstable. if it.is_extern_crate() && (it.attrs.has_doc_flag("masked") || self.cx.tcx.is_compiler_builtins(it.def_id.krate)) { </ins> masked_crates.insert(it.def_id.krate); } }
Change:
A comment in in said to sort the two option sets. I gave up upon realizing they're not just vectors of something easily sortable.
Cleanup, but not really important. Not milestoning.
Still cleanup, still not really important. Still not milestoning.

Discussion:
#[test] #[should_fail] fn test_ascii_fail_char_slice() { 'λ'.to_ascii(); } <ins> #[test] </ins> fn test_opt() { assert_eq!(65u8.to_ascii_opt(), Some(Ascii { chr: 65u8 })); assert_eq!(255u8.to_ascii_opt(), None);

#[cfg(test)] mod test { use super::*; <del> use io::net::ip::{Ipv4Addr, SocketAddr}; </del> <ins> use io::net::ip::{SocketAddr}; </ins> use io::*; <del> use io::test::*; </del> use prelude::*; iotest!(fn bind_error() {

use unstable::run_in_bare_thread; use super::*; use rt::task::Task; <del> use rt::local_ptr; </del> #[test] fn thread_local_task_smoke_test() {

fn visit_estr_uniq(&mut self) -> bool { true } fn visit_estr_slice(&mut self) -> bool { true } fn visit_estr_fixed(&mut self, <del> _sz: uint, _sz: uint, </del> <ins> _sz: uint, _sz2: uint, </ins> _align: uint) -> bool { true } fn visit_box(&mut self, _mtbl: uint, _inner: *TyDesc) -> bool { true }