jiebi/CodeConvo huggingface dataset:
Change:
The test run-pass/sepcomp-lib- can fail on android apparently due to the fact that a pthread shim dependency is present in libstd (as part of librust_builtin), but it stripped out early. It may be possible to work around this by moving the dependency into liballoc instead, but a more thorough examination is needed.
cc
The problem here on android was as follows: jemalloc requires the symbol, which android does not provide. jemalloc is also statically linked to liballoc We provide a dummy definition of in , which is assembled into and is statically linked to . When building with LTO, we remove all rust-generated code from an rlib (it's all in the LTO object), but we still link the rlib. When linking, we pass libstd's rlib first, then liballoc's rlib on the command line. The linker detects that we're not using any symbols from the libstd's rlib by the time its reached on the command line (scans from left-to-right) because we actually aren't using any symbols from or any other objects in the archive. The linker then strips from the linkage step, which then later yields an unresolved reference. The solution here is to break apart to be less of a conglomerate and instead link specific symbols to specific libraries wherever necessary. For example all of the time-related functionality should be a lib linked directly to , not to . In this example we need to link the symbol directly to , not to , because is not the one that needs it. Just some general cleanup, most things should still work as advertised!
Triage: this test is still ignored on android, but I don't know what is nowadays.
! So I guess this can be closed, but should we check if the affected test was actually fixed?
Yeah I think this is all taken care of, so closing.

Discussion:
llvm::LLVMRustAddAnalysisPasses(tm, pm, llmod); llvm::LLVMRustAddPass(pm, "verify0".as_ptr() as *const _); <del> let opt = sess.opts.cg.opt_level.unwrap_or(0) as libc::c_uint; </del> <ins> let opt = match sess.opts.optimize { config::No => 0, config::Less => 1, config::Default => 2, config::Aggressive => 3, }; </ins> let builder = llvm::LLVMPassManagerBuilderCreate(); llvm::LLVMPassManagerBuilderSetOptLevel(builder, opt);

// aux-build:sepcomp_lib.rs // compile-flags: -C lto // no-prefer-dynamic <ins> // ignore-android FIXME #18800 </ins> extern crate sepcomp_lib; use sepcomp_lib::a::one;
Change:
I'm seeing things like this: Those used to be . My first guess is something changed in that handles crates different from modules?
Example code to reproduce the issue: And output:

Discussion:
<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. mod foo { pub mod bar { pub mod baz { pub fn name() -> &'static str { module_path!() } } } } fn main() { assert_eq!(module_path!(), "issue-18859"); assert_eq!(foo::bar::baz::name(), "issue-18859::foo::bar::baz"); } </ins>
Change:
Looks like substitutions weren't being applied in all places, resulting in it choking on an unsubstituted type parameter. The fix should hopefully be easy.

Discussion:
<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. // Test that we don't ICE due to encountering unsubstituted type // parameters when untupling FnOnce parameters during translation of // an unboxing shim. #![feature(unboxed_closures)] fn main() { let _: Box<FnOnce<(),()>> = box move |&mut:| {}; } </ins>
Change:
Not the best title, but I suppose it somehow summarizes the situation. There's no ICE if I un-comment "use buffer" and prefix Buffer as the comment is suggesting. There's also no ICE if I rename Buffer into anything else. (fun!) rustc 0.13.0-nightly ( 2014-11-11 22:37:05 +0000) binary: rustc commit-hash: commit-date: 2014-11-11 22:37:05 +0000 host: x8664-apple-darwin release: 0.13.0-nightly

Discussion:
E0164, E0165, E0166, <del> E0167 </del> <ins> E0167, E0168 </ins> )

let tcx = pcx.fcx.ccx.tcx; let def = tcx.def_map.borrow()[pat.id].clone(); <del> let def_type = ty::lookup_item_type(tcx, def.def_id()); let (enum_def_id, variant_def_id) = match ty::get(def_type.ty).sty { ty::ty_struct(struct_def_id, _) => (struct_def_id, struct_def_id), ty::ty_enum(enum_def_id, _) if def == def::DefVariant(enum_def_id, def.def_id(), true) => (enum_def_id, def.def_id()), _ => { </del> <ins> let (enum_def_id, variant_def_id) = match def { def::DefTrait(_) => { </ins> let name = pprust::path_to_string(path); <del> span_err!(tcx.sess, pat.span, E0163, "`{}` does not name a struct or a struct variant", name); </del> <ins> span_err!(tcx.sess, pat.span, E0168, "use of trait `{}` in a struct pattern", name); </ins> fcx.write_error(pat.id); for field in fields.iter() { check_pat(pcx, &*field.node.pat, ty::mk_err()); } return; <ins> }, _ => { let def_type = ty::lookup_item_type(tcx, def.def_id()); match ty::get(def_type.ty).sty { ty::ty_struct(struct_def_id, _) => (struct_def_id, struct_def_id), ty::ty_enum(enum_def_id, _) if def == def::DefVariant(enum_def_id, def.def_id(), true) => (enum_def_id, def.def_id()), _ => { let name = pprust::path_to_string(path); span_err!(tcx.sess, pat.span, E0163, "`{}` does not name a struct or a struct variant", name); fcx.write_error(pat.id); for field in fields.iter() { check_pat(pcx, &*field.node.pat, ty::mk_err()); } return; } } </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. // aux-build:use_from_trait_xc.rs extern crate use_from_trait_xc; pub use use_from_trait_xc::Trait; fn main() { match () { Trait { x: 42u } => () //~ ERROR use of trait `Trait` in a struct pattern } } </ins>
Change:
method will unconditionally fail if it encounters a view item ( or ). This is desired behavior if parsing the body of a function. However, there are no public methods that allow parsing either of these items individually. This makes it impossible to parse the full range of possible input to a REPL. If it's acceptable, I could make a pull request for public methods (which already exists, privately) and .

Discussion:
use attr::AttrMetaMethods; use parse::parser::Parser; use parse::token::{str_to_ident}; <ins> use print::pprust::view_item_to_string; </ins> use ptr::P; use util::parser_testing::{string_to_tts, string_to_parser}; use util::parser_testing::{string_to_expr, string_to_item}; <del> use util::parser_testing::string_to_stmt; </del> <ins> use util::parser_testing::{string_to_stmt, string_to_view_item}; </ins> // produce a codemap::span fn sp(a: u32, b: u32) -> Span {

span: sp(0,21)}))); } <ins> #[test] fn parse_use() { let use_s = "use foo::bar::baz;"; let vitem = string_to_view_item(use_s.to_string()); let vitem_s = view_item_to_string(&vitem); assert_eq!(vitem_s.as_slice(), use_s); let use_s = "use foo::bar as baz;"; let vitem = string_to_view_item(use_s.to_string()); let vitem_s = view_item_to_string(&vitem); assert_eq!(vitem_s.as_slice(), use_s); } #[test] fn parse_extern_crate() { let ex_s = "extern crate foo;"; let vitem = string_to_view_item(ex_s.to_string()); let vitem_s = view_item_to_string(&vitem); assert_eq!(vitem_s.as_slice(), ex_s); let ex_s = "extern crate "foo" as bar;"; let vitem = string_to_view_item(ex_s.to_string()); let vitem_s = view_item_to_string(&vitem); assert_eq!(vitem_s.as_slice(), ex_s); } </ins> fn get_spans_of_pat_idents(src: &str) -> Vec<Span> { let item = string_to_item(src.to_string()).unwrap();

}) } <ins> /// Parse a string, return a view item pub fn string_to_view_item (source_str : String) -> ast::ViewItem { with_error_checking_parse(source_str, |p| { p.parse_view_item(Vec::new()) }) } </ins> /// Parse a string, return a pat. Uses "irrefutable"... which doesn't /// (currently) affect parsing. pub fn string_to_pat(source_str: String) -> P<ast::Pat> {
Change:
The pretty printer is removing trailing commas from match arms that contain an block expression: Running it with produces: Which when compiled errors with:
Actually, I'm not sure what the right tag is here...

Discussion:
pub use self::AnnNode::*; use abi; <del> use ast::{FnUnboxedClosureKind, FnMutUnboxedClosureKind}; </del> <ins> use ast::{mod, FnUnboxedClosureKind, FnMutUnboxedClosureKind}; </ins> use ast::{FnOnceUnboxedClosureKind}; use ast::{MethodImplItem, RegionTyParamBound, TraitTyParamBound}; use ast::{RequiredMethod, ProvidedMethod, TypeImplItem, TypeTraitItem}; use ast::{UnboxedClosureKind}; <del> use ast; </del> use ast_util; use owned_slice::OwnedSlice; use attr::{AttrMetaMethods, AttributeMethods}; <del> use codemap::{CodeMap, BytePos}; use codemap; </del> <ins> use codemap::{mod, CodeMap, BytePos}; </ins> use diagnostic; <del> use parse::token::{BinOpToken, Token}; use parse::token; </del> <ins> use parse::token::{mod, BinOpToken, Token}; </ins> use parse::lexer::comments; use parse; <del> use print::pp::{break_offset, word, space, zerobreak, hardbreak}; </del> <ins> use print::pp::{mod, break_offset, word, space, zerobreak, hardbreak}; </ins> use print::pp::{Breaks, Consistent, Inconsistent, eof}; <del> use print::pp; </del> use ptr::P; <del> use std::ascii; use std::io::IoResult; use std::io; use std::mem; </del> <ins> use std::{ascii, mem}; use std::io::{mod, IoResult}; </ins> pub enum AnnNode<'a> { NodeIdent(&'a ast::Ident),

try!(self.print_pat(&**p)); } try!(space(&mut self.s)); <del> match arm.guard { Some(ref e) => { try!(self.word_space("if")); try!(self.print_expr(&**e)); try!(space(&mut self.s)); } None => () </del> <ins> if let Some(ref e) = arm.guard { try!(self.word_space("if")); try!(self.print_expr(&**e)); try!(space(&mut self.s)); </ins> } try!(self.word_space("=>")); match arm.body.node { ast::ExprBlock(ref blk) => { // the block will close the pattern's ibox <del> try!(self.print_block_unclosed_indent(&**blk, indent_unit)); </del> <ins> try!(self.print_block_unclosed_indent(&**blk, indent_unit)); // If it is a user-provided unsafe block, print a comma after it if let ast::UnsafeBlock(ast::UserProvided) = blk.rules { try!(word(&mut self.s, ",")); } </ins> } _ => { try!(self.end()); // close the ibox for the pattern

<ins> // Copyright 2012 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. // // Testing that unsafe blocks in match arms are followed by a comma // pp-exact fn main() { match true { true if true => (), false => unsafe { }, true => { } false => (), } } </ins>
Change:
There's currently no method on . This might have been missed during collections reform, or was never implemented.

Discussion:
// FIXME(conventions): implement shrink_to_fit. Awkward with the current design, but it should // be scrapped anyway. Defer to rewrite? <del> // FIXME(conventions): implement into_iter </del> /// `RingBuf` is a circular buffer that implements `Deque`. pub struct RingBuf<T> {

} } <ins> /// Consumes the list into an iterator yielding elements by value. #[unstable = "matches collection reform specification, waiting for dust to settle"] pub fn into_iter(self) -> MoveItems<T> { MoveItems { inner: self, } } </ins> /// Returns the number of elements in the `RingBuf`. /// /// # Example

} let tail = self.tail; self.tail = wrap_index(self.tail + 1, self.cap); <del> if mem::size_of::<T>() != 0 { unsafe { Some(&mut *self.ptr.offset(tail as int)) } } else { // use a non-zero pointer Some(unsafe { mem::transmute(1u) }) </del> <ins> unsafe { Some(&mut *self.ptr.offset(tail as int)) </ins> } }

return None; } self.head = wrap_index(self.head - 1, self.cap); <del> unsafe { Some(&mut *self.ptr.offset(self.head as int)) } </del> <ins> unsafe { Some(&mut *self.ptr.offset(self.head as int)) } </ins> } } impl<'a, T> ExactSize<&'a mut T> for MutItems<'a, T> {} <ins> // A by-value RingBuf iterator pub struct MoveItems<T> { inner: RingBuf<T>, } impl<T> Iterator<T> for MoveItems<T> { #[inline] fn next(&mut self) -> Option<T> { self.inner.pop_front() } #[inline] fn size_hint(&self) -> (uint, Option<uint>) { let len = self.inner.len(); (len, Some(len)) } } impl<T> DoubleEndedIterator<T> for MoveItems<T> { #[inline] fn next_back(&mut self) -> Option<T> { self.inner.pop_back() } } impl<T> ExactSize<T> for MoveItems<T> {} </ins> impl<A: PartialEq> PartialEq for RingBuf<A> { fn eq(&self, other: &RingBuf<A>) -> bool { self.len() == other.len() &&

} #[test] <ins> fn test_into_iter() { // Empty iter { let d: RingBuf<int> = RingBuf::new(); let mut iter = d.into_iter(); assert_eq!(iter.size_hint(), (0, Some(0))); assert_eq!(iter.next(), None); assert_eq!(iter.size_hint(), (0, Some(0))); } // simple iter { let mut d = RingBuf::new(); for i in range(0i, 5) { d.push_back(i); } let b = vec![0,1,2,3,4]; assert_eq!(d.into_iter().collect::<Vec<int>>(), b); } // wrapped iter { let mut d = RingBuf::new(); for i in range(0i, 5) { d.push_back(i); } for i in range(6, 9) { d.push_front(i); } let b = vec![8,7,6,0,1,2,3,4]; assert_eq!(d.into_iter().collect::<Vec<int>>(), b); } // partially used { let mut d = RingBuf::new(); for i in range(0i, 5) { d.push_back(i); } for i in range(6, 9) { d.push_front(i); } let mut it = d.into_iter(); assert_eq!(it.size_hint(), (8, Some(8))); assert_eq!(it.next(), Some(8)); assert_eq!(it.size_hint(), (7, Some(7))); assert_eq!(it.next_back(), Some(4)); assert_eq!(it.size_hint(), (6, Some(6))); assert_eq!(it.next(), Some(7)); assert_eq!(it.size_hint(), (5, Some(5))); } } #[test] </ins> fn test_from_iter() { use std::iter; let v = vec!(1i,2,3,4,5,6,7);
Change:
struct variants have been unfeature gated, but there are corner cases that we did not intend. Here is (playpen compatible) code that demonstrates this: link:
Nomating for P-backcompat-lang, 1.0

Discussion:
let real_path_ty = fcx.node_ty(pat.id); let (arg_tys, kind_name) = match real_path_ty.sty { <del> ty::ty_enum(enum_def_id, ref expected_substs) => { </del> <ins> ty::ty_enum(enum_def_id, ref expected_substs) if def == def::DefVariant(enum_def_id, def.def_id(), false) => { </ins> let variant = ty::enum_variant_with_id(tcx, enum_def_id, def.def_id()); (variant.args.iter().map(|t| t.subst(tcx, expected_substs)).collect::<Vec<_>>(), "variant")

_ => { let name = pprust::path_to_string(path); span_err!(tcx.sess, pat.span, E0164, <del> "`{}` does not name a variant or a tuple struct", name); </del> <ins> "`{}` does not name a non-struct variant or a tuple struct", name); </ins> fcx.write_error(pat.id); if let Some(ref subpats) = *subpats {

<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() { enum Foo { FooB { x: i32, y: i32 } } let f = FooB { x: 3, y: 4 }; match f { FooB(a, b) => println!("{} {}", a, b), //~^ ERROR `FooB` does not name a non-struct variant or a tuple struct } } </ins>
Change:
cc The best thing to do here is to use (). Is the correct behaviour when using to treat as an unbounded type variable or to cause an error because is not well-specified?
My reading of the RFC is that it should be a compile error to use - all associated types in an object must be bound in the type (it is unclear from the RFC if having a default type for the associated type means we don't need an equality constraint for that type).
is very similar, but not quite a dup, the error message here is (which is wrong - it is not a self type issue).
Yes in general. I think it's fine to allow you to leave it off if there's a default.
I agree it should be a compile-time error to have an object type for which the values of some associated types are not specified (whether explicitly or via default). However, we have to be careful, because there can be a default that references (which is erased). We should catch this and report a nice error. See , which is related.
The ICE is fixed by

Discussion:
<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. // Test that a partially specified trait object with unspecified associated // type does not ICE. #![feature(associated_types)] trait Foo { type A; } fn bar(x: &Foo) {} //~ERROR missing type for associated type `A` pub fn main() {} </ins>
Change:
We generate this information and upload it and do nothing with it (and the upload causes ). Let's just completely remove the code for it (including the never-used ratcheting feature, and probably the test-sharding feature as well).
Nominating because this adds --save-metrics and --ratchet-metrics to test runners that I don't want to support.
I left the documentation about saving and ratcheting metrics out of the latest iteration of the testing guide, so agreed there.
Bots are no longer uploading metrics so it's safe to remove from the code.
P-backcompat-libs, 1.0.
Only the stuff in has been removed. The test crate still supports a bunch of stuff that should be removed. Here are my suggestions: save-metrics - remove ratchet-metrics - remove ratchet-noise-percent - remove test-shard - remove boxplot - remove boxplot-width - remove stats - remove boxplot and stats are less obvious.
I'm working on removing these. It's just taking a little while to get familiar with the code.
Does this live on somewhere out-of-tree? I was using it in html5ever.

Discussion:
TEST_LOG_FILE=tmp/check-stage$(1)-T-$(2)-H-$(3)-$(4).log TEST_OK_FILE=tmp/check-stage$(1)-T-$(2)-H-$(3)-$(4).ok <del> # If we're sharding the testsuite between parallel testers, # pass this argument along to the compiletest and crate test # invocations. ifdef TEST_SHARD CTEST_TESTARGS += --test-shard=$(TEST_SHARD) CRATE_TEST_EXTRA_ARGS += --test-shard=$(TEST_SHARD) endif </del> define DEF_TARGET_COMMANDS ifdef CFG_UNIXY_$(1)
Change:
and are currently empty, except for the module’s docstring. Compare with and
I don't know the best way to tackle this, as I know little about re-exported documentation. do you know?
To clarify: I think this is a bug in rustdoc code rather than documentation that needs to be written.
Agreed.
This is a dupe of (although that should be updated to reflect the static -const split).
Not actually a dupe of , my mistake.

Discussion:
encode_bounds_and_type(rbml_w, ecx, &lookup_item_type(tcx, def_id)); encode_name(rbml_w, item.ident.name); encode_path(rbml_w, path); <ins> encode_attributes(rbml_w, item.attrs.as_slice()); </ins> encode_inlined_item(ecx, rbml_w, IIItemRef(item)); encode_visibility(rbml_w, vis); encode_stability(rbml_w, stab);
Change:
The Any trait is not in release condition at all, considering that is still uses slow virtual calls that could be replaced with an associated static in the near future but stabilizing with would mean that it could not be removed. Normally, this isn't an issue, but since Any is almost exclusively used through trait objects this blocks possible optimizations to layout that could allow to be represented as instead of containing a full vtable.
It would need to be , where the is the destructor (btw).

Discussion:
#[stable] pub trait Any: 'static { /// Get the `TypeId` of `self` <del> #[stable] </del> <ins> #[experimental = "this method will likely be replaced by an associated static"] </ins> fn get_type_id(&self) -> TypeId; }
Change:
This code manipulates a HashMap using the new Entry API, checking for consistency after each step. The assertion in should never fail, but in my tests it does so reliably, almost always within the first 10 iterations of the second loop. When it does fail, the value of is not one of the values previously removed during the loop (that is, is right to return this key, and is wrong to report it as absent). I tested this with on 64-bit Linux.
cc
Fffffff--- looking into it now. cc
Oh thank god it was a simple stupid mistake, and not something complicated.

Discussion:
/// Takes the value out of the entry, and returns it pub fn take(self) -> V { <del> let (_, _, v) = self.elem.take(); </del> <ins> let (_, v) = pop_internal(self.elem); </ins> v } }

use hash; use iter::{Iterator,range_inclusive,range_step_inclusive}; use cell::RefCell; <ins> use rand::{weak_rng, Rng}; </ins> struct KindaIntLike(int);

assert_eq!(map.get(&10).unwrap(), &1000); assert_eq!(map.len(), 6); } <ins> #[test] fn test_entry_take_doesnt_corrupt() { // Test for #19292 fn check(m: &HashMap<int, ()>) { for k in m.keys() { assert!(m.contains_key(k), "{} is in keys() but not in the map?", k); } } let mut m = HashMap::new(); let mut rng = weak_rng(); // Populate the map with some items. for _ in range(0u, 50) { let x = rng.gen_range(-10, 10); m.insert(x, ()); } for i in range(0u, 1000) { let x = rng.gen_range(-10, 10); match m.entry(x) { Vacant(_) => {}, Occupied(e) => { println!("{}: remove {}", i, x); e.take(); }, } check(&m); } } </ins> }
Change:
Error: Reproduces with:
cc
I just now noticed that does not actually yet allow unsized . Might be related.
This doesn't compile, but it doesn't ICE.
It looks like no longer exists. Did it get replaced by something else? I imagine there's not much value in adding a regression test with a broken import
from

Discussion:
<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. #![feature(reflect_marker)] use std::any::TypeId; use std::marker::Reflect; use std::rc::Rc; type Fp<T> = Rc<T>; struct Engine; trait Component: 'static + Reflect {} impl Component for Engine {} trait Env { fn get_component_type_id(&self, type_id: TypeId) -> Option<Fp<Component>>; } impl<'a> Env+'a { fn get_component<T: Component>(&self) -> Option<Fp<T>> { let x = self.get_component_type_id(TypeId::of::<T>()); None } } trait Figment { fn init(&mut self, env: &Env); } struct MyFigment; impl Figment for MyFigment { fn init(&mut self, env: &Env) { let engine = env.get_component::<Engine>(); } } fn main() {} </ins>