Skip to content
Merged
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
10 changes: 5 additions & 5 deletions compiler/rustc_resolve/src/late.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3912,13 +3912,13 @@ impl<'a, 'ast, 'ra, 'tcx> LateResolutionVisitor<'a, 'ast, 'ra, 'tcx> {
PathSource::Delegation,
);

if let Some(qself) = &delegation.qself {
self.visit_ty(&qself.ty);
}

// Create lifetimes not with `LifetimeRibKind::Generics` but with `LifetimeRibKind::Elided`,
// as we are not processing generic params but generic args in a future function call (#156342).
// as we are not processing generic params but generic args in a future call (#156342, #156758).
self.with_lifetime_rib(LifetimeRibKind::Elided(LifetimeRes::Infer), |this| {
if let Some(qself) = &delegation.qself {
this.visit_ty(&qself.ty);
}

this.visit_path(&delegation.path);
});

Expand Down
16 changes: 16 additions & 0 deletions library/core/src/fmt/num_buffer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,22 @@ impl_NumBufferTrait! {

/// A buffer wrapper of which the internal size is based on the maximum
/// number of digits the associated integer can have.
///
/// # Examples
///
/// ```
/// #![feature(int_format_into)]
/// use core::fmt::NumBuffer;
///
/// let mut buf = NumBuffer::new();
/// let n1 = 1972u32;
/// assert_eq!(n1.format_into(&mut buf), "1972");
///
/// // Formatting a negative integer includes the sign.
/// let mut buf = NumBuffer::new();
/// let n2 = -1972i32;
/// assert_eq!(n2.format_into(&mut buf), "-1972");
/// ```
#[unstable(feature = "int_format_into", issue = "138215")]
pub struct NumBuffer<T: NumBufferTrait> {
// FIXME: Once const generics feature is working, use `T::BUF_SIZE` instead of 40.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
//! Regression test for <https://github.com/rust-lang/rust/issues/31299>
//@ run-pass
// Regression test for #31299. This was generating an overflow error
// because of eager normalization:
// This was generating an overflow error because of eager normalization:
//
// proving `M: Sized` requires
// - proving `PtrBack<Vec<M>>: Sized` requires
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
//! Regression test for <https://github.com/rust-lang/rust/issues/27997>
//@ run-pass
use std::sync::atomic::{Ordering, AtomicUsize};

Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
//! Regression test for <https://github.com/rust-lang/rust/issues/35815>
//@ run-pass
#![allow(dead_code)]
use std::mem;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
//! Regression test for <https://github.com/rust-lang/rust/issues/47486>
fn main() {
() < std::mem::size_of::<_>(); //~ ERROR: mismatched types
[0u8; std::mem::size_of::<_>()]; //~ ERROR: type annotations needed
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
error[E0308]: mismatched types
--> $DIR/issue-47486.rs:2:10
--> $DIR/size_of-requires-type-annotation-in-const.rs:3:10
|
LL | () < std::mem::size_of::<_>();
| -- ^^^^^^^^^^^^^^^^^^^^^^^^ expected `()`, found `usize`
| |
| expected because this is `()`

error[E0282]: type annotations needed
--> $DIR/issue-47486.rs:3:11
--> $DIR/size_of-requires-type-annotation-in-const.rs:4:11
|
LL | [0u8; std::mem::size_of::<_>()];
| ^^^^^^^^^^^^^^^^^^^^^^ cannot infer type of the type parameter `T` declared on the function `size_of`
Expand Down
17 changes: 0 additions & 17 deletions tests/ui/delegation/wrong-lifetime-rib-ice-156342.rs

This file was deleted.

19 changes: 0 additions & 19 deletions tests/ui/delegation/wrong-lifetime-rib-ice-156342.stderr

This file was deleted.

32 changes: 32 additions & 0 deletions tests/ui/delegation/wrong-lifetime-rib.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
//@ edition:2024

#![feature(fn_delegation)]
#![feature(type_info)]

mod ice_156342 {
use std::mem::type_info::Trait;

impl Trait {
//~^ ERROR: cannot define inherent `impl` for a type outside of the crate where the type is defined
reuse None::<&()>;
//~^ ERROR: expected function, found unit variant `None`
}

fn foo<T>() {}

reuse foo::<&&&&&&&&&&()> as foo1;
reuse foo::<&std::borrow::Cow<'_, &()>> as foo2;
}

mod ice_156758 {
trait X {}
type Project = ();
type Ty = ();

impl X { //~ ERROR: expected a type, found a trait
reuse<<<&Project> :: Ty> :: Ty as Iterator>::next;
//~^ ERROR: ambiguous associated type
}
}

fn main() {}
46 changes: 46 additions & 0 deletions tests/ui/delegation/wrong-lifetime-rib.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
error[E0423]: expected function, found unit variant `None`
--> $DIR/wrong-lifetime-rib.rs:11:15
|
LL | reuse None::<&()>;
| ^^^^^^^^^^^ not a function

error[E0782]: expected a type, found a trait
--> $DIR/wrong-lifetime-rib.rs:26:10
|
LL | impl X {
| ^
|
help: you can add the `dyn` keyword if you want a trait object
|
LL | impl dyn X {
| +++
help: you might have intended to implement this trait for a given type
|
LL | impl X for /* Type */ {
| ++++++++++++++

error[E0116]: cannot define inherent `impl` for a type outside of the crate where the type is defined
--> $DIR/wrong-lifetime-rib.rs:9:5
|
LL | impl Trait {
| ^^^^^^^^^^ impl for type defined outside of crate
|
= help: consider defining a trait and implementing it for the type or using a newtype wrapper like `struct MyType(ExternalType);` and implement it
= note: for more details about the orphan rules, see <https://doc.rust-lang.org/reference/items/implementations.html?highlight=orphan#orphan-rules>

error[E0223]: ambiguous associated type
--> $DIR/wrong-lifetime-rib.rs:27:16
|
LL | reuse<<<&Project> :: Ty> :: Ty as Iterator>::next;
| ^^^^^^^^^^^^^^^^
|
help: if there were a trait named `Example` with associated type `Ty` implemented for `&()`, you could use the fully-qualified path
|
LL - reuse<<<&Project> :: Ty> :: Ty as Iterator>::next;
LL + reuse<<<&() as Example>::Ty> :: Ty as Iterator>::next;
|

error: aborting due to 4 previous errors

Some errors have detailed explanations: E0116, E0223, E0423, E0782.
For more information about an error, try `rustc --explain E0116`.
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
//! Regression test for <https://github.com/rust-lang/rust/issues/46855>
//@ run-pass
#![allow(dead_code)]
//@ compile-flags: -Zmir-opt-level=1
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
//! Regression test for <https://github.com/rust-lang/rust/issues/50811>
//@ run-pass
#![feature(test)]
#![allow(invalid_nan_comparisons)]
Expand Down
Loading