Skip to content
Permalink
Browse files

Auto merge of #59050 - Centril:rollup, r=Centril

Rollup of 13 pull requests

Successful merges:

 - #58518 (Use early unwraps instead of bubbling up errors just to unwrap in the end)
 - #58626 (rustdoc: add option to calculate "documentation coverage")
 - #58629 (rust-lldb: fix crash when printing empty string)
 - #58660 (MaybeUninit: add read_initialized, add examples)
 - #58670 (fixes #52482)
 - #58676 (look for python2 symlinks before bootstrap python)
 - #58679 (Refactor passes and pass execution to be more parallel)
 - #58750 (Make `Unique::as_ptr`, `NonNull::dangling` and `NonNull::cast` const)
 - #58762 (Mention `unwind(aborts)` in diagnostics for `#[unwind]`)
 - #58924 (Add as_slice() to slice::IterMut and vec::Drain)
 - #58990 (Actually publish miri in the manifest)
 - #59018 (std: Delete a by-definition spuriously failing test)
 - #59045 (Expose new_sub_parser_from_file)

Failed merges:

r? @ghost
  • Loading branch information...
bors committed Mar 9, 2019
2 parents e1b8898 + 4eb762a commit 26b4cb48484382032522384318e70ceb0fbc4a41
Showing with 1,394 additions and 390 deletions.
  1. +3 −0 config.toml.example
  2. +10 −8 src/bootstrap/sanity.rs
  3. +31 −4 src/doc/rustdoc/src/unstable-features.md
  4. +2 −0 src/etc/lldb_rust_formatters.py
  5. +19 −0 src/liballoc/vec.rs
  6. +4 −0 src/libcore/fmt/float.rs
  7. +224 −29 src/libcore/mem.rs
  8. +6 −4 src/libcore/ptr.rs
  9. +28 −0 src/libcore/slice/mod.rs
  10. +1 −0 src/librustc/dep_graph/dep_node.rs
  11. +0 −6 src/librustc/hir/check_attr.rs
  12. +4 −4 src/librustc/hir/mod.rs
  13. +0 −6 src/librustc/middle/intrinsicck.rs
  14. +0 −6 src/librustc/middle/liveness.rs
  15. +0 −6 src/librustc/middle/stability.rs
  16. +17 −17 src/librustc/ty/context.rs
  17. +6 −0 src/librustc/ty/query/config.rs
  18. +2 −1 src/librustc/ty/query/mod.rs
  19. +1 −0 src/librustc/ty/query/plumbing.rs
  20. +7 −7 src/librustc_codegen_ssa/mir/constant.rs
  21. +54 −7 src/librustc_data_structures/sync.rs
  22. +54 −44 src/librustc_interface/passes.rs
  23. +5 −2 src/librustc_mir/build/mod.rs
  24. +20 −23 src/librustc_mir/const_eval.rs
  25. +1 −6 src/librustc_mir/hair/cx/expr.rs
  26. +1 −7 src/librustc_mir/hair/pattern/_match.rs
  27. +0 −7 src/librustc_mir/hair/pattern/check_match.rs
  28. +2 −8 src/librustc_mir/hair/pattern/mod.rs
  29. +0 −1 src/librustc_mir/lib.rs
  30. +0 −6 src/librustc_passes/loops.rs
  31. +7 −17 src/librustc_passes/rvalue_promotion.rs
  32. +36 −42 src/librustc_privacy/lib.rs
  33. +2 −3 src/librustc_typeck/check/cast.rs
  34. +1 −13 src/librustc_typeck/check/mod.rs
  35. +5 −5 src/librustc_typeck/check/wfcheck.rs
  36. +5 −11 src/librustc_typeck/check/writeback.rs
  37. +1 −3 src/librustc_typeck/coherence/mod.rs
  38. +0 −6 src/librustc_typeck/collect.rs
  39. +13 −4 src/librustc_typeck/lib.rs
  40. +25 −1 src/librustdoc/config.rs
  41. +7 −4 src/librustdoc/core.rs
  42. +1 −1 src/librustdoc/html/item_type.rs
  43. +12 −0 src/librustdoc/lib.rs
  44. +166 −0 src/librustdoc/passes/calculate_doc_coverage.rs
  45. +23 −0 src/librustdoc/passes/mod.rs
  46. +0 −15 src/libstd/net/tcp.rs
  47. +17 −31 src/libsyntax/attr/builtin.rs
  48. +1 −1 src/libsyntax/feature_gate.rs
  49. +1 −1 src/libsyntax/parse/mod.rs
  50. +35 −0 src/test/debuginfo/empty-string.rs
  51. +17 −0 src/test/run-pass/consts/const-ptr-nonnull.rs
  52. +15 −0 src/test/run-pass/consts/const-ptr-unique.rs
  53. +50 −0 src/test/rustdoc-ui/coverage/basic.rs
  54. +7 −0 src/test/rustdoc-ui/coverage/basic.stdout
  55. +4 −0 src/test/rustdoc-ui/coverage/empty.rs
  56. +7 −0 src/test/rustdoc-ui/coverage/empty.stdout
  57. +22 −0 src/test/rustdoc-ui/coverage/enums.rs
  58. +7 −0 src/test/rustdoc-ui/coverage/enums.stdout
  59. +15 −0 src/test/rustdoc-ui/coverage/exotic.rs
  60. +8 −0 src/test/rustdoc-ui/coverage/exotic.stdout
  61. +21 −0 src/test/rustdoc-ui/coverage/private.rs
  62. +7 −0 src/test/rustdoc-ui/coverage/private.stdout
  63. +23 −0 src/test/rustdoc-ui/coverage/statics-consts.rs
  64. +7 −0 src/test/rustdoc-ui/coverage/statics-consts.stdout
  65. +37 −0 src/test/rustdoc-ui/coverage/traits.rs
  66. +7 −0 src/test/rustdoc-ui/coverage/traits.stdout
  67. +25 −0 src/test/ui/consts/const-ptr-nonnull.nll.stderr
  68. +11 −0 src/test/ui/consts/const-ptr-nonnull.rs
  69. +25 −0 src/test/ui/consts/const-ptr-nonnull.stderr
  70. +14 −0 src/test/ui/consts/const-ptr-unique.nll.stderr
  71. +10 −0 src/test/ui/consts/const-ptr-unique.rs
  72. +14 −0 src/test/ui/consts/const-ptr-unique.stderr
  73. +1 −0 src/test/ui/issues/issue-20413.rs
  74. +81 −1 src/test/ui/issues/issue-20413.stderr
  75. +1 −0 src/test/ui/issues/issue-21946.rs
  76. +7 −1 src/test/ui/issues/issue-21946.stderr
  77. +1 −0 src/test/ui/issues/issue-23122-1.rs
  78. +7 −1 src/test/ui/issues/issue-23122-1.stderr
  79. +1 −0 src/test/ui/issues/issue-23122-2.rs
  80. +10 −1 src/test/ui/issues/issue-23122-2.stderr
  81. +11 −0 src/test/ui/malformed/malformed-unwind-1.rs
  82. +14 −0 src/test/ui/malformed/malformed-unwind-1.stderr
  83. +11 −0 src/test/ui/malformed/malformed-unwind-2.rs
  84. +15 −0 src/test/ui/malformed/malformed-unwind-2.stderr
  85. +18 −18 src/test/ui/privacy/private-inferred-type.stderr
  86. +3 −1 src/tools/build-manifest/src/main.rs
@@ -164,6 +164,9 @@
# Python interpreter to use for various tasks throughout the build, notably
# rustdoc tests, the lldb python interpreter, and some dist bits and pieces.
# Note that Python 2 is currently required.
#
# Defaults to python2.7, then python2. If neither executable can be found, then
# it defaults to the Python interpreter used to execute x.py.
#python = "python2.7"

# Force Cargo to check that Cargo.lock describes the precise dependency
@@ -34,15 +34,17 @@ impl Finder {

fn maybe_have<S: AsRef<OsStr>>(&mut self, cmd: S) -> Option<PathBuf> {
let cmd: OsString = cmd.as_ref().into();
let path = self.path.clone();
let path = &self.path;
self.cache.entry(cmd.clone()).or_insert_with(|| {
for path in env::split_paths(&path) {
for path in env::split_paths(path) {
let target = path.join(&cmd);
let mut cmd_alt = cmd.clone();
cmd_alt.push(".exe");
if target.is_file() || // some/path/git
target.with_extension("exe").exists() || // some/path/git.exe
target.join(&cmd_alt).exists() { // some/path/git/git.exe
let mut cmd_exe = cmd.clone();
cmd_exe.push(".exe");

if target.is_file() // some/path/git
|| path.join(&cmd_exe).exists() // some/path/git.exe
|| target.join(&cmd_exe).exists() // some/path/git/git.exe
{
return Some(target);
}
}
@@ -107,9 +109,9 @@ pub fn check(build: &mut Build) {
}

build.config.python = build.config.python.take().map(|p| cmd_finder.must_have(p))
.or_else(|| env::var_os("BOOTSTRAP_PYTHON").map(PathBuf::from)) // set by bootstrap.py
.or_else(|| cmd_finder.maybe_have("python2.7"))
.or_else(|| cmd_finder.maybe_have("python2"))
.or_else(|| env::var_os("BOOTSTRAP_PYTHON").map(PathBuf::from)) // set by bootstrap.py
.or_else(|| Some(cmd_finder.must_have("python")));

build.config.nodejs = build.config.nodejs.take().map(|p| cmd_finder.must_have(p))
@@ -53,7 +53,7 @@ For example, in the following code:
```rust
/// Does the thing.
pub fn do_the_thing(_: SomeType) {
println!("Let's do the thing!");
println!("Let's do the thing!");
}
/// Token you use to [`do_the_thing`].
@@ -66,15 +66,15 @@ target out also works:

```rust
pub mod some_module {
/// Token you use to do the thing.
pub struct SomeStruct;
/// Token you use to do the thing.
pub struct SomeStruct;
}
/// Does the thing. Requires one [`SomeStruct`] for the thing to work.
///
/// [`SomeStruct`]: some_module::SomeStruct
pub fn do_the_thing(_: some_module::SomeStruct) {
println!("Let's do the thing!");
println!("Let's do the thing!");
}
```

@@ -428,3 +428,30 @@ $ rustdoc src/lib.rs --test -Z unstable-options --persist-doctests target/rustdo
This flag allows you to keep doctest executables around after they're compiled or run.
Usually, rustdoc will immediately discard a compiled doctest after it's been tested, but
with this option, you can keep those binaries around for farther testing.

### `--show-coverage`: calculate the percentage of items with documentation

Using this flag looks like this:

```bash
$ rustdoc src/lib.rs -Z unstable-options --show-coverage
```

If you want to determine how many items in your crate are documented, pass this flag to rustdoc.
When it receives this flag, it will count the public items in your crate that have documentation,
and print out the counts and a percentage instead of generating docs.

Some methodology notes about what rustdoc counts in this metric:

* Rustdoc will only count items from your crate (i.e. items re-exported from other crates don't
count).
* Docs written directly onto inherent impl blocks are not counted, even though their doc comments
are displayed, because the common pattern in Rust code is to write all inherent methods into the
same impl block.
* Items in a trait implementation are not counted, as those impls will inherit any docs from the
trait itself.
* By default, only public items are counted. To count private items as well, pass
`--document-private-items` at the same time.

Public items that are not documented can be seen with the built-in `missing_docs` lint. Private
items that are not documented can be seen with Clippy's `missing_docs_in_private_items` lint.
@@ -290,6 +290,8 @@ def render_element(i):


def read_utf8_string(ptr_val, byte_count):
if byte_count == 0:
return '""'
error = lldb.SBError()
process = ptr_val.get_wrapped_value().GetProcess()
data = process.ReadMemory(ptr_val.as_integer(), byte_count, error)
@@ -2468,6 +2468,25 @@ impl<T: fmt::Debug> fmt::Debug for Drain<'_, T> {
}
}

impl<'a, T> Drain<'a, T> {
/// Returns the remaining items of this iterator as a slice.
///
/// # Examples
///
/// ```
/// # #![feature(vec_drain_as_slice)]
/// let mut vec = vec!['a', 'b', 'c'];
/// let mut drain = vec.drain(..);
/// assert_eq!(drain.as_slice(), &['a', 'b', 'c']);
/// let _ = drain.next().unwrap();
/// assert_eq!(drain.as_slice(), &['b', 'c']);
/// ```
#[unstable(feature = "vec_drain_as_slice", reason = "recently added", issue = "58957")]
pub fn as_slice(&self) -> &[T] {
self.iter.as_slice()
}
}

#[stable(feature = "drain", since = "1.6.0")]
unsafe impl<T: Sync> Sync for Drain<'_, T> {}
#[stable(feature = "drain", since = "1.6.0")]
@@ -15,6 +15,7 @@ fn float_to_decimal_common_exact<T>(fmt: &mut Formatter, num: &T,
// FIXME(#53491): Technically, this is calling `get_mut` on an uninitialized
// `MaybeUninit` (here and elsewhere in this file). Revisit this once
// we decided whether that is valid or not.
// Using `freeze` is *not enough*; `flt2dec::Part` is an enum!
let formatted = flt2dec::to_exact_fixed_str(flt2dec::strategy::grisu::format_exact,
*num, sign, precision,
false, buf.get_mut(), parts.get_mut());
@@ -33,6 +34,7 @@ fn float_to_decimal_common_shortest<T>(fmt: &mut Formatter, num: &T,
// enough for f32 and f64
let mut buf = MaybeUninit::<[u8; flt2dec::MAX_SIG_DIGITS]>::uninitialized();
let mut parts = MaybeUninit::<[flt2dec::Part; 4]>::uninitialized();
// FIXME(#53491)
let formatted = flt2dec::to_shortest_str(flt2dec::strategy::grisu::format_shortest, *num,
sign, precision, false, buf.get_mut(),
parts.get_mut());
@@ -71,6 +73,7 @@ fn float_to_exponential_common_exact<T>(fmt: &mut Formatter, num: &T,
unsafe {
let mut buf = MaybeUninit::<[u8; 1024]>::uninitialized(); // enough for f32 and f64
let mut parts = MaybeUninit::<[flt2dec::Part; 6]>::uninitialized();
// FIXME(#53491)
let formatted = flt2dec::to_exact_exp_str(flt2dec::strategy::grisu::format_exact,
*num, sign, precision,
upper, buf.get_mut(), parts.get_mut());
@@ -90,6 +93,7 @@ fn float_to_exponential_common_shortest<T>(fmt: &mut Formatter,
// enough for f32 and f64
let mut buf = MaybeUninit::<[u8; flt2dec::MAX_SIG_DIGITS]>::uninitialized();
let mut parts = MaybeUninit::<[flt2dec::Part; 6]>::uninitialized();
// FIXME(#53491)
let formatted = flt2dec::to_shortest_exp_str(flt2dec::strategy::grisu::format_shortest,
*num, sign, (0, 0), upper,
buf.get_mut(), parts.get_mut());
Oops, something went wrong.

0 comments on commit 26b4cb4

Please sign in to comment.
You can’t perform that action at this time.