mirror of
https://github.com/rust-lang/rust.git
synced 2024-12-18 11:34:11 +00:00
Auto merge of #89939 - matthiaskrgr:rollup-q3lrdck, r=matthiaskrgr
Rollup of 10 pull requests Successful merges: - #89509 (Stabilize `unreachable_unchecked` as `const fn`) - #89898 (Remove alloc::prelude) - #89902 (Restrict the aarch64 outline atomics test to Linux) - #89906 (Moved format-version constant to rustdoc-json-types) - #89912 (emitter: current substitution can be multi-line) - #89914 (Emit impl difference error for GenericBoundFailure too) - #89915 (Some outlives cleanup) - #89918 (Add some GATs related regression tests) - #89921 ([fuchsia] Update process info struct) - #89925 (updating docs to mention usage of AtomicBool) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
This commit is contained in:
commit
7fbd4ce276
@ -1,10 +1,10 @@
|
|||||||
#![feature(start, core_intrinsics, alloc_prelude, alloc_error_handler, box_syntax)]
|
#![feature(start, core_intrinsics, alloc_error_handler, box_syntax)]
|
||||||
#![no_std]
|
#![no_std]
|
||||||
|
|
||||||
extern crate alloc;
|
extern crate alloc;
|
||||||
extern crate alloc_system;
|
extern crate alloc_system;
|
||||||
|
|
||||||
use alloc::prelude::v1::*;
|
use alloc::boxed::Box;
|
||||||
|
|
||||||
use alloc_system::System;
|
use alloc_system::System;
|
||||||
|
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
#![feature(start, box_syntax, core_intrinsics, alloc_prelude, alloc_error_handler)]
|
#![feature(start, box_syntax, core_intrinsics, alloc_error_handler)]
|
||||||
#![no_std]
|
#![no_std]
|
||||||
|
|
||||||
extern crate alloc;
|
extern crate alloc;
|
||||||
extern crate alloc_system;
|
extern crate alloc_system;
|
||||||
|
|
||||||
use alloc::prelude::v1::*;
|
use alloc::boxed::Box;
|
||||||
|
|
||||||
use alloc_system::System;
|
use alloc_system::System;
|
||||||
|
|
||||||
|
@ -341,7 +341,7 @@ impl CodeSuggestion {
|
|||||||
});
|
});
|
||||||
buf.push_str(&part.snippet);
|
buf.push_str(&part.snippet);
|
||||||
let cur_hi = sm.lookup_char_pos(part.span.hi());
|
let cur_hi = sm.lookup_char_pos(part.span.hi());
|
||||||
if prev_hi.line == cur_lo.line {
|
if prev_hi.line == cur_lo.line && cur_hi.line == cur_lo.line {
|
||||||
// Account for the difference between the width of the current code and the
|
// Account for the difference between the width of the current code and the
|
||||||
// snippet being suggested, so that the *later* suggestions are correctly
|
// snippet being suggested, so that the *later* suggestions are correctly
|
||||||
// aligned on the screen.
|
// aligned on the screen.
|
||||||
|
@ -46,7 +46,9 @@ impl<'a, 'tcx> NiceRegionError<'a, 'tcx> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if let RegionResolutionError::ConcreteFailure(origin, _, _) = error.clone() {
|
if let RegionResolutionError::ConcreteFailure(origin, _, _)
|
||||||
|
| RegionResolutionError::GenericBoundFailure(origin, _, _) = error.clone()
|
||||||
|
{
|
||||||
if let SubregionOrigin::CompareImplTypeObligation {
|
if let SubregionOrigin::CompareImplTypeObligation {
|
||||||
span,
|
span,
|
||||||
item_name,
|
item_name,
|
||||||
|
@ -2,10 +2,10 @@
|
|||||||
// refers to rules defined in RFC 1214 (`OutlivesFooBar`), so see that
|
// refers to rules defined in RFC 1214 (`OutlivesFooBar`), so see that
|
||||||
// RFC for reference.
|
// RFC for reference.
|
||||||
|
|
||||||
use crate::ty::subst::{GenericArg, GenericArgKind};
|
|
||||||
use crate::ty::{self, Ty, TyCtxt, TypeFoldable};
|
|
||||||
use rustc_data_structures::sso::SsoHashSet;
|
use rustc_data_structures::sso::SsoHashSet;
|
||||||
use smallvec::SmallVec;
|
use rustc_middle::ty::subst::{GenericArg, GenericArgKind};
|
||||||
|
use rustc_middle::ty::{self, Ty, TyCtxt, TypeFoldable};
|
||||||
|
use smallvec::{smallvec, SmallVec};
|
||||||
|
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
pub enum Component<'tcx> {
|
pub enum Component<'tcx> {
|
||||||
@ -47,14 +47,16 @@ pub enum Component<'tcx> {
|
|||||||
EscapingProjection(Vec<Component<'tcx>>),
|
EscapingProjection(Vec<Component<'tcx>>),
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'tcx> TyCtxt<'tcx> {
|
/// Push onto `out` all the things that must outlive `'a` for the condition
|
||||||
/// Push onto `out` all the things that must outlive `'a` for the condition
|
/// `ty0: 'a` to hold. Note that `ty0` must be a **fully resolved type**.
|
||||||
/// `ty0: 'a` to hold. Note that `ty0` must be a **fully resolved type**.
|
pub fn push_outlives_components(
|
||||||
pub fn push_outlives_components(self, ty0: Ty<'tcx>, out: &mut SmallVec<[Component<'tcx>; 4]>) {
|
tcx: TyCtxt<'tcx>,
|
||||||
|
ty0: Ty<'tcx>,
|
||||||
|
out: &mut SmallVec<[Component<'tcx>; 4]>,
|
||||||
|
) {
|
||||||
let mut visited = SsoHashSet::new();
|
let mut visited = SsoHashSet::new();
|
||||||
compute_components(self, ty0, out, &mut visited);
|
compute_components(tcx, ty0, out, &mut visited);
|
||||||
debug!("components({:?}) = {:?}", ty0, out);
|
debug!("components({:?}) = {:?}", ty0, out);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fn compute_components(
|
fn compute_components(
|
@ -1,5 +1,6 @@
|
|||||||
//! Various code related to computing outlives relations.
|
//! Various code related to computing outlives relations.
|
||||||
|
|
||||||
|
pub mod components;
|
||||||
pub mod env;
|
pub mod env;
|
||||||
pub mod obligations;
|
pub mod obligations;
|
||||||
pub mod verify;
|
pub mod verify;
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
//! Code that handles "type-outlives" constraints like `T: 'a`. This
|
//! Code that handles "type-outlives" constraints like `T: 'a`. This
|
||||||
//! is based on the `push_outlives_components` function defined on the tcx,
|
//! is based on the `push_outlives_components` function defined in rustc_infer,
|
||||||
//! but it adds a bit of heuristics on top, in particular to deal with
|
//! but it adds a bit of heuristics on top, in particular to deal with
|
||||||
//! associated types and projections.
|
//! associated types and projections.
|
||||||
//!
|
//!
|
||||||
@ -59,13 +59,13 @@
|
|||||||
//! might later infer `?U` to something like `&'b u32`, which would
|
//! might later infer `?U` to something like `&'b u32`, which would
|
||||||
//! imply that `'b: 'a`.
|
//! imply that `'b: 'a`.
|
||||||
|
|
||||||
|
use crate::infer::outlives::components::{push_outlives_components, Component};
|
||||||
use crate::infer::outlives::env::RegionBoundPairs;
|
use crate::infer::outlives::env::RegionBoundPairs;
|
||||||
use crate::infer::outlives::verify::VerifyBoundCx;
|
use crate::infer::outlives::verify::VerifyBoundCx;
|
||||||
use crate::infer::{
|
use crate::infer::{
|
||||||
self, GenericKind, InferCtxt, RegionObligation, SubregionOrigin, UndoLog, VerifyBound,
|
self, GenericKind, InferCtxt, RegionObligation, SubregionOrigin, UndoLog, VerifyBound,
|
||||||
};
|
};
|
||||||
use crate::traits::{ObligationCause, ObligationCauseCode};
|
use crate::traits::{ObligationCause, ObligationCauseCode};
|
||||||
use rustc_middle::ty::outlives::Component;
|
|
||||||
use rustc_middle::ty::subst::GenericArgKind;
|
use rustc_middle::ty::subst::GenericArgKind;
|
||||||
use rustc_middle::ty::{self, Region, Ty, TyCtxt, TypeFoldable};
|
use rustc_middle::ty::{self, Region, Ty, TyCtxt, TypeFoldable};
|
||||||
|
|
||||||
@ -271,7 +271,7 @@ where
|
|||||||
assert!(!ty.has_escaping_bound_vars());
|
assert!(!ty.has_escaping_bound_vars());
|
||||||
|
|
||||||
let mut components = smallvec![];
|
let mut components = smallvec![];
|
||||||
self.tcx.push_outlives_components(ty, &mut components);
|
push_outlives_components(self.tcx, ty, &mut components);
|
||||||
self.components_must_outlive(origin, &components, region);
|
self.components_must_outlive(origin, &components, region);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
use smallvec::smallvec;
|
use smallvec::smallvec;
|
||||||
|
|
||||||
|
use crate::infer::outlives::components::{push_outlives_components, Component};
|
||||||
use crate::traits::{Obligation, ObligationCause, PredicateObligation};
|
use crate::traits::{Obligation, ObligationCause, PredicateObligation};
|
||||||
use rustc_data_structures::fx::{FxHashSet, FxIndexSet};
|
use rustc_data_structures::fx::{FxHashSet, FxIndexSet};
|
||||||
use rustc_middle::ty::outlives::Component;
|
|
||||||
use rustc_middle::ty::{self, ToPredicate, TyCtxt, WithConstness};
|
use rustc_middle::ty::{self, ToPredicate, TyCtxt, WithConstness};
|
||||||
use rustc_span::symbol::Ident;
|
use rustc_span::symbol::Ident;
|
||||||
|
|
||||||
@ -200,7 +200,7 @@ impl Elaborator<'tcx> {
|
|||||||
|
|
||||||
let visited = &mut self.visited;
|
let visited = &mut self.visited;
|
||||||
let mut components = smallvec![];
|
let mut components = smallvec![];
|
||||||
tcx.push_outlives_components(ty_max, &mut components);
|
push_outlives_components(tcx, ty_max, &mut components);
|
||||||
self.stack.extend(
|
self.stack.extend(
|
||||||
components
|
components
|
||||||
.into_iter()
|
.into_iter()
|
||||||
|
@ -92,7 +92,6 @@ pub mod fold;
|
|||||||
pub mod inhabitedness;
|
pub mod inhabitedness;
|
||||||
pub mod layout;
|
pub mod layout;
|
||||||
pub mod normalize_erasing_regions;
|
pub mod normalize_erasing_regions;
|
||||||
pub mod outlives;
|
|
||||||
pub mod print;
|
pub mod print;
|
||||||
pub mod query;
|
pub mod query;
|
||||||
pub mod relate;
|
pub mod relate;
|
||||||
|
@ -1,12 +1,8 @@
|
|||||||
use crate::traits::query::evaluate_obligation::InferCtxtExt as _;
|
use crate::traits::query::evaluate_obligation::InferCtxtExt as _;
|
||||||
use crate::traits::query::outlives_bounds::InferCtxtExt as _;
|
|
||||||
use crate::traits::{self, TraitEngine, TraitEngineExt};
|
use crate::traits::{self, TraitEngine, TraitEngineExt};
|
||||||
|
|
||||||
use rustc_data_structures::stable_set::FxHashSet;
|
|
||||||
use rustc_hir as hir;
|
|
||||||
use rustc_hir::def_id::DefId;
|
use rustc_hir::def_id::DefId;
|
||||||
use rustc_hir::lang_items::LangItem;
|
use rustc_hir::lang_items::LangItem;
|
||||||
use rustc_infer::infer::outlives::env::OutlivesEnvironment;
|
|
||||||
use rustc_infer::traits::ObligationCause;
|
use rustc_infer::traits::ObligationCause;
|
||||||
use rustc_middle::arena::ArenaAllocatable;
|
use rustc_middle::arena::ArenaAllocatable;
|
||||||
use rustc_middle::infer::canonical::{Canonical, CanonicalizedQueryResponse, QueryResponse};
|
use rustc_middle::infer::canonical::{Canonical, CanonicalizedQueryResponse, QueryResponse};
|
||||||
@ -180,48 +176,3 @@ impl<'tcx> InferCtxtBuilderExt<'tcx> for InferCtxtBuilder<'tcx> {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub trait OutlivesEnvironmentExt<'tcx> {
|
|
||||||
fn add_implied_bounds(
|
|
||||||
&mut self,
|
|
||||||
infcx: &InferCtxt<'a, 'tcx>,
|
|
||||||
fn_sig_tys: FxHashSet<Ty<'tcx>>,
|
|
||||||
body_id: hir::HirId,
|
|
||||||
span: Span,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
impl<'tcx> OutlivesEnvironmentExt<'tcx> for OutlivesEnvironment<'tcx> {
|
|
||||||
/// This method adds "implied bounds" into the outlives environment.
|
|
||||||
/// Implied bounds are outlives relationships that we can deduce
|
|
||||||
/// on the basis that certain types must be well-formed -- these are
|
|
||||||
/// either the types that appear in the function signature or else
|
|
||||||
/// the input types to an impl. For example, if you have a function
|
|
||||||
/// like
|
|
||||||
///
|
|
||||||
/// ```
|
|
||||||
/// fn foo<'a, 'b, T>(x: &'a &'b [T]) { }
|
|
||||||
/// ```
|
|
||||||
///
|
|
||||||
/// we can assume in the caller's body that `'b: 'a` and that `T:
|
|
||||||
/// 'b` (and hence, transitively, that `T: 'a`). This method would
|
|
||||||
/// add those assumptions into the outlives-environment.
|
|
||||||
///
|
|
||||||
/// Tests: `src/test/ui/regions/regions-free-region-ordering-*.rs`
|
|
||||||
fn add_implied_bounds(
|
|
||||||
&mut self,
|
|
||||||
infcx: &InferCtxt<'a, 'tcx>,
|
|
||||||
fn_sig_tys: FxHashSet<Ty<'tcx>>,
|
|
||||||
body_id: hir::HirId,
|
|
||||||
span: Span,
|
|
||||||
) {
|
|
||||||
debug!("add_implied_bounds()");
|
|
||||||
|
|
||||||
for ty in fn_sig_tys {
|
|
||||||
let ty = infcx.resolve_vars_if_possible(ty);
|
|
||||||
debug!("add_implied_bounds: ty = {}", ty);
|
|
||||||
let implied_bounds = infcx.implied_outlives_bounds(self.param_env, body_id, ty, span);
|
|
||||||
self.add_outlives_bounds(Some(infcx), implied_bounds)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
@ -9,7 +9,6 @@ pub mod dropck_outlives;
|
|||||||
pub mod evaluate_obligation;
|
pub mod evaluate_obligation;
|
||||||
pub mod method_autoderef;
|
pub mod method_autoderef;
|
||||||
pub mod normalize;
|
pub mod normalize;
|
||||||
pub mod outlives_bounds;
|
|
||||||
pub mod type_op;
|
pub mod type_op;
|
||||||
|
|
||||||
pub use rustc_middle::traits::query::*;
|
pub use rustc_middle::traits::query::*;
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
use crate::infer::canonical::{Canonicalized, CanonicalizedQueryResponse};
|
use crate::infer::canonical::{Canonicalized, CanonicalizedQueryResponse};
|
||||||
use crate::traits::query::outlives_bounds::OutlivesBound;
|
|
||||||
use crate::traits::query::Fallible;
|
use crate::traits::query::Fallible;
|
||||||
|
use rustc_infer::traits::query::OutlivesBound;
|
||||||
use rustc_middle::ty::{ParamEnvAnd, Ty, TyCtxt};
|
use rustc_middle::ty::{ParamEnvAnd, Ty, TyCtxt};
|
||||||
|
|
||||||
#[derive(Copy, Clone, Debug, HashStable, TypeFoldable, Lift)]
|
#[derive(Copy, Clone, Debug, HashStable, TypeFoldable, Lift)]
|
||||||
|
@ -4,14 +4,14 @@
|
|||||||
|
|
||||||
use rustc_hir as hir;
|
use rustc_hir as hir;
|
||||||
use rustc_infer::infer::canonical::{self, Canonical};
|
use rustc_infer::infer::canonical::{self, Canonical};
|
||||||
|
use rustc_infer::infer::outlives::components::{push_outlives_components, Component};
|
||||||
use rustc_infer::infer::{InferCtxt, TyCtxtInferExt};
|
use rustc_infer::infer::{InferCtxt, TyCtxtInferExt};
|
||||||
|
use rustc_infer::traits::query::OutlivesBound;
|
||||||
use rustc_infer::traits::TraitEngineExt as _;
|
use rustc_infer::traits::TraitEngineExt as _;
|
||||||
use rustc_middle::ty::outlives::Component;
|
|
||||||
use rustc_middle::ty::query::Providers;
|
use rustc_middle::ty::query::Providers;
|
||||||
use rustc_middle::ty::{self, Ty, TyCtxt, TypeFoldable};
|
use rustc_middle::ty::{self, Ty, TyCtxt, TypeFoldable};
|
||||||
use rustc_span::source_map::DUMMY_SP;
|
use rustc_span::source_map::DUMMY_SP;
|
||||||
use rustc_trait_selection::infer::InferCtxtBuilderExt;
|
use rustc_trait_selection::infer::InferCtxtBuilderExt;
|
||||||
use rustc_trait_selection::traits::query::outlives_bounds::OutlivesBound;
|
|
||||||
use rustc_trait_selection::traits::query::{CanonicalTyGoal, Fallible, NoSolution};
|
use rustc_trait_selection::traits::query::{CanonicalTyGoal, Fallible, NoSolution};
|
||||||
use rustc_trait_selection::traits::wf;
|
use rustc_trait_selection::traits::wf;
|
||||||
use rustc_trait_selection::traits::FulfillmentContext;
|
use rustc_trait_selection::traits::FulfillmentContext;
|
||||||
@ -118,7 +118,7 @@ fn compute_implied_outlives_bounds<'tcx>(
|
|||||||
ty::PredicateKind::TypeOutlives(ty::OutlivesPredicate(ty_a, r_b)) => {
|
ty::PredicateKind::TypeOutlives(ty::OutlivesPredicate(ty_a, r_b)) => {
|
||||||
let ty_a = infcx.resolve_vars_if_possible(ty_a);
|
let ty_a = infcx.resolve_vars_if_possible(ty_a);
|
||||||
let mut components = smallvec![];
|
let mut components = smallvec![];
|
||||||
tcx.push_outlives_components(ty_a, &mut components);
|
push_outlives_components(tcx, ty_a, &mut components);
|
||||||
implied_bounds_from_components(r_b, components)
|
implied_bounds_from_components(r_b, components)
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -76,19 +76,19 @@ use crate::check::dropck;
|
|||||||
use crate::check::FnCtxt;
|
use crate::check::FnCtxt;
|
||||||
use crate::mem_categorization as mc;
|
use crate::mem_categorization as mc;
|
||||||
use crate::middle::region;
|
use crate::middle::region;
|
||||||
|
use crate::outlives::outlives_bounds::InferCtxtExt as _;
|
||||||
use rustc_data_structures::stable_set::FxHashSet;
|
use rustc_data_structures::stable_set::FxHashSet;
|
||||||
use rustc_hir as hir;
|
use rustc_hir as hir;
|
||||||
use rustc_hir::def_id::LocalDefId;
|
use rustc_hir::def_id::LocalDefId;
|
||||||
use rustc_hir::intravisit::{self, NestedVisitorMap, Visitor};
|
use rustc_hir::intravisit::{self, NestedVisitorMap, Visitor};
|
||||||
use rustc_hir::PatKind;
|
use rustc_hir::PatKind;
|
||||||
use rustc_infer::infer::outlives::env::OutlivesEnvironment;
|
use rustc_infer::infer::outlives::env::OutlivesEnvironment;
|
||||||
use rustc_infer::infer::{self, RegionObligation, RegionckMode};
|
use rustc_infer::infer::{self, InferCtxt, RegionObligation, RegionckMode};
|
||||||
use rustc_middle::hir::place::{PlaceBase, PlaceWithHirId};
|
use rustc_middle::hir::place::{PlaceBase, PlaceWithHirId};
|
||||||
use rustc_middle::ty::adjustment;
|
use rustc_middle::ty::adjustment;
|
||||||
use rustc_middle::ty::{self, Ty};
|
use rustc_middle::ty::{self, Ty};
|
||||||
use rustc_span::Span;
|
use rustc_span::Span;
|
||||||
use rustc_trait_selection::infer::OutlivesEnvironmentExt;
|
use rustc_trait_selection::opaque_types::InferCtxtExt as _;
|
||||||
use rustc_trait_selection::opaque_types::InferCtxtExt;
|
|
||||||
use std::ops::Deref;
|
use std::ops::Deref;
|
||||||
|
|
||||||
// a variation on try that just returns unit
|
// a variation on try that just returns unit
|
||||||
@ -104,6 +104,51 @@ macro_rules! ignore_err {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
trait OutlivesEnvironmentExt<'tcx> {
|
||||||
|
fn add_implied_bounds(
|
||||||
|
&mut self,
|
||||||
|
infcx: &InferCtxt<'a, 'tcx>,
|
||||||
|
fn_sig_tys: FxHashSet<Ty<'tcx>>,
|
||||||
|
body_id: hir::HirId,
|
||||||
|
span: Span,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
impl<'tcx> OutlivesEnvironmentExt<'tcx> for OutlivesEnvironment<'tcx> {
|
||||||
|
/// This method adds "implied bounds" into the outlives environment.
|
||||||
|
/// Implied bounds are outlives relationships that we can deduce
|
||||||
|
/// on the basis that certain types must be well-formed -- these are
|
||||||
|
/// either the types that appear in the function signature or else
|
||||||
|
/// the input types to an impl. For example, if you have a function
|
||||||
|
/// like
|
||||||
|
///
|
||||||
|
/// ```
|
||||||
|
/// fn foo<'a, 'b, T>(x: &'a &'b [T]) { }
|
||||||
|
/// ```
|
||||||
|
///
|
||||||
|
/// we can assume in the caller's body that `'b: 'a` and that `T:
|
||||||
|
/// 'b` (and hence, transitively, that `T: 'a`). This method would
|
||||||
|
/// add those assumptions into the outlives-environment.
|
||||||
|
///
|
||||||
|
/// Tests: `src/test/ui/regions/regions-free-region-ordering-*.rs`
|
||||||
|
fn add_implied_bounds(
|
||||||
|
&mut self,
|
||||||
|
infcx: &InferCtxt<'a, 'tcx>,
|
||||||
|
fn_sig_tys: FxHashSet<Ty<'tcx>>,
|
||||||
|
body_id: hir::HirId,
|
||||||
|
span: Span,
|
||||||
|
) {
|
||||||
|
debug!("add_implied_bounds()");
|
||||||
|
|
||||||
|
for ty in fn_sig_tys {
|
||||||
|
let ty = infcx.resolve_vars_if_possible(ty);
|
||||||
|
debug!("add_implied_bounds: ty = {}", ty);
|
||||||
|
let implied_bounds = infcx.implied_outlives_bounds(self.param_env, body_id, ty, span);
|
||||||
|
self.add_outlives_bounds(Some(infcx), implied_bounds)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////
|
||||||
// PUBLIC ENTRY POINTS
|
// PUBLIC ENTRY POINTS
|
||||||
|
|
||||||
|
@ -142,23 +142,23 @@ pub fn check_item_well_formed(tcx: TyCtxt<'_>, def_id: LocalDefId) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
hir::ItemKind::Fn(ref sig, ..) => {
|
hir::ItemKind::Fn(ref sig, ..) => {
|
||||||
check_item_fn(tcx, item.hir_id(), item.ident, item.span, sig.decl);
|
check_item_fn(tcx, item.def_id, item.ident, item.span, sig.decl);
|
||||||
}
|
}
|
||||||
hir::ItemKind::Static(ty, ..) => {
|
hir::ItemKind::Static(ty, ..) => {
|
||||||
check_item_type(tcx, item.hir_id(), ty.span, false);
|
check_item_type(tcx, item.def_id, ty.span, false);
|
||||||
}
|
}
|
||||||
hir::ItemKind::Const(ty, ..) => {
|
hir::ItemKind::Const(ty, ..) => {
|
||||||
check_item_type(tcx, item.hir_id(), ty.span, false);
|
check_item_type(tcx, item.def_id, ty.span, false);
|
||||||
}
|
}
|
||||||
hir::ItemKind::ForeignMod { items, .. } => {
|
hir::ItemKind::ForeignMod { items, .. } => {
|
||||||
for it in items.iter() {
|
for it in items.iter() {
|
||||||
let it = tcx.hir().foreign_item(it.id);
|
let it = tcx.hir().foreign_item(it.id);
|
||||||
match it.kind {
|
match it.kind {
|
||||||
hir::ForeignItemKind::Fn(decl, ..) => {
|
hir::ForeignItemKind::Fn(decl, ..) => {
|
||||||
check_item_fn(tcx, it.hir_id(), it.ident, it.span, decl)
|
check_item_fn(tcx, it.def_id, it.ident, it.span, decl)
|
||||||
}
|
}
|
||||||
hir::ForeignItemKind::Static(ty, ..) => {
|
hir::ForeignItemKind::Static(ty, ..) => {
|
||||||
check_item_type(tcx, it.hir_id(), ty.span, true)
|
check_item_type(tcx, it.def_id, ty.span, true)
|
||||||
}
|
}
|
||||||
hir::ForeignItemKind::Type => (),
|
hir::ForeignItemKind::Type => (),
|
||||||
}
|
}
|
||||||
@ -199,7 +199,7 @@ pub fn check_trait_item(tcx: TyCtxt<'_>, def_id: LocalDefId) {
|
|||||||
_ => (None, trait_item.span),
|
_ => (None, trait_item.span),
|
||||||
};
|
};
|
||||||
check_object_unsafe_self_trait_by_name(tcx, trait_item);
|
check_object_unsafe_self_trait_by_name(tcx, trait_item);
|
||||||
check_associated_item(tcx, trait_item.hir_id(), span, method_sig);
|
check_associated_item(tcx, trait_item.def_id, span, method_sig);
|
||||||
|
|
||||||
let encl_trait_hir_id = tcx.hir().get_parent_item(hir_id);
|
let encl_trait_hir_id = tcx.hir().get_parent_item(hir_id);
|
||||||
let encl_trait = tcx.hir().expect_item(encl_trait_hir_id);
|
let encl_trait = tcx.hir().expect_item(encl_trait_hir_id);
|
||||||
@ -327,7 +327,7 @@ pub fn check_impl_item(tcx: TyCtxt<'_>, def_id: LocalDefId) {
|
|||||||
_ => (None, impl_item.span),
|
_ => (None, impl_item.span),
|
||||||
};
|
};
|
||||||
|
|
||||||
check_associated_item(tcx, impl_item.hir_id(), span, method_sig);
|
check_associated_item(tcx, impl_item.def_id, span, method_sig);
|
||||||
}
|
}
|
||||||
|
|
||||||
fn check_param_wf(tcx: TyCtxt<'_>, param: &hir::GenericParam<'_>) {
|
fn check_param_wf(tcx: TyCtxt<'_>, param: &hir::GenericParam<'_>) {
|
||||||
@ -437,13 +437,13 @@ fn check_param_wf(tcx: TyCtxt<'_>, param: &hir::GenericParam<'_>) {
|
|||||||
#[tracing::instrument(level = "debug", skip(tcx, span, sig_if_method))]
|
#[tracing::instrument(level = "debug", skip(tcx, span, sig_if_method))]
|
||||||
fn check_associated_item(
|
fn check_associated_item(
|
||||||
tcx: TyCtxt<'_>,
|
tcx: TyCtxt<'_>,
|
||||||
item_id: hir::HirId,
|
item_id: LocalDefId,
|
||||||
span: Span,
|
span: Span,
|
||||||
sig_if_method: Option<&hir::FnSig<'_>>,
|
sig_if_method: Option<&hir::FnSig<'_>>,
|
||||||
) {
|
) {
|
||||||
let code = ObligationCauseCode::WellFormed(Some(WellFormedLoc::Ty(item_id.expect_owner())));
|
let code = ObligationCauseCode::WellFormed(Some(WellFormedLoc::Ty(item_id)));
|
||||||
for_id(tcx, item_id, span).with_fcx(|fcx| {
|
for_id(tcx, item_id, span).with_fcx(|fcx| {
|
||||||
let item = fcx.tcx.associated_item(fcx.tcx.hir().local_def_id(item_id));
|
let item = fcx.tcx.associated_item(item_id);
|
||||||
|
|
||||||
let (mut implied_bounds, self_ty) = match item.container {
|
let (mut implied_bounds, self_ty) = match item.container {
|
||||||
ty::TraitContainer(_) => (FxHashSet::default(), fcx.tcx.types.self_param),
|
ty::TraitContainer(_) => (FxHashSet::default(), fcx.tcx.types.self_param),
|
||||||
@ -455,11 +455,7 @@ fn check_associated_item(
|
|||||||
match item.kind {
|
match item.kind {
|
||||||
ty::AssocKind::Const => {
|
ty::AssocKind::Const => {
|
||||||
let ty = fcx.tcx.type_of(item.def_id);
|
let ty = fcx.tcx.type_of(item.def_id);
|
||||||
let ty = fcx.normalize_associated_types_in_wf(
|
let ty = fcx.normalize_associated_types_in_wf(span, ty, WellFormedLoc::Ty(item_id));
|
||||||
span,
|
|
||||||
ty,
|
|
||||||
WellFormedLoc::Ty(item_id.expect_owner()),
|
|
||||||
);
|
|
||||||
fcx.register_wf_obligation(ty.into(), span, code.clone());
|
fcx.register_wf_obligation(ty.into(), span, code.clone());
|
||||||
}
|
}
|
||||||
ty::AssocKind::Fn => {
|
ty::AssocKind::Fn => {
|
||||||
@ -481,11 +477,8 @@ fn check_associated_item(
|
|||||||
}
|
}
|
||||||
if item.defaultness.has_value() {
|
if item.defaultness.has_value() {
|
||||||
let ty = fcx.tcx.type_of(item.def_id);
|
let ty = fcx.tcx.type_of(item.def_id);
|
||||||
let ty = fcx.normalize_associated_types_in_wf(
|
let ty =
|
||||||
span,
|
fcx.normalize_associated_types_in_wf(span, ty, WellFormedLoc::Ty(item_id));
|
||||||
ty,
|
|
||||||
WellFormedLoc::Ty(item_id.expect_owner()),
|
|
||||||
);
|
|
||||||
fcx.register_wf_obligation(ty.into(), span, code.clone());
|
fcx.register_wf_obligation(ty.into(), span, code.clone());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -496,14 +489,13 @@ fn check_associated_item(
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn for_item<'tcx>(tcx: TyCtxt<'tcx>, item: &hir::Item<'_>) -> CheckWfFcxBuilder<'tcx> {
|
fn for_item<'tcx>(tcx: TyCtxt<'tcx>, item: &hir::Item<'_>) -> CheckWfFcxBuilder<'tcx> {
|
||||||
for_id(tcx, item.hir_id(), item.span)
|
for_id(tcx, item.def_id, item.span)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn for_id(tcx: TyCtxt<'_>, id: hir::HirId, span: Span) -> CheckWfFcxBuilder<'_> {
|
fn for_id(tcx: TyCtxt<'_>, def_id: LocalDefId, span: Span) -> CheckWfFcxBuilder<'_> {
|
||||||
let def_id = tcx.hir().local_def_id(id);
|
|
||||||
CheckWfFcxBuilder {
|
CheckWfFcxBuilder {
|
||||||
inherited: Inherited::build(tcx, def_id),
|
inherited: Inherited::build(tcx, def_id),
|
||||||
id,
|
id: hir::HirId::make_owner(def_id),
|
||||||
span,
|
span,
|
||||||
param_env: tcx.param_env(def_id),
|
param_env: tcx.param_env(def_id),
|
||||||
}
|
}
|
||||||
@ -665,13 +657,12 @@ fn check_associated_type_bounds(fcx: &FnCtxt<'_, '_>, item: &ty::AssocItem, span
|
|||||||
|
|
||||||
fn check_item_fn(
|
fn check_item_fn(
|
||||||
tcx: TyCtxt<'_>,
|
tcx: TyCtxt<'_>,
|
||||||
item_id: hir::HirId,
|
def_id: LocalDefId,
|
||||||
ident: Ident,
|
ident: Ident,
|
||||||
span: Span,
|
span: Span,
|
||||||
decl: &hir::FnDecl<'_>,
|
decl: &hir::FnDecl<'_>,
|
||||||
) {
|
) {
|
||||||
for_id(tcx, item_id, span).with_fcx(|fcx| {
|
for_id(tcx, def_id, span).with_fcx(|fcx| {
|
||||||
let def_id = tcx.hir().local_def_id(item_id);
|
|
||||||
let sig = tcx.fn_sig(def_id);
|
let sig = tcx.fn_sig(def_id);
|
||||||
let mut implied_bounds = FxHashSet::default();
|
let mut implied_bounds = FxHashSet::default();
|
||||||
check_fn_or_method(fcx, ident.span, sig, decl, def_id.to_def_id(), &mut implied_bounds);
|
check_fn_or_method(fcx, ident.span, sig, decl, def_id.to_def_id(), &mut implied_bounds);
|
||||||
@ -679,16 +670,12 @@ fn check_item_fn(
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
fn check_item_type(tcx: TyCtxt<'_>, item_id: hir::HirId, ty_span: Span, allow_foreign_ty: bool) {
|
fn check_item_type(tcx: TyCtxt<'_>, item_id: LocalDefId, ty_span: Span, allow_foreign_ty: bool) {
|
||||||
debug!("check_item_type: {:?}", item_id);
|
debug!("check_item_type: {:?}", item_id);
|
||||||
|
|
||||||
for_id(tcx, item_id, ty_span).with_fcx(|fcx| {
|
for_id(tcx, item_id, ty_span).with_fcx(|fcx| {
|
||||||
let ty = tcx.type_of(tcx.hir().local_def_id(item_id));
|
let ty = tcx.type_of(item_id);
|
||||||
let item_ty = fcx.normalize_associated_types_in_wf(
|
let item_ty = fcx.normalize_associated_types_in_wf(ty_span, ty, WellFormedLoc::Ty(item_id));
|
||||||
ty_span,
|
|
||||||
ty,
|
|
||||||
WellFormedLoc::Ty(item_id.expect_owner()),
|
|
||||||
);
|
|
||||||
|
|
||||||
let mut forbid_unsized = true;
|
let mut forbid_unsized = true;
|
||||||
if allow_foreign_ty {
|
if allow_foreign_ty {
|
||||||
@ -701,7 +688,7 @@ fn check_item_type(tcx: TyCtxt<'_>, item_id: hir::HirId, ty_span: Span, allow_fo
|
|||||||
fcx.register_wf_obligation(
|
fcx.register_wf_obligation(
|
||||||
item_ty.into(),
|
item_ty.into(),
|
||||||
ty_span,
|
ty_span,
|
||||||
ObligationCauseCode::WellFormed(Some(WellFormedLoc::Ty(item_id.expect_owner()))),
|
ObligationCauseCode::WellFormed(Some(WellFormedLoc::Ty(item_id))),
|
||||||
);
|
);
|
||||||
if forbid_unsized {
|
if forbid_unsized {
|
||||||
fcx.register_bound(
|
fcx.register_bound(
|
||||||
|
@ -9,6 +9,7 @@ use rustc_span::Span;
|
|||||||
|
|
||||||
mod explicit;
|
mod explicit;
|
||||||
mod implicit_infer;
|
mod implicit_infer;
|
||||||
|
crate mod outlives_bounds;
|
||||||
/// Code to write unit test for outlives.
|
/// Code to write unit test for outlives.
|
||||||
pub mod test;
|
pub mod test;
|
||||||
mod utils;
|
mod utils;
|
||||||
|
@ -1,11 +1,11 @@
|
|||||||
use crate::infer::canonical::OriginalQueryValues;
|
|
||||||
use crate::infer::InferCtxt;
|
|
||||||
use crate::traits::query::NoSolution;
|
|
||||||
use crate::traits::{FulfillmentContext, ObligationCause, TraitEngine};
|
|
||||||
use rustc_hir as hir;
|
use rustc_hir as hir;
|
||||||
use rustc_infer::traits::TraitEngineExt as _;
|
use rustc_infer::traits::TraitEngineExt as _;
|
||||||
use rustc_middle::ty::{self, Ty};
|
use rustc_middle::ty::{self, Ty};
|
||||||
use rustc_span::source_map::Span;
|
use rustc_span::source_map::Span;
|
||||||
|
use rustc_trait_selection::infer::canonical::OriginalQueryValues;
|
||||||
|
use rustc_trait_selection::infer::InferCtxt;
|
||||||
|
use rustc_trait_selection::traits::query::NoSolution;
|
||||||
|
use rustc_trait_selection::traits::{FulfillmentContext, ObligationCause, TraitEngine};
|
||||||
|
|
||||||
pub use rustc_middle::traits::query::OutlivesBound;
|
pub use rustc_middle::traits::query::OutlivesBound;
|
||||||
|
|
@ -1,4 +1,4 @@
|
|||||||
use rustc_middle::ty::outlives::Component;
|
use rustc_infer::infer::outlives::components::{push_outlives_components, Component};
|
||||||
use rustc_middle::ty::subst::{GenericArg, GenericArgKind};
|
use rustc_middle::ty::subst::{GenericArg, GenericArgKind};
|
||||||
use rustc_middle::ty::{self, Region, RegionKind, Ty, TyCtxt};
|
use rustc_middle::ty::{self, Region, RegionKind, Ty, TyCtxt};
|
||||||
use rustc_span::Span;
|
use rustc_span::Span;
|
||||||
@ -35,7 +35,7 @@ pub fn insert_outlives_predicate<'tcx>(
|
|||||||
// Or if within `struct Foo<U>` you had `T = Vec<U>`, then
|
// Or if within `struct Foo<U>` you had `T = Vec<U>`, then
|
||||||
// we would want to add `U: 'outlived_region`
|
// we would want to add `U: 'outlived_region`
|
||||||
let mut components = smallvec![];
|
let mut components = smallvec![];
|
||||||
tcx.push_outlives_components(ty, &mut components);
|
push_outlives_components(tcx, ty, &mut components);
|
||||||
for component in components {
|
for component in components {
|
||||||
match component {
|
match component {
|
||||||
Component::Region(r) => {
|
Component::Region(r) => {
|
||||||
|
@ -189,7 +189,6 @@ mod boxed {
|
|||||||
pub mod borrow;
|
pub mod borrow;
|
||||||
pub mod collections;
|
pub mod collections;
|
||||||
pub mod fmt;
|
pub mod fmt;
|
||||||
pub mod prelude;
|
|
||||||
pub mod raw_vec;
|
pub mod raw_vec;
|
||||||
pub mod rc;
|
pub mod rc;
|
||||||
pub mod slice;
|
pub mod slice;
|
||||||
|
@ -1,15 +0,0 @@
|
|||||||
//! The alloc Prelude
|
|
||||||
//!
|
|
||||||
//! The purpose of this module is to alleviate imports of commonly-used
|
|
||||||
//! items of the `alloc` crate by adding a glob import to the top of modules:
|
|
||||||
//!
|
|
||||||
//! ```
|
|
||||||
//! # #![allow(unused_imports)]
|
|
||||||
//! #![feature(alloc_prelude)]
|
|
||||||
//! extern crate alloc;
|
|
||||||
//! use alloc::prelude::v1::*;
|
|
||||||
//! ```
|
|
||||||
|
|
||||||
#![unstable(feature = "alloc_prelude", issue = "58935")]
|
|
||||||
|
|
||||||
pub mod v1;
|
|
@ -1,14 +0,0 @@
|
|||||||
//! The first version of the prelude of `alloc` crate.
|
|
||||||
//!
|
|
||||||
//! See the [module-level documentation](../index.html) for more.
|
|
||||||
|
|
||||||
#![unstable(feature = "alloc_prelude", issue = "58935")]
|
|
||||||
|
|
||||||
#[unstable(feature = "alloc_prelude", issue = "58935")]
|
|
||||||
pub use crate::borrow::ToOwned;
|
|
||||||
#[unstable(feature = "alloc_prelude", issue = "58935")]
|
|
||||||
pub use crate::boxed::Box;
|
|
||||||
#[unstable(feature = "alloc_prelude", issue = "58935")]
|
|
||||||
pub use crate::string::{String, ToString};
|
|
||||||
#[unstable(feature = "alloc_prelude", issue = "58935")]
|
|
||||||
pub use crate::vec::Vec;
|
|
@ -44,7 +44,7 @@ use crate::intrinsics;
|
|||||||
/// ```
|
/// ```
|
||||||
#[inline]
|
#[inline]
|
||||||
#[stable(feature = "unreachable", since = "1.27.0")]
|
#[stable(feature = "unreachable", since = "1.27.0")]
|
||||||
#[rustc_const_unstable(feature = "const_unreachable_unchecked", issue = "53188")]
|
#[rustc_const_stable(feature = "const_unreachable_unchecked", since = "1.57.0")]
|
||||||
pub const unsafe fn unreachable_unchecked() -> ! {
|
pub const unsafe fn unreachable_unchecked() -> ! {
|
||||||
// SAFETY: the safety contract for `intrinsics::unreachable` must
|
// SAFETY: the safety contract for `intrinsics::unreachable` must
|
||||||
// be upheld by the caller.
|
// be upheld by the caller.
|
||||||
|
@ -735,7 +735,7 @@ extern "rust-intrinsic" {
|
|||||||
/// reach code marked with this function.
|
/// reach code marked with this function.
|
||||||
///
|
///
|
||||||
/// The stabilized version of this intrinsic is [`core::hint::unreachable_unchecked`].
|
/// The stabilized version of this intrinsic is [`core::hint::unreachable_unchecked`].
|
||||||
#[rustc_const_unstable(feature = "const_unreachable_unchecked", issue = "53188")]
|
#[rustc_const_stable(feature = "const_unreachable_unchecked", since = "1.57.0")]
|
||||||
pub fn unreachable() -> !;
|
pub fn unreachable() -> !;
|
||||||
|
|
||||||
/// Informs the optimizer that a condition is always true.
|
/// Informs the optimizer that a condition is always true.
|
||||||
|
@ -130,7 +130,6 @@
|
|||||||
#![feature(const_trait_impl)]
|
#![feature(const_trait_impl)]
|
||||||
#![feature(const_type_id)]
|
#![feature(const_type_id)]
|
||||||
#![feature(const_type_name)]
|
#![feature(const_type_name)]
|
||||||
#![feature(const_unreachable_unchecked)]
|
|
||||||
#![feature(const_default_impls)]
|
#![feature(const_default_impls)]
|
||||||
#![feature(duration_consts_2)]
|
#![feature(duration_consts_2)]
|
||||||
#![feature(ptr_metadata)]
|
#![feature(ptr_metadata)]
|
||||||
|
@ -62,7 +62,7 @@
|
|||||||
//! some atomic operations. Maximally portable code will want to be careful
|
//! some atomic operations. Maximally portable code will want to be careful
|
||||||
//! about which atomic types are used. `AtomicUsize` and `AtomicIsize` are
|
//! about which atomic types are used. `AtomicUsize` and `AtomicIsize` are
|
||||||
//! generally the most portable, but even then they're not available everywhere.
|
//! generally the most portable, but even then they're not available everywhere.
|
||||||
//! For reference, the `std` library requires pointer-sized atomics, although
|
//! For reference, the `std` library requires `AtomicBool`s and pointer-sized atomics, although
|
||||||
//! `core` does not.
|
//! `core` does not.
|
||||||
//!
|
//!
|
||||||
//! Currently you'll need to use `#[cfg(target_arch)]` primarily to
|
//! Currently you'll need to use `#[cfg(target_arch)]` primarily to
|
||||||
|
@ -25,9 +25,12 @@ pub const ZX_TASK_TERMINATED: zx_signals_t = ZX_OBJECT_SIGNAL_3;
|
|||||||
|
|
||||||
pub const ZX_RIGHT_SAME_RIGHTS: zx_rights_t = 1 << 31;
|
pub const ZX_RIGHT_SAME_RIGHTS: zx_rights_t = 1 << 31;
|
||||||
|
|
||||||
|
// The upper four bits gives the minor version.
|
||||||
pub type zx_object_info_topic_t = u32;
|
pub type zx_object_info_topic_t = u32;
|
||||||
|
|
||||||
pub const ZX_INFO_PROCESS: zx_object_info_topic_t = 3;
|
pub const ZX_INFO_PROCESS: zx_object_info_topic_t = 3 | (1 << 28);
|
||||||
|
|
||||||
|
pub type zx_info_process_flags_t = u32;
|
||||||
|
|
||||||
pub fn zx_cvt<T>(t: T) -> io::Result<T>
|
pub fn zx_cvt<T>(t: T) -> io::Result<T>
|
||||||
where
|
where
|
||||||
@ -68,9 +71,9 @@ impl Drop for Handle {
|
|||||||
#[repr(C)]
|
#[repr(C)]
|
||||||
pub struct zx_info_process_t {
|
pub struct zx_info_process_t {
|
||||||
pub return_code: i64,
|
pub return_code: i64,
|
||||||
pub started: bool,
|
pub start_time: zx_time_t,
|
||||||
pub exited: bool,
|
pub flags: zx_info_process_flags_t,
|
||||||
pub debugger_attached: bool,
|
pub reserved1: u32,
|
||||||
}
|
}
|
||||||
|
|
||||||
extern "C" {
|
extern "C" {
|
||||||
|
@ -255,7 +255,7 @@ impl<'tcx> FormatRenderer<'tcx> for JsonRenderer<'tcx> {
|
|||||||
)
|
)
|
||||||
})
|
})
|
||||||
.collect(),
|
.collect(),
|
||||||
format_version: 9,
|
format_version: types::FORMAT_VERSION,
|
||||||
};
|
};
|
||||||
let mut p = self.out_path.clone();
|
let mut p = self.out_path.clone();
|
||||||
p.push(output.index.get(&output.root).unwrap().name.clone().unwrap());
|
p.push(output.index.get(&output.root).unwrap().name.clone().unwrap());
|
||||||
|
@ -510,5 +510,8 @@ pub struct Static {
|
|||||||
pub expr: String,
|
pub expr: String,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// rustdoc format-version.
|
||||||
|
pub const FORMAT_VERSION: u32 = 9;
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests;
|
mod tests;
|
||||||
|
@ -4,6 +4,7 @@
|
|||||||
// compile-flags: --target aarch64-unknown-linux-gnu
|
// compile-flags: --target aarch64-unknown-linux-gnu
|
||||||
// needs-llvm-components: aarch64
|
// needs-llvm-components: aarch64
|
||||||
// only-aarch64
|
// only-aarch64
|
||||||
|
// only-linux
|
||||||
|
|
||||||
#![crate_type = "rlib"]
|
#![crate_type = "rlib"]
|
||||||
|
|
||||||
|
@ -1,7 +1,5 @@
|
|||||||
// run-pass
|
// run-pass
|
||||||
|
|
||||||
#![feature(const_unreachable_unchecked)]
|
|
||||||
|
|
||||||
const unsafe fn foo(x: bool) -> bool {
|
const unsafe fn foo(x: bool) -> bool {
|
||||||
match x {
|
match x {
|
||||||
true => true,
|
true => true,
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
// error-pattern: evaluation of constant value failed
|
// error-pattern: evaluation of constant value failed
|
||||||
#![feature(const_unreachable_unchecked)]
|
|
||||||
|
|
||||||
const unsafe fn foo(x: bool) -> bool {
|
const unsafe fn foo(x: bool) -> bool {
|
||||||
match x {
|
match x {
|
||||||
|
@ -7,13 +7,13 @@ LL | unsafe { intrinsics::unreachable() }
|
|||||||
| entering unreachable code
|
| entering unreachable code
|
||||||
| inside `unreachable_unchecked` at $SRC_DIR/core/src/hint.rs:LL:COL
|
| inside `unreachable_unchecked` at $SRC_DIR/core/src/hint.rs:LL:COL
|
||||||
|
|
|
|
||||||
::: $DIR/const_unsafe_unreachable_ub.rs:7:18
|
::: $DIR/const_unsafe_unreachable_ub.rs:6:18
|
||||||
|
|
|
|
||||||
LL | false => std::hint::unreachable_unchecked(),
|
LL | false => std::hint::unreachable_unchecked(),
|
||||||
| ---------------------------------- inside `foo` at $DIR/const_unsafe_unreachable_ub.rs:7:18
|
| ---------------------------------- inside `foo` at $DIR/const_unsafe_unreachable_ub.rs:6:18
|
||||||
...
|
...
|
||||||
LL | const BAR: bool = unsafe { foo(false) };
|
LL | const BAR: bool = unsafe { foo(false) };
|
||||||
| ---------- inside `BAR` at $DIR/const_unsafe_unreachable_ub.rs:11:28
|
| ---------- inside `BAR` at $DIR/const_unsafe_unreachable_ub.rs:10:28
|
||||||
|
|
||||||
error: aborting due to previous error
|
error: aborting due to previous error
|
||||||
|
|
||||||
|
@ -0,0 +1,10 @@
|
|||||||
|
// check-pass
|
||||||
|
|
||||||
|
trait X {
|
||||||
|
fn test(x: u32, (
|
||||||
|
//~^ WARN anonymous parameters are deprecated and will be removed in the next edition
|
||||||
|
//~^^ WARN this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2018!
|
||||||
|
)) {}
|
||||||
|
}
|
||||||
|
|
||||||
|
fn main() {}
|
@ -0,0 +1,23 @@
|
|||||||
|
warning: anonymous parameters are deprecated and will be removed in the next edition
|
||||||
|
--> $DIR/issue-89280-emitter-overflow-splice-lines.rs:4:21
|
||||||
|
|
|
||||||
|
LL | fn test(x: u32, (
|
||||||
|
| _____________________^
|
||||||
|
LL | |
|
||||||
|
LL | |
|
||||||
|
LL | | )) {}
|
||||||
|
| |_____^
|
||||||
|
|
|
||||||
|
= note: `#[warn(anonymous_parameters)]` on by default
|
||||||
|
= warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2018!
|
||||||
|
= note: for more information, see issue #41686 <https://github.com/rust-lang/rust/issues/41686>
|
||||||
|
help: try naming the parameter or explicitly ignoring it
|
||||||
|
|
|
||||||
|
LL ~ fn test(x: u32, _: (
|
||||||
|
LL +
|
||||||
|
LL +
|
||||||
|
LL ~ )) {}
|
||||||
|
|
|
||||||
|
|
||||||
|
warning: 1 warning emitted
|
||||||
|
|
@ -13,7 +13,7 @@ struct Fooy<T>(T);
|
|||||||
|
|
||||||
impl<T> Foo for Fooy<T> {
|
impl<T> Foo for Fooy<T> {
|
||||||
type A<'a> where Self: 'static = (&'a ());
|
type A<'a> where Self: 'static = (&'a ());
|
||||||
//~^ ERROR the parameter type `T` may not live long enough
|
//~^ ERROR `impl` associated type
|
||||||
type B<'a, 'b> where 'b: 'a = (&'a(), &'b ());
|
type B<'a, 'b> where 'b: 'a = (&'a(), &'b ());
|
||||||
//~^ ERROR `impl` associated type
|
//~^ ERROR `impl` associated type
|
||||||
//~| ERROR lifetime bound not satisfied
|
//~| ERROR lifetime bound not satisfied
|
||||||
|
@ -1,11 +1,11 @@
|
|||||||
error[E0310]: the parameter type `T` may not live long enough
|
error: `impl` associated type signature for `A` doesn't match `trait` associated type signature
|
||||||
--> $DIR/impl_bounds.rs:15:5
|
--> $DIR/impl_bounds.rs:15:5
|
||||||
|
|
|
|
||||||
|
LL | type A<'a> where Self: 'a;
|
||||||
|
| -------------------------- expected
|
||||||
|
...
|
||||||
LL | type A<'a> where Self: 'static = (&'a ());
|
LL | type A<'a> where Self: 'static = (&'a ());
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ found
|
||||||
|
|
|
||||||
= help: consider adding an explicit lifetime bound `T: 'static`...
|
|
||||||
= note: ...so that the definition in impl matches the definition from the trait
|
|
||||||
|
|
||||||
error: `impl` associated type signature for `B` doesn't match `trait` associated type signature
|
error: `impl` associated type signature for `B` doesn't match `trait` associated type signature
|
||||||
--> $DIR/impl_bounds.rs:17:5
|
--> $DIR/impl_bounds.rs:17:5
|
||||||
@ -85,5 +85,5 @@ LL | impl<T: std::marker::Copy> Foo for Fooy<T> {
|
|||||||
|
|
||||||
error: aborting due to 5 previous errors
|
error: aborting due to 5 previous errors
|
||||||
|
|
||||||
Some errors have detailed explanations: E0277, E0310, E0478.
|
Some errors have detailed explanations: E0277, E0478.
|
||||||
For more information about an error, try `rustc --explain E0277`.
|
For more information about an error, try `rustc --explain E0277`.
|
||||||
|
@ -21,8 +21,8 @@ where
|
|||||||
{
|
{
|
||||||
type T = Either<Left::T, Right::T>;
|
type T = Either<Left::T, Right::T>;
|
||||||
type TRef<'a>
|
type TRef<'a>
|
||||||
//~^ the associated type
|
//~^ `impl` associated type signature
|
||||||
//~^^ the associated type
|
//~^^ `impl` associated type signature
|
||||||
where
|
where
|
||||||
<Left as HasChildrenOf>::T: 'a,
|
<Left as HasChildrenOf>::T: 'a,
|
||||||
<Right as HasChildrenOf>::T: 'a
|
<Right as HasChildrenOf>::T: 'a
|
||||||
|
@ -1,29 +1,32 @@
|
|||||||
error[E0309]: the associated type `<Left as HasChildrenOf>::T` may not live long enough
|
error: `impl` associated type signature for `TRef` doesn't match `trait` associated type signature
|
||||||
--> $DIR/issue-86787.rs:23:5
|
--> $DIR/issue-86787.rs:23:5
|
||||||
|
|
|
|
||||||
|
LL | type TRef<'a>;
|
||||||
|
| -------------- expected
|
||||||
|
...
|
||||||
LL | / type TRef<'a>
|
LL | / type TRef<'a>
|
||||||
LL | |
|
LL | |
|
||||||
LL | |
|
LL | |
|
||||||
LL | | where
|
LL | | where
|
||||||
LL | | <Left as HasChildrenOf>::T: 'a,
|
LL | | <Left as HasChildrenOf>::T: 'a,
|
||||||
LL | | <Right as HasChildrenOf>::T: 'a
|
LL | | <Right as HasChildrenOf>::T: 'a
|
||||||
| | - help: consider adding a where clause: `, <Left as HasChildrenOf>::T: 'a`
|
|
||||||
LL | | = Either<&'a Left::T, &'a Right::T>;
|
LL | | = Either<&'a Left::T, &'a Right::T>;
|
||||||
| |________________________________________^ ...so that the definition in impl matches the definition from the trait
|
| |________________________________________^ found
|
||||||
|
|
||||||
error[E0309]: the associated type `<Right as HasChildrenOf>::T` may not live long enough
|
error: `impl` associated type signature for `TRef` doesn't match `trait` associated type signature
|
||||||
--> $DIR/issue-86787.rs:23:5
|
--> $DIR/issue-86787.rs:23:5
|
||||||
|
|
|
|
||||||
|
LL | type TRef<'a>;
|
||||||
|
| -------------- expected
|
||||||
|
...
|
||||||
LL | / type TRef<'a>
|
LL | / type TRef<'a>
|
||||||
LL | |
|
LL | |
|
||||||
LL | |
|
LL | |
|
||||||
LL | | where
|
LL | | where
|
||||||
LL | | <Left as HasChildrenOf>::T: 'a,
|
LL | | <Left as HasChildrenOf>::T: 'a,
|
||||||
LL | | <Right as HasChildrenOf>::T: 'a
|
LL | | <Right as HasChildrenOf>::T: 'a
|
||||||
| | - help: consider adding a where clause: `, <Right as HasChildrenOf>::T: 'a`
|
|
||||||
LL | | = Either<&'a Left::T, &'a Right::T>;
|
LL | | = Either<&'a Left::T, &'a Right::T>;
|
||||||
| |________________________________________^ ...so that the definition in impl matches the definition from the trait
|
| |________________________________________^ found
|
||||||
|
|
||||||
error: aborting due to 2 previous errors
|
error: aborting due to 2 previous errors
|
||||||
|
|
||||||
For more information about this error, try `rustc --explain E0309`.
|
|
||||||
|
39
src/test/ui/generic-associated-types/issue-88287.rs
Normal file
39
src/test/ui/generic-associated-types/issue-88287.rs
Normal file
@ -0,0 +1,39 @@
|
|||||||
|
// check-pass
|
||||||
|
// edition:2018
|
||||||
|
|
||||||
|
#![feature(generic_associated_types)]
|
||||||
|
#![feature(type_alias_impl_trait)]
|
||||||
|
|
||||||
|
use std::future::Future;
|
||||||
|
|
||||||
|
trait SearchableResource<Criteria> {
|
||||||
|
type SearchResult;
|
||||||
|
}
|
||||||
|
|
||||||
|
trait SearchableResourceExt<Criteria>: SearchableResource<Criteria> {
|
||||||
|
type Future<'f, A: 'f + ?Sized, B: 'f>: Future<Output = Result<Vec<A::SearchResult>, ()>> + 'f
|
||||||
|
where
|
||||||
|
A: SearchableResource<B>;
|
||||||
|
|
||||||
|
fn search<'c>(&'c self, client: &'c ()) -> Self::Future<'c, Self, Criteria>;
|
||||||
|
}
|
||||||
|
|
||||||
|
type SearchFutureTy<'f, A, B: 'f>
|
||||||
|
where
|
||||||
|
A: SearchableResource<B> + ?Sized + 'f,
|
||||||
|
= impl Future<Output = Result<Vec<A::SearchResult>, ()>> + 'f;
|
||||||
|
impl<T, Criteria> SearchableResourceExt<Criteria> for T
|
||||||
|
where
|
||||||
|
T: SearchableResource<Criteria>,
|
||||||
|
{
|
||||||
|
type Future<'f, A, B: 'f>
|
||||||
|
where
|
||||||
|
A: SearchableResource<B> + ?Sized + 'f,
|
||||||
|
= SearchFutureTy<'f, A, B>;
|
||||||
|
|
||||||
|
fn search<'c>(&'c self, _client: &'c ()) -> Self::Future<'c, Self, Criteria> {
|
||||||
|
async move { todo!() }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fn main() {}
|
16
src/test/ui/generic-associated-types/issue-88405.rs
Normal file
16
src/test/ui/generic-associated-types/issue-88405.rs
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
// check-pass
|
||||||
|
|
||||||
|
#![feature(generic_associated_types)]
|
||||||
|
|
||||||
|
trait SomeTrait {}
|
||||||
|
trait OtherTrait {
|
||||||
|
type Item;
|
||||||
|
}
|
||||||
|
|
||||||
|
trait ErrorSimpleExample {
|
||||||
|
type AssociatedType: SomeTrait;
|
||||||
|
type GatBounded<T: SomeTrait>;
|
||||||
|
type ErrorMinimal: OtherTrait<Item = Self::GatBounded<Self::AssociatedType>>;
|
||||||
|
}
|
||||||
|
|
||||||
|
fn main() {}
|
Loading…
Reference in New Issue
Block a user