Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rustc infer doctest #106523

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion compiler/rustc_infer/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ version = "0.0.0"
edition = "2021"

[lib]
doctest = false


[dependencies]
tracing = "0.1"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,14 @@ pub enum TypeAnnotationNeeded {
E0282,
/// An implementation cannot be chosen unambiguously because of lack of information.
/// ```compile_fail,E0283
/// let _ = Default::default();
/// struct Foo;
///
/// impl Into<u32> for Foo {
/// fn into(self) -> u32 { 1 }
/// }
///
/// let foo = Foo;
/// let bar: u32 = foo.into() * 1u32;
/// ```
E0283,
/// ```compile_fail,E0284
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ impl<'a, 'tcx> NiceRegionError<'a, 'tcx> {
///
/// Consider a case where we have
///
/// ```compile_fail,E0623
/// ```compile_fail,(E0623)
/// fn foo(x: &mut Vec<&u8>, y: &u8) {
/// x.push(y);
/// }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ use rustc_middle::ty::{self, Region, TyCtxt};
/// br - the bound region corresponding to the above region which is of type `BrAnon(_)`
///
/// # Example
/// ```compile_fail,E0623
/// ```compile_fail,(E0623)
/// fn foo(x: &mut Vec<&u8>, y: &u8)
/// { x.push(y); }
/// ```
Expand Down
8 changes: 5 additions & 3 deletions compiler/rustc_infer/src/infer/outlives/test_type_match.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,11 @@ use crate::infer::region_constraints::VerifyIfEq;

/// Given a "verify-if-eq" type test like:
///
/// exists<'a...> {
/// verify_if_eq(some_type, bound_region)
/// }
/// ```ignore (pseudo-rust)
/// exists<'a...> {
/// verify_if_eq(some_type, bound_region)
/// }
/// ```
///
/// and the type `test_ty` that the type test is being tested against,
/// returns:
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_infer/src/infer/outlives/verify.rs
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,7 @@ impl<'cx, 'tcx> VerifyBoundCx<'cx, 'tcx> {
///
/// It will not, however, work for higher-ranked bounds like:
///
/// ```compile_fail,E0311
/// ```
/// trait Foo<'a, 'b>
/// where for<'x> <Self as Foo<'x, 'b>>::Bar: 'x
Comment on lines 289 to 293
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The docs say that this shouldn't compile, so there's something wrong here.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you need any help with figuring this out, feel free to open a thread in the t-compiler/help stream on zulip

/// {
Expand Down
4 changes: 2 additions & 2 deletions compiler/rustc_infer/src/infer/region_constraints/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,7 @@ pub enum VerifyBound<'tcx> {
/// and supplies a bound if it ended up being relevant. It's used in situations
/// like this:
///
/// ```rust
/// ```ignore (pseudo-rust)
/// fn foo<'a, 'b, T: SomeTrait<'a>>
/// where
/// <T as SomeTrait<'a>>::Item: 'b
Expand All @@ -255,7 +255,7 @@ pub enum VerifyBound<'tcx> {
/// In the [`VerifyBound`], this struct is enclosed in `Binder to account
/// for cases like
///
/// ```rust
/// ```ignore (pseudo-rust)
/// where for<'a> <T as SomeTrait<'a>::Item: 'a
/// ```
///
Expand Down