From 7cdcdb5dc0b282d5926f0edd7f05b13fbf239197 Mon Sep 17 00:00:00 2001 From: king6cong Date: Wed, 2 Jan 2019 15:18:13 +0800 Subject: [PATCH 01/14] Update reference of rlibc crate to compiler-builtins crate --- src/libcore/lib.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libcore/lib.rs b/src/libcore/lib.rs index b2cafc4cede2e..c94f0ab03014d 100644 --- a/src/libcore/lib.rs +++ b/src/libcore/lib.rs @@ -24,7 +24,7 @@ //! often generated by LLVM. Additionally, this library can make explicit //! calls to these functions. Their signatures are the same as found in C. //! These functions are often provided by the system libc, but can also be -//! provided by the [rlibc crate](https://crates.io/crates/rlibc). +//! provided by the [compiler-builtins crate](https://crates.io/crates/compiler_builtins). //! //! * `rust_begin_panic` - This function takes four arguments, a //! `fmt::Arguments`, a `&'static str`, and two `u32`'s. These four arguments From 5581207182d69a03f09d48c38e279cd7b99e422b Mon Sep 17 00:00:00 2001 From: king6cong Date: Wed, 9 Jan 2019 19:42:25 +0800 Subject: [PATCH 02/14] Remove outdated comment --- config.toml.example | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config.toml.example b/config.toml.example index c68d358b6a67e..23943d34b7ca8 100644 --- a/config.toml.example +++ b/config.toml.example @@ -288,7 +288,7 @@ #codegen-units-std = 1 # Whether or not debug assertions are enabled for the compiler and standard -# library. Also enables compilation of debug! and trace! logging macros. +# library. #debug-assertions = false # Whether or not debuginfo is emitted From 87f5a98a5d8f29d1a631cd06a39863a1e494b4d7 Mon Sep 17 00:00:00 2001 From: Jakub Onderka Date: Fri, 18 Jan 2019 19:08:31 +0100 Subject: [PATCH 03/14] Use `to_ne_bytes` for converting IPv4Address to octets It is easier and it should be also faster, because `to_ne_bytes` just calls `mem::transmute`. --- src/libstd/net/ip.rs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/libstd/net/ip.rs b/src/libstd/net/ip.rs index f98113e0896f7..29f635919cb90 100644 --- a/src/libstd/net/ip.rs +++ b/src/libstd/net/ip.rs @@ -393,8 +393,7 @@ impl Ipv4Addr { /// ``` #[stable(feature = "rust1", since = "1.0.0")] pub fn octets(&self) -> [u8; 4] { - let bits = u32::from_be(self.inner.s_addr); - [(bits >> 24) as u8, (bits >> 16) as u8, (bits >> 8) as u8, bits as u8] + self.inner.s_addr.to_ne_bytes() } /// Returns [`true`] for the special 'unspecified' address (0.0.0.0). From b4d3c87ebc32ed4b96dc64cc9b45758e356df17a Mon Sep 17 00:00:00 2001 From: Simon Heath Date: Sat, 26 Jan 2019 16:46:15 -0500 Subject: [PATCH 04/14] Tiny improvement to docs for `core::convert`. This is not really significant, accept or reject as you wish. I just want to make sure I understand how the PR process works and I'm doing it right before doing a bigger one for #33417. --- src/libcore/convert.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/libcore/convert.rs b/src/libcore/convert.rs index 203be541e492f..d4a1d15e4e7e1 100644 --- a/src/libcore/convert.rs +++ b/src/libcore/convert.rs @@ -17,7 +17,10 @@ //! [`TryFrom`][`TryFrom`] rather than [`Into`][`Into`] or [`TryInto`][`TryInto`], //! as [`From`] and [`TryFrom`] provide greater flexibility and offer //! equivalent [`Into`] or [`TryInto`] implementations for free, thanks to a -//! blanket implementation in the standard library. +//! blanket implementation in the standard library. However, there are some cases +//! where this is not possible, such as creating conversions into a type defined +//! outside your library, so implementing [`Into`] instead of [`From`] is +//! sometimes necessary. //! //! # Generic Implementations //! From 4deb5959a3a2cbc189e26cb4b0c59a6707a10b45 Mon Sep 17 00:00:00 2001 From: Andy Russell Date: Tue, 5 Feb 2019 10:12:43 -0500 Subject: [PATCH 05/14] display sugared return types for async functions --- src/librustdoc/clean/mod.rs | 39 +++++++++++++++++++++++++++++++++++ src/librustdoc/html/format.rs | 23 ++++++++++++++------- src/librustdoc/html/render.rs | 8 ++++--- src/test/rustdoc/async-fn.rs | 35 ++++++++++++++++++++++++------- 4 files changed, 88 insertions(+), 17 deletions(-) diff --git a/src/librustdoc/clean/mod.rs b/src/librustdoc/clean/mod.rs index 6eea95b61c990..9ef723db40833 100644 --- a/src/librustdoc/clean/mod.rs +++ b/src/librustdoc/clean/mod.rs @@ -1707,6 +1707,30 @@ impl FnDecl { pub fn self_type(&self) -> Option { self.inputs.values.get(0).and_then(|v| v.to_self()) } + + /// Returns the sugared return type for an async function. + /// + /// For example, if the return type is `impl std::future::Future`, this function + /// will return `i32`. + /// + /// # Panics + /// + /// This function will panic if the return type does not match the expected sugaring for async + /// functions. + pub fn sugared_async_return_type(&self) -> FunctionRetTy { + match &self.output { + FunctionRetTy::Return(Type::ImplTrait(bounds)) => { + match &bounds[0] { + GenericBound::TraitBound(PolyTrait { trait_, .. }, ..) => { + let bindings = trait_.bindings().unwrap(); + FunctionRetTy::Return(bindings[0].ty.clone()) + } + _ => panic!("unexpected desugaring of async function"), + } + } + _ => panic!("unexpected desugaring of async function"), + } + } } #[derive(Clone, RustcEncodable, RustcDecodable, PartialEq, Eq, Debug, Hash)] @@ -2265,6 +2289,21 @@ impl Type { _ => None, } } + + pub fn bindings(&self) -> Option<&[TypeBinding]> { + match *self { + ResolvedPath { ref path, .. } => { + path.segments.last().and_then(|seg| { + if let GenericArgs::AngleBracketed { ref bindings, .. } = seg.args { + Some(&**bindings) + } else { + None + } + }) + } + _ => None + } + } } impl GetDefId for Type { diff --git a/src/librustdoc/html/format.rs b/src/librustdoc/html/format.rs index 5a3e6984859a2..c03e679bc5194 100644 --- a/src/librustdoc/html/format.rs +++ b/src/librustdoc/html/format.rs @@ -5,6 +5,7 @@ //! assume that HTML output is desired, although it may be possible to redesign //! them in the future to instead emit any format desired. +use std::borrow::Cow; use std::fmt; use rustc::hir::def_id::DefId; @@ -44,14 +45,16 @@ pub struct GenericBounds<'a>(pub &'a [clean::GenericBound]); pub struct CommaSep<'a, T: 'a>(pub &'a [T]); pub struct AbiSpace(pub Abi); -/// Wrapper struct for properly emitting a method declaration. -pub struct Method<'a> { +/// Wrapper struct for properly emitting a function or method declaration. +pub struct Function<'a> { /// The declaration to emit. pub decl: &'a clean::FnDecl, /// The length of the function's "name", used to determine line-wrapping. pub name_len: usize, /// The number of spaces to indent each successive line with, if line-wrapping is necessary. pub indent: usize, + /// Whether the function is async or not. + pub asyncness: hir::IsAsync, } /// Wrapper struct for emitting a where clause from Generics. @@ -829,9 +832,9 @@ impl fmt::Display for clean::FnDecl { } } -impl<'a> fmt::Display for Method<'a> { +impl<'a> fmt::Display for Function<'a> { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - let &Method { decl, name_len, indent } = self; + let &Function { decl, name_len, indent, asyncness } = self; let amp = if f.alternate() { "&" } else { "&" }; let mut args = String::new(); let mut args_plain = String::new(); @@ -891,11 +894,17 @@ impl<'a> fmt::Display for Method<'a> { args_plain.push_str(", ..."); } - let arrow_plain = format!("{:#}", decl.output); + let output = if let hir::IsAsync::Async = asyncness { + Cow::Owned(decl.sugared_async_return_type()) + } else { + Cow::Borrowed(&decl.output) + }; + + let arrow_plain = format!("{:#}", &output); let arrow = if f.alternate() { - format!("{:#}", decl.output) + format!("{:#}", &output) } else { - decl.output.to_string() + output.to_string() }; let pad = " ".repeat(name_len); diff --git a/src/librustdoc/html/render.rs b/src/librustdoc/html/render.rs index 86fb51419c270..c8bda66d84170 100644 --- a/src/librustdoc/html/render.rs +++ b/src/librustdoc/html/render.rs @@ -62,7 +62,7 @@ use fold::DocFolder; use html::escape::Escape; use html::format::{AsyncSpace, ConstnessSpace}; use html::format::{GenericBounds, WhereClause, href, AbiSpace}; -use html::format::{VisSpace, Method, UnsafetySpace, MutableSpace}; +use html::format::{VisSpace, Function, UnsafetySpace, MutableSpace}; use html::format::fmt_impl_for_trait_page; use html::item_type::ItemType; use html::markdown::{self, Markdown, MarkdownHtml, MarkdownSummaryLine, ErrorCodes, IdMap}; @@ -2963,10 +2963,11 @@ fn item_function(w: &mut fmt::Formatter, cx: &Context, it: &clean::Item, name = it.name.as_ref().unwrap(), generics = f.generics, where_clause = WhereClause { gens: &f.generics, indent: 0, end_newline: true }, - decl = Method { + decl = Function { decl: &f.decl, name_len, indent: 0, + asyncness: f.header.asyncness, })?; document(w, cx, it) } @@ -3410,10 +3411,11 @@ fn render_assoc_item(w: &mut fmt::Formatter, href = href, name = name, generics = *g, - decl = Method { + decl = Function { decl: d, name_len: head_len, indent, + asyncness: header.asyncness, }, where_clause = WhereClause { gens: g, diff --git a/src/test/rustdoc/async-fn.rs b/src/test/rustdoc/async-fn.rs index a0b6c29126092..ba4997a7f9b5b 100644 --- a/src/test/rustdoc/async-fn.rs +++ b/src/test/rustdoc/async-fn.rs @@ -1,14 +1,35 @@ // edition:2018 -// compile-flags:-Z unstable-options - -// FIXME: once `--edition` is stable in rustdoc, remove that `compile-flags` directive #![feature(async_await, futures_api)] -// @has async_fn/struct.S.html -// @has - '//code' 'pub async fn f()' -pub struct S; +// @has async_fn/fn.foo.html '//pre[@class="rust fn"]' 'pub async fn foo() -> Option' +pub async fn foo() -> Option { + None +} + +// @has async_fn/fn.bar.html '//pre[@class="rust fn"]' 'pub async fn bar(a: i32, b: i32) -> i32' +pub async fn bar(a: i32, b: i32) -> i32 { + 0 +} + +// @has async_fn/fn.baz.html '//pre[@class="rust fn"]' 'pub async fn baz(a: T) -> T' +pub async fn baz(a: T) -> T { + a +} + +trait Bar {} + +impl Bar for () {} + +// @has async_fn/fn.quux.html '//pre[@class="rust fn"]' 'pub async fn quux() -> impl Bar' +pub async fn quux() -> impl Bar { + () +} + +// @has async_fn/struct.Foo.html +// @matches - '//code' 'pub async fn f\(\)$' +pub struct Foo; -impl S { +impl Foo { pub async fn f() {} } From 1d05f81d19084be01a172205b091bbfe4dd4e5fa Mon Sep 17 00:00:00 2001 From: Taiki Endo Date: Thu, 7 Feb 2019 19:44:06 +0900 Subject: [PATCH 06/14] Add #[must_use] message to Fn* traits --- src/libcore/ops/function.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/libcore/ops/function.rs b/src/libcore/ops/function.rs index 3a1d765f7b816..c69f5fd989696 100644 --- a/src/libcore/ops/function.rs +++ b/src/libcore/ops/function.rs @@ -62,7 +62,7 @@ label="expected an `Fn<{Args}>` closure, found `{Self}`", )] #[fundamental] // so that regex can rely that `&str: !FnMut` -#[must_use] +#[must_use = "closures are lazy and do nothing unless called"] pub trait Fn : FnMut { /// Performs the call operation. #[unstable(feature = "fn_traits", issue = "29625")] @@ -141,7 +141,7 @@ pub trait Fn : FnMut { label="expected an `FnMut<{Args}>` closure, found `{Self}`", )] #[fundamental] // so that regex can rely that `&str: !FnMut` -#[must_use] +#[must_use = "closures are lazy and do nothing unless called"] pub trait FnMut : FnOnce { /// Performs the call operation. #[unstable(feature = "fn_traits", issue = "29625")] @@ -220,7 +220,7 @@ pub trait FnMut : FnOnce { label="expected an `FnOnce<{Args}>` closure, found `{Self}`", )] #[fundamental] // so that regex can rely that `&str: !FnMut` -#[must_use] +#[must_use = "closures are lazy and do nothing unless called"] pub trait FnOnce { /// The returned type after the call operator is used. #[stable(feature = "fn_once_output", since = "1.12.0")] From 541503afa13a4ea8596755e0e88e6dd13a95faa5 Mon Sep 17 00:00:00 2001 From: Ralf Jung Date: Fri, 8 Feb 2019 11:41:01 +0100 Subject: [PATCH 07/14] std::sys::unix::stdio: explain why we do into_raw --- src/libstd/sys/unix/stdio.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/libstd/sys/unix/stdio.rs b/src/libstd/sys/unix/stdio.rs index 8a6b7b5f876ff..715f2eafb2d9b 100644 --- a/src/libstd/sys/unix/stdio.rs +++ b/src/libstd/sys/unix/stdio.rs @@ -12,7 +12,7 @@ impl Stdin { pub fn read(&self, data: &mut [u8]) -> io::Result { let fd = FileDesc::new(libc::STDIN_FILENO); let ret = fd.read(data); - fd.into_raw(); + fd.into_raw(); // do not close this FD ret } } @@ -23,7 +23,7 @@ impl Stdout { pub fn write(&self, data: &[u8]) -> io::Result { let fd = FileDesc::new(libc::STDOUT_FILENO); let ret = fd.write(data); - fd.into_raw(); + fd.into_raw(); // do not close this FD ret } @@ -38,7 +38,7 @@ impl Stderr { pub fn write(&self, data: &[u8]) -> io::Result { let fd = FileDesc::new(libc::STDERR_FILENO); let ret = fd.write(data); - fd.into_raw(); + fd.into_raw(); // do not close this FD ret } From b962ecc6f97cbd6258d1a77041a865aecd6fa3fb Mon Sep 17 00:00:00 2001 From: Guillaume Gomez Date: Fri, 8 Feb 2019 12:38:47 +0100 Subject: [PATCH 08/14] Cleanup JS a bit --- src/librustdoc/html/static/main.js | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/src/librustdoc/html/static/main.js b/src/librustdoc/html/static/main.js index d6c05de0df6f2..3a59d1f259654 100644 --- a/src/librustdoc/html/static/main.js +++ b/src/librustdoc/html/static/main.js @@ -79,8 +79,6 @@ if (!DOMTokenList.prototype.remove) { // 2 for "In Return Types" var currentTab = 0; - var themesWidth = null; - var titleBeforeSearch = document.title; function getPageId() { @@ -240,7 +238,7 @@ if (!DOMTokenList.prototype.remove) { return String.fromCharCode(c); } - function displayHelp(display, ev) { + function displayHelp(display, ev, help) { if (display === true) { if (hasClass(help, "hidden")) { ev.preventDefault(); @@ -258,7 +256,7 @@ if (!DOMTokenList.prototype.remove) { hideModal(); var search = document.getElementById("search"); if (hasClass(help, "hidden") === false) { - displayHelp(false, ev); + displayHelp(false, ev, help); } else if (hasClass(search, "hidden") === false) { ev.preventDefault(); addClass(search, "hidden"); @@ -289,7 +287,7 @@ if (!DOMTokenList.prototype.remove) { case "s": case "S": - displayHelp(false, ev); + displayHelp(false, ev, help); hideModal(); ev.preventDefault(); focusSearchBar(); @@ -304,7 +302,7 @@ if (!DOMTokenList.prototype.remove) { case "?": if (ev.shiftKey) { hideModal(); - displayHelp(true, ev); + displayHelp(true, ev, help); } break; } @@ -654,7 +652,7 @@ if (!DOMTokenList.prototype.remove) { return MAX_LEV_DISTANCE + 1; } } - return lev_distance;//Math.ceil(total / done); + return Math.ceil(total / done); } } return MAX_LEV_DISTANCE + 1; @@ -2432,7 +2430,7 @@ if (!DOMTokenList.prototype.remove) { // for vertical layout (column-oriented flex layout for divs caused // errors in mobile browsers). if (e.tagName === "H2" || e.tagName === "H3") { - let nextTagName = e.nextElementSibling.tagName; + var nextTagName = e.nextElementSibling.tagName; if (nextTagName == "H2" || nextTagName == "H3") { e.nextElementSibling.style.display = "flex"; } else { From 66adf52e7dfd68f04e60744ea9bf130c45befe5e Mon Sep 17 00:00:00 2001 From: Ralf Jung Date: Sat, 9 Feb 2019 15:44:54 +0100 Subject: [PATCH 09/14] miri: give non-generic functions a stable address --- src/librustc/mir/interpret/mod.rs | 31 +++++++++++++++++++++++-------- 1 file changed, 23 insertions(+), 8 deletions(-) diff --git a/src/librustc/mir/interpret/mod.rs b/src/librustc/mir/interpret/mod.rs index efd233f1f3854..bb25d1b42095a 100644 --- a/src/librustc/mir/interpret/mod.rs +++ b/src/librustc/mir/interpret/mod.rs @@ -27,7 +27,7 @@ pub use self::pointer::{Pointer, PointerArithmetic}; use std::fmt; use crate::mir; use crate::hir::def_id::DefId; -use crate::ty::{self, TyCtxt, Instance}; +use crate::ty::{self, TyCtxt, Instance, subst::UnpackedKind}; use crate::ty::layout::{self, Size}; use std::io; use crate::rustc_serialize::{Encoder, Decodable, Encodable}; @@ -318,14 +318,29 @@ impl<'tcx> AllocMap<'tcx> { id } - /// Functions cannot be identified by pointers, as asm-equal functions can get deduplicated - /// by the linker and functions can be duplicated across crates. - /// We thus generate a new `AllocId` for every mention of a function. This means that - /// `main as fn() == main as fn()` is false, while `let x = main as fn(); x == x` is true. pub fn create_fn_alloc(&mut self, instance: Instance<'tcx>) -> AllocId { - let id = self.reserve(); - self.id_to_kind.insert(id, AllocKind::Function(instance)); - id + // Functions cannot be identified by pointers, as asm-equal functions can get deduplicated + // by the linker (we set the "unnamed_addr" attribute for LLVM) and functions can be + // duplicated across crates. + // We thus generate a new `AllocId` for every mention of a function. This means that + // `main as fn() == main as fn()` is false, while `let x = main as fn(); x == x` is true. + // However, formatting code relies on function identity (see #58320), so we only do + // this for generic functions. Lifetime parameters are ignored. + let is_generic = instance.substs.into_iter().any(|kind| { + match kind.unpack() { + UnpackedKind::Lifetime(_) => false, + _ => true, + } + }); + if is_generic { + // Get a fresh ID + let id = self.reserve(); + self.id_to_kind.insert(id, AllocKind::Function(instance)); + id + } else { + // Deduplicate + self.intern(AllocKind::Function(instance)) + } } /// Returns `None` in case the `AllocId` is dangling. An `EvalContext` can still have a From a01efbcbec2123429a7eaa73ce1c9198007af7cf Mon Sep 17 00:00:00 2001 From: Ralf Jung Date: Sat, 9 Feb 2019 19:58:41 +0100 Subject: [PATCH 10/14] operand-to-place copies should never be overlapping --- src/librustc_mir/interpret/place.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/librustc_mir/interpret/place.rs b/src/librustc_mir/interpret/place.rs index 9ca7f9d8e27ff..3d6fcae0cab8c 100644 --- a/src/librustc_mir/interpret/place.rs +++ b/src/librustc_mir/interpret/place.rs @@ -823,6 +823,8 @@ where let src = match self.try_read_immediate(src)? { Ok(src_val) => { // Yay, we got a value that we can write directly. + // FIXME: Add a check to make sure that if `src` is indirect, + // it does not overlap with `dest`. return self.write_immediate_no_validate(src_val, dest); } Err(mplace) => mplace, @@ -836,7 +838,8 @@ where self.memory.copy( src_ptr, src_align, dest_ptr, dest_align, - dest.layout.size, false + dest.layout.size, + /*nonoverlapping*/ true, )?; Ok(()) From 3a3691f1878bf3727585c982526c9db5a79c746c Mon Sep 17 00:00:00 2001 From: Ralf Jung Date: Sun, 10 Feb 2019 12:58:08 +0100 Subject: [PATCH 11/14] when there are multiple filenames, print what got interpreted as 2nd filename --- src/librustc_driver/lib.rs | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/librustc_driver/lib.rs b/src/librustc_driver/lib.rs index a95ce810ffaeb..fe02dd27072f7 100644 --- a/src/librustc_driver/lib.rs +++ b/src/librustc_driver/lib.rs @@ -839,7 +839,15 @@ impl<'a> CompilerCalls<'a> for RustcDefaultCalls { early_error(sopts.error_format, "no input filename given"); } 1 => panic!("make_input should have provided valid inputs"), - _ => early_error(sopts.error_format, "multiple input filenames provided"), + _ => + early_error( + sopts.error_format, + &format!( + "multiple input filenames provided (first two filenames are `{}` and `{}`)", + matches.free[0], + matches.free[1], + ), + ) } } From adb33008f703320727d5022640e9a09cdc4fa8a6 Mon Sep 17 00:00:00 2001 From: Ralf Jung Date: Sun, 10 Feb 2019 13:05:37 +0100 Subject: [PATCH 12/14] rpath computation: explain why we pop() --- src/librustc_codegen_llvm/back/rpath.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/librustc_codegen_llvm/back/rpath.rs b/src/librustc_codegen_llvm/back/rpath.rs index aeff23dec41bb..a5c828e089f39 100644 --- a/src/librustc_codegen_llvm/back/rpath.rs +++ b/src/librustc_codegen_llvm/back/rpath.rs @@ -101,9 +101,9 @@ fn get_rpath_relative_to_output(config: &mut RPathConfig, lib: &Path) -> String let cwd = env::current_dir().unwrap(); let mut lib = fs::canonicalize(&cwd.join(lib)).unwrap_or_else(|_| cwd.join(lib)); - lib.pop(); + lib.pop(); // strip filename let mut output = cwd.join(&config.out_filename); - output.pop(); + output.pop(); // strip filename let output = fs::canonicalize(&output).unwrap_or(output); let relative = path_relative_from(&lib, &output).unwrap_or_else(|| panic!("couldn't create relative path from {:?} to {:?}", output, lib)); From 55f90c77e8eeb114e1bbbb7d7cc536d050c3786b Mon Sep 17 00:00:00 2001 From: Vadim Petrochenkov Date: Sun, 10 Feb 2019 16:21:47 +0300 Subject: [PATCH 13/14] Fix failing tidy (line endings on Windows) --- src/doc/embedded-book | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/doc/embedded-book b/src/doc/embedded-book index d663113d1d9fb..bd2778f304989 160000 --- a/src/doc/embedded-book +++ b/src/doc/embedded-book @@ -1 +1 @@ -Subproject commit d663113d1d9fbd35f1145c29f6080a6350b7f419 +Subproject commit bd2778f304989ee52be8201504d6ec621dd60ca9 From eaf81c2e3ef174c0e257e010e8ee833772c9ec05 Mon Sep 17 00:00:00 2001 From: Ralf Jung Date: Sun, 10 Feb 2019 15:16:25 +0100 Subject: [PATCH 14/14] miri value visitor: use in macro --- src/librustc_mir/interpret/visitor.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/librustc_mir/interpret/visitor.rs b/src/librustc_mir/interpret/visitor.rs index 930bcb44374aa..4ff5cde08d086 100644 --- a/src/librustc_mir/interpret/visitor.rs +++ b/src/librustc_mir/interpret/visitor.rs @@ -125,14 +125,14 @@ impl<'a, 'mir, 'tcx, M: Machine<'a, 'mir, 'tcx>> Value<'a, 'mir, 'tcx, M> } macro_rules! make_value_visitor { - ($visitor_trait_name:ident, $($mutability:ident)*) => { + ($visitor_trait_name:ident, $($mutability:ident)?) => { // How to traverse a value and what to do when we are at the leaves. pub trait $visitor_trait_name<'a, 'mir, 'tcx: 'mir+'a, M: Machine<'a, 'mir, 'tcx>>: Sized { type V: Value<'a, 'mir, 'tcx, M>; /// The visitor must have an `EvalContext` in it. - fn ecx(&$($mutability)* self) - -> &$($mutability)* EvalContext<'a, 'mir, 'tcx, M>; + fn ecx(&$($mutability)? self) + -> &$($mutability)? EvalContext<'a, 'mir, 'tcx, M>; // Recursive actions, ready to be overloaded. /// Visit the given value, dispatching as appropriate to more specialized visitors.