From 9fcc61bf9f2148ede0e97537f4b1ecc80e675f09 Mon Sep 17 00:00:00 2001 From: Benjamin Sago Date: Tue, 29 May 2018 11:31:14 +0200 Subject: [PATCH 1/7] Mention spec and indented blocks in doctest docs MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This commit adds a new section to the Documentation Test docs, which briefly mentions indented code blocks, and links to the CommonMark specification for both. I’m not sure about saying "fenced code blocks the more popular choice in the Rust community” because it seems like I’m speaking for everyone, but I can’t think of a better way to phrase it! --- src/doc/rustdoc/src/documentation-tests.md | 24 ++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/src/doc/rustdoc/src/documentation-tests.md b/src/doc/rustdoc/src/documentation-tests.md index fd7d1713ca574..61cfebb97e74c 100644 --- a/src/doc/rustdoc/src/documentation-tests.md +++ b/src/doc/rustdoc/src/documentation-tests.md @@ -284,3 +284,27 @@ environment that has no network access. compiles, then the test will fail. However please note that code failing with the current Rust release may work in a future release, as new features are added. + +## Syntax reference + +The *exact* syntax for code blocks, including the edge cases, can be found +in the [Fenced Code Blocks](https://spec.commonmark.org/0.28/#fenced-code-blocks) +section of the CommonMark specification. + +Rustdoc also accepts *indented* code blocks as an alternative to fenced +code blocks: instead of surrounding your code with three backticks, you +can indent each line by four or more spaces. + +``````markdown + let foo = "foo"; + assert_eq!(foo, "foo"); +`````` + +These, too, are documented in the CommonMark specification, in the +[Indented Code Blocks](https://spec.commonmark.org/0.28/#indented-code-blocks) +section. + +However, it's preferable to use fenced code blocks over indented code blocks. +Not only are fenced code blocks the more popular choice in the Rust community, +but there is no way to use directives such as `ignore` or `should_panic` with +indented code blocks. From 8f8a7b9a7b236ba02afc1589901acc6b125d6fec Mon Sep 17 00:00:00 2001 From: Benjamin Sago Date: Tue, 29 May 2018 16:04:37 +0200 Subject: [PATCH 2/7] Phrasing tweak in doctest docs --- src/doc/rustdoc/src/documentation-tests.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/doc/rustdoc/src/documentation-tests.md b/src/doc/rustdoc/src/documentation-tests.md index 61cfebb97e74c..3253e4d6269d4 100644 --- a/src/doc/rustdoc/src/documentation-tests.md +++ b/src/doc/rustdoc/src/documentation-tests.md @@ -305,6 +305,6 @@ These, too, are documented in the CommonMark specification, in the section. However, it's preferable to use fenced code blocks over indented code blocks. -Not only are fenced code blocks the more popular choice in the Rust community, +Not only are fenced code blocks considered more idiomatic for Rust code, but there is no way to use directives such as `ignore` or `should_panic` with indented code blocks. From cafe9d0ed404e940a1f039e25053f11f47e88973 Mon Sep 17 00:00:00 2001 From: Seiichi Uchida Date: Tue, 19 Jun 2018 14:04:16 +0900 Subject: [PATCH 3/7] Do not consume semicolon twice while parsing local statement --- src/libsyntax/parse/parser.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libsyntax/parse/parser.rs b/src/libsyntax/parse/parser.rs index 530094e22f243..3500deedde93f 100644 --- a/src/libsyntax/parse/parser.rs +++ b/src/libsyntax/parse/parser.rs @@ -4700,7 +4700,7 @@ impl<'a> Parser<'a> { if macro_legacy_warnings && self.token != token::Semi { self.warn_missing_semicolon(); } else { - self.expect_one_of(&[token::Semi], &[])?; + self.expect_one_of(&[], &[token::Semi])?; } } _ => {} From 03a40b31a74d62923ab616bb64e24c7f90ef3daf Mon Sep 17 00:00:00 2001 From: Adam Barth Date: Tue, 19 Jun 2018 09:46:51 -0700 Subject: [PATCH 4/7] Update zx_cprng_draw_new on Fuchsia Fuchsia is changing the semantics for zx_cprng_draw and zx_cprng_draw_new is a temporary name for the new semantics. --- src/libstd/sys/unix/rand.rs | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/libstd/sys/unix/rand.rs b/src/libstd/sys/unix/rand.rs index caa1894576552..3f7f067149084 100644 --- a/src/libstd/sys/unix/rand.rs +++ b/src/libstd/sys/unix/rand.rs @@ -183,15 +183,14 @@ mod imp { mod imp { #[link(name = "zircon")] extern { - fn zx_cprng_draw(buffer: *mut u8, len: usize, actual: *mut usize) -> i32; + fn zx_cprng_draw_new(buffer: *mut u8, len: usize) -> i32; } fn getrandom(buf: &mut [u8]) -> Result { unsafe { - let mut actual = 0; - let status = zx_cprng_draw(buf.as_mut_ptr(), buf.len(), &mut actual); + let status = zx_cprng_draw_new(buf.as_mut_ptr(), buf.len()); if status == 0 { - Ok(actual) + Ok(buf.len()) } else { Err(status) } From 2dcafef621f464e61d7e649ae854d416d704a7c3 Mon Sep 17 00:00:00 2001 From: jeb Date: Wed, 20 Jun 2018 08:19:05 -1000 Subject: [PATCH 5/7] make `parse_seq_to_before_end`, `mk_mac_expr`, and `parse_optional_str` public in libsyntax --- src/libsyntax/parse/parser.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/libsyntax/parse/parser.rs b/src/libsyntax/parse/parser.rs index 1735951da2f34..818a176ee658e 100644 --- a/src/libsyntax/parse/parser.rs +++ b/src/libsyntax/parse/parser.rs @@ -1037,7 +1037,7 @@ impl<'a> Parser<'a> { /// Parse a sequence, not including the closing delimiter. The function /// f must consume tokens until reaching the next separator or /// closing bracket. - fn parse_seq_to_before_end(&mut self, + pub fn parse_seq_to_before_end(&mut self, ket: &token::Token, sep: SeqSep, f: F) @@ -2108,7 +2108,7 @@ impl<'a> Parser<'a> { ExprKind::AssignOp(binop, lhs, rhs) } - fn mk_mac_expr(&mut self, span: Span, m: Mac_, attrs: ThinVec) -> P { + pub fn mk_mac_expr(&mut self, span: Span, m: Mac_, attrs: ThinVec) -> P { P(Expr { id: ast::DUMMY_NODE_ID, node: ExprKind::Mac(codemap::Spanned {node: m, span: span}), @@ -7212,7 +7212,7 @@ impl<'a> Parser<'a> { }) } - fn parse_optional_str(&mut self) -> Option<(Symbol, ast::StrStyle, Option)> { + pub fn parse_optional_str(&mut self) -> Option<(Symbol, ast::StrStyle, Option)> { let ret = match self.token { token::Literal(token::Str_(s), suf) => (s, ast::StrStyle::Cooked, suf), token::Literal(token::StrRaw(s, n), suf) => (s, ast::StrStyle::Raw(n), suf), From e9aacfd5c1947d0333887689f1569cf9e2cb2e12 Mon Sep 17 00:00:00 2001 From: Marco Castelluccio Date: Wed, 20 Jun 2018 22:07:55 +0100 Subject: [PATCH 6/7] Disable probestack when GCOV profiling is being used --- src/librustc_codegen_llvm/attributes.rs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/librustc_codegen_llvm/attributes.rs b/src/librustc_codegen_llvm/attributes.rs index a5d04c5c576b2..429acbbe0c2cb 100644 --- a/src/librustc_codegen_llvm/attributes.rs +++ b/src/librustc_codegen_llvm/attributes.rs @@ -98,6 +98,11 @@ pub fn set_probestack(cx: &CodegenCx, llfn: ValueRef) { return; } + // probestack doesn't play nice either with gcov profiling. + if cx.sess().opts.debugging_opts.profile { + return; + } + // Flag our internal `__rust_probestack` function as the stack probe symbol. // This is defined in the `compiler-builtins` crate for each architecture. llvm::AddFunctionAttrStringValue( From 07ad6e042c4324bed11fa422988179edd8ef2dbc Mon Sep 17 00:00:00 2001 From: kennytm Date: Fri, 22 Jun 2018 16:22:01 +0800 Subject: [PATCH 7/7] Recognize the extra "LLVM tools versions" argument to build-manifest. Fix #51699. --- src/tools/build-manifest/src/main.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/src/tools/build-manifest/src/main.rs b/src/tools/build-manifest/src/main.rs index 91a44fdd424fb..db30e649a7e6b 100644 --- a/src/tools/build-manifest/src/main.rs +++ b/src/tools/build-manifest/src/main.rs @@ -212,6 +212,7 @@ fn main() { let cargo_release = args.next().unwrap(); let rls_release = args.next().unwrap(); let rustfmt_release = args.next().unwrap(); + let _llvm_tools_vers = args.next().unwrap(); // FIXME do something with it? let s3_address = args.next().unwrap(); let mut passphrase = String::new(); t!(io::stdin().read_to_string(&mut passphrase));