Skip to content

Commit b6c41d7

Browse files
authored
correct docs and code comments around the plrust.required_lints GUC (#341)
1 parent 30abdea commit b6c41d7

File tree

4 files changed

+18
-18
lines changed

4 files changed

+18
-18
lines changed

doc/src/config-lints.md

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,14 @@ these custom lints, PL/Rust uses some standard Rust lints to enforce safety.
1212

1313

1414
The `plrust.required_lints` GUC defines which lints must have been applied to a function before PL/Rust will load the
15-
library and execute the function. Using the `PLRUST_REQUIRED_LINTS` environment variable, it is possible to enforce
16-
that certain lints are always required of compiled functions, regardless of the `plrust.required_lints` GUC value.
17-
`PLRUST_REQUIRED_LINTS`'s format is a comma-separated list of lint named. It must be set in the environment in which
18-
Postgres is started. The intention here is that the system administrator can force certain lints for execution if for
19-
some reason `postgresql.conf` or the users able to modify it are not trusted.
15+
library and execute the function. The default value is the empty set -- PL/Rust will not require any specific lints to
16+
have been previously applied to a function.
17+
18+
Using the `PLRUST_REQUIRED_LINTS` environment variable, it is possible to enforce that certain lints are always required
19+
of compiled functions, regardless of the `plrust.required_lints` GUC value.`PLRUST_REQUIRED_LINTS`'s format is a
20+
comma-separated list of lint named. It must be set in the environment in which Postgres is started. The intention here
21+
is that the system administrator can force certain lints for execution if for some reason `postgresql.conf` or the users
22+
able to modify it are not trusted.
2023

2124

2225
In all cases, these lints are added to the generated code which wraps the user's `LANGUAGE plrust` function, as

doc/src/config-pg.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,5 +164,4 @@ plrust.compile_lints = 'plrust_extern_blocks, plrust_lifetime_parameterized_trai
164164

165165
A comma-separated list of Rust lints that are required to have been applied to a user function before PL/Rust will load the library and execute the function.
166166

167-
The value of `plrust.required_lints` defaults to `plrust.compile_lints`.
168167

plrust/src/gucs.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ pub(crate) fn init() {
9191
GucRegistry::define_string_guc(
9292
"plrust.required_lints",
9393
"A comma-separated list of Rust code lints that are required to have been applied to a PL/Rust user function before PL/Rust will execute it",
94-
"If unspecified, PL/Rust will use a set of defaults",
94+
"If unspecified, the default is the empty set",
9595
&PLRUST_REQUIRED_LINTS,
9696
GucContext::Sighup,
9797
GucFlags::default(),

plrust/src/lib.rs

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -13,16 +13,15 @@ Use of this source code is governed by the PostgreSQL license that can be found
1313
#[cfg(all(
1414
feature = "trusted",
1515
not(any(
16-
all(
17-
target_os = "linux",
18-
any(target_arch = "x86_64", target_arch = "aarch64")
19-
),
20-
all(
21-
target_os = "macos",
22-
any(target_arch = "x86_64", target_arch = "aarch64")
23-
)
16+
all(
17+
target_os = "linux",
18+
any(target_arch = "x86_64", target_arch = "aarch64")
19+
),
20+
all(
21+
target_os = "macos",
22+
any(target_arch = "x86_64", target_arch = "aarch64")
2423
)
25-
)
24+
))
2625
))]
2726
compile_error!("This platform does not support the 'trusted' version of plrust");
2827

@@ -76,8 +75,7 @@ $$;
7675
bootstrap
7776
);
7877

79-
/// This is the default set of lints we apply to PL/Rust user functions, and require of PL/Rust user
80-
/// functions before we'll load and execute them.
78+
/// This is the default set of lints we apply to PL/Rust user functions during compilation.
8179
///
8280
/// The defaults **can** be changed with the `plrust.compile_lints` and `plrust.required_lints` GUCS
8381
// Hello from the futurepast!

0 commit comments

Comments
 (0)