Auto merge of #78562 - JohnTitor:rollup-otg906u, r=JohnTitor
Rollup of 8 pull requests Successful merges: - #77334 (Reorder benches const variable) - #77888 (Simplify a nested bool match) - #77921 (f64: Refactor collapsible_if) - #78523 (Revert invalid `fn` return type parsing change) - #78524 (Avoid BorrowMutError with RUSTC_LOG=debug) - #78545 (Make anonymous binders start at 0) - #78554 (Improve wording of `core::ptr::drop_in_place` docs) - #78556 (Link to pass docs from NRVO module docs) Failed merges: - #78424 (Fix some more clippy warnings) r? `@ghost`
This commit is contained in:
commit
388ef34904
@ -156,24 +156,13 @@ fn tt_prepend_space(tt: &TokenTree, prev: &TokenTree) -> bool {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
match tt {
|
match tt {
|
||||||
TokenTree::Token(token) => match token.kind {
|
TokenTree::Token(token) => token.kind != token::Comma,
|
||||||
token::Comma => false,
|
TokenTree::Delimited(_, DelimToken::Paren, _) => {
|
||||||
_ => true,
|
!matches!(prev, TokenTree::Token(Token { kind: token::Ident(..), .. }))
|
||||||
},
|
}
|
||||||
TokenTree::Delimited(_, DelimToken::Paren, _) => match prev {
|
TokenTree::Delimited(_, DelimToken::Bracket, _) => {
|
||||||
TokenTree::Token(token) => match token.kind {
|
!matches!(prev, TokenTree::Token(Token { kind: token::Pound, .. }))
|
||||||
token::Ident(_, _) => false,
|
}
|
||||||
_ => true,
|
|
||||||
},
|
|
||||||
_ => true,
|
|
||||||
},
|
|
||||||
TokenTree::Delimited(_, DelimToken::Bracket, _) => match prev {
|
|
||||||
TokenTree::Token(token) => match token.kind {
|
|
||||||
token::Pound => false,
|
|
||||||
_ => true,
|
|
||||||
},
|
|
||||||
_ => true,
|
|
||||||
},
|
|
||||||
TokenTree::Delimited(..) => true,
|
TokenTree::Delimited(..) => true,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -512,7 +512,7 @@ impl<T: Clone> Clone for Lock<T> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug)]
|
#[derive(Debug, Default)]
|
||||||
pub struct RwLock<T>(InnerRwLock<T>);
|
pub struct RwLock<T>(InnerRwLock<T>);
|
||||||
|
|
||||||
impl<T> RwLock<T> {
|
impl<T> RwLock<T> {
|
||||||
|
@ -2042,6 +2042,10 @@ fn encode_metadata_impl(tcx: TyCtxt<'_>) -> EncodedMetadata {
|
|||||||
encoder.emit_raw_bytes(&[0, 0, 0, 0]);
|
encoder.emit_raw_bytes(&[0, 0, 0, 0]);
|
||||||
|
|
||||||
let source_map_files = tcx.sess.source_map().files();
|
let source_map_files = tcx.sess.source_map().files();
|
||||||
|
let source_file_cache = (source_map_files[0].clone(), 0);
|
||||||
|
let required_source_files = Some(GrowableBitSet::with_capacity(source_map_files.len()));
|
||||||
|
drop(source_map_files);
|
||||||
|
|
||||||
let hygiene_ctxt = HygieneEncodeContext::default();
|
let hygiene_ctxt = HygieneEncodeContext::default();
|
||||||
|
|
||||||
let mut ecx = EncodeContext {
|
let mut ecx = EncodeContext {
|
||||||
@ -2052,13 +2056,12 @@ fn encode_metadata_impl(tcx: TyCtxt<'_>) -> EncodedMetadata {
|
|||||||
lazy_state: LazyState::NoNode,
|
lazy_state: LazyState::NoNode,
|
||||||
type_shorthands: Default::default(),
|
type_shorthands: Default::default(),
|
||||||
predicate_shorthands: Default::default(),
|
predicate_shorthands: Default::default(),
|
||||||
source_file_cache: (source_map_files[0].clone(), 0),
|
source_file_cache,
|
||||||
interpret_allocs: Default::default(),
|
interpret_allocs: Default::default(),
|
||||||
required_source_files: Some(GrowableBitSet::with_capacity(source_map_files.len())),
|
required_source_files,
|
||||||
is_proc_macro: tcx.sess.crate_types().contains(&CrateType::ProcMacro),
|
is_proc_macro: tcx.sess.crate_types().contains(&CrateType::ProcMacro),
|
||||||
hygiene_ctxt: &hygiene_ctxt,
|
hygiene_ctxt: &hygiene_ctxt,
|
||||||
};
|
};
|
||||||
drop(source_map_files);
|
|
||||||
|
|
||||||
// Encode the rustc version string in a predictable location.
|
// Encode the rustc version string in a predictable location.
|
||||||
rustc_version().encode(&mut ecx).unwrap();
|
rustc_version().encode(&mut ecx).unwrap();
|
||||||
|
@ -684,7 +684,7 @@ impl<'tcx> TyCtxt<'tcx> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Rewrite any late-bound regions so that they are anonymous. Region numbers are
|
/// Rewrite any late-bound regions so that they are anonymous. Region numbers are
|
||||||
/// assigned starting at 1 and increasing monotonically in the order traversed
|
/// assigned starting at 0 and increasing monotonically in the order traversed
|
||||||
/// by the fold operation.
|
/// by the fold operation.
|
||||||
///
|
///
|
||||||
/// The chief purpose of this function is to canonicalize regions so that two
|
/// The chief purpose of this function is to canonicalize regions so that two
|
||||||
@ -698,8 +698,9 @@ impl<'tcx> TyCtxt<'tcx> {
|
|||||||
let mut counter = 0;
|
let mut counter = 0;
|
||||||
Binder::bind(
|
Binder::bind(
|
||||||
self.replace_late_bound_regions(sig, |_| {
|
self.replace_late_bound_regions(sig, |_| {
|
||||||
|
let r = self.mk_region(ty::ReLateBound(ty::INNERMOST, ty::BrAnon(counter)));
|
||||||
counter += 1;
|
counter += 1;
|
||||||
self.mk_region(ty::ReLateBound(ty::INNERMOST, ty::BrAnon(counter)))
|
r
|
||||||
})
|
})
|
||||||
.0,
|
.0,
|
||||||
)
|
)
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
|
//! See the docs for [`RenameReturnPlace`].
|
||||||
|
|
||||||
use rustc_hir::Mutability;
|
use rustc_hir::Mutability;
|
||||||
use rustc_index::bit_set::HybridBitSet;
|
use rustc_index::bit_set::HybridBitSet;
|
||||||
use rustc_middle::mir::visit::{MutVisitor, NonUseContext, PlaceContext, Visitor};
|
use rustc_middle::mir::visit::{MutVisitor, NonUseContext, PlaceContext, Visitor};
|
||||||
|
@ -1666,19 +1666,10 @@ impl<'a> Parser<'a> {
|
|||||||
req_name: ReqName,
|
req_name: ReqName,
|
||||||
ret_allow_plus: AllowPlus,
|
ret_allow_plus: AllowPlus,
|
||||||
) -> PResult<'a, P<FnDecl>> {
|
) -> PResult<'a, P<FnDecl>> {
|
||||||
let inputs = self.parse_fn_params(req_name)?;
|
Ok(P(FnDecl {
|
||||||
let output = self.parse_ret_ty(ret_allow_plus, RecoverQPath::Yes)?;
|
inputs: self.parse_fn_params(req_name)?,
|
||||||
|
output: self.parse_ret_ty(ret_allow_plus, RecoverQPath::Yes)?,
|
||||||
if let ast::FnRetTy::Ty(ty) = &output {
|
}))
|
||||||
if let TyKind::Path(_, Path { segments, .. }) = &ty.kind {
|
|
||||||
if let [.., last] = &segments[..] {
|
|
||||||
// Detect and recover `fn foo() -> Vec<i32>> {}`
|
|
||||||
self.check_trailing_angle_brackets(last, &[&token::OpenDelim(token::Brace)]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Ok(P(FnDecl { inputs, output }))
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Parses the parameter list of a function, including the `(` and `)` delimiters.
|
/// Parses the parameter list of a function, including the `(` and `)` delimiters.
|
||||||
|
@ -12,7 +12,7 @@ pub use crate::*;
|
|||||||
|
|
||||||
use rustc_data_structures::fx::FxHashMap;
|
use rustc_data_structures::fx::FxHashMap;
|
||||||
use rustc_data_structures::stable_hasher::StableHasher;
|
use rustc_data_structures::stable_hasher::StableHasher;
|
||||||
use rustc_data_structures::sync::{AtomicU32, Lock, LockGuard, Lrc, MappedLockGuard};
|
use rustc_data_structures::sync::{AtomicU32, Lrc, MappedReadGuard, ReadGuard, RwLock};
|
||||||
use std::cmp;
|
use std::cmp;
|
||||||
use std::convert::TryFrom;
|
use std::convert::TryFrom;
|
||||||
use std::hash::Hash;
|
use std::hash::Hash;
|
||||||
@ -168,7 +168,7 @@ pub struct SourceMap {
|
|||||||
/// The address space below this value is currently used by the files in the source map.
|
/// The address space below this value is currently used by the files in the source map.
|
||||||
used_address_space: AtomicU32,
|
used_address_space: AtomicU32,
|
||||||
|
|
||||||
files: Lock<SourceMapFiles>,
|
files: RwLock<SourceMapFiles>,
|
||||||
file_loader: Box<dyn FileLoader + Sync + Send>,
|
file_loader: Box<dyn FileLoader + Sync + Send>,
|
||||||
// This is used to apply the file path remapping as specified via
|
// This is used to apply the file path remapping as specified via
|
||||||
// `--remap-path-prefix` to all `SourceFile`s allocated within this `SourceMap`.
|
// `--remap-path-prefix` to all `SourceFile`s allocated within this `SourceMap`.
|
||||||
@ -236,8 +236,8 @@ impl SourceMap {
|
|||||||
|
|
||||||
// By returning a `MonotonicVec`, we ensure that consumers cannot invalidate
|
// By returning a `MonotonicVec`, we ensure that consumers cannot invalidate
|
||||||
// any existing indices pointing into `files`.
|
// any existing indices pointing into `files`.
|
||||||
pub fn files(&self) -> MappedLockGuard<'_, monotonic::MonotonicVec<Lrc<SourceFile>>> {
|
pub fn files(&self) -> MappedReadGuard<'_, monotonic::MonotonicVec<Lrc<SourceFile>>> {
|
||||||
LockGuard::map(self.files.borrow(), |files| &mut files.source_files)
|
ReadGuard::map(self.files.borrow(), |files| &files.source_files)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn source_file_by_stable_id(
|
pub fn source_file_by_stable_id(
|
||||||
|
@ -200,15 +200,9 @@ impl SymbolMangler<'tcx> {
|
|||||||
|
|
||||||
let lifetimes = regions
|
let lifetimes = regions
|
||||||
.into_iter()
|
.into_iter()
|
||||||
.map(|br| {
|
.map(|br| match br {
|
||||||
match br {
|
ty::BrAnon(i) => i,
|
||||||
ty::BrAnon(i) => {
|
_ => bug!("symbol_names: non-anonymized region `{:?}` in `{:?}`", br, value),
|
||||||
// FIXME(eddyb) for some reason, `anonymize_late_bound_regions` starts at `1`.
|
|
||||||
assert_ne!(i, 0);
|
|
||||||
i - 1
|
|
||||||
}
|
|
||||||
_ => bug!("symbol_names: non-anonymized region `{:?}` in `{:?}`", br, value),
|
|
||||||
}
|
|
||||||
})
|
})
|
||||||
.max()
|
.max()
|
||||||
.map_or(0, |max| max + 1);
|
.map_or(0, |max| max + 1);
|
||||||
@ -327,10 +321,6 @@ impl Printer<'tcx> for SymbolMangler<'tcx> {
|
|||||||
// Late-bound lifetimes use indices starting at 1,
|
// Late-bound lifetimes use indices starting at 1,
|
||||||
// see `BinderLevel` for more details.
|
// see `BinderLevel` for more details.
|
||||||
ty::ReLateBound(debruijn, ty::BrAnon(i)) => {
|
ty::ReLateBound(debruijn, ty::BrAnon(i)) => {
|
||||||
// FIXME(eddyb) for some reason, `anonymize_late_bound_regions` starts at `1`.
|
|
||||||
assert_ne!(i, 0);
|
|
||||||
let i = i - 1;
|
|
||||||
|
|
||||||
let binder = &self.binders[self.binders.len() - 1 - debruijn.index()];
|
let binder = &self.binders[self.binders.len() - 1 - debruijn.index()];
|
||||||
let depth = binder.lifetime_depths.start + i;
|
let depth = binder.lifetime_depths.start + i;
|
||||||
|
|
||||||
|
@ -186,8 +186,9 @@ pub fn resolve_interior<'a, 'tcx>(
|
|||||||
// which means that none of the regions inside relate to any other, even if
|
// which means that none of the regions inside relate to any other, even if
|
||||||
// typeck had previously found constraints that would cause them to be related.
|
// typeck had previously found constraints that would cause them to be related.
|
||||||
let folded = fcx.tcx.fold_regions(&erased, &mut false, |_, current_depth| {
|
let folded = fcx.tcx.fold_regions(&erased, &mut false, |_, current_depth| {
|
||||||
|
let r = fcx.tcx.mk_region(ty::ReLateBound(current_depth, ty::BrAnon(counter)));
|
||||||
counter += 1;
|
counter += 1;
|
||||||
fcx.tcx.mk_region(ty::ReLateBound(current_depth, ty::BrAnon(counter)))
|
r
|
||||||
});
|
});
|
||||||
|
|
||||||
cause.ty = folded;
|
cause.ty = folded;
|
||||||
|
@ -570,6 +570,8 @@ fn bench_in_place_collect_droppable(b: &mut Bencher) {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const LEN: usize = 16384;
|
||||||
|
|
||||||
#[bench]
|
#[bench]
|
||||||
fn bench_chain_collect(b: &mut Bencher) {
|
fn bench_chain_collect(b: &mut Bencher) {
|
||||||
let data = black_box([0; LEN]);
|
let data = black_box([0; LEN]);
|
||||||
@ -613,8 +615,6 @@ pub fn map_fast(l: &[(u32, u32)]) -> Vec<u32> {
|
|||||||
result
|
result
|
||||||
}
|
}
|
||||||
|
|
||||||
const LEN: usize = 16384;
|
|
||||||
|
|
||||||
#[bench]
|
#[bench]
|
||||||
fn bench_range_map_collect(b: &mut Bencher) {
|
fn bench_range_map_collect(b: &mut Bencher) {
|
||||||
b.iter(|| (0..LEN).map(|_| u32::default()).collect::<Vec<_>>());
|
b.iter(|| (0..LEN).map(|_| u32::default()).collect::<Vec<_>>());
|
||||||
|
@ -99,9 +99,9 @@ mod mut_ptr;
|
|||||||
/// dropped normally.
|
/// dropped normally.
|
||||||
///
|
///
|
||||||
/// * It is friendlier to the optimizer to do this over [`ptr::read`] when
|
/// * It is friendlier to the optimizer to do this over [`ptr::read`] when
|
||||||
/// dropping manually allocated memory (e.g., when writing Box/Rc/Vec),
|
/// dropping manually allocated memory (e.g., in the implementations of
|
||||||
/// as the compiler doesn't need to prove that it's sound to elide the
|
/// `Box`/`Rc`/`Vec`), as the compiler doesn't need to prove that it's
|
||||||
/// copy.
|
/// sound to elide the copy.
|
||||||
///
|
///
|
||||||
/// * It can be used to drop [pinned] data when `T` is not `repr(packed)`
|
/// * It can be used to drop [pinned] data when `T` is not `repr(packed)`
|
||||||
/// (pinned data must not be moved before it is dropped).
|
/// (pinned data must not be moved before it is dropped).
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
//! This module provides constants which are specific to the implementation
|
//! This module provides constants which are specific to the implementation
|
||||||
//! of the `f32` floating point data type.
|
//! of the `f32` floating point data type.
|
||||||
//!
|
//!
|
||||||
//! *[See also the `f32` primitive type](../../std/primitive.f32.html).*
|
//! *[See also the `f32` primitive type](primitive@f32).*
|
||||||
//!
|
//!
|
||||||
//! Mathematically significant numbers are provided in the `consts` sub-module.
|
//! Mathematically significant numbers are provided in the `consts` sub-module.
|
||||||
//!
|
//!
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
//! This module provides constants which are specific to the implementation
|
//! This module provides constants which are specific to the implementation
|
||||||
//! of the `f64` floating point data type.
|
//! of the `f64` floating point data type.
|
||||||
//!
|
//!
|
||||||
//! *[See also the `f64` primitive type](../../std/primitive.f64.html).*
|
//! *[See also the `f64` primitive type](primitive@f64).*
|
||||||
//!
|
//!
|
||||||
//! Mathematically significant numbers are provided in the `consts` sub-module.
|
//! Mathematically significant numbers are provided in the `consts` sub-module.
|
||||||
//!
|
//!
|
||||||
@ -920,22 +920,20 @@ impl f64 {
|
|||||||
fn log_wrapper<F: Fn(f64) -> f64>(self, log_fn: F) -> f64 {
|
fn log_wrapper<F: Fn(f64) -> f64>(self, log_fn: F) -> f64 {
|
||||||
if !cfg!(any(target_os = "solaris", target_os = "illumos")) {
|
if !cfg!(any(target_os = "solaris", target_os = "illumos")) {
|
||||||
log_fn(self)
|
log_fn(self)
|
||||||
} else {
|
} else if self.is_finite() {
|
||||||
if self.is_finite() {
|
if self > 0.0 {
|
||||||
if self > 0.0 {
|
log_fn(self)
|
||||||
log_fn(self)
|
} else if self == 0.0 {
|
||||||
} else if self == 0.0 {
|
Self::NEG_INFINITY // log(0) = -Inf
|
||||||
Self::NEG_INFINITY // log(0) = -Inf
|
|
||||||
} else {
|
|
||||||
Self::NAN // log(-n) = NaN
|
|
||||||
}
|
|
||||||
} else if self.is_nan() {
|
|
||||||
self // log(NaN) = NaN
|
|
||||||
} else if self > 0.0 {
|
|
||||||
self // log(Inf) = Inf
|
|
||||||
} else {
|
} else {
|
||||||
Self::NAN // log(-Inf) = NaN
|
Self::NAN // log(-n) = NaN
|
||||||
}
|
}
|
||||||
|
} else if self.is_nan() {
|
||||||
|
self // log(NaN) = NaN
|
||||||
|
} else if self > 0.0 {
|
||||||
|
self // log(Inf) = Inf
|
||||||
|
} else {
|
||||||
|
Self::NAN // log(-Inf) = NaN
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
1
src/test/ui/auxiliary/rustc-rust-log-aux.rs
Normal file
1
src/test/ui/auxiliary/rustc-rust-log-aux.rs
Normal file
@ -0,0 +1 @@
|
|||||||
|
// rustc-env:RUSTC_LOG=debug
|
@ -6,7 +6,7 @@ LL | with_closure_expecting_fn_with_free_region(|x: fn(&'x u32), y| {});
|
|||||||
|
|
|
|
||||||
= note: expected fn pointer `fn(&u32)`
|
= note: expected fn pointer `fn(&u32)`
|
||||||
found fn pointer `fn(&'x u32)`
|
found fn pointer `fn(&'x u32)`
|
||||||
note: the anonymous lifetime #2 defined on the body at 16:48...
|
note: the anonymous lifetime #1 defined on the body at 16:48...
|
||||||
--> $DIR/expect-fn-supply-fn.rs:16:48
|
--> $DIR/expect-fn-supply-fn.rs:16:48
|
||||||
|
|
|
|
||||||
LL | with_closure_expecting_fn_with_free_region(|x: fn(&'x u32), y| {});
|
LL | with_closure_expecting_fn_with_free_region(|x: fn(&'x u32), y| {});
|
||||||
@ -30,7 +30,7 @@ note: the lifetime `'x` as defined on the function body at 13:36...
|
|||||||
|
|
|
|
||||||
LL | fn expect_free_supply_free_from_fn<'x>(x: &'x u32) {
|
LL | fn expect_free_supply_free_from_fn<'x>(x: &'x u32) {
|
||||||
| ^^
|
| ^^
|
||||||
note: ...does not necessarily outlive the anonymous lifetime #2 defined on the body at 16:48
|
note: ...does not necessarily outlive the anonymous lifetime #1 defined on the body at 16:48
|
||||||
--> $DIR/expect-fn-supply-fn.rs:16:48
|
--> $DIR/expect-fn-supply-fn.rs:16:48
|
||||||
|
|
|
|
||||||
LL | with_closure_expecting_fn_with_free_region(|x: fn(&'x u32), y| {});
|
LL | with_closure_expecting_fn_with_free_region(|x: fn(&'x u32), y| {});
|
||||||
|
@ -6,7 +6,7 @@ LL | closure_expecting_bound(|x: &'x u32| {
|
|||||||
|
|
|
|
||||||
= note: expected reference `&u32`
|
= note: expected reference `&u32`
|
||||||
found reference `&'x u32`
|
found reference `&'x u32`
|
||||||
note: the anonymous lifetime #2 defined on the body at 14:29...
|
note: the anonymous lifetime #1 defined on the body at 14:29...
|
||||||
--> $DIR/expect-region-supply-region-2.rs:14:29
|
--> $DIR/expect-region-supply-region-2.rs:14:29
|
||||||
|
|
|
|
||||||
LL | closure_expecting_bound(|x: &'x u32| {
|
LL | closure_expecting_bound(|x: &'x u32| {
|
||||||
@ -37,7 +37,7 @@ note: the lifetime `'x` as defined on the function body at 9:30...
|
|||||||
|
|
|
|
||||||
LL | fn expect_bound_supply_named<'x>() {
|
LL | fn expect_bound_supply_named<'x>() {
|
||||||
| ^^
|
| ^^
|
||||||
note: ...does not necessarily outlive the anonymous lifetime #2 defined on the body at 14:29
|
note: ...does not necessarily outlive the anonymous lifetime #1 defined on the body at 14:29
|
||||||
--> $DIR/expect-region-supply-region-2.rs:14:29
|
--> $DIR/expect-region-supply-region-2.rs:14:29
|
||||||
|
|
|
|
||||||
LL | closure_expecting_bound(|x: &'x u32| {
|
LL | closure_expecting_bound(|x: &'x u32| {
|
||||||
|
@ -4,7 +4,7 @@ error[E0312]: lifetime of reference outlives lifetime of borrowed content...
|
|||||||
LL | x
|
LL | x
|
||||||
| ^
|
| ^
|
||||||
|
|
|
|
||||||
note: ...the reference is valid for the anonymous lifetime #2 defined on the body at 2:69...
|
note: ...the reference is valid for the anonymous lifetime #1 defined on the body at 2:69...
|
||||||
--> $DIR/issue-10291.rs:2:69
|
--> $DIR/issue-10291.rs:2:69
|
||||||
|
|
|
|
||||||
LL | drop::<Box<dyn for<'z> FnMut(&'z isize) -> &'z isize>>(Box::new(|z| {
|
LL | drop::<Box<dyn for<'z> FnMut(&'z isize) -> &'z isize>>(Box::new(|z| {
|
||||||
|
@ -6,12 +6,12 @@ LL | gimme(|x, y| y)
|
|||||||
|
|
|
|
||||||
= note: expected reference `&Foo<'_, '_, u32>`
|
= note: expected reference `&Foo<'_, '_, u32>`
|
||||||
found reference `&Foo<'_, '_, u32>`
|
found reference `&Foo<'_, '_, u32>`
|
||||||
note: the anonymous lifetime #4 defined on the body at 9:11...
|
note: the anonymous lifetime #3 defined on the body at 9:11...
|
||||||
--> $DIR/issue-52533-1.rs:9:11
|
--> $DIR/issue-52533-1.rs:9:11
|
||||||
|
|
|
|
||||||
LL | gimme(|x, y| y)
|
LL | gimme(|x, y| y)
|
||||||
| ^^^^^^^^
|
| ^^^^^^^^
|
||||||
note: ...does not necessarily outlive the anonymous lifetime #3 defined on the body at 9:11
|
note: ...does not necessarily outlive the anonymous lifetime #2 defined on the body at 9:11
|
||||||
--> $DIR/issue-52533-1.rs:9:11
|
--> $DIR/issue-52533-1.rs:9:11
|
||||||
|
|
|
|
||||||
LL | gimme(|x, y| y)
|
LL | gimme(|x, y| y)
|
||||||
|
@ -4,12 +4,12 @@ error[E0312]: lifetime of reference outlives lifetime of borrowed content...
|
|||||||
LL | foo(|a, b| b)
|
LL | foo(|a, b| b)
|
||||||
| ^
|
| ^
|
||||||
|
|
|
|
||||||
note: ...the reference is valid for the anonymous lifetime #2 defined on the body at 5:9...
|
note: ...the reference is valid for the anonymous lifetime #1 defined on the body at 5:9...
|
||||||
--> $DIR/issue-52533.rs:5:9
|
--> $DIR/issue-52533.rs:5:9
|
||||||
|
|
|
|
||||||
LL | foo(|a, b| b)
|
LL | foo(|a, b| b)
|
||||||
| ^^^^^^^^
|
| ^^^^^^^^
|
||||||
note: ...but the borrowed content is only valid for the anonymous lifetime #3 defined on the body at 5:9
|
note: ...but the borrowed content is only valid for the anonymous lifetime #2 defined on the body at 5:9
|
||||||
--> $DIR/issue-52533.rs:5:9
|
--> $DIR/issue-52533.rs:5:9
|
||||||
|
|
|
|
||||||
LL | foo(|a, b| b)
|
LL | foo(|a, b| b)
|
||||||
|
6
src/test/ui/parser/fn-returns-fn-pointer.rs
Normal file
6
src/test/ui/parser/fn-returns-fn-pointer.rs
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
// check-pass
|
||||||
|
// Regression test for #78507.
|
||||||
|
fn foo() -> Option<fn() -> Option<bool>> {
|
||||||
|
Some(|| Some(true))
|
||||||
|
}
|
||||||
|
fn main() {}
|
@ -1,8 +1,8 @@
|
|||||||
// Verify that '>' is not both expected and found at the same time, as it used
|
// Verify that '>' is not both expected and found at the same time, as it used
|
||||||
// to happen in #24780. For example, following should be an error:
|
// to happen in #24780. For example, following should be an error:
|
||||||
// expected one of ..., `>`, ... found `>`. No longer exactly this, but keeping for posterity.
|
// expected one of ..., `>`, ... found `>`.
|
||||||
|
|
||||||
fn foo() -> Vec<usize>> { //~ ERROR unmatched angle bracket
|
fn foo() -> Vec<usize>> { //~ ERROR expected one of `!`, `+`, `::`, `;`, `where`, or `{`, found `>`
|
||||||
Vec::new()
|
Vec::new()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
error: unmatched angle bracket
|
error: expected one of `!`, `+`, `::`, `;`, `where`, or `{`, found `>`
|
||||||
--> $DIR/issue-24780.rs:5:23
|
--> $DIR/issue-24780.rs:5:23
|
||||||
|
|
|
|
||||||
LL | fn foo() -> Vec<usize>> {
|
LL | fn foo() -> Vec<usize>> {
|
||||||
| ^^ help: remove extra angle bracket
|
| ^ expected one of `!`, `+`, `::`, `;`, `where`, or `{`
|
||||||
|
|
||||||
error: aborting due to previous error
|
error: aborting due to previous error
|
||||||
|
|
||||||
|
@ -4,7 +4,7 @@ error[E0495]: cannot infer an appropriate lifetime due to conflicting requiremen
|
|||||||
LL | let mut ay = &y;
|
LL | let mut ay = &y;
|
||||||
| ^^
|
| ^^
|
||||||
|
|
|
|
||||||
note: first, the lifetime cannot outlive the anonymous lifetime #2 defined on the body at 7:58...
|
note: first, the lifetime cannot outlive the anonymous lifetime #1 defined on the body at 7:58...
|
||||||
--> $DIR/regions-nested-fns.rs:7:58
|
--> $DIR/regions-nested-fns.rs:7:58
|
||||||
|
|
|
|
||||||
LL | ignore::<Box<dyn for<'z> FnMut(&'z isize)>>(Box::new(|z| {
|
LL | ignore::<Box<dyn for<'z> FnMut(&'z isize)>>(Box::new(|z| {
|
||||||
@ -19,7 +19,7 @@ note: ...so that reference does not outlive borrowed content
|
|||||||
|
|
|
|
||||||
LL | ay = z;
|
LL | ay = z;
|
||||||
| ^
|
| ^
|
||||||
note: but, the lifetime must be valid for the anonymous lifetime #2 defined on the body at 13:72...
|
note: but, the lifetime must be valid for the anonymous lifetime #1 defined on the body at 13:72...
|
||||||
--> $DIR/regions-nested-fns.rs:13:72
|
--> $DIR/regions-nested-fns.rs:13:72
|
||||||
|
|
|
|
||||||
LL | ignore::< Box<dyn for<'z> FnMut(&'z isize) -> &'z isize>>(Box::new(|z| {
|
LL | ignore::< Box<dyn for<'z> FnMut(&'z isize) -> &'z isize>>(Box::new(|z| {
|
||||||
@ -48,7 +48,7 @@ error[E0312]: lifetime of reference outlives lifetime of borrowed content...
|
|||||||
LL | if false { return x; }
|
LL | if false { return x; }
|
||||||
| ^
|
| ^
|
||||||
|
|
|
|
||||||
note: ...the reference is valid for the anonymous lifetime #2 defined on the body at 13:72...
|
note: ...the reference is valid for the anonymous lifetime #1 defined on the body at 13:72...
|
||||||
--> $DIR/regions-nested-fns.rs:13:72
|
--> $DIR/regions-nested-fns.rs:13:72
|
||||||
|
|
|
|
||||||
LL | ignore::< Box<dyn for<'z> FnMut(&'z isize) -> &'z isize>>(Box::new(|z| {
|
LL | ignore::< Box<dyn for<'z> FnMut(&'z isize) -> &'z isize>>(Box::new(|z| {
|
||||||
|
@ -4,7 +4,7 @@ error[E0495]: cannot infer an appropriate lifetime due to conflicting requiremen
|
|||||||
LL | with(|o| o)
|
LL | with(|o| o)
|
||||||
| ^
|
| ^
|
||||||
|
|
|
|
||||||
note: first, the lifetime cannot outlive the anonymous lifetime #2 defined on the body at 10:10...
|
note: first, the lifetime cannot outlive the anonymous lifetime #1 defined on the body at 10:10...
|
||||||
--> $DIR/regions-ret-borrowed-1.rs:10:10
|
--> $DIR/regions-ret-borrowed-1.rs:10:10
|
||||||
|
|
|
|
||||||
LL | with(|o| o)
|
LL | with(|o| o)
|
||||||
|
@ -4,7 +4,7 @@ error[E0495]: cannot infer an appropriate lifetime due to conflicting requiremen
|
|||||||
LL | with(|o| o)
|
LL | with(|o| o)
|
||||||
| ^
|
| ^
|
||||||
|
|
|
|
||||||
note: first, the lifetime cannot outlive the anonymous lifetime #2 defined on the body at 13:10...
|
note: first, the lifetime cannot outlive the anonymous lifetime #1 defined on the body at 13:10...
|
||||||
--> $DIR/regions-ret-borrowed.rs:13:10
|
--> $DIR/regions-ret-borrowed.rs:13:10
|
||||||
|
|
|
|
||||||
LL | with(|o| o)
|
LL | with(|o| o)
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
// dont-check-compiler-stdout
|
// dont-check-compiler-stdout
|
||||||
// dont-check-compiler-stderr
|
// dont-check-compiler-stderr
|
||||||
// compile-flags: --error-format human
|
// compile-flags: --error-format human
|
||||||
|
// aux-build: rustc-rust-log-aux.rs
|
||||||
// rustc-env:RUSTC_LOG=debug
|
// rustc-env:RUSTC_LOG=debug
|
||||||
|
|
||||||
fn main() {}
|
fn main() {}
|
||||||
|
@ -4,7 +4,7 @@ error[E0312]: lifetime of reference outlives lifetime of borrowed content...
|
|||||||
LL | x.set(y);
|
LL | x.set(y);
|
||||||
| ^
|
| ^
|
||||||
|
|
|
|
||||||
note: ...the reference is valid for the anonymous lifetime #3 defined on the body at 16:14...
|
note: ...the reference is valid for the anonymous lifetime #2 defined on the body at 16:14...
|
||||||
--> $DIR/unboxed-closures-infer-argument-types-two-region-pointers.rs:16:14
|
--> $DIR/unboxed-closures-infer-argument-types-two-region-pointers.rs:16:14
|
||||||
|
|
|
|
||||||
LL | doit(0, &|x, y| {
|
LL | doit(0, &|x, y| {
|
||||||
@ -12,7 +12,7 @@ LL | doit(0, &|x, y| {
|
|||||||
LL | | x.set(y);
|
LL | | x.set(y);
|
||||||
LL | | });
|
LL | | });
|
||||||
| |_____^
|
| |_____^
|
||||||
note: ...but the borrowed content is only valid for the anonymous lifetime #4 defined on the body at 16:14
|
note: ...but the borrowed content is only valid for the anonymous lifetime #3 defined on the body at 16:14
|
||||||
--> $DIR/unboxed-closures-infer-argument-types-two-region-pointers.rs:16:14
|
--> $DIR/unboxed-closures-infer-argument-types-two-region-pointers.rs:16:14
|
||||||
|
|
|
|
||||||
LL | doit(0, &|x, y| {
|
LL | doit(0, &|x, y| {
|
||||||
|
@ -1775,6 +1775,11 @@ impl<'test> TestCx<'test> {
|
|||||||
let mut aux_rustc =
|
let mut aux_rustc =
|
||||||
aux_cx.make_compile_args(input_file, aux_output, EmitMetadata::No, AllowUnused::No);
|
aux_cx.make_compile_args(input_file, aux_output, EmitMetadata::No, AllowUnused::No);
|
||||||
|
|
||||||
|
for key in &aux_props.unset_rustc_env {
|
||||||
|
aux_rustc.env_remove(key);
|
||||||
|
}
|
||||||
|
aux_rustc.envs(aux_props.rustc_env.clone());
|
||||||
|
|
||||||
let (dylib, crate_type) = if aux_props.no_prefer_dynamic {
|
let (dylib, crate_type) = if aux_props.no_prefer_dynamic {
|
||||||
(true, None)
|
(true, None)
|
||||||
} else if self.config.target.contains("cloudabi")
|
} else if self.config.target.contains("cloudabi")
|
||||||
|
Loading…
Reference in New Issue
Block a user