jiebi/CodeConvo huggingface dataset:
Change:
Not on 1.15. cc
Fun note: another bug fixed on my shimmir branch. Not that I really want to merge it to 1.16/1.17.
Minified: I think we should just have the first commit of shimmir to fix this.
triage: P-high

Discussion:
def_id: DefId) -> bool { match tcx.item_type(def_id).sty { <del> ty::TyFnDef(def_id, _, f) => { </del> <ins> ty::TyFnDef(def_id, _, _) => { </ins> // Some constructors also have type TyFnDef but they are // always instantiated inline and don't result in a // translation item. Same for FFI functions. if let Some(hir_map::NodeForeignItem(_)) = tcx.hir.get_if_local(def_id) { return false; } <del> if let Some(adt_def) = f.sig.output().skip_binder().ty_adt_def() { if adt_def.variants.iter().any(|v| def_id == v.did) { return false; } } </del> } ty::TyClosure(..) => {} _ => return false

fn should_trans_locally<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, def_id: DefId) -> bool { <ins> if let ty::TyFnDef(_, _, f) = tcx.item_type(def_id).sty { if let Some(adt_def) = f.sig.output().skip_binder().ty_adt_def() { if adt_def.variants.iter().any(|v| def_id == v.did) { // HACK: ADT constructors are translated in-place and // do not have a trans-item. return false; } } } </ins> if def_id.is_local() { true } else {

<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. #![crate_type="rlib"] #[derive(Debug, PartialEq)] pub struct RemoteC(pub u32); #[derive(Debug, PartialEq)] pub struct RemoteG<T>(pub T); </ins>

<ins> // Copyright 2016 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. // aux-build:issue_39823.rs extern crate issue_39823; use issue_39823::{RemoteC, RemoteG}; #[derive(Debug, PartialEq)] struct LocalC(u32); #[derive(Debug, PartialEq)] struct LocalG<T>(T); fn main() { let virtual_localc : &Fn(_) -> LocalC = &LocalC; assert_eq!(virtual_localc(1), LocalC(1)); let virtual_localg : &Fn(_) -> LocalG<u32> = &LocalG; assert_eq!(virtual_localg(1), LocalG(1)); let virtual_remotec : &Fn(_) -> RemoteC = &RemoteC; assert_eq!(virtual_remotec(1), RemoteC(1)); let virtual_remoteg : &Fn(_) -> RemoteG<u32> = &RemoteG; assert_eq!(virtual_remoteg(1), RemoteG(1)); } </ins>
Change:
UPDATE: This now works in NLL land. and should be separate borrows into the same structure. Note that changing to makes it borrow check, and changing to in the struct also makes it borrow check. This makes me think it's something to do with the special casing of .
This is intentional. rust-lang/rfcs.
no... it isn't. This is incorrect behavior. It should treat and as separate borrows. (as seen by the fact that it works in the outer match statement)
I'm afraid is right, we really dumbed down . Proof: while .
then it's a bug with the specification (and the issue should be left open).
given that this works: , rust should be able to figure out the difference between a moving deref and a non-moving; it can already figure out mutable vs. non-mutable.
Sure, the equivalent of your code with a type instead of a works: The current borrowck is sort-of in maintenance mode, so this is unlikely to be fixed before MIR borrowck.
Nominating. I suggest we retag this as C-enhancement rather than C-bug. I separately suggest that we prioritize it as P-medium. (It does not need to land as part of the initial MIR-borrowck / NLL work.)
(looking at , I am wondering: what's the difference between C-feature-request and C-enhancement? Should we collapse those two labels into one...?)
In the NLL / MIR borrow checker, we decided to just be smarter around . Therefore, .
I think I would be happy to just add a test for this (with ) and close this issue.

Discussion:
<ins> // Copyright 2018 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. // Test case from #39963. #![feature(nll)] #[derive(Clone)] struct Foo(Option<Box<Foo>>, Option<Box<Foo>>); fn test(f: &mut Foo) { match *f { Foo(Some(ref mut left), Some(ref mut right)) => match **left { Foo(Some(ref mut left), Some(ref mut right)) => panic!(), _ => panic!(), }, _ => panic!(), } } fn main() { } </ins>
Change:
The docs for () say: but the error above indicates that this isn't true.
Seems its not doing the coercion. This works:
Suspect it has something to do with this line - Going to try and work on a patch.

Discussion:
let base_t = self.structurally_resolved_type(expr.span, base_t); match self.lookup_indexing(expr, base, base_t, idx_t, lvalue_pref) { Some((index_ty, element_ty)) => { <del> self.demand_eqtype(expr.span, index_ty, idx_t); </del> <ins> self.demand_coerce(idx, idx_t, index_ty); </ins> element_ty } None => {

<ins> // Copyright 2015 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. use std::ops::Index; fn bar() {} static UNIT: () = (); struct S; impl Index<fn()> for S { type Output = (); fn index(&self, _: fn()) -> &() { &UNIT } } fn main() { S.index(bar); S[bar]; } </ins>
Change:
The conversion traits are implemented for conversion between and , but it is not clear what byte order is used.
It is network order, but that should be documented on the impl.
doc team triage: this would make a great first PR. I am happy to mentor anyone who wants to tackle this issue.
I'd like to, is someone else working on this?
nope, please do! Ping me if you need any help

Discussion:
#[stable(feature = "ip_u32", since = "1.1.0")] impl From<Ipv4Addr> for u32 { <ins> /// It performs the conversion in network order (big-endian). </ins> fn from(ip: Ipv4Addr) -> u32 { let ip = ip.octets(); ((ip[0] as u32) << 24) + ((ip[1] as u32) << 16) + ((ip[2] as u32) << 8) + (ip[3] as u32)

#[stable(feature = "ip_u32", since = "1.1.0")] impl From<u32> for Ipv4Addr { <ins> /// It performs the conversion in network order (big-endian). </ins> fn from(ip: u32) -> Ipv4Addr { Ipv4Addr::new((ip >> 24) as u8, (ip >> 16) as u8, (ip >> 8) as u8, ip as u8) }
Change:
The minimum code example: compiling:
Thats a regression from stable → beta/nightly.
Introduced by .

Discussion:
Some(&adt_def.variants[variant_index]) } _ => if let ty::TyAdt(adt, _) = self.ty.sty { <del> Some(adt.struct_variant()) </del> <ins> if adt.is_univariant() { Some(&adt.variants[0]) } else { None } </ins> } else { None }

<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. enum P { C(PC), } enum PC { Q, QA, } fn test(proto: P) { match proto { P::C(PC::Q) => (), } } fn main() {} </ins>

<ins> error[E0004]: non-exhaustive patterns: `C(QA)` not covered --> $DIR/issue-40221.rs:21:11 | 21 |     match proto { |           ^^^^^ pattern `C(QA)` not covered error: aborting due to previous error </ins>
Change:
I'm working on implementing for (in ), and am running into the need for an equivalent of  for /. With the current internals for , I believe the implementation could be very similar; namely: Is this something that could be in line with ?
I think this was in , but can you confirm that the one you're looking for was there?
Ah, yes, that looks perfect! Thanks.

Discussion:
EnterCriticalSection(&_cs); _holding_thread = GetCurrentThreadId(); #else <del> if (timeout_in_ns == 0) { </del> <ins> if (timeout_in_ms == 0) { </ins> CHECKED(pthread_cond_wait(&_cond, &_mutex)); } else { timeval time_val;
Change:
I found prevents to be parsed as a float, whereas is allowed anyway. Is this a bug or an intended behavior? This is a code : It seems natural that both of them are banned or both of them are allowed.
It is a bug.
IIRC at least.
This is the relevant section in the reference: It says: and i.e. so all forms should parse.
I'm going to close this issue, because fixed it.

Discussion:
base = 16; num_digits = self.scan_digits(16, 16); } <del> '0'...'9' | '_' | '.' => { </del> <ins> '0'...'9' | '_' | '.' | 'e' | 'E' => { </ins> num_digits = self.scan_digits(10, 10) + 1; } _ => {

<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. fn main() { println!("{}", 0E+10); println!("{}", 0e+10); println!("{}", 00e+10); println!("{}", 00E+10); } </ins>
Change:
Specifically, the notice about not being emitted anymore <img width="535" alt="untitled" src=""This is functional, but could look much nicer.
I could take this one and start working on it.
That'd be great!
will fix this
PR was merged, this can be closed!

Discussion:
register_long_diagnostics! { E0001: r##" <del> ## Note: this error code is no longer emitted by the compiler. </del> <ins> #### Note: this error code is no longer emitted by the compiler. </ins> This error suggests that the expression arm corresponding to the noted pattern will never be reached as for all possible values of the expression being

"##, E0002: r##" <del> ## Note: this error code is no longer emitted by the compiler. </del> <ins> #### Note: this error code is no longer emitted by the compiler. </ins> This error indicates that an empty match expression is invalid because the type it is matching on is non-empty (there exist values of this type). In safe code

"##, E0003: r##" <del> ## Note: this error code is no longer emitted by the compiler. </del> <ins> #### Note: this error code is no longer emitted by the compiler. </ins> Not-a-Number (NaN) values cannot be compared for equality and hence can never match the input to a match expression. So, the following will not compile:
Change:
Some [methods of slices], including , , , and return types without documenting the conditions under which they return vs ; I would like to suggest that these conditions be documented. [methods of slices]:

Discussion:
core_slice::SliceExt::first_mut(self) } <del> /// Returns the first and all the rest of the elements of a slice. </del> <ins> /// Returns the first and all the rest of the elements of a slice, or `None` if it is empty. </ins> /// /// # Examples ///

core_slice::SliceExt::split_first(self) } <del> /// Returns the first and all the rest of the elements of a slice. </del> <ins> /// Returns the first and all the rest of the elements of a slice, or `None` if it is empty. </ins> /// /// # Examples ///

core_slice::SliceExt::split_first_mut(self) } <del> /// Returns the last and all the rest of the elements of a slice. </del> <ins> /// Returns the last and all the rest of the elements of a slice, or `None` if it is empty. </ins> /// /// # Examples ///

} <del> /// Returns the last and all the rest of the elements of a slice. </del> <ins> /// Returns the last and all the rest of the elements of a slice, or `None` if it is empty. </ins> /// /// # Examples ///
Change:
Backstory in (comment 16 has dmajor's analysis). In summary: when building on windows, rustc can generate symbol names into the .pdb file that microsoft's DIA library doesn't like. In particular, it can result in calls to to crash with a divide-by-zero. This is a bug in the DIA library which I reported to a friend at Microsoft and which has been fixed. However, older versions of the DIA library still have this problem, so rustc should probably be updated to not generate such symbols. This bug results in the mozilla-central crashing which in turn generates a bad .sym file which causes windows debug tests to blow up. For now I have a workaround patch ready to land that catches the div-by-zero in suggested that if there is some runtime workaround (e.g. setting rustflags or something) that can avoid this problem, we should do that instead - so if there is anything I can try along those lines, please let me know. /cc
Thanks for the report. It looks like we are doing this on purpose for arrays we don't know the size of. I'll try to find out if we can do something else here.
So the real culprit here is the that is assigned to every function. It seems that MSDIA has a problem with fixed-size arrays of or anything zero-sized. Fixed-size arrays of any other type (including , interestingly) are handled without crashes. Here's a table of various types and sizes I've tested: My proposed fix/workaround is to adapt parameter types within , so that fixed-size arrays are replaced with pointers when compiling against MSVC. is anyway, so things don't get worse at least.

Discussion:
use syntax_pos::{self, Span, Pos}; use syntax::ast; use syntax::symbol::Symbol; <del> use rustc::ty::layout; </del> <ins> use rustc::ty::layout::{self, LayoutTyper}; </ins> pub mod gdb; mod utils;

}; // Arguments types <del> for &argument_type in inputs { signature.push(type_metadata(cx, argument_type, syntax_pos::DUMMY_SP)); </del> <ins> if cx.sess().target.target.options.is_like_msvc { // FIXME(#42800): // There is a bug in MSDIA that leads to a crash when it encounters // a fixed-size array of `u8` or something zero-sized in a // function-type (see #40477). // As a workaround, we replace those fixed-size arrays with a // pointer-type. So a function `fn foo(a: u8, b: [u8; 4])` would // appear as `fn foo(a: u8, b: *const u8)` in debuginfo, // and a function `fn bar(x: [(); 7])` as `fn bar(x: *const ())`. // This transformed type is wrong, but these function types are // already inaccurate due to ABI adjustments (see #42800). signature.extend(inputs.iter().map(|&t| { let t = match t.sty { ty::TyArray(ct, _) if (ct == cx.tcx().types.u8) || (cx.layout_of(ct).size(cx).bytes() == 0) => { cx.tcx().mk_imm_ptr(ct) } _ => t }; type_metadata(cx, t, syntax_pos::DUMMY_SP) })); } else { signature.extend(inputs.iter().map(|t| { type_metadata(cx, t, syntax_pos::DUMMY_SP) })); </ins> } if sig.abi == Abi::RustCall && !sig.inputs().is_empty() {
Change:
This works: This does not and gives a confusing error: The error:
This also gives a confusing error: The following works:
None of these examples don't compile today, so I'm presuming this is fixed and marking E-needstest.
Can I take this issue and put this into a run-pass test?
Sounds good to me, though compile-pass would probably be sufficient - grep for .
Ok. Will do. Btw, it looks like this commit was fixed by .

Discussion:
<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(rustc_attrs)] #![allow(unused)] fn f() { let mut x: Box<()> = Box::new(()); || { &mut x }; } #[rustc_error] fn main() {} //~ ERROR compilation successful </ins>

<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(rustc_attrs)] #![allow(unused)] fn f() { let x: Box<()> = Box::new(()); || { &x }; } #[rustc_error] fn main() {} //~ ERROR compilation successful </ins>

<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(rustc_attrs)] #![allow(unused)] fn f() { let mut x: Vec<()> = Vec::new(); || { || { x.push(()) } }; } #[rustc_error] fn main() {} //~ ERROR compilation successful </ins>

<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(rustc_attrs)] #![allow(unused)] fn f() { let x: Vec<()> = Vec::new(); || { || { x.len() } }; } #[rustc_error] fn main() {} //~ ERROR compilation successful </ins>
Change:
Tracking issue for
Is there any work needed here before stabilization?
There isn't. The feature is implemented and documented. The final stabilization PR will just have to add one sentence to the docs, that's it (see the FIXMEs in the code).
fcp merge
Team member has proposed to merge this. The next step is review by the rest of the tagged teams: [x] [x] [x] [x] [x] [x] [x] No concerns currently listed. Once these reviewers reach consensus, this will enter its final comment period. If you spot a major issue that hasn't been raised at any point in this process, please speak up! See for info about what commands tagged team members can give me.
:bell: This is now entering its final comment period, as per the . :bell:
The final comment period is now complete.
I'm curious if I compile it to native and wasm. I'll get the same ouput?

Discussion:
- [simd](simd.md) - [simd_ffi](simd-ffi.md) - [slice_patterns](slice-patterns.md) <ins> - [sort_unstable](sort-unstable.md) </ins> - [specialization](specialization.md) - [staged_api](staged-api.md) - [start](start.md)

<ins> # `sort_unstable` The tracking issue for this feature is: [#40585] [#40585]: https://github.com/rust-lang/rust/issues/40585 ------------------------ </ins>
Change:
What it looks like on : ! ! The strange color change on the side with the new sidebar style looks kind of tacky (especially at the bottom) and was probably not intended. Currently on : ! !
This is also broken on beta, tagging as such.
I'm looking into this. I see three potential options: the sidebar white on the src pages. This would look the same as the old styling. the width of the src view so it doesn't overlap with the sidebar. The sidebar is empty on src pages though so this looks kind of weird. If the sidebar retained its items from the other doc pages, this might look nice. the sidebar color and the background of the code block match so there isn't slightly different shades of grey on top of each other. I'm leaning toward option 1 for now but I think option 2 might be worth considering in the future. Thoughts?
While I am certainly not the most qualified to weigh in on this, my thoughts would be that 3 is less than desirable (having a random grey stripe on the left side looks out-of-place regardless of whether the color matches or not), 2 would unnecessarily decrease the usability of pages by decreasing the amount of horizontal space available to the code, and 1 is likely the best option. 3 would also mean that the code block would have padding on the right side but no padding on the left.
1 seems good
Ok. Option 1 it is!

Discussion:
{favicon} {in_header} </head> <del> <body class="rustdoc"> </del> <ins> <body class="rustdoc {css_class}"> </ins> <!--[if lte IE 8]> <div class="warning"> This old browser is unsupported and will most likely display funky

</form> </nav> <del> <section id='main' class="content {css_class}">{content}</section> </del> <ins> <section id='main' class="content">{content}</section> </ins> <section id='search' class="content hidden"></section> <section class="footer"></section>

padding: 14px; } <del> .source pre { </del> <ins> .source .content pre { </ins> padding: 20px; }

max-width: 100%; } <del> .content.source { </del> <ins> .source .content { </ins> margin-top: 50px; max-width: none; overflow: visible;

padding: 15px 0; } <del> .content.source pre.rust { </del> <ins> .source .content pre.rust { </ins> white-space: pre; overflow: auto; padding-left: 0;

background-color: #fff; } <ins> .source .sidebar { background-color: #fff; } </ins> .sidebar .location { border-color: #000; background-color: #fff;