jiebi/CodeConvo huggingface dataset:
Change:
Tracking issue for rust-lang/rfcs
The feature gate for this points at , should it point here instead?
How is this going? Is anything on fire yet?
Is there any review/stability status on this feature by any chance?
Any update on this?
cc This seems like a constrained extension to macros, that we could consider stabilising.
There's an issue re interaction with deriving, see , but I think it's minor.
Going to FCP for this feature seems good to me. If people are using it successfully (or have found bugs!) please say so :-)
+1 to stabilising. There are still a few issues with type macros, but just bugs, and nothing major that I'm aware of.
Did the lang team decide to FCP or wait?
We went to FCP. Apologies for the dropped administrative work recently -- all of the Mozilla folks just traveled to London for a week and the preparations for that resulted in some balls being dropped.
This feature is in its final comment period for stabilization (in 1.11).
rustc 1.11 still reports type macros as unstable. Is there any chance of having this feature stabilized in 1.12?
Yes, it's ready for immediate stabilization. Anyone should feel free to open a stabilization PR and ping me on it.
Indeed I am slow in writing it up, but the team decided formally to stabilize this feature (as commented). Horray!
I am tagging the issue with E-mentor because I would be happy to mentor someone through the process of implementing a stabilization PR.
I don't have experience with rustc internals, but I'd be happy to try to implement the stabilization PR. :-)
ok, basically all you have to do is to modify in and basically remove the from this code: you also need to change this declaration from and move it to be "accepted" (there is a section of "accepted" features below in the file):
Also remove from any tests that mention it.
Ok, I've removed the check on the feature gate in , updated the tests and moved the declaration in . Just two questions: 1) should I bump the version number in the declaration to ? (or maybe , it's not clear to me if this commit will be backported to the current beta) 2) should I reference this issue in the commit message? I've put " for now, I don't know if this convention is ok for this project. Thanks!

Discussion:
("associated_type_defaults", "1.2.0", Some(29661), Active), // Allows macros to appear in the type position. <del> ("type_macros", "1.3.0", Some(27336), Active), </del> <ins> ("type_macros", "1.3.0", Some(27245), Active), </ins> // allow `repr(simd)`, and importing the various simd intrinsics ("repr_simd", "1.4.0", Some(27731), Active),

struct Foo<T> { x: Id!(T) <del> //~^ ERROR: type macros are experimental (see issue #27336) </del> <ins> //~^ ERROR: type macros are experimental (see issue #27245) </ins> } fn main() {
Change:
Fedora x8664 builds install libraries to /usr/lib64 so that 32-bit and 64-bit libraries can coexist on the same system. However, with , the build breaks: It appears that libraries are getting generated at stage0/lib but the build is (maybe?) looking for them at stage0/lib64. The results of : I can only assume the same problem will probably propagate through later stages. This is from doing a bootstrap build of the 1.1.0 tag (i.e., commit ) in rust git, but I've also tried bootstrapping using commit and gotten the same results. I've tried hunting down hard-coded "lib" and replacing it with $CFGLIBDIRRELATIVE. However, that did not resolve the problem, so perhaps something else is going on. Possibly related: , , Output of :

Discussion:
do for t in $CFG_TARGET do <ins> # host bin dir stage0 make_dir $h/stage0/bin </ins> # host lib dir stage0 make_dir $h/stage0/lib <ins> # host test dir stage0 make_dir $h/stage0/test </ins> # target bin dir stage0 make_dir $h/stage0/lib/rustlib/$t/bin # target lib dir stage0 make_dir $h/stage0/lib/rustlib/$t/lib <del> for i in 0 1 2 3 </del> <ins> for i in 1 2 3 </ins> do # host bin dir make_dir $h/stage$i/bin
Change:
Doesn't seem to ICE as of rustc 1.4.0-beta.3 ( 2015-10-16)
Yes, it's fixed, and there's a testcase in the tree; I just forgot to close it.

Discussion:
visit::walk_expr(self, expr); } <del> fn visit_fn(&mut self, fn_kind: visit::FnKind<'v>, decl: &'v ast::FnDecl, block: &'v ast::Block, span: Span, _id: ast::NodeId) { match fn_kind { visit::FkItemFn(..) | visit::FkMethod(..) => { // ignore nested fn items } visit::FkFnBlock => { visit::walk_fn(self, fn_kind, decl, block, span); } } } </del> <ins> // Skip all items; they aren't in the same context. fn visit_item(&mut self, _: &'v ast::Item) { } </ins> } impl<'a,'tcx> SeedBorrowKind<'a,'tcx> {

span: Span, id: ast::NodeId) { <del> match fn_kind { visit::FkItemFn(..) | visit::FkMethod(..) => { // ignore nested fn items } visit::FkFnBlock => { visit::walk_fn(self, fn_kind, decl, body, span); self.analyze_closure(id, span, decl, body); } } </del> <ins> visit::walk_fn(self, fn_kind, decl, body, span); self.analyze_closure(id, span, decl, body); </ins> } <ins> // Skip all items; they aren't in the same context. fn visit_item(&mut self, _: &'v ast::Item) { } </ins> } impl<'a,'tcx> euv::Delegate<'tcx> for AdjustBorrowKind<'a,'tcx> {

<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. fn main() { const _C: &'static Fn() = &||{}; } </ins>
Change:
made the lint trigger for tuples, but as far as I understand, returning is equivalent to returning cvoid, and therefore should be allowed. Here is an example:
Yes, stupid mistake; I'll fix it. (As a workaround, you can write .)
since was merged i'm closing

Discussion:
false } <ins> fn ast_ty_to_normalized<'tcx>(tcx: &ty::ctxt<'tcx>, id: ast::NodeId) -> Ty<'tcx> { let tty = match tcx.ast_ty_to_ty_cache.borrow().get(&id) { Some(&t) => t, None => panic!("ast_ty_to_ty_cache was incomplete after typeck!") }; infer::normalize_associated_type(tcx, &tty) } </ins> impl<'a, 'tcx> ImproperCTypesVisitor<'a, 'tcx> { /// Check if the given type is "ffi-safe" (has a stable, well-defined /// representation which can be exported to C code).

} fn check_def(&mut self, sp: Span, id: ast::NodeId) { <del> let tty = match self.cx.tcx.ast_ty_to_ty_cache.borrow().get(&id) { Some(&t) => t, None => panic!("ast_ty_to_ty_cache was incomplete after typeck!") }; let tty = infer::normalize_associated_type(self.cx.tcx, &tty); </del> <ins> let tty = ast_ty_to_normalized(self.cx.tcx, id); </ins> match ImproperCTypesVisitor::check_type_for_ffi(self, &mut FnvHashSet(), tty) { FfiResult::FfiSafe => {}

check_ty(cx, &*input.ty); } if let ast::Return(ref ret_ty) = decl.output { <del> check_ty(cx, &**ret_ty); </del> <ins> let tty = ast_ty_to_normalized(cx.tcx, ret_ty.id); if !tty.is_nil() { check_ty(cx, &ret_ty); } </ins> } }

pub struct ZeroSize; pub type RustFn = fn(); pub type RustBadRet = extern fn() -> Box<u32>; <ins> pub type CVoidRet = (); </ins> extern { pub fn bare_type1(size: isize); //~ ERROR: found Rust type

pub fn good6(s: StructWithProjectionAndLifetime); pub fn good7(fptr: extern fn() -> ()); pub fn good8(fptr: extern fn() -> !); <ins> pub fn good9() -> (); pub fn good10() -> CVoidRet; </ins> } fn main() {
Change:
Just like , Clone is also wanted for , but that can be much simpler: There is no panic issue, and it can use a simple ptr::copy of the data. Follow up after

Discussion:
} } <ins> #[stable(feature = "box_slice_clone", since = "1.3.0")] impl Clone for Box<str> { fn clone(&self) -> Self { let len = self.len(); let buf = RawVec::with_capacity(len); unsafe { ptr::copy_nonoverlapping(self.as_ptr(), buf.ptr(), len); mem::transmute(buf.into_box()) // bytes to str ~magic } } } </ins> #[stable(feature = "rust1", since = "1.0.0")] impl<T: ?Sized + PartialEq> PartialEq for Box<T> { #[inline]

#![feature(unsafe_no_drop_flag, filling_drop)] #![feature(unsize)] #![feature(core_slice_ext)] <ins> #![feature(core_str_ext)] </ins> #![cfg_attr(test, feature(test, alloc, rustc_private, box_raw))] #![cfg_attr(all(not(feature = "external_funcs"), not(feature = "external_crate")),

assert_eq!(string.clone().into_boxed_slice().into_string(), string); } <ins> #[test] fn test_box_slice_clone() { let data = String::from("hello HELLO hello HELLO yes YES 5 中ä华!!!"); let data2 = data.clone().into_boxed_slice().clone().into_string(); assert_eq!(data, data2); } </ins> mod pattern { use std::str::pattern::Pattern; use std::str::pattern::{Searcher, ReverseSearcher};
Change:
The problematic function: the first field return value is very much alive when is called on . This doesn't strictly violate LLVM's aliasing rules (AFAICT), because the overlapping part isn't directly accessed, but is still very sketchy (I can think of optimizers screwing it up).

Discussion:
#[inline] fn split_at_mut(&mut self, mid: usize) -> (&mut [T], &mut [T]) { <ins> let len = self.len(); let ptr = self.as_mut_ptr(); assert!(mid <= len); </ins> unsafe { <del> let self2: &mut [T] = mem::transmute_copy(&self); (ops::IndexMut::index_mut(self, ops::RangeTo { end: mid } ), ops::IndexMut::index_mut(self2, ops::RangeFrom { start: mid } )) </del> <ins> (from_raw_parts_mut(ptr, mid), from_raw_parts_mut(ptr.offset(mid as isize), len - mid)) </ins> } }
Change:
It looks like that when a local variable is initialized in a loop and dropped in the same loop, the stack local drop flag for that local isn't reinitialized to "not dropped" when the loop runs after the first time. Concretely, this test passes on stable and fails on nightly right now: cc
Interestingly this slight variation on the above code does drop twice as expected:

Discussion:
"Force drop flag checks on or off"), trace_macros: bool = (false, parse_bool, "For every macro invocation, print its name and arguments"), <del> disable_nonzeroing_move_hints: bool = (false, parse_bool, "Force nonzeroing move optimization off"), </del> <ins> enable_nonzeroing_move_hints: bool = (false, parse_bool, "Force nonzeroing move optimization on"), </ins> } pub fn default_lib_output() -> CrateType {

self.opts.debugging_opts.print_enum_sizes } pub fn nonzeroing_move_hints(&self) -> bool { <del> !self.opts.debugging_opts.disable_nonzeroing_move_hints </del> <ins> self.opts.debugging_opts.enable_nonzeroing_move_hints </ins> } pub fn sysroot<'a>(&'a self) -> &'a Path { match self.opts.maybe_sysroot {

<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. // ignore-pretty #27582 // Check that when a `let`-binding occurs in a loop, its associated // drop-flag is reinitialized (to indicate "needs-drop" at the end of // the owning variable's scope). struct A<'a>(&'a mut i32); impl<'a> Drop for A<'a> { fn drop(&mut self) { *self.0 += 1; } } fn main() { let mut cnt = 0; for i in 0..2 { let a = A(&mut cnt); if i == 1 { // Note that break;  //  both this break }           //   and also drop(a);    //    this move of `a` // are necessary to expose the bug } assert_eq!(cnt, 2); } </ins>
Change:
The exact opposite is said at the beginning of the chapter : Also, the doc seems to be meant for the Randolf-Carters of this world or the others, and while it is nice to introduce the more abstract notion of subtyping early on, it would be much more readable if "is a subtype of" were replaced with "outlives" in the later explanations IMHO.
Oops! Good catch.
we should discuss tagging for the nomicon, for now, tagging with docs and assigning to you

Discussion:
The signature of `overwrite` is clearly valid: it takes mutable references to two values of the same type, and overwrites one with the other. If `&mut T` was <del> variant over T, then `&mut &'a str` would be a subtype of `&mut &'static str`, since `&'a str` is a subtype of `&'static str`. Therefore the lifetime of </del> <ins> variant over T, then `&mut &'static str` would be a subtype of `&mut &'a str`, since `&'static str` is a subtype of `&'a str`. Therefore the lifetime of </ins> `forever_str` would successfully be "shrunk" down to the shorter lifetime of `string`, and `overwrite` would be called successfully. `string` would subsequently be dropped, and `forever_str` would point to freed memory when we
Change:
I compile the code below: using compiler version 1.3.0-nightly ( 2015-07-27) with the following command line: As result I get the following symbol inside a produced rlib:
How'd you verify this? I tried a few variants myself and it looks like it works.
It's broken in Nightly release. Try the following code in after choosing 'Asm' and 'Nightly'.
Aha, looks like I was using an older nightly. cc some informal bisecting turns up as a suspicious commit
Yes, that bisection is correct; PR coming up.

Discussion:
} } <ins> fn set_global_section(ccx: &CrateContext, llval: ValueRef, i: &ast::Item) { match attr::first_attr_value_str_by_name(&i.attrs, "link_section") { Some(sect) => { if contains_null(&sect) { ccx.sess().fatal(&format!("Illegal null byte in link_section value: `{}`", &sect)); } unsafe { let buf = CString::new(sect.as_bytes()).unwrap(); llvm::LLVMSetSection(llval, buf.as_ptr()); } }, None => () } } </ins> pub fn trans_item(ccx: &CrateContext, item: &ast::Item) { let _icx = push_ctxt("trans_item");

} else { trans_fn(ccx, &**decl, &**body, llfn, empty_substs, item.id, &item.attrs); } <ins> set_global_section(ccx, llfn, item); </ins> update_linkage(ccx, llfn, Some(item.id), if is_origin { OriginalTranslation } else { InlinedCopy });

v.visit_expr(&**expr); let g = consts::trans_static(ccx, m, expr, item.id, &item.attrs); <ins> set_global_section(ccx, g, item); </ins> update_linkage(ccx, g, Some(item.id), OriginalTranslation); }, ast::ItemForeignMod(ref foreign_mod) => {

_ => ccx.sess().bug("get_item_val: weird result in table") }; <del> match attr::first_attr_value_str_by_name(&i.attrs, "link_section") { Some(sect) => { if contains_null(&sect) { ccx.sess().fatal(&format!("Illegal null byte in link_section value: `{}`", &sect)); } unsafe { let buf = CString::new(sect.as_bytes()).unwrap(); llvm::LLVMSetSection(v, buf.as_ptr()); } }, None => () } </del> v }

<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. // compile-flags: -C no-prepopulate-passes // CHECK: @VAR1 = constant i32 1, section ".test_one" #[no_mangle] #[link_section = ".test_one"] pub static VAR1: u32 = 1; pub enum E { A(u32), B(f32) } // CHECK: @VAR2 = constant {{.*}} { i32 0, i32 666, {{.*}} }, section ".test_two" #[no_mangle] #[link_section = ".test_two"] pub static VAR2: E = E::A(666); // CHECK: @VAR3 = constant {{.*}} { i32 1, float 1.000000e+00, {{.*}} }, section ".test_three" #[no_mangle] #[link_section = ".test_three"] pub static VAR3: E = E::B(1.); // CHECK: define void @fn1() {{.*}} section ".test_four" { #[no_mangle] #[link_section = ".test_four"] pub fn fn1() {} </ins>
Change:
Ran into this when running a fauly tt muncher with ~100 items. We can now compete with C++ in the compiler spew area as well! :-P
Ran into this while demonstrating why you need raw pointers to do a singly-linked-queue: 66 Borrow check errors in this test.

Discussion:
let new_loan_indices = self.loans_generated_by(node); debug!("new_loan_indices = {:?}", new_loan_indices); <del> self.each_issued_loan(node, |issued_loan| { for &new_loan_index in &new_loan_indices { </del> <ins> for &new_loan_index in &new_loan_indices { self.each_issued_loan(node, |issued_loan| { </ins> let new_loan = &self.all_loans[new_loan_index]; <del> self.report_error_if_loans_conflict(issued_loan, new_loan); } true }); </del> <ins> // Only report an error for the first issued loan that conflicts // to avoid O(n^2) errors. self.report_error_if_loans_conflict(issued_loan, new_loan) }); } </ins> for (i, &x) in new_loan_indices.iter().enumerate() { let old_loan = &self.all_loans[x];

pub fn report_error_if_loans_conflict(&self, old_loan: &Loan<'tcx>, <del> new_loan: &Loan<'tcx>) { </del> <ins> new_loan: &Loan<'tcx>) -> bool { </ins> //! Checks whether `old_loan` and `new_loan` can safely be issued //! simultaneously.

self.report_error_if_loan_conflicts_with_restriction( old_loan, new_loan, old_loan, new_loan) && self.report_error_if_loan_conflicts_with_restriction( <del> new_loan, old_loan, old_loan, new_loan); </del> <ins> new_loan, old_loan, old_loan, new_loan) </ins> } pub fn report_error_if_loan_conflicts_with_restriction(&self,

<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. // Test to ensure we only report an error for the first issued loan that // conflicts with a new loan, as opposed to every issued loan.  This keeps us // down to O(n) errors (for n problem lines), instead of O(n^2) errors. fn main() { let mut x = 1; let mut addr; loop { match 1 { 1 => { addr = &mut x; } //~^ ERROR cannot borrow `x` as mutable more than once at a time 2 => { addr = &mut x; } //~^ ERROR cannot borrow `x` as mutable more than once at a time _ => { addr = &mut x; } //~^ ERROR cannot borrow `x` as mutable more than once at a time } } } </ins>
Change:
The high end of the span of in is incorrectly set to .
It's seems to be caused by this `hack': (Called here: ) Weirdly enough, the proper span is shown for diagnostics: Any pointers,
Since works in s now, it's probably time to retire that hack and always provide the correct type. appears to hold the type (with its correct span), instead of the argument itself, in this case.
This has been fixed. Can this ticket be closed?

Discussion:
<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. // Point at correct span for self type struct SomeType {} trait Foo { fn handler(self: &SomeType); } fn main() {} </ins>

<ins> error[E0308]: mismatched method receiver --> $DIR/issue-27522.rs:16:22 | 16 |     fn handler(self: &SomeType); |                      ^^^^^^^^^ expected Self, found struct `SomeType` | = note: expected type `&Self` = note:    found type `&SomeType` error: aborting due to previous error </ins>
Change:
In the documentation for , it states that: "Though they both have scary names, PhantomData<Tand "phantom types" are unrelated." This seems to not be an accurate description of the relationship between the PhantomData marker and phantom types, the concept. They are related, just not the same thing. /cc

Discussion:
/// even though it does not. This allows you to inform the compiler about certain safety properties /// of your code. /// <del> /// Though they both have scary names, `PhantomData<T>` and "phantom types" are unrelated. 👻👻👻 </del> <ins> /// # A ghastly note 👻👻👻 /// /// Though they both have scary names, `PhantomData<T>` and 'phantom types' are related, but not /// identical. Phantom types are a more general concept that don't require `PhantomData<T>` to /// implement, but `PhantomData<T>` is the most common way to implement them in a correct manner. </ins> /// /// # Examples ///
Change:
Title says it all. cc
This was recently for MUSL/MSVC, and for sake the docs would probably look something like: - a cfg option provided by the compiler by default describing the runtime environment of the target platform. Some examples of this are "musl" for builds targeting the MUSL libc implementation, "msvc" for Windows builds targeting MSVC, and "gnu" frequently the rest of the time. This option may also be blank on some platforms.

Discussion:
`"mips"`, `"powerpc"`, `"arm"`, or `"aarch64"`. * `target_endian = "..."`. Endianness of the target CPU, either `"little"` or `"big"`. <ins> * `target_env = ".."` - an option provided by the compiler by default describing the runtime environment of the target platform. Some examples of this are `musl` for builds targeting the MUSL libc implementation, `msvc` for Windows builds targeting MSVC, and `gnu` frequently the rest of the time. This option may also be blank on some platforms. </ins> * `target_family = "..."`. Operating system family of the target, e. g. `"unix"` or `"windows"`. The value of this configuration option is defined as a configuration itself, like `unix` or `windows`.
Change:
Trying to package rust 1.2 into Debian & Ubuntu, I get the following test failures: I am using Debian LLVM 3.6.1 packages (version 3.6.1-1)
is in the package. I wonder whether we want a check in that makes a requirement or one that disables the respective tests if it is not available.
That was indeed the issue. I installed it and I have issue now.
Addressed in
These test should be optional until LLVM has a way to install FileCheck

Discussion:
LLVM_BUILD_DIR= LLVM_INST_DIR=$CFG_LLVM_ROOT do_reconfigure=0 <ins> # Check that LLVm FileCheck is available. Needed for the tests need_cmd $LLVM_INST_DIR/bin/FileCheck </ins> fi if [ ${do_reconfigure} -ne 0 ] then # because git is hilarious, it might have put the module index