mirror of
https://github.com/rust-lang/rust.git
synced 2026-04-27 18:57:42 +03:00
Auto merge of #140613 - matthiaskrgr:rollup-yag6z7w, r=matthiaskrgr
Rollup of 7 pull requests Successful merges: - #138712 (resolve: Support imports of associated types and glob imports from traits) - #140395 (organize and extend forbidden target feature tests) - #140576 (Remove fragile equal-pointers-unequal tests.) - #140582 (Update sysinfo to `0.35.0` in bootstrap and `tools/opt-dist`) - #140595 (doc(std): fix typo lchown -> lchmod) - #140597 (zkvm: remove schmerik as target maintainer) - #140604 (yet another small borrowck cleanup ) r? `@ghost` `@rustbot` modify labels: rollup
This commit is contained in:
+34
-67
@@ -744,7 +744,7 @@ dependencies = [
|
||||
"tracing-subscriber",
|
||||
"unified-diff",
|
||||
"walkdir",
|
||||
"windows 0.59.0",
|
||||
"windows",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -2463,6 +2463,25 @@ version = "0.4.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "830b246a0e5f20af87141b25c173cd1b609bd7779a4617d6ec582abaf90870f3"
|
||||
|
||||
[[package]]
|
||||
name = "objc2-core-foundation"
|
||||
version = "0.3.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "1c10c2894a6fed806ade6027bcd50662746363a9589d3ec9d9bef30a4e4bc166"
|
||||
dependencies = [
|
||||
"bitflags",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "objc2-io-kit"
|
||||
version = "0.3.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "71c1c64d6120e51cd86033f67176b1cb66780c2efe34dec55176f77befd93c0a"
|
||||
dependencies = [
|
||||
"libc",
|
||||
"objc2-core-foundation",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "object"
|
||||
version = "0.32.2"
|
||||
@@ -3466,7 +3485,7 @@ dependencies = [
|
||||
"thorin-dwp",
|
||||
"tracing",
|
||||
"wasm-encoder 0.219.2",
|
||||
"windows 0.59.0",
|
||||
"windows",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -3525,7 +3544,7 @@ dependencies = [
|
||||
"tempfile",
|
||||
"thin-vec",
|
||||
"tracing",
|
||||
"windows 0.59.0",
|
||||
"windows",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -3588,7 +3607,7 @@ dependencies = [
|
||||
"serde_json",
|
||||
"shlex",
|
||||
"tracing",
|
||||
"windows 0.59.0",
|
||||
"windows",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -3643,7 +3662,7 @@ dependencies = [
|
||||
"termcolor",
|
||||
"termize",
|
||||
"tracing",
|
||||
"windows 0.59.0",
|
||||
"windows",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -4386,7 +4405,7 @@ dependencies = [
|
||||
"smallvec",
|
||||
"termize",
|
||||
"tracing",
|
||||
"windows 0.59.0",
|
||||
"windows",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -5068,13 +5087,14 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "sysinfo"
|
||||
version = "0.31.4"
|
||||
version = "0.35.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "355dbe4f8799b304b05e1b0f05fc59b2a18d36645cf169607da45bde2f69a1be"
|
||||
checksum = "b897c8ea620e181c7955369a31be5f48d9a9121cb59fd33ecef9ff2a34323422"
|
||||
dependencies = [
|
||||
"core-foundation-sys",
|
||||
"libc",
|
||||
"windows 0.57.0",
|
||||
"objc2-core-foundation",
|
||||
"objc2-io-kit",
|
||||
"windows",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -5949,16 +5969,6 @@ version = "0.4.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f"
|
||||
|
||||
[[package]]
|
||||
name = "windows"
|
||||
version = "0.57.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "12342cb4d8e3b046f3d80effd474a7a02447231330ef77d71daa6fbc40681143"
|
||||
dependencies = [
|
||||
"windows-core 0.57.0",
|
||||
"windows-targets 0.52.6",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "windows"
|
||||
version = "0.59.0"
|
||||
@@ -5980,18 +5990,6 @@ dependencies = [
|
||||
"serde_json",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "windows-core"
|
||||
version = "0.57.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d2ed2439a290666cd67ecce2b0ffaad89c2a56b976b736e6ece670297897832d"
|
||||
dependencies = [
|
||||
"windows-implement 0.57.0",
|
||||
"windows-interface 0.57.0",
|
||||
"windows-result 0.1.2",
|
||||
"windows-targets 0.52.6",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "windows-core"
|
||||
version = "0.59.0"
|
||||
@@ -5999,8 +5997,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "810ce18ed2112484b0d4e15d022e5f598113e220c53e373fb31e67e21670c1ce"
|
||||
dependencies = [
|
||||
"windows-implement 0.59.0",
|
||||
"windows-interface 0.59.1",
|
||||
"windows-result 0.3.2",
|
||||
"windows-interface",
|
||||
"windows-result",
|
||||
"windows-strings 0.3.1",
|
||||
"windows-targets 0.53.0",
|
||||
]
|
||||
@@ -6012,23 +6010,12 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "4763c1de310c86d75a878046489e2e5ba02c649d185f21c67d4cf8a56d098980"
|
||||
dependencies = [
|
||||
"windows-implement 0.60.0",
|
||||
"windows-interface 0.59.1",
|
||||
"windows-interface",
|
||||
"windows-link",
|
||||
"windows-result 0.3.2",
|
||||
"windows-result",
|
||||
"windows-strings 0.4.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "windows-implement"
|
||||
version = "0.57.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "9107ddc059d5b6fbfbffdfa7a7fe3e22a226def0b2608f72e9d552763d3e1ad7"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 2.0.100",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "windows-implement"
|
||||
version = "0.59.0"
|
||||
@@ -6051,17 +6038,6 @@ dependencies = [
|
||||
"syn 2.0.100",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "windows-interface"
|
||||
version = "0.57.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "29bee4b38ea3cde66011baa44dba677c432a78593e202392d1e9070cf2a7fca7"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 2.0.100",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "windows-interface"
|
||||
version = "0.59.1"
|
||||
@@ -6079,15 +6055,6 @@ version = "0.1.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "76840935b766e1b0a05c0066835fb9ec80071d4c09a16f6bd5f7e655e3c14c38"
|
||||
|
||||
[[package]]
|
||||
name = "windows-result"
|
||||
version = "0.1.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "5e383302e8ec8515204254685643de10811af0ed97ea37210dc26fb0032647f8"
|
||||
dependencies = [
|
||||
"windows-targets 0.52.6",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "windows-result"
|
||||
version = "0.3.2"
|
||||
|
||||
@@ -7,6 +7,8 @@
|
||||
|
||||
use crate::RegionInferenceContext;
|
||||
use crate::constraints::ConstraintSccIndex;
|
||||
use crate::region_infer::ConstraintSccs;
|
||||
use crate::universal_regions::UniversalRegions;
|
||||
|
||||
pub(crate) struct ReverseSccGraph {
|
||||
graph: VecGraph<ConstraintSccIndex>,
|
||||
@@ -19,6 +21,29 @@ pub(crate) struct ReverseSccGraph {
|
||||
}
|
||||
|
||||
impl ReverseSccGraph {
|
||||
pub(super) fn compute(
|
||||
constraint_sccs: &ConstraintSccs,
|
||||
universal_regions: &UniversalRegions<'_>,
|
||||
) -> Self {
|
||||
let graph = constraint_sccs.reverse();
|
||||
let mut paired_scc_regions = universal_regions
|
||||
.universal_regions_iter()
|
||||
.map(|region| (constraint_sccs.scc(region), region))
|
||||
.collect::<Vec<_>>();
|
||||
paired_scc_regions.sort();
|
||||
let universal_regions = paired_scc_regions.iter().map(|&(_, region)| region).collect();
|
||||
|
||||
let mut scc_regions = FxIndexMap::default();
|
||||
let mut start = 0;
|
||||
for chunk in paired_scc_regions.chunk_by(|&(scc1, _), &(scc2, _)| scc1 == scc2) {
|
||||
let (scc, _) = chunk[0];
|
||||
|
||||
scc_regions.insert(scc, start..start + chunk.len());
|
||||
start += chunk.len();
|
||||
}
|
||||
ReverseSccGraph { graph, scc_regions, universal_regions }
|
||||
}
|
||||
|
||||
/// Find all universal regions that are required to outlive the given SCC.
|
||||
pub(super) fn upper_bounds(&self, scc0: ConstraintSccIndex) -> impl Iterator<Item = RegionVid> {
|
||||
let mut duplicates = FxIndexSet::default();
|
||||
@@ -40,23 +65,7 @@ pub(super) fn compute_reverse_scc_graph(&mut self) {
|
||||
return;
|
||||
}
|
||||
|
||||
let graph = self.constraint_sccs.reverse();
|
||||
let mut paired_scc_regions = self
|
||||
.universal_regions()
|
||||
.universal_regions_iter()
|
||||
.map(|region| (self.constraint_sccs.scc(region), region))
|
||||
.collect::<Vec<_>>();
|
||||
paired_scc_regions.sort();
|
||||
let universal_regions = paired_scc_regions.iter().map(|&(_, region)| region).collect();
|
||||
|
||||
let mut scc_regions = FxIndexMap::default();
|
||||
let mut start = 0;
|
||||
for chunk in paired_scc_regions.chunk_by(|&(scc1, _), &(scc2, _)| scc1 == scc2) {
|
||||
let (scc, _) = chunk[0];
|
||||
scc_regions.insert(scc, start..start + chunk.len());
|
||||
start += chunk.len();
|
||||
}
|
||||
|
||||
self.rev_scc_graph = Some(ReverseSccGraph { graph, scc_regions, universal_regions });
|
||||
self.rev_scc_graph =
|
||||
Some(ReverseSccGraph::compute(&self.constraint_sccs, self.universal_regions()));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -41,8 +41,8 @@ pub(crate) struct UniversalRegionRelations<'tcx> {
|
||||
|
||||
pub(crate) struct CreateResult<'tcx> {
|
||||
pub(crate) universal_region_relations: Frozen<UniversalRegionRelations<'tcx>>,
|
||||
pub(crate) region_bound_pairs: RegionBoundPairs<'tcx>,
|
||||
pub(crate) known_type_outlives_obligations: Vec<ty::PolyTypeOutlivesPredicate<'tcx>>,
|
||||
pub(crate) region_bound_pairs: Frozen<RegionBoundPairs<'tcx>>,
|
||||
pub(crate) known_type_outlives_obligations: Frozen<Vec<ty::PolyTypeOutlivesPredicate<'tcx>>>,
|
||||
pub(crate) normalized_inputs_and_output: NormalizedInputsAndOutput<'tcx>,
|
||||
}
|
||||
|
||||
@@ -333,8 +333,8 @@ pub(crate) fn create(mut self) -> CreateResult<'tcx> {
|
||||
outlives: self.outlives.freeze(),
|
||||
inverse_outlives: self.inverse_outlives.freeze(),
|
||||
}),
|
||||
known_type_outlives_obligations,
|
||||
region_bound_pairs: self.region_bound_pairs,
|
||||
known_type_outlives_obligations: Frozen::freeze(known_type_outlives_obligations),
|
||||
region_bound_pairs: Frozen::freeze(self.region_bound_pairs),
|
||||
normalized_inputs_and_output,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -151,8 +151,8 @@ pub(crate) fn type_check<'a, 'tcx>(
|
||||
body,
|
||||
promoted,
|
||||
user_type_annotations: &body.user_type_annotations,
|
||||
region_bound_pairs,
|
||||
known_type_outlives_obligations,
|
||||
region_bound_pairs: ®ion_bound_pairs,
|
||||
known_type_outlives_obligations: &known_type_outlives_obligations,
|
||||
reported_errors: Default::default(),
|
||||
universal_regions: &universal_region_relations.universal_regions,
|
||||
location_table,
|
||||
@@ -216,8 +216,8 @@ struct TypeChecker<'a, 'tcx> {
|
||||
/// User type annotations are shared between the main MIR and the MIR of
|
||||
/// all of the promoted items.
|
||||
user_type_annotations: &'a CanonicalUserTypeAnnotations<'tcx>,
|
||||
region_bound_pairs: RegionBoundPairs<'tcx>,
|
||||
known_type_outlives_obligations: Vec<ty::PolyTypeOutlivesPredicate<'tcx>>,
|
||||
region_bound_pairs: &'a RegionBoundPairs<'tcx>,
|
||||
known_type_outlives_obligations: &'a [ty::PolyTypeOutlivesPredicate<'tcx>],
|
||||
reported_errors: FxIndexSet<(Ty<'tcx>, Span)>,
|
||||
universal_regions: &'a UniversalRegions<'tcx>,
|
||||
location_table: &'a PoloniusLocationTable,
|
||||
@@ -412,9 +412,9 @@ fn push_region_constraints(
|
||||
constraint_conversion::ConstraintConversion::new(
|
||||
self.infcx,
|
||||
self.universal_regions,
|
||||
&self.region_bound_pairs,
|
||||
self.region_bound_pairs,
|
||||
self.infcx.param_env,
|
||||
&self.known_type_outlives_obligations,
|
||||
self.known_type_outlives_obligations,
|
||||
locations,
|
||||
locations.span(self.body),
|
||||
category,
|
||||
@@ -2506,9 +2506,9 @@ fn prove_closure_bounds(
|
||||
constraint_conversion::ConstraintConversion::new(
|
||||
self.infcx,
|
||||
self.universal_regions,
|
||||
&self.region_bound_pairs,
|
||||
self.region_bound_pairs,
|
||||
self.infcx.param_env,
|
||||
&self.known_type_outlives_obligations,
|
||||
self.known_type_outlives_obligations,
|
||||
locations,
|
||||
self.body.span, // irrelevant; will be overridden.
|
||||
ConstraintCategory::Boring, // same as above.
|
||||
|
||||
@@ -1,9 +1,13 @@
|
||||
#### Note: this error code is no longer emitted by the compiler.
|
||||
|
||||
Attempt was made to import an unimportable type. This can happen when trying
|
||||
to import a type from a trait.
|
||||
|
||||
Erroneous code example:
|
||||
|
||||
```compile_fail,E0253
|
||||
```
|
||||
#![feature(import_trait_associated_functions)]
|
||||
|
||||
mod foo {
|
||||
pub trait MyTrait {
|
||||
type SomeType;
|
||||
|
||||
@@ -1770,7 +1770,7 @@ fn lower_qpath_ty(
|
||||
span: Span,
|
||||
opt_self_ty: Option<Ty<'tcx>>,
|
||||
item_def_id: DefId,
|
||||
trait_segment: &hir::PathSegment<'tcx>,
|
||||
trait_segment: Option<&hir::PathSegment<'tcx>>,
|
||||
item_segment: &hir::PathSegment<'tcx>,
|
||||
) -> Ty<'tcx> {
|
||||
match self.lower_qpath_shared(
|
||||
@@ -1795,7 +1795,7 @@ fn lower_qpath_const(
|
||||
span: Span,
|
||||
opt_self_ty: Option<Ty<'tcx>>,
|
||||
item_def_id: DefId,
|
||||
trait_segment: &hir::PathSegment<'tcx>,
|
||||
trait_segment: Option<&hir::PathSegment<'tcx>>,
|
||||
item_segment: &hir::PathSegment<'tcx>,
|
||||
) -> Const<'tcx> {
|
||||
match self.lower_qpath_shared(
|
||||
@@ -1820,7 +1820,7 @@ fn lower_qpath_shared(
|
||||
span: Span,
|
||||
opt_self_ty: Option<Ty<'tcx>>,
|
||||
item_def_id: DefId,
|
||||
trait_segment: &hir::PathSegment<'tcx>,
|
||||
trait_segment: Option<&hir::PathSegment<'tcx>>,
|
||||
item_segment: &hir::PathSegment<'tcx>,
|
||||
assoc_tag: ty::AssocTag,
|
||||
) -> Result<(DefId, GenericArgsRef<'tcx>), ErrorGuaranteed> {
|
||||
@@ -1840,7 +1840,7 @@ fn lower_qpath_shared(
|
||||
debug!(?self_ty);
|
||||
|
||||
let trait_ref =
|
||||
self.lower_mono_trait_ref(span, trait_def_id, self_ty, trait_segment, false);
|
||||
self.lower_mono_trait_ref(span, trait_def_id, self_ty, trait_segment.unwrap(), false);
|
||||
debug!(?trait_ref);
|
||||
|
||||
let item_args =
|
||||
@@ -2196,16 +2196,17 @@ pub fn lower_path(
|
||||
}
|
||||
}
|
||||
Res::Def(DefKind::AssocTy, def_id) => {
|
||||
debug_assert!(path.segments.len() >= 2);
|
||||
let _ = self.prohibit_generic_args(
|
||||
path.segments[..path.segments.len() - 2].iter(),
|
||||
GenericsArgsErrExtend::None,
|
||||
);
|
||||
let trait_segment = if let [modules @ .., trait_, _item] = path.segments {
|
||||
let _ = self.prohibit_generic_args(modules.iter(), GenericsArgsErrExtend::None);
|
||||
Some(trait_)
|
||||
} else {
|
||||
None
|
||||
};
|
||||
self.lower_qpath_ty(
|
||||
span,
|
||||
opt_self_ty,
|
||||
def_id,
|
||||
&path.segments[path.segments.len() - 2],
|
||||
trait_segment,
|
||||
path.segments.last().unwrap(),
|
||||
)
|
||||
}
|
||||
@@ -2413,16 +2414,17 @@ fn lower_const_path_resolved(
|
||||
ty::Const::new_unevaluated(tcx, ty::UnevaluatedConst::new(did, args))
|
||||
}
|
||||
Res::Def(DefKind::AssocConst, did) => {
|
||||
debug_assert!(path.segments.len() >= 2);
|
||||
let _ = self.prohibit_generic_args(
|
||||
path.segments[..path.segments.len() - 2].iter(),
|
||||
GenericsArgsErrExtend::None,
|
||||
);
|
||||
let trait_segment = if let [modules @ .., trait_, _item] = path.segments {
|
||||
let _ = self.prohibit_generic_args(modules.iter(), GenericsArgsErrExtend::None);
|
||||
Some(trait_)
|
||||
} else {
|
||||
None
|
||||
};
|
||||
self.lower_qpath_const(
|
||||
span,
|
||||
opt_self_ty,
|
||||
did,
|
||||
&path.segments[path.segments.len() - 2],
|
||||
trait_segment,
|
||||
path.segments.last().unwrap(),
|
||||
)
|
||||
}
|
||||
|
||||
@@ -218,10 +218,6 @@ resolve_invalid_asm_sym =
|
||||
.label = is a local variable
|
||||
.help = `sym` operands must refer to either a function or a static
|
||||
|
||||
resolve_is_not_directly_importable =
|
||||
`{$target}` is not directly importable
|
||||
.label = cannot be imported directly
|
||||
|
||||
resolve_is_private =
|
||||
{$ident_descr} `{$ident}` is private
|
||||
.label = private {$ident_descr}
|
||||
@@ -231,9 +227,6 @@ resolve_item_was_behind_feature =
|
||||
|
||||
resolve_item_was_cfg_out = the item is gated here
|
||||
|
||||
resolve_items_in_traits_are_not_importable =
|
||||
items in traits are not importable
|
||||
|
||||
resolve_label_with_similar_name_reachable =
|
||||
a label with a similar name is reachable
|
||||
|
||||
|
||||
@@ -1181,11 +1181,9 @@ fn lookup_import_candidates_from_module<FilterFn>(
|
||||
} {
|
||||
let in_module_is_extern = !in_module.def_id().is_local();
|
||||
in_module.for_each_child(self, |this, ident, ns, name_binding| {
|
||||
// avoid non-importable candidates
|
||||
if !name_binding.is_importable()
|
||||
// FIXME(import_trait_associated_functions): remove this when `import_trait_associated_functions` is stable
|
||||
|| name_binding.is_assoc_const_or_fn()
|
||||
&& !this.tcx.features().import_trait_associated_functions()
|
||||
// Avoid non-importable candidates.
|
||||
if name_binding.is_assoc_item()
|
||||
&& !this.tcx.features().import_trait_associated_functions()
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -781,22 +781,6 @@ pub(crate) struct CannotGlobImportAllCrates {
|
||||
pub(crate) span: Span,
|
||||
}
|
||||
|
||||
#[derive(Diagnostic)]
|
||||
#[diag(resolve_items_in_traits_are_not_importable)]
|
||||
pub(crate) struct ItemsInTraitsAreNotImportable {
|
||||
#[primary_span]
|
||||
pub(crate) span: Span,
|
||||
}
|
||||
|
||||
#[derive(Diagnostic)]
|
||||
#[diag(resolve_is_not_directly_importable, code = E0253)]
|
||||
pub(crate) struct IsNotDirectlyImportable {
|
||||
#[primary_span]
|
||||
#[label]
|
||||
pub(crate) span: Span,
|
||||
pub(crate) target: Ident,
|
||||
}
|
||||
|
||||
#[derive(Subdiagnostic)]
|
||||
#[suggestion(
|
||||
resolve_unexpected_res_change_ty_to_const_param_sugg,
|
||||
|
||||
@@ -30,8 +30,7 @@
|
||||
use crate::errors::{
|
||||
CannotBeReexportedCratePublic, CannotBeReexportedCratePublicNS, CannotBeReexportedPrivate,
|
||||
CannotBeReexportedPrivateNS, CannotDetermineImportResolution, CannotGlobImportAllCrates,
|
||||
ConsiderAddingMacroExport, ConsiderMarkingAsPub, IsNotDirectlyImportable,
|
||||
ItemsInTraitsAreNotImportable,
|
||||
ConsiderAddingMacroExport, ConsiderMarkingAsPub,
|
||||
};
|
||||
use crate::{
|
||||
AmbiguityError, AmbiguityKind, BindingKey, Finalize, ImportSuggestion, Module,
|
||||
@@ -835,11 +834,8 @@ fn resolve_import(&mut self, import: Import<'ra>) -> usize {
|
||||
|
||||
let parent = import.parent_scope.module;
|
||||
match source_bindings[ns].get() {
|
||||
Err(Undetermined) => indeterminate_count += 1,
|
||||
// Don't update the resolution, because it was never added.
|
||||
Err(Determined) if target.name == kw::Underscore => {}
|
||||
Ok(binding) if binding.is_importable() => {
|
||||
if binding.is_assoc_const_or_fn()
|
||||
Ok(binding) => {
|
||||
if binding.is_assoc_item()
|
||||
&& !this.tcx.features().import_trait_associated_functions()
|
||||
{
|
||||
feature_err(
|
||||
@@ -850,21 +846,21 @@ fn resolve_import(&mut self, import: Import<'ra>) -> usize {
|
||||
)
|
||||
.emit();
|
||||
}
|
||||
|
||||
let imported_binding = this.import(binding, import);
|
||||
target_bindings[ns].set(Some(imported_binding));
|
||||
this.define(parent, target, ns, imported_binding);
|
||||
}
|
||||
source_binding @ (Ok(..) | Err(Determined)) => {
|
||||
if source_binding.is_ok() {
|
||||
this.dcx()
|
||||
.create_err(IsNotDirectlyImportable { span: import.span, target })
|
||||
.emit();
|
||||
Err(Determined) => {
|
||||
// Don't update the resolution for underscores, because it was never added.
|
||||
if target.name != kw::Underscore {
|
||||
let key = BindingKey::new(target, ns);
|
||||
this.update_resolution(parent, key, false, |_, resolution| {
|
||||
resolution.single_imports.swap_remove(&import);
|
||||
});
|
||||
}
|
||||
let key = BindingKey::new(target, ns);
|
||||
this.update_resolution(parent, key, false, |_, resolution| {
|
||||
resolution.single_imports.swap_remove(&import);
|
||||
});
|
||||
}
|
||||
Err(Undetermined) => indeterminate_count += 1,
|
||||
}
|
||||
}
|
||||
});
|
||||
@@ -1428,10 +1424,17 @@ fn resolve_glob_import(&mut self, import: Import<'ra>) {
|
||||
return;
|
||||
};
|
||||
|
||||
if module.is_trait() {
|
||||
self.dcx().emit_err(ItemsInTraitsAreNotImportable { span: import.span });
|
||||
return;
|
||||
} else if module == import.parent_scope.module {
|
||||
if module.is_trait() && !self.tcx.features().import_trait_associated_functions() {
|
||||
feature_err(
|
||||
self.tcx.sess,
|
||||
sym::import_trait_associated_functions,
|
||||
import.span,
|
||||
"`use` associated items of traits is unstable",
|
||||
)
|
||||
.emit();
|
||||
}
|
||||
|
||||
if module == import.parent_scope.module {
|
||||
return;
|
||||
} else if is_prelude {
|
||||
self.prelude = Some(module);
|
||||
|
||||
@@ -949,14 +949,8 @@ fn is_glob_import(&self) -> bool {
|
||||
}
|
||||
}
|
||||
|
||||
fn is_importable(&self) -> bool {
|
||||
!matches!(self.res(), Res::Def(DefKind::AssocTy, _))
|
||||
}
|
||||
|
||||
// FIXME(import_trait_associated_functions): associate `const` or `fn` are not importable unless
|
||||
// the feature `import_trait_associated_functions` is enable
|
||||
fn is_assoc_const_or_fn(&self) -> bool {
|
||||
matches!(self.res(), Res::Def(DefKind::AssocConst | DefKind::AssocFn, _))
|
||||
fn is_assoc_item(&self) -> bool {
|
||||
matches!(self.res(), Res::Def(DefKind::AssocConst | DefKind::AssocFn | DefKind::AssocTy, _))
|
||||
}
|
||||
|
||||
fn macro_kind(&self) -> Option<MacroKind> {
|
||||
|
||||
@@ -3043,7 +3043,7 @@ pub fn read_dir<P: AsRef<Path>>(path: P) -> io::Result<ReadDir> {
|
||||
/// When possible, permissions should be set at creation time instead.
|
||||
///
|
||||
/// # Rationale
|
||||
/// POSIX does not specify an `lchown` function,
|
||||
/// POSIX does not specify an `lchmod` function,
|
||||
/// and symlinks can be followed regardless of what permission bits are set.
|
||||
///
|
||||
/// # Errors
|
||||
|
||||
+130
-15
@@ -64,7 +64,7 @@ dependencies = [
|
||||
"tracing-subscriber",
|
||||
"tracing-tree",
|
||||
"walkdir",
|
||||
"windows",
|
||||
"windows 0.57.0",
|
||||
"xz2",
|
||||
]
|
||||
|
||||
@@ -158,12 +158,6 @@ dependencies = [
|
||||
"cc",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "core-foundation-sys"
|
||||
version = "0.8.7"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "773648b94d0e5d620f64f280777445740e61fe701025087ec8b57f45c791888b"
|
||||
|
||||
[[package]]
|
||||
name = "cpufeatures"
|
||||
version = "0.2.15"
|
||||
@@ -440,6 +434,25 @@ dependencies = [
|
||||
"windows-sys 0.52.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "objc2-core-foundation"
|
||||
version = "0.3.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "1c10c2894a6fed806ade6027bcd50662746363a9589d3ec9d9bef30a4e4bc166"
|
||||
dependencies = [
|
||||
"bitflags",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "objc2-io-kit"
|
||||
version = "0.3.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "71c1c64d6120e51cd86033f67176b1cb66780c2efe34dec55176f77befd93c0a"
|
||||
dependencies = [
|
||||
"libc",
|
||||
"objc2-core-foundation",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "object"
|
||||
version = "0.36.5"
|
||||
@@ -700,15 +713,16 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "sysinfo"
|
||||
version = "0.33.0"
|
||||
version = "0.35.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "948512566b1895f93b1592c7574baeb2de842f224f2aab158799ecadb8ebbb46"
|
||||
checksum = "b897c8ea620e181c7955369a31be5f48d9a9121cb59fd33ecef9ff2a34323422"
|
||||
dependencies = [
|
||||
"core-foundation-sys",
|
||||
"libc",
|
||||
"memchr",
|
||||
"ntapi",
|
||||
"windows",
|
||||
"objc2-core-foundation",
|
||||
"objc2-io-kit",
|
||||
"windows 0.61.1",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -927,22 +941,67 @@ version = "0.57.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "12342cb4d8e3b046f3d80effd474a7a02447231330ef77d71daa6fbc40681143"
|
||||
dependencies = [
|
||||
"windows-core",
|
||||
"windows-core 0.57.0",
|
||||
"windows-targets",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "windows"
|
||||
version = "0.61.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c5ee8f3d025738cb02bad7868bbb5f8a6327501e870bf51f1b455b0a2454a419"
|
||||
dependencies = [
|
||||
"windows-collections",
|
||||
"windows-core 0.61.0",
|
||||
"windows-future",
|
||||
"windows-link",
|
||||
"windows-numerics",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "windows-collections"
|
||||
version = "0.2.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "3beeceb5e5cfd9eb1d76b381630e82c4241ccd0d27f1a39ed41b2760b255c5e8"
|
||||
dependencies = [
|
||||
"windows-core 0.61.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "windows-core"
|
||||
version = "0.57.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d2ed2439a290666cd67ecce2b0ffaad89c2a56b976b736e6ece670297897832d"
|
||||
dependencies = [
|
||||
"windows-implement",
|
||||
"windows-interface",
|
||||
"windows-result",
|
||||
"windows-implement 0.57.0",
|
||||
"windows-interface 0.57.0",
|
||||
"windows-result 0.1.2",
|
||||
"windows-targets",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "windows-core"
|
||||
version = "0.61.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "4763c1de310c86d75a878046489e2e5ba02c649d185f21c67d4cf8a56d098980"
|
||||
dependencies = [
|
||||
"windows-implement 0.60.0",
|
||||
"windows-interface 0.59.1",
|
||||
"windows-link",
|
||||
"windows-result 0.3.2",
|
||||
"windows-strings",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "windows-future"
|
||||
version = "0.2.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7a1d6bbefcb7b60acd19828e1bc965da6fcf18a7e39490c5f8be71e54a19ba32"
|
||||
dependencies = [
|
||||
"windows-core 0.61.0",
|
||||
"windows-link",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "windows-implement"
|
||||
version = "0.57.0"
|
||||
@@ -954,6 +1013,17 @@ dependencies = [
|
||||
"syn",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "windows-implement"
|
||||
version = "0.60.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a47fddd13af08290e67f4acabf4b459f647552718f683a7b415d290ac744a836"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "windows-interface"
|
||||
version = "0.57.0"
|
||||
@@ -965,6 +1035,33 @@ dependencies = [
|
||||
"syn",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "windows-interface"
|
||||
version = "0.59.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "bd9211b69f8dcdfa817bfd14bf1c97c9188afa36f4750130fcdf3f400eca9fa8"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "windows-link"
|
||||
version = "0.1.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "76840935b766e1b0a05c0066835fb9ec80071d4c09a16f6bd5f7e655e3c14c38"
|
||||
|
||||
[[package]]
|
||||
name = "windows-numerics"
|
||||
version = "0.2.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "9150af68066c4c5c07ddc0ce30421554771e528bde427614c61038bc2c92c2b1"
|
||||
dependencies = [
|
||||
"windows-core 0.61.0",
|
||||
"windows-link",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "windows-result"
|
||||
version = "0.1.2"
|
||||
@@ -974,6 +1071,24 @@ dependencies = [
|
||||
"windows-targets",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "windows-result"
|
||||
version = "0.3.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c64fd11a4fd95df68efcfee5f44a294fe71b8bc6a91993e2791938abcc712252"
|
||||
dependencies = [
|
||||
"windows-link",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "windows-strings"
|
||||
version = "0.4.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7a2ba9642430ee452d5a7aa78d72907ebe8cfda358e8cb7918a2050581322f97"
|
||||
dependencies = [
|
||||
"windows-link",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "windows-sys"
|
||||
version = "0.52.0"
|
||||
|
||||
@@ -58,7 +58,7 @@ walkdir = "2.4"
|
||||
xz2 = "0.1"
|
||||
|
||||
# Dependencies needed by the build-metrics feature
|
||||
sysinfo = { version = "0.33.0", default-features = false, optional = true, features = ["system"] }
|
||||
sysinfo = { version = "0.35.0", default-features = false, optional = true, features = ["system"] }
|
||||
|
||||
# Dependencies needed by the `tracing` feature
|
||||
tracing = { version = "0.1", optional = true, features = ["attributes"] }
|
||||
|
||||
@@ -8,7 +8,6 @@ RISC Zero's Zero Knowledge Virtual Machine (zkVM) implementing the RV32IM instru
|
||||
|
||||
[@flaub](https://github.com/flaub)
|
||||
[@jbruestle](https://github.com/jbruestle)
|
||||
[@SchmErik](https://github.com/SchmErik)
|
||||
|
||||
## Background
|
||||
|
||||
|
||||
@@ -10,7 +10,7 @@ log = "0.4"
|
||||
anyhow = "1"
|
||||
humantime = "2"
|
||||
humansize = "2"
|
||||
sysinfo = { version = "0.31.2", default-features = false, features = ["disk"] }
|
||||
sysinfo = { version = "0.35.0", default-features = false, features = ["disk"] }
|
||||
fs_extra = "1"
|
||||
camino = "1"
|
||||
tar = "0.4"
|
||||
|
||||
@@ -1,21 +0,0 @@
|
||||
//@ known-bug: #107975
|
||||
//@ compile-flags: -Copt-level=2
|
||||
//@ run-pass
|
||||
|
||||
fn main() {
|
||||
let a: usize = {
|
||||
let v = 0u8;
|
||||
&v as *const _ as usize
|
||||
};
|
||||
let b: usize = {
|
||||
let v = 0u8;
|
||||
&v as *const _ as usize
|
||||
};
|
||||
|
||||
// `a` and `b` are not equal.
|
||||
assert_ne!(a, b);
|
||||
// But they are the same number.
|
||||
assert_eq!(format!("{a}"), format!("{b}"));
|
||||
// And they are equal.
|
||||
assert_eq!(a, b);
|
||||
}
|
||||
@@ -1,22 +0,0 @@
|
||||
//@ known-bug: #107975
|
||||
//@ compile-flags: -Copt-level=2
|
||||
//@ run-pass
|
||||
|
||||
// Based on https://github.com/rust-lang/rust/issues/107975#issuecomment-1434203908
|
||||
|
||||
fn f() -> usize {
|
||||
let v = 0;
|
||||
&v as *const _ as usize
|
||||
}
|
||||
|
||||
fn main() {
|
||||
let a = f();
|
||||
let b = f();
|
||||
|
||||
// `a` and `b` are not equal.
|
||||
assert_ne!(a, b);
|
||||
// But they are the same number.
|
||||
assert_eq!(format!("{a}"), format!("{b}"));
|
||||
// And they are equal.
|
||||
assert_eq!(a, b);
|
||||
}
|
||||
@@ -1,20 +0,0 @@
|
||||
//@ known-bug: #107975
|
||||
//@ compile-flags: -Copt-level=2
|
||||
//@ run-pass
|
||||
|
||||
// https://github.com/rust-lang/rust/issues/107975#issuecomment-1430704499
|
||||
|
||||
fn main() {
|
||||
let a = {
|
||||
let v = 0;
|
||||
&v as *const _ as usize
|
||||
};
|
||||
let b = {
|
||||
let v = 0;
|
||||
&v as *const _ as usize
|
||||
};
|
||||
|
||||
assert_ne!(a, b);
|
||||
println!("{a}"); // or b
|
||||
assert_eq!(a, b);
|
||||
}
|
||||
@@ -1,23 +0,0 @@
|
||||
//@ known-bug: #107975
|
||||
//@ compile-flags: -Copt-level=2
|
||||
//@ run-pass
|
||||
|
||||
use std::ptr;
|
||||
|
||||
fn main() {
|
||||
let a: usize = {
|
||||
let v = 0u8;
|
||||
ptr::from_ref(&v).expose_provenance()
|
||||
};
|
||||
let b: usize = {
|
||||
let v = 0u8;
|
||||
ptr::from_ref(&v).expose_provenance()
|
||||
};
|
||||
|
||||
// `a` and `b` are not equal.
|
||||
assert_ne!(a, b);
|
||||
// But they are the same number.
|
||||
assert_eq!(format!("{a}"), format!("{b}"));
|
||||
// And they are equal.
|
||||
assert_eq!(a, b);
|
||||
}
|
||||
@@ -1,24 +0,0 @@
|
||||
//@ known-bug: #107975
|
||||
//@ compile-flags: -Copt-level=2
|
||||
//@ run-pass
|
||||
|
||||
// Based on https://github.com/rust-lang/rust/issues/107975#issuecomment-1434203908
|
||||
|
||||
use std::ptr;
|
||||
|
||||
fn f() -> usize {
|
||||
let v = 0;
|
||||
ptr::from_ref(&v).expose_provenance()
|
||||
}
|
||||
|
||||
fn main() {
|
||||
let a = f();
|
||||
let b = f();
|
||||
|
||||
// `a` and `b` are not equal.
|
||||
assert_ne!(a, b);
|
||||
// But they are the same number.
|
||||
assert_eq!(format!("{a}"), format!("{b}"));
|
||||
// And they are equal.
|
||||
assert_eq!(a, b);
|
||||
}
|
||||
@@ -1,22 +0,0 @@
|
||||
//@ known-bug: #107975
|
||||
//@ compile-flags: -Copt-level=2
|
||||
//@ run-pass
|
||||
|
||||
// https://github.com/rust-lang/rust/issues/107975#issuecomment-1430704499
|
||||
|
||||
use std::ptr;
|
||||
|
||||
fn main() {
|
||||
let a: usize = {
|
||||
let v = 0;
|
||||
ptr::from_ref(&v).expose_provenance()
|
||||
};
|
||||
let b: usize = {
|
||||
let v = 0;
|
||||
ptr::from_ref(&v).expose_provenance()
|
||||
};
|
||||
|
||||
assert_ne!(a, b);
|
||||
println!("{a}"); // or b
|
||||
assert_eq!(a, b);
|
||||
}
|
||||
@@ -1,23 +0,0 @@
|
||||
//@ known-bug: #107975
|
||||
//@ compile-flags: -Copt-level=2
|
||||
//@ run-pass
|
||||
|
||||
use std::ptr;
|
||||
|
||||
fn main() {
|
||||
let a: usize = {
|
||||
let v = 0u8;
|
||||
ptr::from_ref(&v).addr()
|
||||
};
|
||||
let b: usize = {
|
||||
let v = 0u8;
|
||||
ptr::from_ref(&v).addr()
|
||||
};
|
||||
|
||||
// `a` and `b` are not equal.
|
||||
assert_ne!(a, b);
|
||||
// But they are the same number.
|
||||
assert_eq!(format!("{a}"), format!("{b}"));
|
||||
// And they are equal.
|
||||
assert_eq!(a, b);
|
||||
}
|
||||
@@ -1,24 +0,0 @@
|
||||
//@ known-bug: #107975
|
||||
//@ compile-flags: -Copt-level=2
|
||||
//@ run-pass
|
||||
|
||||
// Based on https://github.com/rust-lang/rust/issues/107975#issuecomment-1434203908
|
||||
|
||||
use std::ptr;
|
||||
|
||||
fn f() -> usize {
|
||||
let v = 0;
|
||||
ptr::from_ref(&v).addr()
|
||||
}
|
||||
|
||||
fn main() {
|
||||
let a = f();
|
||||
let b = f();
|
||||
|
||||
// `a` and `b` are not equal.
|
||||
assert_ne!(a, b);
|
||||
// But they are the same number.
|
||||
assert_eq!(format!("{a}"), format!("{b}"));
|
||||
// And they are equal.
|
||||
assert_eq!(a, b);
|
||||
}
|
||||
@@ -1,22 +0,0 @@
|
||||
//@ known-bug: #107975
|
||||
//@ compile-flags: -Copt-level=2
|
||||
//@ run-pass
|
||||
|
||||
// https://github.com/rust-lang/rust/issues/107975#issuecomment-1430704499
|
||||
|
||||
use std::ptr;
|
||||
|
||||
fn main() {
|
||||
let a: usize = {
|
||||
let v = 0;
|
||||
ptr::from_ref(&v).addr()
|
||||
};
|
||||
let b: usize = {
|
||||
let v = 0;
|
||||
ptr::from_ref(&v).addr()
|
||||
};
|
||||
|
||||
assert_ne!(a, b);
|
||||
println!("{a}"); // or b
|
||||
assert_eq!(a, b);
|
||||
}
|
||||
@@ -1,10 +0,0 @@
|
||||
mod foo {
|
||||
pub trait MyTrait {
|
||||
type SomeType;
|
||||
}
|
||||
}
|
||||
|
||||
use foo::MyTrait::SomeType;
|
||||
//~^ ERROR E0253
|
||||
|
||||
fn main() {}
|
||||
@@ -1,9 +0,0 @@
|
||||
error[E0253]: `SomeType` is not directly importable
|
||||
--> $DIR/E0253.rs:7:5
|
||||
|
|
||||
LL | use foo::MyTrait::SomeType;
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^ cannot be imported directly
|
||||
|
||||
error: aborting due to 1 previous error
|
||||
|
||||
For more information about this error, try `rustc --explain E0253`.
|
||||
@@ -60,4 +60,7 @@ fn f() {
|
||||
let t: Option<S> = DEFAULT;
|
||||
}
|
||||
|
||||
trait Glob {}
|
||||
use Glob::*; //~ ERROR `use` associated items of traits is unstable
|
||||
|
||||
fn main() {}
|
||||
|
||||
@@ -48,6 +48,16 @@ LL | use super::A::{self, DEFAULT, new};
|
||||
= help: add `#![feature(import_trait_associated_functions)]` to the crate attributes to enable
|
||||
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
|
||||
|
||||
error: aborting due to 5 previous errors
|
||||
error[E0658]: `use` associated items of traits is unstable
|
||||
--> $DIR/feature-gate-import-trait-associated-functions.rs:64:5
|
||||
|
|
||||
LL | use Glob::*;
|
||||
| ^^^^^^^
|
||||
|
|
||||
= note: see issue #134691 <https://github.com/rust-lang/rust/issues/134691> for more information
|
||||
= help: add `#![feature(import_trait_associated_functions)]` to the crate attributes to enable
|
||||
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
|
||||
|
||||
error: aborting due to 6 previous errors
|
||||
|
||||
For more information about this error, try `rustc --explain E0658`.
|
||||
|
||||
@@ -3,7 +3,4 @@
|
||||
|
||||
use std::io::Result::*; //~ ERROR unresolved import `std::io::Result` [E0432]
|
||||
|
||||
trait T {}
|
||||
use T::*; //~ ERROR items in traits are not importable
|
||||
|
||||
fn main() {}
|
||||
|
||||
@@ -1,9 +1,3 @@
|
||||
error: items in traits are not importable
|
||||
--> $DIR/issue-30560.rs:7:5
|
||||
|
|
||||
LL | use T::*;
|
||||
| ^^^^
|
||||
|
||||
error[E0432]: unresolved import `Alias`
|
||||
--> $DIR/issue-30560.rs:2:5
|
||||
|
|
||||
@@ -16,6 +10,6 @@ error[E0432]: unresolved import `std::io::Result`
|
||||
LL | use std::io::Result::*;
|
||||
| ^^^^^^ `Result` is a type alias, not a module
|
||||
|
||||
error: aborting due to 3 previous errors
|
||||
error: aborting due to 2 previous errors
|
||||
|
||||
For more information about this error, try `rustc --explain E0432`.
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
error: target feature `d` cannot be enabled with `#[target_feature]`: this feature is incompatible with the target ABI
|
||||
--> $DIR/abi-incompatible-target-feature-attribute.rs:15:90
|
||||
|
|
||||
LL | #[cfg_attr(x86, target_feature(enable = "soft-float"))] #[cfg_attr(riscv, target_feature(enable = "d"))]
|
||||
| ^^^^^^^^^^^^
|
||||
|
||||
error: aborting due to 1 previous error
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
//! Ensure ABI-incompatible features cannot be enabled via `#[target_feature]`.
|
||||
// ignore-tidy-linelength
|
||||
//@ compile-flags: --crate-type=lib
|
||||
//@ revisions: x86 riscv
|
||||
//@[x86] compile-flags: --target=x86_64-unknown-linux-gnu
|
||||
//@[x86] needs-llvm-components: x86
|
||||
//@[riscv] compile-flags: --target=riscv32e-unknown-none-elf
|
||||
//@[riscv] needs-llvm-components: riscv
|
||||
#![feature(no_core, lang_items, riscv_target_feature, x87_target_feature)]
|
||||
#![no_core]
|
||||
|
||||
#[lang = "sized"]
|
||||
pub trait Sized {}
|
||||
|
||||
#[cfg_attr(x86, target_feature(enable = "soft-float"))] #[cfg_attr(riscv, target_feature(enable = "d"))]
|
||||
//~^ERROR: cannot be enabled with
|
||||
pub unsafe fn my_fun() {}
|
||||
@@ -0,0 +1,8 @@
|
||||
error: target feature `soft-float` cannot be enabled with `#[target_feature]`: this feature is incompatible with the target ABI
|
||||
--> $DIR/abi-incompatible-target-feature-attribute.rs:15:32
|
||||
|
|
||||
LL | #[cfg_attr(x86, target_feature(enable = "soft-float"))] #[cfg_attr(riscv, target_feature(enable = "d"))]
|
||||
| ^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: aborting due to 1 previous error
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
warning: target feature `d` must be disabled to ensure that the ABI of the current target can be implemented correctly
|
||||
|
|
||||
= note: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
|
||||
= note: for more information, see issue #116344 <https://github.com/rust-lang/rust/issues/116344>
|
||||
|
||||
warning: unstable feature specified for `-Ctarget-feature`: `d`
|
||||
|
|
||||
= note: this feature is not stably supported; its behavior can change in the future
|
||||
|
||||
warning: unstable feature specified for `-Ctarget-feature`: `f`
|
||||
|
|
||||
= note: this feature is not stably supported; its behavior can change in the future
|
||||
|
||||
warning: unstable feature specified for `-Ctarget-feature`: `zicsr`
|
||||
|
|
||||
= note: this feature is not stably supported; its behavior can change in the future
|
||||
|
||||
warning: 4 warnings emitted
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
//! Ensure ABI-incompatible features cannot be enabled via `-Ctarget-feature`.
|
||||
// These are just warnings for now.
|
||||
//@ check-pass
|
||||
//@ compile-flags: --crate-type=lib
|
||||
//@ revisions: x86 riscv
|
||||
//@[x86] compile-flags: --target=x86_64-unknown-linux-gnu -Ctarget-feature=+soft-float
|
||||
//@[x86] needs-llvm-components: x86
|
||||
//@[riscv] compile-flags: --target=riscv32e-unknown-none-elf -Ctarget-feature=+d
|
||||
//@[riscv] needs-llvm-components: riscv
|
||||
|
||||
#![feature(no_core, lang_items, riscv_target_feature)]
|
||||
#![no_core]
|
||||
|
||||
#[lang = "sized"]
|
||||
pub trait Sized {}
|
||||
#[lang = "freeze"]
|
||||
pub trait Freeze {}
|
||||
|
||||
//~? WARN must be disabled to ensure that the ABI of the current target can be implemented correctly
|
||||
//~? WARN unstable feature specified for `-Ctarget-feature`
|
||||
//[riscv]~? WARN unstable feature specified for `-Ctarget-feature`
|
||||
//[riscv]~? WARN unstable feature specified for `-Ctarget-feature`
|
||||
+3
@@ -1,3 +1,6 @@
|
||||
//! `x87` is a required target feature on some x86 targets, but not on this one as this one
|
||||
//! uses soft-floats. So ensure disabling the target feature here (which is a NOP) does
|
||||
//! not trigger a warning.
|
||||
//@ compile-flags: --target=x86_64-unknown-none --crate-type=lib
|
||||
//@ needs-llvm-components: x86
|
||||
//@ compile-flags: -Ctarget-feature=-x87
|
||||
+2
@@ -1,3 +1,5 @@
|
||||
//! Enabling a target feature that is anyway required changes nothing, so this is allowed
|
||||
//! for `#[target_feature]`.
|
||||
//@ compile-flags: --target=x86_64-unknown-none --crate-type=lib
|
||||
//@ needs-llvm-components: x86
|
||||
//@ build-pass
|
||||
@@ -0,0 +1,11 @@
|
||||
warning: target feature `d` must be enabled to ensure that the ABI of the current target can be implemented correctly
|
||||
|
|
||||
= note: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
|
||||
= note: for more information, see issue #116344 <https://github.com/rust-lang/rust/issues/116344>
|
||||
|
||||
warning: unstable feature specified for `-Ctarget-feature`: `d`
|
||||
|
|
||||
= note: this feature is not stably supported; its behavior can change in the future
|
||||
|
||||
warning: 2 warnings emitted
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
warning: target feature `d` must be enabled to ensure that the ABI of the current target can be implemented correctly
|
||||
|
|
||||
= note: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
|
||||
= note: for more information, see issue #116344 <https://github.com/rust-lang/rust/issues/116344>
|
||||
|
||||
warning: unstable feature specified for `-Ctarget-feature`: `d`
|
||||
|
|
||||
= note: this feature is not stably supported; its behavior can change in the future
|
||||
|
||||
warning: 2 warnings emitted
|
||||
|
||||
@@ -0,0 +1,27 @@
|
||||
//! Ensure ABI-required features cannot be disabled via `-Ctarget-feature`.
|
||||
//! Also covers the case of a feature indirectly disabling another via feature implications.
|
||||
//@ compile-flags: --crate-type=lib
|
||||
//@ revisions: x86 x86-implied aarch64 riscv loongarch
|
||||
//@[x86] compile-flags: --target=x86_64-unknown-linux-gnu -Ctarget-feature=-x87
|
||||
//@[x86] needs-llvm-components: x86
|
||||
//@[x86-implied] compile-flags: --target=x86_64-unknown-linux-gnu -Ctarget-feature=-sse
|
||||
//@[x86-implied] needs-llvm-components: x86
|
||||
//@[aarch64] compile-flags: --target=aarch64-unknown-linux-gnu -Ctarget-feature=-neon
|
||||
//@[aarch64] needs-llvm-components: aarch64
|
||||
//@[riscv] compile-flags: --target=riscv64gc-unknown-none-elf -Ctarget-feature=-d
|
||||
//@[riscv] needs-llvm-components: riscv
|
||||
//@[loongarch] compile-flags: --target=loongarch64-unknown-none -Ctarget-feature=-d
|
||||
//@[loongarch] needs-llvm-components: loongarch
|
||||
// For now this is just a warning.
|
||||
//@ build-pass
|
||||
// Remove some LLVM warnings that only show up sometimes.
|
||||
//@ normalize-stderr: "\n[^\n]*(target-abi|lp64f)[^\n]*" -> ""
|
||||
|
||||
#![feature(no_core, lang_items)]
|
||||
#![no_core]
|
||||
|
||||
#[lang = "sized"]
|
||||
pub trait Sized {}
|
||||
|
||||
//~? WARN must be enabled to ensure that the ABI of the current target can be implemented correctly
|
||||
//[x86,riscv,loongarch]~? WARN unstable feature specified for `-Ctarget-feature`
|
||||
@@ -1,15 +0,0 @@
|
||||
//! Ensure that if disabling a target feature implies disabling an ABI-required target feature,
|
||||
//! we complain.
|
||||
//@ compile-flags: --target=x86_64-unknown-linux-gnu --crate-type=lib
|
||||
//@ needs-llvm-components: x86
|
||||
//@ compile-flags: -Ctarget-feature=-sse
|
||||
// For now this is just a warning.
|
||||
//@ build-pass
|
||||
|
||||
#![feature(no_core, lang_items)]
|
||||
#![no_core]
|
||||
|
||||
#[lang = "sized"]
|
||||
pub trait Sized {}
|
||||
|
||||
//~? WARN target feature `sse2` must be enabled to ensure that the ABI of the current target can be implemented correctly
|
||||
@@ -1,13 +0,0 @@
|
||||
//@ compile-flags: --target=aarch64-unknown-linux-gnu --crate-type=lib
|
||||
//@ needs-llvm-components: aarch64
|
||||
//@ compile-flags: -Ctarget-feature=-neon
|
||||
// For now this is just a warning.
|
||||
//@ build-pass
|
||||
|
||||
#![feature(no_core, lang_items)]
|
||||
#![no_core]
|
||||
|
||||
#[lang = "sized"]
|
||||
pub trait Sized {}
|
||||
|
||||
//~? WARN target feature `neon` must be enabled to ensure that the ABI of the current target can be implemented correctly
|
||||
@@ -1,15 +0,0 @@
|
||||
//! Ensure ABI-required features cannot be disabled via `-Ctarget-feature`.
|
||||
//@ compile-flags: --target=x86_64-unknown-linux-gnu --crate-type=lib
|
||||
//@ needs-llvm-components: x86
|
||||
//@ compile-flags: -Ctarget-feature=-x87
|
||||
// For now this is just a warning.
|
||||
//@ build-pass
|
||||
|
||||
#![feature(no_core, lang_items)]
|
||||
#![no_core]
|
||||
|
||||
#[lang = "sized"]
|
||||
pub trait Sized {}
|
||||
|
||||
//~? WARN target feature `x87` must be enabled to ensure that the ABI of the current target can be implemented correctly
|
||||
//~? WARN unstable feature specified for `-Ctarget-feature`: `x87`
|
||||
@@ -1,15 +0,0 @@
|
||||
//! Ensure ABI-incompatible features cannot be enabled via `-Ctarget-feature`.
|
||||
//@ compile-flags: --target=x86_64-unknown-linux-gnu --crate-type=lib
|
||||
//@ needs-llvm-components: x86
|
||||
//@ compile-flags: -Ctarget-feature=+soft-float
|
||||
// For now this is just a warning.
|
||||
//@ build-pass
|
||||
|
||||
#![feature(no_core, lang_items, riscv_target_feature)]
|
||||
#![no_core]
|
||||
|
||||
#[lang = "sized"]
|
||||
pub trait Sized {}
|
||||
|
||||
//~? WARN target feature `soft-float` must be disabled to ensure that the ABI of the current target can be implemented correctl
|
||||
//~? WARN unstable feature specified for `-Ctarget-feature`: `soft-float`
|
||||
@@ -0,0 +1,18 @@
|
||||
#![feature(import_trait_associated_functions)]
|
||||
#![feature(min_generic_const_args)]
|
||||
#![allow(incomplete_features)]
|
||||
|
||||
trait Trait {
|
||||
type AssocTy;
|
||||
const CONST: usize;
|
||||
}
|
||||
|
||||
use Trait::AssocTy;
|
||||
type Alias1 = AssocTy; //~ ERROR ambiguous associated type
|
||||
type Alias2 = self::AssocTy; //~ ERROR ambiguous associated type
|
||||
|
||||
use Trait::CONST;
|
||||
type Alias3 = [u8; CONST]; //~ ERROR ambiguous associated constant
|
||||
type Alias4 = [u8; self::CONST]; //~ ERROR ambiguous associated constant
|
||||
|
||||
fn main() {}
|
||||
@@ -0,0 +1,49 @@
|
||||
error[E0223]: ambiguous associated type
|
||||
--> $DIR/import_trait_associated_item_bad.rs:11:15
|
||||
|
|
||||
LL | type Alias1 = AssocTy;
|
||||
| ^^^^^^^
|
||||
|
|
||||
help: if there were a type named `Example` that implemented `Trait`, you could use the fully-qualified path
|
||||
|
|
||||
LL | type Alias1 = <Example as Trait>::AssocTy;
|
||||
| ++++++++++++++++++++
|
||||
|
||||
error[E0223]: ambiguous associated type
|
||||
--> $DIR/import_trait_associated_item_bad.rs:12:15
|
||||
|
|
||||
LL | type Alias2 = self::AssocTy;
|
||||
| ^^^^^^^^^^^^^
|
||||
|
|
||||
help: if there were a type named `Example` that implemented `Trait`, you could use the fully-qualified path
|
||||
|
|
||||
LL - type Alias2 = self::AssocTy;
|
||||
LL + type Alias2 = <Example as Trait>::AssocTy;
|
||||
|
|
||||
|
||||
error[E0223]: ambiguous associated constant
|
||||
--> $DIR/import_trait_associated_item_bad.rs:15:20
|
||||
|
|
||||
LL | type Alias3 = [u8; CONST];
|
||||
| ^^^^^
|
||||
|
|
||||
help: if there were a type named `Example` that implemented `Trait`, you could use the fully-qualified path
|
||||
|
|
||||
LL | type Alias3 = [u8; <Example as Trait>::CONST];
|
||||
| ++++++++++++++++++++
|
||||
|
||||
error[E0223]: ambiguous associated constant
|
||||
--> $DIR/import_trait_associated_item_bad.rs:16:20
|
||||
|
|
||||
LL | type Alias4 = [u8; self::CONST];
|
||||
| ^^^^^^^^^^^
|
||||
|
|
||||
help: if there were a type named `Example` that implemented `Trait`, you could use the fully-qualified path
|
||||
|
|
||||
LL - type Alias4 = [u8; self::CONST];
|
||||
LL + type Alias4 = [u8; <Example as Trait>::CONST];
|
||||
|
|
||||
|
||||
error: aborting due to 4 previous errors
|
||||
|
||||
For more information about this error, try `rustc --explain E0223`.
|
||||
@@ -0,0 +1,17 @@
|
||||
//@ check-pass
|
||||
|
||||
#![feature(import_trait_associated_functions)]
|
||||
|
||||
trait Trait: Default {
|
||||
fn f() -> Self { Default::default() }
|
||||
fn g() -> Self { Default::default() }
|
||||
}
|
||||
|
||||
impl Trait for u8 {}
|
||||
|
||||
use Trait::*;
|
||||
|
||||
fn main() {
|
||||
let _: u8 = f();
|
||||
let _: u8 = g();
|
||||
}
|
||||
@@ -6,7 +6,7 @@
|
||||
//~^ ERROR `use` associated items of traits is unstable [E0658]
|
||||
|
||||
use use_from_trait_xc::Trait::Assoc;
|
||||
//~^ ERROR `Assoc` is not directly importable
|
||||
//~^ ERROR `use` associated items of traits is unstable [E0658]
|
||||
|
||||
use use_from_trait_xc::Trait::CONST;
|
||||
//~^ ERROR `use` associated items of traits is unstable [E0658]
|
||||
|
||||
@@ -8,11 +8,15 @@ LL | use use_from_trait_xc::Trait::foo;
|
||||
= help: add `#![feature(import_trait_associated_functions)]` to the crate attributes to enable
|
||||
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
|
||||
|
||||
error[E0253]: `Assoc` is not directly importable
|
||||
error[E0658]: `use` associated items of traits is unstable
|
||||
--> $DIR/use-from-trait-xc.rs:8:5
|
||||
|
|
||||
LL | use use_from_trait_xc::Trait::Assoc;
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot be imported directly
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: see issue #134691 <https://github.com/rust-lang/rust/issues/134691> for more information
|
||||
= help: add `#![feature(import_trait_associated_functions)]` to the crate attributes to enable
|
||||
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
|
||||
|
||||
error[E0658]: `use` associated items of traits is unstable
|
||||
--> $DIR/use-from-trait-xc.rs:11:5
|
||||
@@ -74,5 +78,5 @@ LL | struct Foo;
|
||||
|
||||
error: aborting due to 9 previous errors
|
||||
|
||||
Some errors have detailed explanations: E0253, E0432, E0603, E0658.
|
||||
For more information about an error, try `rustc --explain E0253`.
|
||||
Some errors have detailed explanations: E0432, E0603, E0658.
|
||||
For more information about an error, try `rustc --explain E0432`.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
use Trait::foo; //~ ERROR `use` associated items of traits is unstable [E0658]
|
||||
use Trait::Assoc; //~ ERROR `Assoc` is not directly importable
|
||||
use Trait::Assoc; //~ ERROR `use` associated items of traits is unstable [E0658]
|
||||
use Trait::C; //~ ERROR `use` associated items of traits is unstable [E0658]
|
||||
|
||||
use Foo::new; //~ ERROR unresolved import `Foo` [E0432]
|
||||
|
||||
@@ -8,11 +8,15 @@ LL | use Trait::foo;
|
||||
= help: add `#![feature(import_trait_associated_functions)]` to the crate attributes to enable
|
||||
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
|
||||
|
||||
error[E0253]: `Assoc` is not directly importable
|
||||
error[E0658]: `use` associated items of traits is unstable
|
||||
--> $DIR/use-from-trait.rs:2:5
|
||||
|
|
||||
LL | use Trait::Assoc;
|
||||
| ^^^^^^^^^^^^ cannot be imported directly
|
||||
| ^^^^^^^^^^^^
|
||||
|
|
||||
= note: see issue #134691 <https://github.com/rust-lang/rust/issues/134691> for more information
|
||||
= help: add `#![feature(import_trait_associated_functions)]` to the crate attributes to enable
|
||||
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
|
||||
|
||||
error[E0658]: `use` associated items of traits is unstable
|
||||
--> $DIR/use-from-trait.rs:3:5
|
||||
@@ -38,5 +42,5 @@ LL | use Foo::C2;
|
||||
|
||||
error: aborting due to 5 previous errors
|
||||
|
||||
Some errors have detailed explanations: E0253, E0432, E0658.
|
||||
For more information about an error, try `rustc --explain E0253`.
|
||||
Some errors have detailed explanations: E0432, E0658.
|
||||
For more information about an error, try `rustc --explain E0432`.
|
||||
|
||||
Reference in New Issue
Block a user