Auto merge of #116054 - matthiaskrgr:rollup-3pusno6, r=matthiaskrgr
Rollup of 7 pull requests Successful merges: - #114379 (Command: also print removed env vars) - #116034 (add UI test for delimiter errors) - #116036 (tests/ui: Split large_moves.rs and move to lint/large_assignments) - #116038 (Fall back to _SC_NPROCESSORS_ONLN if sched_getaffinity returns an empty mask) - #116039 (Account for nested `impl Trait` in TAIT) - #116041 (Add note to `is_known_rigid`) - #116049 (give FutureIncompatibilityReason variants more explicit names) r? `@ghost` `@rustbot` modify labels: rollup
This commit is contained in:
commit
03c199af8e
29 changed files with 374 additions and 136 deletions
|
@ -151,7 +151,12 @@ impl fmt::Display for DiagnosticLocation {
|
|||
#[derive(Clone, Debug, PartialEq, Eq, Hash, Encodable, Decodable)]
|
||||
pub enum DiagnosticId {
|
||||
Error(String),
|
||||
Lint { name: String, has_future_breakage: bool, is_force_warn: bool },
|
||||
Lint {
|
||||
name: String,
|
||||
/// Indicates whether this lint should show up in cargo's future breakage report.
|
||||
has_future_breakage: bool,
|
||||
is_force_warn: bool,
|
||||
},
|
||||
}
|
||||
|
||||
/// A "sub"-diagnostic attached to a parent diagnostic.
|
||||
|
@ -301,6 +306,7 @@ impl Diagnostic {
|
|||
}
|
||||
}
|
||||
|
||||
/// Indicates whether this diagnostic should show up in cargo's future breakage report.
|
||||
pub fn has_future_breakage(&self) -> bool {
|
||||
match self.code {
|
||||
Some(DiagnosticId::Lint { has_future_breakage, .. }) => has_future_breakage,
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
use rustc_errors::StashKey;
|
||||
use rustc_hir::def_id::LocalDefId;
|
||||
use rustc_hir::intravisit::{self, Visitor};
|
||||
use rustc_hir::{self as hir, Expr, ImplItem, Item, Node, TraitItem};
|
||||
use rustc_hir::{self as hir, def, Expr, ImplItem, Item, Node, TraitItem};
|
||||
use rustc_middle::hir::nested_filter;
|
||||
use rustc_middle::ty::{self, Ty, TyCtxt, TypeVisitableExt};
|
||||
use rustc_span::DUMMY_SP;
|
||||
|
@ -74,9 +74,14 @@ pub(super) fn find_opaque_ty_constraints_for_tait(tcx: TyCtxt<'_>, def_id: Local
|
|||
|
||||
hidden.ty
|
||||
} else {
|
||||
let mut parent_def_id = def_id;
|
||||
while tcx.def_kind(parent_def_id) == def::DefKind::OpaqueTy {
|
||||
// Account for `type Alias = impl Trait<Foo = impl Trait>;` (#116031)
|
||||
parent_def_id = tcx.local_parent(parent_def_id);
|
||||
}
|
||||
let reported = tcx.sess.emit_err(UnconstrainedOpaqueType {
|
||||
span: tcx.def_span(def_id),
|
||||
name: tcx.item_name(tcx.local_parent(def_id).to_def_id()),
|
||||
name: tcx.item_name(parent_def_id.to_def_id()),
|
||||
what: match tcx.hir().get(scope) {
|
||||
_ if scope == hir::CRATE_HIR_ID => "module",
|
||||
Node::Item(hir::Item { kind: hir::ItemKind::Mod(_), .. }) => "module",
|
||||
|
|
|
@ -34,8 +34,8 @@ declare_lint! {
|
|||
Warn,
|
||||
"detects calling `into_iter` on arrays in Rust 2015 and 2018",
|
||||
@future_incompatible = FutureIncompatibleInfo {
|
||||
reference: "<https://doc.rust-lang.org/nightly/edition-guide/rust-2021/IntoIterator-for-arrays.html>",
|
||||
reason: FutureIncompatibilityReason::EditionSemanticsChange(Edition::Edition2021),
|
||||
reference: "<https://doc.rust-lang.org/nightly/edition-guide/rust-2021/IntoIterator-for-arrays.html>",
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
@ -844,8 +844,8 @@ declare_lint! {
|
|||
Warn,
|
||||
"detects anonymous parameters",
|
||||
@future_incompatible = FutureIncompatibleInfo {
|
||||
reference: "issue #41686 <https://github.com/rust-lang/rust/issues/41686>",
|
||||
reason: FutureIncompatibilityReason::EditionError(Edition::Edition2018),
|
||||
reference: "issue #41686 <https://github.com/rust-lang/rust/issues/41686>",
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -1669,8 +1669,8 @@ declare_lint! {
|
|||
Warn,
|
||||
"`...` range patterns are deprecated",
|
||||
@future_incompatible = FutureIncompatibleInfo {
|
||||
reference: "<https://doc.rust-lang.org/nightly/edition-guide/rust-2021/warnings-promoted-to-error.html>",
|
||||
reason: FutureIncompatibilityReason::EditionError(Edition::Edition2021),
|
||||
reference: "<https://doc.rust-lang.org/nightly/edition-guide/rust-2021/warnings-promoted-to-error.html>",
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -1804,8 +1804,8 @@ declare_lint! {
|
|||
Allow,
|
||||
"detects edition keywords being used as an identifier",
|
||||
@future_incompatible = FutureIncompatibleInfo {
|
||||
reference: "issue #49716 <https://github.com/rust-lang/rust/issues/49716>",
|
||||
reason: FutureIncompatibilityReason::EditionError(Edition::Edition2018),
|
||||
reference: "issue #49716 <https://github.com/rust-lang/rust/issues/49716>",
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
@ -5,6 +5,7 @@ use crate::{
|
|||
|
||||
use rustc_hir as hir;
|
||||
use rustc_middle::{traits::util::supertraits, ty};
|
||||
use rustc_session::lint::FutureIncompatibilityReason;
|
||||
use rustc_span::sym;
|
||||
|
||||
declare_lint! {
|
||||
|
@ -48,6 +49,7 @@ declare_lint! {
|
|||
Warn,
|
||||
"`Deref` implementation usage with a supertrait trait object for output might be shadowed in the future",
|
||||
@future_incompatible = FutureIncompatibleInfo {
|
||||
reason: FutureIncompatibilityReason::FutureReleaseErrorDontReportInDeps,
|
||||
reference: "issue #89460 <https://github.com/rust-lang/rust/issues/89460>",
|
||||
};
|
||||
}
|
||||
|
|
|
@ -39,6 +39,7 @@ declare_lint! {
|
|||
Warn,
|
||||
"applying forbid to lint-groups",
|
||||
@future_incompatible = FutureIncompatibleInfo {
|
||||
reason: FutureIncompatibilityReason::FutureReleaseErrorDontReportInDeps,
|
||||
reference: "issue #81670 <https://github.com/rust-lang/rust/issues/81670>",
|
||||
};
|
||||
}
|
||||
|
@ -74,6 +75,7 @@ declare_lint! {
|
|||
Deny,
|
||||
"ill-formed attribute inputs that were previously accepted and used in practice",
|
||||
@future_incompatible = FutureIncompatibleInfo {
|
||||
reason: FutureIncompatibilityReason::FutureReleaseErrorDontReportInDeps,
|
||||
reference: "issue #57571 <https://github.com/rust-lang/rust/issues/57571>",
|
||||
};
|
||||
crate_level_only
|
||||
|
@ -110,6 +112,7 @@ declare_lint! {
|
|||
Deny,
|
||||
"conflicts between `#[repr(..)]` hints that were previously accepted and used in practice",
|
||||
@future_incompatible = FutureIncompatibleInfo {
|
||||
reason: FutureIncompatibilityReason::FutureReleaseErrorDontReportInDeps,
|
||||
reference: "issue #68585 <https://github.com/rust-lang/rust/issues/68585>",
|
||||
};
|
||||
}
|
||||
|
@ -1016,8 +1019,8 @@ declare_lint! {
|
|||
Deny,
|
||||
"raw pointers must be aligned before dereferencing",
|
||||
@future_incompatible = FutureIncompatibleInfo {
|
||||
reason: FutureIncompatibilityReason::FutureReleaseErrorReportInDeps,
|
||||
reference: "issue #68585 <https://github.com/rust-lang/rust/issues/104616>",
|
||||
reason: FutureIncompatibilityReason::FutureReleaseErrorReportNow,
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -1096,6 +1099,7 @@ declare_lint! {
|
|||
Deny,
|
||||
"detect public re-exports of private extern crates",
|
||||
@future_incompatible = FutureIncompatibleInfo {
|
||||
reason: FutureIncompatibilityReason::FutureReleaseErrorDontReportInDeps,
|
||||
reference: "issue #34537 <https://github.com/rust-lang/rust/issues/34537>",
|
||||
};
|
||||
}
|
||||
|
@ -1125,6 +1129,7 @@ declare_lint! {
|
|||
Deny,
|
||||
"type parameter default erroneously allowed in invalid location",
|
||||
@future_incompatible = FutureIncompatibleInfo {
|
||||
reason: FutureIncompatibilityReason::FutureReleaseErrorDontReportInDeps,
|
||||
reference: "issue #36887 <https://github.com/rust-lang/rust/issues/36887>",
|
||||
};
|
||||
}
|
||||
|
@ -1267,6 +1272,7 @@ declare_lint! {
|
|||
Deny,
|
||||
"patterns in functions without body were erroneously allowed",
|
||||
@future_incompatible = FutureIncompatibleInfo {
|
||||
reason: FutureIncompatibilityReason::FutureReleaseErrorDontReportInDeps,
|
||||
reference: "issue #35203 <https://github.com/rust-lang/rust/issues/35203>",
|
||||
};
|
||||
}
|
||||
|
@ -1310,6 +1316,7 @@ declare_lint! {
|
|||
Deny,
|
||||
"detects missing fragment specifiers in unused `macro_rules!` patterns",
|
||||
@future_incompatible = FutureIncompatibleInfo {
|
||||
reason: FutureIncompatibilityReason::FutureReleaseErrorDontReportInDeps,
|
||||
reference: "issue #40107 <https://github.com/rust-lang/rust/issues/40107>",
|
||||
};
|
||||
}
|
||||
|
@ -1351,6 +1358,7 @@ declare_lint! {
|
|||
Warn,
|
||||
"detects generic lifetime arguments in path segments with late bound lifetime parameters",
|
||||
@future_incompatible = FutureIncompatibleInfo {
|
||||
reason: FutureIncompatibilityReason::FutureReleaseErrorDontReportInDeps,
|
||||
reference: "issue #42868 <https://github.com/rust-lang/rust/issues/42868>",
|
||||
};
|
||||
}
|
||||
|
@ -1386,8 +1394,8 @@ declare_lint! {
|
|||
Deny,
|
||||
"trait-object types were treated as different depending on marker-trait order",
|
||||
@future_incompatible = FutureIncompatibleInfo {
|
||||
reason: FutureIncompatibilityReason::FutureReleaseErrorReportInDeps,
|
||||
reference: "issue #56484 <https://github.com/rust-lang/rust/issues/56484>",
|
||||
reason: FutureIncompatibilityReason::FutureReleaseErrorReportNow,
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -1426,6 +1434,7 @@ declare_lint! {
|
|||
Warn,
|
||||
"distinct impls distinguished only by the leak-check code",
|
||||
@future_incompatible = FutureIncompatibleInfo {
|
||||
reason: FutureIncompatibilityReason::FutureReleaseErrorDontReportInDeps,
|
||||
reference: "issue #56105 <https://github.com/rust-lang/rust/issues/56105>",
|
||||
};
|
||||
}
|
||||
|
@ -1617,8 +1626,8 @@ declare_lint! {
|
|||
Warn,
|
||||
"raw pointer to an inference variable",
|
||||
@future_incompatible = FutureIncompatibleInfo {
|
||||
reference: "issue #46906 <https://github.com/rust-lang/rust/issues/46906>",
|
||||
reason: FutureIncompatibilityReason::EditionError(Edition::Edition2018),
|
||||
reference: "issue #46906 <https://github.com/rust-lang/rust/issues/46906>",
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -1685,8 +1694,8 @@ declare_lint! {
|
|||
Warn,
|
||||
"suggest using `dyn Trait` for trait objects",
|
||||
@future_incompatible = FutureIncompatibleInfo {
|
||||
reference: "<https://doc.rust-lang.org/nightly/edition-guide/rust-2021/warnings-promoted-to-error.html>",
|
||||
reason: FutureIncompatibilityReason::EditionError(Edition::Edition2021),
|
||||
reference: "<https://doc.rust-lang.org/nightly/edition-guide/rust-2021/warnings-promoted-to-error.html>",
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -1740,8 +1749,8 @@ declare_lint! {
|
|||
"fully qualified paths that start with a module name \
|
||||
instead of `crate`, `self`, or an extern crate name",
|
||||
@future_incompatible = FutureIncompatibleInfo {
|
||||
reference: "issue #53130 <https://github.com/rust-lang/rust/issues/53130>",
|
||||
reason: FutureIncompatibilityReason::EditionError(Edition::Edition2018),
|
||||
reference: "issue #53130 <https://github.com/rust-lang/rust/issues/53130>",
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -1789,6 +1798,7 @@ declare_lint! {
|
|||
Warn,
|
||||
"floating-point literals cannot be used in patterns",
|
||||
@future_incompatible = FutureIncompatibleInfo {
|
||||
reason: FutureIncompatibilityReason::FutureReleaseErrorDontReportInDeps,
|
||||
reference: "issue #41620 <https://github.com/rust-lang/rust/issues/41620>",
|
||||
};
|
||||
}
|
||||
|
@ -1939,6 +1949,7 @@ declare_lint! {
|
|||
Warn,
|
||||
"checks the object safety of where clauses",
|
||||
@future_incompatible = FutureIncompatibleInfo {
|
||||
reason: FutureIncompatibilityReason::FutureReleaseErrorDontReportInDeps,
|
||||
reference: "issue #51443 <https://github.com/rust-lang/rust/issues/51443>",
|
||||
};
|
||||
}
|
||||
|
@ -2005,8 +2016,8 @@ declare_lint! {
|
|||
Deny,
|
||||
"detects proc macro derives using inaccessible names from parent modules",
|
||||
@future_incompatible = FutureIncompatibleInfo {
|
||||
reason: FutureIncompatibilityReason::FutureReleaseErrorReportInDeps,
|
||||
reference: "issue #83583 <https://github.com/rust-lang/rust/issues/83583>",
|
||||
reason: FutureIncompatibilityReason::FutureReleaseErrorReportNow,
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -2108,6 +2119,7 @@ declare_lint! {
|
|||
"macro-expanded `macro_export` macros from the current crate \
|
||||
cannot be referred to by absolute paths",
|
||||
@future_incompatible = FutureIncompatibleInfo {
|
||||
reason: FutureIncompatibilityReason::FutureReleaseErrorDontReportInDeps,
|
||||
reference: "issue #52234 <https://github.com/rust-lang/rust/issues/52234>",
|
||||
};
|
||||
crate_level_only
|
||||
|
@ -2199,6 +2211,7 @@ declare_lint! {
|
|||
Warn,
|
||||
"constant used in pattern contains value of non-structural-match type in a field or a variant",
|
||||
@future_incompatible = FutureIncompatibleInfo {
|
||||
reason: FutureIncompatibilityReason::FutureReleaseErrorDontReportInDeps,
|
||||
reference: "issue #62411 <https://github.com/rust-lang/rust/issues/62411>",
|
||||
};
|
||||
}
|
||||
|
@ -2253,6 +2266,7 @@ declare_lint! {
|
|||
Allow,
|
||||
"pointers are not structural-match",
|
||||
@future_incompatible = FutureIncompatibleInfo {
|
||||
reason: FutureIncompatibilityReason::FutureReleaseErrorDontReportInDeps,
|
||||
reference: "issue #62411 <https://github.com/rust-lang/rust/issues/70861>",
|
||||
};
|
||||
}
|
||||
|
@ -2291,6 +2305,7 @@ declare_lint! {
|
|||
"constant used in pattern of non-structural-match type and the constant's initializer \
|
||||
expression contains values of non-structural-match types",
|
||||
@future_incompatible = FutureIncompatibleInfo {
|
||||
reason: FutureIncompatibilityReason::FutureReleaseErrorDontReportInDeps,
|
||||
reference: "issue #73448 <https://github.com/rust-lang/rust/issues/73448>",
|
||||
};
|
||||
}
|
||||
|
@ -2348,6 +2363,7 @@ declare_lint! {
|
|||
Deny,
|
||||
"ambiguous associated items",
|
||||
@future_incompatible = FutureIncompatibleInfo {
|
||||
reason: FutureIncompatibilityReason::FutureReleaseErrorDontReportInDeps,
|
||||
reference: "issue #57644 <https://github.com/rust-lang/rust/issues/57644>",
|
||||
};
|
||||
}
|
||||
|
@ -2389,6 +2405,7 @@ declare_lint! {
|
|||
Deny,
|
||||
"a feature gate that doesn't break dependent crates",
|
||||
@future_incompatible = FutureIncompatibleInfo {
|
||||
reason: FutureIncompatibilityReason::FutureReleaseErrorDontReportInDeps,
|
||||
reference: "issue #64266 <https://github.com/rust-lang/rust/issues/64266>",
|
||||
};
|
||||
}
|
||||
|
@ -2617,8 +2634,8 @@ declare_lint! {
|
|||
Deny,
|
||||
"a C-like enum implementing Drop is cast",
|
||||
@future_incompatible = FutureIncompatibleInfo {
|
||||
reason: FutureIncompatibilityReason::FutureReleaseErrorReportInDeps,
|
||||
reference: "issue #73333 <https://github.com/rust-lang/rust/issues/73333>",
|
||||
reason: FutureIncompatibilityReason::FutureReleaseErrorReportNow,
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -2747,6 +2764,7 @@ declare_lint! {
|
|||
Warn,
|
||||
"detects a generic constant is used in a type without a emitting a warning",
|
||||
@future_incompatible = FutureIncompatibleInfo {
|
||||
reason: FutureIncompatibilityReason::FutureReleaseErrorDontReportInDeps,
|
||||
reference: "issue #76200 <https://github.com/rust-lang/rust/issues/76200>",
|
||||
};
|
||||
}
|
||||
|
@ -2805,6 +2823,7 @@ declare_lint! {
|
|||
Warn,
|
||||
"uninhabited static",
|
||||
@future_incompatible = FutureIncompatibleInfo {
|
||||
reason: FutureIncompatibilityReason::FutureReleaseErrorDontReportInDeps,
|
||||
reference: "issue #74840 <https://github.com/rust-lang/rust/issues/74840>",
|
||||
};
|
||||
}
|
||||
|
@ -2975,8 +2994,8 @@ declare_lint! {
|
|||
Warn,
|
||||
"trailing semicolon in macro body used as expression",
|
||||
@future_incompatible = FutureIncompatibleInfo {
|
||||
reason: FutureIncompatibilityReason::FutureReleaseErrorReportInDeps,
|
||||
reference: "issue #79813 <https://github.com/rust-lang/rust/issues/79813>",
|
||||
reason: FutureIncompatibilityReason::FutureReleaseErrorReportNow,
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -3022,6 +3041,7 @@ declare_lint! {
|
|||
Warn,
|
||||
"detects derive helper attributes that are used before they are introduced",
|
||||
@future_incompatible = FutureIncompatibleInfo {
|
||||
reason: FutureIncompatibilityReason::FutureReleaseErrorDontReportInDeps,
|
||||
reference: "issue #79202 <https://github.com/rust-lang/rust/issues/79202>",
|
||||
};
|
||||
}
|
||||
|
@ -3090,6 +3110,7 @@ declare_lint! {
|
|||
Deny,
|
||||
"detects usage of `#![cfg_attr(..., crate_type/crate_name = \"...\")]`",
|
||||
@future_incompatible = FutureIncompatibleInfo {
|
||||
reason: FutureIncompatibilityReason::FutureReleaseErrorDontReportInDeps,
|
||||
reference: "issue #91632 <https://github.com/rust-lang/rust/issues/91632>",
|
||||
};
|
||||
}
|
||||
|
@ -3181,6 +3202,7 @@ declare_lint! {
|
|||
Warn,
|
||||
"transparent type contains an external ZST that is marked #[non_exhaustive] or contains private fields",
|
||||
@future_incompatible = FutureIncompatibleInfo {
|
||||
reason: FutureIncompatibilityReason::FutureReleaseErrorDontReportInDeps,
|
||||
reference: "issue #78586 <https://github.com/rust-lang/rust/issues/78586>",
|
||||
};
|
||||
}
|
||||
|
@ -3231,6 +3253,7 @@ declare_lint! {
|
|||
Warn,
|
||||
"unstable syntax can change at any point in the future, causing a hard error!",
|
||||
@future_incompatible = FutureIncompatibleInfo {
|
||||
reason: FutureIncompatibilityReason::FutureReleaseErrorDontReportInDeps,
|
||||
reference: "issue #65860 <https://github.com/rust-lang/rust/issues/65860>",
|
||||
};
|
||||
}
|
||||
|
@ -3662,6 +3685,7 @@ declare_lint! {
|
|||
Warn,
|
||||
"detects invalid `#[doc(...)]` attributes",
|
||||
@future_incompatible = FutureIncompatibleInfo {
|
||||
reason: FutureIncompatibilityReason::FutureReleaseErrorDontReportInDeps,
|
||||
reference: "issue #82730 <https://github.com/rust-lang/rust/issues/82730>",
|
||||
};
|
||||
}
|
||||
|
@ -3708,8 +3732,8 @@ declare_lint! {
|
|||
Deny,
|
||||
"detects usage of old versions of certain proc-macro crates",
|
||||
@future_incompatible = FutureIncompatibleInfo {
|
||||
reason: FutureIncompatibilityReason::FutureReleaseErrorReportInDeps,
|
||||
reference: "issue #83125 <https://github.com/rust-lang/rust/issues/83125>",
|
||||
reason: FutureIncompatibilityReason::FutureReleaseErrorReportNow,
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -3747,8 +3771,8 @@ declare_lint! {
|
|||
Allow,
|
||||
"detects usage of old versions of or-patterns",
|
||||
@future_incompatible = FutureIncompatibleInfo {
|
||||
reference: "<https://doc.rust-lang.org/nightly/edition-guide/rust-2021/or-patterns-macro-rules.html>",
|
||||
reason: FutureIncompatibilityReason::EditionError(Edition::Edition2021),
|
||||
reference: "<https://doc.rust-lang.org/nightly/edition-guide/rust-2021/or-patterns-macro-rules.html>",
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -3796,8 +3820,8 @@ declare_lint! {
|
|||
"detects the usage of trait methods which are ambiguous with traits added to the \
|
||||
prelude in future editions",
|
||||
@future_incompatible = FutureIncompatibleInfo {
|
||||
reference: "<https://doc.rust-lang.org/nightly/edition-guide/rust-2021/prelude.html>",
|
||||
reason: FutureIncompatibilityReason::EditionError(Edition::Edition2021),
|
||||
reference: "<https://doc.rust-lang.org/nightly/edition-guide/rust-2021/prelude.html>",
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -3833,8 +3857,8 @@ declare_lint! {
|
|||
Allow,
|
||||
"identifiers that will be parsed as a prefix in Rust 2021",
|
||||
@future_incompatible = FutureIncompatibleInfo {
|
||||
reference: "<https://doc.rust-lang.org/nightly/edition-guide/rust-2021/reserving-syntax.html>",
|
||||
reason: FutureIncompatibilityReason::EditionError(Edition::Edition2021),
|
||||
reference: "<https://doc.rust-lang.org/nightly/edition-guide/rust-2021/reserving-syntax.html>",
|
||||
};
|
||||
crate_level_only
|
||||
}
|
||||
|
@ -3881,6 +3905,7 @@ declare_lint! {
|
|||
Warn,
|
||||
"use of unsupported calling convention",
|
||||
@future_incompatible = FutureIncompatibleInfo {
|
||||
reason: FutureIncompatibilityReason::FutureReleaseErrorDontReportInDeps,
|
||||
reference: "issue #87678 <https://github.com/rust-lang/rust/issues/87678>",
|
||||
};
|
||||
}
|
||||
|
@ -4221,8 +4246,8 @@ declare_lint! {
|
|||
Deny,
|
||||
"impl method assumes more implied bounds than its corresponding trait method",
|
||||
@future_incompatible = FutureIncompatibleInfo {
|
||||
reason: FutureIncompatibilityReason::FutureReleaseErrorReportInDeps,
|
||||
reference: "issue #105572 <https://github.com/rust-lang/rust/issues/105572>",
|
||||
reason: FutureIncompatibilityReason::FutureReleaseErrorReportNow,
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -4253,8 +4278,8 @@ declare_lint! {
|
|||
Warn,
|
||||
"`[u8]` or `str` used in a packed struct with `derive`",
|
||||
@future_incompatible = FutureIncompatibleInfo {
|
||||
reason: FutureIncompatibilityReason::FutureReleaseErrorReportInDeps,
|
||||
reference: "issue #107457 <https://github.com/rust-lang/rust/issues/107457>",
|
||||
reason: FutureIncompatibilityReason::FutureReleaseErrorReportNow,
|
||||
};
|
||||
report_in_external_macro
|
||||
}
|
||||
|
@ -4415,6 +4440,7 @@ declare_lint! {
|
|||
"impls that are not considered to overlap may be considered to \
|
||||
overlap in the future",
|
||||
@future_incompatible = FutureIncompatibleInfo {
|
||||
reason: FutureIncompatibilityReason::FutureReleaseErrorDontReportInDeps,
|
||||
reference: "issue #114040 <https://github.com/rust-lang/rust/issues/114040>",
|
||||
};
|
||||
}
|
||||
|
@ -4483,7 +4509,7 @@ declare_lint! {
|
|||
Warn,
|
||||
"detects certain glob imports that require reporting an ambiguity error",
|
||||
@future_incompatible = FutureIncompatibleInfo {
|
||||
reason: FutureIncompatibilityReason::FutureReleaseError,
|
||||
reason: FutureIncompatibilityReason::FutureReleaseErrorDontReportInDeps,
|
||||
reference: "issue #114095 <https://github.com/rust-lang/rust/issues/114095>",
|
||||
};
|
||||
}
|
||||
|
@ -4568,7 +4594,7 @@ declare_lint! {
|
|||
Warn,
|
||||
"elided lifetimes cannot be used in associated constants in impls",
|
||||
@future_incompatible = FutureIncompatibleInfo {
|
||||
reason: FutureIncompatibilityReason::FutureReleaseError,
|
||||
reason: FutureIncompatibilityReason::FutureReleaseErrorDontReportInDeps,
|
||||
reference: "issue #115010 <https://github.com/rust-lang/rust/issues/115010>",
|
||||
};
|
||||
}
|
||||
|
|
|
@ -347,12 +347,18 @@ pub struct FutureIncompatibleInfo {
|
|||
/// The reason for future incompatibility
|
||||
#[derive(Copy, Clone, Debug)]
|
||||
pub enum FutureIncompatibilityReason {
|
||||
/// This will be an error in a future release
|
||||
/// for all editions
|
||||
FutureReleaseError,
|
||||
/// This will be an error in a future release for all editions
|
||||
///
|
||||
/// This will *not* show up in cargo's future breakage report.
|
||||
/// The warning will hence only be seen in local crates, not in dependencies.
|
||||
FutureReleaseErrorDontReportInDeps,
|
||||
/// This will be an error in a future release, and
|
||||
/// Cargo should create a report even for dependencies
|
||||
FutureReleaseErrorReportNow,
|
||||
///
|
||||
/// This is the *only* reason that will make future incompatibility warnings show up in cargo's
|
||||
/// reports. All other future incompatibility warnings are not visible when they occur in a
|
||||
/// dependency.
|
||||
FutureReleaseErrorReportInDeps,
|
||||
/// Code that changes meaning in some way in a
|
||||
/// future release.
|
||||
FutureReleaseSemanticsChange,
|
||||
|
@ -380,7 +386,7 @@ impl FutureIncompatibleInfo {
|
|||
pub const fn default_fields_for_macro() -> Self {
|
||||
FutureIncompatibleInfo {
|
||||
reference: "",
|
||||
reason: FutureIncompatibilityReason::FutureReleaseError,
|
||||
reason: FutureIncompatibilityReason::FutureReleaseErrorDontReportInDeps,
|
||||
explain_reason: true,
|
||||
}
|
||||
}
|
||||
|
@ -718,7 +724,10 @@ macro_rules! declare_lint {
|
|||
);
|
||||
($(#[$attr:meta])* $vis: vis $NAME: ident, $Level: ident, $desc: expr,
|
||||
$(@feature_gate = $gate:expr;)?
|
||||
$(@future_incompatible = FutureIncompatibleInfo { $($field:ident : $val:expr),* $(,)* }; )?
|
||||
$(@future_incompatible = FutureIncompatibleInfo {
|
||||
reason: $reason:expr,
|
||||
$($field:ident : $val:expr),* $(,)*
|
||||
}; )?
|
||||
$(@edition $lint_edition:ident => $edition_level:ident;)?
|
||||
$($v:ident),*) => (
|
||||
$(#[$attr])*
|
||||
|
@ -730,6 +739,7 @@ macro_rules! declare_lint {
|
|||
$($v: true,)*
|
||||
$(feature_gate: Some($gate),)?
|
||||
$(future_incompatible: Some($crate::FutureIncompatibleInfo {
|
||||
reason: $reason,
|
||||
$($field: $val,)*
|
||||
..$crate::FutureIncompatibleInfo::default_fields_for_macro()
|
||||
}),)?
|
||||
|
|
|
@ -314,7 +314,10 @@ pub fn struct_lint_level(
|
|||
// Default allow lints trigger too often for testing.
|
||||
sess.opts.unstable_opts.future_incompat_test && lint.default_level != Level::Allow,
|
||||
|incompat| {
|
||||
matches!(incompat.reason, FutureIncompatibilityReason::FutureReleaseErrorReportNow)
|
||||
matches!(
|
||||
incompat.reason,
|
||||
FutureIncompatibilityReason::FutureReleaseErrorReportInDeps
|
||||
)
|
||||
},
|
||||
);
|
||||
|
||||
|
@ -404,8 +407,8 @@ pub fn struct_lint_level(
|
|||
|
||||
if let Some(future_incompatible) = future_incompatible {
|
||||
let explanation = match future_incompatible.reason {
|
||||
FutureIncompatibilityReason::FutureReleaseError
|
||||
| FutureIncompatibilityReason::FutureReleaseErrorReportNow => {
|
||||
FutureIncompatibilityReason::FutureReleaseErrorDontReportInDeps
|
||||
| FutureIncompatibilityReason::FutureReleaseErrorReportInDeps => {
|
||||
"this was previously accepted by the compiler but is being phased out; \
|
||||
it will become a hard error in a future release!"
|
||||
.to_owned()
|
||||
|
|
|
@ -2946,6 +2946,11 @@ impl<'tcx> Ty<'tcx> {
|
|||
}
|
||||
}
|
||||
|
||||
/// Returns `true` when the outermost type cannot be further normalized,
|
||||
/// resolved, or substituted. This includes all primitive types, but also
|
||||
/// things like ADTs and trait objects, sice even if their arguments or
|
||||
/// nested types may be further simplified, the outermost [`TyKind`] or
|
||||
/// type constructor remains the same.
|
||||
pub fn is_known_rigid(self) -> bool {
|
||||
match self.kind() {
|
||||
Bool
|
||||
|
|
|
@ -789,7 +789,7 @@ impl Command {
|
|||
/// or [`Command::envs`]. In addition, it will prevent the spawned child process from inheriting
|
||||
/// any environment variable from its parent process.
|
||||
///
|
||||
/// After calling [`Command::env_remove`], the iterator from [`Command::get_envs`] will be
|
||||
/// After calling [`Command::env_clear`], the iterator from [`Command::get_envs`] will be
|
||||
/// empty.
|
||||
///
|
||||
/// You can use [`Command::env_remove`] to clear a single mapping.
|
||||
|
|
|
@ -537,7 +537,7 @@ fn env_empty() {
|
|||
#[test]
|
||||
#[cfg(not(windows))]
|
||||
#[cfg_attr(any(target_os = "emscripten", target_env = "sgx"), ignore)]
|
||||
fn main() {
|
||||
fn debug_print() {
|
||||
const PIDFD: &'static str =
|
||||
if cfg!(target_os = "linux") { " create_pidfd: false,\n" } else { "" };
|
||||
|
||||
|
@ -623,6 +623,51 @@ fn main() {
|
|||
cwd: Some(
|
||||
"/some/path",
|
||||
),
|
||||
{PIDFD}}}"#
|
||||
)
|
||||
);
|
||||
|
||||
let mut command_with_removed_env = Command::new("boring-name");
|
||||
command_with_removed_env.env_remove("FOO").env_remove("BAR");
|
||||
assert_eq!(format!("{command_with_removed_env:?}"), r#"env -u BAR -u FOO "boring-name""#);
|
||||
assert_eq!(
|
||||
format!("{command_with_removed_env:#?}"),
|
||||
format!(
|
||||
r#"Command {{
|
||||
program: "boring-name",
|
||||
args: [
|
||||
"boring-name",
|
||||
],
|
||||
env: CommandEnv {{
|
||||
clear: false,
|
||||
vars: {{
|
||||
"BAR": None,
|
||||
"FOO": None,
|
||||
}},
|
||||
}},
|
||||
{PIDFD}}}"#
|
||||
)
|
||||
);
|
||||
|
||||
let mut command_with_cleared_env = Command::new("boring-name");
|
||||
command_with_cleared_env.env_clear().env("BAR", "val").env_remove("FOO");
|
||||
assert_eq!(format!("{command_with_cleared_env:?}"), r#"env -i BAR="val" "boring-name""#);
|
||||
assert_eq!(
|
||||
format!("{command_with_cleared_env:#?}"),
|
||||
format!(
|
||||
r#"Command {{
|
||||
program: "boring-name",
|
||||
args: [
|
||||
"boring-name",
|
||||
],
|
||||
env: CommandEnv {{
|
||||
clear: true,
|
||||
vars: {{
|
||||
"BAR": Some(
|
||||
"val",
|
||||
),
|
||||
}},
|
||||
}},
|
||||
{PIDFD}}}"#
|
||||
)
|
||||
);
|
||||
|
|
|
@ -586,6 +586,23 @@ impl fmt::Debug for Command {
|
|||
if let Some(ref cwd) = self.cwd {
|
||||
write!(f, "cd {cwd:?} && ")?;
|
||||
}
|
||||
if self.env.does_clear() {
|
||||
write!(f, "env -i ")?;
|
||||
// Altered env vars will be printed next, that should exactly work as expected.
|
||||
} else {
|
||||
// Removed env vars need the command to be wrapped in `env`.
|
||||
let mut any_removed = false;
|
||||
for (key, value_opt) in self.get_envs() {
|
||||
if value_opt.is_none() {
|
||||
if !any_removed {
|
||||
write!(f, "env ")?;
|
||||
any_removed = true;
|
||||
}
|
||||
write!(f, "-u {} ", key.to_string_lossy())?;
|
||||
}
|
||||
}
|
||||
}
|
||||
// Altered env vars can just be added in front of the program.
|
||||
for (key, value_opt) in self.get_envs() {
|
||||
if let Some(value) = value_opt {
|
||||
write!(f, "{}={value:?} ", key.to_string_lossy())?;
|
||||
|
|
|
@ -318,25 +318,38 @@ pub fn available_parallelism() -> io::Result<NonZeroUsize> {
|
|||
target_os = "solaris",
|
||||
target_os = "illumos",
|
||||
))] {
|
||||
#[allow(unused_assignments)]
|
||||
#[allow(unused_mut)]
|
||||
let mut quota = usize::MAX;
|
||||
|
||||
#[cfg(any(target_os = "android", target_os = "linux"))]
|
||||
{
|
||||
let quota = cgroups::quota().max(1);
|
||||
quota = cgroups::quota().max(1);
|
||||
let mut set: libc::cpu_set_t = unsafe { mem::zeroed() };
|
||||
unsafe {
|
||||
if libc::sched_getaffinity(0, mem::size_of::<libc::cpu_set_t>(), &mut set) == 0 {
|
||||
let count = libc::CPU_COUNT(&set) as usize;
|
||||
let count = count.min(quota);
|
||||
// reported to occur on MIPS kernels older than our minimum supported kernel version for those targets
|
||||
let count = NonZeroUsize::new(count)
|
||||
.expect("CPU count must be > 0. This may be a bug in sched_getaffinity(); try upgrading the kernel.");
|
||||
return Ok(count);
|
||||
|
||||
// According to sched_getaffinity's API it should always be non-zero, but
|
||||
// some old MIPS kernels were buggy and zero-initialized the mask if
|
||||
// none was explicitly set.
|
||||
// In that case we use the sysconf fallback.
|
||||
if let Some(count) = NonZeroUsize::new(count) {
|
||||
return Ok(count)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
match unsafe { libc::sysconf(libc::_SC_NPROCESSORS_ONLN) } {
|
||||
-1 => Err(io::Error::last_os_error()),
|
||||
0 => Err(io::const_io_error!(io::ErrorKind::NotFound, "The number of hardware threads is not known for the target platform")),
|
||||
cpus => Ok(unsafe { NonZeroUsize::new_unchecked(cpus as usize) }),
|
||||
cpus => {
|
||||
let count = cpus as usize;
|
||||
// Cover the unusual situation where we were able to get the quota but not the affinity mask
|
||||
let count = count.min(quota);
|
||||
Ok(unsafe { NonZeroUsize::new_unchecked(count) })
|
||||
}
|
||||
}
|
||||
} else if #[cfg(any(target_os = "freebsd", target_os = "dragonfly", target_os = "netbsd"))] {
|
||||
use crate::ptr;
|
||||
|
|
|
@ -80,6 +80,10 @@ impl CommandEnv {
|
|||
self.vars.clear();
|
||||
}
|
||||
|
||||
pub fn does_clear(&self) -> bool {
|
||||
self.clear
|
||||
}
|
||||
|
||||
pub fn have_changed_path(&self) -> bool {
|
||||
self.saw_path || self.clear
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
// check-fail
|
||||
// Tests that a doc comment will not preclude a field from being considered a diagnostic argument
|
||||
// normalize-stderr-test "the following other types implement trait `IntoDiagnosticArg`:(?:.*\n){0,9}\s+and \d+ others" -> "normalized in stderr"
|
||||
// normalize-stderr-test "diagnostic_builder\.rs:[0-9]+:[0-9]+" -> "diagnostic_builder.rs:LL:CC"
|
||||
// normalize-stderr-test "(COMPILER_DIR/.*\.rs):[0-9]+:[0-9]+" -> "$1:LL:CC"
|
||||
|
||||
// The proc_macro2 crate handles spans differently when on beta/stable release rather than nightly,
|
||||
// changing the output of this test. Since Subdiagnostic is strictly internal to the compiler
|
||||
|
|
|
@ -23,7 +23,7 @@ LL | arg: NotIntoDiagnosticArg,
|
|||
|
|
||||
= help: normalized in stderr
|
||||
note: required by a bound in `Diagnostic::set_arg`
|
||||
--> $COMPILER_DIR/rustc_errors/src/diagnostic.rs:968:5
|
||||
--> $COMPILER_DIR/rustc_errors/src/diagnostic.rs:LL:CC
|
||||
|
||||
error: aborting due to 2 previous errors
|
||||
|
||||
|
|
|
@ -1,39 +0,0 @@
|
|||
error: moving 10024 bytes
|
||||
--> $DIR/large_moves.rs:21:14
|
||||
|
|
||||
LL | let z = (x, 42);
|
||||
| ^ value moved from here
|
||||
|
|
||||
= note: The current maximum size is 1000, but it can be customized with the move_size_limit attribute: `#![move_size_limit = "..."]`
|
||||
note: the lint level is defined here
|
||||
--> $DIR/large_moves.rs:1:9
|
||||
|
|
||||
LL | #![deny(large_assignments)]
|
||||
| ^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: moving 10024 bytes
|
||||
--> $DIR/large_moves.rs:22:13
|
||||
|
|
||||
LL | let a = z.0;
|
||||
| ^^^ value moved from here
|
||||
|
|
||||
= note: The current maximum size is 1000, but it can be customized with the move_size_limit attribute: `#![move_size_limit = "..."]`
|
||||
|
||||
error: moving 9999 bytes
|
||||
--> $DIR/large_moves.rs:27:13
|
||||
|
|
||||
LL | let _ = NotBox::new([0; 9999]);
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^ value moved from here
|
||||
|
|
||||
= note: The current maximum size is 1000, but it can be customized with the move_size_limit attribute: `#![move_size_limit = "..."]`
|
||||
|
||||
error: moving 9999 bytes
|
||||
--> $DIR/large_moves.rs:41:13
|
||||
|
|
||||
LL | data,
|
||||
| ^^^^ value moved from here
|
||||
|
|
||||
= note: The current maximum size is 1000, but it can be customized with the move_size_limit attribute: `#![move_size_limit = "..."]`
|
||||
|
||||
error: aborting due to 4 previous errors
|
||||
|
|
@ -1,39 +0,0 @@
|
|||
error: moving 10024 bytes
|
||||
--> $DIR/large_moves.rs:21:14
|
||||
|
|
||||
LL | let z = (x, 42);
|
||||
| ^ value moved from here
|
||||
|
|
||||
= note: The current maximum size is 1000, but it can be customized with the move_size_limit attribute: `#![move_size_limit = "..."]`
|
||||
note: the lint level is defined here
|
||||
--> $DIR/large_moves.rs:1:9
|
||||
|
|
||||
LL | #![deny(large_assignments)]
|
||||
| ^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: moving 10024 bytes
|
||||
--> $DIR/large_moves.rs:22:13
|
||||
|
|
||||
LL | let a = z.0;
|
||||
| ^^^ value moved from here
|
||||
|
|
||||
= note: The current maximum size is 1000, but it can be customized with the move_size_limit attribute: `#![move_size_limit = "..."]`
|
||||
|
||||
error: moving 9999 bytes
|
||||
--> $DIR/large_moves.rs:27:13
|
||||
|
|
||||
LL | let _ = NotBox::new([0; 9999]);
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^ value moved from here
|
||||
|
|
||||
= note: The current maximum size is 1000, but it can be customized with the move_size_limit attribute: `#![move_size_limit = "..."]`
|
||||
|
||||
error: moving 9999 bytes
|
||||
--> $DIR/large_moves.rs:41:13
|
||||
|
|
||||
LL | data,
|
||||
| ^^^^ value moved from here
|
||||
|
|
||||
= note: The current maximum size is 1000, but it can be customized with the move_size_limit attribute: `#![move_size_limit = "..."]`
|
||||
|
||||
error: aborting due to 4 previous errors
|
||||
|
|
@ -1,10 +1,8 @@
|
|||
#![deny(large_assignments)]
|
||||
#![feature(large_assignments)]
|
||||
#![cfg_attr(attribute, move_size_limit = "1000")]
|
||||
#![move_size_limit = "1000"]
|
||||
// build-fail
|
||||
// only-x86_64
|
||||
// revisions: attribute option
|
||||
// [option]compile-flags: -Zmove-size-limit=1000
|
||||
|
||||
// edition:2018
|
||||
// compile-flags: -Zmir-opt-level=0
|
||||
|
@ -12,25 +10,12 @@
|
|||
use std::{sync::Arc, rc::Rc};
|
||||
|
||||
fn main() {
|
||||
let x = async {
|
||||
let y = [0; 9999];
|
||||
dbg!(y);
|
||||
thing(&y).await;
|
||||
dbg!(y);
|
||||
};
|
||||
let z = (x, 42); //~ ERROR large_assignments
|
||||
let a = z.0; //~ ERROR large_assignments
|
||||
let b = z.1;
|
||||
let _ = Arc::new([0; 9999]); // OK!
|
||||
let _ = Box::new([0; 9999]); // OK!
|
||||
let _ = Rc::new([0; 9999]); // OK!
|
||||
let _ = NotBox::new([0; 9999]); //~ ERROR large_assignments
|
||||
}
|
||||
|
||||
async fn thing(y: &[u8]) {
|
||||
dbg!(y);
|
||||
}
|
||||
|
||||
struct NotBox {
|
||||
data: [u8; 9999],
|
||||
}
|
23
tests/ui/lint/large_assignments/box_rc_arc_allowed.stderr
Normal file
23
tests/ui/lint/large_assignments/box_rc_arc_allowed.stderr
Normal file
|
@ -0,0 +1,23 @@
|
|||
error: moving 9999 bytes
|
||||
--> $DIR/box_rc_arc_allowed.rs:16:13
|
||||
|
|
||||
LL | let _ = NotBox::new([0; 9999]);
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^ value moved from here
|
||||
|
|
||||
= note: The current maximum size is 1000, but it can be customized with the move_size_limit attribute: `#![move_size_limit = "..."]`
|
||||
note: the lint level is defined here
|
||||
--> $DIR/box_rc_arc_allowed.rs:1:9
|
||||
|
|
||||
LL | #![deny(large_assignments)]
|
||||
| ^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: moving 9999 bytes
|
||||
--> $DIR/box_rc_arc_allowed.rs:26:13
|
||||
|
|
||||
LL | data,
|
||||
| ^^^^ value moved from here
|
||||
|
|
||||
= note: The current maximum size is 1000, but it can be customized with the move_size_limit attribute: `#![move_size_limit = "..."]`
|
||||
|
||||
error: aborting due to 2 previous errors
|
||||
|
|
@ -0,0 +1,23 @@
|
|||
error: moving 10024 bytes
|
||||
--> $DIR/large_future.rs:19:14
|
||||
|
|
||||
LL | let z = (x, 42);
|
||||
| ^ value moved from here
|
||||
|
|
||||
= note: The current maximum size is 1000, but it can be customized with the move_size_limit attribute: `#![move_size_limit = "..."]`
|
||||
note: the lint level is defined here
|
||||
--> $DIR/large_future.rs:1:9
|
||||
|
|
||||
LL | #![deny(large_assignments)]
|
||||
| ^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: moving 10024 bytes
|
||||
--> $DIR/large_future.rs:20:13
|
||||
|
|
||||
LL | let a = z.0;
|
||||
| ^^^ value moved from here
|
||||
|
|
||||
= note: The current maximum size is 1000, but it can be customized with the move_size_limit attribute: `#![move_size_limit = "..."]`
|
||||
|
||||
error: aborting due to 2 previous errors
|
||||
|
23
tests/ui/lint/large_assignments/large_future.option.stderr
Normal file
23
tests/ui/lint/large_assignments/large_future.option.stderr
Normal file
|
@ -0,0 +1,23 @@
|
|||
error: moving 10024 bytes
|
||||
--> $DIR/large_future.rs:19:14
|
||||
|
|
||||
LL | let z = (x, 42);
|
||||
| ^ value moved from here
|
||||
|
|
||||
= note: The current maximum size is 1000, but it can be customized with the move_size_limit attribute: `#![move_size_limit = "..."]`
|
||||
note: the lint level is defined here
|
||||
--> $DIR/large_future.rs:1:9
|
||||
|
|
||||
LL | #![deny(large_assignments)]
|
||||
| ^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: moving 10024 bytes
|
||||
--> $DIR/large_future.rs:20:13
|
||||
|
|
||||
LL | let a = z.0;
|
||||
| ^^^ value moved from here
|
||||
|
|
||||
= note: The current maximum size is 1000, but it can be customized with the move_size_limit attribute: `#![move_size_limit = "..."]`
|
||||
|
||||
error: aborting due to 2 previous errors
|
||||
|
26
tests/ui/lint/large_assignments/large_future.rs
Normal file
26
tests/ui/lint/large_assignments/large_future.rs
Normal file
|
@ -0,0 +1,26 @@
|
|||
#![deny(large_assignments)]
|
||||
#![cfg_attr(attribute, feature(large_assignments))]
|
||||
#![cfg_attr(attribute, move_size_limit = "1000")]
|
||||
// build-fail
|
||||
// only-x86_64
|
||||
// revisions: attribute option
|
||||
// [option]compile-flags: -Zmove-size-limit=1000
|
||||
|
||||
// edition:2018
|
||||
// compile-flags: -Zmir-opt-level=0
|
||||
|
||||
fn main() {
|
||||
let x = async {
|
||||
let y = [0; 9999];
|
||||
dbg!(y);
|
||||
thing(&y).await;
|
||||
dbg!(y);
|
||||
};
|
||||
let z = (x, 42); //~ ERROR large_assignments
|
||||
let a = z.0; //~ ERROR large_assignments
|
||||
let b = z.1;
|
||||
}
|
||||
|
||||
async fn thing(y: &[u8]) {
|
||||
dbg!(y);
|
||||
}
|
9
tests/ui/parser/issues/issue-98601-delimiter-error-1.rs
Normal file
9
tests/ui/parser/issues/issue-98601-delimiter-error-1.rs
Normal file
|
@ -0,0 +1,9 @@
|
|||
fn foo() {
|
||||
match 0 {
|
||||
_ => {}
|
||||
}
|
||||
if foo
|
||||
}
|
||||
} //~ ERROR unexpected closing delimiter: `}`
|
||||
|
||||
fn main() {}
|
16
tests/ui/parser/issues/issue-98601-delimiter-error-1.stderr
Normal file
16
tests/ui/parser/issues/issue-98601-delimiter-error-1.stderr
Normal file
|
@ -0,0 +1,16 @@
|
|||
error: unexpected closing delimiter: `}`
|
||||
--> $DIR/issue-98601-delimiter-error-1.rs:7:1
|
||||
|
|
||||
LL | fn foo() {
|
||||
| - this delimiter might not be properly closed...
|
||||
LL | match 0 {
|
||||
LL | _ => {}
|
||||
| -- block is empty, you might have not meant to close it
|
||||
...
|
||||
LL | }
|
||||
| - ...as it matches this but it has different indentation
|
||||
LL | }
|
||||
| ^ unexpected closing delimiter
|
||||
|
||||
error: aborting due to previous error
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
fn main() {
|
||||
todo!();
|
||||
}
|
||||
|
||||
fn other(_: i32)) {} //~ ERROR unexpected closing delimiter: `)`
|
|
@ -0,0 +1,14 @@
|
|||
error: unexpected closing delimiter: `)`
|
||||
--> $DIR/issue-98601-delimiter-error-unexpected-close.rs:5:17
|
||||
|
|
||||
LL | fn main() {
|
||||
| - this opening brace...
|
||||
LL | todo!();
|
||||
LL | }
|
||||
| - ...matches this closing brace
|
||||
LL |
|
||||
LL | fn other(_: i32)) {}
|
||||
| ^ unexpected closing delimiter
|
||||
|
||||
error: aborting due to previous error
|
||||
|
|
@ -0,0 +1,9 @@
|
|||
#![feature(type_alias_impl_trait)]
|
||||
|
||||
pub type Tait = impl Iterator<Item = (&'db Key, impl Iterator)>;
|
||||
//~^ ERROR use of undeclared lifetime name `'db`
|
||||
//~| ERROR cannot find type `Key` in this scope
|
||||
//~| ERROR unconstrained opaque type
|
||||
//~| ERROR unconstrained opaque type
|
||||
|
||||
pub fn main() {}
|
|
@ -0,0 +1,47 @@
|
|||
error[E0261]: use of undeclared lifetime name `'db`
|
||||
--> $DIR/nested-impl-trait-in-tait.rs:3:40
|
||||
|
|
||||
LL | pub type Tait = impl Iterator<Item = (&'db Key, impl Iterator)>;
|
||||
| ^^^ undeclared lifetime
|
||||
|
|
||||
= note: for more information on higher-ranked polymorphism, visit https://doc.rust-lang.org/nomicon/hrtb.html
|
||||
help: consider making the bound lifetime-generic with a new `'db` lifetime
|
||||
|
|
||||
LL | pub type Tait = impl for<'db> Iterator<Item = (&'db Key, impl Iterator)>;
|
||||
| ++++++++
|
||||
help: consider introducing lifetime `'db` here
|
||||
|
|
||||
LL | pub type Tait<'db> = impl Iterator<Item = (&'db Key, impl Iterator)>;
|
||||
| +++++
|
||||
|
||||
error[E0412]: cannot find type `Key` in this scope
|
||||
--> $DIR/nested-impl-trait-in-tait.rs:3:44
|
||||
|
|
||||
LL | pub type Tait = impl Iterator<Item = (&'db Key, impl Iterator)>;
|
||||
| ^^^ not found in this scope
|
||||
|
|
||||
help: consider importing this struct
|
||||
|
|
||||
LL + use std::thread::local_impl::Key;
|
||||
|
|
||||
|
||||
error: unconstrained opaque type
|
||||
--> $DIR/nested-impl-trait-in-tait.rs:3:17
|
||||
|
|
||||
LL | pub type Tait = impl Iterator<Item = (&'db Key, impl Iterator)>;
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: `Tait` must be used in combination with a concrete type within the same module
|
||||
|
||||
error: unconstrained opaque type
|
||||
--> $DIR/nested-impl-trait-in-tait.rs:3:49
|
||||
|
|
||||
LL | pub type Tait = impl Iterator<Item = (&'db Key, impl Iterator)>;
|
||||
| ^^^^^^^^^^^^^
|
||||
|
|
||||
= note: `Tait` must be used in combination with a concrete type within the same module
|
||||
|
||||
error: aborting due to 4 previous errors
|
||||
|
||||
Some errors have detailed explanations: E0261, E0412.
|
||||
For more information about an error, try `rustc --explain E0261`.
|
Loading…
Add table
Reference in a new issue