Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rollup of 8 pull requests #69958

Closed
wants to merge 37 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
79b8ad8
Implement `Copy` for `IoSlice`
LeSeulArtichaut Feb 23, 2020
9fa7981
rustdoc: don't call into_iter() on iterator. (clippy::identity_conver…
matthiaskrgr Mar 5, 2020
6bfff8a
rustdoc: Use .any(p) instead of find(p).is_some(). (clippy::search_is…
matthiaskrgr Mar 5, 2020
7aad89a
Use ?-operator in more places (clippy::question_mark, had some false …
matthiaskrgr Mar 5, 2020
45108b1
rustdoc: simplify boolean condition (clippy::nonminimal_bool)
matthiaskrgr Mar 6, 2020
1351db3
iterate over a maps values directly. (clippy::for_kv_map)
matthiaskrgr Mar 6, 2020
254ceae
call .as_deref() instead of .as_ref().map(Deref::deref) (clippy::opti…
matthiaskrgr Mar 6, 2020
0d7faaf
rustdoc: remove redundant static lifetimes (clippy::redundant_static_…
matthiaskrgr Mar 6, 2020
cca3d52
libtest: declare variables as floats instead of casting them (clippy:…
matthiaskrgr Mar 6, 2020
77af19e
remove unneeded mutable references (cippy::unnecessary_mut_passed)
matthiaskrgr Mar 6, 2020
f326f0f
libtest: remove redundant argument to writeln!() (clippy::writeln_emp…
matthiaskrgr Mar 6, 2020
3f87f8c
Use writeln!(fmt, "word") instead of write!(fmt, "word\n") (clippy::w…
matthiaskrgr Mar 6, 2020
8351138
reduce references on match patterns (clippy::match_ref_pats)
matthiaskrgr Mar 7, 2020
f29afc1
Remove `free_region_map` from `TypeckTables`
matthewjasper Nov 30, 2019
b5a44ff
Don't use `TypeckTables` in NiceRegionError
matthewjasper Feb 15, 2020
40993b0
Support type search for arguments and returned types
GuillaumeGomez Feb 23, 2020
3b02550
Update JS results tester
GuillaumeGomez Feb 23, 2020
b0666d2
Add tests for new of variables
GuillaumeGomez Feb 23, 2020
1a3358d
formatting
GuillaumeGomez Feb 23, 2020
cd31800
Rename render::Type to improve naming
GuillaumeGomez Mar 3, 2020
85b6723
Update src/librustdoc/html/static/main.js
GuillaumeGomez Mar 9, 2020
118003d
triagebot.toml: add ping aliases
Centril Mar 12, 2020
7326e53
Move some const-eval `build-pass` tests to `check-pass`
LeSeulArtichaut Mar 12, 2020
8f0fa24
Move some more tests to `check-pass`
LeSeulArtichaut Mar 12, 2020
90e8058
triagebot.toml: add typo aliases
Centril Mar 12, 2020
2f145f6
Make macro metavars respect (non-)hygiene
matthewjasper Mar 11, 2020
54f7202
Erase regions in writeback
matthewjasper Feb 15, 2020
f8a08a9
Update tests for erasing regions in typeck
matthewjasper Feb 15, 2020
7b1b08c
remove lifetimes that can be elided (clippy::needless_lifetimes)
matthiaskrgr Mar 6, 2020
39fb6ca
Rollup merge of #68746 - matthewjasper:metahygiene, r=petrochenkov
Centril Mar 12, 2020
d895ceb
Rollup merge of #69189 - matthewjasper:erase-the-world, r=nikomatsakis
Centril Mar 12, 2020
dab9e21
Rollup merge of #69402 - GuillaumeGomez:extend-search, r=kinnison
Centril Mar 12, 2020
9252153
Rollup merge of #69403 - LeSeulArtichaut:copy-ioslice, r=sfackler
Centril Mar 12, 2020
5831003
Rollup merge of #69460 - LeSeulArtichaut:move-compile-pass, r=RalfJung
Centril Mar 12, 2020
1185d8b
Rollup merge of #69802 - matthiaskrgr:cl1ppy, r=Dylan-DPC
Centril Mar 12, 2020
b9f26dc
Rollup merge of #69809 - matthiaskrgr:lifetimes, r=eddyb
Centril Mar 12, 2020
e1f3da1
Rollup merge of #69949 - rust-lang:triagebot-ping-alias, r=Mark-Simul…
Centril Mar 12, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/liballoc/collections/linked_list.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1427,7 +1427,7 @@ impl<'a, T> CursorMut<'a, T> {
/// `CursorMut`, which means it cannot outlive the `CursorMut` and that the
/// `CursorMut` is frozen for the lifetime of the `Cursor`.
#[unstable(feature = "linked_list_cursors", issue = "58533")]
pub fn as_cursor<'cm>(&'cm self) -> Cursor<'cm, T> {
pub fn as_cursor(&self) -> Cursor<'_, T> {
Cursor { list: self.list, current: self.current, index: self.index }
}
}
Expand Down
13 changes: 5 additions & 8 deletions src/libcore/str/pattern.rs
Original file line number Diff line number Diff line change
Expand Up @@ -365,11 +365,7 @@ unsafe impl<'a> ReverseSearcher<'a> for CharSearcher<'a> {
let haystack = self.haystack.as_bytes();
loop {
// get the haystack up to but not including the last character searched
let bytes = if let Some(slice) = haystack.get(self.finger..self.finger_back) {
slice
} else {
return None;
};
let bytes = haystack.get(self.finger..self.finger_back)?;
// the last byte of the utf8 encoded needle
// SAFETY: we have an invariant that `utf8_size < 5`
let last_byte = unsafe { *self.utf8_encoded.get_unchecked(self.utf8_size - 1) };
Expand Down Expand Up @@ -575,11 +571,12 @@ macro_rules! pattern_methods {

#[inline]
fn is_suffix_of(self, haystack: &'a str) -> bool
where $t: ReverseSearcher<'a>
where
$t: ReverseSearcher<'a>,
{
($pmap)(self).is_suffix_of(haystack)
}
}
};
}

macro_rules! searcher_methods {
Expand Down Expand Up @@ -614,7 +611,7 @@ macro_rules! searcher_methods {
fn next_reject_back(&mut self) -> Option<(usize, usize)> {
self.0.next_reject_back()
}
}
};
}

/////////////////////////////////////////////////////////////////////////////
Expand Down
2 changes: 1 addition & 1 deletion src/librustc/dep_graph/dep_node.rs
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ macro_rules! define_dep_nodes {
$(
#[inline(always)]
#[allow(unreachable_code, non_snake_case)]
pub fn $variant<'tcx>(_tcx: TyCtxt<'tcx>, $(arg: $tuple_arg_ty)*) -> DepNode {
pub fn $variant(_tcx: TyCtxt<'_>, $(arg: $tuple_arg_ty)*) -> DepNode {
// tuple args
$({
erase!($tuple_arg_ty);
Expand Down
2 changes: 1 addition & 1 deletion src/librustc/hir/map/collector.rs
Original file line number Diff line number Diff line change
Expand Up @@ -340,7 +340,7 @@ impl<'a, 'hir> Visitor<'hir> for NodeCollector<'a, 'hir> {
/// deep walking so that we walk nested items in the context of
/// their outer items.

fn nested_visit_map<'this>(&'this mut self) -> NestedVisitorMap<'this, Self::Map> {
fn nested_visit_map(&mut self) -> NestedVisitorMap<'_, Self::Map> {
panic!("`visit_nested_xxx` must be manually implemented in this visitor");
}

Expand Down
2 changes: 1 addition & 1 deletion src/librustc/hir/map/hir_id_validator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ impl<'a, 'hir> HirIdValidator<'a, 'hir> {
impl<'a, 'hir> intravisit::Visitor<'hir> for HirIdValidator<'a, 'hir> {
type Map = Map<'hir>;

fn nested_visit_map<'this>(&'this mut self) -> intravisit::NestedVisitorMap<'this, Self::Map> {
fn nested_visit_map(&mut self) -> intravisit::NestedVisitorMap<'_, Self::Map> {
intravisit::NestedVisitorMap::OnlyBodies(self.hir_map)
}

Expand Down
2 changes: 1 addition & 1 deletion src/librustc/hir/map/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -298,7 +298,7 @@ impl<'hir> Map<'hir> {
}

pub fn def_kind(&self, hir_id: HirId) -> Option<DefKind> {
let node = if let Some(node) = self.find(hir_id) { node } else { return None };
let node = self.find(hir_id)?;

Some(match node {
Node::Item(item) => match item.kind {
Expand Down
4 changes: 2 additions & 2 deletions src/librustc/mir/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -403,7 +403,7 @@ pub enum ClearCrossCrate<T> {
}

impl<T> ClearCrossCrate<T> {
pub fn as_ref(&'a self) -> ClearCrossCrate<&'a T> {
pub fn as_ref(&self) -> ClearCrossCrate<&T> {
match self {
ClearCrossCrate::Clear => ClearCrossCrate::Clear,
ClearCrossCrate::Set(v) => ClearCrossCrate::Set(v),
Expand Down Expand Up @@ -2503,7 +2503,7 @@ impl UserTypeProjection {

pub(crate) fn variant(
mut self,
adt_def: &'tcx AdtDef,
adt_def: &AdtDef,
variant_index: VariantIdx,
field: Field,
) -> Self {
Expand Down
9 changes: 0 additions & 9 deletions src/librustc/ty/context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ use crate::mir::{
};
use crate::traits;
use crate::traits::{Clause, Clauses, Goal, GoalKind, Goals};
use crate::ty::free_region_map::FreeRegionMap;
use crate::ty::layout::{LayoutDetails, TargetDataLayout, VariantIdx};
use crate::ty::query;
use crate::ty::steal::Steal;
Expand Down Expand Up @@ -415,11 +414,6 @@ pub struct TypeckTables<'tcx> {
/// this field will be set to `true`.
pub tainted_by_errors: bool,

/// Stores the free-region relationships that were deduced from
/// its where-clauses and parameter types. These are then
/// read-again by borrowck.
pub free_region_map: FreeRegionMap<'tcx>,

/// All the opaque types that are restricted to concrete types
/// by this function.
pub concrete_opaque_types: FxHashMap<DefId, ResolvedOpaqueTy<'tcx>>,
Expand Down Expand Up @@ -455,7 +449,6 @@ impl<'tcx> TypeckTables<'tcx> {
coercion_casts: Default::default(),
used_trait_imports: Lrc::new(Default::default()),
tainted_by_errors: false,
free_region_map: Default::default(),
concrete_opaque_types: Default::default(),
upvar_list: Default::default(),
generator_interior_types: Default::default(),
Expand Down Expand Up @@ -718,7 +711,6 @@ impl<'a, 'tcx> HashStable<StableHashingContext<'a>> for TypeckTables<'tcx> {

ref used_trait_imports,
tainted_by_errors,
ref free_region_map,
ref concrete_opaque_types,
ref upvar_list,
ref generator_interior_types,
Expand Down Expand Up @@ -756,7 +748,6 @@ impl<'a, 'tcx> HashStable<StableHashingContext<'a>> for TypeckTables<'tcx> {
coercion_casts.hash_stable(hcx, hasher);
used_trait_imports.hash_stable(hcx, hasher);
tainted_by_errors.hash_stable(hcx, hasher);
free_region_map.hash_stable(hcx, hasher);
concrete_opaque_types.hash_stable(hcx, hasher);
upvar_list.hash_stable(hcx, hasher);
generator_interior_types.hash_stable(hcx, hasher);
Expand Down
7 changes: 1 addition & 6 deletions src/librustc/ty/util.rs
Original file line number Diff line number Diff line change
Expand Up @@ -346,12 +346,7 @@ impl<'tcx> TyCtxt<'tcx> {
adt_did: DefId,
validate: &mut dyn FnMut(Self, DefId) -> Result<(), ErrorReported>,
) -> Option<ty::Destructor> {
let drop_trait = if let Some(def_id) = self.lang_items().drop_trait() {
def_id
} else {
return None;
};

let drop_trait = self.lang_items().drop_trait()?;
self.ensure().coherent_trait(drop_trait);

let mut dtor_did = None;
Expand Down
4 changes: 2 additions & 2 deletions src/librustc_codegen_llvm/common.rs
Original file line number Diff line number Diff line change
Expand Up @@ -320,7 +320,7 @@ impl ConstMethods<'tcx> for CodegenCx<'ll, 'tcx> {
}
}

pub fn val_ty(v: &'ll Value) -> &'ll Type {
pub fn val_ty(v: &Value) -> &Type {
unsafe { llvm::LLVMTypeOf(v) }
}

Expand All @@ -342,6 +342,6 @@ fn hi_lo_to_u128(lo: u64, hi: u64) -> u128 {
((hi as u128) << 64) | (lo as u128)
}

fn try_as_const_integral(v: &'ll Value) -> Option<&'ll ConstantInt> {
fn try_as_const_integral(v: &Value) -> Option<&ConstantInt> {
unsafe { llvm::LLVMIsAConstantInt(v) }
}
6 changes: 3 additions & 3 deletions src/librustc_codegen_llvm/llvm/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -185,12 +185,12 @@ impl Drop for SectionIter<'a> {
}
}

pub fn mk_section_iter(llof: &'a ffi::ObjectFile) -> SectionIter<'a> {
pub fn mk_section_iter(llof: &ffi::ObjectFile) -> SectionIter<'_> {
unsafe { SectionIter { llsi: LLVMGetSections(llof) } }
}

/// Safe wrapper around `LLVMGetParam`, because segfaults are no fun.
pub fn get_param(llfn: &'a Value, index: c_uint) -> &'a Value {
pub fn get_param(llfn: &Value, index: c_uint) -> &Value {
unsafe {
assert!(
index < LLVMCountParams(llfn),
Expand All @@ -203,7 +203,7 @@ pub fn get_param(llfn: &'a Value, index: c_uint) -> &'a Value {
}

/// Safe wrapper for `LLVMGetValueName2` into a byte slice
pub fn get_value_name(value: &'a Value) -> &'a [u8] {
pub fn get_value_name(value: &Value) -> &[u8] {
unsafe {
let mut len = 0;
let data = LLVMGetValueName2(value, &mut len);
Expand Down
2 changes: 1 addition & 1 deletion src/librustc_codegen_llvm/type_.rs
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,7 @@ impl Type {
unsafe { llvm::LLVMIntTypeInContext(llcx, num_bits as c_uint) }
}

pub fn i8p_llcx(llcx: &'ll llvm::Context) -> &'ll Type {
pub fn i8p_llcx(llcx: &llvm::Context) -> &Type {
Type::i8_llcx(llcx).ptr_to()
}

Expand Down
2 changes: 1 addition & 1 deletion src/librustc_data_structures/graph/scc/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ impl<N: Idx, S: Idx> GraphSuccessors<'graph> for Sccs<N, S> {
}

impl<N: Idx, S: Idx> WithSuccessors for Sccs<N, S> {
fn successors<'graph>(&'graph self, node: S) -> <Self as GraphSuccessors<'graph>>::Iter {
fn successors(&self, node: S) -> <Self as GraphSuccessors<'_>>::Iter {
self.successors(node).iter().cloned()
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/librustc_data_structures/graph/vec_graph/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ impl<N: Idx> GraphSuccessors<'graph> for VecGraph<N> {
}

impl<N: Idx> WithSuccessors for VecGraph<N> {
fn successors<'graph>(&'graph self, node: N) -> <Self as GraphSuccessors<'graph>>::Iter {
fn successors(&self, node: N) -> <Self as GraphSuccessors<'_>>::Iter {
self.successors(node).iter().cloned()
}
}
7 changes: 1 addition & 6 deletions src/librustc_driver/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1124,12 +1124,7 @@ fn extra_compiler_flags() -> Option<(Vec<String>, bool)> {
return None;
}

let matches = if let Some(matches) = handle_options(&args) {
matches
} else {
return None;
};

let matches = handle_options(&args)?;
let mut result = Vec::new();
let mut excluded_cargo_defaults = false;
for flag in ICE_REPORT_COMPILER_FLAGS {
Expand Down
22 changes: 11 additions & 11 deletions src/librustc_driver/pretty.rs
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ trait PrinterSupport: pprust::PpAnn {
///
/// (Rust does not yet support upcasting from a trait object to
/// an object for one of its super-traits.)
fn pp_ann<'a>(&'a self) -> &'a dyn pprust::PpAnn;
fn pp_ann(&self) -> &dyn pprust::PpAnn;
}

trait HirPrinterSupport<'hir>: pprust_hir::PpAnn {
Expand All @@ -106,13 +106,13 @@ trait HirPrinterSupport<'hir>: pprust_hir::PpAnn {

/// Provides a uniform interface for re-extracting a reference to an
/// `hir_map::Map` from a value that now owns it.
fn hir_map<'a>(&'a self) -> Option<&'a hir_map::Map<'hir>>;
fn hir_map(&self) -> Option<&hir_map::Map<'hir>>;

/// Produces the pretty-print annotation object.
///
/// (Rust does not yet support upcasting from a trait object to
/// an object for one of its super-traits.)
fn pp_ann<'a>(&'a self) -> &'a dyn pprust_hir::PpAnn;
fn pp_ann(&self) -> &dyn pprust_hir::PpAnn;

/// Computes an user-readable representation of a path, if possible.
fn node_path(&self, id: hir::HirId) -> Option<String> {
Expand All @@ -132,7 +132,7 @@ impl<'hir> PrinterSupport for NoAnn<'hir> {
self.sess
}

fn pp_ann<'a>(&'a self) -> &'a dyn pprust::PpAnn {
fn pp_ann(&self) -> &dyn pprust::PpAnn {
self
}
}
Expand All @@ -142,11 +142,11 @@ impl<'hir> HirPrinterSupport<'hir> for NoAnn<'hir> {
self.sess
}

fn hir_map<'a>(&'a self) -> Option<&'a hir_map::Map<'hir>> {
fn hir_map(&self) -> Option<&hir_map::Map<'hir>> {
self.tcx.map(|tcx| *tcx.hir())
}

fn pp_ann<'a>(&'a self) -> &'a dyn pprust_hir::PpAnn {
fn pp_ann(&self) -> &dyn pprust_hir::PpAnn {
self
}
}
Expand All @@ -170,7 +170,7 @@ impl<'hir> PrinterSupport for IdentifiedAnnotation<'hir> {
self.sess
}

fn pp_ann<'a>(&'a self) -> &'a dyn pprust::PpAnn {
fn pp_ann(&self) -> &dyn pprust::PpAnn {
self
}
}
Expand Down Expand Up @@ -216,11 +216,11 @@ impl<'hir> HirPrinterSupport<'hir> for IdentifiedAnnotation<'hir> {
self.sess
}

fn hir_map<'a>(&'a self) -> Option<&'a hir_map::Map<'hir>> {
fn hir_map(&self) -> Option<&hir_map::Map<'hir>> {
self.tcx.map(|tcx| *tcx.hir())
}

fn pp_ann<'a>(&'a self) -> &'a dyn pprust_hir::PpAnn {
fn pp_ann(&self) -> &dyn pprust_hir::PpAnn {
self
}
}
Expand Down Expand Up @@ -315,11 +315,11 @@ impl<'b, 'tcx> HirPrinterSupport<'tcx> for TypedAnnotation<'b, 'tcx> {
&self.tcx.sess
}

fn hir_map<'a>(&'a self) -> Option<&'a hir_map::Map<'tcx>> {
fn hir_map(&self) -> Option<&hir_map::Map<'tcx>> {
Some(&self.tcx.hir())
}

fn pp_ann<'a>(&'a self) -> &'a dyn pprust_hir::PpAnn {
fn pp_ann(&self) -> &dyn pprust_hir::PpAnn {
self
}

Expand Down
13 changes: 8 additions & 5 deletions src/librustc_expand/mbe/macro_check.rs
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ use rustc_data_structures::fx::FxHashMap;
use rustc_session::lint::builtin::META_VARIABLE_MISUSE;
use rustc_session::parse::ParseSess;
use rustc_span::symbol::kw;
use rustc_span::{symbol::Ident, MultiSpan, Span};
use rustc_span::{symbol::LegacyIdent, MultiSpan, Span};

use smallvec::SmallVec;

Expand Down Expand Up @@ -179,7 +179,7 @@ struct BinderInfo {
}

/// An environment of meta-variables to their binder information.
type Binders = FxHashMap<Ident, BinderInfo>;
type Binders = FxHashMap<LegacyIdent, BinderInfo>;

/// The state at which we entered a macro definition in the RHS of another macro definition.
struct MacroState<'a> {
Expand Down Expand Up @@ -245,6 +245,7 @@ fn check_binders(
if macros.is_empty() {
sess.span_diagnostic.span_bug(span, "unexpected MetaVar in lhs");
}
let name = LegacyIdent::new(name);
// There are 3 possibilities:
if let Some(prev_info) = binders.get(&name) {
// 1. The meta-variable is already bound in the current LHS: This is an error.
Expand All @@ -264,6 +265,7 @@ fn check_binders(
if !macros.is_empty() {
sess.span_diagnostic.span_bug(span, "unexpected MetaVarDecl in nested lhs");
}
let name = LegacyIdent::new(name);
if let Some(prev_info) = get_binder_info(macros, binders, name) {
// Duplicate binders at the top-level macro definition are errors. The lint is only
// for nested macro definitions.
Expand Down Expand Up @@ -300,7 +302,7 @@ fn check_binders(
fn get_binder_info<'a>(
mut macros: &'a Stack<'a, MacroState<'a>>,
binders: &'a Binders,
name: Ident,
name: LegacyIdent,
) -> Option<&'a BinderInfo> {
binders.get(&name).or_else(|| macros.find_map(|state| state.binders.get(&name)))
}
Expand Down Expand Up @@ -331,6 +333,7 @@ fn check_occurrences(
sess.span_diagnostic.span_bug(span, "unexpected MetaVarDecl in rhs")
}
TokenTree::MetaVar(span, name) => {
let name = LegacyIdent::new(name);
check_ops_is_prefix(sess, node_id, macros, binders, ops, span, name);
}
TokenTree::Delimited(_, ref del) => {
Expand Down Expand Up @@ -552,7 +555,7 @@ fn check_ops_is_prefix(
binders: &Binders,
ops: &Stack<'_, KleeneToken>,
span: Span,
name: Ident,
name: LegacyIdent,
) {
let macros = macros.push(MacroState { binders, ops: ops.into() });
// Accumulates the stacks the operators of each state until (and including when) the
Expand Down Expand Up @@ -598,7 +601,7 @@ fn ops_is_prefix(
sess: &ParseSess,
node_id: NodeId,
span: Span,
name: Ident,
name: LegacyIdent,
binder_ops: &[KleeneToken],
occurrence_ops: &[KleeneToken],
) {
Expand Down
Loading