jiebi/CodeConvo huggingface dataset:
Change:
Because that's what the old build system does: but rustbuild and rsbegin.o ends up being an ELF on linux: The fix should be simple in theory. You just have to pass to the in the code linked above. But then you run in problems with the order of the operations: " not found for $TARGET". cc
FWIW, trying to cross compile to i686-pc-windows-gnu I get this: Trying to cross compile to x86_64-pc-windows-gnu results in
Yeah not passing would do it, should be easy to add though! (I think that's all that's necessary)
Actually, the solution is the opposite. rustbuild is building these startup files for linux but it should compile them for windows hence the has to be .
Oh right sorry "it" there was "would cause this problem", we should indeed pass !

Discussion:
return } let compiler = Compiler::new(0, &build.config.build); <del> let compiler = build.compiler_path(&compiler); </del> <ins> let compiler_path = build.compiler_path(&compiler); </ins> for file in t!(fs::read_dir(build.src.join("src/rtstartup"))) { let file = t!(file); <del> build.run(Command::new(&compiler) .arg("--emit=obj") .arg("--out-dir").arg(into) .arg(file.path())); </del> <ins> let mut cmd = Command::new(&compiler_path); build.add_bootstrap_key(&compiler, &mut cmd); build.run(cmd.arg("--target").arg(target) .arg("--emit=obj") .arg("--out-dir").arg(into) .arg(file.path())); </ins> } for obj in ["crt2.o", "dllcrt2.o"].iter() {

// object (usually called `crtX.o), which then invokes initialization callbacks // of other runtime components (registered via yet another special image section). <ins> #![feature(no_core, lang_items)] </ins> #![crate_type="rlib"] <del> #![no_std] </del> <ins> #![no_core] </ins> #![allow(non_camel_case_types)] <ins> #[lang = "sized"] trait Sized {} #[lang = "sync"] trait Sync {} #[lang = "copy"] trait Copy {} impl<T> Sync for T {} </ins> #[cfg(all(target_os="windows", target_arch = "x86", target_env="gnu"))] pub mod eh_frames { #[no_mangle]

// See rsbegin.rs for details. <ins> #![feature(no_core, lang_items)] </ins> #![crate_type="rlib"] <del> #![no_std] </del> <ins> #![no_core] #[lang = "sized"] trait Sized {} #[lang = "sync"] trait Sync {} impl<T> Sync for T {} </ins> #[cfg(all(target_os="windows", target_arch = "x86", target_env="gnu"))] pub mod eh_frames {

name = "std_shim" version = "0.1.0" dependencies = [ <ins> "core 0.0.0", </ins> "std 0.0.0", ]

[dependencies] std = { path = "../../libstd" } <ins> core = { path = "../../libcore" } </ins> # Reexport features from std [features]

// except according to those terms. // See comments in Cargo.toml for why this exists <ins> // There's a bug right now where if we pass --extern std=... and we're cross // compiling then this doesn't work with `#[macro_use] extern crate std;`. Work // around this by not having `#[macro_use] extern crate std;` #![no_std] extern crate std; </ins>
Change:
This looks weird. Isn't a .dll the right thing for this target? cc
Could you try passing ? Seems like may not be making its way to Cargo, or the shim is really messing up here (probably the latter)

Discussion:
return } let compiler = Compiler::new(0, &build.config.build); <del> let compiler = build.compiler_path(&compiler); </del> <ins> let compiler_path = build.compiler_path(&compiler); </ins> for file in t!(fs::read_dir(build.src.join("src/rtstartup"))) { let file = t!(file); <del> build.run(Command::new(&compiler) .arg("--emit=obj") .arg("--out-dir").arg(into) .arg(file.path())); </del> <ins> let mut cmd = Command::new(&compiler_path); build.add_bootstrap_key(&compiler, &mut cmd); build.run(cmd.arg("--target").arg(target) .arg("--emit=obj") .arg("--out-dir").arg(into) .arg(file.path())); </ins> } for obj in ["crt2.o", "dllcrt2.o"].iter() {

// object (usually called `crtX.o), which then invokes initialization callbacks // of other runtime components (registered via yet another special image section). <ins> #![feature(no_core, lang_items)] </ins> #![crate_type="rlib"] <del> #![no_std] </del> <ins> #![no_core] </ins> #![allow(non_camel_case_types)] <ins> #[lang = "sized"] trait Sized {} #[lang = "sync"] trait Sync {} #[lang = "copy"] trait Copy {} impl<T> Sync for T {} </ins> #[cfg(all(target_os="windows", target_arch = "x86", target_env="gnu"))] pub mod eh_frames { #[no_mangle]

// See rsbegin.rs for details. <ins> #![feature(no_core, lang_items)] </ins> #![crate_type="rlib"] <del> #![no_std] </del> <ins> #![no_core] #[lang = "sized"] trait Sized {} #[lang = "sync"] trait Sync {} impl<T> Sync for T {} </ins> #[cfg(all(target_os="windows", target_arch = "x86", target_env="gnu"))] pub mod eh_frames {

name = "std_shim" version = "0.1.0" dependencies = [ <ins> "core 0.0.0", </ins> "std 0.0.0", ]

[dependencies] std = { path = "../../libstd" } <ins> core = { path = "../../libcore" } </ins> # Reexport features from std [features]

// except according to those terms. // See comments in Cargo.toml for why this exists <ins> // There's a bug right now where if we pass --extern std=... and we're cross // compiling then this doesn't work with `#[macro_use] extern crate std;`. Work // around this by not having `#[macro_use] extern crate std;` #![no_std] extern crate std; </ins>
Change:
On OS X at least, it will think the link itself is the executable, then calculate sysroot based on that. Thanks to kyle for the report.
nominating to change to production ready
accepted for production-ready milestone
triage bump. still annoying.
or could be used to resolve the symlink. Would this issue warrant the badge "E_easy"?
Seems so! Adding the E-easy label.
Note that the relevant code is and it probably needs a check to see whether is a symlink or not.
seems important to fix for polish reasons. Accepted for P-high.

Discussion:
#!/usr/bin/env python # xfail-license <ins> import glob </ins> import sys if __name__ == '__main__':

def count(t): return sum(map(lambda (f, s): len(s.get(t, [])), summaries)) logfiles = sys.argv[1:] <del> map(summarise, logfiles) </del> <ins> for files in map(glob.glob, logfiles): map(summarise, files) </ins> ok = count('ok') failed = count('failed') ignored = count('ignored')

} pub fn get_or_default_sysroot() -> Path { <del> match os::self_exe_path() { option::Some(p) => { let mut p = p; p.pop(); p } </del> <ins> // Follow symlinks.  If the resolved path is relative, make it absolute. fn canonicalize(path: Option<Path>) -> Option<Path> { path.and_then(|mut path| match io::io_error::cond.trap(|_| ()).inside(|| fs::readlink(&path)) { Some(canon) => { if canon.is_absolute() { Some(canon) } else { path.pop(); Some(path.join(canon)) } }, None => Some(path), }) } match canonicalize(os::self_exe_name()) { option::Some(p) => { let mut p = p; p.pop(); p.pop(); p } </ins> option::None => fail!("can't determine value for sysroot") } }

format!("{}{}{}", consts::DLL_PREFIX, base, consts::DLL_SUFFIX) } <del> /// Optionally returns the filesystem path to the current executable which is </del> <ins> /// Optionally returns the filesystem path of the current executable which is </ins> /// running. If any failure occurs, None is returned. <del> pub fn self_exe_path() -> Option<Path> { </del> <ins> pub fn self_exe_name() -> Option<Path> { </ins> #[cfg(target_os = "freebsd")] fn load_self() -> Option<~[u8]> {

} } <del> load_self().and_then(|path| Path::new_opt(path).map(|mut p| { p.pop(); p })) </del> <ins> load_self().and_then(Path::new_opt) } /// Optionally returns the filesystem path to the current executable which is /// running. Like self_exe_name() but without the binary's name. /// If any failure occurs, None is returned. pub fn self_exe_path() -> Option<Path> { self_exe_name().map(|mut p| { p.pop(); p }) </ins> } /**

} #[test] <ins> fn test_self_exe_name() { let path = os::self_exe_name(); assert!(path.is_some()); let path = path.unwrap(); debug!("{:?}", path.clone()); // Hard to test this function assert!(path.is_absolute()); } #[test] </ins> fn test_self_exe_path() { let path = os::self_exe_path(); assert!(path.is_some());
Change:
The docs are: [ ] current given file? wat [ ] "as an expression" is incorrect -- it could be an item or statement according to context [ ] The second sentence is vague and confusing if you aren't familiar with hygiene. [ ] Behavior WRT relative paths is not specified (for it is). is widely used for generated code these days, so the doc should be more informative and clearly explain in which situations is a bad idea. Maybe even have an example of including generated code from $OUTDIR. Part of .
This was presumably fixed by

Discussion:
#[macro_export] macro_rules! cfg { ($($cfg:tt)*) => ({ /* compiler built-in */ }) } <del> /// Parse the current given file as an expression. /// /// This is generally a bad idea, because it's going to behave unhygienically. </del> <ins> /// Parse the file provided in the argument as an expression or an /// item according to the context. This file is located relative /// to the current file (similarly to how modules are found). /// /// Using this macro is often a bad idea, because if the file is /// parsed as an expression, it is going to be placed in the /// surrounding code unhygenically. This could result in variables /// or functions being different from what the file expected if /// there are variables or functions that have the same name in /// the current file. </ins> /// /// # Examples ///
Change:
This fails on stable because rust still parses the unstable module: It's possible to work around this by conditionally defining a macro and then having the macro define the module but that's a bit messy:
Or implement the module in another file. I think this is a fundamental limitation -- you can't skip forward over an item if you don't understand the syntax that the item is using. The only way we could solve it is with time travel, i.e., doing a point release of stable that knows the syntax but not what it means.
That's actually what I'm doing in my project (still the same problem). That is, I have the following in my : And a module,
Modules are parsed before 's are parsed, which has been an issue for as long as I can remember. Can someone find whether there is an issue tracking this?
Dupe of . cc ( expert!)
Though this'll be fixed by the above PR, the workaround for current stable is

Discussion:
} // Determine if a node with the given attributes should be included in this configuation. <del> fn in_cfg(&mut self, attrs: &[ast::Attribute]) -> bool { </del> <ins> pub fn in_cfg(&mut self, attrs: &[ast::Attribute]) -> bool { </ins> attrs.iter().all(|attr| { // When not compiling with --test we should not compile the #[test] functions if !self.should_test && is_test_or_bench(attr) {

/// Parse a `mod <foo> { ... }` or `mod <foo>;` item fn parse_item_mod(&mut self, outer_attrs: &[Attribute]) -> PResult<'a, ItemInfo> { <del> let outer_attrs = ::config::StripUnconfigured { config: &self.cfg, sess: self.sess, should_test: false, // irrelevant features: None, // don't perform gated feature checking }.process_cfg_attrs(outer_attrs.to_owned()); </del> <ins> let (in_cfg, outer_attrs) = { let mut strip_unconfigured = ::config::StripUnconfigured { config: &self.cfg, sess: self.sess, should_test: false, // irrelevant features: None, // don't perform gated feature checking }; let outer_attrs = strip_unconfigured.process_cfg_attrs(outer_attrs.to_owned()); (strip_unconfigured.in_cfg(&outer_attrs), outer_attrs) }; </ins> let id_span = self.span; let id = self.parse_ident()?; if self.check(&token::Semi) { self.bump(); <del> // This mod is in an external file. Let's go get it! let (m, attrs) = self.eval_src_mod(id, &outer_attrs, id_span)?; Ok((id, m, Some(attrs))) </del> <ins> if in_cfg { // This mod is in an external file. Let's go get it! let (m, attrs) = self.eval_src_mod(id, &outer_attrs, id_span)?; Ok((id, m, Some(attrs))) } else { let placeholder = ast::Mod { inner: syntax_pos::DUMMY_SP, items: Vec::new() }; Ok((id, ItemKind::Mod(placeholder), None)) } </ins> } else { let directory = self.directory.clone(); self.push_directory(id, &outer_attrs);

fn the(&self); } } <ins> #[cfg(any())] mod nonexistent_file; // Check that unconfigured non-inline modules are not loaded or parsed. </ins>
Change:
Because the itself cannot be marked , only the individual item.
Hi, I'm very new to rust and I'm trying to learn more about this language. I would like to make the change. Seems that I have to change the error text (e.g. ..., but the item of the parent impl is not marked ), Is it right? However searching about specialization documents I found this issue where seems that a will be possible. Am i missing something?
The text should suggest that the item could be , but not that the parent impl could be, because it can't. It might be in the future (as suggested by ) but that is not certain.
Hi , I'm seeing a bit more deep the specialization feature. I'm wondering if I can try to implement the . I have in mind to do what is described in the following quotes taken from the RFC For the moment, with this implementation, the must define all items of the trait (not a part of them) and, therefore, they will be all treated as default items. Would you accept a PR for this?
there is some debate at the moment about some of the details of specialisation. It would probably be best to open a thread on before starting to work on this.
PR was merged, so this can be closed now.

Discussion:
let mut err = struct_span_err!( tcx.sess, impl_item.span, E0520, "`{}` specializes an item from a parent `impl`, but  <del> neither that item nor the `impl` are marked `default`", </del> <ins> that item is not marked `default`", </ins> impl_item.name); err.span_label(impl_item.span, &format!("cannot specialize default item `{}`", impl_item.name));

match tcx.span_of_impl(parent_impl) { Ok(span) => { err.span_label(span, &"parent `impl` is here"); <del> err.note(&format!("to specialize, either the parent `impl` or `{}`  in the parent `impl` must be marked `default`", </del> <ins> err.note(&format!("to specialize, `{}` in the parent `impl` must be marked `default`", </ins> impl_item.name)); } Err(cname) => {

default fn fly(&self) {} //~^ ERROR E0520 //~| NOTE cannot specialize default item `fly` <del> //~| NOTE either the parent `impl` or `fly` in the parent `impl` must be marked `default` </del> <ins> //~| NOTE `fly` in the parent `impl` must be marked `default` </ins> } fn main() {
Change:
The following small binding produces an ICE: According to some comments in the IRC channel, the mode is necessary to comply to the C ABI. Trace:

Discussion:
Float => 4, Double => 8, Struct => { <del> do vec::foldl(0, struct_tys(ty)) |s, t| { s + ty_size(*t) } </del> <ins> let size = do vec::foldl(0, struct_tys(ty)) |s, t| { align(s, *t) + ty_size(*t) }; align(size, ty) </ins> } Array => { let len = llvm::LLVMGetArrayLength(ty) as uint;

<ins> // Issue #3656 // Incorrect struct size computation in the FFI, because of not taking // the alignment of elements into account. use libc::*; struct KEYGEN { hash_algorithm: [c_uint]/2, count: uint32_t, salt: *c_void, salt_size: uint32_t, } extern { // Bogus signature, just need to test if it compiles. pub fn malloc(++data: KEYGEN); } fn main() { } </ins>
Change:
Here's my code (2.rs): On running , I get And gives Am I missing something? Shouldn't the explanation talk about ?
The error explanation was in . The code reporting contains the following note: And, from :

Discussion:
``` "##, <ins> E0317: r##" This error occurs when an `if` expression without an `else` block is used in a context where a type other than `()` is expected, for example a `let` expression: ```compile_fail,E0317 fn main() { let x = 5; let a = if x == 5 { 1 }; } ``` An `if` expression without an `else` block has the type `()`, so this is a type error. To resolve it, add an `else` block having the same type as the `if` block. "##, </ins> E0398: r##" In Rust 1.3, the default object lifetime bounds are expected to change, as described in RFC #1156 [1]. You are getting a warning because the compiler

terr: &TypeError<'tcx>) -> DiagnosticBuilder<'tcx> { <del> // FIXME: do we want to use a different error code for each origin? let mut diag = struct_span_err!( self.tcx.sess, trace.origin.span(), E0308, "{}", trace.origin.as_failure_str() ); </del> <ins> let span = trace.origin.span(); let failure_str = trace.origin.as_failure_str(); let mut diag = match trace.origin { TypeOrigin::IfExpressionWithNoElse(_) => { struct_span_err!(self.tcx.sess, span, E0317, "{}", failure_str) }, _ => { struct_span_err!(self.tcx.sess, span, E0308, "{}", failure_str) }, }; </ins> self.note_type_err(&mut diag, trace.origin, None, Some(trace.values), terr); diag }

fn main() { let a = if true { true }; <del> //~^ ERROR if may be missing an else clause </del> <ins> //~^ ERROR if may be missing an else clause [E0317] </ins> //~| expected type `()` //~| found type `bool` //~| expected (), found bool
Change:
Noticed it causing issues with cargo as it uses and then parses the files as part of the fingerprinting process. It seems every instance of macro generated code (e.g. via serde_derive) creates a entry into this file which when cargo tries to look up it can't find. Cargo issue:
Added this to the macros 1.1 tracking issue (I consider this a blocker for stabilization)

Discussion:
__internal::with_parse_sess(|sess| { let src = src.to_string(); let cfg = Vec::new(); <del> let name = "rustc-macro source code".to_string(); </del> <ins> let name = "<rustc-macro source code>".to_string(); </ins> let mut parser = parse::new_parser_from_source_str(sess, cfg, name, src); let mut ret = TokenStream { inner: Vec::new() };

<ins> -include ../tools.mk all: $(RUSTC) foo.rs $(RUSTC) bar.rs --emit dep-info grep "rustc-macro source" $(TMPDIR)/bar.d && exit 1 || exit 0 </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. #![feature(rustc_macro)] #[macro_use] extern crate foo; #[derive(A)] struct A; fn main() { let _b = B; } </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. #![crate_type = "rustc-macro"] #![feature(rustc_macro)] #![feature(rustc_macro_lib)] extern crate rustc_macro; use rustc_macro::TokenStream; #[rustc_macro_derive(A)] pub fn derive(input: TokenStream) -> TokenStream { let input = input.to_string(); assert!(input.contains("struct A;")); "struct B;".parse().unwrap() } </ins>
Change:
This code works: As does placing it in an array: However, using a fails: Instead, it must be explicitly dereferenced: It's even more annoying for :
The fact that this works for arrays, but not Vec suggests that it's probably related to associated types. It's possible that wherever the coercion from to is done sees instead.
This doesn't seem to be fully resolved:
That may be instead.

Discussion:
expected: Expectation<'tcx>) -> Ty<'tcx> { let original_callee_ty = self.check_expr(callee_expr); <ins> let expr_ty = self.structurally_resolved_type(call_expr.span, original_callee_ty); </ins> <del> let mut autoderef = self.autoderef(callee_expr.span, original_callee_ty); </del> <ins> let mut autoderef = self.autoderef(callee_expr.span, expr_ty); </ins> let result = autoderef.by_ref().flat_map(|(adj_ty, idx)| { self.try_overloaded_call_step(call_expr, callee_expr, adj_ty, idx) }).next();

<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. // Ensure that types that rely on obligations are autoderefed // correctly fn main() { let x : Vec<Box<Fn()>> = vec![Box::new(|| ())]; x[0]() } </ins>
Change:
Currently on Travis CI for this repository, running the full test suite results in one having to download the raw log because the entire log is too long to fit in Travis CI's web UI. It also causes my browser tab to halt for a few seconds to render. I propose we turn on the for test running on Travis CI. This will also make it easier to find test failures for PRs where there are failures.
Sounds like a great idea!
Have any suggestions about how to accomplish this with rustbuild?
Perhaps could be a option which is threaded through to the tests themselves?
Nevermind, I guess this was intentionally turned off in
Ah yeah this was explicitly re-enabled to help diagnose flaky failures we've been having.

Discussion:
script: - docker run -v `pwd`:/build rust sh -c " <del> ./configure --enable-rustbuild --llvm-root=/usr/lib/llvm-3.7 && </del> <ins> ./configure --enable-rustbuild --llvm-root=/usr/lib/llvm-3.7 --enable-quiet-tests && </ins> make tidy && make check -j4 "

opt compiler-docs     0 "build compiler documentation" opt optimize-tests 1 "build tests with optimizations" opt debuginfo-tests 0 "build tests with debugger metadata" <ins> opt quiet-tests 0 "enable quieter output when running tests" </ins> opt libcpp 1 "build llvm with libc++ instead of libstdc++ when using clang" opt llvm-assertions 0 "build LLVM with assertions" opt debug-assertions 0 "build with debugging assertions"

cmd.arg("--verbose"); } <ins> if build.config.quiet_tests { cmd.arg("--quiet"); } </ins> // Only pass correct values for these flags for the `run-make` suite as it // requires that a C++ compiler was configured which isn't always the case. if suite == "run-make" {

build.add_rustc_lib_path(compiler, &mut cmd); cmd.arg("--test"); cmd.arg(markdown); <del> cmd.arg("--test-args").arg(build.flags.args.join(" ")); </del> <ins> let mut test_args = build.flags.args.join(" "); if build.config.quiet_tests { test_args.push_str(" --quiet"); } cmd.arg("--test-args").arg(test_args); </ins> build.run(&mut cmd); }

dylib_path.insert(0, build.sysroot_libdir(compiler, target)); cargo.env(dylib_path_var(), env::join_paths(&dylib_path).unwrap()); <ins> if build.config.quiet_tests { cargo.arg("--"); cargo.arg("--quiet"); } </ins> if target.contains("android") { build.run(cargo.arg("--no-run")); krate_android(build, compiler, target, mode);

// misc pub channel: String, <ins> pub quiet_tests: bool, </ins> // Fallback musl-root for all targets pub musl_root: Option<PathBuf>, pub prefix: Option<String>,

("RPATH", self.rust_rpath), ("OPTIMIZE_TESTS", self.rust_optimize_tests), ("DEBUGINFO_TESTS", self.rust_debuginfo_tests), <ins> ("QUIET_TESTS", self.quiet_tests), </ins> ("LOCAL_REBUILD", self.local_rebuild), ("NINJA", self.ninja), ("CODEGEN_TESTS", self.codegen_tests),
Change:
While playing around with , I encountered an ICE when attempting to compile the following code with nightly on the playground: Compiler output:
Backtrace: Rust Version:
Cannot reproduce with . The example builds and runs successfully.

Discussion:
<ins> // check-pass #![feature(specialization)] pub struct Cloned<I>(I); impl<'a, I, T: 'a> Iterator for Cloned<I> where I: Iterator<Item = &'a T>, T: Clone, { type Item = T; fn next(&mut self) -> Option<T> { unimplemented!() } } impl<'a, I, T: 'a> Iterator for Cloned<I> where I: Iterator<Item = &'a T>, T: Copy, { fn count(self) -> usize { unimplemented!() } } fn main() { let a = [1,2,3,4]; Cloned(a.iter()).count(); } </ins>