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 10 pull requests #98066

Merged
merged 25 commits into from
Jun 13, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
27af8e4
Normalize consts' tys when relating with adt_const_params
compiler-errors Jun 3, 2022
d8f0765
Remove doc
JohnTitor Jun 8, 2022
153f01e
Remove the `infer_static_outlives_requirements` feature
JohnTitor Jun 8, 2022
40913c6
Remove related tests
JohnTitor Jun 8, 2022
e5245ef
interpret: unify offset_from check with offset check
RalfJung Jun 10, 2022
2f923c4
Make type_changing_struct_update no longer incomplete
compiler-errors Jun 11, 2022
77d6176
remove unnecessary `to_string` and `String::new`
TaKO8Ki Jun 13, 2022
fd1290a
remove unnecessary `to_string` and `String::new` for `tool_only_span_…
TaKO8Ki Jun 13, 2022
ddd18a5
del unrelated comment
dust1 Jun 13, 2022
55b3c44
remove use Cell in variance-object-types.rs
dust1 Jun 13, 2022
acda886
Document an edge case of `str::split_once`
imbolc Jun 13, 2022
c15fed5
Update variance-object-types.stderr
dust1 Jun 13, 2022
c4b43d8
Add some more regression tests for #67945
JohnTitor Jun 13, 2022
af8c1e3
fix error message for download-ci-llvm
pietroalbini Jun 13, 2022
3305b66
Update miri
oli-obk Jun 13, 2022
e13eeed
Rollup merge of #97709 - compiler-errors:normalize-const-param-ty, r=…
matthiaskrgr Jun 13, 2022
89249b1
Rollup merge of #97875 - JohnTitor:rm-infer-static-outlives-requireme…
matthiaskrgr Jun 13, 2022
426922b
Rollup merge of #97960 - RalfJung:offset-from, r=oli-obk
matthiaskrgr Jun 13, 2022
f758b4f
Rollup merge of #97999 - compiler-errors:type_changin_struct_update_i…
matthiaskrgr Jun 13, 2022
9d27f2e
Rollup merge of #98043 - TaKO8Ki:remove-unnecessary-to-string, r=davi…
matthiaskrgr Jun 13, 2022
94443f2
Rollup merge of #98044 - dust1:master, r=Dylan-DPC
matthiaskrgr Jun 13, 2022
62eb97a
Rollup merge of #98049 - imbolc:patch-3, r=Dylan-DPC
matthiaskrgr Jun 13, 2022
3f17cd7
Rollup merge of #98050 - JohnTitor:issue-67945, r=compiler-errors
matthiaskrgr Jun 13, 2022
68cb0a7
Rollup merge of #98054 - ferrocene:pa-fix-llvm-download-spaces, r=jyn514
matthiaskrgr Jun 13, 2022
af1f614
Rollup merge of #98057 - oli-obk:miri_ui_test, r=oli-obk
matthiaskrgr Jun 13, 2022
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
Prev Previous commit
Next Next commit
Remove the infer_static_outlives_requirements feature
  • Loading branch information
JohnTitor committed Jun 8, 2022
commit 153f01e42ca07712d5a10bbbc28f8aa621fa1212
2 changes: 0 additions & 2 deletions compiler/rustc_feature/src/active.rs
Original file line number Diff line number Diff line change
Expand Up @@ -411,8 +411,6 @@ declare_features! (
(active, if_let_guard, "1.47.0", Some(51114), None),
/// Allows using imported `main` function
(active, imported_main, "1.53.0", Some(28937), None),
/// Allows inferring `'static` outlives requirements (RFC 2093).
(active, infer_static_outlives_requirements, "1.26.0", Some(54185), None),
/// Allows associated types in inherent impls.
(incomplete, inherent_associated_types, "1.52.0", Some(8995), None),
/// Allow anonymous constants from an inline `const` block
Expand Down
3 changes: 3 additions & 0 deletions compiler/rustc_feature/src/removed.rs
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,9 @@ declare_features! (
/// Allows in-band quantification of lifetime bindings (e.g., `fn foo(x: &'a u8) -> &'a u8`).
(removed, in_band_lifetimes, "1.23.0", Some(44524), None,
Some("removed due to unsolved ergonomic questions and added lifetime resolution complexity")),
/// Allows inferring `'static` outlives requirements (RFC 2093).
(removed, infer_static_outlives_requirements, "1.63.0", Some(54185), None,
Some("removed as it caused some confusion and discussion was inactive for years")),
/// Lazily evaluate constants. This allows constants to depend on type parameters.
(removed, lazy_normalization_consts, "1.46.0", Some(72219), None, Some("superseded by `generic_const_exprs`")),
/// Allows using the `#[link_args]` attribute.
Expand Down
13 changes: 2 additions & 11 deletions compiler/rustc_lint/src/builtin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2113,7 +2113,6 @@ impl ExplicitOutlivesRequirements {
tcx: TyCtxt<'tcx>,
bounds: &hir::GenericBounds<'_>,
inferred_outlives: &[ty::Region<'tcx>],
infer_static: bool,
) -> Vec<(usize, Span)> {
use rustc_middle::middle::resolve_lifetime::Region;

Expand All @@ -2123,9 +2122,6 @@ impl ExplicitOutlivesRequirements {
.filter_map(|(i, bound)| {
if let hir::GenericBound::Outlives(lifetime) = bound {
let is_inferred = match tcx.named_region(lifetime.hir_id) {
Some(Region::Static) if infer_static => {
inferred_outlives.iter().any(|r| matches!(**r, ty::ReStatic))
}
Some(Region::EarlyBound(index, ..)) => inferred_outlives.iter().any(|r| {
if let ty::ReEarlyBound(ebr) = **r { ebr.index == index } else { false }
}),
Expand Down Expand Up @@ -2201,7 +2197,6 @@ impl<'tcx> LateLintPass<'tcx> for ExplicitOutlivesRequirements {
fn check_item(&mut self, cx: &LateContext<'tcx>, item: &'tcx hir::Item<'_>) {
use rustc_middle::middle::resolve_lifetime::Region;

let infer_static = cx.tcx.features().infer_static_outlives_requirements;
let def_id = item.def_id;
if let hir::ItemKind::Struct(_, ref hir_generics)
| hir::ItemKind::Enum(_, ref hir_generics)
Expand Down Expand Up @@ -2262,12 +2257,8 @@ impl<'tcx> LateLintPass<'tcx> for ExplicitOutlivesRequirements {
continue;
}

let bound_spans = self.collect_outlives_bound_spans(
cx.tcx,
bounds,
&relevant_lifetimes,
infer_static,
);
let bound_spans =
self.collect_outlives_bound_spans(cx.tcx, bounds, &relevant_lifetimes);
bound_count += bound_spans.len();

let drop_predicate = bound_spans.len() == bounds.len();
Expand Down
11 changes: 5 additions & 6 deletions compiler/rustc_typeck/src/outlives/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ pub fn insert_outlives_predicate<'tcx>(
) {
// If the `'a` region is bound within the field type itself, we
// don't want to propagate this constraint to the header.
if !is_free_region(tcx, outlived_region) {
if !is_free_region(outlived_region) {
return;
}

Expand Down Expand Up @@ -119,7 +119,7 @@ pub fn insert_outlives_predicate<'tcx>(
}

GenericArgKind::Lifetime(r) => {
if !is_free_region(tcx, r) {
if !is_free_region(r) {
return;
}
required_predicates.entry(ty::OutlivesPredicate(kind, outlived_region)).or_insert(span);
Expand All @@ -131,7 +131,7 @@ pub fn insert_outlives_predicate<'tcx>(
}
}

fn is_free_region(tcx: TyCtxt<'_>, region: Region<'_>) -> bool {
fn is_free_region(region: Region<'_>) -> bool {
// First, screen for regions that might appear in a type header.
match *region {
// These correspond to `T: 'a` relationships:
Expand All @@ -144,13 +144,12 @@ fn is_free_region(tcx: TyCtxt<'_>, region: Region<'_>) -> bool {
ty::ReEarlyBound(_) => true,

// These correspond to `T: 'static` relationships which can be
// rather surprising. We are therefore putting this behind a
// feature flag:
// rather surprising.
//
// struct Foo<'a, T> {
// field: &'static T, // this would generate a ReStatic
// }
ty::ReStatic => tcx.sess.features_untracked().infer_static_outlives_requirements,
ty::ReStatic => false,

// Late-bound regions can appear in `fn` types:
//
Expand Down