Open
Description
opened on Jan 8, 2024
I tried this code (issue code repo
(c1421faeeb9b8a2775d3ce460ee56e42064ea709)):
let unit = neu::ascii_alphabetic()
.or(neu::ascii_alphanumeric())
.or('_');
let ident = unit.repeat_one_more();
let ty = neu::ascii_alphabetic()
.or('_')
.repeat_one()
.then(ident)
.pat();
// compile about 25s+
let layer1 = ty
.then(ty.quote("<", ">"))
.map(|(w, ty)| Ok(Ty::Layer1(w, ty)));
let layer2 = ty
.then(ty.then(ty.quote("<", ">")).quote("<", ">"))
.map(|(w1, (w2, ty))| Ok(Ty::Layer2(w1, w2, ty)));
let layer0 = ty.map(|ty| Ok(Ty::Layer0(ty)));
let field = ident.sep_once(":", layer2.or(layer1.or(layer0)));
// let layer1 = ty
// .then(ty.quote("<", ">"))
// .map(|(w, ty)| Ok(Ty::Layer1(w, ty)));
// let layer0 = ty.map(|ty| Ok(Ty::Layer0(ty)));
// let field = ident.sep_once(":", layer1.or(layer0));
// comment 55 ~ 62 and uncomment current block, compile about 2s+
let public = field
.padded("pub")
.map(|(name, ty_name)| Ok(Field::public(name, ty_name)));
let private = field.map(|(name, ty_name)| Ok(Field::private(name, ty_name)));
let parser = public.or(private).sep(",");
let data = "abc: Option<i32>";
let b_policy = re_policy(neu::whitespace().repeat_full());
dbg!(PolicyCtx::new(CharsCtx::new(data), b_policy).ctor(&parser)?);
I expected to see this happen: compile in several seconds.
Instead, this happened: compile in 27s+.
Compiling api-gen v0.1.0 (E:\Rust\issue-example)
warning: field `public` is never read
--> src\main.rs:23:5
|
| ----- field in this struct
...
23 | public: bool,
| ^^^^^^
|
= note: `Field` has derived impls for the traits `Clone` and `Debug`, but these are intentionally ignored during dead code analysis
= note: `#[warn(dead_code)]` on by default
warning: `api-gen` (bin "api-gen") generated 1 warning
Finished dev [unoptimized + debuginfo] target(s) in 27.29s
neure
is a crate write for parsing string or binary data,
Meta
rustc --version --verbose
:
rustc 1.77.0-nightly (3cdd004e5 2023-12-29)
binary: rustc
commit-hash: 3cdd004e55c869faa2b7b25efd3becf50346e7d6
commit-date: 2023-12-29
host: x86_64-pc-windows-msvc
release: 1.77.0-nightly
LLVM version: 17.0.6
Metadata
Assignees
Labels
Area: Type systemCategory: This is a bug.Call for participation: This issue has a repro, but needs a Minimal Complete and Verifiable ExampleIssue: Problems and improvements with respect to compile times.Relevant to the compiler team, which will review and decide on the PR/issue.Relevant to the types team, which will review and decide on the PR/issue.
Activity