Auto merge of #68174 - JohnTitor:rollup-ix4amrj, r=JohnTitor

Rollup of 8 pull requests

Successful merges:

 - #67313 (Document more use cases of dataflow)
 - #67959 (rustdoc: improve stability mark arrows)
 - #68097 (Specify units for test timeout environment variables)
 - #68135 (restore some rustc_parse visibilities for rustfmt)
 - #68145 (Expose `context::CheckLintNameResult`)
 - #68156 (Fix crate paths in comments)
 - #68157 (Clean up E0186 explanation)
 - #68161 (Fix system call docs for time::Instant)

Failed merges:

r? @ghost
This commit is contained in:
bors 2020-01-13 08:20:49 +00:00
commit af958046e5
13 changed files with 73 additions and 19 deletions

View file

@ -2,7 +2,7 @@ An associated function for a trait was defined to be a method (i.e., to take a
`self` parameter), but an implementation of the trait declared the same function
to be static.
Here's an example of this error:
Erroneous code example:
```compile_fail,E0186
trait Foo {
@ -17,3 +17,19 @@ impl Foo for Bar {
fn foo() {}
}
```
When a type implements a trait's associated function, it has to use the same
signature. So in this case, since `Foo::foo` takes `self` as argument and
does not return anything, its implementation on `Bar` should be the same:
```
trait Foo {
fn foo(&self);
}
struct Bar;
impl Foo for Bar {
fn foo(&self) {} // ok!
}
```

View file

@ -1,7 +1,8 @@
//! # Feature gates
//!
//! This crate declares the set of past and present unstable features in the compiler.
//! Feature gate checking itself is done in `libsyntax/feature_gate/check.rs` at the moment.
//! Feature gate checking itself is done in `librustc_ast_passes/feature_gate.rs`
//! at the moment.
//!
//! Features are enabled in programs via the crate-level attributes of
//! `#![feature(...)]` with a comma-separated list of features.

View file

@ -1812,7 +1812,7 @@ declare_lint! {
}
declare_lint_pass!(
/// Check for used feature gates in `INCOMPLETE_FEATURES` in `feature_gate.rs`.
/// Check for used feature gates in `INCOMPLETE_FEATURES` in `librustc_feature/active.rs`.
IncompleteFeatures => [INCOMPLETE_FEATURES]
);

View file

@ -76,7 +76,7 @@ use unused::*;
/// Useful for other parts of the compiler / Clippy.
pub use builtin::SoftLints;
pub use context::{EarlyContext, LateContext, LintContext, LintStore};
pub use context::{CheckLintNameResult, EarlyContext, LateContext, LintContext, LintStore};
pub use early::check_ast_crate;
pub use late::check_crate;
pub use passes::{EarlyLintPass, LateLintPass};

View file

@ -668,6 +668,26 @@ pub trait BottomValue {
const BOTTOM_VALUE: bool;
/// Merges `in_set` into `inout_set`, returning `true` if `inout_set` changed.
///
/// It is almost certainly wrong to override this, since it automatically applies
/// * `inout_set & in_set` if `BOTTOM_VALUE == true`
/// * `inout_set | in_set` if `BOTTOM_VALUE == false`
///
/// This means that if a bit is not `BOTTOM_VALUE`, it is propagated into all target blocks.
/// For clarity, the above statement again from a different perspective:
/// A bit in the block's entry set is `!BOTTOM_VALUE` if *any* predecessor block's bit value is
/// `!BOTTOM_VALUE`.
///
/// There are situations where you want the opposite behaviour: propagate only if *all*
/// predecessor blocks's value is `!BOTTOM_VALUE`.
/// E.g. if you want to know whether a bit is *definitely* set at a specific location. This
/// means that all code paths leading to the location must have set the bit, instead of any
/// code path leading there.
///
/// If you want this kind of "definitely set" analysis, you need to
/// 1. Invert `BOTTOM_VALUE`
/// 2. Reset the `entry_set` in `start_block_effect` to `!BOTTOM_VALUE`
/// 3. Override `join` to do the opposite from what it's doing now.
#[inline]
fn join<T: Idx>(&self, inout_set: &mut BitSet<T>, in_set: &BitSet<T>) -> bool {
if Self::BOTTOM_VALUE == false {
@ -685,7 +705,9 @@ pub trait BottomValue {
/// for each block individually. The entry set for all other basic blocks is
/// initialized to `Self::BOTTOM_VALUE`. The dataflow analysis then
/// iteratively modifies the various entry sets (but leaves the the transfer
/// function unchanged).
/// function unchanged). `BottomValue::join` is used to merge the bitsets from
/// two blocks (e.g. when two blocks' terminator jumps to a single block, that
/// target block's state is the merged state of both incoming blocks).
pub trait BitDenotation<'tcx>: BottomValue {
/// Specifies what index type is used to access the bitvector.
type Idx: Idx;

View file

@ -2,6 +2,7 @@ pub mod attr;
mod expr;
mod item;
mod module;
pub use module::{ModulePath, ModulePathSuccess};
mod pat;
mod path;
mod ty;
@ -117,7 +118,8 @@ pub struct Parser<'a> {
/// Used to determine the path to externally loaded source files.
pub(super) directory: Directory<'a>,
/// `true` to parse sub-modules in other files.
pub(super) recurse_into_file_modules: bool,
// Public for rustfmt usage.
pub recurse_into_file_modules: bool,
/// Name of the root module this parser originated from. If `None`, then the
/// name is not known. This does not change while the parser is descending
/// into modules, and sub-parsers have new values for this name.
@ -126,7 +128,8 @@ pub struct Parser<'a> {
token_cursor: TokenCursor,
desugar_doc_comments: bool,
/// `true` we should configure out of line modules as we parse.
cfg_mods: bool,
// Public for rustfmt usage.
pub cfg_mods: bool,
/// This field is used to keep track of how many left angle brackets we have seen. This is
/// required in order to detect extra leading left angle brackets (`<` characters) and error
/// appropriately.
@ -483,7 +486,8 @@ impl<'a> Parser<'a> {
}
}
fn parse_ident(&mut self) -> PResult<'a, ast::Ident> {
// Public for rustfmt usage.
pub fn parse_ident(&mut self) -> PResult<'a, ast::Ident> {
self.parse_ident_common(true)
}
@ -540,7 +544,8 @@ impl<'a> Parser<'a> {
/// If the next token is the given keyword, eats it and returns `true`.
/// Otherwise, returns `false`. An expectation is also added for diagnostics purposes.
fn eat_keyword(&mut self, kw: Symbol) -> bool {
// Public for rustfmt usage.
pub fn eat_keyword(&mut self, kw: Symbol) -> bool {
if self.check_keyword(kw) {
self.bump();
true

View file

@ -14,13 +14,15 @@ use syntax::token::{self, TokenKind};
use std::path::{self, Path, PathBuf};
/// Information about the path to a module.
pub(super) struct ModulePath {
// Public for rustfmt usage.
pub struct ModulePath {
name: String,
path_exists: bool,
pub result: Result<ModulePathSuccess, Error>,
}
pub(super) struct ModulePathSuccess {
// Public for rustfmt usage.
pub struct ModulePathSuccess {
pub path: PathBuf,
pub directory_ownership: DirectoryOwnership,
}
@ -177,7 +179,8 @@ impl<'a> Parser<'a> {
}
}
pub(super) fn submod_path_from_attr(attrs: &[Attribute], dir_path: &Path) -> Option<PathBuf> {
// Public for rustfmt usage.
pub fn submod_path_from_attr(attrs: &[Attribute], dir_path: &Path) -> Option<PathBuf> {
if let Some(s) = attr::first_attr_value_str_by_name(attrs, sym::path) {
let s = s.as_str();
@ -194,7 +197,8 @@ impl<'a> Parser<'a> {
}
/// Returns a path to a module.
pub(super) fn default_submod_path(
// Public for rustfmt usage.
pub fn default_submod_path(
id: ast::Ident,
relative: Option<ast::Ident>,
dir_path: &Path,

View file

@ -542,11 +542,11 @@ h4 > code, h3 > code, .invisible > code {
}
.content .stability::before {
content: '˪';
font-size: 30px;
content: '';
font-size: 25px;
position: absolute;
top: -9px;
left: -13px;
top: -6px;
left: -19px;
}
.content .impl-items .method, .content .impl-items > .type, .impl-items > .associatedconstant {

View file

@ -105,6 +105,8 @@ pre {
.content .highlighted.primitive { background-color: #00708a; }
.content .highlighted.keyword { background-color: #884719; }
.content .stability::before { color: #ccc; }
.content span.enum, .content a.enum, .block a.current.enum { color: #82b089; }
.content span.struct, .content a.struct, .block a.current.struct { color: #2dbfb8; }
.content span.type, .content a.type, .block a.current.type { color: #ff7f00; }

View file

@ -105,6 +105,8 @@ pre {
.content .highlighted.primitive { background-color: #9aecff; }
.content .highlighted.keyword { background-color: #f99650; }
.content .stability::before { color: #ccc; }
.content span.enum, .content a.enum, .block a.current.enum { color: #508157; }
.content span.struct, .content a.struct, .block a.current.struct { color: #ad448e; }
.content span.type, .content a.type, .block a.current.type { color: #ba5d00; }

View file

@ -67,7 +67,7 @@ pub use core::time::Duration;
/// |:---------:|:--------------------------------------------------------------------:|
/// | Cloud ABI | [clock_time_get (Monotonic Clock)] |
/// | SGX | [`insecure_time` usercall]. More information on [timekeeping in SGX] |
/// | UNIX | [clock_time_get (Monotonic Clock)] |
/// | UNIX | [clock_gettime (Monotonic Clock)] |
/// | Darwin | [mach_absolute_time] |
/// | VXWorks | [clock_gettime (Monotonic Clock)] |
/// | WASI | [__wasi_clock_time_get (Monotonic Clock)] |

View file

@ -125,6 +125,8 @@ fn optgroups() -> getopts::Options {
`RUST_TEST_TIME_DOCTEST` environment variables.
Expected format of environment variable is `VARIABLE=WARN_TIME,CRITICAL_TIME`.
Durations must be specified in milliseconds, e.g. `500,2000` means that the warn time
is 0.5 seconds, and the critical time is 2 seconds.
Not available for --format=terse",
"plain|colored",

View file

@ -12,7 +12,7 @@
// the change when it happens.
//
// At the time of authoring, the attributes here are listed in the
// order that they occur in libsyntax/feature_gate.rs.
// order that they occur in `librustc_feature`.
//
// Any builtin attributes that:
//