mirror of
https://github.com/servo/servo.git
synced 2025-10-02 17:49:16 +01:00
crown: Check closure bodies for unrooted types and fix root TransmitBodyPromise* (#39534)
We should also check closure bodies for unrooted expressions. Testing: New crown tests Fixes: #37331 Fixes (partial): #37330 --------- Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com>
This commit is contained in:
parent
6c062bbea8
commit
aaa7f83176
4 changed files with 42 additions and 7 deletions
14
support/crown/tests/compile-fail/unrooted_must_root_body.rs
Normal file
14
support/crown/tests/compile-fail/unrooted_must_root_body.rs
Normal file
|
@ -0,0 +1,14 @@
|
|||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
||||
//@rustc-env:RUSTC_BOOTSTRAP=1
|
||||
|
||||
#[crown::unrooted_must_root_lint::must_root]
|
||||
struct Foo(i32);
|
||||
|
||||
fn foo2() {
|
||||
let foo = Foo(0);
|
||||
//~^ ERROR: Expression of type Foo must be rooted
|
||||
}
|
||||
|
||||
fn main() {}
|
|
@ -0,0 +1,16 @@
|
|||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
||||
//@rustc-env:RUSTC_BOOTSTRAP=1
|
||||
|
||||
#[crown::unrooted_must_root_lint::must_root]
|
||||
struct Foo(i32);
|
||||
|
||||
fn foo2() {
|
||||
|| {
|
||||
let foo = Foo(0);
|
||||
//~^ ERROR: Expression of type Foo must be rooted
|
||||
};
|
||||
}
|
||||
|
||||
fn main() {}
|
Loading…
Add table
Add a link
Reference in a new issue