type Target = Self; fn deref(&self) -> &Self::Target { self } } impl PartialEq<&'static str> for S { fn eq(&self, _other: &&'static str) -> bool { false } } // Do not crash while checking if S implements `.is_empty()` S == "" }42 changes: 24 additions & 18 delet...
use std::ops::Index; pub trait Indexable { type Index; } struct Foo; struct Bar; impl Indexable for Foo { type Index = u8; } impl Indexable for Bar { type Index = u16; } pub trait Indexer<T: Indexable>: Index<T::Index, Output=T> {} struct Store; impl Index<u8> for Store {...
compiler/rustc_trait_selection/src/traits/wf.rsOutdatedShow resolvedHide resolved compiler-errorsaddedS-waiting-on-authorStatus: This is awaiting some action (such as code changes or more information) from the author.and removedS-waiting-on-reviewStatus: Awaiting review from the assignee but also ...
Expose a Valid trait to check if rust geo-types geometries are valid.Valid trait has the following signature:trait Valid { fn is_valid(&self) -> bool; fn explain_invalidity(&self) -> Option<ProblemReport>; }The result of the invalidity reason is provided in a ProblemReport struct (it ...
// that the components of this type are also `~const Destruct`. This // amounts to verifying that there are no values in this ADT that may have // a non-const drop. if cx.tcx.features().const_trait_impl() { let destruct_def_id = cx.tcx.require_lang_item(LangItem::Destruct, ...
// Trait methods are always accessible if the trait is in scope. ty::TraitContainer(_) => {} // Trait methods are always all public. The only controlling factor // is whether the trait itself is accessible or not. ty::TraitContainer(trait_def_id) => { self.report_error(self.ensure...
if !tcx.has_attr(def_id, sym::rustc_mir) { debug!("skipping rustc_peek::SanityCheck on {}", tcx.def_path_str(def_id)); return; } else { debug!("running rustc_peek::SanityCheck on {}", tcx.def_path_str(def_id)); } pub fn sanity_check<'tcx>(tcx: TyCtxt<'tcx>, body...
In Rust, heap allocators are described by the [`GlobalAlloc`] trait, which is mentioned in the error message. To set the heap allocator for the crate, the `#[global_allocator]` attribute must be applied to a `static` variable that implements the `GlobalAlloc` trait. The first error ...
To be able to call `create_example_mapping` we need to create a type that implements the `FrameAllocator` trait first. As noted above, the trait is responsible for allocating frames for new page table if they are needed by `map_to`. To be able to call `create_example_mapping`, we ...
Revert "Remove unnecessary trait accessibility check."… cb0ce69 This reverts commitf4f95eb. rust-highfiveassignednrcOct 26, 2015 alexcrichtonmentioned this pull requestOct 26, 2015 nrcreviewedOct 26, 2015 View reviewed changes src/test/compile-fail/privacy-ufcs.rs ...