jiebi/CodeConvo huggingface dataset:
= note: `impl Trait` is only allowed in arguments and return types of functions and methods error[E0798]: function pointers with the `"C-cmse-nonsecure-call"` ABI cannot contain generics in their type <del> --> $DIR/generics.rs:19:9 </del> <ins> --> $DIR/generics.rs:20:9 </ins> | LL |     f3: extern "C-cmse-nonsecure-call" fn(T, u32, u32, u32) -> u64, |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0798]: function pointers with the `"C-cmse-nonsecure-call"` ABI cannot contain generics in their type <del> --> $DIR/generics.rs:20:9 </del> <ins> --> $DIR/generics.rs:21:9 </ins> | LL |     f4: extern "C-cmse-nonsecure-call" fn(Wrapper<T>, u32, u32, u32) -> u64, |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ <del> error: aborting due to 5 previous errors </del> <ins> error[E0798]: return value of `"C-cmse-nonsecure-call"` function too large to pass via registers --> $DIR/generics.rs:27:73 | LL | type WithTraitObject = extern "C-cmse-nonsecure-call" fn(&dyn Trait) -> &dyn Trait; |                                                                         ^^^^^^^^^^ this type doesn't fit in the available registers | = note: functions with the `"C-cmse-nonsecure-call"` ABI must pass their result via the available return registers = note: the result must either be a (transparently wrapped) i64, u64 or f64, or be at most 4 bytes in size error[E0798]: return value of `"C-cmse-nonsecure-call"` function too large to pass via registers --> $DIR/generics.rs:31:62 | LL |     extern "C-cmse-nonsecure-call" fn(&'static dyn Trait) -> &'static dyn Trait; |                                                              ^^^^^^^^^^^^^^^^^^ this type doesn't fit in the available registers | = note: functions with the `"C-cmse-nonsecure-call"` ABI must pass their result via the available return registers = note: the result must either be a (transparently wrapped) i64, u64 or f64, or be at most 4 bytes in size error[E0798]: return value of `"C-cmse-nonsecure-call"` function too large to pass via registers --> $DIR/generics.rs:38:62 | LL |     extern "C-cmse-nonsecure-call" fn(WrapperTransparent) -> WrapperTransparent; |                                                              ^^^^^^^^^^^^^^^^^^ this type doesn't fit in the available registers | = note: functions with the `"C-cmse-nonsecure-call"` ABI must pass their result via the available return registers = note: the result must either be a (transparently wrapped) i64, u64 or f64, or be at most 4 bytes in size error[E0045]: C-variadic function must have a compatible calling convention, like `C` or `cdecl` --> $DIR/generics.rs:41:20 | LL | type WithVarArgs = extern "C-cmse-nonsecure-call" fn(u32, ...); |                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ C-variadic function must have a compatible calling convention error: aborting due to 9 previous errors </ins> <del> Some errors have detailed explanations: E0412, E0562, E0798. For more information about an error, try `rustc --explain E0412`. </del> <ins> Some errors have detailed explanations: E0045, E0412, E0562, E0798. For more information about an error, try `rustc --explain E0045`. </ins>
cmd_finder.must_have(s); } <del> // this warning is useless in CI, // and CI probably won't have the right branches anyway. if !build_helper::ci::CiEnv::is_ci() { if let Err(e) = warn_old_master_branch(&build.config.git_config(), &build.config.src) .map_err(|e| e.to_string()) { eprintln!("unable to check if upstream branch is old: {e}"); } } </del> <ins> warn_old_master_branch(&build.config.git_config(), &build.config.src); </ins> }
/// /// This can result in formatting thousands of files instead of a dozen, /// so we should warn the user something is wrong. <del> pub fn warn_old_master_branch( config: &GitConfig<'_>, git_dir: &Path, ) -> Result<(), Box<dyn std::error::Error>> { use std::time::Duration; const WARN_AFTER: Duration = Duration::from_secs(60 * 60 * 24 * 10); let updated_master = updated_master_branch(config, Some(git_dir))?; let branch_path = git_dir.join(".git/refs/remotes").join(&updated_master); match std::fs::metadata(branch_path) { Ok(meta) => { if meta.modified()?.elapsed()? > WARN_AFTER { eprintln!("warning: {updated_master} has not been updated in 10 days"); } else { return Ok(()); </del> <ins> pub fn warn_old_master_branch(config: &GitConfig<'_>, git_dir: &Path) { if crate::ci::CiEnv::is_ci() { // this warning is useless in CI, // and CI probably won't have the right branches anyway. return; } // this will be overwritten by the actual name, if possible let mut updated_master = "the upstream master branch".to_string(); match warn_old_master_branch_(config, git_dir, &mut updated_master) { Ok(branch_is_old) => { if !branch_is_old { return; </ins> } <ins> // otherwise fall through and print the rest of the warning </ins> } Err(err) => { eprintln!("warning: unable to check if {updated_master} is old due to error: {err}")
} eprintln!( "warning: {updated_master} is used to determine if files have been modifiedn <del> warning: if it is not updated, this may cause files to be needlessly reformatted" </del> <ins> warning: if it is not updated, this may cause files to be needlessly reformatted" </ins> ); <del> Ok(()) </del> <ins> } pub fn warn_old_master_branch_( config: &GitConfig<'_>, git_dir: &Path, updated_master: &mut String, ) -> Result<bool, Box<dyn std::error::Error>> { use std::time::Duration; *updated_master = updated_master_branch(config, Some(git_dir))?; let branch_path = git_dir.join(".git/refs/remotes").join(&updated_master); const WARN_AFTER: Duration = Duration::from_secs(60 * 60 * 24 * 10); let meta = match std::fs::metadata(&branch_path) { Ok(meta) => meta, Err(err) => { let gcd = git_common_dir(&git_dir)?; if branch_path.starts_with(&gcd) { return Err(Box::new(err)); } std::fs::metadata(Path::new(&gcd).join("refs/remotes").join(&updated_master))? } }; if meta.modified()?.elapsed()? > WARN_AFTER { eprintln!("warning: {updated_master} has not been updated in 10 days"); Ok(true) } else { Ok(false) } } fn git_common_dir(dir: &Path) -> Result<String, String> { output_result(Command::new("git").arg("-C").arg(dir).arg("rev-parse").arg("--git-common-dir")) .map(|x| x.trim().to_string()) </ins> }
} #[derive(PartialEq, Eq, Clone, Copy, Debug)] <del> pub struct ExitCode(bool); </del> <ins> pub struct ExitCode(u8); </ins> impl ExitCode { <del> pub const SUCCESS: ExitCode = ExitCode(false); pub const FAILURE: ExitCode = ExitCode(true); </del> <ins> pub const SUCCESS: ExitCode = ExitCode(0); pub const FAILURE: ExitCode = ExitCode(1); </ins> pub fn as_i32(&self) -> i32 { self.0 as i32
// if a test does not crash, consider it an error if proc_res.status.success() || matches!(proc_res.status.code(), Some(1 | 0)) { self.fatal(&format!( <del> "crashtest no longer crashes/triggers ICE, horray! Please give it a meaningful name,  add a doc-comment to the start of the test explaining why it exists and  move it to tests/ui or wherever you see fit. Adding 'Fixes #<issueNr>' to your PR description  ensures that the corresponding ticket is auto-closed upon merge." </del> <ins> "crashtest no longer crashes/triggers ICE, horray! Please give it a meaningful  name, add a doc-comment to the start of the test explaining why it exists and  move it to tests/ui or wherever you see fit. Adding 'Fixes #<issueNr>' to your PR  description ensures that the corresponding ticket is auto-closed upon merge.  If you want to see verbose output, set `COMPILETEST_VERBOSE_CRASHES=1`." </ins> )); } }
} .docblock li { <del> margin-bottom: .8em; </del> <ins> margin-bottom: .4em; </ins> } <del> .docblock li p { margin-bottom: .1em; </del> <ins> .docblock li p:not(:last-child) { /* This margin is voluntarily smaller than `.docblock li` to keep the visual list element items separated while also having a visual separation (although smaller) for paragraphs. */ margin-bottom: .3em; </ins> } /* "where ..." clauses with block display are also smaller */
<ins> // This test ensures that the documentation list markers are correctly placed. // It also serves as a regression test for <https://github.com/rust-lang/rust/issues/130622>. go-to: "file://" + |DOC_PATH| + "/test_docs/long_list/index.html" show-text: true // 0.3em assert-css: (".docblock li p:not(last-child)", {"margin-bottom": "4.8px"}) assert-css: (".docblock li p + p:last-child", {"margin-bottom": "0px"}) // 0.4em assert-css: (".docblock li", {"margin-bottom": "6.4px"}) </ins>
/// subt_vec_num(x: &[f64], y: f64) pub fn subt_vec_num() {} } <ins> pub mod long_list { //! bla //! //! * Lorem ipsum dolor sit amet, consectetur adipiscing elit. Pellentesque et libero ut leo //!   interdum laoreet vitae a mi. Aliquam erat volutpat. Suspendisse volutpat non quam non //!   commodo. //! //!   Praesent enim neque, imperdiet sed nisl at, lobortis egestas augue. Sed vitae tristique //!   augue. Phasellus vel pretium lectus. //! * Praesent enim neque, imperdiet sed nisl at, lobortis egestas augue. Sed vitae tristique //!   augue. Phasellus vel pretium lectus. //! * Praesent enim neque, imperdiet sed nisl at, lobortis egestas augue. Sed vitae tristique //!   augue. Phasellus vel pretium lectus. //! //! Another list: //! //! * [`TryFromBytes`](#a) indicates that a type may safely be converted from certain byte //!   sequence (conditional on runtime checks) //! * [`FromZeros`](#a) indicates that a sequence of zero bytes represents a valid instance of //!   a type //! * [`FromBytes`](#a) indicates that a type may safely be converted from an arbitrary byte //!   sequence } </ins>
} macro_rules! tool_check_step { <del> ($name:ident, $path:literal, $($alias:literal, )* $source_type:path $(, $default:literal )?) => { </del> <ins> ( $name:ident, $display_name:literal, $path:literal, $($alias:literal, )* $source_type:path $(, $default:literal )? ) => { </ins> #[derive(Debug, Clone, PartialEq, Eq, Hash)] pub struct $name { pub target: TargetSelection,
}; } <del> tool_check_step!(Rustdoc, "src/tools/rustdoc", "src/librustdoc", SourceType::InTree); </del> <ins> tool_check_step!(Rustdoc, "rustdoc", "src/tools/rustdoc", "src/librustdoc", SourceType::InTree); </ins> // Clippy, miri and Rustfmt are hybrids. They are external tools, but use a git subtree instead // of a submodule. Since the SourceType only drives the deny-warnings // behavior, treat it as in-tree so that any new warnings in clippy will be // rejected. <del> tool_check_step!(Clippy, "src/tools/clippy", SourceType::InTree); tool_check_step!(Miri, "src/tools/miri", SourceType::InTree); tool_check_step!(CargoMiri, "src/tools/miri/cargo-miri", SourceType::InTree); tool_check_step!(Rls, "src/tools/rls", SourceType::InTree); tool_check_step!(Rustfmt, "src/tools/rustfmt", SourceType::InTree); tool_check_step!(MiroptTestTools, "src/tools/miropt-test-tools", SourceType::InTree); tool_check_step!(TestFloatParse, "src/etc/test-float-parse", SourceType::InTree); tool_check_step!(Bootstrap, "src/bootstrap", SourceType::InTree, false); </del> <ins> tool_check_step!(Clippy, "clippy", "src/tools/clippy", SourceType::InTree); tool_check_step!(Miri, "miri", "src/tools/miri", SourceType::InTree); tool_check_step!(CargoMiri, "cargo-miri", "src/tools/miri/cargo-miri", SourceType::InTree); tool_check_step!(Rls, "rls", "src/tools/rls", SourceType::InTree); tool_check_step!(Rustfmt, "rustfmt", "src/tools/rustfmt", SourceType::InTree); tool_check_step!( MiroptTestTools, "miropt-test-tools", "src/tools/miropt-test-tools", SourceType::InTree ); tool_check_step!( TestFloatParse, "test-float-parse", "src/etc/test-float-parse", SourceType::InTree ); tool_check_step!(Bootstrap, "bootstrap", "src/bootstrap", SourceType::InTree, false); </ins> /// Cargo's output path for the standard library in a given stage, compiled /// by a particular compiler for the specified target.
}); } <ins> function escape(content) { return $('<h1/>').text(content).html(); } </ins> function showResults(results) { var output, shown, query = getQuery(); currentResults = query.id; <del> output = '<h1>Results for ' + query.query + (query.type ? ' (type: ' + query.type + ')' : '') + '</h1>'; </del> <ins> output = '<h1>Results for ' + escape(query.query) + (query.type ? ' (type: ' + escape(query.type) + ')' : '') + '</h1>'; </ins> output += '<table class="search-results">'; if (results.length > 0) {
fn clone(&self) -> Box<rtio::RtioTcpStream + Send> { box TcpWatcher { handle: self.handle, <del> stream: StreamWatcher::new(self.handle), </del> <ins> stream: StreamWatcher::new(self.handle, false), </ins> home: self.home.clone(), refcount: self.refcount.clone(), read_access: self.read_access.clone(),
// will be manipulated on each of the methods called on this watcher. // Wrappers should ensure to always reset the field to an appropriate value // if they rely on the field to perform an action. <del> pub fn new(stream: *mut uvll::uv_stream_t) -> StreamWatcher { unsafe { uvll::set_data_for_uv_handle(stream, 0 as *mut int) } </del> <ins> pub fn new(stream: *mut uvll::uv_stream_t, init: bool) -> StreamWatcher { if init { unsafe { uvll::set_data_for_uv_handle(stream, 0 as *mut int) } } </ins> StreamWatcher { handle: stream, last_write_req: None,
rx2.recv(); }) <ins> iotest!(fn clone_while_reading() { let addr = next_test_ip6(); let listen = TcpListener::bind(addr.ip.to_str().as_slice(), addr.port); let mut accept = listen.listen().unwrap(); // Enqueue a task to write to a socket let (tx, rx) = channel(); let (txdone, rxdone) = channel(); let txdone2 = txdone.clone(); spawn(proc() { let mut tcp = TcpStream::connect(addr.ip.to_str().as_slice(), addr.port).unwrap(); rx.recv(); tcp.write_u8(0).unwrap(); txdone2.send(()); }); // Spawn off a reading clone let tcp = accept.accept().unwrap(); let tcp2 = tcp.clone(); let txdone3 = txdone.clone(); spawn(proc() { let mut tcp2 = tcp2; tcp2.read_u8().unwrap(); txdone3.send(()); }); // Try to ensure that the reading clone is indeed reading for _ in range(0i, 50) { ::task::deschedule(); } // clone the handle again while it's reading, then let it finish the // read. let _ = tcp.clone(); tx.send(()); rxdone.recv(); rxdone.recv(); }) </ins> }
pub stderr: Option<AnonPipe>, } <del> // FIXME: This should be a unit struct, so we can always construct it // The value here should be never used, since we cannot spawn processes. </del> <ins> #[derive(Debug)] </ins> pub enum Stdio { Inherit, Null, MakePipe, <ins> ParentStdout, ParentStderr, #[allow(dead_code)] // This variant exists only for the Debug impl InheritFile(File), </ins> } impl Command { <del> pub fn new(_program: &OsStr) -> Command { Command { env: Default::default() } </del> <ins> pub fn new(program: &OsStr) -> Command { Command { program: program.to_owned(), args: vec![program.to_owned()], env: Default::default(), cwd: None, stdin: None, stdout: None, stderr: None, } </ins> } <del> pub fn arg(&mut self, _arg: &OsStr) {} </del> <ins> pub fn arg(&mut self, arg: &OsStr) { self.args.push(arg.to_owned()); } </ins> pub fn env_mut(&mut self) -> &mut CommandEnv { &mut self.env } <del> pub fn cwd(&mut self, _dir: &OsStr) {} </del> <ins> pub fn cwd(&mut self, dir: &OsStr) { self.cwd = Some(dir.to_owned()); } </ins> <del> pub fn stdin(&mut self, _stdin: Stdio) {} </del> <ins> pub fn stdin(&mut self, stdin: Stdio) { self.stdin = Some(stdin); } </ins> <del> pub fn stdout(&mut self, _stdout: Stdio) {} </del> <ins> pub fn stdout(&mut self, stdout: Stdio) { self.stdout = Some(stdout); } </ins> <del> pub fn stderr(&mut self, _stderr: Stdio) {} </del> <ins> pub fn stderr(&mut self, stderr: Stdio) { self.stderr = Some(stderr); } </ins> pub fn get_program(&self) -> &OsStr { <del> panic!("unsupported") </del> <ins> &self.program </ins> } pub fn get_args(&self) -> CommandArgs<'_> { <del> CommandArgs { _p: PhantomData } </del> <ins> let mut iter = self.args.iter(); iter.next(); CommandArgs { iter } </ins> } pub fn get_envs(&self) -> CommandEnvs<'_> {
impl From<io::Stdout> for Stdio { fn from(_: io::Stdout) -> Stdio { <del> // FIXME: This is wrong. // Instead, the Stdio we have here should be a unit struct. panic!("unsupported") </del> <ins> Stdio::ParentStdout </ins> } } impl From<io::Stderr> for Stdio { fn from(_: io::Stderr) -> Stdio { <del> // FIXME: This is wrong. // Instead, the Stdio we have here should be a unit struct. panic!("unsupported") </del> <ins> Stdio::ParentStderr </ins> } } impl From<File> for Stdio { <del> fn from(_file: File) -> Stdio { // FIXME: This is wrong. // Instead, the Stdio we have here should be a unit struct. panic!("unsupported") </del> <ins> fn from(file: File) -> Stdio { Stdio::InheritFile(file) </ins> } } impl fmt::Debug for Command { <del> fn fmt(&self, _f: &mut fmt::Formatter<'_>) -> fmt::Result { Ok(()) </del> <ins> // show all attributes fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { if f.alternate() { let mut debug_command = f.debug_struct("Command"); debug_command.field("program", &self.program).field("args", &self.args); if !self.env.is_unchanged() { debug_command.field("env", &self.env); } if self.cwd.is_some() { debug_command.field("cwd", &self.cwd); } if self.stdin.is_some() { debug_command.field("stdin", &self.stdin); } if self.stdout.is_some() { debug_command.field("stdout", &self.stdout); } if self.stderr.is_some() { debug_command.field("stderr", &self.stderr); } debug_command.finish() } else { if let Some(ref cwd) = self.cwd { write!(f, "cd {cwd:?} && ")?; } if self.env.does_clear() { write!(f, "env -i ")?; // Altered env vars will be printed next, that should exactly work as expected. } else { // Removed env vars need the command to be wrapped in `env`. let mut any_removed = false; for (key, value_opt) in self.get_envs() { if value_opt.is_none() { if !any_removed { write!(f, "env ")?; any_removed = true; } write!(f, "-u {} ", key.to_string_lossy())?; } } } // Altered env vars can just be added in front of the program. for (key, value_opt) in self.get_envs() { if let Some(value) = value_opt { write!(f, "{}={value:?} ", key.to_string_lossy())?; } } if self.program != self.args[0] { write!(f, "[{:?}] ", self.program)?; } write!(f, "{:?}", self.args[0])?; for arg in &self.args[1..] { write!(f, " {:?}", arg)?; } Ok(()) } </ins> } }
} pub struct CommandArgs<'a> { <del> _p: PhantomData<&'a ()>, </del> <ins> iter: crate::slice::Iter<'a, OsString>, </ins> } impl<'a> Iterator for CommandArgs<'a> { type Item = &'a OsStr; fn next(&mut self) -> Option<&'a OsStr> { <del> None </del> <ins> self.iter.next().map(|os| &**os) </ins> } fn size_hint(&self) -> (usize, Option<usize>) { <del> (0, Some(0)) </del> <ins> self.iter.size_hint() </ins> } } <del> impl<'a> ExactSizeIterator for CommandArgs<'a> {} </del> <ins> impl<'a> ExactSizeIterator for CommandArgs<'a> { fn len(&self) -> usize { self.iter.len() } fn is_empty(&self) -> bool { self.iter.is_empty() } } </ins> impl<'a> fmt::Debug for CommandArgs<'a> { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { <del> f.debug_list().finish() </del> <ins> f.debug_list().entries(self.iter.clone()).finish() </ins> } }
rustup toolchain install --profile minimal nightly-${TOOLCHAIN} # Sanity check to see if the nightly exists echo nightly-${TOOLCHAIN} > rust-toolchain <del> echo "=> Uninstalling all old nighlies" </del> <ins> echo "=> Uninstalling all old nightlies" </ins> for nightly in $(rustup toolchain list | grep nightly | grep -v $TOOLCHAIN | grep -v nightly-x86_64); do rustup toolchain uninstall $nightly done
} fn check_expr(&mut self, cx: &Context, e: &ast::Expr) { <ins> // if the expression was produced by a macro expansion, if e.span.expn_info.is_some() { return } </ins> let id = match e.node { ast::ExprPath(..) | ast::ExprStruct(..) => { match cx.tcx.def_map.borrow().find(&e.id) {
// aux-build:lint_stability.rs // aux-build:inherited_stability.rs <del> #![feature(globs)] </del> <ins> #![feature(globs, phase)] </ins> #![deny(unstable)] #![deny(deprecated)] #![deny(experimental)] #![allow(dead_code)] mod cross_crate { <ins> #[phase(plugin, link)] </ins> extern crate lint_stability; use self::lint_stability::*;
let _ = StableTupleStruct (1); let _ = FrozenTupleStruct (1); let _ = LockedTupleStruct (1); <ins> // At the moment, the following just checks that the stability // level of expanded code does not trigger the // lint. Eventually, we will want to lint the contents of the // macro in the module *defining* it. Also, stability levels // on macros themselves are not yet linted. macro_test!(); </ins> } fn test_method_param<F: Trait>(foo: F) {
**Source:** https://github.com/rust-lang/rust-analyzer/blob/master/crates/rust-analyzer/src/config.rs[config.rs] <del> The <<_installation,Installation>> section contains details on configuration for some of the editors. </del> <ins> The <<installation,Installation>> section contains details on configuration for some of the editors. </ins> In general `rust-analyzer` is configured via LSP messages, which means that it's up to the editor to decide on the exact format and location of configuration files. Some clients, such as <<vs-code,VS Code>> or <<coc-rust-analyzer,COC plugin in Vim>> provide `rust-analyzer` specific configuration UIs. Others may require you to know a bit more about the interaction with `rust-analyzer`.
return v; } pub fn bt_push(&mut self, ei: ExpnInfo) { <ins> self.recursion_count += 1; if self.recursion_count > self.ecfg.recursion_limit { self.span_fatal(ei.call_site, format!("Recursion limit reached while expanding the macro `{}`", ei.callee.name).as_slice()); } </ins> let mut call_site = ei.call_site; call_site.expn_id = self.backtrace; self.backtrace = self.codemap().record_expansion(ExpnInfo {
match self.backtrace { NO_EXPANSION => self.bug("tried to pop without a push"), expn_id => { <ins> self.recursion_count -= 1; </ins> self.backtrace = self.codemap().with_expn_info(expn_id, |expn_info| { expn_info.map_or(NO_EXPANSION, |ei| ei.call_site.expn_id) });
<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. #![feature(macro_rules)] macro_rules! recursive( () => ( recursive!() //~ ERROR Recursion limit reached while expanding the macro `recursive` ) ) fn main() { recursive!() } </ins>
)); try!(self.pclose()); } <ins> try!(self.print_where_clause(generics)); </ins> try!(word(&mut self.s, ";")); try!(self.end()); self.end() // close the outer-box } else { <ins> try!(self.print_where_clause(generics)); </ins> try!(self.nbsp()); try!(self.bopen()); try!(self.hardbreak_if_not_bol());
<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. struct Baz<U> where U: Eq(U); //This is parsed as the new Fn* style parenthesis syntax. struct Baz<U> where U: Eq(U) -> R; // Notice this parses as well. struct Baz<U>(U) where U: Eq; // This rightfully signals no error as well. struct Foo<T> where T: Copy, (T); //~ ERROR unexpected token in `where` clause struct Bar<T> { x: T } where T: Copy //~ ERROR expected item, found `where` fn main() {} </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. struct Foo<T> where T: Copy; struct Bar<T>(T) where T: Copy; struct Bleh<T, U>(T, U) where T: Copy, U: Sized; struct Baz<T> where T: Copy { field: T } fn main() {} </ins>