jiebi/CodeConvo huggingface dataset:
Change:
is missing examples for these methods: Examples for them should be .
Same as the other ticket: these are currently unstable.
and are stable. This should be open.

Discussion:
/// Saturating integer addition. Computes `self + other`, saturating at /// the numeric bounds instead of overflowing. <ins> /// /// # Examples /// /// ``` /// use std::num::Int; /// /// assert_eq!(5u16.saturating_add(65534), 65535); /// assert_eq!((-5i16).saturating_add(-32767), -32768); /// assert_eq!(100u32.saturating_add(4294967294), 4294967295); /// ``` </ins> #[stable(feature = "rust1", since = "1.0.0")] #[inline] fn saturating_add(self, other: Self) -> Self {

/// Saturating integer subtraction. Computes `self - other`, saturating at /// the numeric bounds instead of overflowing. <ins> /// /// # Examples /// /// ``` /// use std::num::Int; /// /// assert_eq!(5u16.saturating_sub(65534), 0); /// assert_eq!(5i16.saturating_sub(-32767), 32767); /// assert_eq!(100u32.saturating_sub(4294967294), 0); /// ``` </ins> #[stable(feature = "rust1", since = "1.0.0")] #[inline] fn saturating_sub(self, other: Self) -> Self {
Change:
Currently, will panic, but will not, because the expression is not evaluated in that case.
Also, crashes the compiler. Maybe it's the same issue?
Thanks for the reminder, fixes that as well.

Discussion:
} SaveIn(lldest) => { match ty::eval_repeat_count(bcx.tcx(), &**count_expr) { <del> 0 => bcx, </del> <ins> 0 => expr::trans_into(bcx, &**element, Ignore), </ins> 1 => expr::trans_into(bcx, &**element, SaveIn(lldest)), count => { let elem = unpack_datum!(bcx, expr::trans(bcx, &**element));

F: FnOnce(Block<'blk, 'tcx>, ValueRef, Ty<'tcx>) -> Block<'blk, 'tcx>, { let _icx = push_ctxt("tvec::iter_vec_loop"); <del> let fcx = bcx.fcx; </del> <ins> if bcx.unreachable.get() { return bcx; } let fcx = bcx.fcx; </ins> let loop_bcx = fcx.new_temp_block("expr_repeat"); let next_bcx = fcx.new_temp_block("expr_repeat: next");

<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. // error-pattern:panic evaluated #[allow(unused_variables)] fn main() { // This used to trigger an LLVM assertion during compilation let x = [panic!("panic evaluated"); 2]; } </ins>

<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. // error-pattern:panic evaluated #[allow(unused_variables)] fn main() { let x = [panic!("panic evaluated"); 0]; } </ins>
Change:
A simple malformed macro makes the compiler crash. Code: Playpen error: Playpen:
Another case: Playpen:
I had a crash in a bad macro which hits the same bug as Note that his/her error has the following which is a different stack trace: I'm on the latest beta; not nightly.
I think you and I are getting a different panic from this bug. I've opened since the panic is in a different location in the code.

Discussion:
tt @ &TtSequence(..) => { check_matcher(cx, Some(tt).into_iter(), &Eof); }, <del> _ => cx.span_bug(sp, "wrong-structured lhs for follow check (didn't find  a TtDelimited or TtSequence)") </del> <ins> _ => cx.span_err(sp, "Invalid macro matcher; matchers must be contained  in balanced delimiters or a repetition indicator") </ins> }, _ => cx.span_bug(sp, "wrong-structured lhs for follow check (didn't find a  MatchedNonterminal)")

<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. macro_rules! invalid { _ => (); //~^ ERROR Invalid macro matcher } fn main() { } </ins>
Change:
Given the following code: Rustc bails out on an LLVM assertion: Here's the stack: And here's the vitals: Playpen link that also fails on 2015-03-16:
/cc

Discussion:
assert_eq!(nonzero_fields.len(), 1); let nonzero_field = ty::lookup_field_type(tcx, did, nonzero_fields[0].id, substs); match nonzero_field.sty { <ins> ty::ty_ptr(ty::mt { ty, .. }) if !type_is_sized(tcx, ty) => { path.push_all(&[0, FAT_PTR_ADDR]); Some(path) }, </ins> ty::ty_ptr(..) | ty::ty_int(..) | ty::ty_uint(..) => { path.push(0); Some(path)

<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. // Don't fail if we encounter a NonZero<*T> where T is an unsized type #![feature(unique)] use std::ptr::Unique; fn main() { let mut a = [0u8; 5]; let b: Option<Unique<[u8]>> = unsafe { Some(Unique::new(&mut a)) }; match b { Some(_) => println!("Got `Some`"), None => panic!("Unexpected `None`"), } } </ins>
Change:
seems to result in a call to in the drop glue (and no allocates), which results in a crash. Just doing works, as do non-empty input arrays.
cc
cc should this have been fixed by ? Or did cause a regression?
it appears to have been fixed, this example doesn't crash in my local branch (assuming it's not something else I've done since).
I have 2 tests based on example, one using the syntax and one using . Interestingly, using causes a compile time error: Shouldn't they both behave similar in this case?
test with doesn't compile because the argument to that function must be . However, the code does compile and run successfully with the syntax, so a PR containing src/test/run-pass/issue- from should close this issue.

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(box_syntax)] struct Node<T: ?Sized>(T); fn main() { let x: Box<Node<[isize]>> = box Node([]); } </ins>
Change:
I've tried to write: The line above gives LLVM assertion. I think this must show some syntax error.

Discussion:
LowerBound(Result<'blk, 'tcx>) } <del> #[derive(Clone, Copy)] </del> <ins> #[derive(Clone, Copy, PartialEq)] </ins> pub enum TransBindingMode { TrByCopy(/* llbinding */ ValueRef), TrByMove,

None => { let data = &m[0].data; for &(ref ident, ref value_ptr) in &m[0].bound_ptrs { <del> let llmatch = data.bindings_map[*ident].llmatch; call_lifetime_start(bcx, llmatch); Store(bcx, *value_ptr, llmatch); </del> <ins> let binfo = data.bindings_map[*ident]; call_lifetime_start(bcx, binfo.llmatch); if binfo.trmode == TrByRef && type_is_fat_ptr(bcx.tcx(), binfo.ty) { expr::copy_fat_ptr(bcx, *value_ptr, binfo.llmatch); } else { Store(bcx, *value_ptr, binfo.llmatch); } </ins> } match data.arm.guard { Some(ref guard_expr) => {

_ => None } }; match adt_vals { Some(field_vals) => { let pats = enter_match(bcx, dm, m, col, val, |pats|

ast::BindByRef(_) => { // By ref binding: the value of the variable <del> // is the pointer `val` itself. Store(bcx, val, llval); </del> <ins> // is the pointer `val` itself or fat pointer referenced by `val` if type_is_fat_ptr(bcx.tcx(), ty) { expr::copy_fat_ptr(bcx, val, llval); } else { Store(bcx, val, llval); } </ins> bcx } }

GEPi(bcx, fat_ptr, &[0, abi::FAT_PTR_ADDR]) } <ins> pub fn copy_fat_ptr(bcx: Block, src_ptr: ValueRef, dst_ptr: ValueRef) { Store(bcx, Load(bcx, get_dataptr(bcx, src_ptr)), get_dataptr(bcx, dst_ptr)); Store(bcx, Load(bcx, get_len(bcx, src_ptr)), get_len(bcx, dst_ptr)); } </ins> // Retrieve the information we are losing (making dynamic) in an unsizing // adjustment. // When making a dtor, we need to do different things depending on the

<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. // Binding unsized expressions to ref patterns pub fn main() { let ref a = *"abcdef"; assert_eq!(a, "abcdef"); match *"12345" { ref b => { assert_eq!(b, "12345") } } } </ins>
Change:
Fedora 21 x86_64, rustc 1.0.0-nightly ( 2015-03-22) (built 2015-03-23). I hit an assertion when compiling cuviper/rust-git-fs I haven't tried to reduce it yet. Stack trace from coredumpctl:
I narrowed this down to my , where a is indexed by a . I can reproduce the crash with this smaller example: If I convert to a first, then all is fine.
Another example is:
Does not seem to affect beta or nightly. Marking as E-needstest
I'll add regression tests for these examples right now

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. use std::mem; pub struct X([u8]); fn _f(x: &X) -> usize { match *x { X(ref x) =>  { x.len() } } } fn main() { let b: &[u8] = &[11; 42]; let v: &X = unsafe { mem::transmute(b) }; assert_eq!(_f(v), 42); } </ins>

<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::collections::HashMap; use std::path::{Path, PathBuf}; fn main() { let m: HashMap<PathBuf, ()> = HashMap::new(); let k = Path::new("foo"); println!("{:?}", m.get(k)); } </ins>

<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. #[derive(PartialEq)] struct Slice { slice: [u8] } fn main() {} </ins>
Change:
The trait was recently changed, once again, to inherit from . This was done mostly because suspect that many people will wind up using , especially once incorporated downcasting, worried that, after setting up such APIs, people would end up wanting to send between threads and not be able to, and, suspected that most errors would or could be made anyway. However, there are some cases in important libraries like Iron that involve non- errors, at least at the moment. We need to make a final decision here. Should we instead require people to know about and use when they need it?
cc
cc :)
note that this is blocking iron from building, so a swift decision would be quite appreciated
My feeling, as summarized to over IRC: better to be more general. If it turns out that people forget the Send a lot (and they probably will), we can always introduce an alias or something for , and converting from to ought to... mostly be compatible.
Does anyone think this needs an RfC? Though I believe the original RfC doesn't mention the bound so perhaps it's okay.
Yeah, I would consider this a relatively minor implementation detail. It's gone back and forth a few times since the original reform. I'm personally OK changing it a final time without an RFC.

Discussion:
/// Base functionality for all errors in Rust. #[stable(feature = "rust1", since = "1.0.0")] <del> pub trait Error: Debug + Display + Send { </del> <ins> pub trait Error: Debug + Display { </ins> /// A short description of the error. /// /// The description should not contain newlines or sentence-ending
Change:
Warning:
By the way, the warning goes away if you explicitly specify the trait who's static method you are calling, like so:

Discussion:
} fn lookup_and_handle_definition(&mut self, id: &ast::NodeId) { <ins> use middle::ty::TypeVariants::{TyEnum, TyStruct}; // If `bar` is a trait item, make sure to mark Foo as alive in `Foo::bar` self.tcx.tables.borrow().item_substs.get(id) .and_then(|substs| substs.substs.self_ty()) .map(|ty| match ty.sty { TyEnum(tyid, _) | TyStruct(tyid, _) => self.check_def_id(tyid.did), _ => (), }); </ins> self.tcx.def_map.borrow().get(id).map(|def| { match def.full_def() { def::DefConst(_) | def::DefAssociatedConst(..) => {

<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(associated_consts)] #![deny(dead_code)] // use different types / traits to test all combinations trait Const { const C: (); } trait StaticFn { fn sfn(); } struct ConstStruct; struct StaticFnStruct; enum ConstEnum {} enum StaticFnEnum {} struct AliasedConstStruct; struct AliasedStaticFnStruct; enum AliasedConstEnum {} enum AliasedStaticFnEnum {} type AliasConstStruct    = AliasedConstStruct; type AliasStaticFnStruct = AliasedStaticFnStruct; type AliasConstEnum      = AliasedConstEnum; type AliasStaticFnEnum   = AliasedStaticFnEnum; macro_rules! impl_Const {($($T:ident),*) => {$( impl Const for $T { const C: () = (); } )*}} macro_rules! impl_StaticFn {($($T:ident),*) => {$( impl StaticFn for $T { fn sfn() {} } )*}} impl_Const!(ConstStruct, ConstEnum, AliasedConstStruct, AliasedConstEnum); impl_StaticFn!(StaticFnStruct, StaticFnEnum, AliasedStaticFnStruct, AliasedStaticFnEnum); fn main() { let _ = ConstStruct::C; let _ = ConstEnum::C; StaticFnStruct::sfn(); StaticFnEnum::sfn(); let _ = AliasConstStruct::C; let _ = AliasConstEnum::C; AliasStaticFnStruct::sfn(); AliasStaticFnEnum::sfn(); } </ins>
Change:
Compiler panics, when closure marked as diverging. I tried this code: I expected to see this happen: Instead, this happened: : Backtrace:

Discussion:
def_id: fn_trait_def_id, substs: tcx.mk_substs(trait_substs), }); <del> ty::Binder((trait_ref, sig.0.output.unwrap())) </del> <ins> ty::Binder((trait_ref, sig.0.output.unwrap_or(ty::mk_nil(tcx)))) </ins> } impl<'tcx,O:Repr<'tcx>> Repr<'tcx> for super::Obligation<'tcx, O> {

ty::FnDiverging => unreachable!() } } <ins> pub fn unwrap_or(self, def: Ty<'tcx>) -> Ty<'tcx> { match self { ty::FnConverging(t) => t, ty::FnDiverging => def } } </ins> } pub type PolyFnOutput<'tcx> = Binder<FnOutput<'tcx>>;

demand::eqtype(fcx, self.call_expr.span, self_arg_ty, method_arg_ty); } <ins> let nilty = ty::mk_nil(fcx.tcx()); </ins> demand::eqtype(fcx, self.call_expr.span, <del> method_sig.output.unwrap(), self.fn_sig.output.unwrap()); </del> <ins> method_sig.output.unwrap_or(nilty), self.fn_sig.output.unwrap_or(nilty)); </ins> write_overloaded_call_method_map(fcx, self.call_expr, method_callee); }

<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. // error-pattern:oops fn main() { let func = || -> ! { panic!("oops"); }; func(); } </ins>
Change:
The code example at should be corrected changing into .
nice catch!
Should this instance be , or should everything else be instead? Judging from , it looks like is more common. Granted, half of it is alexcrichton, but still ;-) Incoming PR to that effect.
Oh, really now?
I actually vote for everything else to be .
Aw, shoot. From some more grepping, the style guide and the language reference both refer to . Going with that.
Ok but... to me it doesn't make sense that we use and then we name the folder , as they both can contain multiple tests...
/me considers giving Steve a choose-your-own-adventure pair of pull requests.

Discussion:
} #[cfg(test)] <del> mod tests { </del> <ins> mod test { </ins> use super::*; use test::Bencher;

} #[cfg(test)] <del> mod tests { </del> <ins> mod test { </ins> use super::*; #[test]
Change:
eg It's still an accurate characterization, but there's no other kind to contrast with.
We probably don't need it to say "Use with the module" either.

Discussion:
} } <del> /// External iterator for a string's characters and their byte offsets. /// Use with the `std::iter` module. </del> <ins> /// Iterator for a string's characters and their byte offsets. </ins> #[derive(Clone)] #[stable(feature = "rust1", since = "1.0.0")] pub struct CharIndices<'a> {
Change:
I have noted a regression in starting from (found with bisect). the failing test is one of . The fail occurs with stage1 and with stage2 (it have help a lot for bisect: only 50 min for 1 step of bisect) I extract the example to a standalone file, and manually run rustc: the error is a linking error: it seems -lgcc isn't passed by rustc, whereas the symbol was present in . Any help would be appreciate.
I have the same issue. It worked fine in nightly (2015-03-28), but now in nightly (2015-04-13) I get these errors when trying to link my standalone kernel with libcore: It only happens when I use my custom : If I try to add manually: ...Rust gives me this error instead: Is there a solution or workaround? <br /
you could try to explicitly link with libgcc by providing on rustc command-line.
Can that be done through Cargo too? As I've only used Cargo up to now.
I really don't known... (I don't have cargo on openbsd). You could try to add in your file.

Discussion:
As an example, here is a program that will calculate the dot product of two vectors provided from C, using idiomatic Rust practices. <del> ``` </del> <ins> ```ignore </ins> #![feature(lang_items, start, no_std, core, libc)] #![no_std]
Change:
Th example here: shows
We need an explicit here, I think
when I click on the codepen link, I do see an explicit . However, the function was not being called.
Right, but I think it does the wrong thing, because that main is generated by Rustdoc. It's only a theory, I could be wrong
Oh! No, this is

Discussion:
// Don't inject `extern crate std` because it's already injected by the // compiler. <del> if !s.contains("extern crate") && !opts.no_crate_inject { </del> <ins> if !s.contains("extern crate") && !opts.no_crate_inject && cratename != Some("std") { </ins> match cratename { Some(cratename) => { if s.contains(cratename) {
Change:
This causes cargo to misbehave: Tagging as E-easy, since the appropriate fix.
I'm going to try and fix this.
After reading the files and , I have come up with a plan. This is a little bit tricky, since with , we know that we are including utf-8 content, so it's safe to store the source as a String in a . We don't know that for , but I don't think we actually need to track the contents anyways, so I'm passing to . Currently building, I'll see if that fixes it.
This should have been Can someone with power close?
Indeed!

Discussion:
return DummyResult::expr(sp); } Ok(..) => { <ins> // Add this input file to the code map to make it available as // dependency information, but don't enter it's contents let filename = format!("{}", file.display()); cx.codemap().new_filemap(filename, "".to_string()); </ins> base::MacEager::expr(cx.expr_lit(sp, ast::LitBinary(Rc::new(bytes)))) } }

<ins> -include ../tools.mk # FIXME: ignore freebsd/windows # on windows `rustc --dep-info` produces Makefile dependency with # windows native paths (e.g. `c:pathtolibfoo.a`) # but msys make seems to fail to recognize such paths, so test fails. ifneq ($(shell uname),FreeBSD) ifndef IS_WINDOWS all: $(RUSTC) --emit dep-info main.rs grep "input.txt" $(TMPDIR)/main.d grep "input.bin" $(TMPDIR)/main.d else all: endif else all: endif </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. pub fn main() { const INPUT_TXT: &'static str = include_str!("input.txt"); const INPUT_BIN: &'static [u8] = include_bytes!("input.bin"); println!("{}", INPUT_TXT); println!("{:?}", INPUT_BIN); } </ins>
Change:
The following code will fail to compile at "Self::new()" with the message, "error: failed to resolve. Use of undeclared type or module " While either of the following will work: The first example should compile as-is.

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. #![allow(dead_code)] struct Foo; impl Foo { fn new() -> Self { Foo } fn bar() { Self::new(); } } fn main() {} </ins>