Skip to content

Commit

Permalink
Auto merge of rust-lang#132703 - GuillaumeGomez:rollup-tfuef34, r=Gui…
Browse files Browse the repository at this point in the history
…llaumeGomez

Rollup of 3 pull requests

Successful merges:

 - rust-lang#132617 (Fix an extra newline in rendered std doc)
 - rust-lang#132698 (Remove unneeded fields in `scrape_examples::FindCalls`)
 - rust-lang#132700 (add note not to re-report crashes from `crashes` tests)

r? `@ghost`
`@rustbot` modify labels: rollup
  • Loading branch information
bors committed Nov 6, 2024
2 parents 116fc31 + 4c7e92f commit 8549802
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 14 deletions.
10 changes: 4 additions & 6 deletions library/std/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,12 @@
//!
//! Once you are familiar with the contents of the standard library you may
//! begin to find the verbosity of the prose distracting. At this stage in your
//! development you may want to press the <code>
//! <svg style="width:0.75rem;height:0.75rem" viewBox="0 0 12 12"
//! stroke="currentColor" fill="none">
//! <path d="M2,2l4,4l4,-4M2,6l4,4l4,-4"/></svg> Summary</code> button near the
//! top of the page to collapse it into a more skimmable view.
//! development you may want to press the
//! "<svg style="width:0.75rem;height:0.75rem" viewBox="0 0 12 12" stroke="currentColor" fill="none"><path d="M2,2l4,4l4,-4M2,6l4,4l4,-4"/></svg>&nbsp;Summary"
//! button near the top of the page to collapse it into a more skimmable view.
//!
//! While you are looking at the top of the page, also notice the
//! <code>source</code> link. Rust's API documentation comes with the source
//! "Source" link. Rust's API documentation comes with the source
//! code and you are encouraged to read it. The standard library source is
//! generally high quality and a peek behind the curtains is
//! often enlightening.
Expand Down
10 changes: 3 additions & 7 deletions src/librustdoc/scrape_examples.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ use rustc_hir::intravisit::{self, Visitor};
use rustc_hir::{self as hir};
use rustc_interface::interface;
use rustc_macros::{Decodable, Encodable};
use rustc_middle::hir::map::Map;
use rustc_middle::hir::nested_filter;
use rustc_middle::ty::{self, TyCtxt};
use rustc_serialize::opaque::{FileEncoder, MemDecoder};
Expand Down Expand Up @@ -107,8 +106,6 @@ pub(crate) type AllCallLocations = FxIndexMap<DefPathHash, FnCallLocations>;

/// Visitor for traversing a crate and finding instances of function calls.
struct FindCalls<'a, 'tcx> {
tcx: TyCtxt<'tcx>,
map: Map<'tcx>,
cx: Context<'tcx>,
target_crates: Vec<CrateNum>,
calls: &'a mut AllCallLocations,
Expand All @@ -122,13 +119,13 @@ where
type NestedFilter = nested_filter::OnlyBodies;

fn nested_visit_map(&mut self) -> Self::Map {
self.map
self.cx.tcx().hir()
}

fn visit_expr(&mut self, ex: &'tcx hir::Expr<'tcx>) {
intravisit::walk_expr(self, ex);

let tcx = self.tcx;
let tcx = self.cx.tcx();

// If we visit an item that contains an expression outside a function body,
// then we need to exit before calling typeck (which will panic). See
Expand Down Expand Up @@ -294,8 +291,7 @@ pub(crate) fn run(

// Run call-finder on all items
let mut calls = FxIndexMap::default();
let mut finder =
FindCalls { calls: &mut calls, tcx, map: tcx.hir(), cx, target_crates, bin_crate };
let mut finder = FindCalls { calls: &mut calls, cx, target_crates, bin_crate };
tcx.hir().visit_all_item_likes_in_crate(&mut finder);

// The visitor might have found a type error, which we need to
Expand Down
4 changes: 3 additions & 1 deletion tests/crashes/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ A test will "pass" if rustc exits with something other than 1 or 0.

When adding crashes from https://github.com/rust-lang/rust/issues, the
issue number should be noted in the file name (12345.rs should suffice)
and perhaps also inside the file via `//@ known-bug #4321`
and also inside the file via `//@ known-bug #4321` if possible.

If you happen to fix one of the crashes, please move it to a fitting
subdirectory in `tests/ui` and give it a meaningful name.
Expand All @@ -21,3 +21,5 @@ to the description of your pull request will ensure the
corresponding tickets will be closed automatically upon merge.
The ticket ids can be found in the file name or the `known-bug` annotation
inside the testfile.

Please do not re-report any crashes that you find here!

0 comments on commit 8549802

Please sign in to comment.