-
Notifications
You must be signed in to change notification settings - Fork 12.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
limit the length of types in monomorphization
This adds the new insta-stable `#![type_size_limit]` crate attribute to control the limit, and is obviously a [breaking-change] fixable by that.
- Loading branch information
Showing
9 changed files
with
137 additions
and
7 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
// Copyright 2016 The Rust Project Developers. See the COPYRIGHT | ||
// file at the top-level directory of this distribution and at | ||
// http://rust-lang.org/COPYRIGHT. | ||
// | ||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or | ||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license | ||
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your | ||
// option. This file may not be copied, modified, or distributed | ||
// except according to those terms. | ||
|
||
// error-pattern: reached the type-length limit while instantiating | ||
|
||
// Test that the type length limit can be changed. | ||
|
||
#![allow(dead_code)] | ||
#![type_length_limit="256"] | ||
|
||
macro_rules! link { | ||
($id:ident, $t:ty) => { | ||
pub type $id = ($t, $t, $t); | ||
} | ||
} | ||
|
||
link! { A, B } | ||
link! { B, C } | ||
link! { C, D } | ||
link! { D, E } | ||
link! { E, F } | ||
link! { F, G } | ||
|
||
pub struct G; | ||
|
||
fn main() { | ||
drop::<Option<A>>(None); | ||
} |
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,30 @@ | ||
// Copyright 2016 The Rust Project Developers. See the COPYRIGHT | ||
// file at the top-level directory of this distribution and at | ||
// http://rust-lang.org/COPYRIGHT. | ||
// | ||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or | ||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license | ||
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your | ||
// option. This file may not be copied, modified, or distributed | ||
// except according to those terms. | ||
|
||
trait Mirror { | ||
type Image; | ||
} | ||
|
||
impl<T> Mirror for T { type Image = T; } | ||
|
||
trait Foo { | ||
fn recurse(&self); | ||
} | ||
|
||
impl<T> Foo for T { | ||
#[allow(unconditional_recursion)] | ||
fn recurse(&self) { | ||
(self, self).recurse(); | ||
} | ||
} | ||
|
||
fn main() { | ||
().recurse(); | ||
} |
13 changes: 13 additions & 0 deletions
13
src/test/ui/issue-37311-type-length-limit/issue-37311.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,13 @@ | ||
error: reached the type-length limit while instantiating `<T as Foo><(&(&(&(&(&(&(&(&(&(&(&(&(&(&(&(&(&(&(&(), &()), &(&()...` | ||
--> $DIR/issue-37311.rs:23:5 | ||
| | ||
23 | fn recurse(&self) { | ||
| _____^ starting here... | ||
24 | | (self, self).recurse(); | ||
25 | | } | ||
| |_____^ ...ending here | ||
| | ||
= note: consider adding a `#![type_length_limit="2097152"]` attribute to your crate | ||
|
||
error: aborting due to previous error | ||
|