Auto merge of #89549 - Manishearth:rollup-mhkyc16, r=Manishearth

Rollup of 12 pull requests

Successful merges:

 - #87631 (os current_exe using same approach as linux to get always the full ab…)
 - #88234 (rustdoc-json: Don't ignore impls for primitive types)
 - #88651 (Use the 64b inner:monotonize() implementation not the 128b one for aarch64)
 - #88816 (Rustdoc migrate to table so the gui can handle >2k constants)
 - #89244 (refactor: VecDeques PairSlices fields to private)
 - #89364 (rustdoc-json: Encode json files with UTF-8)
 - #89423 (Fix ICE caused by non_exaustive_omitted_patterns struct lint)
 - #89426 (bootstrap: add config option for nix patching)
 - #89462 (haiku thread affinity build fix)
 - #89482 (Follow the diagnostic output style guide)
 - #89504 (Don't suggest replacing region with 'static in NLL)
 - #89535 (fix busted JavaScript in error index generator)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
This commit is contained in:
bors 2021-10-05 06:56:57 +00:00
commit 074f63648b
94 changed files with 230 additions and 340 deletions

View File

@ -171,9 +171,7 @@ impl OutlivesSuggestionBuilder {
let outlived_fr_name = self.region_vid_to_name(mbcx, errci.outlived_fr);
if let (Some(fr_name), Some(outlived_fr_name)) = (fr_name, outlived_fr_name) {
if let RegionNameSource::Static = outlived_fr_name.source {
diag.help(&format!("consider replacing `{}` with `'static`", fr_name));
} else {
if !matches!(outlived_fr_name.source, RegionNameSource::Static) {
diag.help(&format!(
"consider adding the following bound: `{}: {}`",
fr_name, outlived_fr_name

View File

@ -102,7 +102,7 @@ impl NonConstOp for FnCallUnstable {
);
if ccx.is_const_stable_const_fn() {
err.help("Const-stable functions can only call other const-stable functions");
err.help("const-stable functions can only call other const-stable functions");
} else if ccx.tcx.sess.is_nightly_build() {
if let Some(feature) = feature {
err.help(&format!(

View File

@ -58,7 +58,7 @@ pub(super) fn check_abi(tcx: TyCtxt<'_>, hir_id: hir::HirId, span: Span, abi: Ab
tcx.sess,
span,
E0781,
"the `\"C-cmse-nonsecure-call\"` ABI is only allowed on function pointers."
"the `\"C-cmse-nonsecure-call\"` ABI is only allowed on function pointers"
)
.emit()
}

View File

@ -181,8 +181,8 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
self.check_pat_tuple_struct(pat, qpath, subpats, ddpos, expected, def_bm, ti)
}
PatKind::Path(_) => self.check_pat_path(pat, path_res.unwrap(), expected, ti),
PatKind::Struct(ref qpath, fields, etc) => {
self.check_pat_struct(pat, qpath, fields, etc, expected, def_bm, ti)
PatKind::Struct(ref qpath, fields, has_rest_pat) => {
self.check_pat_struct(pat, qpath, fields, has_rest_pat, expected, def_bm, ti)
}
PatKind::Or(pats) => {
let parent_pat = Some(pat);
@ -712,7 +712,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
pat: &'tcx Pat<'tcx>,
qpath: &hir::QPath<'_>,
fields: &'tcx [hir::PatField<'tcx>],
etc: bool,
has_rest_pat: bool,
expected: Ty<'tcx>,
def_bm: BindingMode,
ti: TopInfo<'tcx>,
@ -734,7 +734,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
self.demand_eqtype_pat(pat.span, expected, pat_ty, ti);
// Type-check subpatterns.
if self.check_struct_pat_fields(pat_ty, pat, variant, fields, etc, def_bm, ti) {
if self.check_struct_pat_fields(pat_ty, &pat, variant, fields, has_rest_pat, def_bm, ti) {
pat_ty
} else {
self.tcx.ty_error()
@ -1216,7 +1216,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
pat: &'tcx Pat<'tcx>,
variant: &'tcx ty::VariantDef,
fields: &'tcx [hir::PatField<'tcx>],
etc: bool,
has_rest_pat: bool,
def_bm: BindingMode,
ti: TopInfo<'tcx>,
) -> bool {
@ -1290,7 +1290,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
// Require `..` if struct has non_exhaustive attribute.
let non_exhaustive = variant.is_field_list_non_exhaustive() && !adt.did.is_local();
if non_exhaustive && !etc {
if non_exhaustive && !has_rest_pat {
self.error_foreign_non_exhaustive_spat(pat, adt.variant_descr(), fields.is_empty());
}
@ -1302,7 +1302,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
.struct_span_err(pat.span, "union patterns should have exactly one field")
.emit();
}
if etc {
if has_rest_pat {
tcx.sess.struct_span_err(pat.span, "`..` cannot be used in union patterns").emit();
}
} else if !unmentioned_fields.is_empty() {
@ -1313,9 +1313,8 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
field.vis.is_accessible_from(tcx.parent_module(pat.hir_id).to_def_id(), tcx)
})
.collect();
if non_exhaustive {
self.non_exhaustive_reachable_pattern(pat, &accessible_unmentioned_fields, adt_ty)
} else if !etc {
if !has_rest_pat {
if accessible_unmentioned_fields.is_empty() {
unmentioned_err = Some(self.error_no_accessible_fields(pat, fields));
} else {
@ -1326,6 +1325,12 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
fields,
));
}
} else if non_exhaustive && !accessible_unmentioned_fields.is_empty() {
self.lint_non_exhaustive_omitted_patterns(
pat,
&accessible_unmentioned_fields,
adt_ty,
)
}
}
match (inexistent_fields_err, unmentioned_err) {
@ -1653,7 +1658,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
/// is not exhaustive enough.
///
/// Nb: the partner lint for enums lives in `compiler/rustc_mir_build/src/thir/pattern/usefulness.rs`.
fn non_exhaustive_reachable_pattern(
fn lint_non_exhaustive_omitted_patterns(
&self,
pat: &Pat<'_>,
unmentioned_fields: &[(&ty::FieldDef, Ident)],

View File

@ -313,6 +313,12 @@ changelog-seen = 2
# this setting's very existence, are all subject to change.)
#print-step-rusage = false
# Always patch binaries for usage with Nix toolchains. If `true` then binaries
# will be patched unconditionally. If `false` or unset, binaries will be patched
# only if the current distribution is NixOS. This option is useful when using
# a Nix toolchain on non-NixOS distributions.
#patch-binaries-for-nix = false
# =============================================================================
# General install configuration options
# =============================================================================

View File

@ -20,10 +20,10 @@ use super::VecDeque;
///
/// and the uneven remainder of either A or B is skipped.
pub struct PairSlices<'a, 'b, T> {
pub(crate) a0: &'a mut [T],
pub(crate) a1: &'a mut [T],
pub(crate) b0: &'b [T],
pub(crate) b1: &'b [T],
a0: &'a mut [T],
a1: &'a mut [T],
b0: &'b [T],
b1: &'b [T],
}
impl<'a, 'b, T> PairSlices<'a, 'b, T> {

View File

@ -380,20 +380,24 @@ pub fn current_exe() -> io::Result<PathBuf> {
#[cfg(any(target_os = "solaris", target_os = "illumos"))]
pub fn current_exe() -> io::Result<PathBuf> {
extern "C" {
fn getexecname() -> *const c_char;
}
unsafe {
let path = getexecname();
if path.is_null() {
Err(io::Error::last_os_error())
} else {
let filename = CStr::from_ptr(path).to_bytes();
let path = PathBuf::from(<OsStr as OsStrExt>::from_bytes(filename));
if let Ok(path) = crate::fs::read_link("/proc/self/path/a.out") {
Ok(path)
} else {
extern "C" {
fn getexecname() -> *const c_char;
}
unsafe {
let path = getexecname();
if path.is_null() {
Err(io::Error::last_os_error())
} else {
let filename = CStr::from_ptr(path).to_bytes();
let path = PathBuf::from(<OsStr as OsStrExt>::from_bytes(filename));
// Prepend a current working directory to the path if
// it doesn't contain an absolute pathname.
if filename[0] == b'/' { Ok(path) } else { getcwd().map(|cwd| cwd.join(path)) }
// Prepend a current working directory to the path if
// it doesn't contain an absolute pathname.
if filename[0] == b'/' { Ok(path) } else { getcwd().map(|cwd| cwd.join(path)) }
}
}
}
}

View File

@ -339,14 +339,18 @@ pub fn available_concurrency() -> io::Result<NonZeroUsize> {
Ok(unsafe { NonZeroUsize::new_unchecked(cpus as usize) })
} else if #[cfg(target_os = "haiku")] {
let mut sinfo: libc::system_info = crate::mem::zeroed();
let res = libc::get_system_info(&mut sinfo);
// system_info cpu_count field gets the static data set at boot time with `smp_set_num_cpus`
// `get_system_info` calls then `smp_get_num_cpus`
unsafe {
let mut sinfo: libc::system_info = crate::mem::zeroed();
let res = libc::get_system_info(&mut sinfo);
if res != libc::B_OK {
return Err(io::Error::last_os_error());
if res != libc::B_OK {
return Err(io::Error::new_const(io::ErrorKind::NotFound, &"The number of hardware threads is not known for the target platform"));
}
Ok(NonZeroUsize::new_unchecked(sinfo.cpu_count as usize))
}
Ok(unsafe { NonZeroUsize::new_unchecked(sinfo.cpu_count as usize) })
} else {
// FIXME: implement on vxWorks, Redox, l4re
Err(io::Error::new_const(io::ErrorKind::Unsupported, &"Getting the number of hardware threads is not supported on the target platform"))

View File

@ -5,7 +5,7 @@ pub(super) fn monotonize(raw: time::Instant) -> time::Instant {
inner::monotonize(raw)
}
#[cfg(all(target_has_atomic = "64", not(target_has_atomic = "128")))]
#[cfg(any(all(target_has_atomic = "64", not(target_has_atomic = "128")), target_arch = "aarch64"))]
pub mod inner {
use crate::sync::atomic::AtomicU64;
use crate::sync::atomic::Ordering::*;
@ -71,7 +71,7 @@ pub mod inner {
}
}
#[cfg(target_has_atomic = "128")]
#[cfg(all(target_has_atomic = "128", not(target_arch = "aarch64")))]
pub mod inner {
use crate::sync::atomic::AtomicU128;
use crate::sync::atomic::Ordering::*;

View File

@ -594,19 +594,23 @@ class RustBuild(object):
if ostype != "Linux":
return
# Use `/etc/os-release` instead of `/etc/NIXOS`.
# The latter one does not exist on NixOS when using tmpfs as root.
try:
with open("/etc/os-release", "r") as f:
if not any(line.strip() == "ID=nixos" for line in f):
return
except FileNotFoundError:
return
if os.path.exists("/lib"):
return
# If the user has asked binaries to be patched for Nix, then
# don't check for NixOS or `/lib`, just continue to the patching.
if self.get_toml('patch-binaries-for-nix', 'build') != 'true':
# Use `/etc/os-release` instead of `/etc/NIXOS`.
# The latter one does not exist on NixOS when using tmpfs as root.
try:
with open("/etc/os-release", "r") as f:
if not any(line.strip() == "ID=nixos" for line in f):
return
except FileNotFoundError:
return
if os.path.exists("/lib"):
return
# At this point we're pretty sure the user is running NixOS
nix_os_msg = "info: you seem to be running NixOS. Attempting to patch"
# At this point we're pretty sure the user is running NixOS or
# using Nix
nix_os_msg = "info: you seem to be using Nix. Attempting to patch"
print(nix_os_msg, fname)
# Only build `.nix-deps` once.

View File

@ -397,6 +397,7 @@ struct Build {
install_stage: Option<u32>,
dist_stage: Option<u32>,
bench_stage: Option<u32>,
patch_binaries_for_nix: Option<bool>,
}
/// TOML representation of various global install decisions.

View File

@ -9,7 +9,7 @@
import sys
import json
crate = json.load(open(sys.argv[1]))
crate = json.load(open(sys.argv[1], encoding="utf-8"))
def get_local_item(item_id):

View File

@ -34,6 +34,8 @@ use crate::html::markdown::MarkdownSummaryLine;
const ITEM_TABLE_OPEN: &'static str = "<div class=\"item-table\">";
const ITEM_TABLE_CLOSE: &'static str = "</div>";
const ITEM_TABLE_ROW_OPEN: &'static str = "<div class=\"item-row\">";
const ITEM_TABLE_ROW_CLOSE: &'static str = "</div>";
pub(super) fn print_item(cx: &Context<'_>, item: &clean::Item, buf: &mut Buffer, page: &Page<'_>) {
debug_assert!(!item.is_stripped());
@ -256,9 +258,6 @@ fn item_module(w: &mut Buffer, cx: &Context<'_>, item: &clean::Item, items: &[cl
debug!("{:?}", indices);
let mut curty = None;
// See: https://github.com/rust-lang/rust/issues/88545
let item_table_block_size = 900usize;
let mut item_table_nth_element = 0usize;
for &idx in &indices {
let myitem = &items[idx];
@ -285,13 +284,13 @@ fn item_module(w: &mut Buffer, cx: &Context<'_>, item: &clean::Item, items: &[cl
id = cx.derive_id(short.to_owned()),
name = name
);
item_table_nth_element = 0;
}
match *myitem.kind {
clean::ExternCrateItem { ref src } => {
use crate::html::format::anchor;
w.write_str(ITEM_TABLE_ROW_OPEN);
match *src {
Some(ref src) => write!(
w,
@ -312,6 +311,7 @@ fn item_module(w: &mut Buffer, cx: &Context<'_>, item: &clean::Item, items: &[cl
),
}
w.write_str("</code></div>");
w.write_str(ITEM_TABLE_ROW_CLOSE);
}
clean::ImportItem(ref import) => {
@ -336,6 +336,7 @@ fn item_module(w: &mut Buffer, cx: &Context<'_>, item: &clean::Item, items: &[cl
let add = if stab.is_some() { " " } else { "" };
w.write_str(ITEM_TABLE_ROW_OPEN);
write!(
w,
"<div class=\"item-left {stab}{add}import-item\">\
@ -348,6 +349,7 @@ fn item_module(w: &mut Buffer, cx: &Context<'_>, item: &clean::Item, items: &[cl
imp = import.print(cx),
stab_tags = stab_tags.unwrap_or_default(),
);
w.write_str(ITEM_TABLE_ROW_CLOSE);
}
_ => {
@ -368,6 +370,7 @@ fn item_module(w: &mut Buffer, cx: &Context<'_>, item: &clean::Item, items: &[cl
let add = if stab.is_some() { " " } else { "" };
let doc_value = myitem.doc_value().unwrap_or_default();
w.write_str(ITEM_TABLE_ROW_OPEN);
write!(
w,
"<div class=\"item-left {stab}{add}module-item\">\
@ -390,15 +393,9 @@ fn item_module(w: &mut Buffer, cx: &Context<'_>, item: &clean::Item, items: &[cl
.collect::<Vec<_>>()
.join(" "),
);
w.write_str(ITEM_TABLE_ROW_CLOSE);
}
}
item_table_nth_element += 1;
if item_table_nth_element > item_table_block_size {
w.write_str(ITEM_TABLE_CLOSE);
w.write_str(ITEM_TABLE_OPEN);
item_table_nth_element = 0;
}
}
if curty.is_some() {

View File

@ -773,22 +773,18 @@ h2.small-section-header > .anchor {
.block a.current.crate { font-weight: 500; }
.item-table {
display: grid;
column-gap: 1.2rem;
row-gap: 0.0rem;
grid-template-columns: auto 1fr;
display: table-row;
/* align content left */
justify-items: start;
}
.item-row {
display: table-row;
}
.item-left, .item-right {
display: block;
display: table-cell;
}
.item-left {
grid-column: 1;
}
.item-right {
grid-column: 2;
padding-right: 1.2rem;
}
.search-container {
@ -1891,6 +1887,9 @@ details.undocumented[open] > summary::before {
/* Display an alternating layout on tablets and phones */
.item-table {
display: block;
}
.item-row {
display: flex;
flex-flow: column wrap;
}

View File

@ -218,6 +218,7 @@ fn from_clean_item(item: clean::Item, tcx: TyCtxt<'_>) -> ItemEnum {
ConstantItem(c) => ItemEnum::Constant(c.into_tcx(tcx)),
MacroItem(m) => ItemEnum::Macro(m.source),
ProcMacroItem(m) => ItemEnum::ProcMacro(m.into_tcx(tcx)),
PrimitiveItem(p) => ItemEnum::PrimitiveType(p.as_sym().to_string()),
AssocConstItem(t, s) => ItemEnum::AssocConst { type_: t.into_tcx(tcx), default: s },
AssocTypeItem(g, t) => ItemEnum::AssocType {
bounds: g.into_iter().map(|x| x.into_tcx(tcx)).collect(),
@ -225,7 +226,7 @@ fn from_clean_item(item: clean::Item, tcx: TyCtxt<'_>) -> ItemEnum {
},
// `convert_item` early returns `None` for striped items
StrippedItem(_) => unreachable!(),
PrimitiveItem(_) | KeywordItem(_) => {
KeywordItem(_) => {
panic!("{:?} is not supported for JSON output", item)
}
ExternCrateItem { ref src } => ItemEnum::ExternCrate {

View File

@ -69,7 +69,21 @@ impl JsonRenderer<'tcx> {
.iter()
.filter_map(|i| {
let item = &i.impl_item;
if item.def_id.is_local() {
// HACK(hkmatsumoto): For impls of primitive types, we index them
// regardless of whether they're local. This is because users can
// document primitive items in an arbitrary crate by using
// `doc(primitive)`.
let mut is_primitive_impl = false;
if let clean::types::ItemKind::ImplItem(ref impl_) = *item.kind {
if impl_.trait_.is_none() {
if let clean::types::Type::Primitive(_) = impl_.for_ {
is_primitive_impl = true;
}
}
}
if item.def_id.is_local() || is_primitive_impl {
self.item(item.clone()).unwrap();
Some(from_item_id(item.def_id))
} else {
@ -191,6 +205,11 @@ impl<'tcx> FormatRenderer<'tcx> for JsonRenderer<'tcx> {
fn after_krate(&mut self) -> Result<(), Error> {
debug!("Done with crate");
for primitive in Rc::clone(&self.cache).primitive_locations.values() {
self.get_impls(primitive.clone());
}
let mut index = (*self.index).clone().into_inner();
index.extend(self.get_trait_items());
// This needs to be the default HashMap for compatibility with the public interface for
@ -236,7 +255,7 @@ impl<'tcx> FormatRenderer<'tcx> for JsonRenderer<'tcx> {
)
})
.collect(),
format_version: 7,
format_version: 8,
};
let mut p = self.out_path.clone();
p.push(output.index.get(&output.root).unwrap().name.clone().unwrap());

View File

@ -221,6 +221,8 @@ pub enum ItemEnum {
Macro(String),
ProcMacro(ProcMacro),
PrimitiveType(String),
AssocConst {
#[serde(rename = "type")]
type_: Type,

View File

@ -0,0 +1,5 @@
goto: file://|DOC_PATH|/test_docs/huge_amount_of_consts/index.html
// Make sure that the last two entries are more than 12 pixels apart and not stacked on each other.
compare-elements-position-near-false: ("//*[@class='item-table']//div[last()-1]", "//*[@class='item-table']//div[last()-3]", {"y": 12})

View File

@ -3,5 +3,7 @@ name = "test_docs"
version = "0.1.0"
edition = "2018"
build = "build.rs"
[lib]
path = "lib.rs"

View File

@ -0,0 +1,15 @@
//! generate 2000 constants for testing
use std::{fs::write, path::PathBuf};
fn main() -> std::io::Result<()> {
let out_dir = std::env::var("OUT_DIR").expect("OUT_DIR is not defined");
let mut output = String::new();
for i in 0..2000 {
let line = format!("/// Some const A{0}\npub const A{0}: isize = 0;\n", i);
output.push_str(&*line);
};
write(&[&*out_dir, "huge_amount_of_consts.rs"].iter().collect::<PathBuf>(), output)
}

View File

@ -116,3 +116,7 @@ pub mod keyword {}
/// Just some type alias.
pub type SomeType = u32;
pub mod huge_amount_of_consts {
include!(concat!(env!("OUT_DIR"), "/huge_amount_of_consts.rs"));
}

View File

@ -0,0 +1,14 @@
// edition:2018
#![feature(doc_primitive)]
#[doc(primitive = "usize")]
mod usize {}
// @set local_crate_id = primitive.json "$.index[*][?(@.name=='primitive')].crate_id"
// @has - "$.index[*][?(@.name=='log10')]"
// @!is - "$.index[*][?(@.name=='log10')].crate_id" $local_crate_id
// @has - "$.index[*][?(@.name=='checked_add')]"
// @!is - "$.index[*][?(@.name=='checked_add')]" $local_crate_id
// @!has - "$.index[*][?(@.name=='is_ascii_uppercase')]"

View File

@ -5,8 +5,6 @@ LL | fn baz<'a,'b>(x: &'a u32) -> &'static u32 {
| -- lifetime `'a` defined here
LL | bar(foo, x)
| ^^^^^^^^^^^ returning this value requires that `'a` must outlive `'static`
|
= help: consider replacing `'a` with `'static`
error: aborting due to previous error

View File

@ -6,8 +6,6 @@ LL | fn baz<'a, 'b>(x: Type<'a>) -> Type<'static> {
...
LL | bar(foo, x)
| ^^^^^^^^^^^ returning this value requires that `'a` must outlive `'static`
|
= help: consider replacing `'a` with `'static`
error: aborting due to previous error

View File

@ -18,8 +18,6 @@ LL | fn expect_free_supply_free_from_fn<'x>(x: &'x u32) {
...
LL | with_closure_expecting_fn_with_free_region(|x: fn(&'x u32), y| {});
| ^ requires that `'x` must outlive `'static`
|
= help: consider replacing `'x` with `'static`
error[E0308]: mismatched types
--> $DIR/expect-fn-supply-fn.rs:32:49

View File

@ -17,8 +17,6 @@ LL | fn expect_bound_supply_named<'x>() {
...
LL | closure_expecting_bound(|x: &'x u32| {
| ^ requires that `'x` must outlive `'static`
|
= help: consider replacing `'x` with `'static`
error: aborting due to 2 previous errors

View File

@ -1,4 +1,4 @@
error[E0781]: the `"C-cmse-nonsecure-call"` ABI is only allowed on function pointers.
error[E0781]: the `"C-cmse-nonsecure-call"` ABI is only allowed on function pointers
--> $DIR/wrong-abi-location-1.rs:8:1
|
LL | pub extern "C-cmse-nonsecure-call" fn test() {}

View File

@ -1,4 +1,4 @@
error[E0781]: the `"C-cmse-nonsecure-call"` ABI is only allowed on function pointers.
error[E0781]: the `"C-cmse-nonsecure-call"` ABI is only allowed on function pointers
--> $DIR/wrong-abi-location-2.rs:8:1
|
LL | / extern "C-cmse-nonsecure-call" {

View File

@ -4,7 +4,7 @@ error: `foo` is not yet stable as a const fn
LL | const fn bar() -> u32 { foo() }
| ^^^^^
|
= help: Const-stable functions can only call other const-stable functions
= help: const-stable functions can only call other const-stable functions
error: `foo2` is not yet stable as a const fn
--> $DIR/min_const_fn_libstd_stability.rs:24:26
@ -12,7 +12,7 @@ error: `foo2` is not yet stable as a const fn
LL | const fn bar2() -> u32 { foo2() }
| ^^^^^^
|
= help: Const-stable functions can only call other const-stable functions
= help: const-stable functions can only call other const-stable functions
error: const-stable function cannot use `#[feature(const_fn_floating_point_arithmetic)]`
--> $DIR/min_const_fn_libstd_stability.rs:29:26
@ -35,7 +35,7 @@ error: `foo2_gated` is not yet stable as a const fn
LL | const fn bar2_gated() -> u32 { foo2_gated() }
| ^^^^^^^^^^^^
|
= help: Const-stable functions can only call other const-stable functions
= help: const-stable functions can only call other const-stable functions
error: aborting due to 4 previous errors

View File

@ -4,7 +4,7 @@ error: `foo` is not yet stable as a const fn
LL | const unsafe fn bar() -> u32 { unsafe { foo() } }
| ^^^^^
|
= help: Const-stable functions can only call other const-stable functions
= help: const-stable functions can only call other const-stable functions
error: `foo2` is not yet stable as a const fn
--> $DIR/min_const_unsafe_fn_libstd_stability.rs:24:42
@ -12,7 +12,7 @@ error: `foo2` is not yet stable as a const fn
LL | const unsafe fn bar2() -> u32 { unsafe { foo2() } }
| ^^^^^^
|
= help: Const-stable functions can only call other const-stable functions
= help: const-stable functions can only call other const-stable functions
error: const-stable function cannot use `#[feature(const_fn_floating_point_arithmetic)]`
--> $DIR/min_const_unsafe_fn_libstd_stability.rs:29:33
@ -35,7 +35,7 @@ error: `foo2_gated` is not yet stable as a const fn
LL | const unsafe fn bar2_gated() -> u32 { unsafe { foo2_gated() } }
| ^^^^^^^^^^^^
|
= help: Const-stable functions can only call other const-stable functions
= help: const-stable functions can only call other const-stable functions
error: aborting due to 4 previous errors

View File

@ -4,7 +4,7 @@ error: `foo` is not yet stable as a const fn
LL | const unsafe fn bar() -> u32 { foo() }
| ^^^^^
|
= help: Const-stable functions can only call other const-stable functions
= help: const-stable functions can only call other const-stable functions
error: `foo2` is not yet stable as a const fn
--> $DIR/min_const_unsafe_fn_libstd_stability2.rs:24:33
@ -12,7 +12,7 @@ error: `foo2` is not yet stable as a const fn
LL | const unsafe fn bar2() -> u32 { foo2() }
| ^^^^^^
|
= help: Const-stable functions can only call other const-stable functions
= help: const-stable functions can only call other const-stable functions
error: `foo2_gated` is not yet stable as a const fn
--> $DIR/min_const_unsafe_fn_libstd_stability2.rs:33:39
@ -20,7 +20,7 @@ error: `foo2_gated` is not yet stable as a const fn
LL | const unsafe fn bar2_gated() -> u32 { foo2_gated() }
| ^^^^^^^^^^^^
|
= help: Const-stable functions can only call other const-stable functions
= help: const-stable functions can only call other const-stable functions
error: aborting due to 3 previous errors

View File

@ -14,8 +14,6 @@ LL | fn give_some<'a>() {
| -- lifetime `'a` defined here
LL | want_hrtb::<&'a u32>()
| ^^^^^^^^^^^^^^^^^^^^ requires that `'a` must outlive `'static`
|
= help: consider replacing `'a` with `'static`
error: implementation of `Foo` is not general enough
--> $DIR/hrtb-just-for-static.rs:30:5

View File

@ -54,8 +54,6 @@ LL | fn foo_hrtb_bar_not<'b, T>(mut t: T)
...
LL | foo_hrtb_bar_not(&mut t);
| ^^^^^^^^^^^^^^^^^^^^^^^^ requires that `'b` must outlive `'static`
|
= help: consider replacing `'b` with `'static`
error: implementation of `Bar` is not general enough
--> $DIR/hrtb-perfect-forwarding.rs:43:5

View File

@ -5,8 +5,6 @@ LL | fn with_dyn_debug_static<'a>(x: Box<dyn Debug + 'a>) {
| - `x` is a reference that is only valid in the function body
LL | static_val(x);
| ^^^^^^^^^^^^^ `x` escapes the function body here
|
= help: consider replacing `'a` with `'static`
error: aborting due to previous error

View File

@ -19,7 +19,6 @@ LL | fn explicit<'a>(x: &'a i32) -> impl Copy { x }
| |
| lifetime `'a` defined here
|
= help: consider replacing `'a` with `'static`
help: to allow this `impl Trait` to capture borrowed data with lifetime `'a`, add `'a` as a bound
|
LL | fn explicit<'a>(x: &'a i32) -> impl Copy + 'a { x }
@ -42,7 +41,6 @@ LL | fn explicit2<'a>(x: &'a i32) -> impl Copy + 'static { x }
| -- lifetime `'a` defined here ^ returning this value requires that `'a` must outlive `'static`
|
= help: consider replacing `'a` with `'static`
= help: consider replacing `'a` with `'static`
error[E0621]: explicit lifetime required in the type of `x`
--> $DIR/must_outlive_least_region_or_bound.rs:11:41
@ -67,7 +65,6 @@ LL | fn with_bound<'a>(x: &'a i32) -> impl LifetimeTrait<'a> + 'static { x }
| -- lifetime `'a` defined here ^ returning this value requires that `'a` must outlive `'static`
|
= help: consider replacing `'a` with `'static`
= help: consider replacing `'a` with `'static`
error: lifetime may not live long enough
--> $DIR/must_outlive_least_region_or_bound.rs:32:61

View File

@ -19,7 +19,6 @@ LL | fn iter_values<'a>(&'a self) -> impl Iterator<Item=u32> {
| |
| lifetime `'a` defined here
|
= help: consider replacing `'a` with `'static`
help: to allow this `impl Trait` to capture borrowed data with lifetime `'a`, add `'a` as a bound
|
LL | fn iter_values<'a>(&'a self) -> impl Iterator<Item=u32> + 'a {

View File

@ -6,8 +6,6 @@ LL | fn test<'x>(x: &'x isize) {
LL | drop::<Box<dyn for<'z> FnMut(&'z isize) -> &'z isize>>(Box::new(|z| {
LL | x
| ^ returning this value requires that `'x` must outlive `'static`
|
= help: consider replacing `'x` with `'static`
error: aborting due to previous error

View File

@ -5,8 +5,6 @@ LL | fn bar<'a>() {
| -- lifetime `'a` defined here
LL | foo::<&'a i32>();
| ^^^^^^^^^^^^^^ requires that `'a` must outlive `'static`
|
= help: consider replacing `'a` with `'static`
error: aborting due to previous error

View File

@ -6,8 +6,6 @@ LL | fn boo<'a>() {
...
LL | let x = foo::<&'a u32>();
| ^^^^^^^^^^^^^^ requires that `'a` must outlive `'static`
|
= help: consider replacing `'a` with `'static`
error: aborting due to previous error

View File

@ -6,8 +6,6 @@ LL | pub trait Graph<'a> {
...
LL | Box::new(self.out_edges(u).map(|e| e.target()))
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ returning this value requires that `'a` must outlive `'static`
|
= help: consider replacing `'a` with `'static`
error: lifetime may not live long enough
--> $DIR/issue-55796.rs:23:9
@ -17,8 +15,6 @@ LL | pub trait Graph<'a> {
...
LL | Box::new(self.in_edges(u).map(|e| e.target()))
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ returning this value requires that `'a` must outlive `'static`
|
= help: consider replacing `'a` with `'static`
error: aborting due to 2 previous errors

View File

@ -6,8 +6,6 @@ LL | fn inject<'a, Env: 'a, A: 'a + Send>(v: A) -> Box<dyn FnOnce(&'a Env) -> Bo
LL | let fut: BoxFuture<'a, A> = Box::pin(future::ready(v));
LL | Box::new(move |_| fut)
| ^^^^^^^^^^^^^^^^^^^^^^ returning this value requires that `'a` must outlive `'static`
|
= help: consider replacing `'a` with `'static`
error: aborting due to previous error

View File

@ -6,8 +6,6 @@ LL | fn test2<'a>(x: &'a Box<dyn Fn() + 'a>) {
LL | // but ref_obj will not, so warn.
LL | ref_obj(x)
| ^^^^^^^^^^ `x` escapes the function body here
|
= help: consider replacing `'a` with `'static`
error[E0521]: borrowed data escapes outside of function
--> $DIR/lifetime-bound-will-change-warning.rs:39:5
@ -17,8 +15,6 @@ LL | fn test2cc<'a>(x: &'a Box<dyn Fn() + 'a>) {
LL | // same as test2, but cross crate
LL | lib::ref_obj(x)
| ^^^^^^^^^^^^^^^ `x` escapes the function body here
|
= help: consider replacing `'a` with `'static`
error: aborting due to 2 previous errors

View File

@ -6,8 +6,6 @@ LL | pub fn opt_str2<'a>(maybestr: &'a Option<String>) -> &'static str {
...
LL | s
| ^ returning this value requires that `'a` must outlive `'static`
|
= help: consider replacing `'a` with `'static`
error: lifetime may not live long enough
--> $DIR/lub-if.rs:35:9
@ -17,8 +15,6 @@ LL | pub fn opt_str3<'a>(maybestr: &'a Option<String>) -> &'static str {
...
LL | s
| ^ returning this value requires that `'a` must outlive `'static`
|
= help: consider replacing `'a` with `'static`
error: aborting due to 2 previous errors

View File

@ -6,8 +6,6 @@ LL | pub fn opt_str2<'a>(maybestr: &'a Option<String>) -> &'static str {
...
LL | s
| ^ returning this value requires that `'a` must outlive `'static`
|
= help: consider replacing `'a` with `'static`
error: lifetime may not live long enough
--> $DIR/lub-match.rs:39:13
@ -17,8 +15,6 @@ LL | pub fn opt_str3<'a>(maybestr: &'a Option<String>) -> &'static str {
...
LL | s
| ^ returning this value requires that `'a` must outlive `'static`
|
= help: consider replacing `'a` with `'static`
error: aborting due to 2 previous errors

View File

@ -46,8 +46,6 @@ LL | | // Only works if 'x: 'y:
LL | | demand_y(x, y, x.get())
LL | | });
| |______^ `cell_a` escapes the function body here
|
= help: consider replacing `'a` with `'static`
error: aborting due to previous error

View File

@ -46,8 +46,6 @@ LL | | // Only works if 'x: 'y:
LL | | demand_y(x, y, x.get())
LL | | });
| |______^ `cell_a` escapes the function body here
|
= help: consider replacing `'a` with `'static`
error: aborting due to previous error

View File

@ -5,8 +5,6 @@ LL | fn foo<'a>(x: &'a u32) -> &'static u32 {
| -- lifetime `'a` defined here
LL | &*x
| ^^^ returning this value requires that `'a` must outlive `'static`
|
= help: consider replacing `'a` with `'static`
error: aborting due to previous error

View File

@ -6,8 +6,6 @@ LL | fn foo<'a, T: 'static>(s: Box<<&'a T as A>::X>)
...
LL | let _x = *s;
| ^^ proving this value is `Sized` requires that `'a` must outlive `'static`
|
= help: consider replacing `'a` with `'static`
error: aborting due to previous error

View File

@ -6,8 +6,6 @@ LL | fn static_to_a_to_static_through_ref_in_tuple<'a>(x: &'a u32) -> &'static u
LL | let (ref y, _z): (&'a u32, u32) = (&22, 44);
LL | *y
| ^^ returning this value requires that `'a` must outlive `'static`
|
= help: consider replacing `'a` with `'static`
error: aborting due to previous error

View File

@ -6,8 +6,6 @@ LL | fn foo<'a>(x: i32) {
...
LL | A::<'a>::X..=A::<'static>::X => (),
| ^^^^^^^^^^ requires that `'a` must outlive `'static`
|
= help: consider replacing `'a` with `'static`
error: lifetime may not live long enough
--> $DIR/issue-58299.rs:24:27
@ -17,8 +15,6 @@ LL | fn bar<'a>(x: i32) {
...
LL | A::<'static>::X..=A::<'a>::X => (),
| ^^^^^^^^^^ requires that `'a` must outlive `'static`
|
= help: consider replacing `'a` with `'static`
error: aborting due to 2 previous errors

View File

@ -0,0 +1,14 @@
// Regression test for issue #73159
// Tests thar we don't suggest replacing 'a with 'static'
#![feature(nll)]
struct Foo<'a>(&'a [u8]);
impl<'a> Foo<'a> {
fn make_it(&self) -> impl Iterator<Item = u8> { //~ ERROR lifetime may not live
self.0.iter().copied()
}
}
fn main() {}

View File

@ -0,0 +1,10 @@
error: lifetime may not live long enough
--> $DIR/issue-73159-rpit-static.rs:9:26
|
LL | impl<'a> Foo<'a> {
| -- lifetime `'a` defined here
LL | fn make_it(&self) -> impl Iterator<Item = u8> {
| ^^^^^^^^^^^^^^^^^^^^^^^^ opaque type requires that `'a` must outlive `'static`
error: aborting due to previous error

View File

@ -6,8 +6,6 @@ LL | fn bar<'a>(x: &'a u32) -> &'static u32 {
...
LL | f(x)
| ^^^^ returning this value requires that `'a` must outlive `'static`
|
= help: consider replacing `'a` with `'static`
error: aborting due to previous error

View File

@ -6,8 +6,6 @@ LL | fn bar<'a>(input: &'a u32, f: fn(&'a u32) -> &'a u32) -> &'static u32 {
...
LL | unsafe { g(input) }
| ^^^^^^^^ returning this value requires that `'a` must outlive `'static`
|
= help: consider replacing `'a` with `'static`
error: aborting due to previous error

View File

@ -5,8 +5,6 @@ LL | fn bar<'a>(x: &'a u32) -> &'static dyn Debug {
| -- lifetime `'a` defined here
LL | x
| ^ returning this value requires that `'a` must outlive `'static`
|
= help: consider replacing `'a` with `'static`
error: aborting due to previous error

View File

@ -46,8 +46,6 @@ LL | fn foo2<'a, 'b, 'c>(x: &'a usize, y: &'b usize) -> (&'c usize, &'static usi
| -- lifetime `'b` defined here
LL | (x, y)
| ^^^^^^ returning this value requires that `'b` must outlive `'static`
|
= help: consider replacing `'b` with `'static`
help: the following changes may resolve your lifetime errors
|
@ -88,8 +86,6 @@ LL | fn foo3<'a, 'b, 'c, 'd, 'e>(
...
LL | (x, y, z)
| ^^^^^^^^^ returning this value requires that `'c` must outlive `'static`
|
= help: consider replacing `'c` with `'static`
help: the following changes may resolve your lifetime errors
|

View File

@ -17,8 +17,6 @@ LL | fn foo2<'a>(x: &'a usize) -> &'static usize {
| -- lifetime `'a` defined here
LL | x
| ^ returning this value requires that `'a` must outlive `'static`
|
= help: consider replacing `'a` with `'static`
error: lifetime may not live long enough
--> $DIR/outlives-suggestion-simple.rs:14:5
@ -66,8 +64,6 @@ LL | pub fn foo<'a>(x: &'a usize) -> Self {
| -- lifetime `'a` defined here
LL | Foo { x }
| ^^^^^^^^^ returning this value requires that `'a` must outlive `'static`
|
= help: consider replacing `'a` with `'static`
error: lifetime may not live long enough
--> $DIR/outlives-suggestion-simple.rs:41:9

View File

@ -6,8 +6,6 @@ LL | fn uninit<'a>() {
LL | return;
LL | let x: &'static &'a ();
| ^^^^^^^^^^^^^^^ type annotation requires that `'a` must outlive `'static`
|
= help: consider replacing `'a` with `'static`
error: lifetime may not live long enough
--> $DIR/wf-unreachable.rs:13:12
@ -17,8 +15,6 @@ LL | fn var_type<'a>() {
LL | return;
LL | let x: &'static &'a () = &&();
| ^^^^^^^^^^^^^^^ type annotation requires that `'a` must outlive `'static`
|
= help: consider replacing `'a` with `'static`
error: lifetime may not live long enough
--> $DIR/wf-unreachable.rs:17:12
@ -27,8 +23,6 @@ LL | fn uninit_infer<'a>() {
| -- lifetime `'a` defined here
LL | let x: &'static &'a _;
| ^^^^^^^^^^^^^^ type annotation requires that `'a` must outlive `'static`
|
= help: consider replacing `'a` with `'static`
error: lifetime may not live long enough
--> $DIR/wf-unreachable.rs:23:12
@ -38,8 +32,6 @@ LL | fn infer<'a>() {
LL | return;
LL | let x: &'static &'a _ = &&();
| ^^^^^^^^^^^^^^ type annotation requires that `'a` must outlive `'static`
|
= help: consider replacing `'a` with `'static`
error: lifetime may not live long enough
--> $DIR/wf-unreachable.rs:28:12
@ -49,8 +41,6 @@ LL | fn uninit_no_var<'a>() {
LL | return;
LL | let _: &'static &'a ();
| ^^^^^^^^^^^^^^^ type annotation requires that `'a` must outlive `'static`
|
= help: consider replacing `'a` with `'static`
error: lifetime may not live long enough
--> $DIR/wf-unreachable.rs:33:12
@ -60,8 +50,6 @@ LL | fn no_var<'a>() {
LL | return;
LL | let _: &'static &'a () = &&();
| ^^^^^^^^^^^^^^^ type annotation requires that `'a` must outlive `'static`
|
= help: consider replacing `'a` with `'static`
error: lifetime may not live long enough
--> $DIR/wf-unreachable.rs:38:12
@ -71,8 +59,6 @@ LL | fn infer_no_var<'a>() {
LL | return;
LL | let _: &'static &'a _ = &&();
| ^^^^^^^^^^^^^^ type annotation requires that `'a` must outlive `'static`
|
= help: consider replacing `'a` with `'static`
error: lifetime may not live long enough
--> $DIR/wf-unreachable.rs:51:12
@ -82,8 +68,6 @@ LL | fn required_substs<'a>() {
LL | return;
LL | let _: C<'static, 'a, _> = C((), &(), &());
| ^^^^^^^^^^^^^^^^^ type annotation requires that `'a` must outlive `'static`
|
= help: consider replacing `'a` with `'static`
error: aborting due to 8 previous errors

View File

@ -6,8 +6,6 @@ LL | fn foo<'a>() {
...
LL | return x;
| ^ returning this value requires that `'a` must outlive `'static`
|
= help: consider replacing `'a` with `'static`
error: lifetime may not live long enough
--> $DIR/closure-substs.rs:15:16
@ -25,8 +23,6 @@ LL | fn bar<'a>() {
...
LL | b(x);
| ^^^^ argument requires that `'a` must outlive `'static`
|
= help: consider replacing `'a` with `'static`
error[E0521]: borrowed data escapes outside of closure
--> $DIR/closure-substs.rs:29:9

View File

@ -5,8 +5,6 @@ LL | fn foo<'a>(_: &'a u32) -> &'static u32 {
| -- lifetime `'a` defined here
LL | <Foo<'a>>::C
| ^^^^^^^^^^^^ returning this value requires that `'a` must outlive `'static`
|
= help: consider replacing `'a` with `'static`
error: aborting due to previous error

View File

@ -5,8 +5,6 @@ LL | fn foo<'a>(_: &'a u32) -> &'static u32 {
| -- lifetime `'a` defined here
LL | <() as Foo<'a>>::C
| ^^^^^^^^^^^^^^^^^^ returning this value requires that `'a` must outlive `'static`
|
= help: consider replacing `'a` with `'static`
error: aborting due to previous error

View File

@ -5,8 +5,6 @@ LL | fn foo<'a>(_: &'a u32) -> &'static u32 {
| -- lifetime `'a` defined here
LL | <() as Foo<'a>>::C
| ^^^^^^^^^^^^^^^^^^ returning this value requires that `'a` must outlive `'static`
|
= help: consider replacing `'a` with `'static`
error: aborting due to previous error

View File

@ -5,8 +5,6 @@ LL | fn foo<'a, T: Foo<'a>>() -> &'static u32 {
| -- lifetime `'a` defined here
LL | <T as Foo<'a>>::C
| ^^^^^^^^^^^^^^^^^ returning this value requires that `'a` must outlive `'static`
|
= help: consider replacing `'a` with `'static`
error: aborting due to previous error

View File

@ -5,8 +5,6 @@ LL | fn foo<'a, T: Foo<'a>>() -> &'static u32 {
| -- lifetime `'a` defined here
LL | T::C
| ^^^^ returning this value requires that `'a` must outlive `'static`
|
= help: consider replacing `'a` with `'static`
error: aborting due to previous error

View File

@ -5,8 +5,6 @@ LL | fn non_wf_associated_const<'a>(x: i32) {
| -- lifetime `'a` defined here
LL | A::<'a>::IC;
| ^^^^^^^^^^^ requires that `'a` must outlive `'static`
|
= help: consider replacing `'a` with `'static`
error: aborting due to previous error

View File

@ -15,8 +15,6 @@ LL | fn test<'a>() {
| -- lifetime `'a` defined here
LL | let _:fn(&()) = |_:&'a ()| {};
| ^ requires that `'a` must outlive `'static`
|
= help: consider replacing `'a` with `'static`
error: aborting due to 2 previous errors

View File

@ -6,8 +6,6 @@ LL | fn coupled_regions_lhs<'a>(_x: &'a u32, s: &'static u32) -> &'static u32 {
...
LL | y
| ^ returning this value requires that `'a` must outlive `'static`
|
= help: consider replacing `'a` with `'static`
error: lifetime may not live long enough
--> $DIR/issue-55748-pat-types-constrain-bindings.rs:49:5
@ -17,8 +15,6 @@ LL | fn coupled_types_lhs<'a>(_x: &'a u32, s: &'static u32) -> &'static u32 {
...
LL | y
| ^ returning this value requires that `'a` must outlive `'static`
|
= help: consider replacing `'a` with `'static`
error: lifetime may not live long enough
--> $DIR/issue-55748-pat-types-constrain-bindings.rs:62:5
@ -28,8 +24,6 @@ LL | fn coupled_wilds_lhs<'a>(_x: &'a u32, s: &'static u32) -> &'static u32 {
...
LL | y
| ^ returning this value requires that `'a` must outlive `'static`
|
= help: consider replacing `'a` with `'static`
error: aborting due to 3 previous errors

View File

@ -6,8 +6,6 @@ LL | fn coupled_wilds_rhs<'a>(_x: &'a u32, s: &'static u32) -> &'static u32 {
LL | let ((y, _z),) = ((s, _x),): (PairCoupledTypes<_>,);
LL | y
| ^ returning this value requires that `'a` must outlive `'static`
|
= help: consider replacing `'a` with `'static`
error: lifetime may not live long enough
--> $DIR/issue-57731-ascibed-coupled-types.rs:22:5
@ -17,8 +15,6 @@ LL | fn coupled_regions_rhs<'a>(_x: &'a u32, s: &'static u32) -> &'static u32 {
LL | let ((y, _z),) = ((s, _x),): (PairCoupledRegions<_>,);
LL | y
| ^ returning this value requires that `'a` must outlive `'static`
|
= help: consider replacing `'a` with `'static`
error: lifetime may not live long enough
--> $DIR/issue-57731-ascibed-coupled-types.rs:32:5
@ -28,8 +24,6 @@ LL | fn cast_coupled_wilds_rhs<'a>(_x: &'a u32, s: &'static u32) -> &'static u32
LL | let ((y, _z),) = ((s, _x),) as (PairCoupledTypes<_>,);
LL | y
| ^ returning this value requires that `'a` must outlive `'static`
|
= help: consider replacing `'a` with `'static`
error: lifetime may not live long enough
--> $DIR/issue-57731-ascibed-coupled-types.rs:37:5
@ -39,8 +33,6 @@ LL | fn cast_coupled_regions_rhs<'a>(_x: &'a u32, s: &'static u32) -> &'static u
LL | let ((y, _z),) = ((s, _x),) as (PairCoupledRegions<_>,);
LL | y
| ^ returning this value requires that `'a` must outlive `'static`
|
= help: consider replacing `'a` with `'static`
error: aborting due to 4 previous errors

View File

@ -156,8 +156,6 @@ LL | fn static_to_a_to_static_through_variable<'a>(x: &'a u32) -> &'static u32 {
...
LL | y
| ^ returning this value requires that `'a` must outlive `'static`
|
= help: consider replacing `'a` with `'static`
error: lifetime may not live long enough
--> $DIR/patterns.rs:125:5
@ -167,8 +165,6 @@ LL | fn static_to_a_to_static_through_tuple<'a>(x: &'a u32) -> &'static u32 {
...
LL | y
| ^ returning this value requires that `'a` must outlive `'static`
|
= help: consider replacing `'a` with `'static`
error: lifetime may not live long enough
--> $DIR/patterns.rs:130:5
@ -178,8 +174,6 @@ LL | fn static_to_a_to_static_through_struct<'a>(_x: &'a u32) -> &'static u32 {
LL | let Single { value: y }: Single<&'a u32> = Single { value: &22 };
LL | y
| ^ returning this value requires that `'a` must outlive `'static`
|
= help: consider replacing `'a` with `'static`
error: lifetime may not live long enough
--> $DIR/patterns.rs:134:18
@ -188,8 +182,6 @@ LL | fn a_to_static_then_static<'a>(x: &'a u32) -> &'static u32 {
| -- lifetime `'a` defined here
LL | let (y, _z): (&'static u32, u32) = (x, 44);
| ^^^^^^^^^^^^^^^^^^^ type annotation requires that `'a` must outlive `'static`
|
= help: consider replacing `'a` with `'static`
error: aborting due to 19 previous errors

View File

@ -5,8 +5,6 @@ LL | fn c<'a>(t: &'a Box<dyn Test+'a>, mut ss: SomeStruct<'a>) {
| -- lifetime `'a` defined here
LL | ss.t = t;
| ^^^^^^^^ assignment requires that `'a` must outlive `'static`
|
= help: consider replacing `'a` with `'static`
error: aborting due to previous error

View File

@ -5,8 +5,6 @@ LL | fn c<'a>(t: &'a MyBox<dyn Test+'a>, mut ss: SomeStruct<'a>) {
| -- lifetime `'a` defined here
LL | ss.t = t;
| ^^^^^^^^ assignment requires that `'a` must outlive `'static`
|
= help: consider replacing `'a` with `'static`
error: aborting due to previous error

View File

@ -18,8 +18,6 @@ LL | fn load2<'a>(ss: &MyBox<dyn SomeTrait + 'a>) -> MyBox<dyn SomeTrait + 'a> {
| -- `ss` is a reference that is only valid in the function body
LL | load0(ss)
| ^^^^^^^^^ `ss` escapes the function body here
|
= help: consider replacing `'a` with `'static`
error: aborting due to 2 previous errors

View File

@ -6,8 +6,6 @@ LL | fn unify<'a>(x: Option<Invariant<'a>>, f: fn(Invariant<'a>)) {
LL | let bad = if x.is_some() {
LL | x.unwrap()
| ^^^^^^^^^^ `x` escapes the function body here
|
= help: consider replacing `'a` with `'static`
error: aborting due to previous error

View File

@ -5,8 +5,6 @@ LL | fn param_not_ok<'a>(x: &'a isize) {
| -- lifetime `'a` defined here
LL | assert_send::<&'a isize>();
| ^^^^^^^^^^^^^^^^^^^^^^^^ requires that `'a` must outlive `'static`
|
= help: consider replacing `'a` with `'static`
error: lifetime may not live long enough
--> $DIR/regions-bounded-by-trait-requiring-static.rs:26:5
@ -15,8 +13,6 @@ LL | fn param_not_ok1<'a>(_: &'a isize) {
| -- lifetime `'a` defined here
LL | assert_send::<&'a str>();
| ^^^^^^^^^^^^^^^^^^^^^^ requires that `'a` must outlive `'static`
|
= help: consider replacing `'a` with `'static`
error: lifetime may not live long enough
--> $DIR/regions-bounded-by-trait-requiring-static.rs:30:5
@ -25,8 +21,6 @@ LL | fn param_not_ok2<'a>(_: &'a isize) {
| -- lifetime `'a` defined here
LL | assert_send::<&'a [isize]>();
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ requires that `'a` must outlive `'static`
|
= help: consider replacing `'a` with `'static`
error: lifetime may not live long enough
--> $DIR/regions-bounded-by-trait-requiring-static.rs:44:5
@ -35,8 +29,6 @@ LL | fn box_with_region_not_ok<'a>() {
| -- lifetime `'a` defined here
LL | assert_send::<Box<&'a isize>>();
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ requires that `'a` must outlive `'static`
|
= help: consider replacing `'a` with `'static`
error: lifetime may not live long enough
--> $DIR/regions-bounded-by-trait-requiring-static.rs:55:5
@ -45,8 +37,6 @@ LL | fn unsafe_ok2<'a>(_: &'a isize) {
| -- lifetime `'a` defined here
LL | assert_send::<*const &'a isize>();
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ requires that `'a` must outlive `'static`
|
= help: consider replacing `'a` with `'static`
error: lifetime may not live long enough
--> $DIR/regions-bounded-by-trait-requiring-static.rs:59:5
@ -55,8 +45,6 @@ LL | fn unsafe_ok3<'a>(_: &'a isize) {
| -- lifetime `'a` defined here
LL | assert_send::<*mut &'a isize>();
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ requires that `'a` must outlive `'static`
|
= help: consider replacing `'a` with `'static`
error: aborting due to 6 previous errors

View File

@ -5,8 +5,6 @@ LL | fn caller<'a>(x: &isize) {
| -- lifetime `'a` defined here
LL | Foo.some_method::<&'a isize>();
| ^^^^^^^^^^^ requires that `'a` must outlive `'static`
|
= help: consider replacing `'a` with `'static`
error: aborting due to previous error

View File

@ -5,8 +5,6 @@ LL | fn g<'a, T: 'static>(v: Box<dyn A<T> + 'a>) -> Box<dyn X + 'static> {
| -- lifetime `'a` defined here
LL | Box::new(B(&*v)) as Box<dyn X>
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ returning this value requires that `'a` must outlive `'static`
|
= help: consider replacing `'a` with `'static`
error[E0515]: cannot return value referencing local data `*v`
--> $DIR/regions-close-object-into-object-2.rs:9:5

View File

@ -29,8 +29,6 @@ LL | fn i<'a, T, U>(v: Box<dyn A<U>+'a>) -> Box<dyn X + 'static> {
| -- lifetime `'a` defined here
LL | Box::new(B(&*v)) as Box<dyn X>
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ returning this value requires that `'a` must outlive `'static`
|
= help: consider replacing `'a` with `'static`
error[E0515]: cannot return value referencing local data `*v`
--> $DIR/regions-close-object-into-object-4.rs:9:5

View File

@ -5,8 +5,6 @@ LL | fn to_longer_lifetime<'r>(b_isize: Invariant<'r>) -> Invariant<'static> {
| -- lifetime `'r` defined here
LL | b_isize
| ^^^^^^^ returning this value requires that `'r` must outlive `'static`
|
= help: consider replacing `'r` with `'static`
error: aborting due to previous error

View File

@ -5,8 +5,6 @@ LL | fn to_longer_lifetime<'r>(b_isize: Invariant<'r>) -> Invariant<'static> {
| -- lifetime `'r` defined here
LL | b_isize
| ^^^^^^^ returning this value requires that `'r` must outlive `'static`
|
= help: consider replacing `'r` with `'static`
error: aborting due to previous error

View File

@ -5,8 +5,6 @@ LL | fn to_longer_lifetime<'r>(b_isize: Invariant<'r>) -> Invariant<'static> {
| -- lifetime `'r` defined here
LL | b_isize
| ^^^^^^^ returning this value requires that `'r` must outlive `'static`
|
= help: consider replacing `'r` with `'static`
error: aborting due to previous error

View File

@ -45,8 +45,6 @@ LL | fn nested<'x>(x: &'x isize) {
...
LL | if false { return x; }
| ^ returning this value requires that `'x` must outlive `'static`
|
= help: consider replacing `'x` with `'static`
error: aborting due to 4 previous errors

View File

@ -5,8 +5,6 @@ LL | fn static_id_wrong_way<'a>(t: &'a ()) -> &'static () where 'static: 'a {
| -- lifetime `'a` defined here
LL | t
| ^ returning this value requires that `'a` must outlive `'static`
|
= help: consider replacing `'a` with `'static`
error[E0621]: explicit lifetime required in the type of `u`
--> $DIR/regions-static-bound.rs:14:5

View File

@ -5,8 +5,6 @@ LL | fn static_id_wrong_way<'a>(t: &'a ()) -> &'static () where 'static: 'a {
| -- lifetime `'a` defined here
LL | t
| ^ returning this value requires that `'a` must outlive `'static`
|
= help: consider replacing `'a` with `'static`
error[E0621]: explicit lifetime required in the type of `u`
--> $DIR/regions-static-bound.rs:14:5

View File

@ -6,8 +6,6 @@ LL | fn use_<'b>(c: Invariant<'b>) {
...
LL | let _: Invariant<'static> = c;
| ^^^^^^^^^^^^^^^^^^ type annotation requires that `'b` must outlive `'static`
|
= help: consider replacing `'b` with `'static`
error: aborting due to previous error

View File

@ -31,3 +31,11 @@ pub struct NestedStruct {
pub foo: u16,
pub bar: NormalStruct,
}
#[derive(Default)]
#[non_exhaustive]
pub struct MixedVisFields {
pub a: u16,
pub b: bool,
pub(crate) foo: bool,
}

View File

@ -10,7 +10,7 @@ use enums::{
EmptyNonExhaustiveEnum, NestedNonExhaustive, NonExhaustiveEnum, NonExhaustiveSingleVariant,
VariantNonExhaustive,
};
use structs::{FunctionalRecord, NestedStruct, NormalStruct};
use structs::{FunctionalRecord, MixedVisFields, NestedStruct, NormalStruct};
#[non_exhaustive]
#[derive(Default)]
@ -141,6 +141,10 @@ fn main() {
//~^ some fields are not explicitly listed
//~^^ some fields are not explicitly listed
// Ok: this tests https://github.com/rust-lang/rust/issues/89382
#[warn(non_exhaustive_omitted_patterns)]
let MixedVisFields { a, b, .. } = MixedVisFields::default();
// Ok: because this only has 1 variant
#[deny(non_exhaustive_omitted_patterns)]
match NonExhaustiveSingleVariant::A(true) {

View File

@ -129,13 +129,13 @@ LL | #[deny(non_exhaustive_omitted_patterns)]
= note: the matched value is of type `ErrorKind` and the `non_exhaustive_omitted_patterns` attribute was found
error: some variants are not matched explicitly
--> $DIR/reachable-patterns.rs:153:9
--> $DIR/reachable-patterns.rs:157:9
|
LL | _ => {}
| ^ pattern `A(_)` not covered
|
note: the lint level is defined here
--> $DIR/reachable-patterns.rs:151:12
--> $DIR/reachable-patterns.rs:155:12
|
LL | #[deny(non_exhaustive_omitted_patterns)]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

View File

@ -13,7 +13,7 @@ error: `<Int as Add>::add` is not yet stable as a const fn
LL | Int(1i32) + Int(2i32)
| ^^^^^^^^^^^^^^^^^^^^^
|
= help: Const-stable functions can only call other const-stable functions
= help: const-stable functions can only call other const-stable functions
error: aborting due to 2 previous errors

View File

@ -5,8 +5,6 @@ LL | fn use_it<'a, T>(val: &'a dyn ObjectTrait<T>) -> impl OtherTrait<'a> +
| --- `val` is a reference that is only valid in the function body
LL | val.use_self::<T>()
| ^^^^^^^^^^^^^^^^^^^ `val` escapes the function body here
|
= help: consider replacing `'a` with `'static`
error[E0521]: borrowed data escapes outside of function
--> $DIR/impl-on-dyn-trait-with-implicit-static-bound.rs:69:9
@ -15,8 +13,6 @@ LL | fn use_it<'a>(val: &'a dyn ObjectTrait) -> impl OtherTrait<'a> + 'a {
| --- `val` is a reference that is only valid in the function body
LL | val.use_self()
| ^^^^^^^^^^^^^^ `val` escapes the function body here
|
= help: consider replacing `'a` with `'static`
error[E0521]: borrowed data escapes outside of function
--> $DIR/impl-on-dyn-trait-with-implicit-static-bound.rs:88:9
@ -25,8 +21,6 @@ LL | fn use_it<'a>(val: &'a dyn ObjectTrait) -> impl OtherTrait<'a> {
| --- `val` is a reference that is only valid in the function body
LL | val.use_self()
| ^^^^^^^^^^^^^^ `val` escapes the function body here
|
= help: consider replacing `'a` with `'static`
error[E0521]: borrowed data escapes outside of function
--> $DIR/impl-on-dyn-trait-with-implicit-static-bound.rs:108:9
@ -35,8 +29,6 @@ LL | fn use_it<'a>(val: &'a dyn ObjectTrait) -> impl OtherTrait<'a> + 'a {
| --- `val` is a reference that is only valid in the function body
LL | MyTrait::use_self(val)
| ^^^^^^^^^^^^^^^^^^^^^^ `val` escapes the function body here
|
= help: consider replacing `'a` with `'static`
error: aborting due to 4 previous errors

View File

@ -32,8 +32,6 @@ LL | | current: None,
LL | | remaining: self.0.iter(),
LL | | }
| |_________^ returning this value requires that `'a` must outlive `'static`
|
= help: consider replacing `'a` with `'static`
error: lifetime may not live long enough
--> $DIR/trait-object-nested-in-impl-trait.rs:60:30
@ -43,7 +41,6 @@ LL | fn iter<'a>(&'a self) -> impl Iterator<Item = Box<dyn Foo>> {
| |
| lifetime `'a` defined here
|
= help: consider replacing `'a` with `'static`
help: to allow this `impl Trait` to capture borrowed data with lifetime `'a`, add `'a` as a bound
|
LL | fn iter<'a>(&'a self) -> impl Iterator<Item = Box<dyn Foo>> + 'a {

View File

@ -5,8 +5,6 @@ LL | fn take<'a>(_: &'a u32) {
| -- lifetime `'a` defined here
LL | let _: Box<dyn Foo<Bar = &'a u32>> = make();
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ type annotation requires that `'a` must outlive `'static`
|
= help: consider replacing `'a` with `'static`
error: aborting due to previous error

View File

@ -5,8 +5,6 @@ LL | fn iter_cov_key<'a, 'new>(v: IterMut<'a, &'static (), ()>) -> IterMut<'a, &
| ---- lifetime `'new` defined here
LL | v
| ^ returning this value requires that `'new` must outlive `'static`
|
= help: consider replacing `'new` with `'static`
error: lifetime may not live long enough
--> $DIR/variance-btree-invariant-types.rs:7:5
@ -15,8 +13,6 @@ LL | fn iter_cov_val<'a, 'new>(v: IterMut<'a, (), &'static ()>) -> IterMut<'a, (
| ---- lifetime `'new` defined here
LL | v
| ^ returning this value requires that `'new` must outlive `'static`
|
= help: consider replacing `'new` with `'static`
error: lifetime may not live long enough
--> $DIR/variance-btree-invariant-types.rs:10:5
@ -25,8 +21,6 @@ LL | fn iter_contra_key<'a, 'new>(v: IterMut<'a, &'new (), ()>) -> IterMut<'a, &
| ---- lifetime `'new` defined here
LL | v
| ^ returning this value requires that `'new` must outlive `'static`
|
= help: consider replacing `'new` with `'static`
error: lifetime may not live long enough
--> $DIR/variance-btree-invariant-types.rs:13:5
@ -35,8 +29,6 @@ LL | fn iter_contra_val<'a, 'new>(v: IterMut<'a, (), &'new ()>) -> IterMut<'a, (
| ---- lifetime `'new` defined here
LL | v
| ^ returning this value requires that `'new` must outlive `'static`
|
= help: consider replacing `'new` with `'static`
error: lifetime may not live long enough
--> $DIR/variance-btree-invariant-types.rs:17:5
@ -45,8 +37,6 @@ LL | fn range_cov_key<'a, 'new>(v: RangeMut<'a, &'static (), ()>) -> RangeMut<'a
| ---- lifetime `'new` defined here
LL | v
| ^ returning this value requires that `'new` must outlive `'static`
|
= help: consider replacing `'new` with `'static`
error: lifetime may not live long enough
--> $DIR/variance-btree-invariant-types.rs:20:5
@ -55,8 +45,6 @@ LL | fn range_cov_val<'a, 'new>(v: RangeMut<'a, (), &'static ()>) -> RangeMut<'a
| ---- lifetime `'new` defined here
LL | v
| ^ returning this value requires that `'new` must outlive `'static`
|
= help: consider replacing `'new` with `'static`
error: lifetime may not live long enough
--> $DIR/variance-btree-invariant-types.rs:23:5
@ -65,8 +53,6 @@ LL | fn range_contra_key<'a, 'new>(v: RangeMut<'a, &'new (), ()>) -> RangeMut<'a
| ---- lifetime `'new` defined here
LL | v
| ^ returning this value requires that `'new` must outlive `'static`
|
= help: consider replacing `'new` with `'static`
error: lifetime may not live long enough
--> $DIR/variance-btree-invariant-types.rs:26:5
@ -75,8 +61,6 @@ LL | fn range_contra_val<'a, 'new>(v: RangeMut<'a, (), &'new ()>) -> RangeMut<'a
| ---- lifetime `'new` defined here
LL | v
| ^ returning this value requires that `'new` must outlive `'static`
|
= help: consider replacing `'new` with `'static`
error: lifetime may not live long enough
--> $DIR/variance-btree-invariant-types.rs:31:5
@ -86,8 +70,6 @@ LL | fn occ_cov_key<'a, 'new>(v: OccupiedEntry<'a, &'static (), ()>)
LL | -> OccupiedEntry<'a, &'new (), ()> {
LL | v
| ^ returning this value requires that `'new` must outlive `'static`
|
= help: consider replacing `'new` with `'static`
error: lifetime may not live long enough
--> $DIR/variance-btree-invariant-types.rs:35:5
@ -97,8 +79,6 @@ LL | fn occ_cov_val<'a, 'new>(v: OccupiedEntry<'a, (), &'static ()>)
LL | -> OccupiedEntry<'a, (), &'new ()> {
LL | v
| ^ returning this value requires that `'new` must outlive `'static`
|
= help: consider replacing `'new` with `'static`
error: lifetime may not live long enough
--> $DIR/variance-btree-invariant-types.rs:39:5
@ -108,8 +88,6 @@ LL | fn occ_contra_key<'a, 'new>(v: OccupiedEntry<'a, &'new (), ()>)
LL | -> OccupiedEntry<'a, &'static (), ()> {
LL | v
| ^ returning this value requires that `'new` must outlive `'static`
|
= help: consider replacing `'new` with `'static`
error: lifetime may not live long enough
--> $DIR/variance-btree-invariant-types.rs:43:5
@ -119,8 +97,6 @@ LL | fn occ_contra_val<'a, 'new>(v: OccupiedEntry<'a, (), &'new ()>)
LL | -> OccupiedEntry<'a, (), &'static ()> {
LL | v
| ^ returning this value requires that `'new` must outlive `'static`
|
= help: consider replacing `'new` with `'static`
error: lifetime may not live long enough
--> $DIR/variance-btree-invariant-types.rs:48:5
@ -130,8 +106,6 @@ LL | fn vac_cov_key<'a, 'new>(v: VacantEntry<'a, &'static (), ()>)
LL | -> VacantEntry<'a, &'new (), ()> {
LL | v
| ^ returning this value requires that `'new` must outlive `'static`
|
= help: consider replacing `'new` with `'static`
error: lifetime may not live long enough
--> $DIR/variance-btree-invariant-types.rs:52:5
@ -141,8 +115,6 @@ LL | fn vac_cov_val<'a, 'new>(v: VacantEntry<'a, (), &'static ()>)
LL | -> VacantEntry<'a, (), &'new ()> {
LL | v
| ^ returning this value requires that `'new` must outlive `'static`
|
= help: consider replacing `'new` with `'static`
error: lifetime may not live long enough
--> $DIR/variance-btree-invariant-types.rs:56:5
@ -152,8 +124,6 @@ LL | fn vac_contra_key<'a, 'new>(v: VacantEntry<'a, &'new (), ()>)
LL | -> VacantEntry<'a, &'static (), ()> {
LL | v
| ^ returning this value requires that `'new` must outlive `'static`
|
= help: consider replacing `'new` with `'static`
error: lifetime may not live long enough
--> $DIR/variance-btree-invariant-types.rs:60:5
@ -163,8 +133,6 @@ LL | fn vac_contra_val<'a, 'new>(v: VacantEntry<'a, (), &'new ()>)
LL | -> VacantEntry<'a, (), &'static ()> {
LL | v
| ^ returning this value requires that `'new` must outlive `'static`
|
= help: consider replacing `'new` with `'static`
error: aborting due to 16 previous errors

View File

@ -143,56 +143,41 @@ impl Formatter for HTMLFormatter {
r##"<script>
function onEach(arr, func) {{
if (arr && arr.length > 0 && func) {{
for (var i = 0; i < arr.length; i++) {{
func(arr[i]);
}}
}}
}}
function hasClass(elem, className) {{
if (elem && className && elem.className) {{
var elemClass = elem.className;
var start = elemClass.indexOf(className);
if (start === -1) {{
return false;
}} else if (elemClass.length === className.length) {{
return true;
}} else {{
if (start > 0 && elemClass[start - 1] !== ' ') {{
return false;
var length = arr.length;
var i;
for (i = 0; i < length; ++i) {{
if (func(arr[i])) {{
return true;
}}
var end = start + className.length;
if (end < elemClass.length && elemClass[end] !== ' ') {{
return false;
}}
return true;
}}
if (start > 0 && elemClass[start - 1] !== ' ') {{
return false;
}}
var end = start + className.length;
if (end < elemClass.length && elemClass[end] !== ' ') {{
return false;
}}
return true;
}}
return false;
}}
onEach(document.getElementsByClassName('rust-example-rendered'), function(e) {{
function onEachLazy(lazyArray, func) {{
return onEach(
Array.prototype.slice.call(lazyArray),
func);
}}
function hasClass(elem, className) {{
return elem && elem.classList && elem.classList.contains(className);
}}
onEachLazy(document.getElementsByClassName('rust-example-rendered'), function(e) {{
if (hasClass(e, 'compile_fail')) {{
e.addEventListener("mouseover", function(event) {{
e.previousElementSibling.childNodes[0].style.color = '#f00';
e.parentElement.previousElementSibling.childNodes[0].style.color = '#f00';
}});
e.addEventListener("mouseout", function(event) {{
e.previousElementSibling.childNodes[0].style.color = '';
e.parentElement.previousElementSibling.childNodes[0].style.color = '';
}});
}} else if (hasClass(e, 'ignore')) {{
e.addEventListener("mouseover", function(event) {{
e.previousElementSibling.childNodes[0].style.color = '#ff9200';
e.parentElement.previousElementSibling.childNodes[0].style.color = '#ff9200';
}});
e.addEventListener("mouseout", function(event) {{
e.previousElementSibling.childNodes[0].style.color = '';
e.parentElement.previousElementSibling.childNodes[0].style.color = '';
}});
}}
}});

View File

@ -172,7 +172,7 @@ async function main(argv) {
}
files.sort();
console.log(`Running ${files.length} rustdoc-gui tests...`);
console.log(`Running ${files.length} rustdoc-gui (${opts["jobs"]} concurrently) ...`);
if (opts["jobs"] < 1) {
process.setMaxListeners(files.length + 1);