forked from rust-lang/rust
-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Auto merge of rust-lang#86226 - JohnTitor:rollup-5ubdolf, r=JohnTitor
Rollup of 7 pull requests Successful merges: - rust-lang#85800 (Fix some diagnostic issues with const_generics_defaults feature gate) - rust-lang#85823 (Do not suggest ampmut if rhs is already mutable) - rust-lang#86153 (Print dummy spans as `no-location`) - rust-lang#86174 (Detect incorrect vtable alignment during const eval) - rust-lang#86189 (Make `relate_type_and_mut` public) - rust-lang#86205 (Run full const-generics test for issue-72293) - rust-lang#86217 (Remove "generic type" in boxed.rs) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
- Loading branch information
Showing
24 changed files
with
152 additions
and
41 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
fn main() { | ||
let mut test = Vec::new(); | ||
let rofl: &Vec<Vec<i32>> = &mut test; | ||
//~^ HELP consider changing this to be a mutable reference | ||
rofl.push(Vec::new()); | ||
//~^ ERROR cannot borrow `*rofl` as mutable, as it is behind a `&` reference | ||
//~| NOTE `rofl` is a `&` reference, so the data it refers to cannot be borrowed as mutable | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
error[E0596]: cannot borrow `*rofl` as mutable, as it is behind a `&` reference | ||
--> $DIR/issue-85765.rs:5:5 | ||
| | ||
LL | let rofl: &Vec<Vec<i32>> = &mut test; | ||
| ---- help: consider changing this to be a mutable reference: `&mut Vec<Vec<i32>>` | ||
LL | | ||
LL | rofl.push(Vec::new()); | ||
| ^^^^ `rofl` is a `&` reference, so the data it refers to cannot be borrowed as mutable | ||
|
||
error: aborting due to previous error | ||
|
||
For more information about this error, try `rustc --explain E0596`. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
5 changes: 5 additions & 0 deletions
5
src/test/ui/const-generics/defaults/param-order-err-pretty-prints-default.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
#![feature(const_generics_defaults)] | ||
struct Foo<const M: usize = 10, 'a>(&'a u32); | ||
//~^ Error lifetime parameters must be declared prior to const parameters | ||
|
||
fn main() {} |
8 changes: 8 additions & 0 deletions
8
src/test/ui/const-generics/defaults/param-order-err-pretty-prints-default.stderr
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
error: lifetime parameters must be declared prior to const parameters | ||
--> $DIR/param-order-err-pretty-prints-default.rs:2:33 | ||
| | ||
LL | struct Foo<const M: usize = 10, 'a>(&'a u32); | ||
| ----------------------^^- help: reorder the parameters: lifetimes, then consts and types: `<'a, const M: usize = 10>` | ||
|
||
error: aborting due to previous error | ||
|
10 changes: 0 additions & 10 deletions
10
src/test/ui/const-generics/min_const_generics/transmute-const-param-static-reference.rs
This file was deleted.
Oops, something went wrong.
2 changes: 1 addition & 1 deletion
2
...smute-const-param-static-reference.stderr → ...e-const-param-static-reference.min.stderr
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
16 changes: 16 additions & 0 deletions
16
src/test/ui/const-generics/transmute-const-param-static-reference.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
// revisions: full min | ||
//[full] check-pass | ||
|
||
#![cfg_attr(full, feature(const_generics))] | ||
#![cfg_attr(full, allow(incomplete_features))] | ||
|
||
struct Const<const P: &'static ()>; | ||
//[min]~^ ERROR `&'static ()` is forbidden as the type of a const generic parameter | ||
|
||
fn main() { | ||
const A: &'static () = unsafe { | ||
std::mem::transmute(10 as *const ()) | ||
}; | ||
|
||
let _ = Const::<{A}>; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
// This test contains code with incorrect vtables in a const context: | ||
// - from issue 86132: a trait object with invalid alignment caused an ICE in const eval, and now | ||
// triggers an error | ||
// - a similar test that triggers a previously-untested const UB error: emitted close to the above | ||
// error, it checks the correctness of the size | ||
|
||
trait Trait {} | ||
|
||
const INVALID_VTABLE_ALIGNMENT: &dyn Trait = | ||
unsafe { std::mem::transmute((&92u8, &[0usize, 1usize, 1000usize])) }; | ||
//~^ ERROR any use of this value will cause an error | ||
//~| WARNING this was previously accepted by the compiler | ||
//~| invalid vtable: alignment `1000` is not a power of 2 | ||
|
||
const INVALID_VTABLE_SIZE: &dyn Trait = | ||
unsafe { std::mem::transmute((&92u8, &[1usize, usize::MAX, 1usize])) }; | ||
//~^ ERROR any use of this value will cause an error | ||
//~| WARNING this was previously accepted by the compiler | ||
//~| invalid vtable: size is bigger than largest supported object | ||
|
||
fn main() {} |
Oops, something went wrong.