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 16 pull requests #62294

Closed
wants to merge 63 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
63 commits
Select commit Hold shift + click to select a range
0ae61d8
in which the `non_ascii_idents` lint appears (RFC 2457)
zackmdavis Jun 16, 2019
bb26e07
Add debug assertions to write_bytes and copy*
nitnelave Feb 27, 2019
0533f12
Handle null from LLVMRustGetSectionName
nitnelave Mar 27, 2019
8a4573f
format a bit
RalfJung Jun 24, 2019
4159b27
order things more traditionally
RalfJung Jun 24, 2019
a68afc5
ignore some codegen tests in debug mode
RalfJung Jun 25, 2019
d3e1bf9
nits
RalfJung Jun 25, 2019
7262e64
Make FlowAtLocation support borrowing flow data
tmandry Jun 18, 2019
4a8a552
Add DataflowResultsCursor
tmandry Jun 18, 2019
9969417
Add RequiresStorage pass to decide which locals to save in generators
tmandry Jun 18, 2019
c932518
Don't use lift to detect local types
Zoxc May 31, 2019
8465daf
Check for local types in writeback with debug assertions
Zoxc Jun 15, 2019
b2aeb0f
Move some tests in src/test/compile-fail -> src/test/ui.
Centril Jun 27, 2019
2a37582
std: Move a process test out of libstd
alexcrichton Jun 27, 2019
a0e5fcf
import gdb for explicit access to gdb.current_objfile()
cclauss Jun 28, 2019
9527565
Add Vec::leak
cramertj Jun 27, 2019
11b09e7
Add size tests for moved locals in generators
tmandry Jun 21, 2019
aee1357
Remove Clone requirement
tmandry Jun 26, 2019
d8ed2e7
Use RequiresStorage to determine which locals can overlap
tmandry Jun 29, 2019
e2d7df5
Privatize a bunch of methods
Mark-Simulacrum Jun 24, 2019
209bde1
Delete now-unused methods
Mark-Simulacrum Jun 24, 2019
1aff8af
Replace pretty-printer Box<dyn Write> with &mut String
Mark-Simulacrum Jun 24, 2019
da5c835
Remove io::Result from syntax::print
Mark-Simulacrum Jun 24, 2019
ff27756
Remove unused import
Mark-Simulacrum Jun 24, 2019
d26c4b7
Inline rust_printer
Mark-Simulacrum Jun 24, 2019
6d4c642
Use ignore/keep-wasm32 where appropriate.
Centril Jun 29, 2019
dfb9f5b
Add missing links for TryFrom docs
GuillaumeGomez Jun 29, 2019
3e83728
Add missing type urls in Into trait
GuillaumeGomez Jun 27, 2019
9e2714a
Update rustfmt to 1.3.1
topecongiro Jun 30, 2019
0ffb643
Make sure `#[rustc_doc_only_macro]` and other rustc attributes are re…
petrochenkov Jun 29, 2019
e4e7eb2
Feature gate `rustc` attributes harder
petrochenkov Jun 30, 2019
ac4e109
Remove needless lifetimes
jeremystucki Jun 21, 2019
4e184ec
Remove needless lifetimes
jeremystucki Jun 21, 2019
01d8121
Remove needless lifetimes
jeremystucki Jun 21, 2019
a3dda49
Remove needless lifetimes
jeremystucki Jun 21, 2019
69e8a77
Remove needless lifetimes
jeremystucki Jun 21, 2019
856b427
Remove needless lifetimes
jeremystucki Jun 21, 2019
1552d8d
Add missing lifetime specifier
jeremystucki Jun 23, 2019
17c2d6b
Add missing lifetime specifier
jeremystucki Jun 23, 2019
0bee0fb
Add missing lifetime specifier
jeremystucki Jun 23, 2019
37f6aa7
Add missing lifetime specifier
jeremystucki Jun 24, 2019
4c221b3
Revert changes to the standard library
jeremystucki Jun 25, 2019
7e5f6c7
rustc: always keep `hir::Path` behind a `P<...>`.
eddyb Jun 19, 2019
25a9206
syntax: use `box` instead of `Box::new` in `ptr::P`.
eddyb Jun 12, 2019
c6374cf
rustc: use a separate copy of P for HIR than for AST.
eddyb Jun 12, 2019
734d31a
Update phf to get rid of rand 0.4
mati865 Jun 21, 2019
a68e2c7
Clean up extra lifetime, add assertions
tmandry Jul 1, 2019
e58fbbb
Rollup merge of #61871 - Zoxc:no-lift-branch, r=eddyb
Manishearth Jul 2, 2019
af4b62b
Rollup merge of #61883 - zackmdavis:non_ascii_idents_lint, r=Manishearth
Manishearth Jul 2, 2019
2a2d71f
Rollup merge of #61922 - tmandry:moar-generator-optimization, r=matth…
Manishearth Jul 2, 2019
e3204bc
Rollup merge of #61995 - eddyb:hir-sep-ptr, r=petrochenkov
Manishearth Jul 2, 2019
e988c42
Rollup merge of #62026 - mati865:deps, r=alexcrichton
Manishearth Jul 2, 2019
1381760
Rollup merge of #62039 - jeremystucki:needless_lifetimes, r=eddyb
Manishearth Jul 2, 2019
77124e3
Rollup merge of #62099 - Mark-Simulacrum:syntax-print-clean-2, r=eddyb
Manishearth Jul 2, 2019
7982092
Rollup merge of #62103 - RalfJung:debug-assert, r=alexcrichton
Manishearth Jul 2, 2019
62b38c1
Rollup merge of #62133 - petrochenkov:norustc, r=eddyb
Manishearth Jul 2, 2019
b9d4b3b
Rollup merge of #62161 - GuillaumeGomez:add-missing-tryfrom-links, r=…
Manishearth Jul 2, 2019
42d0eb5
Rollup merge of #62177 - Centril:move-some-compile-fail-tests, r=petr…
Manishearth Jul 2, 2019
99d52f7
Rollup merge of #62183 - alexcrichton:fix-tests, r=nikomatsakis
Manishearth Jul 2, 2019
179ed23
Rollup merge of #62186 - GuillaumeGomez:add-missing-type-links-into, …
Manishearth Jul 2, 2019
91376ec
Rollup merge of #62196 - cramertj:vec-leak, r=centril,withoutboats
Manishearth Jul 2, 2019
eef6248
Rollup merge of #62199 - cclauss:patch-1, r=nikomatsakis
Manishearth Jul 2, 2019
fddcb19
Rollup merge of #62244 - topecongiro:rustfmt-1.3.1, r=alexcrichton
Manishearth Jul 2, 2019
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
99 changes: 36 additions & 63 deletions Cargo.lock

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions src/etc/gdb_load_rust_pretty_printers.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
import gdb
import gdb_rust_pretty_printing
gdb_rust_pretty_printing.register_printers(gdb.current_objfile())
34 changes: 34 additions & 0 deletions src/liballoc/vec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1367,6 +1367,40 @@ impl<T> Vec<T> {
self.truncate(new_len);
}
}

/// Consumes and leaks the `Vec`, returning a mutable reference to the contents,
/// `&'a mut [T]`. Note that the type `T` must outlive the chosen lifetime
/// `'a`. If the type has only static references, or none at all, then this
/// may be chosen to be `'static`.
///
/// This function is similar to the `leak` function on `Box`.
///
/// This function is mainly useful for data that lives for the remainder of
/// the program's life. Dropping the returned reference will cause a memory
/// leak.
///
/// # Examples
///
/// Simple usage:
///
/// ```
/// #![feature(vec_leak)]
///
/// fn main() {
/// let x = vec![1, 2, 3];
/// let static_ref: &'static mut [usize] = Vec::leak(x);
/// static_ref[0] += 1;
/// assert_eq!(static_ref, &[2, 2, 3]);
/// }
/// ```
#[unstable(feature = "vec_leak", issue = "62195")]
#[inline]
pub fn leak<'a>(vec: Vec<T>) -> &'a mut [T]
where
T: 'a // Technically not needed, but kept to be explicit.
{
Box::leak(vec.into_boxed_slice())
}
}

impl<T: Clone> Vec<T> {
Expand Down
25 changes: 14 additions & 11 deletions src/libcore/convert.rs
Original file line number Diff line number Diff line change
Expand Up @@ -251,12 +251,12 @@ pub trait AsMut<T: ?Sized> {
///
/// # Examples
///
/// [`String`] implements `Into<Vec<u8>>`:
/// [`String`] implements [`Into`]`<`[`Vec`]`<`[`u8`]`>>`:
///
/// In order to express that we want a generic function to take all arguments that can be
/// converted to a specified type `T`, we can use a trait bound of [`Into`]`<T>`.
/// For example: The function `is_hello` takes all arguments that can be converted into a
/// `Vec<u8>`.
/// [`Vec`]`<`[`u8`]`>`.
///
/// ```
/// fn is_hello<T: Into<Vec<u8>>>(s: T) {
Expand All @@ -274,6 +274,7 @@ pub trait AsMut<T: ?Sized> {
/// [`String`]: ../../std/string/struct.String.html
/// [`From`]: trait.From.html
/// [`Into`]: trait.Into.html
/// [`Vec`]: ../../std/vec/struct.Vec.html
#[stable(feature = "rust1", since = "1.0.0")]
pub trait Into<T>: Sized {
/// Performs the conversion.
Expand Down Expand Up @@ -410,12 +411,12 @@ pub trait TryInto<T>: Sized {
///
/// This is useful when you are doing a type conversion that may
/// trivially succeed but may also need special handling.
/// For example, there is no way to convert an `i64` into an `i32`
/// using the [`From`] trait, because an `i64` may contain a value
/// that an `i32` cannot represent and so the conversion would lose data.
/// This might be handled by truncating the `i64` to an `i32` (essentially
/// giving the `i64`'s value modulo `i32::MAX`) or by simply returning
/// `i32::MAX`, or by some other method. The `From` trait is intended
/// For example, there is no way to convert an [`i64`] into an [`i32`]
/// using the [`From`] trait, because an [`i64`] may contain a value
/// that an [`i32`] cannot represent and so the conversion would lose data.
/// This might be handled by truncating the [`i64`] to an [`i32`] (essentially
/// giving the [`i64`]'s value modulo [`i32::MAX`]) or by simply returning
/// [`i32::MAX`], or by some other method. The [`From`] trait is intended
/// for perfect conversions, so the `TryFrom` trait informs the
/// programmer when a type conversion could go bad and lets them
/// decide how to handle it.
Expand All @@ -425,8 +426,8 @@ pub trait TryInto<T>: Sized {
/// - `TryFrom<T> for U` implies [`TryInto`]`<U> for T`
/// - [`try_from`] is reflexive, which means that `TryFrom<T> for T`
/// is implemented and cannot fail -- the associated `Error` type for
/// calling `T::try_from()` on a value of type `T` is `Infallible`.
/// When the `!` type is stablized `Infallible` and `!` will be
/// calling `T::try_from()` on a value of type `T` is [`Infallible`].
/// When the [`!`] type is stablized [`Infallible`] and [`!`] will be
/// equivalent.
///
/// `TryFrom<T>` can be implemented as follows:
Expand All @@ -451,7 +452,7 @@ pub trait TryInto<T>: Sized {
///
/// # Examples
///
/// As described, [`i32`] implements `TryFrom<i64>`:
/// As described, [`i32`] implements `TryFrom<`[`i64`]`>`:
///
/// ```
/// use std::convert::TryFrom;
Expand All @@ -474,6 +475,8 @@ pub trait TryInto<T>: Sized {
///
/// [`try_from`]: trait.TryFrom.html#tymethod.try_from
/// [`TryInto`]: trait.TryInto.html
/// [`i32::MAX`]: ../../std/i32/constant.MAX.html
/// [`!`]: ../../std/primitive.never.html
#[stable(feature = "try_from", since = "1.34.0")]
pub trait TryFrom<T>: Sized {
/// The type returned in the event of a conversion error.
Expand Down
33 changes: 32 additions & 1 deletion src/libcore/intrinsics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@
issue = "0")]
#![allow(missing_docs)]

use crate::mem;

#[stable(feature = "drop_in_place", since = "1.8.0")]
#[rustc_deprecated(reason = "no longer an intrinsic - use `ptr::drop_in_place` directly",
since = "1.18.0")]
Expand Down Expand Up @@ -1331,6 +1333,26 @@ extern "rust-intrinsic" {
// (`transmute` also falls into this category, but it cannot be wrapped due to the
// check that `T` and `U` have the same size.)

/// Checks whether `ptr` is properly aligned with respect to
/// `align_of::<T>()`.
pub(crate) fn is_aligned_and_not_null<T>(ptr: *const T) -> bool {
!ptr.is_null() && ptr as usize % mem::align_of::<T>() == 0
}

/// Checks whether the regions of memory starting at `src` and `dst` of size
/// `count * size_of::<T>()` overlap.
fn overlaps<T>(src: *const T, dst: *const T, count: usize) -> bool {
let src_usize = src as usize;
let dst_usize = dst as usize;
let size = mem::size_of::<T>().checked_mul(count).unwrap();
let diff = if src_usize > dst_usize {
src_usize - dst_usize
} else {
dst_usize - src_usize
};
size > diff
}

/// Copies `count * size_of::<T>()` bytes from `src` to `dst`. The source
/// and destination must *not* overlap.
///
Expand Down Expand Up @@ -1420,7 +1442,11 @@ pub unsafe fn copy_nonoverlapping<T>(src: *const T, dst: *mut T, count: usize) {
extern "rust-intrinsic" {
fn copy_nonoverlapping<T>(src: *const T, dst: *mut T, count: usize);
}
copy_nonoverlapping(src, dst, count);

debug_assert!(is_aligned_and_not_null(src), "attempt to copy from unaligned or null pointer");
debug_assert!(is_aligned_and_not_null(dst), "attempt to copy to unaligned or null pointer");
debug_assert!(!overlaps(src, dst, count), "attempt to copy to overlapping memory");
copy_nonoverlapping(src, dst, count)
}

/// Copies `count * size_of::<T>()` bytes from `src` to `dst`. The source
Expand Down Expand Up @@ -1480,6 +1506,9 @@ pub unsafe fn copy<T>(src: *const T, dst: *mut T, count: usize) {
extern "rust-intrinsic" {
fn copy<T>(src: *const T, dst: *mut T, count: usize);
}

debug_assert!(is_aligned_and_not_null(src), "attempt to copy from unaligned or null pointer");
debug_assert!(is_aligned_and_not_null(dst), "attempt to copy to unaligned or null pointer");
copy(src, dst, count)
}

Expand Down Expand Up @@ -1561,6 +1590,8 @@ pub unsafe fn write_bytes<T>(dst: *mut T, val: u8, count: usize) {
extern "rust-intrinsic" {
fn write_bytes<T>(dst: *mut T, val: u8, count: usize);
}

debug_assert!(is_aligned_and_not_null(dst), "attempt to write to unaligned or null pointer");
write_bytes(dst, val, count)
}

Expand Down
1 change: 1 addition & 0 deletions src/libcore/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@
#![feature(concat_idents)]
#![feature(const_fn)]
#![feature(const_fn_union)]
#![feature(custom_inner_attributes)]
#![feature(doc_cfg)]
#![feature(doc_spotlight)]
#![feature(extern_types)]
Expand Down
6 changes: 3 additions & 3 deletions src/libcore/slice/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
use crate::cmp::Ordering::{self, Less, Equal, Greater};
use crate::cmp;
use crate::fmt;
use crate::intrinsics::{assume, exact_div, unchecked_sub};
use crate::intrinsics::{assume, exact_div, unchecked_sub, is_aligned_and_not_null};
use crate::isize;
use crate::iter::*;
use crate::ops::{FnMut, Try, self};
Expand Down Expand Up @@ -5213,7 +5213,7 @@ unsafe impl<'a, T> TrustedRandomAccess for RChunksExactMut<'a, T> {
#[inline]
#[stable(feature = "rust1", since = "1.0.0")]
pub unsafe fn from_raw_parts<'a, T>(data: *const T, len: usize) -> &'a [T] {
debug_assert!(data as usize % mem::align_of::<T>() == 0, "attempt to create unaligned slice");
debug_assert!(is_aligned_and_not_null(data), "attempt to create unaligned or null slice");
debug_assert!(mem::size_of::<T>().saturating_mul(len) <= isize::MAX as usize,
"attempt to create slice covering half the address space");
&*ptr::slice_from_raw_parts(data, len)
Expand All @@ -5234,7 +5234,7 @@ pub unsafe fn from_raw_parts<'a, T>(data: *const T, len: usize) -> &'a [T] {
#[inline]
#[stable(feature = "rust1", since = "1.0.0")]
pub unsafe fn from_raw_parts_mut<'a, T>(data: *mut T, len: usize) -> &'a mut [T] {
debug_assert!(data as usize % mem::align_of::<T>() == 0, "attempt to create unaligned slice");
debug_assert!(is_aligned_and_not_null(data), "attempt to create unaligned or null slice");
debug_assert!(mem::size_of::<T>().saturating_mul(len) <= isize::MAX as usize,
"attempt to create slice covering half the address space");
&mut *ptr::slice_from_raw_parts_mut(data, len)
Expand Down
2 changes: 1 addition & 1 deletion src/libproc_macro/bridge/scoped_cell.rs
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ impl<T: LambdaL> ScopedCell<T> {
}

/// Sets the value in `self` to `value` while running `f`.
pub fn set<'a, R>(&self, value: <T as ApplyL<'a>>::Out, f: impl FnOnce() -> R) -> R {
pub fn set<R>(&self, value: <T as ApplyL<'_>>::Out, f: impl FnOnce() -> R) -> R {
self.replace(value, |_| f())
}
}
4 changes: 2 additions & 2 deletions src/librustc/cfg/construct.rs
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
use crate::cfg::*;
use crate::middle::region;
use rustc_data_structures::graph::implementation as graph;
use syntax::ptr::P;
use crate::ty::{self, TyCtxt};

use crate::hir::{self, PatKind};
use crate::hir::def_id::DefId;
use crate::hir::ptr::P;

struct CFGBuilder<'a, 'tcx> {
tcx: TyCtxt<'tcx>,
Expand All @@ -30,7 +30,7 @@ struct LoopScope {
break_index: CFGIndex, // where to go on a `break`
}

pub fn construct<'tcx>(tcx: TyCtxt<'tcx>, body: &hir::Body) -> CFG {
pub fn construct(tcx: TyCtxt<'_>, body: &hir::Body) -> CFG {
let mut graph = graph::Graph::new();
let entry = graph.add_node(CFGNodeData::Entry);

Expand Down
2 changes: 1 addition & 1 deletion src/librustc/cfg/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ pub type CFGNode = graph::Node<CFGNodeData>;
pub type CFGEdge = graph::Edge<CFGEdgeData>;

impl CFG {
pub fn new<'tcx>(tcx: TyCtxt<'tcx>, body: &hir::Body) -> CFG {
pub fn new(tcx: TyCtxt<'_>, body: &hir::Body) -> CFG {
construct::construct(tcx, body)
}

Expand Down
2 changes: 1 addition & 1 deletion src/librustc/dep_graph/graph.rs
Original file line number Diff line number Diff line change
Expand Up @@ -841,7 +841,7 @@ impl DepGraph {
//
// This method will only load queries that will end up in the disk cache.
// Other queries will not be executed.
pub fn exec_cache_promotions<'tcx>(&self, tcx: TyCtxt<'tcx>) {
pub fn exec_cache_promotions(&self, tcx: TyCtxt<'_>) {
let data = self.data.as_ref().unwrap();
for prev_index in data.colors.values.indices() {
match data.colors.get(prev_index) {
Expand Down
2 changes: 1 addition & 1 deletion src/librustc/hir/check_attr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -347,7 +347,7 @@ fn is_c_like_enum(item: &hir::Item) -> bool {
}
}

fn check_mod_attrs<'tcx>(tcx: TyCtxt<'tcx>, module_def_id: DefId) {
fn check_mod_attrs(tcx: TyCtxt<'_>, module_def_id: DefId) {
tcx.hir().visit_item_likes_in_module(
module_def_id,
&mut CheckAttrVisitor { tcx }.as_deep_visitor()
Expand Down
24 changes: 13 additions & 11 deletions src/librustc/hir/lowering.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ use crate::hir::map::{DefKey, DefPathData, Definitions};
use crate::hir::def_id::{DefId, DefIndex, CRATE_DEF_INDEX};
use crate::hir::def::{Res, DefKind, PartialRes, PerNS};
use crate::hir::{GenericArg, ConstArg};
use crate::hir::ptr::P;
use crate::lint::builtin::{self, PARENTHESIZED_PARAMS_IN_TYPES_AND_MODULES,
ELIDED_LIFETIMES_IN_PATHS};
use crate::middle::cstore::CrateStore;
Expand All @@ -61,7 +62,6 @@ use syntax::ast::*;
use syntax::errors;
use syntax::ext::hygiene::{Mark, SyntaxContext};
use syntax::print::pprust;
use syntax::ptr::P;
use syntax::source_map::{self, respan, ExpnInfo, CompilerDesugaringKind, Spanned};
use syntax::source_map::CompilerDesugaringKind::IfTemporary;
use syntax::std_inject;
Expand Down Expand Up @@ -1111,7 +1111,7 @@ impl<'a> LoweringContext<'a> {
},
);

lowered_generics.params = lowered_generics
let mut lowered_params: Vec<_> = lowered_generics
.params
.into_iter()
.chain(in_band_defs)
Expand All @@ -1121,14 +1121,16 @@ impl<'a> LoweringContext<'a> {
// unsorted generic parameters at the moment, so we make sure
// that they're ordered correctly here for now. (When we chain
// the `in_band_defs`, we might make the order unsorted.)
lowered_generics.params.sort_by_key(|param| {
lowered_params.sort_by_key(|param| {
match param.kind {
hir::GenericParamKind::Lifetime { .. } => ParamKindOrd::Lifetime,
hir::GenericParamKind::Type { .. } => ParamKindOrd::Type,
hir::GenericParamKind::Const { .. } => ParamKindOrd::Const,
}
});

lowered_generics.params = lowered_params.into();

(lowered_generics, res)
}

Expand All @@ -1155,13 +1157,13 @@ impl<'a> LoweringContext<'a> {
&mut self,
capture_clause: CaptureBy,
closure_node_id: NodeId,
ret_ty: Option<&Ty>,
ret_ty: Option<syntax::ptr::P<Ty>>,
span: Span,
body: impl FnOnce(&mut LoweringContext<'_>) -> hir::Expr,
) -> hir::ExprKind {
let capture_clause = self.lower_capture_clause(capture_clause);
let output = match ret_ty {
Some(ty) => FunctionRetTy::Ty(P(ty.clone())),
Some(ty) => FunctionRetTy::Ty(ty),
None => FunctionRetTy::Default(span),
};
let ast_decl = FnDecl {
Expand Down Expand Up @@ -2725,7 +2727,7 @@ impl<'a> LoweringContext<'a> {

// ::std::future::Future<future_params>
let future_path =
self.std_path(span, &[sym::future, sym::Future], Some(future_params), false);
P(self.std_path(span, &[sym::future, sym::Future], Some(future_params), false));

hir::GenericBound::Trait(
hir::PolyTraitRef {
Expand Down Expand Up @@ -3094,7 +3096,7 @@ impl<'a> LoweringContext<'a> {

fn lower_trait_ref(&mut self, p: &TraitRef, itctx: ImplTraitContext<'_>) -> hir::TraitRef {
let path = match self.lower_qpath(p.ref_id, &None, &p.path, ParamMode::Explicit, itctx) {
hir::QPath::Resolved(None, path) => path.and_then(|path| path),
hir::QPath::Resolved(None, path) => path,
qpath => bug!("lower_trait_ref: unexpected QPath `{:?}`", qpath),
};
hir::TraitRef {
Expand Down Expand Up @@ -3620,7 +3622,7 @@ impl<'a> LoweringContext<'a> {
hir::Item {
hir_id: new_id,
ident,
attrs: attrs.clone(),
attrs: attrs.into_iter().cloned().collect(),
node: item,
vis,
span,
Expand Down Expand Up @@ -3705,7 +3707,7 @@ impl<'a> LoweringContext<'a> {
hir::Item {
hir_id: new_hir_id,
ident,
attrs: attrs.clone(),
attrs: attrs.into_iter().cloned().collect(),
node: item,
vis,
span: use_tree.span,
Expand Down Expand Up @@ -4567,7 +4569,7 @@ impl<'a> LoweringContext<'a> {
// `|x: u8| future_from_generator(|| -> X { ... })`.
let body_id = this.lower_fn_body(&outer_decl, |this| {
let async_ret_ty = if let FunctionRetTy::Ty(ty) = &decl.output {
Some(&**ty)
Some(ty.clone())
} else { None };
let async_body = this.make_async_expr(
capture_clause, closure_id, async_ret_ty, body.span,
Expand Down Expand Up @@ -5577,7 +5579,7 @@ impl<'a> LoweringContext<'a> {
let principal = hir::PolyTraitRef {
bound_generic_params: hir::HirVec::new(),
trait_ref: hir::TraitRef {
path: path.and_then(|path| path),
path,
hir_ref_id: hir_id,
},
span,
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 @@ -4,7 +4,7 @@ use crate::hir::itemlikevisit::ItemLikeVisitor;
use rustc_data_structures::fx::FxHashSet;
use rustc_data_structures::sync::{Lock, ParallelIterator, par_iter};

pub fn check_crate<'hir>(hir_map: &hir::map::Map<'hir>) {
pub fn check_crate(hir_map: &hir::map::Map<'_>) {
hir_map.dep_graph.assert_ignored();

let errors = Lock::new(Vec::new());
Expand Down
Loading