| Age | Commit message (Collapse) | Author | Lines |
|
Don't ICE on missing `Unsize` impl
Previously code of the form
```rust
#![feature(unsize, dispatch_from_dyn)]
use std::marker::Unsize;
use std::ops::DispatchFromDyn;
pub struct Foo<'a, T: ?Sized> {
_inner: &'a &'a T,
}
impl<'a, T: ?Sized + Unsize<U>, U: ?Sized> DispatchFromDyn<Foo<'a, U>> for Foo<'a, T> {}
```
would generate an ICE due to the missing `Unsize` impl being run through the `suggest_change_mut` suggestion. This PR adds an early exit and a pointer to the appropriate docs regarding `Unsize` instead:
```
error[E0277]: the trait bound `&'a T: std::marker::Unsize<&'a U>` is not satisfied
--> src/test/ui/issues/issue-71036.rs:11:1
|
11 | impl<'a, T: ?Sized + Unsize<U>, U: ?Sized> DispatchFromDyn<Foo<'a, U>> for Foo<'a, T> {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `std::marker::Unsize<&'a U>` is not implemented for `&'a T`
|
= note: all implementations of `Unsize` are provided automatically by the compiler, see <https://doc.rust-lang.org/stable/std/marker/trait.Unsize.html> for more information
= note: required because of the requirements on the impl of `std::ops::DispatchFromDyn<&'a &'a U>` for `&'a &'a T`
error: aborting due to previous error
For more information about this error, try `rustc --explain E0277`.
```
r? @estebank
Resolves #71036
|
|
r=petrochenkov
add long error explanation for E0228
Add long explanation for the E0228 error code
Part of #61137
Let me know if this is wrong at all (or can be written more clearly), I'm still learning Rust.
|
|
Fix hang in lexical_region_resolve
Regionck was stuck in a loop where a region value was changing between two equal regions.
Closes #72051
|
|
Fix unused_parens false positive when using binary operations
Fixes #71290
r? @cuviper who provided instructions
|
|
|
|
Pointer printing: do not print 0 offset
r? @eddyb Cc @oli-obk
|
|
Suggest adding super trait constraints
|
|
Process termination test for SGX
The issue is described in https://github.com/fortanix/rust-sgx/issues/109
cc @jethrogb
|
|
|
|
|
|
- Make the bound restriction suggestion `span_suggestion_verbose`.
- Fix whitespace typo.
|
|
|
|
|
|
|
|
Emit a warning when optimization fuel runs out
`eprintln!` gets swallowed by Cargo too easily.
|
|
display `ConstKind::Param`
|
|
Fix debug assertion in error code
Closes #70813
|
|
|
|
`eprintln!` gets swallowed by Cargo too easily.
|
|
Enable `cfg` predicate for `target_feature = "crt-static"` only if the target supports it
That's what all other `target_feature`s do.
|
|
Fix ICE for broken or-pattern in async fn
closes #71297
|
|
|
|
Move tests from `test/run-fail` to UI
Fixes #65440
cc #65865 #65506
r? @nikomatsakis
|
|
upgrade chalk and use chalk-solve/chalk-ir/chalk-rust-ir
Reintegrate chalk into rustc.
r? @nikomatsakis
cc. @rust-lang/wg-traits
|
|
Dead-code pass highlights too much of impl functions
Fixes #66627.
Previous diagnostic:
```
error: method is never used: `unused_impl_fn_3`
--> src/main.rs:28:5
|
28 | / fn unused_impl_fn_3(
29 | | var: i32,
30 | | ) {
31 | | println!("bar {}", var);
32 | | }
| |_____^
```
New diagnostic:
```
error: associated function is never used: `unused_impl_fn_3`
--> $DIR/lint-dead-code-6.rs:13:8
|
LL | fn unused_impl_fn_3(
| ^^^^^^^^^^^^^^^^
```
This makes associated functions in line with free-standing functions.
|
|
Make BTreeMap::new and BTreeSet::new const
|
|
Test for zero-sized function items not ICEing
Closes #30276.
Again.
Please give rustcake with no icing!
|
|
|
|
Add const-generics test
Taken from #71973 as this apparently already compiles.
r? @varkor
|
|
|
|
|
|
|
|
Fix E0284 to not use incorrect wording
Fix #71584, fix #69683.
|
|
reword "possible candidate" import suggestion
This suggestion has always read a bit awkwardly to me, particularly the "possible better candidate" variant.
This commit rewords the suggestion to be more concise and mention the kind of the suggested item. There isn't a nice way to label individual suggestions, so I opted to use "items" in the case of multiple suggestions.
|
|
Detect errors caused by `async` block in 2015 edition
Fix #67204.
|
|
Fix #71584, fix #69683.
|
|
use hex for pointers in Miri error messages
Also refine vtable error message: distinguish between "drop fn does not point to a function" and "drop fn points to a function with the wrong signature".
|
|
Add some regression tests
Closes #29988
Closes #34979
Pick up two snippets that have been fixed from #67945 (shouldn't be closed yet!)
|
|
|
|
|
|
|
|
|
|
Miri validation error handling cleanup
Slightly expand @jumbatm's pattern macro and use it throughout validation. This ensures we never incorrectly swallow `InvalidProgram` errors or ICE when they occur.
Fixes https://github.com/rust-lang/rust/issues/71353
r? @oli-obk
|
|
Provide suggestions for type parameters missing bounds for associated types
When implementing the binary operator traits it is easy to forget to restrict the `Output` associated type. `rustc` now accounts for different cases to lead users in the right direction to add the necessary restrictions. The structured suggestions in the following output are new:
```
error: equality constraints are not yet supported in `where` clauses
--> $DIR/missing-bounds.rs:37:33
|
LL | impl<B: Add> Add for E<B> where <B as Add>::Output = B {
| ^^^^^^^^^^^^^^^^^^^^^^ not supported
|
= note: see issue #20041 <https://github.com/rust-lang/rust/issues/20041> for more information
help: if `Output` is an associated type you're trying to set, use the associated type binding syntax
|
LL | impl<B: Add> Add for E<B> where B: Add<Output = B> {
| ^^^^^^^^^^^^^^^^^
error[E0308]: mismatched types
--> $DIR/missing-bounds.rs:11:11
|
7 | impl<B> Add for A<B> where B: Add {
| - this type parameter
...
11 | A(self.0 + rhs.0)
| ^^^^^^^^^^^^^^ expected type parameter `B`, found associated type
|
= note: expected type parameter `B`
found associated type `<B as std::ops::Add>::Output`
help: consider further restricting this bound
|
7 | impl<B> Add for A<B> where B: Add + std::ops::Add<Output = B> {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
error[E0369]: cannot add `B` to `B`
--> $DIR/missing-bounds.rs:31:21
|
31 | Self(self.0 + rhs.0)
| ------ ^ ----- B
| |
| B
|
help: consider restricting type parameter `B`
|
27 | impl<B: std::ops::Add<Output = B>> Add for D<B> {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
```
That output is given for the following cases:
```rust
struct A<B>(B);
impl<B> Add for A<B> where B: Add {
type Output = Self;
fn add(self, rhs: Self) -> Self {
A(self.0 + rhs.0) //~ ERROR mismatched types
}
}
struct D<B>(B);
impl<B> Add for D<B> {
type Output = Self;
fn add(self, rhs: Self) -> Self {
Self(self.0 + rhs.0) //~ ERROR cannot add `B` to `B`
}
}
struct E<B>(B);
impl<B: Add> Add for E<B> where <B as Add>::Output = B {
type Output = Self;
fn add(self, rhs: Self) -> Self {
Self(self.0 + rhs.0)
}
}
```
|
|
|
|
|
|
Ignore SGX on a few ui tests
cc @jethrogb
|
|
Define UB in float-to-int casts to saturate
This closes #10184 by defining the behavior there to saturate infinities and values exceeding the integral range (on the lower or upper end). `NaN` is sent to zero.
|
|
|
|
|